@objectstack/account 7.4.1 → 7.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -36,7 +36,7 @@ Tip: a local app already owns this manifest_id. Remove it from objectstack.confi
|
|
|
36
36
|
The cached manifest will be removed. The app will remain loaded in the running kernel until the next restart.`,successInList:`Removed {{manifestId}}. Restart the runtime to fully unload it from the running kernel.`,successInDetail:`Removed cached manifest for {{manifestId}}. Restart the runtime to fully unload the app from the running kernel.`},accessDenied:{title:`App Marketplace is admin-only`,description:`You don't have permission to install apps in this environment. Ask an owner or admin of this organization for access.`},category:{crm:`CRM`,erp:`ERP`,hr:`Human Resources`,finance:`Finance`,project:`Project Management`,collaboration:`Collaboration`,analytics:`Analytics`,integration:`Integration`,automation:`Automation`,ai:`AI`,security:`Security`,"developer-tools":`Developer Tools`,"ui-theme":`UI Theme`,storage:`Storage`,other:`Other`},pricing:{free:`Free`,freemium:`Freemium`,paid:`Paid`,subscription:`Subscription`,"usage-based":`Usage-based`,"contact-sales":`Contact Sales`},relativeTime:{today:`today`,daysAgo:`{{count}}d ago`,monthsAgo:`{{count}}mo ago`,yearsAgo:`{{count}}y ago`}}},ar:{common:{addToFavorites:`إضافة إلى المفضلة`,removeFromFavorites:`إزالة من المفضلة`,loading:`جاري التحميل...`,save:`حفظ`,cancel:`إلغاء`,delete:`حذف`,edit:`تعديل`,create:`إنشاء`,search:`بحث`,filter:`تصفية`,reset:`إعادة تعيين`,confirm:`تأكيد`,close:`إغلاق`,back:`رجوع`,next:`التالي`,previous:`السابق`,submit:`إرسال`,refresh:`تحديث`,export:`تصدير`,import:`استيراد`,yes:`نعم`,no:`لا`,ok:`موافق`,actions:`إجراءات`,more:`المزيد`,selectAll:`تحديد الكل`,clearAll:`مسح الكل`,noData:`لا توجد بيانات`,noResults:`لم يتم العثور على نتائج`,required:`مطلوب`,optional:`اختياري`,selectOption:`اختر خياراً`,select:`اختر...`,openChat:`فتح المحادثة`,closeChat:`إغلاق المحادثة`,toggleSidebar:`تبديل الشريط الجانبي`},validation:{required:`{{field}} مطلوب`,minLength:`{{field}} يجب أن يكون {{min}} حرفاً على الأقل`,maxLength:`{{field}} يجب ألا يتجاوز {{max}} حرفاً`,min:`{{field}} يجب أن يكون {{min}} على الأقل`,max:`{{field}} يجب ألا يتجاوز {{max}}`,email:`يرجى إدخال بريد إلكتروني صالح`,url:`يرجى إدخال رابط صالح`,pattern:`صيغة {{field}} غير صالحة`,unique:`{{field}} يجب أن يكون فريداً`,type:`{{field}} يجب أن يكون {{type}} صالحاً`},form:{addItem:`إضافة عنصر`,removeItem:`إزالة عنصر`,fieldRequired:`هذا الحقل مطلوب`,invalidFormat:`صيغة غير صالحة`,saveSuccess:`تم الحفظ بنجاح`,saveError:`فشل في الحفظ`,unsavedChanges:`لديك تغييرات غير محفوظة. هل أنت متأكد أنك تريد المغادرة؟`,stepOf:`الخطوة {{current}} من {{total}}`,createTitle:`إنشاء {{object}}`,editTitle:`تعديل {{object}}`,createDescription:`إضافة {{object}} جديد إلى قاعدة البيانات.`,editDescription:`تحديث تفاصيل {{object}}`,saveRecord:`حفظ السجل`},fields:{richText:{format:`Format: {{format}}`,basicEditorHint:`Rich text editor (basic)`,placeholder:`Enter text...`}},table:{rowsPerPage:`صفوف في الصفحة`,showing:`عرض {{from}} إلى {{to}} من {{total}}`,noRows:`لا توجد صفوف للعرض`,sortAsc:`ترتيب تصاعدي`,sortDesc:`ترتيب تنازلي`,filterColumn:`تصفية {{column}}`,columns:`الأعمدة`,exportCSV:`تصدير CSV`,exportExcel:`تصدير Excel`,selectRow:`تحديد صف`,selectAllRows:`تحديد جميع الصفوف`,expandRow:`توسيع الصف`,collapseRow:`طي الصف`,hideColumn:`إخفاء العمود`,freezeColumn:`تجميد العمود`,unfreezeColumn:`إلغاء تجميد العمود`,pageInfo:`صفحة {{current}} من {{total}}`,totalRecords:`{{count}} إجمالي`},grid:{actions:`إجراءات`,edit:`تعديل`,delete:`حذف`,export:`تصدير`,exportAs:`تصدير كـ {{format}}`,loading:`جاري تحميل الشبكة...`,errorLoading:`خطأ في تحميل الشبكة`,pullToRefresh:`اسحب للتحديث`,refreshing:`جاري التحديث…`,openRecord:`فتح السجل`,rowHeight:`ارتفاع الصف: {{mode}}`},calendar:{today:`اليوم`,month:`شهر`,week:`أسبوع`,day:`يوم`,agenda:`جدول أعمال`,allDay:`طوال اليوم`,noEvents:`لا توجد أحداث`,newEvent:`حدث جديد`,moreEvents:`+{{count}} المزيد`},list:{recordCount:`{{count}} سجلات`,recordCountOne:`{{count}} سجل`,addRecord:`إضافة سجل`,tabs:`علامات التبويب`,allRecords:`جميع السجلات`,search:`بحث`,filter:`تصفية`,filterRecords:`تصفية السجلات`,sort:`ترتيب`,sortRecords:`ترتيب السجلات`,group:`تجميع`,groupBy:`تجميع حسب`,export:`تصدير`,exportAs:`تصدير كـ {{format}}`,color:`لون`,rowColor:`لون الصف`,colorByField:`تلوين حسب الحقل`,clear:`مسح`,none:`لا شيء`,hideFields:`إخفاء الحقول`,noItems:`لم يتم العثور على عناصر`,noItemsMessage:`لا توجد سجلات للعرض. حاول تعديل الفلاتر أو إضافة بيانات جديدة.`},kanban:{addCard:`إضافة بطاقة`,addColumn:`إضافة عمود`,moveCard:`نقل بطاقة`,deleteCard:`حذف بطاقة`,deleteColumn:`حذف عمود`},timeline:{bucket:{overdue:`متأخر`,today:`اليوم`,tomorrow:`غداً`,thisWeek:`هذا الأسبوع`,nextWeek:`الأسبوع القادم`,later:`لاحقاً`,noDate:`بدون تاريخ`,unassigned:`غير معين`}},gantt:{column:{taskName:`Task Name`,start:`Start`,end:`End`},toolbar:{prevPeriod:`Previous period`,nextPeriod:`Next period`,zoomIn:`Zoom in`,zoomOut:`Zoom out`,jumpToToday:`Jump to today`,today:`Today`,showTaskList:`Show task list`,hideTaskList:`Hide task list`}},view:{rename:`إعادة تسمية`,duplicateView:`تكرار العرض`,shareView:`مشاركة العرض`,setAsDefault:`تعيين كافتراضي`,pinView:`تثبيت العرض`,unpinView:`إلغاء تثبيت العرض`,changeViewType:`تغيير نوع العرض`,deleteView:`حذف العرض`,addView:`إضافة عرض`,unsavedChanges:`تغييرات غير محفوظة`,saveAsView:`حفظ كعرض`,moreViews:`{{count}} المزيد`,activeFilters:`الفلاتر نشطة`,activeSort:`الترتيب نشط`},detail:{back:`رجوع`,edit:`تحرير`,editInline:`تحرير`,save:`حفظ`,saveChanges:`حفظ التغييرات`,editFieldsInline:`تحرير الحقول`,share:`مشاركة`,duplicate:`نسخ`,export:`تصدير`,viewHistory:`عرض السجل`,delete:`حذف`,moreActions:`المزيد من الإجراءات`,addToFavorites:`إضافة إلى المفضلة`,removeFromFavorites:`إزالة من المفضلة`,previousRecord:`السجل السابق`,nextRecord:`السجل التالي`,recordOf:`{{current}} من {{total}}`,recordNotFound:`لم يتم العثور على السجل`,recordNotFoundDescription:`السجل الذي تبحث عنه غير موجود أو ربما تم حذفه.`,goBack:`رجوع`,details:`التفاصيل`,related:`ذات صلة`,relatedRecords:`{{count}} سجلات`,relatedRecordOne:`{{count}} سجل`,noRelatedRecords:`لا توجد سجلات ذات صلة`,loading:`جاري التحميل...`,copyToClipboard:`نسخ إلى الحافظة`,copied:`تم النسخ!`,deleteConfirmation:`هل أنت متأكد أنك تريد حذف هذا السجل؟`,editRecord:`تحرير السجل`,viewAll:`عرض الكل`,new:`جديد`,emptyValue:`—`,comments:`التعليقات`,searchComments:`البحث في التعليقات…`,addCommentPlaceholder:`أضف تعليقاً… (Ctrl+Enter للإرسال)`,noMatchingComments:`لا توجد تعليقات مطابقة`,noCommentsYet:`لا توجد تعليقات بعد`,pinned:`مثبت`,pin:`تثبيت`,unpin:`إلغاء التثبيت`,justNow:`الآن`,minutesAgo:`منذ {{count}} دقيقة`,hoursAgo:`منذ {{count}} ساعة`,daysAgo:`منذ {{count}} يوم`,dropFilesToUpload:`اسحب الملفات هنا أو انقر للرفع`,attachmentCount:`{{count}} مرفق`,attachmentCountPlural:`{{count}} مرفقات`,removeAttachment:`إزالة المرفق`,unifiedDiff:`عرض موحد`,sideBySideDiff:`عرض جنباً إلى جنب`,noChanges:`لا توجد تغييرات`,previousVersion:`السابق`,currentVersion:`الحالي`,discussion:`المناقشة`,showDiscussion:`إظهار المناقشة ({{count}})`,hideDiscussion:`إخفاء المناقشة`,bold:`غامق (Ctrl+B)`,italic:`مائل (Ctrl+I)`,listFormat:`قائمة`,inlineCode:`كود مضمن`,mentionSomeone:`إشارة إلى شخص`,preview:`معاينة`,submitComment:`إرسال (Ctrl+Enter)`,sendComment:`إرسال`,writeComment:`اكتب تعليقاً…`,subscribedTooltip:`مشترك — انقر لإلغاء الاشتراك`,unsubscribedTooltip:`الاشتراك في الإشعارات`,firstRecord:`السجل الأول (Home)`,previousRecordKey:`السجل السابق (←)`,nextRecordKey:`السجل التالي (→)`,lastRecord:`السجل الأخير (End)`,noRecords:`لا توجد سجلات`,searchWhileNavigating:`البحث أثناء التصفح`,searchRecords:`البحث في السجلات…`,allActivity:`كل النشاط`,commentsOnly:`التعليقات فقط`,fieldChangesFilter:`تغييرات الحقول`,tasksOnly:`المهام فقط`,leaveCommentPlaceholder:`اترك تعليقاً… (Ctrl+Enter للإرسال)`,noActivity:`لا يوجد نشاط مسجل`,loadMore:`تحميل المزيد`,edited:`(معدل)`,via:`عبر {{source}}`,replyCount:`{{count}} رد`,replyCountPlural:`{{count}} ردود`,replyPlaceholder:`رد…`,filterActivity:`تصفية النشاط`,openDiscussion:`فتح لوحة المناقشة`,closeDiscussion:`إغلاق لوحة المناقشة`,subscribeAriaLabel:`الاشتراك في الإشعارات`,unsubscribeAriaLabel:`إلغاء الاشتراك من الإشعارات`,clearSearch:`مسح البحث`},chart:{noData:`لا تتوفر بيانات للرسم البياني`,loading:`جاري تحميل الرسم البياني...`},map:{searchLocations:`البحث عن المواقع…`,locationDetails:`تفاصيل الموقع`,markersCount:`{{count}} علامة`,invalidCoordinates:`{{count}} سجل بإحداثيات مفقودة أو غير صالحة مستبعد من الخريطة.`,invalidCoordinatesPlural:`{{count}} سجلات بإحداثيات مفقودة أو غير صالحة مستبعدة من الخريطة.`},workflow:{draft:`مسودة`,active:`نشط`,paused:`متوقف مؤقتاً`,completed:`مكتمل`,cancelled:`ملغي`,save:`حفظ`,publish:`نشر`,addNode:`إضافة عقدة`,workflowFlow:`سير العمل`,properties:`الخصائص`,connections:`الاتصالات`,quickConnect:`اتصال سريع`,fromPlaceholder:`من...`,toPlaceholder:`إلى...`,connect:`ربط`,label:`التسمية`,type:`النوع`,description:`الوصف`,assignee:`المسؤول`,assigneeType:`نوع المسؤول`,user:`مستخدم`,role:`دور`,group:`مجموعة`,expression:`تعبير`,timeoutMinutes:`المهلة (دقائق)`,selectNodeToEdit:`حدد عقدة لتعديل خصائصها`,workflowTitle:`عنوان سير العمل`,newWorkflow:`سير عمل جديد`,outConnections:`{{count}} مخرج`,start:`بداية`,end:`نهاية`,task:`مهمة`,userTask:`مهمة مستخدم`,serviceTask:`مهمة خدمة`,scriptTask:`مهمة نصية`,approval:`موافقة`,condition:`شرط`,parallelGateway:`بوابة متوازية`,joinGateway:`بوابة دمج`,boundaryEvent:`حدث حدودي`,delay:`تأخير`,notification:`إشعار`,webhook:`Webhook`,allowConcurrency:`السماح (تنفيذ متزامن)`,forbidConcurrency:`منع (تخطي الجديد)`,replaceConcurrency:`استبدال (إلغاء الحالي)`,queueConcurrency:`طابور (تنفيذ بعد الحالي)`,conditionEvent:`شرط`,manualEvent:`يدوي`,webhookEvent:`Webhook`,timerEvent:`مؤقت`,signalEvent:`إشارة`,versionHistory:`تاريخ الإصدارات`,importBpmn:`استيراد BPMN`,exportBpmn:`تصدير BPMN`,undo:`تراجع`,redo:`إعادة`,resetZoom:`إعادة تعيين التكبير`},dashboard:{addWidget:`إضافة أداة`,removeWidget:`إزالة أداة`,editLayout:`تعديل التخطيط`,saveLayout:`حفظ التخطيط`,resetLayout:`إعادة تعيين التخطيط`},configPanel:{save:`حفظ`,discard:`تجاهل`,close:`إغلاق`,layout:`التخطيط`,columns:`الأعمدة`,gap:`المسافة`,rowHeight:`ارتفاع الصف`,data:`البيانات`,refreshInterval:`فترة التحديث`,appearance:`المظهر`,title:`العنوان`,showDescription:`إظهار الوصف`,theme:`السمة`,configuration:`الإعداد`,general:`عام`,advanced:`متقدم`},appDesigner:{createApp:`Create Application`,editApp:`Edit Application`,basicInfo:`Basic Info`,objects:`Objects`,navigation:`Navigation`,branding:`Branding`,appName:`App Name`,appTitle:`Title`,appDescription:`Description`,appIcon:`Icon`,template:`Template`,layout:`Layout`,layoutSidebar:`Sidebar`,layoutHeader:`Header`,layoutEmpty:`Empty`,selectObjects:`Select Objects`,searchObjects:`Search objects…`,selectAll:`Select All`,deselectAll:`Deselect All`,navBuilder:`Navigation Builder`,addGroup:`Add Group`,addUrl:`Add URL`,addSeparator:`Add Separator`,noNavItems:`No navigation items yet.`,logoUrl:`Logo URL`,primaryColor:`Primary Color`,faviconUrl:`Favicon URL`,preview:`Preview`,complete:`Complete`,snakeCaseHint:`Must be snake_case (e.g. my_app)`,modeEdit:`Edit`,modePreview:`Preview`,modeCode:`Code`,addWidget:`Add Widget`,widgetProperties:`Widget Properties`,dataSource:`Data Source`,valueField:`Value Field`,aggregate:`Aggregate`,colorVariant:`Color Variant`,addComponent:`Add Component`,componentProperties:`Component Properties`,viewType:`View Type`,fields:`Fields`,toolbar:`Toolbar`,showSearch:`Show Search`,showFilters:`Show Filters`,showSort:`Show Sort`,appearance:`Appearance`,rowHeight:`Row Height`,stripedRows:`Striped Rows`,bordered:`Bordered`,livePreview:`Live Preview`,stepBasicDesc:`الاسم والعنوان والتخطيط`,stepObjectsDesc:`اختيار كائنات الأعمال`,stepNavigationDesc:`بناء شجرة التنقل`,stepBrandingDesc:`الشعار والألوان والأيقونة`,noObjectsFound:`لم يتم العثور على كائنات.`,noNavItemsHint:`لا توجد عناصر تنقل بعد. حدد كائنات في الخطوة السابقة أو أضف عناصر يدويًا.`,separator:`فاصل`,separatorLabel:`— فاصل —`,newGroup:`مجموعة جديدة`,newLink:`رابط جديد`,saveDraft:`حفظ المسودة`,cancelConfirmTitle:`تجاهل التغييرات؟`,cancelConfirmMessage:`لديك تغييرات غير محفوظة. هل أنت متأكد من الإلغاء؟`,confirmDiscard:`تجاهل`,keepEditing:`متابعة التحرير`,navNoItems:`لا توجد عناصر تنقل. انقر على الأزرار أعلاه لإضافة عناصر.`,navNoPreviewItems:`لا توجد عناصر`,navLivePreview:`معاينة مباشرة`,navCollapseGroup:`طي المجموعة`,navExpandGroup:`توسيع المجموعة`,navAddChild:`إضافة عنصر فرعي`,navMoveUp:`نقل لأعلى`,navMoveDown:`نقل لأسفل`,navRemove:`إزالة`,navObjectPage:`صفحة الكائن`,navDashboard:`لوحة القيادة`,navPage:`صفحة`,navReport:`تقرير`,navGroup:`مجموعة`,navUrl:`رابط`,navSeparator:`فاصل`,navTypeObject:`كائن`,navTypeDashboard:`لوحة القيادة`,navTypePage:`صفحة`,navTypeReport:`تقرير`,navTypeUrl:`رابط`,navTypeGroup:`مجموعة`,navTypeSeparator:`فاصل`,navTypeAction:`إجراء`,navEditIcon:`تعديل الأيقونة`,navToggleVisible:`تبديل الظهور`,navHidden:`مخفي`,navExportSchema:`تصدير JSON`,navImportSchema:`استيراد JSON`,navExportSuccess:`تم تصدير هيكل التنقل`,navImportSuccess:`تم استيراد هيكل التنقل`,navImportError:`ملف JSON تنقل غير صالح`,navIconPlaceholder:`اسم الأيقونة (مثل Users)`,dashboardEditor:`محرر لوحة المعلومات`,noWidgets:`لا توجد عناصر. انقر على زر أعلاه لإضافة واحد.`,widgetLayoutSize:`حجم التخطيط`,widgetWidth:`العرض`,widgetHeight:`الارتفاع`,dashboardPreview:`معاينة لوحة المعلومات`,noWidgetsPreview:`لا توجد عناصر للمعاينة`,pageCanvasEditor:`محرر لوحة الصفحة`,emptyPage:`صفحة فارغة. انقر على زر أعلاه لإضافة مكون.`,pagePreview:`معاينة الصفحة`,noComponentsPreview:`لا توجد مكونات للمعاينة`,modePage:`صفحة`,modeDashboard:`لوحة المعلومات`,undo:`تراجع`,redo:`إعادة`,brandingEditor:`محرر العلامة التجارية`,brandingExport:`تصدير JSON`,brandingImport:`استيراد JSON`,brandingPreview:`معاينة`,brandingSampleButton:`زر نموذجي`,brandingSampleText:`هكذا سيبدو موضوع علامتك التجارية.`,colorPalette:`لوحة الألوان`,fontFamily:`الخط`,fontDefault:`افتراضي (النظام)`,modeLight:`فاتح`,modeDark:`داكن`,mobilePreview:`معاينة الجوال`,objectManager:{title:`مدير الكائنات`,addObject:`كائن جديد`,searchPlaceholder:`بحث عن كائنات…`,noObjects:`لم يتم العثور على كائنات.`,objectName:`اسم API`,objectLabel:`التسمية`,pluralLabel:`التسمية الجمعية`,icon:`الأيقونة`,selectIcon:`اختيار أيقونة…`,group:`المجموعة`,noGroup:`بدون مجموعة`,sortOrder:`ترتيب الفرز`,enabled:`مفعّل`,relationships:`العلاقات`,systemBadge:`نظام`,fieldCount:`{{count}} حقول`,ungrouped:`غير مصنف`,deleteConfirmTitle:`حذف الكائن؟`,deleteConfirmMessage:`سيتم حذف الكائن وجميع حقوله نهائيًا. لا يمكن التراجع عن هذا الإجراء.`},fieldDesigner:{title:`مصمم الحقول`,addField:`حقل جديد`,searchPlaceholder:`بحث عن حقول…`,allTypes:`كل الأنواع`,noFields:`لم يتم العثور على حقول.`,fieldName:`اسم API`,fieldLabel:`التسمية`,fieldType:`النوع`,fieldGroup:`المجموعة`,description:`الوصف`,required:`مطلوب`,unique:`فريد`,readOnly:`للقراءة فقط`,hidden:`مخفي`,indexed:`مفهرس`,externalId:`معرف خارجي`,trackHistory:`تتبع السجل`,defaultValue:`القيمة الافتراضية`,placeholder:`نص توضيحي`,referenceTo:`مرجع إلى`,formula:`صيغة`,options:`خيارات`,addOption:`إضافة خيار`,validationRules:`قواعد التحقق`,addRule:`إضافة قاعدة`,systemBadge:`نظام`,ungrouped:`عام`,deleteConfirmTitle:`حذف الحقل؟`,deleteConfirmMessage:`سيتم حذف الحقل نهائيًا. ستفقد البيانات الموجودة في هذا الحقل.`}},console:{title:`وحدة تحكم ObjectStack`,initializing:`جاري تهيئة التطبيق...`,breadcrumb:{dashboards:`لوحات المعلومات`,pages:`الصفحات`,reports:`التقارير`,system:`النظام`},loadingSteps:{connecting:`جاري الاتصال بمصدر البيانات`,loadingConfig:`جاري تحميل الإعدادات`,preparingWorkspace:`جاري تجهيز مساحة العمل`},error:{connectionFailed:`تعذّر الاتصال بالخادم`,serverUnreachable:`الخادم {{url}} غير قابل للوصول.`,checkServer:`يرجى التحقق من اتصال الشبكة أو من تشغيل الواجهة الخلفية.`,timeout:`انتهت مهلة الاتصال بعد 10 ثوانٍ.`},actions:{retry:`إعادة المحاولة`,retrying:`جاري إعادة المحاولة…`},shortcuts:{title:`اختصارات لوحة المفاتيح`,description:`مرجع سريع لجميع اختصارات لوحة المفاتيح المتاحة.`,groups:{general:`عام`,navigation:`التنقل`,dataViews:`عروض البيانات`,preferences:`التفضيلات`},openCommandPalette:`فتح لوحة الأوامر`,showShortcuts:`عرض اختصارات لوحة المفاتيح`,closeDialog:`إغلاق النافذة / اللوحة`,toggleSidebar:`تبديل الشريط الجانبي`,focusSearch:`التركيز على البحث`,createRecord:`إنشاء سجل جديد`,refreshData:`تحديث البيانات`,editRecord:`تعديل السجل المحدد`,toggleDarkMode:`تبديل الوضع الداكن`},commandPalette:{placeholder:`اكتب أمراً أو ابحث...`,noResults:`لم يتم العثور على نتائج.`,objects:`الكائنات`,dashboards:`لوحات المعلومات`,pages:`الصفحات`,reports:`التقارير`,switchApp:`تبديل التطبيق`,current:`الحالي`,preferences:`التفضيلات`,lightTheme:`المظهر الفاتح`,darkTheme:`المظهر الداكن`,systemTheme:`مظهر النظام`,actions:`الإجراءات`,openFullSearch:`فتح صفحة البحث الكاملة`,createApp:`إنشاء تطبيق جديد`},errors:{somethingWentWrong:`حدث خطأ ما`,unexpectedError:`حدث خطأ غير متوقع أثناء عرض هذا المحتوى.`,tryAgain:`إعادة المحاولة`,goHome:`العودة للرئيسية`,errorDetails:`تفاصيل الخطأ (وضع التطوير فقط)`},theme:{toggle:`تبديل المظهر`,light:`فاتح`,dark:`داكن`,system:`النظام`},objectView:{objectNotFound:`الكائن غير موجود`,objectNotFoundDescription:`الكائن "{{objectName}}" غير موجود في الإعدادات الحالية.`,objectNotFoundHint:`تحقق من إعدادات التنقل في تطبيقك أو اختر كائنًا آخر من الشريط الجانبي.`,allRecords:`جميع السجلات`,exitDesignMode:`الخروج من وضع التصميم`,enterDesignMode:`الدخول إلى وضع التصميم`,metadataInspector:`مفتش البيانات الوصفية`,editView:`تعديل العرض`,addView:`إضافة عرض`,designTools:`أدوات التصميم`,new:`جديد`,configureView:`تكوين العرض`,closePanel:`إغلاق اللوحة`,page:`الصفحة`,pageConfigHint:`شريط الأدوات والتنقل وإعدادات غلاف العرض`,listConfigHint:`عرض البيانات والأعمدة والمظهر لهذا النوع من القائمة`,general:`عام`,generalHint:`عنوان العرض والوصف والنوع`,toolbar:`شريط الأدوات`,toolbarHint:`البحث والتصفية والفرز والتجميع ومفاتيح الكثافة`,toolbarEnabledCount:`{{count}} من {{total}} مفعّل`,navigationSection:`التنقل`,navigationHint:`سلوك النقر على الصف وإعدادات العرض التفصيلي`,records:`السجلات`,recordsHint:`وضع التحديد وإضافة سجل والتحرير المباشر`,exportPrint:`التصدير والطباعة`,exportPrintHint:`صيغ التصدير والطباعة وعرض عدد السجلات`,showAllFields:`إظهار الكل`,hideAllFields:`إخفاء الكل`,searchFields:`البحث في الحقول...`,title:`العنوان`,description:`الوصف`,data:`البيانات`,source:`المصدر`,columns:`الأعمدة`,filterBy:`تصفية حسب`,sortBy:`ترتيب حسب`,appearance:`المظهر`,showDescription:`عرض الوصف`,viewType:`نوع العرض`,userFilters:`مرشحات المستخدم`,enableSearch:`تفعيل البحث`,enableFilter:`تفعيل التصفية`,enableSort:`تفعيل الترتيب`,enableHideFields:`تفعيل إخفاء الحقول`,enableGroup:`تفعيل التجميع`,enableColor:`تفعيل اللون`,enableDensity:`تفعيل الكثافة`,userActions:`إجراءات المستخدم`,addRecordViaForm:`إضافة سجلات عبر النموذج`,advanced:`متقدم`,allowExport:`السماح بالتصدير`,recordCount:`{{count}} سجل`,noDescription:`لا يوجد وصف`,none:`لا شيء`,columnsConfigured:`{{count}} أعمدة`,save:`حفظ`,discard:`تجاهل`,createView:`إنشاء عرض`,newView:`عرض جديد`,typeOptions:`خيارات النوع`,groupByField:`حقل التجميع`,startDateField:`حقل تاريخ البدء`,titleField:`حقل العنوان`,latitudeField:`حقل خط العرض`,longitudeField:`حقل خط الطول`,imageField:`حقل الصورة`,dateField:`حقل التاريخ`,selectField:`اختر حقلاً...`,gridOptionsHint:`يستخدم عرض الشبكة الأعمدة المكونة أعلاه.`,groupBy:`تجميع حسب`,prefixField:`حقل البادئة`,fields:`الحقول`,fieldsVisible:`{{count}} مرئي`,sortsCount:`{{count}} ترتيبات`,filtersCount:`{{count}} مرشحات`,endDateField:`حقل تاريخ الانتهاء`,color:`اللون`,fieldTextColor:`لون نص الحقل`,rowHeight:`ارتفاع الصف`,wrapHeaders:`التفاف العناوين`,showFieldDescriptions:`إظهار أوصاف الحقول`,collapseAllByDefault:`طي الكل افتراضياً`,striped:`صفوف مخططة`,bordered:`خلايا محاطة بحدود`,inlineEdit:`تحرير السجلات مباشرة`,addDeleteRecordsInline:`إضافة/حذف السجلات مباشرة`,clickIntoRecordDetails:`انقر لعرض تفاصيل السجل`,navigationMode:`وضع التنقل`,navigationWidth:`عرض التنقل`,navigationWidthHint:`متاح لأوضاع التنقل: الدرج والنافذة المنبثقة والعرض المقسم`,openNewTab:`فتح في علامة تبويب جديدة`,openNewTabHint:`متاح لأوضاع التنقل: الصفحة والنافذة الجديدة`},localeSwitcher:{label:`اللغة`}},auth:{login:{title:`تسجيل الدخول إلى حسابك`,description:`أدخل بريدك الإلكتروني وكلمة المرور للمتابعة`,emailLabel:`البريد الإلكتروني`,emailPlaceholder:`name@example.com`,passwordLabel:`كلمة المرور`,passwordPlaceholder:`أدخل كلمة المرور`,forgotPasswordText:`نسيت كلمة المرور؟`,submitButton:`تسجيل الدخول`,submittingButton:`جارٍ تسجيل الدخول...`,noAccountText:`ليس لديك حساب؟`,signUpText:`إنشاء حساب`},register:{title:`إنشاء حساب`,description:`أدخل معلوماتك للبدء`,nameLabel:`الاسم`,namePlaceholder:`محمد أحمد`,emailLabel:`البريد الإلكتروني`,emailPlaceholder:`name@example.com`,passwordLabel:`كلمة المرور`,passwordPlaceholder:`إنشاء كلمة مرور (8 أحرف على الأقل)`,confirmPasswordLabel:`تأكيد كلمة المرور`,confirmPasswordPlaceholder:`أكّد كلمة المرور`,passwordMismatchError:`كلمتا المرور غير متطابقتين`,passwordTooShortError:`يجب أن تتكون كلمة المرور من 8 أحرف على الأقل`,submitButton:`إنشاء حساب`,submittingButton:`جارٍ إنشاء الحساب...`,hasAccountText:`لديك حساب بالفعل؟`,signInText:`تسجيل الدخول`},forgotPassword:{title:`إعادة تعيين كلمة المرور`,description:`أدخل عنوان بريدك الإلكتروني وسنرسل لك رابطًا لإعادة تعيين كلمة المرور`,emailLabel:`البريد الإلكتروني`,emailPlaceholder:`name@example.com`,submitButton:`إرسال رابط إعادة التعيين`,submittingButton:`جارٍ الإرسال...`,successTitle:`تحقق من بريدك الإلكتروني`,successDescription:`لقد أرسلنا رابط إعادة تعيين كلمة المرور إلى {{email}}. يرجى التحقق من بريدك الوارد.`,backToSignInText:`العودة إلى تسجيل الدخول`,rememberPasswordText:`تتذكر كلمة المرور؟`,signInText:`تسجيل الدخول`}},errors:{networkError:`خطأ في الشبكة. يرجى التحقق من اتصالك.`,serverError:`خطأ في الخادم. يرجى المحاولة مرة أخرى لاحقاً.`,notFound:`المورد غير موجود.`,unauthorized:`ليس لديك صلاحية لتنفيذ هذا الإجراء.`,forbidden:`تم رفض الوصول.`,timeout:`انتهت مهلة الطلب. يرجى المحاولة مرة أخرى.`,unknown:`حدث خطأ غير متوقع.`},workspace:{label:`مساحات العمل`,default:`مساحة العمل الخاصة بي`,switch:`تبديل مساحة العمل`,create:`إنشاء مساحة عمل`,createTitle:`إنشاء مساحة عمل`,createDescription:`مساحة العمل هي مساحة مشتركة لفريقك للتعاون.`,createButton:`إنشاء مساحة عمل`,nameLabel:`اسم مساحة العمل`,namePlaceholder:`مثلاً، Acme Inc`,slugLabel:`معرف URL`,slugHint:`يستخدم في عناوين URL. أحرف صغيرة وأرقام وشرطات فقط.`,invite:`دعوة عضو`,members:`الأعضاء`,settings:`إعدادات مساحة العمل`},sidebar:{settings:`الإعدادات`,help:`المساعدة`,helpTooltip:`المساعدة والوثائق`,activityFeed:`موجز النشاط`},home:{title:`الرئيسية`,subtitle:`لوحة تحكم مساحة العمل`,nav:`الرئيسية`,allApps:`جميع التطبيقات`,loading:`جارٍ تحميل مساحة العمل...`,recent:`الأخيرة`,starred:`المميزة بنجمة`,welcome:`مرحباً بك في ObjectUI`,welcomeDescription:`ابدأ بإنشاء تطبيقك الأول أو تكوين إعدادات النظام.`,createFirstApp:`أنشئ أول تطبيق لك`,systemSettings:`إعدادات النظام`,browseMarketplace:`تصفح متجر التطبيقات`,quickActions:{title:`إجراءات سريعة`,createApp:`إنشاء تطبيق`,createAppDesc:`ابدأ بتطبيق جديد`,manageObjects:`إدارة الكائنات`,manageObjectsDesc:`تكوين نماذج البيانات`,systemSettings:`إعدادات النظام`,systemSettingsDesc:`تكوين مساحة العمل الخاصة بك`},appCard:{noDescription:`لا يوجد وصف`,default:`افتراضي`}},layout:{appSwitcher:{home:`Home`,addApp:`Add App`,editApp:`Edit App`,manageAllApps:`Manage All Apps`,systemConsole:`System Console`,noAppsConfigured:`No apps configured`},activityFeed:{title:`Recent Activity`,filter:`Filter`,empty:`No recent activity`,ariaLabel:`Activity feed`,typeCreate:`Create`,typeUpdate:`Update`,typeDelete:`Delete`,typeComment:`Comment`,relativeJustNow:`just now`,relativeSecondsAgo:`{{count}}s ago`,relativeMinutesAgo:`{{count}}m ago`,relativeHoursAgo:`{{count}}h ago`,relativeDaysAgo:`{{count}}d ago`},metadata:{label:`Metadata`,toggleTitle:`Toggle Metadata Inspector`,panelTitle:`Metadata Inspector`,jsonBadge:`JSON`,copyJson:`Copy JSON`}},search:{title:`Search`,back:`Back`,placeholder:`Search objects, dashboards, pages, reports...`,inputAriaLabel:`Search objects, dashboards, pages, reports`,resultsCount:`{{count}} result for "{{query}}"`,resultsCountPlural:`{{count}} results for "{{query}}"`,itemsAvailable:`{{count}} items available`,noResults:`No results found`,noResultsHint:`Try adjusting your search terms`,typeObjects:`Objects`,typeDashboards:`Dashboards`,typePages:`Pages`,typeReports:`Reports`,badgeObject:`object`,badgeDashboard:`dashboard`,badgePage:`page`,badgeReport:`report`},empty:{objectNotFound:`Object Not Found`,objectNotFoundDescription:`Object "{{name}}" definition missing. Check your configuration or navigate back to select a valid object.`,pageNotFound:`Page Not Found`,pageNotFoundDescription:`The page "{{name}}" could not be found. It may have been removed or renamed.`,dashboardNotFound:`Dashboard Not Found`,dashboardNotFoundDescription:`The dashboard "{{name}}" could not be found. It may have been removed or renamed.`,reportNotFound:`Report Not Found`,reportNotFoundDescription:`The report "{{name}}" could not be found. It may have been removed or renamed.`,noAppsConfigured:`No Apps Configured`,noAppsConfiguredDescription:`No applications have been registered. Create your first app or visit System Settings to configure your environment.`,createFirstApp:`Create Your First App`,systemSettings:`System Settings`,back:`Back`},renderer:{noPageSchema:`No page schema provided`,noFormSchema:`No form schema provided`,noDashboardSchema:`No dashboard schema provided`,pageRendering:`Page rendering: {{name}}`,dashboardRendering:`Dashboard rendering: {{name}}`,formRenderingMode:`Form rendering in {{mode}} mode`,formRenderingFor:`for record {{id}}`,createRecord:`Create Record`,editRecord:`Edit Record`,page:`Page`,dashboard:`Dashboard`,save:`Save`,cancel:`Cancel`},actionDialog:{title:`Action Parameters`,description:`Please provide the required information to continue.`,selectPlaceholder:`Select {{label}}`,requiredError:`{{label}} is required`,cancel:`Cancel`,confirm:`Confirm`,defaultActionTitle:`Action`,ok:`OK`},rowAction:{openMenu:`Open menu`,edit:`Edit`,delete:`Delete`},navigationSync:{addedPage:`Navigation updated: added page "{{name}}"`,addedDashboard:`Navigation updated: added dashboard "{{name}}"`,removedPage:`Navigation updated: removed page "{{name}}"`,removedDashboard:`Navigation updated: removed dashboard "{{name}}"`,renamedPage:`Navigation updated: renamed page "{{oldName}}" → "{{newName}}"`,renamedDashboard:`Navigation updated: renamed dashboard "{{oldName}}" → "{{newName}}"`,undoLabel:`Undo`,undone:`Navigation change undone`,undoFailed:`Failed to undo navigation change`,updateFailed:`Failed to update navigation`},objectActions:{deleteSuccess:`{{label}} deleted successfully`,deleteFailed:`Failed to delete {{label}}`,noRecordId:`No record ID provided`,deleteConfirm:`Are you sure you want to delete this record?`},objectViewActions:{renameFailed:`Failed to rename view`,deleteFailed:`Failed to delete view`},dashboardActions:{pdfPreparing:`Preparing PDF export…`,exportFailed:`Export failed: {{message}}`,forecastSoon:`Forecast view coming soon`},recordDetail:{viewersTooltip:`Users viewing this record`},cellRender:{empty:`Empty`,yes:`Yes`,no:`No`,systemFields:`System`},user:{profile:`Profile`,settings:`Settings`,logout:`Log out`},report:{rowTotal:`Row Total`,columnTotal:`Column Total`,grandTotal:`Grand Total`,totals:`Totals`,rowsLabel:`Row`,columnsLabel:`Column`,allLabel:`(All)`,emptyLabel:`(Empty)`,loading:`Loading…`,failedToLoad:`Failed to load matrix: {{message}}`,needsAcross:"Matrix report requires at least one `groupingsAcross` field.",aggregate:{count:`Count`,countDistinct:`Distinct Count`,sum:`Sum`,avg:`Average`,min:`Min`,max:`Max`,first:`First`},editor:{breadcrumb:`الإعدادات`,basic:`أساسي`,title:`العنوان`,titlePlaceholder:`مثال: المسار حسب الربع`,description:`الوصف`,descriptionPlaceholder:`ماذا يعرض هذا التقرير؟`,type:`نوع التقرير`,typeTabular:`جدولي — قائمة مسطّحة`,typeSummary:`ملخص — مجمّع مع المجاميع`,typeMatrix:`مصفوفة — محور صفوف × أعمدة`,typeJoined:`مدمج — كتل متعددة`,typeHelp:`اختر التخطيط الذي يطابق ما تريد رؤيته.`,data:`البيانات`,objectName:`مصدر البيانات`,objectNamePlaceholder:`مثال: opportunity`,objectNameHelp:`أي كائن يجب أن يستعلم عنه هذا التقرير؟`,limit:`حد عدد الصفوف`,limitPlaceholder:`مثال: 100`,columns:`الأعمدة`,columnsHint:`اختر الحقول التي ستظهر كأعمدة. أضف تجميعًا (مجموع، عدد…) في تقارير الملخص أو المصفوفة.`,filters:`عوامل التصفية`,filtersHint:`قيّد الصفوف التي تدخل في هذا التقرير.`,filtersComplex:`يستخدم هذا التقرير عامل تصفية متقدّمًا لا يمكن تحريره هنا. سيُحتفظ به كما هو عند الحفظ.`,groupBy:`التجميع حسب`,groupByHint:`جمّع البيانات واحسب المجاميع الفرعية.`,rows:`الصفوف`,rowsHint:`جمّع الصفوف حسب هذه الحقول.`,columnsAxis:`الأعمدة`,columnsAxisHint:`اعرض هذه الحقول كمحور في الأعلى.`,values:`القيم`,valuesHint:`الأرقام التي تظهر في كل خلية. اختر حقلاً واحدًا أو أكثر وأضف تجميعًا (مجموع، عدد…).`,grouping:`تجميع`,addGrouping:`إضافة تجميع`,dateGranularity:`دقة التاريخ`,dateGranularityNone:`(استخدام القيمة الأصلية)`,day:`يوم`,week:`أسبوع`,month:`شهر`,quarter:`ربع`,year:`سنة`,sortAsc:`تصاعدي`,sortDesc:`تنازلي`,chart:`الرسم البياني`,chartHint:`عرض مرئي اختياري بجانب الجدول.`,chartType:`نوع الرسم`,chartTitle:`عنوان الرسم`,chartTitlePlaceholder:`افتراضيًا يستخدم عنوان التقرير`,chartXAxis:`المحور السيني (الفئة)`,chartYAxis:`المحور الصادي (القيمة)`,chartShowLegend:`إظهار وسيلة الإيضاح`,chartShowDataLabels:`إظهار تسميات البيانات`,chartNone:`(بدون رسم)`,chartBar:`أعمدة`,chartLine:`خطي`,chartArea:`منطقة`,chartPie:`دائري`,chartDonut:`حلقي`,chartFunnel:`قمعي`,validationNeedsObject:`اختر مصدر بيانات قبل إضافة الأعمدة.`,validationMatrixNeedsRowsCols:`تتطلب تقارير المصفوفة صفًا وعمودًا واحدًا على الأقل.`,validationSummaryNeedsRows:`تتطلب تقارير الملخص حقل تجميع واحدًا على الأقل.`,blocks:`الكتل`,blocksHint:`كل كتلة هي جدولها أو رسمها البياني الخاص. عوامل تصفية الكتلة تُدمج مع عامل تصفية التقرير بمنطق AND.`,addBlock:`إضافة كتلة`,removeBlock:`إزالة الكتلة`,blockName:`اسم الكتلة`,blockNamePlaceholder:`اسم_فريد_للكتلة`,blockLabel:`التسمية المعروضة`,blockLabelPlaceholder:`تُعرض فوق الكتلة`,blockDescription:`الوصف`,blockDescriptionPlaceholder:`سياق اختياري لهذه الكتلة`,validationJoinedNeedsBlocks:`تتطلب التقارير المدمجة كتلة واحدة على الأقل.`,validationBlockNameRequired:`يجب أن يكون لكل كتلة اسم غير فارغ.`,validationBlockNameDuplicate:`يجب أن تكون أسماء الكتل فريدة داخل التقرير.`,validationBlockNeedsColumns:`تحتاج كل كتلة إلى عمود واحد على الأقل.`,noneOption:`(بلا)`,addCondition:`إضافة شرط`,combineLogic:`الدمج مع`,opContains:`يحتوي على`,opIsEmpty:`فارغ`,opIsNotEmpty:`ليس فارغًا`,formatAuto:`تلقائي`,formatCurrency:`عملة`,formatPercent:`نسبة مئوية`,formatInteger:`عدد صحيح`,formatDate:`تاريخ`,formatDatetime:`تاريخ ووقت`,columnLabelPlaceholder:`تجاوز التسمية`,aggregateColumn:`تجميع`,formatColumn:`تنسيق`,addColumns:`إضافة أعمدة`,searchFields:`البحث في الحقول…`,noMatchingFields:`لا توجد حقول تطابق بحثك.`,noFieldsAvailable:`لا توجد حقول متاحة.`}},organizations:{mine:`مؤسساتي`,title:`المؤسسات`,heading:`مؤسساتك`,subtitle:`اختر مؤسسة للمتابعة، أو أنشئ مؤسسة جديدة.`,searchPlaceholder:`ابحث عن مؤسسة`,new:`مؤسسة جديدة`,current:`المؤسسة الحالية`,manage:`إدارة`,emptyTitle:`لا توجد مؤسسات بعد`,emptyDescription:`أنشئ مؤسستك الأولى للبدء.`,noMatches:`لا توجد مؤسسات تطابق بحثك.`},notifications:{empty:`لا توجد إشعارات`,markAllRead:`تعليم الكل كمقروء`,viewAll:`عرض جميع الإشعارات`,approvalsPending:`{{count}} موافقات معلقة`,viewApprovals:`عرض الموافقات`,noPendingApprovals:`لا توجد موافقات معلقة`,openApprovalsInbox:`فتح صندوق الموافقات`},publicForm:{submit:`Submit`,submitting:`Submitting…`,submitAnother:`Submit another response`,poweredBy:`Powered by ObjectStack`,secureNotice:`Your information is transmitted securely and only used to respond to your request.`,thankYouTitle:`Thank you!`,thankYouMessage:`Your submission has been received successfully.`,redirecting:`Redirecting in {{seconds}} seconds…`,unavailableTitle:`Form unavailable`,unavailableDescription:`No public form is available at this URL. Make sure the underlying view has anonymous sharing enabled and matches this slug.`,tryDemo:`Try the demo`,retry:`Retry`,loading:`Loading form…`,requiredHint:`* Required field`,consentLabelDefault:`I agree to the privacy policy and consent to my data being processed for this request.`,consentLink:`Privacy policy`,consentRequired:`Please accept the privacy policy to continue.`,rateLimited:`Please take a moment to review your answers before submitting.`,redirectBlocked:`Submission accepted, but the redirect URL was blocked for security.`,demo:{contactTitle:`Contact us`,contactDescription:`Tell us about your project and a sales representative will get back to you within one business day.`,supportTitle:`Submit a support request`,supportDescription:`Tell us what is going wrong — our team responds within one business day.`,thankYouSalesTitle:`Thanks — we received your message!`,thankYouSalesMessage:`A sales representative will be in touch within one business day.`,thankYouSupportTitle:`Got it — your request is in the queue.`,thankYouSupportMessage:`A support engineer will follow up shortly. Save this page if you have more screenshots to add.`,field:{firstName:`First name`,lastName:`Last name`,email:`Work email`,phone:`Phone`,jobTitle:`Job title`,company:`Company`,website:`Website`,industry:`Industry`,companySize:`Company size`,howCanWeHelp:`How can we help?`,subject:`Subject`,description:`Description`,issueType:`Issue type`,priority:`Priority`},industry:{technology:`Technology`,software:`Software / SaaS`,finance:`Finance`,healthcare:`Healthcare`,retail:`Retail`,other:`Other`},issueType:{question:`Question`,problem:`Problem`,bug:`Bug`,feature_request:`Feature request`},priority:{low:`Low`,medium:`Medium`,high:`High`,critical:`Critical`}}},marketplace:{title:`App Marketplace`,subtitle:`Browse approved apps published to the ObjectStack catalog. Click an app to view details and install it into one of your environments.`,searchPlaceholder:`Search apps by name or manifest ID…`,searchAria:`Search marketplace apps`,installed:`Installed`,installedCount:`Installed ({{count}})`,refresh:`Refresh`,all:`All`,noApprovedYet:`No apps have been approved for the marketplace yet.`,noMatchFilters:`No apps match your filters.`,noDescription:`No description provided.`,back:`Back to marketplace`,installedTitle:`Installed Apps`,installedSubtitle:`Marketplace packages currently installed into this runtime's kernel. Cached manifests live in <code>.objectstack/installed-packages/</code> and survive restarts.`,installedEmpty:`No marketplace apps installed in this runtime yet.`,browseLink:`Browse the marketplace →`,installedAdditiveNote:`<strong>Note:</strong> The kernel API is additive only — uninstall removes the on-disk manifest so the package won't load on next boot, but the running kernel keeps the app registered until you restart the runtime.`,installedAt:`Installed {{when}}`,installedBy:`by {{user}}`,installedPackageId:`package`,cachedAs:`Cached as <code>{{path}}</code>`,versionBadge:`v{{version}}`,installedBadge:`Installed v{{version}}`,load:{failed:`Failed to load marketplace`,failedHint:`By default this runtime points at the public ObjectStack cloud. Check the runtime is online, or override <code>OS_CLOUD_URL</code> to point at a self-hosted control plane.`,packageFailed:`Failed to load package`,notFound:`Not found.`},detail:{homepage:`Homepage`,installedV:`Installed · v{{version}}`,about:`About`,noReadme:`No readme provided.`,versions:`Versions`,noApprovedVersions:`No approved versions.`,prerelease:`pre`,moreOptions:`More install options`,uninstallFromRuntime:`Uninstall from this runtime`},action:{install:`Install`,reinstall:`Reinstall`,working:`Working…`,installToCloud:`Install to cloud…`,installing:`Installing…`,uninstall:`Uninstall`,uninstalling:`Uninstalling…`,details:`Details`,close:`Close`,dismiss:`Dismiss`,openOnCloud:`Open on cloud`,backHome:`Back to home`},install:{dialogTitle:`Install {{name}}`,dialogDescCurrent:`Install into this environment ({{host}}).`,dialogDescPicker:`Choose an environment to install this app into. You need to be signed into ObjectStack Cloud.`,environment:`Environment`,environmentPlaceholder:`Pick an environment`,includeSampleData:`Include sample data`,noEnvs:`No environments found in your active organization.`,noPermission:`You do not have permission to install apps in any environment. Only organization owners and admins can install — ask your workspace admin.`,signInFirst:`You need to sign into ObjectStack Cloud first. Click "Open on cloud" below.`,success:`Installed successfully. Open the environment to see the new app.`,localSuccess:`Installed v{{version}} to this runtime. "{{name}}" should now appear in the app switcher.`,localManifestConflict:`{{message}}
|
|
37
37
|
Tip: a local app already owns this manifest_id. Remove it from objectstack.config.ts first.`,localUnauthorized:`Sign in to this runtime first, then try again.`,localMarketplaceUnavailable:`This runtime has no OS_CLOUD_URL configured, so the marketplace catalog is unreachable.`},uninstall:{confirm:`Uninstall {{manifestId}} v{{version}} from this runtime?
|
|
38
38
|
|
|
39
|
-
The cached manifest will be removed. The app will remain loaded in the running kernel until the next restart.`,successInList:`Removed {{manifestId}}. Restart the runtime to fully unload it from the running kernel.`,successInDetail:`Removed cached manifest for {{manifestId}}. Restart the runtime to fully unload the app from the running kernel.`},accessDenied:{title:`App Marketplace is admin-only`,description:`You don't have permission to install apps in this environment. Ask an owner or admin of this organization for access.`},category:{crm:`CRM`,erp:`ERP`,hr:`Human Resources`,finance:`Finance`,project:`Project Management`,collaboration:`Collaboration`,analytics:`Analytics`,integration:`Integration`,automation:`Automation`,ai:`AI`,security:`Security`,"developer-tools":`Developer Tools`,"ui-theme":`UI Theme`,storage:`Storage`,other:`Other`},pricing:{free:`Free`,freemium:`Freemium`,paid:`Paid`,subscription:`Subscription`,"usage-based":`Usage-based`,"contact-sales":`Contact Sales`},relativeTime:{today:`today`,daysAgo:`{{count}}d ago`,monthsAgo:`{{count}}mo ago`,yearsAgo:`{{count}}y ago`}}}},ft=[`ar`,`he`,`fa`,`ur`];function pt(e){return ft.includes(e)}function mt(e={}){let{defaultLanguage:t=`en`,fallbackLanguage:n=`en`,resources:r={},detectBrowserLanguage:i=!0,interpolation:a}=e,o={};for(let[e,t]of Object.entries(dt))o[e]={translation:{...t,...r[e]||{}}};for(let[e,t]of Object.entries(r))o[e]||(o[e]={translation:t});let s=t;if(i&&typeof navigator<`u`){let e=navigator.language?.split(`-`)[0];e&&o[e]&&(s=e)}let c=Ie.createInstance();return c.use(tt).init({lng:s,fallbackLng:n,resources:o,interpolation:{escapeValue:!1,...a},returnNull:!1,react:{useSuspense:!1}}),c}function ht(e){return pt(e)?`rtl`:`ltr`}var gt=(0,j.createContext)(null);function _t({config:e,instance:t,loadLanguage:n,children:r}){let i=(0,j.useMemo)(()=>t||mt(e),[t,e]),[a,o]=(0,j.useState)(i.language||`en`),s=ht(a),c=(0,j.useRef)(new Set);(0,j.useEffect)(()=>{let e=e=>{o(e),typeof document<`u`&&(document.documentElement.dir=ht(e),document.documentElement.lang=e)},t=i.language||a;return typeof document<`u`&&t&&(document.documentElement.dir=ht(t),document.documentElement.lang=t),i.on(`languageChanged`,e),()=>{i.off(`languageChanged`,e)}},[i]),(0,j.useEffect)(()=>{if(!n)return;let e=i.language||`en`;c.current.has(e)||(c.current.add(e),n(e).then(t=>{t&&Object.keys(t).length>0&&(i.addResourceBundle(e,`translation`,t,!0,!0),o(e))}).catch(t=>{c.current.delete(e),console.warn(`[i18n] Failed to load app translations for '${e}':`,t)}))},[i,n]);let l=(0,j.useMemo)(()=>({language:a,changeLanguage:async e=>{if(n&&!c.current.has(e)){c.current.add(e);try{let t=await n(e);i.addResourceBundle(e,`translation`,t,!0,!0)}catch(t){c.current.delete(e),console.warn(`[i18n] Failed to load app translations for '${e}':`,t)}}await i.changeLanguage(e)},direction:s,i18n:i}),[a,s,i,n]);return j.createElement(gt.Provider,{value:l},j.createElement(ut,{i18n:i},r))}function vt(e){let t=(0,j.useContext)(gt),{t:n,i18n:r}=lt(e);return{t:n,language:t?.language||r.language||`en`,changeLanguage:t?.changeLanguage||(async e=>{await r.changeLanguage(e)}),direction:t?.direction||`ltr`,i18n:r}}function yt(){let e=(0,j.useContext)(gt);if(!e)throw Error(`useI18nContext must be used within an I18nProvider`);return e}var bt=typeof window<`u`?j.useLayoutEffect:j.useEffect;function xt(e){let t=j.useRef({value:e,prev:null}),n=t.current.value;return e!==n&&(t.current={value:e,prev:n}),t.current.prev}function St(e,t,n={},r={}){j.useEffect(()=>{if(!e.current||r.disabled||typeof IntersectionObserver!=`function`)return;let i=new IntersectionObserver(([e])=>{t(e)},n);return i.observe(e.current),()=>{i.disconnect()}},[t,n,r.disabled,e])}function Ct(e){let t=j.useRef(null);return j.useImperativeHandle(e,()=>t.current,[]),t}function wt(e){return e[e.length-1]}function Tt(e){return typeof e==`function`}function Et(e,t){return Tt(e)?e(t):e}var Dt=Object.prototype.hasOwnProperty,Ot=Object.prototype.propertyIsEnumerable;function kt(e){for(let t in e)if(Dt.call(e,t))return!0;return!1}var At=()=>Object.create(null),jt=(e,t)=>Mt(e,t,At);function Mt(e,t,n=()=>({}),r=0){if(e===t)return e;if(r>500)return t;let i=t,a=It(e)&&It(i);if(!a&&!(Pt(e)&&Pt(i)))return i;let o=a?e:Nt(e);if(!o)return i;let s=a?i:Nt(i);if(!s)return i;let c=o.length,l=s.length,u=a?Array(l):n(),d=0;for(let t=0;t<l;t++){let o=a?t:s[t],l=e[o],f=i[o];if(l===f){u[o]=l,(a?t<c:Dt.call(e,o))&&d++;continue}if(l===null||f===null||typeof l!=`object`||typeof f!=`object`){u[o]=f;continue}let p=Mt(l,f,n,r+1);u[o]=p,p===l&&d++}return c===l&&d===c?e:u}function Nt(e){let t=Object.getOwnPropertyNames(e);for(let n of t)if(!Ot.call(e,n))return!1;let n=Object.getOwnPropertySymbols(e);if(n.length===0)return t;let r=t;for(let t of n){if(!Ot.call(e,t))return!1;r.push(t)}return r}function Pt(e){if(!Ft(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!Ft(n)||!n.hasOwnProperty(`isPrototypeOf`))}function Ft(e){return Object.prototype.toString.call(e)===`[object Object]`}function It(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Lt(e,t,n){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let r=0,i=e.length;r<i;r++)if(!Lt(e[r],t[r],n))return!1;return!0}if(Pt(e)&&Pt(t)){let r=n?.ignoreUndefined??!0;if(n?.partial){for(let i in t)if((!r||t[i]!==void 0)&&!Lt(e[i],t[i],n))return!1;return!0}let i=0;if(!r)i=Object.keys(e).length;else for(let t in e)e[t]!==void 0&&i++;let a=0;for(let o in t)if((!r||t[o]!==void 0)&&(a++,a>i||!Lt(e[o],t[o],n)))return!1;return i===a}return!1}function Rt(e){let t,n,r=new Promise((e,r)=>{t=e,n=r});return r.status=`pending`,r.resolve=n=>{r.status=`resolved`,r.value=n,t(n),e?.(n)},r.reject=e=>{r.status=`rejected`,n(e)},r}function zt(e){return!!(e&&typeof e==`object`&&typeof e.then==`function`)}function Bt(e){return e.replace(/[\x00-\x1f\x7f]/g,``)}function Vt(e){let t;try{t=decodeURI(e)}catch{t=e.replaceAll(/%[0-9A-F]{2}/gi,e=>{try{return decodeURI(e)}catch{return e}})}return Bt(t)}var Ht=[`http:`,`https:`,`mailto:`,`tel:`];function Ut(e,t){if(!e)return!1;try{let n=new URL(e);return!t.has(n.protocol)}catch{return!1}}function Wt(e){if(!e||!/[%\\\x00-\x1f\x7f]/.test(e)&&!e.startsWith(`//`))return{path:e,handledProtocolRelativeURL:!1};let t=/%25|%5C/gi,n=0,r=``,i;for(;(i=t.exec(e))!==null;)r+=Vt(e.slice(n,i.index))+i[0],n=t.lastIndex;r+=Vt(n?e.slice(n):e);let a=!1;return r.startsWith(`//`)&&(a=!0,r=`/`+r.replace(/^\/+/,``)),{path:r,handledProtocolRelativeURL:a}}function Gt(e){return/\s|[^\u0000-\u007F]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function Kt(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function qt(){throw Error(`Invariant failed`)}function Jt(e){let t=new Map,n,r,i=e=>{e.next&&(e.prev?(e.prev.next=e.next,e.next.prev=e.prev,e.next=void 0,r&&(r.next=e,e.prev=r)):(e.next.prev=void 0,n=e.next,e.next=void 0,r&&(e.prev=r,r.next=e)),r=e)};return{get(e){let n=t.get(e);if(n)return i(n),n.value},set(a,o){if(t.size>=e&&n){let e=n;t.delete(e.key),e.next&&(n=e.next,e.next.prev=void 0),e===r&&(r=void 0)}let s=t.get(a);if(s)s.value=o,i(s);else{let e={key:a,value:o,prev:r};r&&(r.next=e),r=e,n||=e,t.set(a,e)}},clear(){t.clear(),n=void 0,r=void 0}}}var Yt=4,Xt=5;function Zt(e){let t=e.indexOf(`{`);if(t===-1)return null;let n=e.indexOf(`}`,t);return n===-1||t+1>=e.length?null:[t,n]}function Qt(e,t,n=new Uint16Array(6)){let r=e.indexOf(`/`,t),i=r===-1?e.length:r,a=e.substring(t,i);if(!a||!a.includes(`$`))return n[0]=0,n[1]=t,n[2]=t,n[3]=i,n[4]=i,n[5]=i,n;if(a===`$`){let r=e.length;return n[0]=2,n[1]=t,n[2]=t,n[3]=r,n[4]=r,n[5]=r,n}if(a.charCodeAt(0)===36)return n[0]=1,n[1]=t,n[2]=t+1,n[3]=i,n[4]=i,n[5]=i,n;let o=Zt(a);if(o){let[r,s]=o,c=a.charCodeAt(r+1);if(c===45){if(r+2<a.length&&a.charCodeAt(r+2)===36){let e=r+3,a=s;if(e<a)return n[0]=3,n[1]=t+r,n[2]=t+e,n[3]=t+a,n[4]=t+s+1,n[5]=i,n}}else if(c===36){let a=r+1,o=r+2;return o===s?(n[0]=2,n[1]=t+r,n[2]=t+a,n[3]=t+o,n[4]=t+s+1,n[5]=e.length,n):(n[0]=1,n[1]=t+r,n[2]=t+o,n[3]=t+s,n[4]=t+s+1,n[5]=i,n)}}return n[0]=0,n[1]=t,n[2]=t,n[3]=i,n[4]=i,n[5]=i,n}function $t(e,t,n,r,i,a,o){o?.(n);let s=r;{let r=n.fullPath??n.from,o=r.length,c=n.options?.caseSensitive??e,l=n.options?.params?.parse??n.options?.parseParams;for(;s<o;){let e=Qt(r,s,t),o,u=s,d=e[5];switch(s=d+1,a++,e[0]){case 0:{let t=r.substring(e[2],e[3]);if(c){let e=i.static?.get(t);if(e)o=e;else{i.static??=new Map;let e=nn(n.fullPath??n.from);e.parent=i,e.depth=a,o=e,i.static.set(t,e)}}else{let e=t.toLowerCase(),r=i.staticInsensitive?.get(e);if(r)o=r;else{i.staticInsensitive??=new Map;let t=nn(n.fullPath??n.from);t.parent=i,t.depth=a,o=t,i.staticInsensitive.set(e,t)}}break}case 1:{let t=r.substring(u,e[1]),s=r.substring(e[4],d),f=c&&!!(t||s),p=t?f?t:t.toLowerCase():void 0,m=s?f?s:s.toLowerCase():void 0,h=!l&&i.dynamic?.find(e=>!e.parse&&e.caseSensitive===f&&e.prefix===p&&e.suffix===m);if(h)o=h;else{let e=rn(1,n.fullPath??n.from,f,p,m);o=e,e.depth=a,e.parent=i,i.dynamic??=[],i.dynamic.push(e)}break}case 3:{let t=r.substring(u,e[1]),s=r.substring(e[4],d),f=c&&!!(t||s),p=t?f?t:t.toLowerCase():void 0,m=s?f?s:s.toLowerCase():void 0,h=!l&&i.optional?.find(e=>!e.parse&&e.caseSensitive===f&&e.prefix===p&&e.suffix===m);if(h)o=h;else{let e=rn(3,n.fullPath??n.from,f,p,m);o=e,e.parent=i,e.depth=a,i.optional??=[],i.optional.push(e)}break}case 2:{let t=r.substring(u,e[1]),s=r.substring(e[4],d),l=c&&!!(t||s),f=t?l?t:t.toLowerCase():void 0,p=s?l?s:s.toLowerCase():void 0,m=rn(2,n.fullPath??n.from,l,f,p);o=m,m.parent=i,m.depth=a,i.wildcard??=[],i.wildcard.push(m)}}i=o}if(l&&n.children&&!n.isRoot&&n.id&&n.id.charCodeAt(n.id.lastIndexOf(`/`)+1)===95){let e=nn(n.fullPath??n.from);e.kind=Xt,e.parent=i,a++,e.depth=a,i.pathless??=[],i.pathless.push(e),i=e}let u=(n.path||!n.children)&&!n.isRoot;if(u&&r.endsWith(`/`)){let e=nn(n.fullPath??n.from);e.kind=Yt,e.parent=i,a++,e.depth=a,i.index=e,i=e}i.parse=l??null,i.priority=n.options?.params?.priority??0,u&&!i.route&&(i.route=n,i.fullPath=n.fullPath??n.from)}if(n.children)for(let r of n.children)$t(e,t,r,s,i,a,o)}function en(e,t){if(e.parse&&!t.parse)return-1;if(!e.parse&&t.parse)return 1;if(e.parse&&t.parse&&(e.priority||t.priority))return t.priority-e.priority;if(e.prefix&&t.prefix&&e.prefix!==t.prefix){if(e.prefix.startsWith(t.prefix))return-1;if(t.prefix.startsWith(e.prefix))return 1}if(e.suffix&&t.suffix&&e.suffix!==t.suffix){if(e.suffix.endsWith(t.suffix))return-1;if(t.suffix.endsWith(e.suffix))return 1}return e.prefix&&!t.prefix?-1:!e.prefix&&t.prefix?1:e.suffix&&!t.suffix?-1:!e.suffix&&t.suffix?1:e.caseSensitive&&!t.caseSensitive?-1:!e.caseSensitive&&t.caseSensitive?1:0}function tn(e){if(e.pathless)for(let t of e.pathless)tn(t);if(e.static)for(let t of e.static.values())tn(t);if(e.staticInsensitive)for(let t of e.staticInsensitive.values())tn(t);if(e.dynamic?.length){e.dynamic.sort(en);for(let t of e.dynamic)tn(t)}if(e.optional?.length){e.optional.sort(en);for(let t of e.optional)tn(t)}if(e.wildcard?.length){e.wildcard.sort(en);for(let t of e.wildcard)tn(t)}}function nn(e){return{kind:0,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:e,parent:null,parse:null,priority:0}}function rn(e,t,n,r,i){return{kind:e,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:t,parent:null,parse:null,priority:0,caseSensitive:n,prefix:r,suffix:i}}function an(e,t){let n=nn(`/`),r=new Uint16Array(6);for(let t of e)$t(!1,r,t,1,n,0);tn(n),t.masksTree=n,t.flatCache=Jt(1e3)}function on(e,t){e||=`/`;let n=t.flatCache.get(e);if(n)return n;let r=dn(e,t.masksTree);return t.flatCache.set(e,r),r}function sn(e,t,n,r,i){e||=`/`,r||=`/`;let a=t?`case\0${e}`:e,o=i.singleCache.get(a);return o||(o=nn(`/`),$t(t,new Uint16Array(6),{from:e},1,o,0),i.singleCache.set(a,o)),dn(r,o,n)}function cn(e,t,n=!1){let r=n?e:`nofuzz\0${e}`,i=t.matchCache.get(r);if(i!==void 0)return i;e||=`/`;let a;try{a=dn(e,t.segmentTree,n)}catch(e){if(e instanceof URIError)a=null;else throw e}return a&&(a.branch=pn(a.route)),t.matchCache.set(r,a),a}function ln(e){return e===`/`?e:e.replace(/\/{1,}$/,``)}function un(e,t=!1,n){let r=nn(e.fullPath),i=new Uint16Array(6),a={},o={},s=0;return $t(t,i,e,1,r,0,e=>{if(n?.(e,s),e.id in a&&qt(),a[e.id]=e,s!==0&&e.path){let t=ln(e.fullPath);(!o[t]||e.fullPath.endsWith(`/`))&&(o[t]=e)}s++}),tn(r),{processedTree:{segmentTree:r,singleCache:Jt(1e3),matchCache:Jt(1e3),flatCache:null,masksTree:null},routesById:a,routesByPath:o}}function dn(e,t,n=!1){let r=e.split(`/`),i=hn(e,r,t,n);if(!i)return null;let[a]=fn(e,r,i);return{route:i.node.route,rawParams:a}}function fn(e,t,n){let r=mn(n.node),i=null,a=Object.create(null),o=n.extract?.part??0,s=n.extract?.node??0,c=n.extract?.path??0,l=n.extract?.segment??0;for(;s<r.length;o++,s++,c++,l++){let u=r[s];if(u.kind===Yt)break;if(u.kind===Xt){l--,o--,c--;continue}let d=t[o],f=c;if(d&&(c+=d.length),u.kind===1){i??=n.node.fullPath.split(`/`);let e=i[l],t=u.prefix?.length??0;if(e.charCodeAt(t)===123){let n=u.suffix?.length??0,r=e.substring(t+2,e.length-n-1),i=d.substring(t,d.length-n);a[r]=decodeURIComponent(i)}else{let t=e.substring(1);a[t]=decodeURIComponent(d)}}else if(u.kind===3){if(n.skipped&1<<s){o--,c=f-1;continue}i??=n.node.fullPath.split(`/`);let e=i[l],t=u.prefix?.length??0,r=u.suffix?.length??0,p=e.substring(t+3,e.length-r-1),m=u.suffix||u.prefix?d.substring(t,d.length-r):d;m&&(a[p]=decodeURIComponent(m))}else if(u.kind===2){let t=u,n=e.substring(f+(t.prefix?.length??0),e.length-(t.suffix?.length??0)),r=decodeURIComponent(n);a[`*`]=r,a._splat=r;break}}return n.rawParams&&Object.assign(a,n.rawParams),[a,{part:o,node:s,path:c,segment:l}]}function pn(e){let t=[e];for(;e.parentRoute;)e=e.parentRoute,t.push(e);return t.reverse(),t}function mn(e){let t=Array(e.depth+1);do t[e.depth]=e,e=e.parent;while(e);return t}function hn(e,t,n,r){if(e===`/`&&n.index)return{node:n.index,skipped:0};let i=!wt(t),a=i&&e!==`/`,o=t.length-+!!i,s=[{node:n,index:1,skipped:0,depth:1,statics:0,dynamics:0,optionals:0}],c=null,l=null;for(;s.length;){let n=s.pop(),{node:i,index:u,skipped:d,depth:f,statics:p,dynamics:m,optionals:h}=n,{extract:g,rawParams:_}=n;if(i.kind===2&&i.route&&!yn(l,n))continue;if(i.parse){if(!vn(e,t,n))continue;_=n.rawParams,g=n.extract}r&&i.route&&i.kind!==Yt&&yn(c,n)&&(c=n);let v=u===o;if(v&&(i.route&&(!a||i.kind===Yt||i.kind===2)&&yn(l,n)&&(l=n),!i.optional&&!i.wildcard&&!i.index&&!i.pathless))continue;let y=v?void 0:t[u],b;if(v&&i.index){let n={node:i.index,index:u,skipped:d,depth:f+1,statics:p,dynamics:m,optionals:h,extract:g,rawParams:_},r=!0;if(i.index.parse&&(vn(e,t,n)||(r=!1)),r){if(!m&&!h&&!d&&_n(p,o))return n;yn(l,n)&&(l=n)}}if(i.wildcard)for(let e=i.wildcard.length-1;e>=0;e--){let n=i.wildcard[e],{prefix:r,suffix:a}=n;if(!(r&&(v||!(n.caseSensitive?y:b??=y.toLowerCase()).startsWith(r)))){if(a){if(v)continue;let e=t.slice(u).join(`/`).slice(-a.length);if((n.caseSensitive?e:e.toLowerCase())!==a)continue}s.push({node:n,index:o,skipped:d,depth:f+1,statics:p,dynamics:m,optionals:h,extract:g,rawParams:_})}}if(i.optional){let e=d|1<<f,t=f+1;for(let n=i.optional.length-1;n>=0;n--){let r=i.optional[n];s.push({node:r,index:u,skipped:e,depth:t,statics:p,dynamics:m,optionals:h,extract:g,rawParams:_})}if(!v)for(let e=i.optional.length-1;e>=0;e--){let n=i.optional[e],{prefix:r,suffix:a}=n;if(r||a){let e=n.caseSensitive?y:b??=y.toLowerCase();if(r&&!e.startsWith(r)||a&&!e.endsWith(a))continue}s.push({node:n,index:u+1,skipped:d,depth:t,statics:p,dynamics:m,optionals:h+gn(o,u),extract:g,rawParams:_})}}if(!v&&i.dynamic&&y)for(let e=i.dynamic.length-1;e>=0;e--){let t=i.dynamic[e],{prefix:n,suffix:r}=t;if(n||r){let e=t.caseSensitive?y:b??=y.toLowerCase();if(n&&!e.startsWith(n)||r&&!e.endsWith(r))continue}s.push({node:t,index:u+1,skipped:d,depth:f+1,statics:p,dynamics:m+gn(o,u),optionals:h,extract:g,rawParams:_})}if(!v&&i.staticInsensitive){let e=i.staticInsensitive.get(b??=y.toLowerCase());e&&s.push({node:e,index:u+1,skipped:d,depth:f+1,statics:p+gn(o,u),dynamics:m,optionals:h,extract:g,rawParams:_})}if(!v&&i.static){let e=i.static.get(y);e&&s.push({node:e,index:u+1,skipped:d,depth:f+1,statics:p+gn(o,u),dynamics:m,optionals:h,extract:g,rawParams:_})}if(i.pathless){let e=f+1;for(let t=i.pathless.length-1;t>=0;t--){let n=i.pathless[t];s.push({node:n,index:u,skipped:d,depth:e,statics:p,dynamics:m,optionals:h,extract:g,rawParams:_})}}}if(l)return l;if(r&&c){let n=c.index;for(let e=0;e<c.index;e++)n+=t[e].length;let r=n===e.length?`/`:e.slice(n);return c.rawParams??=Object.create(null),c.rawParams[`**`]=decodeURIComponent(r),c}return null}function gn(e,t){return 2**(e-t-1)}function _n(e,t){return e===2**(t-1)-1}function vn(e,t,n){let r,i;try{[r,i]=fn(e,t,n)}catch{return null}if(n.rawParams=r,n.extract=i,!n.node.parse)return!0;try{if(n.node.parse(r)===!1)return null}catch{}return!0}function yn(e,t){return e?t.statics>e.statics||t.statics===e.statics&&(t.dynamics>e.dynamics||t.dynamics===e.dynamics&&(t.optionals>e.optionals||t.optionals===e.optionals&&((t.node.kind===Yt)>(e.node.kind===Yt)||t.node.kind===Yt==(e.node.kind===Yt)&&t.depth>e.depth))):!0}function bn(e){return xn(e.filter(e=>e!==void 0).join(`/`))}function xn(e){return e.replace(/\/{2,}/g,`/`)}function Sn(e){return e===`/`?e:e.replace(/^\/{1,}/,``)}function Cn(e){let t=e.length;return t>1&&e[t-1]===`/`?e.replace(/\/{1,}$/,``):e}function wn(e){return Cn(Sn(e))}function Tn(e,t){return e?.endsWith(`/`)&&e!==`/`&&e!==`${t}/`?e.slice(0,-1):e}function En(e,t,n){return Tn(e,n)===Tn(t,n)}function Dn({base:e,to:t,trailingSlash:n=`never`,cache:r}){let i=t.startsWith(`/`),a=!i&&t===`.`,o;if(r){o=i?t:a?e:e+`\0`+t;let n=r.get(o);if(n)return n}let s;if(a)s=e.split(`/`);else if(i)s=t.split(`/`);else{for(s=e.split(`/`);s.length>1&&wt(s)===``;)s.pop();let n=t.split(`/`);for(let e=0,t=n.length;e<t;e++){let r=n[e];r===``?e?e===t-1&&s.push(r):s=[r]:r===`..`?s.pop():r===`.`||s.push(r)}}s.length>1&&(wt(s)===``?n===`never`&&s.pop():n===`always`&&s.push(``));let c=xn(s.join(`/`))||`/`;return o&&r&&r.set(o,c),c}function On(e){let t=new Map(e.map(e=>[encodeURIComponent(e),e])),n=Array.from(t.keys()).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).join(`|`),r=new RegExp(n,`g`);return e=>e.replace(r,e=>t.get(e)??e)}function kn(e,t,n){let r=t[e];return typeof r==`string`?e===`_splat`?/^[a-zA-Z0-9\-._~!/]*$/.test(r)?r:r.split(`/`).map(e=>jn(e,n)).join(`/`):jn(r,n):r}function An({path:e,params:t,decoder:n,...r}){let i=!1,a=Object.create(null);if(!e||e===`/`)return{interpolatedPath:`/`,usedParams:a,isMissingParams:i};if(!e.includes(`$`))return{interpolatedPath:e,usedParams:a,isMissingParams:i};let o=e.length,s=0,c,l=``;for(;s<o;){let r=s;c=Qt(e,r,c);let o=c[5];if(s=o+1,r===o)continue;let u=c[0];if(u===0){l+=`/`+e.substring(r,o);continue}if(u===2){let s=t._splat;a._splat=s,a[`*`]=s;let u=e.substring(r,c[1]),d=e.substring(c[4],o);if(!s){i=!0,(u||d)&&(l+=`/`+u+d);continue}let f=kn(`_splat`,t,n);l+=`/`+u+f+d;continue}if(u===1){let s=e.substring(c[2],c[3]);!i&&!(s in t)&&(i=!0),a[s]=t[s];let u=e.substring(r,c[1]),d=e.substring(c[4],o),f=kn(s,t,n)??`undefined`;l+=`/`+u+f+d;continue}if(u===3){let i=e.substring(c[2],c[3]),s=t[i];if(s==null)continue;a[i]=s;let u=e.substring(r,c[1]),d=e.substring(c[4],o),f=kn(i,t,n)??``;l+=`/`+u+f+d;continue}}return e.endsWith(`/`)&&(l+=`/`),{usedParams:a,interpolatedPath:l||`/`,isMissingParams:i}}function jn(e,t){let n=encodeURIComponent(e);return t?.(n)??n}function Mn(e){return e?.isNotFound===!0}function Nn(e,t=String){let n=new URLSearchParams;for(let r in e){let i=e[r];i!==void 0&&n.set(r,t(i))}return n.toString()}function Pn(e){return e?e===`false`?!1:e===`true`?!0:e*0==0&&+e+``===e?+e:e:``}function Fn(e){let t=new URLSearchParams(e),n=Object.create(null);for(let[e,r]of t.entries()){let t=n[e];t==null?n[e]=Pn(r):Array.isArray(t)?t.push(Pn(r)):n[e]=[t,Pn(r)]}return n}var In=Rn(JSON.parse),Ln=zn(JSON.stringify,JSON.parse);function Rn(e){return t=>{t[0]===`?`&&(t=t.substring(1));let n=Fn(t);for(let t in n){let r=n[t];if(typeof r==`string`)try{n[t]=e(r)}catch{}}return n}}function zn(e,t){let n=typeof t==`function`;function r(r){if(typeof r==`object`&&r)try{return e(r)}catch{}else if(n&&typeof r==`string`)try{return t(r),e(r)}catch{}return r}return e=>{let t=Nn(e,r);return t?`?${t}`:``}}var Bn=`__root__`;function Vn(e){if(e.statusCode=e.statusCode||e.code||307,!e._builtLocation&&!e.reloadDocument&&typeof e.href==`string`)try{new URL(e.href),e.reloadDocument=!0}catch{}let t=new Headers(e.headers);e.href&&t.get(`Location`)===null&&t.set(`Location`,e.href);let n=new Response(null,{status:e.statusCode,headers:t});if(n.options=e,e.throw)throw n;return n}function Hn(e){return e instanceof Response&&!!e.options}var Un=e=>{if(!e.rendered)return e.rendered=!0,e.onReady?.()},Wn=e=>e.stores.matchesId.get().some(t=>e.stores.matchStores.get(t)?.get()._forcePending),Gn=(e,t)=>!!(e.preload&&!e.router.stores.matchStores.has(t)),Kn=(e,t,n=!0)=>{let r={...e.router.options.context??{}},i=n?t:t-1;for(let t=0;t<=i;t++){let n=e.matches[t];if(!n)continue;let i=e.router.getMatch(n.id);i&&Object.assign(r,i.__routeContext,i.__beforeLoadContext)}return r},qn=(e,t)=>{if(!e.matches.length)return;let n=t.routeId,r=e.matches.findIndex(t=>t.routeId===e.router.routeTree.id),i=r>=0?r:0,a=n?e.matches.findIndex(e=>e.routeId===n):e.firstBadMatchIndex??e.matches.length-1;a<0&&(a=i);for(let t=a;t>=0;t--){let n=e.matches[t];if(e.router.looseRoutesById[n.routeId].options.notFoundComponent)return t}return n?a:i},Jn=(e,t,n)=>{if(!(!Hn(n)&&!Mn(n)))throw Hn(n)&&n.redirectHandled&&!n.options.reloadDocument?n:(t&&(t._nonReactive.beforeLoadPromise?.resolve(),t._nonReactive.loaderPromise?.resolve(),t._nonReactive.beforeLoadPromise=void 0,t._nonReactive.loaderPromise=void 0,t._nonReactive.error=n,e.updateMatch(t.id,r=>({...r,status:Hn(n)?`redirected`:Mn(n)?`notFound`:r.status===`pending`?`success`:r.status,context:Kn(e,t.index),isFetching:!1,error:n})),Mn(n)&&!n.routeId&&(n.routeId=t.routeId),t._nonReactive.loadPromise?.resolve()),Hn(n)&&(e.rendered=!0,n.options._fromLocation=e.location,n.redirectHandled=!0,n=e.router.resolveRedirect(n)),n)},Yn=(e,t)=>{let n=e.router.getMatch(t);return!!(!n||n._nonReactive.dehydrated)},Xn=(e,t,n)=>{let r=Kn(e,n);e.updateMatch(t,e=>({...e,context:r}))},Zn=(e,t,n,r)=>{let{id:i,routeId:a}=e.matches[t],o=e.router.looseRoutesById[a];if(n instanceof Promise)throw n;n.routerCode=r,e.firstBadMatchIndex??=t,Jn(e,e.router.getMatch(i),n);try{o.options.onError?.(n)}catch(t){n=t,Jn(e,e.router.getMatch(i),n)}e.updateMatch(i,e=>(e._nonReactive.beforeLoadPromise?.resolve(),e._nonReactive.beforeLoadPromise=void 0,e._nonReactive.loadPromise?.resolve(),{...e,error:n,status:`error`,isFetching:!1,updatedAt:Date.now(),abortController:new AbortController})),!e.preload&&!Hn(n)&&!Mn(n)&&(e.serialError??=n)},Qn=(e,t,n,r)=>{if(r._nonReactive.pendingTimeout!==void 0)return;let i=n.options.pendingMs??e.router.options.defaultPendingMs;if(e.onReady&&!Gn(e,t)&&(n.options.loader||n.options.beforeLoad||lr(n))&&typeof i==`number`&&i!==1/0&&(n.options.pendingComponent??e.router.options?.defaultPendingComponent)){let t=setTimeout(()=>{Un(e)},i);r._nonReactive.pendingTimeout=t}},$n=(e,t,n)=>{let r=e.router.getMatch(t);if(!r._nonReactive.beforeLoadPromise&&!r._nonReactive.loaderPromise)return;Qn(e,t,n,r);let i=()=>{let n=e.router.getMatch(t);n.preload&&(n.status===`redirected`||n.status===`notFound`)&&Jn(e,n,n.error)};return r._nonReactive.beforeLoadPromise?r._nonReactive.beforeLoadPromise.then(i):i()},er=(e,t,n,r)=>{let i=e.router.getMatch(t),a=i._nonReactive.loadPromise;i._nonReactive.loadPromise=Rt(()=>{a?.resolve(),a=void 0});let{paramsError:o,searchError:s}=i;o&&Zn(e,n,o,`PARSE_PARAMS`),s&&Zn(e,n,s,`VALIDATE_SEARCH`),Qn(e,t,r,i);let c=new AbortController,l=!1,u=()=>{l||(l=!0,e.updateMatch(t,e=>({...e,isFetching:`beforeLoad`,fetchCount:e.fetchCount+1,abortController:c})))},d=()=>{i._nonReactive.beforeLoadPromise?.resolve(),i._nonReactive.beforeLoadPromise=void 0,e.updateMatch(t,e=>({...e,isFetching:!1}))};if(!r.options.beforeLoad){e.router.batch(()=>{u(),d()});return}i._nonReactive.beforeLoadPromise=Rt();let f={...Kn(e,n,!1),...i.__routeContext},{search:p,params:m,cause:h}=i,g=Gn(e,t),_={search:p,abortController:c,params:m,preload:g,context:f,location:e.location,navigate:t=>e.router.navigate({...t,_fromLocation:e.location}),buildLocation:e.router.buildLocation,cause:g?`preload`:h,matches:e.matches,routeId:r.id,...e.router.options.additionalContext},v=r=>{if(r===void 0){e.router.batch(()=>{u(),d()});return}(Hn(r)||Mn(r))&&(u(),Zn(e,n,r,`BEFORE_LOAD`)),e.router.batch(()=>{u(),e.updateMatch(t,e=>({...e,__beforeLoadContext:r})),d()})},y;try{if(y=r.options.beforeLoad(_),zt(y))return u(),y.catch(t=>{Zn(e,n,t,`BEFORE_LOAD`)}).then(v)}catch(t){u(),Zn(e,n,t,`BEFORE_LOAD`)}v(y)},tr=(e,t)=>{let{id:n,routeId:r}=e.matches[t],i=e.router.looseRoutesById[r],a=()=>s(),o=()=>er(e,n,t,i),s=()=>{if(Yn(e,n))return;let t=$n(e,n,i);return zt(t)?t.then(o):o()};return a()},nr=(e,t,n)=>{let r=e.router.getMatch(t);if(!r||!n.options.head&&!n.options.scripts&&!n.options.headers)return;let i={ssr:e.router.options.ssr,matches:e.matches,match:r,params:r.params,loaderData:r.loaderData};return Promise.all([n.options.head?.(i),n.options.scripts?.(i),n.options.headers?.(i)]).then(([e,t,n])=>({meta:e?.meta,links:e?.links,headScripts:e?.scripts,headers:n,scripts:t,styles:e?.styles}))},rr=(e,t,n,r,i)=>{let a=t[r-1],{params:o,loaderDeps:s,abortController:c,cause:l}=e.router.getMatch(n),u=Kn(e,r),d=Gn(e,n);return{params:o,deps:s,preload:!!d,parentMatchPromise:a,abortController:c,context:u,location:e.location,navigate:t=>e.router.navigate({...t,_fromLocation:e.location}),cause:d?`preload`:l,route:i,...e.router.options.additionalContext}},ir=async(e,t,n,r,i)=>{try{let a=e.router.getMatch(n);try{cr(i);let o=i.options.loader,s=typeof o==`function`?o:o?.handler,c=s?.(rr(e,t,n,r,i)),l=!!s&&zt(c);if((l||i._lazyPromise||i._componentsPromise||i.options.head||i.options.scripts||i.options.headers||a._nonReactive.minPendingPromise)&&e.updateMatch(n,e=>({...e,isFetching:`loader`})),s){let t=l?await c:c;Jn(e,e.router.getMatch(n),t),t!==void 0&&e.updateMatch(n,e=>({...e,loaderData:t}))}i._lazyPromise&&await i._lazyPromise;let u=a._nonReactive.minPendingPromise;u&&await u,i._componentsPromise&&await i._componentsPromise,e.updateMatch(n,t=>({...t,error:void 0,context:Kn(e,r),status:`success`,isFetching:!1,updatedAt:Date.now()}))}catch(t){let o=t;if(o?.name===`AbortError`){if(a.abortController.signal.aborted){a._nonReactive.loaderPromise?.resolve(),a._nonReactive.loaderPromise=void 0;return}e.updateMatch(n,t=>({...t,status:t.status===`pending`?`success`:t.status,isFetching:!1,context:Kn(e,r)}));return}let s=a._nonReactive.minPendingPromise;s&&await s,Mn(t)&&await i.options.notFoundComponent?.preload?.(),Jn(e,e.router.getMatch(n),t);try{i.options.onError?.(t)}catch(t){o=t,Jn(e,e.router.getMatch(n),t)}!Hn(o)&&!Mn(o)&&await cr(i,[`errorComponent`]),e.updateMatch(n,t=>({...t,error:o,context:Kn(e,r),status:`error`,isFetching:!1}))}}catch(t){let r=e.router.getMatch(n);r&&(r._nonReactive.loaderPromise=void 0),Jn(e,r,t)}},ar=async(e,t,n)=>{async function r(r,a,c,l,d){let f=Date.now()-a.updatedAt,p=r?d.options.preloadStaleTime??e.router.options.defaultPreloadStaleTime??3e4:d.options.staleTime??e.router.options.defaultStaleTime??0,m=d.options.shouldReload,h=typeof m==`function`?m(rr(e,t,i,n,d)):m,{status:g,invalid:_}=l,v=f>=p&&(!!e.forceStaleReload||l.cause===`enter`||c!==void 0&&c!==l.id);o=g===`success`&&(_||(h??v)),r&&d.options.preload===!1||(o&&!e.sync&&u?(s=!0,(async()=>{try{await ir(e,t,i,n,d);let r=e.router.getMatch(i);r._nonReactive.loaderPromise?.resolve(),r._nonReactive.loadPromise?.resolve(),r._nonReactive.loaderPromise=void 0,r._nonReactive.loadPromise=void 0}catch(t){Hn(t)&&await e.router.navigate(t.options)}})()):g!==`success`||o?await ir(e,t,i,n,d):Xn(e,i,n))}let{id:i,routeId:a}=e.matches[n],o=!1,s=!1,c=e.router.looseRoutesById[a],l=c.options.loader,u=((typeof l==`function`?void 0:l?.staleReloadMode)??e.router.options.defaultStaleReloadMode)!==`blocking`;if(Yn(e,i)){if(!e.router.getMatch(i))return e.matches[n];Xn(e,i,n)}else{let t=e.router.getMatch(i),o=e.router.stores.matchesId.get()[n],s=(o&&e.router.stores.matchStores.get(o)||null)?.routeId===a?o:e.router.stores.matches.get().find(e=>e.routeId===a)?.id,l=Gn(e,i);if(t._nonReactive.loaderPromise){if(t.status===`success`&&!e.sync&&!t.preload&&u)return t;await t._nonReactive.loaderPromise;let n=e.router.getMatch(i),a=n._nonReactive.error||n.error;a&&Jn(e,n,a),n.status===`pending`&&await r(l,t,s,n,c)}else{let n=l&&!e.router.stores.matchStores.has(i),a=e.router.getMatch(i);a._nonReactive.loaderPromise=Rt(),n!==a.preload&&e.updateMatch(i,e=>({...e,preload:n})),await r(l,t,s,a,c)}}let d=e.router.getMatch(i);s||(d._nonReactive.loaderPromise?.resolve(),d._nonReactive.loadPromise?.resolve(),d._nonReactive.loadPromise=void 0),clearTimeout(d._nonReactive.pendingTimeout),d._nonReactive.pendingTimeout=void 0,s||(d._nonReactive.loaderPromise=void 0),d._nonReactive.dehydrated=void 0;let f=s?d.isFetching:!1;return f!==d.isFetching||d.invalid!==!1?(e.updateMatch(i,e=>({...e,isFetching:f,invalid:!1})),e.router.getMatch(i)):d};async function or(e){let t=e,n=[];Wn(t.router)&&Un(t);let r;for(let e=0;e<t.matches.length;e++){try{let n=tr(t,e);zt(n)&&await n}catch(e){if(Hn(e))throw e;if(Mn(e))r=e;else if(!t.preload)throw e;break}if(t.serialError||t.firstBadMatchIndex!=null)break}let i=t.firstBadMatchIndex??t.matches.length,a=r&&!t.preload?qn(t,r):void 0,o=r&&t.preload?0:a===void 0?i:Math.min(a+1,i),s,c;for(let e=0;e<o;e++)n.push(ar(t,n,e));try{await Promise.all(n)}catch{let e=await Promise.allSettled(n);for(let t of e){if(t.status!==`rejected`)continue;let e=t.reason;if(Hn(e))throw e;Mn(e)?s??=e:c??=e}if(c!==void 0)throw c}let l=s??(r&&!t.preload?r:void 0),u=t.firstBadMatchIndex===void 0?t.matches.length-1:t.firstBadMatchIndex;if(!l&&r&&t.preload)return t.matches;if(l){let e=qn(t,l);e===void 0&&qt();let n=t.matches[e],r=t.router.looseRoutesById[n.routeId],i=t.router.options?.defaultNotFoundComponent;!r.options.notFoundComponent&&i&&(r.options.notFoundComponent=i),l.routeId=n.routeId;let a=n.routeId===t.router.routeTree.id;t.updateMatch(n.id,e=>({...e,...a?{status:`success`,globalNotFound:!0,error:void 0}:{status:`notFound`,error:l},isFetching:!1})),u=e,await cr(r,[`notFoundComponent`])}else if(!t.preload){let e=t.matches[0];e.globalNotFound||t.router.getMatch(e.id)?.globalNotFound&&t.updateMatch(e.id,e=>({...e,globalNotFound:!1,error:void 0}))}if(t.serialError&&t.firstBadMatchIndex!==void 0){let e=t.router.looseRoutesById[t.matches[t.firstBadMatchIndex].routeId];await cr(e,[`errorComponent`])}for(let e=0;e<=u;e++){let{id:n,routeId:r}=t.matches[e],i=t.router.looseRoutesById[r];try{let e=nr(t,n,i);if(e){let r=await e;t.updateMatch(n,e=>({...e,...r}))}}catch(e){console.error(`Error executing head for route ${r}:`,e)}}let d=Un(t);if(zt(d)&&await d,l)throw l;if(t.serialError&&!t.preload&&!t.onReady)throw t.serialError;return t.matches}function sr(e,t){let n=t.map(t=>e.options[t]?.preload?.()).filter(Boolean);if(n.length!==0)return Promise.all(n)}function cr(e,t=ur){!e._lazyLoaded&&e._lazyPromise===void 0&&(e.lazyFn?e._lazyPromise=e.lazyFn().then(t=>{let{id:n,...r}=t.options;Object.assign(e.options,r),e._lazyLoaded=!0,e._lazyPromise=void 0}):e._lazyLoaded=!0);let n=()=>e._componentsLoaded?void 0:t===ur?(()=>{if(e._componentsPromise===void 0){let t=sr(e,ur);t?e._componentsPromise=t.then(()=>{e._componentsLoaded=!0,e._componentsPromise=void 0}):e._componentsLoaded=!0}return e._componentsPromise})():sr(e,t);return e._lazyPromise?e._lazyPromise.then(n):n()}function lr(e){for(let t of ur)if(e.options[t]?.preload)return!0;return!1}var ur=[`component`,`errorComponent`,`pendingComponent`,`notFoundComponent`];function dr(e){return{input:({url:t})=>{for(let n of e)t=pr(n,t);return t},output:({url:t})=>{for(let n=e.length-1;n>=0;n--)t=mr(e[n],t);return t}}}function fr(e){let t=wn(e.basepath),n=`/${t}`,r=e.caseSensitive?n:n.toLowerCase(),i=`${r}/`;return{input:({url:t})=>{let a=e.caseSensitive?t.pathname:t.pathname.toLowerCase();return a===r?t.pathname=`/`:a.startsWith(i)&&(t.pathname=t.pathname.slice(n.length)),t},output:({url:e})=>(e.pathname=bn([`/`,t,e.pathname]),e)}}function pr(e,t){let n=e?.input?.({url:t});if(n){if(typeof n==`string`)return new URL(n);if(n instanceof URL)return n}return t}function mr(e,t){let n=e?.output?.({url:t});if(n){if(typeof n==`string`)return new URL(n);if(n instanceof URL)return n}return t}function hr(e,t){let{createMutableStore:n,createReadonlyStore:r,batch:i,init:a}=t,o=new Map,s=new Map,c=new Map,l=n(e.status),u=n(e.loadedAt),d=n(e.isLoading),f=n(e.isTransitioning),p=n(e.location),m=n(e.resolvedLocation),h=n(e.statusCode),g=n(e.redirect),_=n([]),v=n([]),y=n([]),b=r(()=>gr(o,_.get())),x=r(()=>gr(s,v.get())),S=r(()=>gr(c,y.get())),C=r(()=>_.get()[0]),w=r(()=>_.get().some(e=>o.get(e)?.get().status===`pending`)),T=r(()=>({locationHref:p.get().href,resolvedLocationHref:m.get()?.href,status:l.get()})),E=r(()=>({status:l.get(),loadedAt:u.get(),isLoading:d.get(),isTransitioning:f.get(),matches:b.get(),location:p.get(),resolvedLocation:m.get(),statusCode:h.get(),redirect:g.get()})),D=Jt(64);function O(e){let t=D.get(e);return t||(t=r(()=>{let t=_.get();for(let n of t){let t=o.get(n);if(t&&t.routeId===e)return t.get()}}),D.set(e,t)),t}let ee={status:l,loadedAt:u,isLoading:d,isTransitioning:f,location:p,resolvedLocation:m,statusCode:h,redirect:g,matchesId:_,pendingIds:v,cachedIds:y,matches:b,pendingMatches:x,cachedMatches:S,firstId:C,hasPending:w,matchRouteDeps:T,matchStores:o,pendingMatchStores:s,cachedMatchStores:c,__store:E,getRouteMatchStore:O,setMatches:te,setPending:ne,setCached:re};te(e.matches),a?.(ee);function te(e){_r(e,o,_,n,i)}function ne(e){_r(e,s,v,n,i)}function re(e){_r(e,c,y,n,i)}return ee}function gr(e,t){let n=[];for(let r of t){let t=e.get(r);t&&n.push(t.get())}return n}function _r(e,t,n,r,i){let a=e.map(e=>e.id),o=new Set(a);i(()=>{for(let e of t.keys())o.has(e)||t.delete(e);for(let n of e){let e=t.get(n.id);if(!e){let e=r(n);e.routeId=n.routeId,t.set(n.id,e);continue}e.routeId=n.routeId,e.get()!==n&&e.set(n)}Kt(n.get(),a)||n.set(a)})}var vr=`__TSR_index`,yr=`popstate`,br=`beforeunload`;function xr(e){let t=e.getLocation(),n=new Set,r=r=>{t=e.getLocation(),n.forEach(e=>e({location:t,action:r}))},i=n=>{e.notifyOnIndexChange??!0?r(n):t=e.getLocation()},a=async({task:n,navigateOpts:r,...i})=>{if(r?.ignoreBlocker??!1){n();return}let a=e.getBlockers?.()??[],o=i.type===`PUSH`||i.type===`REPLACE`;if(typeof document<`u`&&a.length&&o)for(let n of a){let r=Tr(i.path,i.state);if(await n.blockerFn({currentLocation:t,nextLocation:r,action:i.type})){e.onBlocked?.();return}}n()};return{get location(){return t},get length(){return e.getLength()},subscribers:n,subscribe:e=>(n.add(e),()=>{n.delete(e)}),push:(n,i,o)=>{let s=t.state[vr];i=Sr(s+1,i),a({task:()=>{e.pushState(n,i),r({type:`PUSH`})},navigateOpts:o,type:`PUSH`,path:n,state:i})},replace:(n,i,o)=>{let s=t.state[vr];i=Sr(s,i),a({task:()=>{e.replaceState(n,i),r({type:`REPLACE`})},navigateOpts:o,type:`REPLACE`,path:n,state:i})},go:(t,n)=>{a({task:()=>{e.go(t),i({type:`GO`,index:t})},navigateOpts:n,type:`GO`})},back:t=>{a({task:()=>{e.back(t?.ignoreBlocker??!1),i({type:`BACK`})},navigateOpts:t,type:`BACK`})},forward:t=>{a({task:()=>{e.forward(t?.ignoreBlocker??!1),i({type:`FORWARD`})},navigateOpts:t,type:`FORWARD`})},canGoBack:()=>t.state[vr]!==0,createHref:t=>e.createHref(t),block:t=>{if(!e.setBlockers)return()=>{};let n=e.getBlockers?.()??[];return e.setBlockers([...n,t]),()=>{let n=e.getBlockers?.()??[];e.setBlockers?.(n.filter(e=>e!==t))}},flush:()=>e.flush?.(),destroy:()=>e.destroy?.(),notify:r}}function Sr(e,t){t||={};let n=Er();return{...t,key:n,__TSR_key:n,[vr]:e}}function Cr(e){let t=e?.window??(typeof document<`u`?window:void 0),n=t.history.pushState,r=t.history.replaceState,i=[],a=()=>i,o=e=>i=e,s=e?.createHref??(e=>e),c=e?.parseLocation??(()=>Tr(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!t.history.state?.__TSR_key&&!t.history.state?.key){let e=Er();t.history.replaceState({[vr]:0,key:e,__TSR_key:e},``)}let l=c(),u,d=!1,f=!1,p=!1,m=!1,h=()=>l,g,_,v=()=>{g&&(C._ignoreSubscribers=!0,(g.isPush?t.history.pushState:t.history.replaceState)(g.state,``,g.href),C._ignoreSubscribers=!1,g=void 0,_=void 0,u=void 0)},y=(e,t,n)=>{let r=s(t);_||(u=l),l=Tr(t,n),g={href:r,state:n,isPush:g?.isPush||e===`push`},_||=Promise.resolve().then(()=>v())},b=e=>{l=c(),C.notify({type:e})},x=async()=>{if(f){f=!1;return}let e=c(),n=e.state[vr]-l.state[vr],r=n===1,i=n===-1,o=!r&&!i||d;d=!1;let s=o?`GO`:i?`BACK`:`FORWARD`,u=o?{type:`GO`,index:n}:{type:i?`BACK`:`FORWARD`};if(p)p=!1;else{let n=a();if(typeof document<`u`&&n.length){for(let r of n)if(await r.blockerFn({currentLocation:l,nextLocation:e,action:s})){f=!0,t.history.go(1),C.notify(u);return}}}l=c(),C.notify(u)},S=e=>{if(m){m=!1;return}let t=!1,n=a();if(typeof document<`u`&&n.length)for(let e of n){let n=e.enableBeforeUnload??!0;if(n===!0){t=!0;break}if(typeof n==`function`&&n()===!0){t=!0;break}}if(t)return e.preventDefault(),e.returnValue=``},C=xr({getLocation:h,getLength:()=>t.history.length,pushState:(e,t)=>y(`push`,e,t),replaceState:(e,t)=>y(`replace`,e,t),back:e=>(e&&(p=!0),m=!0,t.history.back()),forward:e=>{e&&(p=!0),m=!0,t.history.forward()},go:e=>{d=!0,t.history.go(e)},createHref:e=>s(e),flush:v,destroy:()=>{t.history.pushState=n,t.history.replaceState=r,t.removeEventListener(br,S,{capture:!0}),t.removeEventListener(yr,x)},onBlocked:()=>{u&&l!==u&&(l=u)},getBlockers:a,setBlockers:o,notifyOnIndexChange:!1});return t.addEventListener(br,S,{capture:!0}),t.addEventListener(yr,x),t.history.pushState=function(...e){let r=n.apply(t.history,e);return C._ignoreSubscribers||b(`PUSH`),r},t.history.replaceState=function(...e){let n=r.apply(t.history,e);return C._ignoreSubscribers||b(`REPLACE`),n},C}function wr(e){let t=e.replace(/[\x00-\x1f\x7f]/g,``);return t.startsWith(`//`)&&(t=`/`+t.replace(/^\/+/,``)),t}function Tr(e,t){let n=wr(e),r=n.indexOf(`#`),i=n.indexOf(`?`),a=Er();return{href:n,pathname:n.substring(0,r>0?i>0?Math.min(r,i):r:i>0?i:n.length),hash:r>-1?n.substring(r):``,search:i>-1?n.slice(i,r===-1?void 0:r):``,state:t||{[vr]:0,key:a,__TSR_key:a}}}function Er(){return(Math.random()+1).toString(36).substring(7)}function Dr(e,t){let n=t,r=e;return{fromLocation:n,toLocation:r,pathChanged:n?.pathname!==r.pathname,hrefChanged:n?.href!==r.href,hashChanged:n?.hash!==r.hash}}var Or=new WeakMap,kr=class{constructor(e,t){this.tempLocationKey=`${Math.round(Math.random()*1e7)}`,this.resetNextScroll=!0,this.shouldViewTransition=void 0,this.isViewTransitionTypesSupported=void 0,this.subscribers=new Set,this.isScrollRestoring=!1,this.isScrollRestorationSetup=!1,this.routeBranchCache=new WeakMap,this.startTransition=e=>e(),this.update=e=>{let t=this.options,n=this.basepath??t?.basepath??`/`,r=this.basepath===void 0,i=t?.rewrite;if(this.options={...t,...e},this.isServer=this.options.isServer??typeof document>`u`,this.protocolAllowlist=new Set(this.options.protocolAllowlist),this.options.pathParamsAllowedCharacters&&(this.pathParamsDecoder=On(this.options.pathParamsAllowedCharacters)),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.options.history?this.history=this.options.history:this.history=Cr()),this.origin=this.options.origin,this.origin||(window?.origin&&window.origin!==`null`?this.origin=window.origin:this.origin=`http://localhost`),this.history&&this.updateLatestLocation(),this.options.routeTree!==this.routeTree){this.routeTree=this.options.routeTree;let e;this.resolvePathCache=Jt(1e3),e=this.buildRouteTree(),this.setRoutes(e)}if(!this.stores&&this.latestLocation){let e=this.getStoreConfig(this);this.batch=e.batch,this.stores=hr(Mr(this.latestLocation),e),Qr(this)}let a=!1,o=this.options.basepath??`/`,s=this.options.rewrite;if(r||n!==o||i!==s){this.basepath=o;let e=[],t=wn(o);t&&t!==`/`&&e.push(fr({basepath:o})),s&&e.push(s),this.rewrite=e.length===0?void 0:e.length===1?e[0]:dr(e),this.history&&this.updateLatestLocation(),a=!0}a&&this.stores&&this.stores.location.set(this.latestLocation),typeof window<`u`&&`CSS`in window&&typeof window.CSS?.supports==`function`&&(this.isViewTransitionTypesSupported=window.CSS.supports(`selector(:active-view-transition-type(a))`))},this.updateLatestLocation=()=>{this.latestLocation=this.parseLocation(this.history.location,this.latestLocation)},this.buildRouteTree=()=>{let e=un(this.routeTree,this.options.caseSensitive,(e,t)=>{e.init({originalIndex:t})});return this.options.routeMasks&&an(this.options.routeMasks,e.processedTree),e},this.subscribe=(e,t)=>{let n={eventType:e,fn:t};return this.subscribers.add(n),()=>{this.subscribers.delete(n)}},this.emit=e=>{this.subscribers.forEach(t=>{t.eventType===e.type&&t.fn(e)})},this.parseLocation=(e,t)=>{let n=({pathname:e,search:n,hash:r,href:i,state:a})=>{if(!this.rewrite&&!/[ \x00-\x1f\x7f\u0080-\uffff]/.test(e)){let i=this.options.parseSearch(n),o=this.options.stringifySearch(i);return{href:e+o+r,publicHref:e+o+r,pathname:Wt(e).path,external:!1,searchStr:o,search:jt(t?.search,i),hash:Wt(r.slice(1)).path,state:Mt(t?.state,a)}}let o=new URL(i,this.origin),s=pr(this.rewrite,o),c=this.options.parseSearch(s.search),l=this.options.stringifySearch(c);return s.search=l,{href:s.href.replace(s.origin,``),publicHref:i,pathname:Wt(s.pathname).path,external:!!this.rewrite&&s.origin!==this.origin,searchStr:l,search:jt(t?.search,c),hash:Wt(s.hash.slice(1)).path,state:Mt(t?.state,a)}},r=n(e),{__tempLocation:i,__tempKey:a}=r.state;if(i&&(!a||a===this.tempLocationKey)){let e=n(i);return e.state.key=r.state.key,e.state.__TSR_key=r.state.__TSR_key,delete e.state.__tempLocation,{...e,maskedLocation:r}}return r},this.resolvePathWithBase=(e,t)=>Dn({base:e,to:t.includes(`//`)?xn(t):t,trailingSlash:this.options.trailingSlash,cache:this.resolvePathCache}),this.matchRoutes=(e,t,n)=>typeof e==`string`?this.matchRoutesInternal({pathname:e,search:t},n):this.matchRoutesInternal(e,t),this.getMatchedRoutes=e=>Pr({pathname:e,routesById:this.routesById,processedTree:this.processedTree}),this.cancelMatch=e=>{let t=this.getMatch(e);t&&(t.abortController.abort(),clearTimeout(t._nonReactive.pendingTimeout),t._nonReactive.pendingTimeout=void 0)},this.cancelMatches=()=>{this.stores.pendingIds.get().forEach(e=>{this.cancelMatch(e)}),this.stores.matchesId.get().forEach(e=>{if(this.stores.pendingMatchStores.has(e))return;let t=this.stores.matchStores.get(e)?.get();t&&(t.status===`pending`||t.isFetching===`loader`)&&this.cancelMatch(e)})},this.buildLocation=e=>{let t=(t={})=>{let n=t._fromLocation||this.pendingBuiltLocation||this.latestLocation,r=this.matchRoutesLightweight(n);t.from;let i=t.unsafeRelative===`path`?n.pathname:t.from??r.fullPath,a=t.to?`${t.to}`:void 0,o=r.search,s=Object.assign(Object.create(null),r.params),c=a?.charCodeAt(0)===47?`/`:this.resolvePathWithBase(i,`.`),l=a?this.resolvePathWithBase(c,a):c,u=t.params===!1||t.params===null?Object.create(null):(t.params??!0)===!0?s:Object.assign(s,Et(t.params,s)),d=this.routesByPath[Cn(l)],f;if(d)f=this.getRouteBranch(d);else if(l.includes(`$`))f=[];else{let e=this.getMatchedRoutes(l);f=e.matchedRoutes,this.options.notFoundRoute&&(!e.foundRoute||e.foundRoute.path!==`/`&&e.routeParams[`**`])&&(f=[...f,this.options.notFoundRoute])}if(f.length&&kt(u))for(let e of f){let t=e.options.params?.stringify??e.options.stringifyParams;if(t)try{Object.assign(u,t(u))}catch{}}let p=e.leaveParams?l:Wt(An({path:l,params:u,decoder:this.pathParamsDecoder,server:this.isServer}).interpolatedPath).path,m=o;if(e._includeValidateSearch&&this.options.search?.strict){let e={};f.forEach(t=>{if(t.options.validateSearch)try{Object.assign(e,Nr(t.options.validateSearch,{...e,...m}))}catch{}}),m=e}m=Fr({search:m,dest:t,destRoutes:f,_includeValidateSearch:e._includeValidateSearch}),m=jt(o,m);let h=this.options.stringifySearch(m),g=t.hash===!0?n.hash:t.hash?Et(t.hash,n.hash):void 0,_=g?`#${g}`:``,v=t.state===!0?n.state:t.state?Et(t.state,n.state):{};v=Mt(n.state,v);let y=`${p}${h}${_}`,b,x,S=!1;if(this.rewrite){let e=new URL(y,this.origin),t=mr(this.rewrite,e);b=e.href.replace(e.origin,``),t.origin===this.origin?x=t.pathname+t.search+t.hash:(x=t.href,S=!0)}else b=Gt(y),x=b;return{publicHref:x,href:b,pathname:p,search:m,searchStr:h,state:v,hash:g??``,external:S,unmaskOnReload:t.unmaskOnReload}},n=(n={},r)=>{let i=t(n),a=r?t(r):void 0;if(!a){let n=Object.create(null);if(this.options.routeMasks){let o=on(i.pathname,this.processedTree);if(o){Object.assign(n,o.rawParams);let{from:i,params:s,...c}=o.route,l=s===!1||s===null?Object.create(null):(s??!0)===!0?n:Object.assign(n,Et(s,n));r={from:e.from,...c,params:l},a=t(r)}}}return a&&(i.maskedLocation=a),i};return e.mask?n(e,{from:e.from,...e.mask}):n(e)},this.commitLocation=async({viewTransition:e,ignoreBlocker:t,...n})=>{let r,i=()=>{let e=[`key`,`__TSR_key`,`__TSR_index`,`__hashScrollIntoViewOptions`];e.forEach(e=>{n.state[e]=this.latestLocation.state[e]});let t=Lt(n.state,this.latestLocation.state);return e.forEach(e=>{delete n.state[e]}),t},a=Cn(this.latestLocation.href)===Cn(n.href),o=this.commitLocationPromise;if(this.commitLocationPromise=Rt(()=>{o?.resolve(),o=void 0}),a&&i())this.load();else{let{maskedLocation:i,hashScrollIntoView:a,...o}=n;i&&(o={...i,state:{...i.state,__tempKey:void 0,__tempLocation:{...o,search:o.searchStr,state:{...o.state,__tempKey:void 0,__tempLocation:void 0,__TSR_key:void 0,key:void 0}}}},(o.unmaskOnReload??this.options.unmaskOnReload??!1)&&(o.state.__tempKey=this.tempLocationKey)),o.state.__hashScrollIntoViewOptions=a??this.options.defaultHashScrollIntoView??!0,this.shouldViewTransition=e,r=n.replace?`REPLACE`:`PUSH`,this.history[r===`REPLACE`?`replace`:`push`](o.publicHref,o.state,{ignoreBlocker:t})}return this.resetNextScroll=n.resetScroll??!0,this.history.subscribers.size||this.load(r?{action:{type:r}}:void 0),this.commitLocationPromise},this.buildAndCommitLocation=({replace:e,resetScroll:t,hashScrollIntoView:n,viewTransition:r,ignoreBlocker:i,href:a,...o}={})=>{if(a){let t=this.history.location.state.__TSR_index,n=Tr(a,{__TSR_index:e?t:t+1}),r=new URL(n.pathname,this.origin);o.to=pr(this.rewrite,r).pathname,o.search=this.options.parseSearch(n.search),o.hash=n.hash.slice(1)}let s=this.buildLocation({...o,_includeValidateSearch:!0});this.pendingBuiltLocation=s;let c=this.commitLocation({...s,viewTransition:r,replace:e,resetScroll:t,hashScrollIntoView:n,ignoreBlocker:i});return Promise.resolve().then(()=>{this.pendingBuiltLocation===s&&(this.pendingBuiltLocation=void 0)}),c},this.navigate=async({to:e,reloadDocument:t,href:n,publicHref:r,...i})=>{let a=!1;if(n)try{new URL(`${n}`),a=!0}catch{}if(a&&!t&&(t=!0),t){if(e!==void 0||!n){let t=this.buildLocation({to:e,...i});n??=t.publicHref,r??=t.publicHref}let t=!a&&r?r:n;if(Ut(t,this.protocolAllowlist))return Promise.resolve();if(!i.ignoreBlocker){let e=this.history.getBlockers?.()??[];for(let t of e)if(t?.blockerFn&&await t.blockerFn({currentLocation:this.latestLocation,nextLocation:this.latestLocation,action:`PUSH`}))return Promise.resolve()}return i.replace?window.location.replace(t):window.location.href=t,Promise.resolve()}return this.buildAndCommitLocation({...i,href:n,to:e,_isNavigate:!0})},this.beforeLoad=()=>{this.cancelMatches(),this.updateLatestLocation();let e=this.matchRoutes(this.latestLocation),t=this.stores.cachedMatches.get().filter(t=>!e.some(e=>e.id===t.id));this.batch(()=>{this.stores.status.set(`pending`),this.stores.statusCode.set(200),this.stores.isLoading.set(!0),this.stores.location.set(this.latestLocation),this.stores.setPending(e),this.stores.setCached(t)})},this.load=async e=>{let t=e?.action?.type,n,r,i,a=this.stores.resolvedLocation.get()??this.stores.location.get();for(i=new Promise(o=>{this.startTransition(async()=>{try{this.beforeLoad(),t?Or.set(this.latestLocation,t):Or.delete(this.latestLocation);let n=this.latestLocation,r=Dr(n,this.stores.resolvedLocation.get());this.stores.redirect.get()||this.emit({type:`onBeforeNavigate`,...r}),this.emit({type:`onBeforeLoad`,...r}),await or({router:this,sync:e?.sync,forceStaleReload:a.href===n.href,matches:this.stores.pendingMatches.get(),location:n,updateMatch:this.updateMatch,onReady:async()=>{this.startTransition(()=>{this.startViewTransition(async()=>{let e=null,t=null,n=null,r=null;this.batch(()=>{let i=this.stores.pendingMatches.get(),a=i.length,o=this.stores.matches.get();e=a?o.filter(e=>!this.stores.pendingMatchStores.has(e.id)):null;let s=new Set;for(let e of this.stores.pendingMatchStores.values())e.routeId&&s.add(e.routeId);let c=new Set;for(let e of this.stores.matchStores.values())e.routeId&&c.add(e.routeId);t=a?o.filter(e=>!s.has(e.routeId)):null,n=a?i.filter(e=>!c.has(e.routeId)):null,r=a?i.filter(e=>c.has(e.routeId)):o,this.stores.isLoading.set(!1),this.stores.loadedAt.set(Date.now()),a&&(this.stores.setMatches(i),this.stores.setPending([]),this.stores.setCached([...this.stores.cachedMatches.get(),...e.filter(e=>e.status!==`error`&&e.status!==`notFound`&&e.status!==`redirected`)]),this.clearExpiredCache())});for(let[e,i]of[[t,`onLeave`],[n,`onEnter`],[r,`onStay`]])if(e)for(let t of e)this.looseRoutesById[t.routeId].options[i]?.(t)})})}})}catch(e){Hn(e)?(n=e,this.navigate({...n.options,replace:!0,ignoreBlocker:!0})):Mn(e)&&(r=e);let t=n?n.status:r?404:this.stores.matches.get().some(e=>e.status===`error`)?500:200;this.batch(()=>{this.stores.statusCode.set(t),this.stores.redirect.set(n)})}this.latestLoadPromise===i&&(this.commitLocationPromise?.resolve(),this.latestLoadPromise=void 0,this.commitLocationPromise=void 0),o()})}),this.latestLoadPromise=i,await i;this.latestLoadPromise&&i!==this.latestLoadPromise;)await this.latestLoadPromise;let o;this.hasNotFoundMatch()?o=404:this.stores.matches.get().some(e=>e.status===`error`)&&(o=500),o!==void 0&&this.stores.statusCode.set(o)},this.startViewTransition=e=>{let t=this.shouldViewTransition??this.options.defaultViewTransition;if(this.shouldViewTransition=void 0,t&&typeof document<`u`&&`startViewTransition`in document&&typeof document.startViewTransition==`function`){let n;if(typeof t==`object`&&this.isViewTransitionTypesSupported){let r=this.latestLocation,i=this.stores.resolvedLocation.get(),a=typeof t.types==`function`?t.types(Dr(r,i)):t.types;if(a===!1){e();return}n={update:e,types:a}}else n=e;document.startViewTransition(n)}else e()},this.updateMatch=(e,t)=>{this.startTransition(()=>{let n=this.stores.pendingMatchStores.get(e);if(n){n.set(t);return}let r=this.stores.matchStores.get(e);if(r){r.set(t);return}let i=this.stores.cachedMatchStores.get(e);if(i){let n=t(i.get());n.status===`redirected`?this.stores.cachedMatchStores.delete(e)&&this.stores.cachedIds.set(t=>t.filter(t=>t!==e)):i.set(n)}})},this.getMatch=e=>this.stores.cachedMatchStores.get(e)?.get()??this.stores.pendingMatchStores.get(e)?.get()??this.stores.matchStores.get(e)?.get(),this.invalidate=e=>{let t=t=>e?.filter?.(t)??!0?{...t,invalid:!0,...e?.forcePending||t.status===`error`||t.status===`notFound`?{status:`pending`,error:void 0}:void 0}:t;return this.batch(()=>{this.stores.setMatches(this.stores.matches.get().map(t)),this.stores.setCached(this.stores.cachedMatches.get().map(t)),this.stores.setPending(this.stores.pendingMatches.get().map(t))}),this.shouldViewTransition=!1,this.load({sync:e?.sync})},this.getParsedLocationHref=e=>e.publicHref||`/`,this.resolveRedirect=e=>{let t=e.headers.get(`Location`);if(!e.options.href||e.options._builtLocation){let t=e.options._builtLocation??this.buildLocation(e.options),n=this.getParsedLocationHref(t);e.options.href=n,e.headers.set(`Location`,n)}else if(t)try{let n=new URL(t);if(this.origin&&n.origin===this.origin){let t=n.pathname+n.search+n.hash;e.options.href=t,e.headers.set(`Location`,t)}}catch{}if(e.options.href&&!e.options._builtLocation&&Ut(e.options.href,this.protocolAllowlist))throw Error(`Redirect blocked: unsafe protocol`);return e.headers.get(`Location`)||e.headers.set(`Location`,e.options.href),e},this.clearCache=e=>{let t=e?.filter;t===void 0?this.stores.setCached([]):this.stores.setCached(this.stores.cachedMatches.get().filter(e=>!t(e)))},this.clearExpiredCache=()=>{let e=Date.now();this.clearCache({filter:t=>{let n=this.looseRoutesById[t.routeId];if(!n.options.loader)return!0;let r=(t.preload?n.options.preloadGcTime??this.options.defaultPreloadGcTime:n.options.gcTime??this.options.defaultGcTime)??300*1e3;return t.status===`error`?!0:e-t.updatedAt>=r}})},this.loadRouteChunk=cr,this.preloadRoute=async e=>{let t=e._builtLocation??this.buildLocation(e),n=this.matchRoutes(t,{throwOnError:!0,preload:!0,dest:e}),r=new Set([...this.stores.matchesId.get(),...this.stores.pendingIds.get()]),i=new Set([...r,...this.stores.cachedIds.get()]),a=n.filter(e=>!i.has(e.id));if(a.length){let e=this.stores.cachedMatches.get();this.stores.setCached([...e,...a])}try{return n=await or({router:this,matches:n,location:t,preload:!0,updateMatch:(e,t)=>{r.has(e)?n=n.map(n=>n.id===e?t(n):n):this.updateMatch(e,t)}}),n}catch(e){if(Hn(e))return e.options.reloadDocument?void 0:await this.preloadRoute({...e.options,_fromLocation:t});Mn(e)||console.error(e);return}},this.matchRoute=(e,t)=>{let n={...e,to:e.to?this.resolvePathWithBase(e.from||``,e.to):void 0,params:e.params||{},leaveParams:!0},r=this.buildLocation(n);if(t?.pending&&this.stores.status.get()!==`pending`)return!1;let i=(t?.pending===void 0?!this.stores.isLoading.get():t.pending)?this.latestLocation:this.stores.resolvedLocation.get()||this.stores.location.get(),a=sn(r.pathname,t?.caseSensitive??!1,t?.fuzzy??!1,i.pathname,this.processedTree);return!a||e.params&&!Lt(a.rawParams,e.params,{partial:!0})?!1:t?.includeSearch??!0?Lt(i.search,r.search,{partial:!0})?a.rawParams:!1:a.rawParams},this.hasNotFoundMatch=()=>this.stores.matches.get().some(e=>e.status===`notFound`||e.globalNotFound),this.getStoreConfig=t,this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...e,caseSensitive:e.caseSensitive??!1,notFoundMode:e.notFoundMode??`fuzzy`,stringifySearch:e.stringifySearch??Ln,parseSearch:e.parseSearch??In,protocolAllowlist:e.protocolAllowlist??Ht}),typeof document<`u`&&(self.__TSR_ROUTER__=this)}isShell(){return!!this.options.isShell}isPrerendering(){return!!this.options.isPrerendering}get state(){return this.stores.__store.get()}setRoutes({routesById:e,routesByPath:t,processedTree:n}){this.routesById=e,this.routesByPath=t,this.processedTree=n;let r=this.options.notFoundRoute;r&&(r.init({originalIndex:99999999999}),this.routesById[r.id]=r)}getRouteBranch(e){let t=this.routeBranchCache.get(e);return t||(t=pn(e),this.routeBranchCache.set(e,t)),t}get looseRoutesById(){return this.routesById}getParentContext(e){return e?.id?e.context??this.options.context??void 0:this.options.context??void 0}matchRoutesInternal(e,t){let n=this.getMatchedRoutes(e.pathname),{foundRoute:r,routeParams:i}=n,{matchedRoutes:a}=n,o=!1;(r?r.path!==`/`&&i[`**`]:Cn(e.pathname))&&(this.options.notFoundRoute?a=[...a,this.options.notFoundRoute]:o=!0);let s=o?Lr(this.options.notFoundMode,a):void 0,c=Array(a.length),l=new Map;for(let e of this.stores.matchStores.values())e.routeId&&l.set(e.routeId,e.get());for(let n=0;n<a.length;n++){let r=a[n],o=c[n-1],u,d,f;{let n=o?.search??e.search,i=o?._strictSearch??void 0;try{let e=Nr(r.options.validateSearch,{...n})??void 0;u={...n,...e},d={...i,...e},f=void 0}catch(e){let r=e;if(e instanceof Ar||(r=new Ar(e.message,{cause:e})),t?.throwOnError)throw r;u=n,d={},f=r}}let p=r.options.loaderDeps?.({search:u})??``,m=p?JSON.stringify(p):``,{interpolatedPath:h,usedParams:g}=An({path:r.fullPath,params:i,decoder:this.pathParamsDecoder,server:this.isServer}),_=r.id+h+m,v=this.getMatch(_),y=l.get(r.id),b=v?._strictParams??g,x;if(!v)try{Rr(r,b)}catch(e){if(x=Mn(e)||Hn(e)?e:new jr(e.message,{cause:e}),t?.throwOnError)throw x}Object.assign(i,b);let S=y?`stay`:`enter`,C;if(v)C={...v,cause:S,params:y?.params??i,_strictParams:b,search:jt(y?y.search:v.search,u),_strictSearch:d};else{let e=r.options.loader||r.options.beforeLoad||r.lazyFn||lr(r)?`pending`:`success`;C={id:_,ssr:r.options.ssr,index:n,routeId:r.id,params:y?.params??i,_strictParams:b,pathname:h,updatedAt:Date.now(),search:y?jt(y.search,u):u,_strictSearch:d,searchError:void 0,status:e,isFetching:!1,error:void 0,paramsError:x,__routeContext:void 0,_nonReactive:{loadPromise:Rt()},__beforeLoadContext:void 0,context:{},abortController:new AbortController,fetchCount:0,cause:S,loaderDeps:y?Mt(y.loaderDeps,p):p,invalid:!1,preload:!1,links:void 0,scripts:void 0,headScripts:void 0,meta:void 0,staticData:r.options.staticData||{},fullPath:r.fullPath}}t?.preload||(C.globalNotFound=s===r.id),C.searchError=f;let w=this.getParentContext(o);C.context={...w,...C.__routeContext,...C.__beforeLoadContext},c[n]=C}for(let t=0;t<c.length;t++){let n=c[t],r=this.looseRoutesById[n.routeId],a=this.getMatch(n.id),o=l.get(n.routeId);if(n.params=o?jt(o.params,i):i,!a){let i=c[t-1],a=this.getParentContext(i);if(r.options.context){let t={deps:n.loaderDeps,params:n.params,context:a??{},location:e,navigate:t=>this.navigate({...t,_fromLocation:e}),buildLocation:this.buildLocation,cause:n.cause,abortController:n.abortController,preload:!!n.preload,matches:c,routeId:r.id};n.__routeContext=r.options.context(t)??void 0}n.context={...a,...n.__routeContext,...n.__beforeLoadContext}}}return c}matchRoutesLightweight(e){let{matchedRoutes:t,routeParams:n}=this.getMatchedRoutes(e.pathname),r=wt(t),i={...e.search};for(let e of t)try{Object.assign(i,Nr(e.options.validateSearch,i))}catch{}let a=wt(this.stores.matchesId.get()),o=a&&this.stores.matchStores.get(a)?.get(),s=o&&o.routeId===r.id&&o.pathname===e.pathname,c;if(s)c=o.params;else{let e=Object.assign(Object.create(null),n);for(let n of t)try{Rr(n,e)}catch{}c=e}return{matchedRoutes:t,fullPath:r.fullPath,search:i,params:c}}},Ar=class extends Error{},jr=class extends Error{};function Mr(e){return{loadedAt:0,isLoading:!1,isTransitioning:!1,status:`idle`,resolvedLocation:void 0,location:e,matches:[],statusCode:200}}function Nr(e,t){if(e==null)return{};if(`~standard`in e){let n=e[`~standard`].validate(t);if(n instanceof Promise)throw new Ar(`Async validation not supported`);if(n.issues)throw new Ar(JSON.stringify(n.issues,void 0,2),{cause:n});return n.value}return`parse`in e?e.parse(t):typeof e==`function`?e(t):{}}function Pr({pathname:e,routesById:t,processedTree:n}){let r=Object.create(null),i=Cn(e),a,o=cn(i,n,!0);return o&&(a=o.route,Object.assign(r,o.rawParams)),{matchedRoutes:o?.branch||[t.__root__],routeParams:r,foundRoute:a}}function Fr({search:e,dest:t,destRoutes:n,_includeValidateSearch:r}){return Ir(n)(e,t,r??!1)}function Ir(e){let t={dest:null,_includeValidateSearch:!1,middlewares:[]};for(let n of e)`search`in n.options?n.options.search?.middlewares&&t.middlewares.push(...n.options.search.middlewares):(n.options.preSearchFilters||n.options.postSearchFilters)&&t.middlewares.push(({search:e,next:t})=>{let r=e;`preSearchFilters`in n.options&&n.options.preSearchFilters&&(r=n.options.preSearchFilters.reduce((e,t)=>t(e),e));let i=t(r);return`postSearchFilters`in n.options&&n.options.postSearchFilters?n.options.postSearchFilters.reduce((e,t)=>t(e),i):i}),n.options.validateSearch&&t.middlewares.push(({search:e,next:r})=>{let i=r(e);if(!t._includeValidateSearch)return i;try{return{...i,...Nr(n.options.validateSearch,i)??void 0}}catch{return i}});t.middlewares.push(({search:e})=>{let n=t.dest;return n.search?n.search===!0?e:Et(n.search,e):{}});let n=(e,t,r)=>{if(e>=r.length)return t;let i=r[e];return i({search:t,next:t=>n(e+1,t,r)})};return function(e,r,i){return t.dest=r,t._includeValidateSearch=i,n(0,e,t.middlewares)}}function Lr(e,t){if(e!==`root`)for(let e=t.length-1;e>=0;e--){let n=t[e];if(n.children)return n.id}return Bn}function Rr(e,t){let n=e.options.params?.parse??e.options.parseParams;if(n){let e=n(t);if(e===!1)throw Error(`Route params.parse returned false for a matched route`);Object.assign(t,e)}}function zr(){try{return sessionStorage}catch{return}}var Br=`tsr-scroll-restoration-v1_3`,Vr=zr();function Hr(){try{return JSON.parse(Vr?.getItem(`tsr-scroll-restoration-v1_3`)||`{}`)}catch{return{}}}function Ur(){try{Vr?.setItem(Br,JSON.stringify(Wr))}catch{}}var Wr=Hr(),Gr=`data-scroll-restoration-id`,Kr=e=>e.state.__TSR_key||e.href;function qr(e){let t=e.getAttribute(Gr);if(t)return`[${Gr}="${t}"]`;let n=``,r=e,i;for(;i=r.parentNode;){let e=1,t=r;for(;t=t.previousElementSibling;)e++;let a=`${r.localName}:nth-child(${e})`;n=n?`${a} > ${n}`:a,r=i}return n}var Jr=!1,Yr=`window`;function Xr(e){try{return typeof e==`function`?e():document.querySelector(e)}catch{}}function Zr(e){let t=[];for(let n of e){if(n===Yr)continue;let e=Xr(n);e&&t.push(e)}return t}function Qr(e,t){if((t??e.options.scrollRestoration)&&(e.isScrollRestoring=!0),e.isScrollRestorationSetup)return;e.isScrollRestorationSetup=!0,Jr=!1;let n=e.options.getScrollRestorationKey||Kr,r=new Map,i=(e,t,n)=>{let i=r.get(e)||{};i.scrollX=t,i.scrollY=n,r.set(e,i)};history.scrollRestoration=`manual`;let a=t=>{if(!(Jr||!e.isScrollRestoring))if(t.target===document)i(Yr,scrollX,scrollY);else{let e=t.target;i(e,e.scrollLeft,e.scrollTop)}},o=t=>{if(!e.isScrollRestoring)return;let n=Wr[t]||={};for(let[e,t]of r)e===Yr?n[Yr]=t:e.isConnected&&(n[qr(e)]=t)};document.addEventListener(`scroll`,a,!0),e.subscribe(`onBeforeLoad`,e=>{e.fromLocation&&o(n(e.fromLocation)),r.clear()}),addEventListener(`pagehide`,()=>{o(n(e.stores.resolvedLocation.get()??e.stores.location.get())),Ur()}),e.subscribe(`onRendered`,t=>{let i=e.options.scrollRestorationBehavior,a=e.options.scrollToTopSelectors,o=e.resetNextScroll,s;if(r.clear(),o||(e.resetNextScroll=!0),typeof e.options.scrollRestoration==`function`&&!e.options.scrollRestoration({location:e.latestLocation}))return;let c=n(t.toLocation),l=t.fromLocation&&n(t.fromLocation);if(e.isScrollRestoring&&l&&l!==c){let e=Wr[l];if(e){let t=Wr[c];for(let n in e){if(n===Yr){if(o)continue}else{let e=Xr(n);if(!e||o&&a&&(s??=Zr(a),s.includes(e)))continue}t||=Wr[c]={},t[n]??=e[n]}}}Jr=!0;try{let n=t.toLocation.hash,r=t.toLocation.state.__hashScrollIntoViewOptions??!0,l=!1;if(o){let o=Or.get(t.toLocation),u=n&&r&&(o===`PUSH`||o===`REPLACE`),d=e.isScrollRestoring?Wr[c]:void 0;if(d)for(let e in d){let{scrollX:t,scrollY:n}=d[e];if(e===Yr){if(u)continue;scrollTo({top:n,left:t,behavior:i}),l=!0}else{let r=Xr(e);r&&(r.scrollLeft=t,r.scrollTop=n)}}if(!l&&!n){let e={top:0,left:0,behavior:i};if(scrollTo(e),a){s??=Zr(a);for(let t of s)t.scrollTo(e)}}}!l&&n&&r&&document.getElementById(n)?.scrollIntoView(r)}finally{Jr=!1}})}var $r=`Error preloading route! ☝️`,ei=class{get to(){return this._to}get id(){return this._id}get path(){return this._path}get fullPath(){return this._fullPath}constructor(e){if(this.init=e=>{this.originalIndex=e.originalIndex;let t=this.options,n=!t?.path&&!t?.id;this.parentRoute=this.options.getParentRoute?.(),n?this._path=Bn:this.parentRoute||qt();let r=n?Bn:t?.path;r&&r!==`/`&&(r=Sn(r));let i=t?.id||r,a=n?Bn:bn([this.parentRoute.id===`__root__`?``:this.parentRoute.id,i]);r===`__root__`&&(r=`/`),a!==`__root__`&&(a=bn([`/`,a]));let o=a===`__root__`?`/`:bn([this.parentRoute.fullPath,r]);this._path=r,this._id=a,this._fullPath=o,this._to=Cn(o)},this.addChildren=e=>this._addFileChildren(e),this._addFileChildren=e=>(Array.isArray(e)&&(this.children=e),typeof e==`object`&&e&&(this.children=Object.values(e)),this),this._addFileTypes=()=>this,this.updateLoader=e=>(Object.assign(this.options,e),this),this.update=e=>(Object.assign(this.options,e),this),this.lazy=e=>(this.lazyFn=e,this),this.redirect=e=>Vn({from:this.fullPath,...e}),this.options=e||{},this.isRoot=!e?.getParentRoute,e?.id&&e?.path)throw Error(`Route cannot have both an 'id' and a 'path' option.`)}},ti=class extends ei{constructor(e){super(e)}},ni=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),M=o(((e,t)=>{t.exports=ni()}))();function ri(e){let t=e.errorComponent??ai;return(0,M.jsx)(ii,{getResetKey:e.getResetKey,onCatch:e.onCatch,children:({error:n,reset:r})=>n?j.createElement(t,{error:n,reset:r}):e.children})}var ii=class extends j.Component{constructor(...e){super(...e),this.state={error:null}}static getDerivedStateFromProps(e,t){let n=e.getResetKey();return t.error&&t.resetKey!==n?{resetKey:n,error:null}:{resetKey:n}}static getDerivedStateFromError(e){return{error:e}}reset(){this.setState({error:null})}componentDidCatch(e,t){this.props.onCatch&&this.props.onCatch(e,t)}render(){return this.props.children({error:this.state.error,reset:()=>{this.reset()}})}};function ai({error:e}){let[t,n]=j.useState(!1);return(0,M.jsxs)(`div`,{style:{padding:`.5rem`,maxWidth:`100%`},children:[(0,M.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`.5rem`},children:[(0,M.jsx)(`strong`,{style:{fontSize:`1rem`},children:`Something went wrong!`}),(0,M.jsx)(`button`,{style:{appearance:`none`,fontSize:`.6em`,border:`1px solid currentColor`,padding:`.1rem .2rem`,fontWeight:`bold`,borderRadius:`.25rem`},onClick:()=>n(e=>!e),children:t?`Hide Error`:`Show Error`})]}),(0,M.jsx)(`div`,{style:{height:`.25rem`}}),t?(0,M.jsx)(`div`,{children:(0,M.jsx)(`pre`,{style:{fontSize:`.7em`,border:`1px solid red`,borderRadius:`.25rem`,padding:`.3rem`,color:`red`,overflow:`auto`},children:e.message?(0,M.jsx)(`code`,{children:e.message}):null})}):null]})}function oi({children:e,fallback:t=null}){return si()?(0,M.jsx)(j.Fragment,{children:e}):(0,M.jsx)(j.Fragment,{children:t})}function si(){return j.useSyncExternalStore(ci,()=>!0,()=>!1)}function ci(){return()=>{}}var li=j.createContext(null);function ui(e){return j.useContext(li)}var di=j.createContext(void 0),fi=j.createContext(void 0),pi=(e=>(e[e.None=0]=`None`,e[e.Mutable=1]=`Mutable`,e[e.Watching=2]=`Watching`,e[e.RecursedCheck=4]=`RecursedCheck`,e[e.Recursed=8]=`Recursed`,e[e.Dirty=16]=`Dirty`,e[e.Pending=32]=`Pending`,e))(pi||{});function mi({update:e,notify:t,unwatched:n}){return{link:r,unlink:i,propagate:a,checkDirty:o,shallowPropagate:s};function r(e,t,n){let r=t.depsTail;if(r!==void 0&&r.dep===e)return;let i=r===void 0?t.deps:r.nextDep;if(i!==void 0&&i.dep===e){i.version=n,t.depsTail=i;return}let a=e.subsTail;if(a!==void 0&&a.version===n&&a.sub===t)return;let o=t.depsTail=e.subsTail={version:n,dep:e,sub:t,prevDep:r,nextDep:i,prevSub:a,nextSub:void 0};i!==void 0&&(i.prevDep=o),r===void 0?t.deps=o:r.nextDep=o,a===void 0?e.subs=o:a.nextSub=o}function i(e,t=e.sub){let r=e.dep,i=e.prevDep,a=e.nextDep,o=e.nextSub,s=e.prevSub;return a===void 0?t.depsTail=i:a.prevDep=i,i===void 0?t.deps=a:i.nextDep=a,o===void 0?r.subsTail=s:o.prevSub=s,s===void 0?(r.subs=o)===void 0&&n(r):s.nextSub=o,a}function a(e){let n=e.nextSub,r;top:do{let i=e.sub,a=i.flags;if(a&60?a&12?a&4?!(a&48)&&c(e,i)?(i.flags=a|40,a&=1):a=0:i.flags=a&-9|32:a=0:i.flags=a|32,a&2&&t(i),a&1){let t=i.subs;if(t!==void 0){let i=(e=t).nextSub;i!==void 0&&(r={value:n,prev:r},n=i);continue}}if((e=n)!==void 0){n=e.nextSub;continue}for(;r!==void 0;)if(e=r.value,r=r.prev,e!==void 0){n=e.nextSub;continue top}break}while(!0)}function o(t,n){let r,i=0,a=!1;top:do{let o=t.dep,c=o.flags;if(n.flags&16)a=!0;else if((c&17)==17){if(e(o)){let e=o.subs;e.nextSub!==void 0&&s(e),a=!0}}else if((c&33)==33){(t.nextSub!==void 0||t.prevSub!==void 0)&&(r={value:t,prev:r}),t=o.deps,n=o,++i;continue}if(!a){let e=t.nextDep;if(e!==void 0){t=e;continue}}for(;i--;){let i=n.subs,o=i.nextSub!==void 0;if(o?(t=r.value,r=r.prev):t=i,a){if(e(n)){o&&s(i),n=t.sub;continue}a=!1}else n.flags&=-33;n=t.sub;let c=t.nextDep;if(c!==void 0){t=c;continue top}}return a}while(!0)}function s(e){do{let n=e.sub,r=n.flags;(r&48)==32&&(n.flags=r|16,(r&6)==2&&t(n))}while((e=e.nextSub)!==void 0)}function c(e,t){let n=t.depsTail;for(;n!==void 0;){if(n===e)return!0;n=n.prevDep}return!1}}function hi(e,t,n){let r=typeof e==`object`,i=r?e:void 0;return{next:(r?e.next:e)?.bind(i),error:(r?e.error:t)?.bind(i),complete:(r?e.complete:n)?.bind(i)}}var gi=[],_i=0,{link:vi,unlink:yi,propagate:bi,checkDirty:xi,shallowPropagate:Si}=mi({update(e){return e._update()},notify(e){gi[wi++]=e,e.flags&=~pi.Watching},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=pi.Mutable|pi.Dirty,Oi(e))}}),Ci=0,wi=0,Ti,Ei=0;function Di(e){try{++Ei,e()}finally{--Ei||ki()}}function Oi(e){let t=e.depsTail,n=t===void 0?e.deps:t.nextDep;for(;n!==void 0;)n=yi(n,e)}function ki(){if(!(Ei>0)){for(;Ci<wi;){let e=gi[Ci];gi[Ci++]=void 0,e.notify()}Ci=0,wi=0}}function Ai(e,t){let n=typeof e==`function`,r=e,i={_snapshot:n?void 0:e,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:n?pi.None:pi.Mutable,get(){return Ti!==void 0&&vi(i,Ti,_i),i._snapshot},subscribe(e){let t=hi(e),n={current:!1},r=ji(()=>{i.get(),n.current?t.next?.(i._snapshot):n.current=!0});return{unsubscribe:()=>{r.stop()}}},_update(e){let a=Ti,o=t?.compare??Object.is;if(n)Ti=i,++_i,i.depsTail=void 0;else if(e===void 0)return!1;n&&(i.flags=pi.Mutable|pi.RecursedCheck);try{let t=i._snapshot,a=typeof e==`function`?e(t):e===void 0&&n?r(t):e;return t===void 0||!o(t,a)?(i._snapshot=a,!0):!1}finally{Ti=a,n&&(i.flags&=~pi.RecursedCheck),Oi(i)}}};return n?(i.flags=pi.Mutable|pi.Dirty,i.get=function(){let e=i.flags;if(e&pi.Dirty||e&pi.Pending&&xi(i.deps,i)){if(i._update()){let e=i.subs;e!==void 0&&Si(e)}}else e&pi.Pending&&(i.flags=e&~pi.Pending);return Ti!==void 0&&vi(i,Ti,_i),i._snapshot}):i.set=function(e){if(i._update(e)){let e=i.subs;e!==void 0&&(bi(e),Si(e),ki())}},i}function ji(e){let t=()=>{let t=Ti;Ti=n,++_i,n.depsTail=void 0,n.flags=pi.Watching|pi.RecursedCheck;try{return e()}finally{Ti=t,n.flags&=~pi.RecursedCheck,Oi(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:pi.Watching|pi.RecursedCheck,notify(){let e=this.flags;e&pi.Dirty||e&pi.Pending&&xi(this.deps,this)?t():this.flags=pi.Watching},stop(){this.flags=pi.None,this.depsTail=void 0,Oi(this)}};return t(),n}var Mi=o((e=>{var t=d(),n=at();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),Ni=o(((e,t)=>{t.exports=Mi()}))();function Pi(e,t){return e===t}function Fi(e,t,n=Pi){let r=(0,j.useCallback)(t=>{if(!e)return()=>{};let{unsubscribe:n}=e.subscribe(t);return n},[e]),i=(0,j.useCallback)(()=>e?.get(),[e]);return(0,Ni.useSyncExternalStoreWithSelector)(r,i,i,t,n)}var Ii={get:()=>void 0,subscribe:()=>({unsubscribe:()=>{}})};function Li(e){let t=ui(),n=j.useContext(e.from?fi:di),r=e.from??n,i=r?e.from?t.stores.getRouteMatchStore(r):t.stores.matchStores.get(r):void 0,a=j.useRef(void 0);return Fi(i??Ii,n=>{if((e.shouldThrow??!0)&&!n&&qt(),n===void 0)return;let r=e.select?e.select(n):n;if(e.structuralSharing??t.options.defaultStructuralSharing){let e=Mt(a.current,r);return a.current=e,e}return r})}function Ri(e){return Li({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function zi(e){let{select:t,...n}=e;return Li({...n,select:e=>t?t(e.loaderDeps):e.loaderDeps})}function Bi(e){return Li({from:e.from,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,strict:e.strict,select:t=>{let n=e.strict===!1?t.params:t._strictParams;return e.select?e.select(n):n}})}function Vi(e){return Li({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function Hi(e){let t=ui();return j.useCallback(n=>t.navigate({...n,from:n.from??e?.from}),[e?.from,t])}function Ui(e){let t=ui(),n=Hi(),r=j.useRef(null);return bt(()=>{r.current!==e&&(n(e),r.current=e)},[t,e,n]),null}function Wi(e){return Li({...e,select:t=>e.select?e.select(t.context):t.context})}var Gi=c(h(),1);function Ki(e,t){let n=ui(),r=Ct(t),{activeProps:i,inactiveProps:a,activeOptions:o,to:s,preload:c,preloadDelay:l,preloadIntentProximity:u,hashScrollIntoView:d,replace:f,startTransition:p,resetScroll:m,viewTransition:h,children:g,target:_,disabled:v,style:y,className:b,onClick:x,onBlur:S,onFocus:C,onMouseEnter:w,onMouseLeave:T,onTouchStart:E,ignoreBlocker:D,params:O,search:ee,hash:te,state:ne,mask:re,reloadDocument:ie,unsafeRelative:ae,from:oe,_fromLocation:k,...se}=e,ce=si(),le=j.useMemo(()=>e,[n,e.from,e._fromLocation,e.hash,e.to,e.search,e.params,e.state,e.mask,e.unsafeRelative]),ue=Fi(n.stores.location,e=>e,(e,t)=>e.href===t.href),A=j.useMemo(()=>{let e={_fromLocation:ue,...le};return n.buildLocation(e)},[n,ue,le]),de=A.maskedLocation?A.maskedLocation.publicHref:A.publicHref,fe=A.maskedLocation?A.maskedLocation.external:A.external,pe=j.useMemo(()=>ta(de,fe,n.history,v),[v,fe,de,n.history]),me=j.useMemo(()=>{if(pe?.external)return Ut(pe.href,n.protocolAllowlist)?void 0:pe.href;if(!na(s)&&!(typeof s!=`string`||s.indexOf(`:`)===-1))try{return new URL(s),Ut(s,n.protocolAllowlist)?void 0:s}catch{}},[s,pe,n.protocolAllowlist]),he=j.useMemo(()=>{if(me)return!1;if(o?.exact){if(!En(ue.pathname,A.pathname,n.basepath))return!1}else{let e=Tn(ue.pathname,n.basepath),t=Tn(A.pathname,n.basepath);if(!(e.startsWith(t)&&(e.length===t.length||e[t.length]===`/`)))return!1}return(o?.includeSearch??!0)&&!Lt(ue.search,A.search,{partial:!o?.exact,ignoreUndefined:!o?.explicitUndefined})?!1:o?.includeHash?ce&&ue.hash===A.hash:!0},[o?.exact,o?.explicitUndefined,o?.includeHash,o?.includeSearch,ue,me,ce,A.hash,A.pathname,A.search,n.basepath]),ge=he?Et(i,{})??Ji:qi,_e=he?qi:Et(a,{})??qi,ve=[b,ge.className,_e.className].filter(Boolean).join(` `),ye=(y||ge.style||_e.style)&&{...y,...ge.style,..._e.style},[be,xe]=j.useState(!1),Se=j.useRef(!1),Ce=e.reloadDocument||me?!1:c??n.options.defaultPreload,we=l??n.options.defaultPreloadDelay??0,Te=j.useCallback(()=>{n.preloadRoute({...le,_builtLocation:A}).catch(e=>{console.warn(e),console.warn($r)})},[n,le,A]);St(r,j.useCallback(e=>{e?.isIntersecting&&Te()},[Te]),$i,{disabled:!!v||Ce!==`viewport`}),j.useEffect(()=>{Se.current||!v&&Ce===`render`&&(Te(),Se.current=!0)},[v,Te,Ce]);let Ee=e=>{let t=e.currentTarget.getAttribute(`target`),r=_===void 0?t:_;if(!v&&!ia(e)&&!e.defaultPrevented&&(!r||r===`_self`)&&e.button===0){e.preventDefault(),(0,Gi.flushSync)(()=>{xe(!0)});let t=n.subscribe(`onResolved`,()=>{t(),xe(!1)});n.navigate({...le,replace:f,resetScroll:m,hashScrollIntoView:d,startTransition:p,viewTransition:h,ignoreBlocker:D})}};if(me)return{...se,ref:r,href:me,...g&&{children:g},..._&&{target:_},...v&&{disabled:v},...y&&{style:y},...b&&{className:b},...x&&{onClick:x},...S&&{onBlur:S},...C&&{onFocus:C},...w&&{onMouseEnter:w},...T&&{onMouseLeave:T},...E&&{onTouchStart:E}};let De=e=>{if(v||Ce!==`intent`)return;if(!we){Te();return}let t=e.currentTarget;if(Qi.has(t))return;let n=setTimeout(()=>{Qi.delete(t),Te()},we);Qi.set(t,n)},Oe=e=>{v||Ce!==`intent`||Te()},ke=e=>{if(v||!Ce||!we)return;let t=e.currentTarget,n=Qi.get(t);n&&(clearTimeout(n),Qi.delete(t))};return{...se,...ge,..._e,href:pe?.href,ref:r,onClick:ea([x,Ee]),onBlur:ea([S,ke]),onFocus:ea([C,De]),onMouseEnter:ea([w,De]),onMouseLeave:ea([T,ke]),onTouchStart:ea([E,Oe]),disabled:!!v,target:_,...ye&&{style:ye},...ve&&{className:ve},...v&&Yi,...he&&Xi,...ce&&be&&Zi}}var qi={},Ji={className:`active`},Yi={role:`link`,"aria-disabled":!0},Xi={"data-status":`active`,"aria-current":`page`},Zi={"data-transitioning":`transitioning`},Qi=new WeakMap,$i={rootMargin:`100px`},ea=e=>t=>{for(let n of e)if(n){if(t.defaultPrevented)return;n(t)}};function ta(e,t,n,r){if(!r)return t?{href:e,external:!0}:{href:n.createHref(e)||`/`,external:!1}}function na(e){if(typeof e!=`string`)return!1;let t=e.charCodeAt(0);return t===47?e.charCodeAt(1)!==47:t===46}var ra=j.forwardRef((e,t)=>{let{_asChild:n,...r}=e,{type:i,...a}=Ki(r,t),o=typeof r.children==`function`?r.children({isActive:a[`data-status`]===`active`}):r.children;if(!n){let{disabled:e,...t}=a;return j.createElement(`a`,t,o)}return j.createElement(n,a,o)});function ia(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}var aa=class extends ei{constructor(e){super(e),this.useMatch=e=>Li({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>Wi({...e,from:this.id}),this.useSearch=e=>Vi({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>Bi({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>zi({...e,from:this.id}),this.useLoaderData=e=>Ri({...e,from:this.id}),this.useNavigate=()=>Hi({from:this.fullPath}),this.Link=j.forwardRef((e,t)=>(0,M.jsx)(ra,{ref:t,from:this.fullPath,...e}))}};function oa(e){return new aa(e)}var sa=class extends ti{constructor(e){super(e),this.useMatch=e=>Li({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>Wi({...e,from:this.id}),this.useSearch=e=>Vi({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>Bi({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>zi({...e,from:this.id}),this.useLoaderData=e=>Ri({...e,from:this.id}),this.useNavigate=()=>Hi({from:this.fullPath}),this.Link=j.forwardRef((e,t)=>(0,M.jsx)(ra,{ref:t,from:this.fullPath,...e}))}};function ca(e){return new sa(e)}function la(e){return new ua(e,{silent:!0}).createRoute}var ua=class{constructor(e,t){this.path=e,this.createRoute=e=>{let t=oa(e);return t.isRoot=!1,t},this.silent=t?.silent}};function da(e){let t=ui(),n=`not-found-${Fi(t.stores.location,e=>e.pathname)}-${Fi(t.stores.status,e=>e)}`;return(0,M.jsx)(ri,{getResetKey:()=>n,onCatch:(t,n)=>{if(Mn(t))e.onCatch?.(t,n);else throw t},errorComponent:({error:t})=>{if(Mn(t))return e.fallback?.(t);throw t},children:e.children})}function fa(){return(0,M.jsx)(`p`,{children:`Not Found`})}function pa(e){return(0,M.jsx)(M.Fragment,{children:e.children})}function ma(e,t,n){return t.options.notFoundComponent?(0,M.jsx)(t.options.notFoundComponent,{...n}):e.options.defaultNotFoundComponent?(0,M.jsx)(e.options.defaultNotFoundComponent,{...n}):(0,M.jsx)(fa,{})}var ha=j.memo(function({matchId:e}){let t=ui(),n=t.stores.matchStores.get(e);n||qt();let r=Fi(t.stores.loadedAt,e=>e),i=Fi(n,e=>e);return(0,M.jsx)(ga,{router:t,matchId:e,resetKey:r,matchState:j.useMemo(()=>{let e=i.routeId,n=t.routesById[e].parentRoute?.id;return{routeId:e,ssr:i.ssr,_displayPending:i._displayPending,parentRouteId:n}},[i._displayPending,i.routeId,i.ssr,t.routesById])})});function ga({router:e,matchId:t,resetKey:n,matchState:r}){let i=e.routesById[r.routeId],a=i.options.pendingComponent??e.options.defaultPendingComponent,o=a?(0,M.jsx)(a,{}):null,s=i.options.errorComponent??e.options.defaultErrorComponent,c=i.options.onCatch??e.options.defaultOnCatch,l=i.isRoot?i.options.notFoundComponent??e.options.notFoundRoute?.options.component:i.options.notFoundComponent,u=r.ssr===!1||r.ssr===`data-only`,d=(!i.isRoot||i.options.wrapInSuspense||u)&&(i.options.wrapInSuspense??a??(i.options.errorComponent?.preload||u))?j.Suspense:pa,f=s?ri:pa,p=l?da:pa;return(0,M.jsxs)(i.isRoot?i.options.shellComponent??pa:pa,{children:[(0,M.jsx)(di.Provider,{value:t,children:(0,M.jsx)(d,{fallback:o,children:(0,M.jsx)(f,{getResetKey:()=>n,errorComponent:s||ai,onCatch:(e,t)=>{if(Mn(e))throw e.routeId??=r.routeId,e;c?.(e,t)},children:(0,M.jsx)(p,{fallback:e=>{if(e.routeId??=r.routeId,!l||e.routeId&&e.routeId!==r.routeId||!e.routeId&&!i.isRoot)throw e;return j.createElement(l,e)},children:u||r._displayPending?(0,M.jsx)(oi,{fallback:o,children:(0,M.jsx)(va,{matchId:t})}):(0,M.jsx)(va,{matchId:t})})})})}),r.parentRouteId===`__root__`?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(_a,{resetKey:n}),(e.options.scrollRestoration,null)]}):null]})}function _a({resetKey:e}){let t=ui(),n=j.useRef(void 0);return bt(()=>{let e=t.latestLocation.href;(n.current===void 0||n.current!==e)&&(t.emit({type:`onRendered`,...Dr(t.stores.location.get(),t.stores.resolvedLocation.get())}),n.current=e)},[t.latestLocation.state.__TSR_key,e,t]),null}var va=j.memo(function({matchId:e}){let t=ui(),n=(e,n)=>t.getMatch(e.id)?._nonReactive[n]??e._nonReactive[n],r=t.stores.matchStores.get(e);r||qt();let i=Fi(r,e=>e),a=i.routeId,o=t.routesById[a],s=j.useMemo(()=>{let e=(t.routesById[a].options.remountDeps??t.options.defaultRemountDeps)?.({routeId:a,loaderDeps:i.loaderDeps,params:i._strictParams,search:i._strictSearch});return e?JSON.stringify(e):void 0},[a,i.loaderDeps,i._strictParams,i._strictSearch,t.options.defaultRemountDeps,t.routesById]),c=j.useMemo(()=>{let e=o.options.component??t.options.defaultComponent;return e?(0,M.jsx)(e,{},s):(0,M.jsx)(ya,{})},[s,o.options.component,t.options.defaultComponent]);if(i._displayPending)throw n(i,`displayPendingPromise`);if(i._forcePending)throw n(i,`minPendingPromise`);if(i.status===`pending`){let e=o.options.pendingMinMs??t.options.defaultPendingMinMs;if(e){let n=t.getMatch(i.id);if(n&&!n._nonReactive.minPendingPromise){let t=Rt();n._nonReactive.minPendingPromise=t,setTimeout(()=>{t.resolve(),n._nonReactive.minPendingPromise=void 0},e)}}throw n(i,`loadPromise`)}if(i.status===`notFound`)return Mn(i.error)||qt(),ma(t,o,i.error);if(i.status===`redirected`)throw Hn(i.error)||qt(),n(i,`loadPromise`);if(i.status===`error`)throw i.error;return c}),ya=j.memo(function(){let e=ui(),t=j.useContext(di),n,r=!1,i;{let a=t?e.stores.matchStores.get(t):void 0;[n,r]=Fi(a,e=>[e?.routeId,e?.globalNotFound??!1]),i=Fi(e.stores.matchesId,e=>e[e.findIndex(e=>e===t)+1])}let a=n?e.routesById[n]:void 0,o=e.options.defaultPendingComponent?(0,M.jsx)(e.options.defaultPendingComponent,{}):null;if(r)return a||qt(),ma(e,a,void 0);if(!i)return null;let s=(0,M.jsx)(ha,{matchId:i});return n===`__root__`?(0,M.jsx)(j.Suspense,{fallback:o,children:s}):s});function ba(){let e=ui(),t=j.useRef({router:e,mounted:!1}),[n,r]=j.useState(!1),i=Fi(e.stores.isLoading,e=>e),a=Fi(e.stores.hasPending,e=>e),o=xt(i),s=i||n||a,c=xt(s),l=i||a,u=xt(l);return e.startTransition=e=>{r(!0),j.startTransition(()=>{e(),r(!1)})},j.useEffect(()=>{let t=e.history.subscribe(e.load),n=e.buildLocation({to:e.latestLocation.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});return Cn(e.latestLocation.publicHref)!==Cn(n.publicHref)&&e.commitLocation({...n,replace:!0}),()=>{t()}},[e,e.history]),bt(()=>{typeof window<`u`&&e.ssr||t.current.router===e&&t.current.mounted||(t.current={router:e,mounted:!0},(async()=>{try{await e.load()}catch(e){console.error(e)}})())},[e]),bt(()=>{o&&!i&&e.emit({type:`onLoad`,...Dr(e.stores.location.get(),e.stores.resolvedLocation.get())})},[o,e,i]),bt(()=>{u&&!l&&e.emit({type:`onBeforeRouteMount`,...Dr(e.stores.location.get(),e.stores.resolvedLocation.get())})},[l,u,e]),bt(()=>{if(c&&!s){let t=Dr(e.stores.location.get(),e.stores.resolvedLocation.get());e.emit({type:`onResolved`,...t}),Di(()=>{e.stores.status.set(`idle`),e.stores.resolvedLocation.set(e.stores.location.get())})}},[s,c,e]),null}function xa(){let e=ui(),t=e.routesById.__root__.options.pendingComponent??e.options.defaultPendingComponent,n=t?(0,M.jsx)(t,{}):null,r=(0,M.jsxs)(typeof document<`u`&&e.ssr?pa:j.Suspense,{fallback:n,children:[(0,M.jsx)(ba,{}),(0,M.jsx)(Sa,{})]});return e.options.InnerWrap?(0,M.jsx)(e.options.InnerWrap,{children:r}):r}function Sa(){let e=ui(),t=Fi(e.stores.firstId,e=>e),n=Fi(e.stores.loadedAt,e=>e),r=t?(0,M.jsx)(ha,{matchId:t}):null;return(0,M.jsx)(di.Provider,{value:t,children:e.options.disableGlobalCatchBoundary?r:(0,M.jsx)(ri,{getResetKey:()=>n,errorComponent:ai,onCatch:void 0,children:r})})}var Ca=e=>({createMutableStore:Ai,createReadonlyStore:Ai,batch:Di}),wa=e=>new Ta(e),Ta=class extends kr{constructor(e){super(e,Ca)}};function Ea({router:e,children:t,...n}){kt(n)&&e.update({...e.options,...n,context:{...e.options.context,...n.context}});let r=(0,M.jsx)(li.Provider,{value:e,children:t});return e.options.Wrap?(0,M.jsx)(e.options.Wrap,{children:r}):r}function Da({router:e,...t}){return(0,M.jsx)(Ea,{router:e,...t,children:(0,M.jsx)(xa,{})})}function Oa(e){let t=ui(),n=(0,j.useRef)(void 0);return Fi(t.stores.location,r=>{let i=e?.select?e.select(r):r;if(e?.structuralSharing??t.options.defaultStructuralSharing){let e=Mt(n.current,i);return n.current=e,e}return i})}var ka;function N(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,"_zod",{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,"name",{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,"init",{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}var Aa=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},ja=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(ka=globalThis).__zod_globalConfig??(ka.__zod_globalConfig={});var Ma=globalThis.__zod_globalConfig;function Na(e){return e&&Object.assign(Ma,e),Ma}function Pa(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function Fa(e,t){return typeof t==`bigint`?t.toString():t}function Ia(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}throw Error(`cached value already set`)}}}function La(e){return e==null}function Ra(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function za(e,t){let n=e/t,r=Math.round(n),i=2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}var Ba=Symbol(`evaluating`);function Va(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==Ba)return r===void 0&&(r=Ba,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function Ha(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Ua(...e){let t={};for(let n of e)Object.assign(t,Object.getOwnPropertyDescriptors(n));return Object.defineProperties({},t)}function Wa(e){return JSON.stringify(e)}function Ga(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var Ka=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function qa(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var Ja=Ia(()=>{if(Ma.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function Ya(e){if(qa(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(qa(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function Xa(e){return Ya(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var Za=new Set([`string`,`number`,`symbol`]);function Qa(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function $a(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function P(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function eo(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}var to={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function no(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return $a(e,Ua(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return Ha(this,`shape`,e),e},checks:[]}))}function ro(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return $a(e,Ua(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return Ha(this,`shape`,r),r},checks:[]}))}function io(e,t){if(!Ya(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return $a(e,Ua(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Ha(this,`shape`,n),n}}))}function ao(e,t){if(!Ya(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return $a(e,Ua(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Ha(this,`shape`,n),n}}))}function oo(e,t){if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);return $a(e,Ua(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return Ha(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function so(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return $a(t,Ua(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return Ha(this,`shape`,i),i},checks:[]}))}function co(e,t,n){return $a(t,Ua(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return Ha(this,`shape`,i),i}}))}function lo(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function uo(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function fo(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function po(e){return typeof e==`string`?e:e?.message}function mo(e,t,n){let r=e.message?e.message:po(e.inst?._zod.def?.error?.(e))??po(t?.error?.(e))??po(n.customError?.(e))??po(n.localeError?.(e))??`Invalid input`,{inst:i,continue:a,input:o,...s}=e;return s.path??=[],s.message=r,t?.reportInput&&(s.input=o),s}function ho(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function go(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var _o=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Fa,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},vo=N(`$ZodError`,_o),F=N(`$ZodError`,_o,{Parent:Error});function yo(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function bo(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i];i===e.length-1?(r[n]=r[n]||{_errors:[]},r[n]._errors.push(t(a))):r[n]=r[n]||{_errors:[]},r=r[n],i++}}}};return r(e),n}var xo=e=>(t,n,r,i)=>{let a=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new Aa;if(o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>mo(e,a,Na())));throw Ka(t,i?.callee),t}return o.value},So=xo(F),Co=e=>async(t,n,r,i)=>{let a=r?{...r,async:!0}:{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>mo(e,a,Na())));throw Ka(t,i?.callee),t}return o.value},wo=Co(F),To=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new Aa;return a.issues.length?{success:!1,error:new(e??vo)(a.issues.map(e=>mo(e,i,Na())))}:{success:!0,data:a.value}},Eo=To(F),Do=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>mo(e,i,Na())))}:{success:!0,data:a.value}},Oo=Do(F),ko=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return xo(e)(t,n,i)},Ao=e=>(t,n,r)=>xo(e)(t,n,r),jo=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Co(e)(t,n,i)},Mo=e=>async(t,n,r)=>Co(e)(t,n,r),No=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return To(e)(t,n,i)},Po=e=>(t,n,r)=>To(e)(t,n,r),Fo=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Do(e)(t,n,i)},Io=e=>async(t,n,r)=>Do(e)(t,n,r),Lo=/^[cC][0-9a-z]{6,}$/,Ro=/^[0-9a-z]+$/,zo=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Bo=/^[0-9a-vA-V]{20}$/,Vo=/^[A-Za-z0-9]{27}$/,Ho=/^[a-zA-Z0-9_-]{21}$/,Uo=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Wo=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Go=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Ko=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,qo=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function Jo(){return new RegExp(qo,`u`)}var Yo=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Xo=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Zo=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Qo=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,$o=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,es=/^[A-Za-z0-9_-]*$/,ts=/^https?$/,ns=/^\+[1-9]\d{6,14}$/,rs=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`,is=RegExp(`^${rs}$`);function as(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function os(e){return RegExp(`^${as(e)}$`)}function ss(e){let t=as({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${rs}T(?:${r})$`)}var cs=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},ls=/^-?\d+$/,us=/^-?\d+(?:\.\d+)?$/,ds=/^(?:true|false)$/i,fs=/^null$/i,ps=/^[^A-Z]*$/,ms=/^[^a-z]*$/,hs=N(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),gs={number:`number`,bigint:`bigint`,object:`date`},_s=N(`$ZodCheckLessThan`,(e,t)=>{hs.init(e,t);let n=gs[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),vs=N(`$ZodCheckGreaterThan`,(e,t)=>{hs.init(e,t);let n=gs[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ys=N(`$ZodCheckMultipleOf`,(e,t)=>{hs.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):za(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),bs=N(`$ZodCheckNumberFormat`,(e,t)=>{hs.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=to[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=ls)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),xs=N(`$ZodCheckMaxLength`,(e,t)=>{var n;hs.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!La(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=ho(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Ss=N(`$ZodCheckMinLength`,(e,t)=>{var n;hs.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!La(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=ho(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Cs=N(`$ZodCheckLengthEquals`,(e,t)=>{var n;hs.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!La(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=ho(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),ws=N(`$ZodCheckStringFormat`,(e,t)=>{var n,r;hs.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),Ts=N(`$ZodCheckRegex`,(e,t)=>{ws.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Es=N(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=ps,ws.init(e,t)}),Ds=N(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=ms,ws.init(e,t)}),Os=N(`$ZodCheckIncludes`,(e,t)=>{hs.init(e,t);let n=Qa(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),ks=N(`$ZodCheckStartsWith`,(e,t)=>{hs.init(e,t);let n=RegExp(`^${Qa(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),As=N(`$ZodCheckEndsWith`,(e,t)=>{hs.init(e,t);let n=RegExp(`.*${Qa(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),js=N(`$ZodCheckOverwrite`,(e,t)=>{hs.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),Ms=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
|
|
39
|
+
The cached manifest will be removed. The app will remain loaded in the running kernel until the next restart.`,successInList:`Removed {{manifestId}}. Restart the runtime to fully unload it from the running kernel.`,successInDetail:`Removed cached manifest for {{manifestId}}. Restart the runtime to fully unload the app from the running kernel.`},accessDenied:{title:`App Marketplace is admin-only`,description:`You don't have permission to install apps in this environment. Ask an owner or admin of this organization for access.`},category:{crm:`CRM`,erp:`ERP`,hr:`Human Resources`,finance:`Finance`,project:`Project Management`,collaboration:`Collaboration`,analytics:`Analytics`,integration:`Integration`,automation:`Automation`,ai:`AI`,security:`Security`,"developer-tools":`Developer Tools`,"ui-theme":`UI Theme`,storage:`Storage`,other:`Other`},pricing:{free:`Free`,freemium:`Freemium`,paid:`Paid`,subscription:`Subscription`,"usage-based":`Usage-based`,"contact-sales":`Contact Sales`},relativeTime:{today:`today`,daysAgo:`{{count}}d ago`,monthsAgo:`{{count}}mo ago`,yearsAgo:`{{count}}y ago`}}}},ft=[`ar`,`he`,`fa`,`ur`];function pt(e){return ft.includes(e)}function mt(e={}){let{defaultLanguage:t=`en`,fallbackLanguage:n=`en`,resources:r={},detectBrowserLanguage:i=!0,interpolation:a}=e,o={};for(let[e,t]of Object.entries(dt))o[e]={translation:{...t,...r[e]||{}}};for(let[e,t]of Object.entries(r))o[e]||(o[e]={translation:t});let s=t;if(i&&typeof navigator<`u`){let e=navigator.language?.split(`-`)[0];e&&o[e]&&(s=e)}let c=Ie.createInstance();return c.use(tt).init({lng:s,fallbackLng:n,resources:o,interpolation:{escapeValue:!1,...a},returnNull:!1,react:{useSuspense:!1}}),c}function ht(e){return pt(e)?`rtl`:`ltr`}var gt=(0,j.createContext)(null);function _t({config:e,instance:t,loadLanguage:n,children:r}){let i=(0,j.useMemo)(()=>t||mt(e),[t,e]),[a,o]=(0,j.useState)(i.language||`en`),s=ht(a),c=(0,j.useRef)(new Set);(0,j.useEffect)(()=>{let e=e=>{o(e),typeof document<`u`&&(document.documentElement.dir=ht(e),document.documentElement.lang=e)},t=i.language||a;return typeof document<`u`&&t&&(document.documentElement.dir=ht(t),document.documentElement.lang=t),i.on(`languageChanged`,e),()=>{i.off(`languageChanged`,e)}},[i]),(0,j.useEffect)(()=>{if(!n)return;let e=i.language||`en`;c.current.has(e)||(c.current.add(e),n(e).then(t=>{t&&Object.keys(t).length>0&&(i.addResourceBundle(e,`translation`,t,!0,!0),o(e))}).catch(t=>{c.current.delete(e),console.warn(`[i18n] Failed to load app translations for '${e}':`,t)}))},[i,n]);let l=(0,j.useMemo)(()=>({language:a,changeLanguage:async e=>{if(n&&!c.current.has(e)){c.current.add(e);try{let t=await n(e);i.addResourceBundle(e,`translation`,t,!0,!0)}catch(t){c.current.delete(e),console.warn(`[i18n] Failed to load app translations for '${e}':`,t)}}await i.changeLanguage(e)},direction:s,i18n:i}),[a,s,i,n]);return j.createElement(gt.Provider,{value:l},j.createElement(ut,{i18n:i},r))}function vt(e){let t=(0,j.useContext)(gt),{t:n,i18n:r}=lt(e);return{t:n,language:t?.language||r.language||`en`,changeLanguage:t?.changeLanguage||(async e=>{await r.changeLanguage(e)}),direction:t?.direction||`ltr`,i18n:r}}function yt(){let e=(0,j.useContext)(gt);if(!e)throw Error(`useI18nContext must be used within an I18nProvider`);return e}var bt=typeof window<`u`?j.useLayoutEffect:j.useEffect;function xt(e){let t=j.useRef({value:e,prev:null}),n=t.current.value;return e!==n&&(t.current={value:e,prev:n}),t.current.prev}function St(e,t,n={},r={}){j.useEffect(()=>{if(!e.current||r.disabled||typeof IntersectionObserver!=`function`)return;let i=new IntersectionObserver(([e])=>{t(e)},n);return i.observe(e.current),()=>{i.disconnect()}},[t,n,r.disabled,e])}function Ct(e){let t=j.useRef(null);return j.useImperativeHandle(e,()=>t.current,[]),t}function wt(e){return e[e.length-1]}function Tt(e){return typeof e==`function`}function Et(e,t){return Tt(e)?e(t):e}var Dt=Object.prototype.hasOwnProperty,Ot=Object.prototype.propertyIsEnumerable;function kt(e){for(let t in e)if(Dt.call(e,t))return!0;return!1}var At=()=>Object.create(null),jt=(e,t)=>Mt(e,t,At);function Mt(e,t,n=()=>({}),r=0){if(e===t)return e;if(r>500)return t;let i=t,a=It(e)&&It(i);if(!a&&!(Pt(e)&&Pt(i)))return i;let o=a?e:Nt(e);if(!o)return i;let s=a?i:Nt(i);if(!s)return i;let c=o.length,l=s.length,u=a?Array(l):n(),d=0;for(let t=0;t<l;t++){let o=a?t:s[t],l=e[o],f=i[o];if(l===f){u[o]=l,(a?t<c:Dt.call(e,o))&&d++;continue}if(l===null||f===null||typeof l!=`object`||typeof f!=`object`){u[o]=f;continue}let p=Mt(l,f,n,r+1);u[o]=p,p===l&&d++}return c===l&&d===c?e:u}function Nt(e){let t=Object.getOwnPropertyNames(e);for(let n of t)if(!Ot.call(e,n))return!1;let n=Object.getOwnPropertySymbols(e);if(n.length===0)return t;let r=t;for(let t of n){if(!Ot.call(e,t))return!1;r.push(t)}return r}function Pt(e){if(!Ft(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!Ft(n)||!n.hasOwnProperty(`isPrototypeOf`))}function Ft(e){return Object.prototype.toString.call(e)===`[object Object]`}function It(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Lt(e,t,n){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let r=0,i=e.length;r<i;r++)if(!Lt(e[r],t[r],n))return!1;return!0}if(Pt(e)&&Pt(t)){let r=n?.ignoreUndefined??!0;if(n?.partial){for(let i in t)if((!r||t[i]!==void 0)&&!Lt(e[i],t[i],n))return!1;return!0}let i=0;if(!r)i=Object.keys(e).length;else for(let t in e)e[t]!==void 0&&i++;let a=0;for(let o in t)if((!r||t[o]!==void 0)&&(a++,a>i||!Lt(e[o],t[o],n)))return!1;return i===a}return!1}function Rt(e){let t,n,r=new Promise((e,r)=>{t=e,n=r});return r.status=`pending`,r.resolve=n=>{r.status=`resolved`,r.value=n,t(n),e?.(n)},r.reject=e=>{r.status=`rejected`,n(e)},r}function zt(e){return!!(e&&typeof e==`object`&&typeof e.then==`function`)}function Bt(e){return e.replace(/[\x00-\x1f\x7f]/g,``)}function Vt(e){let t;try{t=decodeURI(e)}catch{t=e.replaceAll(/%[0-9A-F]{2}/gi,e=>{try{return decodeURI(e)}catch{return e}})}return Bt(t)}var Ht=[`http:`,`https:`,`mailto:`,`tel:`];function Ut(e,t){if(!e)return!1;try{let n=new URL(e);return!t.has(n.protocol)}catch{return!1}}function Wt(e){if(!e||!/[%\\\x00-\x1f\x7f]/.test(e)&&!e.startsWith(`//`))return{path:e,handledProtocolRelativeURL:!1};let t=/%25|%5C/gi,n=0,r=``,i;for(;(i=t.exec(e))!==null;)r+=Vt(e.slice(n,i.index))+i[0],n=t.lastIndex;r+=Vt(n?e.slice(n):e);let a=!1;return r.startsWith(`//`)&&(a=!0,r=`/`+r.replace(/^\/+/,``)),{path:r,handledProtocolRelativeURL:a}}function Gt(e){return/\s|[^\u0000-\u007F]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function Kt(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function qt(){throw Error(`Invariant failed`)}function Jt(e){let t=new Map,n,r,i=e=>{e.next&&(e.prev?(e.prev.next=e.next,e.next.prev=e.prev,e.next=void 0,r&&(r.next=e,e.prev=r)):(e.next.prev=void 0,n=e.next,e.next=void 0,r&&(e.prev=r,r.next=e)),r=e)};return{get(e){let n=t.get(e);if(n)return i(n),n.value},set(a,o){if(t.size>=e&&n){let e=n;t.delete(e.key),e.next&&(n=e.next,e.next.prev=void 0),e===r&&(r=void 0)}let s=t.get(a);if(s)s.value=o,i(s);else{let e={key:a,value:o,prev:r};r&&(r.next=e),r=e,n||=e,t.set(a,e)}},clear(){t.clear(),n=void 0,r=void 0}}}var Yt=4,Xt=5;function Zt(e){let t=e.indexOf(`{`);if(t===-1)return null;let n=e.indexOf(`}`,t);return n===-1||t+1>=e.length?null:[t,n]}function Qt(e,t,n=new Uint16Array(6)){let r=e.indexOf(`/`,t),i=r===-1?e.length:r,a=e.substring(t,i);if(!a||!a.includes(`$`))return n[0]=0,n[1]=t,n[2]=t,n[3]=i,n[4]=i,n[5]=i,n;if(a===`$`){let r=e.length;return n[0]=2,n[1]=t,n[2]=t,n[3]=r,n[4]=r,n[5]=r,n}if(a.charCodeAt(0)===36)return n[0]=1,n[1]=t,n[2]=t+1,n[3]=i,n[4]=i,n[5]=i,n;let o=Zt(a);if(o){let[r,s]=o,c=a.charCodeAt(r+1);if(c===45){if(r+2<a.length&&a.charCodeAt(r+2)===36){let e=r+3,a=s;if(e<a)return n[0]=3,n[1]=t+r,n[2]=t+e,n[3]=t+a,n[4]=t+s+1,n[5]=i,n}}else if(c===36){let a=r+1,o=r+2;return o===s?(n[0]=2,n[1]=t+r,n[2]=t+a,n[3]=t+o,n[4]=t+s+1,n[5]=e.length,n):(n[0]=1,n[1]=t+r,n[2]=t+o,n[3]=t+s,n[4]=t+s+1,n[5]=i,n)}}return n[0]=0,n[1]=t,n[2]=t,n[3]=i,n[4]=i,n[5]=i,n}function $t(e,t,n,r,i,a,o){o?.(n);let s=r;{let r=n.fullPath??n.from,o=r.length,c=n.options?.caseSensitive??e,l=n.options?.params?.parse??n.options?.parseParams;for(;s<o;){let e=Qt(r,s,t),o,u=s,d=e[5];switch(s=d+1,a++,e[0]){case 0:{let t=r.substring(e[2],e[3]);if(c){let e=i.static?.get(t);if(e)o=e;else{i.static??=new Map;let e=nn(n.fullPath??n.from);e.parent=i,e.depth=a,o=e,i.static.set(t,e)}}else{let e=t.toLowerCase(),r=i.staticInsensitive?.get(e);if(r)o=r;else{i.staticInsensitive??=new Map;let t=nn(n.fullPath??n.from);t.parent=i,t.depth=a,o=t,i.staticInsensitive.set(e,t)}}break}case 1:{let t=r.substring(u,e[1]),s=r.substring(e[4],d),f=c&&!!(t||s),p=t?f?t:t.toLowerCase():void 0,m=s?f?s:s.toLowerCase():void 0,h=!l&&i.dynamic?.find(e=>!e.parse&&e.caseSensitive===f&&e.prefix===p&&e.suffix===m);if(h)o=h;else{let e=rn(1,n.fullPath??n.from,f,p,m);o=e,e.depth=a,e.parent=i,i.dynamic??=[],i.dynamic.push(e)}break}case 3:{let t=r.substring(u,e[1]),s=r.substring(e[4],d),f=c&&!!(t||s),p=t?f?t:t.toLowerCase():void 0,m=s?f?s:s.toLowerCase():void 0,h=!l&&i.optional?.find(e=>!e.parse&&e.caseSensitive===f&&e.prefix===p&&e.suffix===m);if(h)o=h;else{let e=rn(3,n.fullPath??n.from,f,p,m);o=e,e.parent=i,e.depth=a,i.optional??=[],i.optional.push(e)}break}case 2:{let t=r.substring(u,e[1]),s=r.substring(e[4],d),l=c&&!!(t||s),f=t?l?t:t.toLowerCase():void 0,p=s?l?s:s.toLowerCase():void 0,m=rn(2,n.fullPath??n.from,l,f,p);o=m,m.parent=i,m.depth=a,i.wildcard??=[],i.wildcard.push(m)}}i=o}if(l&&n.children&&!n.isRoot&&n.id&&n.id.charCodeAt(n.id.lastIndexOf(`/`)+1)===95){let e=nn(n.fullPath??n.from);e.kind=Xt,e.parent=i,a++,e.depth=a,i.pathless??=[],i.pathless.push(e),i=e}let u=(n.path||!n.children)&&!n.isRoot;if(u&&r.endsWith(`/`)){let e=nn(n.fullPath??n.from);e.kind=Yt,e.parent=i,a++,e.depth=a,i.index=e,i=e}i.parse=l??null,i.priority=n.options?.params?.priority??0,u&&!i.route&&(i.route=n,i.fullPath=n.fullPath??n.from)}if(n.children)for(let r of n.children)$t(e,t,r,s,i,a,o)}function en(e,t){if(e.parse&&!t.parse)return-1;if(!e.parse&&t.parse)return 1;if(e.parse&&t.parse&&(e.priority||t.priority))return t.priority-e.priority;if(e.prefix&&t.prefix&&e.prefix!==t.prefix){if(e.prefix.startsWith(t.prefix))return-1;if(t.prefix.startsWith(e.prefix))return 1}if(e.suffix&&t.suffix&&e.suffix!==t.suffix){if(e.suffix.endsWith(t.suffix))return-1;if(t.suffix.endsWith(e.suffix))return 1}return e.prefix&&!t.prefix?-1:!e.prefix&&t.prefix?1:e.suffix&&!t.suffix?-1:!e.suffix&&t.suffix?1:e.caseSensitive&&!t.caseSensitive?-1:!e.caseSensitive&&t.caseSensitive?1:0}function tn(e){if(e.pathless)for(let t of e.pathless)tn(t);if(e.static)for(let t of e.static.values())tn(t);if(e.staticInsensitive)for(let t of e.staticInsensitive.values())tn(t);if(e.dynamic?.length){e.dynamic.sort(en);for(let t of e.dynamic)tn(t)}if(e.optional?.length){e.optional.sort(en);for(let t of e.optional)tn(t)}if(e.wildcard?.length){e.wildcard.sort(en);for(let t of e.wildcard)tn(t)}}function nn(e){return{kind:0,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:e,parent:null,parse:null,priority:0}}function rn(e,t,n,r,i){return{kind:e,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:t,parent:null,parse:null,priority:0,caseSensitive:n,prefix:r,suffix:i}}function an(e,t){let n=nn(`/`),r=new Uint16Array(6);for(let t of e)$t(!1,r,t,1,n,0);tn(n),t.masksTree=n,t.flatCache=Jt(1e3)}function on(e,t){e||=`/`;let n=t.flatCache.get(e);if(n)return n;let r=dn(e,t.masksTree);return t.flatCache.set(e,r),r}function sn(e,t,n,r,i){e||=`/`,r||=`/`;let a=t?`case\0${e}`:e,o=i.singleCache.get(a);return o||(o=nn(`/`),$t(t,new Uint16Array(6),{from:e},1,o,0),i.singleCache.set(a,o)),dn(r,o,n)}function cn(e,t,n=!1){let r=n?e:`nofuzz\0${e}`,i=t.matchCache.get(r);if(i!==void 0)return i;e||=`/`;let a;try{a=dn(e,t.segmentTree,n)}catch(e){if(e instanceof URIError)a=null;else throw e}return a&&(a.branch=pn(a.route)),t.matchCache.set(r,a),a}function ln(e){return e===`/`?e:e.replace(/\/{1,}$/,``)}function un(e,t=!1,n){let r=nn(e.fullPath),i=new Uint16Array(6),a={},o={},s=0;return $t(t,i,e,1,r,0,e=>{if(n?.(e,s),e.id in a&&qt(),a[e.id]=e,s!==0&&e.path){let t=ln(e.fullPath);(!o[t]||e.fullPath.endsWith(`/`))&&(o[t]=e)}s++}),tn(r),{processedTree:{segmentTree:r,singleCache:Jt(1e3),matchCache:Jt(1e3),flatCache:null,masksTree:null},routesById:a,routesByPath:o}}function dn(e,t,n=!1){let r=e.split(`/`),i=hn(e,r,t,n);if(!i)return null;let[a]=fn(e,r,i);return{route:i.node.route,rawParams:a}}function fn(e,t,n){let r=mn(n.node),i=null,a=Object.create(null),o=n.extract?.part??0,s=n.extract?.node??0,c=n.extract?.path??0,l=n.extract?.segment??0;for(;s<r.length;o++,s++,c++,l++){let u=r[s];if(u.kind===Yt)break;if(u.kind===Xt){l--,o--,c--;continue}let d=t[o],f=c;if(d&&(c+=d.length),u.kind===1){i??=n.node.fullPath.split(`/`);let e=i[l],t=u.prefix?.length??0;if(e.charCodeAt(t)===123){let n=u.suffix?.length??0,r=e.substring(t+2,e.length-n-1),i=d.substring(t,d.length-n);a[r]=decodeURIComponent(i)}else{let t=e.substring(1);a[t]=decodeURIComponent(d)}}else if(u.kind===3){if(n.skipped&1<<s){o--,c=f-1;continue}i??=n.node.fullPath.split(`/`);let e=i[l],t=u.prefix?.length??0,r=u.suffix?.length??0,p=e.substring(t+3,e.length-r-1),m=u.suffix||u.prefix?d.substring(t,d.length-r):d;m&&(a[p]=decodeURIComponent(m))}else if(u.kind===2){let t=u,n=e.substring(f+(t.prefix?.length??0),e.length-(t.suffix?.length??0)),r=decodeURIComponent(n);a[`*`]=r,a._splat=r;break}}return n.rawParams&&Object.assign(a,n.rawParams),[a,{part:o,node:s,path:c,segment:l}]}function pn(e){let t=[e];for(;e.parentRoute;)e=e.parentRoute,t.push(e);return t.reverse(),t}function mn(e){let t=Array(e.depth+1);do t[e.depth]=e,e=e.parent;while(e);return t}function hn(e,t,n,r){if(e===`/`&&n.index)return{node:n.index,skipped:0};let i=!wt(t),a=i&&e!==`/`,o=t.length-+!!i,s=[{node:n,index:1,skipped:0,depth:1,statics:0,dynamics:0,optionals:0}],c=null,l=null;for(;s.length;){let n=s.pop(),{node:i,index:u,skipped:d,depth:f,statics:p,dynamics:m,optionals:h}=n,{extract:g,rawParams:_}=n;if(i.kind===2&&i.route&&!yn(l,n))continue;if(i.parse){if(!vn(e,t,n))continue;_=n.rawParams,g=n.extract}r&&i.route&&i.kind!==Yt&&yn(c,n)&&(c=n);let v=u===o;if(v&&(i.route&&(!a||i.kind===Yt||i.kind===2)&&yn(l,n)&&(l=n),!i.optional&&!i.wildcard&&!i.index&&!i.pathless))continue;let y=v?void 0:t[u],b;if(v&&i.index){let n={node:i.index,index:u,skipped:d,depth:f+1,statics:p,dynamics:m,optionals:h,extract:g,rawParams:_},r=!0;if(i.index.parse&&(vn(e,t,n)||(r=!1)),r){if(!m&&!h&&!d&&_n(p,o))return n;yn(l,n)&&(l=n)}}if(i.wildcard)for(let e=i.wildcard.length-1;e>=0;e--){let n=i.wildcard[e],{prefix:r,suffix:a}=n;if(!(r&&(v||!(n.caseSensitive?y:b??=y.toLowerCase()).startsWith(r)))){if(a){if(v)continue;let e=t.slice(u).join(`/`).slice(-a.length);if((n.caseSensitive?e:e.toLowerCase())!==a)continue}s.push({node:n,index:o,skipped:d,depth:f+1,statics:p,dynamics:m,optionals:h,extract:g,rawParams:_})}}if(i.optional){let e=d|1<<f,t=f+1;for(let n=i.optional.length-1;n>=0;n--){let r=i.optional[n];s.push({node:r,index:u,skipped:e,depth:t,statics:p,dynamics:m,optionals:h,extract:g,rawParams:_})}if(!v)for(let e=i.optional.length-1;e>=0;e--){let n=i.optional[e],{prefix:r,suffix:a}=n;if(r||a){let e=n.caseSensitive?y:b??=y.toLowerCase();if(r&&!e.startsWith(r)||a&&!e.endsWith(a))continue}s.push({node:n,index:u+1,skipped:d,depth:t,statics:p,dynamics:m,optionals:h+gn(o,u),extract:g,rawParams:_})}}if(!v&&i.dynamic&&y)for(let e=i.dynamic.length-1;e>=0;e--){let t=i.dynamic[e],{prefix:n,suffix:r}=t;if(n||r){let e=t.caseSensitive?y:b??=y.toLowerCase();if(n&&!e.startsWith(n)||r&&!e.endsWith(r))continue}s.push({node:t,index:u+1,skipped:d,depth:f+1,statics:p,dynamics:m+gn(o,u),optionals:h,extract:g,rawParams:_})}if(!v&&i.staticInsensitive){let e=i.staticInsensitive.get(b??=y.toLowerCase());e&&s.push({node:e,index:u+1,skipped:d,depth:f+1,statics:p+gn(o,u),dynamics:m,optionals:h,extract:g,rawParams:_})}if(!v&&i.static){let e=i.static.get(y);e&&s.push({node:e,index:u+1,skipped:d,depth:f+1,statics:p+gn(o,u),dynamics:m,optionals:h,extract:g,rawParams:_})}if(i.pathless){let e=f+1;for(let t=i.pathless.length-1;t>=0;t--){let n=i.pathless[t];s.push({node:n,index:u,skipped:d,depth:e,statics:p,dynamics:m,optionals:h,extract:g,rawParams:_})}}}if(l)return l;if(r&&c){let n=c.index;for(let e=0;e<c.index;e++)n+=t[e].length;let r=n===e.length?`/`:e.slice(n);return c.rawParams??=Object.create(null),c.rawParams[`**`]=decodeURIComponent(r),c}return null}function gn(e,t){return 2**(e-t-1)}function _n(e,t){return e===2**(t-1)-1}function vn(e,t,n){let r,i;try{[r,i]=fn(e,t,n)}catch{return null}if(n.rawParams=r,n.extract=i,!n.node.parse)return!0;try{if(n.node.parse(r)===!1)return null}catch{}return!0}function yn(e,t){return e?t.statics>e.statics||t.statics===e.statics&&(t.dynamics>e.dynamics||t.dynamics===e.dynamics&&(t.optionals>e.optionals||t.optionals===e.optionals&&((t.node.kind===Yt)>(e.node.kind===Yt)||t.node.kind===Yt==(e.node.kind===Yt)&&t.depth>e.depth))):!0}function bn(e){return xn(e.filter(e=>e!==void 0).join(`/`))}function xn(e){return e.replace(/\/{2,}/g,`/`)}function Sn(e){return e===`/`?e:e.replace(/^\/{1,}/,``)}function Cn(e){let t=e.length;return t>1&&e[t-1]===`/`?e.replace(/\/{1,}$/,``):e}function wn(e){return Cn(Sn(e))}function Tn(e,t){return e?.endsWith(`/`)&&e!==`/`&&e!==`${t}/`?e.slice(0,-1):e}function En(e,t,n){return Tn(e,n)===Tn(t,n)}function Dn({base:e,to:t,trailingSlash:n=`never`,cache:r}){let i=t.startsWith(`/`),a=!i&&t===`.`,o;if(r){o=i?t:a?e:e+`\0`+t;let n=r.get(o);if(n)return n}let s;if(a)s=e.split(`/`);else if(i)s=t.split(`/`);else{for(s=e.split(`/`);s.length>1&&wt(s)===``;)s.pop();let n=t.split(`/`);for(let e=0,t=n.length;e<t;e++){let r=n[e];r===``?e?e===t-1&&s.push(r):s=[r]:r===`..`?s.pop():r===`.`||s.push(r)}}s.length>1&&(wt(s)===``?n===`never`&&s.pop():n===`always`&&s.push(``));let c=xn(s.join(`/`))||`/`;return o&&r&&r.set(o,c),c}function On(e){let t=new Map(e.map(e=>[encodeURIComponent(e),e])),n=Array.from(t.keys()).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).join(`|`),r=new RegExp(n,`g`);return e=>e.replace(r,e=>t.get(e)??e)}function kn(e,t,n){let r=t[e];return typeof r==`string`?e===`_splat`?/^[a-zA-Z0-9\-._~!/]*$/.test(r)?r:r.split(`/`).map(e=>jn(e,n)).join(`/`):jn(r,n):r}function An({path:e,params:t,decoder:n,...r}){let i=!1,a=Object.create(null);if(!e||e===`/`)return{interpolatedPath:`/`,usedParams:a,isMissingParams:i};if(!e.includes(`$`))return{interpolatedPath:e,usedParams:a,isMissingParams:i};let o=e.length,s=0,c,l=``;for(;s<o;){let r=s;c=Qt(e,r,c);let o=c[5];if(s=o+1,r===o)continue;let u=c[0];if(u===0){l+=`/`+e.substring(r,o);continue}if(u===2){let s=t._splat;a._splat=s,a[`*`]=s;let u=e.substring(r,c[1]),d=e.substring(c[4],o);if(!s){i=!0,(u||d)&&(l+=`/`+u+d);continue}let f=kn(`_splat`,t,n);l+=`/`+u+f+d;continue}if(u===1){let s=e.substring(c[2],c[3]);!i&&!(s in t)&&(i=!0),a[s]=t[s];let u=e.substring(r,c[1]),d=e.substring(c[4],o),f=kn(s,t,n)??`undefined`;l+=`/`+u+f+d;continue}if(u===3){let i=e.substring(c[2],c[3]),s=t[i];if(s==null)continue;a[i]=s;let u=e.substring(r,c[1]),d=e.substring(c[4],o),f=kn(i,t,n)??``;l+=`/`+u+f+d;continue}}return e.endsWith(`/`)&&(l+=`/`),{usedParams:a,interpolatedPath:l||`/`,isMissingParams:i}}function jn(e,t){let n=encodeURIComponent(e);return t?.(n)??n}function Mn(e){return e?.isNotFound===!0}function Nn(e,t=String){let n=new URLSearchParams;for(let r in e){let i=e[r];i!==void 0&&n.set(r,t(i))}return n.toString()}function Pn(e){return e?e===`false`?!1:e===`true`?!0:e*0==0&&+e+``===e?+e:e:``}function Fn(e){let t=new URLSearchParams(e),n=Object.create(null);for(let[e,r]of t.entries()){let t=n[e];t==null?n[e]=Pn(r):Array.isArray(t)?t.push(Pn(r)):n[e]=[t,Pn(r)]}return n}var In=Rn(JSON.parse),Ln=zn(JSON.stringify,JSON.parse);function Rn(e){return t=>{t[0]===`?`&&(t=t.substring(1));let n=Fn(t);for(let t in n){let r=n[t];if(typeof r==`string`)try{n[t]=e(r)}catch{}}return n}}function zn(e,t){let n=typeof t==`function`;function r(r){if(typeof r==`object`&&r)try{return e(r)}catch{}else if(n&&typeof r==`string`)try{return t(r),e(r)}catch{}return r}return e=>{let t=Nn(e,r);return t?`?${t}`:``}}var Bn=`__root__`;function Vn(e){if(e.statusCode=e.statusCode||e.code||307,!e._builtLocation&&!e.reloadDocument&&typeof e.href==`string`)try{new URL(e.href),e.reloadDocument=!0}catch{}let t=new Headers(e.headers);e.href&&t.get(`Location`)===null&&t.set(`Location`,e.href);let n=new Response(null,{status:e.statusCode,headers:t});if(n.options=e,e.throw)throw n;return n}function Hn(e){return e instanceof Response&&!!e.options}var Un=e=>{if(!e.rendered)return e.rendered=!0,e.onReady?.()},Wn=e=>e.stores.matchesId.get().some(t=>e.stores.matchStores.get(t)?.get()._forcePending),Gn=(e,t)=>!!(e.preload&&!e.router.stores.matchStores.has(t)),Kn=(e,t,n=!0)=>{let r={...e.router.options.context??{}},i=n?t:t-1;for(let t=0;t<=i;t++){let n=e.matches[t];if(!n)continue;let i=e.router.getMatch(n.id);i&&Object.assign(r,i.__routeContext,i.__beforeLoadContext)}return r},qn=(e,t)=>{if(!e.matches.length)return;let n=t.routeId,r=e.matches.findIndex(t=>t.routeId===e.router.routeTree.id),i=r>=0?r:0,a=n?e.matches.findIndex(e=>e.routeId===n):e.firstBadMatchIndex??e.matches.length-1;a<0&&(a=i);for(let t=a;t>=0;t--){let n=e.matches[t];if(e.router.looseRoutesById[n.routeId].options.notFoundComponent)return t}return n?a:i},Jn=(e,t,n)=>{if(!(!Hn(n)&&!Mn(n)))throw Hn(n)&&n.redirectHandled&&!n.options.reloadDocument?n:(t&&(t._nonReactive.beforeLoadPromise?.resolve(),t._nonReactive.loaderPromise?.resolve(),t._nonReactive.beforeLoadPromise=void 0,t._nonReactive.loaderPromise=void 0,t._nonReactive.error=n,e.updateMatch(t.id,r=>({...r,status:Hn(n)?`redirected`:Mn(n)?`notFound`:r.status===`pending`?`success`:r.status,context:Kn(e,t.index),isFetching:!1,error:n})),Mn(n)&&!n.routeId&&(n.routeId=t.routeId),t._nonReactive.loadPromise?.resolve()),Hn(n)&&(e.rendered=!0,n.options._fromLocation=e.location,n.redirectHandled=!0,n=e.router.resolveRedirect(n)),n)},Yn=(e,t)=>{let n=e.router.getMatch(t);return!!(!n||n._nonReactive.dehydrated)},Xn=(e,t,n)=>{let r=Kn(e,n);e.updateMatch(t,e=>({...e,context:r}))},Zn=(e,t,n)=>{let{id:r,routeId:i}=e.matches[t],a=e.router.looseRoutesById[i];if(n instanceof Promise)throw n;e.firstBadMatchIndex??=t,Jn(e,e.router.getMatch(r),n);try{a.options.onError?.(n)}catch(t){n=t,Jn(e,e.router.getMatch(r),n)}e.updateMatch(r,e=>(e._nonReactive.beforeLoadPromise?.resolve(),e._nonReactive.beforeLoadPromise=void 0,e._nonReactive.loadPromise?.resolve(),{...e,error:n,status:`error`,isFetching:!1,updatedAt:Date.now(),abortController:new AbortController})),!e.preload&&!Hn(n)&&!Mn(n)&&(e.serialError??=n)},Qn=(e,t,n,r)=>{if(r._nonReactive.pendingTimeout!==void 0)return;let i=n.options.pendingMs??e.router.options.defaultPendingMs;if(e.onReady&&!Gn(e,t)&&(n.options.loader||n.options.beforeLoad||lr(n))&&typeof i==`number`&&i!==1/0&&(n.options.pendingComponent??e.router.options?.defaultPendingComponent)){let t=setTimeout(()=>{Un(e)},i);r._nonReactive.pendingTimeout=t}},$n=(e,t,n)=>{let r=e.router.getMatch(t);if(!r._nonReactive.beforeLoadPromise&&!r._nonReactive.loaderPromise)return;Qn(e,t,n,r);let i=()=>{let n=e.router.getMatch(t);n.preload&&(n.status===`redirected`||n.status===`notFound`)&&Jn(e,n,n.error)};return r._nonReactive.beforeLoadPromise?r._nonReactive.beforeLoadPromise.then(i):i()},er=(e,t,n,r)=>{let i=e.router.getMatch(t),a=i._nonReactive.loadPromise;i._nonReactive.loadPromise=Rt(()=>{a?.resolve(),a=void 0});let{paramsError:o,searchError:s}=i;o&&Zn(e,n,o),s&&Zn(e,n,s),Qn(e,t,r,i);let c=new AbortController,l=!1,u=()=>{l||(l=!0,e.updateMatch(t,e=>({...e,isFetching:`beforeLoad`,fetchCount:e.fetchCount+1,abortController:c})))},d=()=>{i._nonReactive.beforeLoadPromise?.resolve(),i._nonReactive.beforeLoadPromise=void 0,e.updateMatch(t,e=>({...e,isFetching:!1}))};if(!r.options.beforeLoad){e.router.batch(()=>{u(),d()});return}i._nonReactive.beforeLoadPromise=Rt();let f={...Kn(e,n,!1),...i.__routeContext},{search:p,params:m,cause:h}=i,g=Gn(e,t),_={search:p,abortController:c,params:m,preload:g,context:f,location:e.location,navigate:t=>e.router.navigate({...t,_fromLocation:e.location}),buildLocation:e.router.buildLocation,cause:g?`preload`:h,matches:e.matches,routeId:r.id,...e.router.options.additionalContext},v=r=>{if(r===void 0){e.router.batch(()=>{u(),d()});return}(Hn(r)||Mn(r))&&(u(),Zn(e,n,r)),e.router.batch(()=>{u(),e.updateMatch(t,e=>({...e,__beforeLoadContext:r})),d()})},y;try{if(y=r.options.beforeLoad(_),zt(y))return u(),y.catch(t=>{Zn(e,n,t)}).then(v)}catch(t){u(),Zn(e,n,t)}v(y)},tr=(e,t)=>{let{id:n,routeId:r}=e.matches[t],i=e.router.looseRoutesById[r],a=()=>s(),o=()=>er(e,n,t,i),s=()=>{if(Yn(e,n))return;let t=$n(e,n,i);return zt(t)?t.then(o):o()};return a()},nr=(e,t,n)=>{let r=e.router.getMatch(t);if(!r||!n.options.head&&!n.options.scripts&&!n.options.headers)return;let i={ssr:e.router.options.ssr,matches:e.matches,match:r,params:r.params,loaderData:r.loaderData};return Promise.all([n.options.head?.(i),n.options.scripts?.(i),n.options.headers?.(i)]).then(([e,t,n])=>({meta:e?.meta,links:e?.links,headScripts:e?.scripts,headers:n,scripts:t,styles:e?.styles}))},rr=(e,t,n,r,i)=>{let a=t[r-1],{params:o,loaderDeps:s,abortController:c,cause:l}=e.router.getMatch(n),u=Kn(e,r),d=Gn(e,n);return{params:o,deps:s,preload:!!d,parentMatchPromise:a,abortController:c,context:u,location:e.location,navigate:t=>e.router.navigate({...t,_fromLocation:e.location}),cause:d?`preload`:l,route:i,...e.router.options.additionalContext}},ir=async(e,t,n,r,i)=>{try{let a=e.router.getMatch(n);try{cr(i);let o=i.options.loader,s=typeof o==`function`?o:o?.handler,c=s?.(rr(e,t,n,r,i)),l=!!s&&zt(c);if((l||i._lazyPromise||i._componentsPromise||i.options.head||i.options.scripts||i.options.headers||a._nonReactive.minPendingPromise)&&e.updateMatch(n,e=>({...e,isFetching:`loader`})),s){let t=l?await c:c;Jn(e,e.router.getMatch(n),t),t!==void 0&&e.updateMatch(n,e=>({...e,loaderData:t}))}i._lazyPromise&&await i._lazyPromise;let u=a._nonReactive.minPendingPromise;u&&await u,i._componentsPromise&&await i._componentsPromise,e.updateMatch(n,t=>({...t,error:void 0,context:Kn(e,r),status:`success`,isFetching:!1,updatedAt:Date.now()}))}catch(t){let o=t;if(o?.name===`AbortError`){if(a.abortController.signal.aborted){a._nonReactive.loaderPromise?.resolve(),a._nonReactive.loaderPromise=void 0;return}e.updateMatch(n,t=>({...t,status:t.status===`pending`?`success`:t.status,isFetching:!1,context:Kn(e,r)}));return}let s=a._nonReactive.minPendingPromise;s&&await s,Mn(t)&&await i.options.notFoundComponent?.preload?.(),Jn(e,e.router.getMatch(n),t);try{i.options.onError?.(t)}catch(t){o=t,Jn(e,e.router.getMatch(n),t)}!Hn(o)&&!Mn(o)&&await cr(i,[`errorComponent`]),e.updateMatch(n,t=>({...t,error:o,context:Kn(e,r),status:`error`,isFetching:!1}))}}catch(t){let r=e.router.getMatch(n);r&&(r._nonReactive.loaderPromise=void 0),Jn(e,r,t)}},ar=async(e,t,n)=>{async function r(r,a,c,l,d){let f=Date.now()-a.updatedAt,p=r?d.options.preloadStaleTime??e.router.options.defaultPreloadStaleTime??3e4:d.options.staleTime??e.router.options.defaultStaleTime??0,m=d.options.shouldReload,h=typeof m==`function`?m(rr(e,t,i,n,d)):m,{status:g,invalid:_}=l,v=f>=p&&(!!e.forceStaleReload||l.cause===`enter`||c!==void 0&&c!==l.id);o=g===`success`&&(_||(h??v)),r&&d.options.preload===!1||(o&&!e.sync&&u?(s=!0,(async()=>{try{await ir(e,t,i,n,d);let r=e.router.getMatch(i);r._nonReactive.loaderPromise?.resolve(),r._nonReactive.loadPromise?.resolve(),r._nonReactive.loaderPromise=void 0,r._nonReactive.loadPromise=void 0}catch(t){Hn(t)&&await e.router.navigate(t.options)}})()):g!==`success`||o?await ir(e,t,i,n,d):Xn(e,i,n))}let{id:i,routeId:a}=e.matches[n],o=!1,s=!1,c=e.router.looseRoutesById[a],l=c.options.loader,u=((typeof l==`function`?void 0:l?.staleReloadMode)??e.router.options.defaultStaleReloadMode)!==`blocking`;if(Yn(e,i)){if(!e.router.getMatch(i))return e.matches[n];Xn(e,i,n)}else{let t=e.router.getMatch(i),o=e.router.stores.matchesId.get()[n],s=(o&&e.router.stores.matchStores.get(o)||null)?.routeId===a?o:e.router.stores.matches.get().find(e=>e.routeId===a)?.id,l=Gn(e,i);if(t._nonReactive.loaderPromise){if(t.status===`success`&&!e.sync&&!t.preload&&u)return t;await t._nonReactive.loaderPromise;let n=e.router.getMatch(i),a=n._nonReactive.error||n.error;a&&Jn(e,n,a),n.status===`pending`&&await r(l,t,s,n,c)}else{let n=l&&!e.router.stores.matchStores.has(i),a=e.router.getMatch(i);a._nonReactive.loaderPromise=Rt(),n!==a.preload&&e.updateMatch(i,e=>({...e,preload:n})),await r(l,t,s,a,c)}}let d=e.router.getMatch(i);s||(d._nonReactive.loaderPromise?.resolve(),d._nonReactive.loadPromise?.resolve(),d._nonReactive.loadPromise=void 0),clearTimeout(d._nonReactive.pendingTimeout),d._nonReactive.pendingTimeout=void 0,s||(d._nonReactive.loaderPromise=void 0),d._nonReactive.dehydrated=void 0;let f=s?d.isFetching:!1;return f!==d.isFetching||d.invalid!==!1?(e.updateMatch(i,e=>({...e,isFetching:f,invalid:!1})),e.router.getMatch(i)):d};async function or(e){let t=e,n=[];Wn(t.router)&&Un(t);let r;for(let e=0;e<t.matches.length;e++){try{let n=tr(t,e);zt(n)&&await n}catch(e){if(Hn(e))throw e;if(Mn(e))r=e;else if(!t.preload)throw e;break}if(t.serialError||t.firstBadMatchIndex!=null)break}let i=t.firstBadMatchIndex??t.matches.length,a=r&&!t.preload?qn(t,r):void 0,o=r&&t.preload?0:a===void 0?i:Math.min(a+1,i),s,c;for(let e=0;e<o;e++)n.push(ar(t,n,e));try{await Promise.all(n)}catch{let e=await Promise.allSettled(n);for(let t of e){if(t.status!==`rejected`)continue;let e=t.reason;if(Hn(e))throw e;Mn(e)?s??=e:c??=e}if(c!==void 0)throw c}let l=s??(r&&!t.preload?r:void 0),u=t.firstBadMatchIndex===void 0?t.matches.length-1:t.firstBadMatchIndex;if(!l&&r&&t.preload)return t.matches;if(l){let e=qn(t,l);e===void 0&&qt();let n=t.matches[e],r=t.router.looseRoutesById[n.routeId],i=t.router.options?.defaultNotFoundComponent;!r.options.notFoundComponent&&i&&(r.options.notFoundComponent=i),l.routeId=n.routeId;let a=n.routeId===t.router.routeTree.id;t.updateMatch(n.id,e=>({...e,...a?{status:`success`,globalNotFound:!0,error:void 0}:{status:`notFound`,error:l},isFetching:!1})),u=e,await cr(r,[`notFoundComponent`])}else if(!t.preload){let e=t.matches[0];e.globalNotFound||t.router.getMatch(e.id)?.globalNotFound&&t.updateMatch(e.id,e=>({...e,globalNotFound:!1,error:void 0}))}if(t.serialError&&t.firstBadMatchIndex!==void 0){let e=t.router.looseRoutesById[t.matches[t.firstBadMatchIndex].routeId];await cr(e,[`errorComponent`])}for(let e=0;e<=u;e++){let{id:n,routeId:r}=t.matches[e],i=t.router.looseRoutesById[r];try{let e=nr(t,n,i);if(e){let r=await e;t.updateMatch(n,e=>({...e,...r}))}}catch(e){console.error(`Error executing head for route ${r}:`,e)}}let d=Un(t);if(zt(d)&&await d,l)throw l;if(t.serialError&&!t.preload&&!t.onReady)throw t.serialError;return t.matches}function sr(e,t){let n=t.map(t=>e.options[t]?.preload?.()).filter(Boolean);if(n.length!==0)return Promise.all(n)}function cr(e,t=ur){!e._lazyLoaded&&e._lazyPromise===void 0&&(e.lazyFn?e._lazyPromise=e.lazyFn().then(t=>{let{id:n,...r}=t.options;Object.assign(e.options,r),e._lazyLoaded=!0,e._lazyPromise=void 0}):e._lazyLoaded=!0);let n=()=>e._componentsLoaded?void 0:t===ur?(()=>{if(e._componentsPromise===void 0){let t=sr(e,ur);t?e._componentsPromise=t.then(()=>{e._componentsLoaded=!0,e._componentsPromise=void 0}):e._componentsLoaded=!0}return e._componentsPromise})():sr(e,t);return e._lazyPromise?e._lazyPromise.then(n):n()}function lr(e){for(let t of ur)if(e.options[t]?.preload)return!0;return!1}var ur=[`component`,`errorComponent`,`pendingComponent`,`notFoundComponent`];function dr(e){return{input:({url:t})=>{for(let n of e)t=pr(n,t);return t},output:({url:t})=>{for(let n=e.length-1;n>=0;n--)t=mr(e[n],t);return t}}}function fr(e){let t=wn(e.basepath),n=`/${t}`,r=e.caseSensitive?n:n.toLowerCase(),i=`${r}/`;return{input:({url:t})=>{let a=e.caseSensitive?t.pathname:t.pathname.toLowerCase();return a===r?t.pathname=`/`:a.startsWith(i)&&(t.pathname=t.pathname.slice(n.length)),t},output:({url:e})=>(e.pathname=bn([`/`,t,e.pathname]),e)}}function pr(e,t){let n=e?.input?.({url:t});if(n){if(typeof n==`string`)return new URL(n);if(n instanceof URL)return n}return t}function mr(e,t){let n=e?.output?.({url:t});if(n){if(typeof n==`string`)return new URL(n);if(n instanceof URL)return n}return t}function hr(e,t){let{createMutableStore:n,createReadonlyStore:r,batch:i,init:a}=t,o=new Map,s=new Map,c=new Map,l=n(e.status),u=n(e.loadedAt),d=n(e.isLoading),f=n(e.isTransitioning),p=n(e.location),m=n(e.resolvedLocation),h=n(e.statusCode),g=n(e.redirect),_=n([]),v=n([]),y=n([]),b=r(()=>gr(o,_.get())),x=r(()=>gr(s,v.get())),S=r(()=>gr(c,y.get())),C=r(()=>_.get()[0]),w=r(()=>_.get().some(e=>o.get(e)?.get().status===`pending`)),T=r(()=>({locationHref:p.get().href,resolvedLocationHref:m.get()?.href,status:l.get()})),E=r(()=>({status:l.get(),loadedAt:u.get(),isLoading:d.get(),isTransitioning:f.get(),matches:b.get(),location:p.get(),resolvedLocation:m.get(),statusCode:h.get(),redirect:g.get()})),D=Jt(64);function O(e){let t=D.get(e);return t||(t=r(()=>{let t=_.get();for(let n of t){let t=o.get(n);if(t&&t.routeId===e)return t.get()}}),D.set(e,t)),t}let ee={status:l,loadedAt:u,isLoading:d,isTransitioning:f,location:p,resolvedLocation:m,statusCode:h,redirect:g,matchesId:_,pendingIds:v,cachedIds:y,matches:b,pendingMatches:x,cachedMatches:S,firstId:C,hasPending:w,matchRouteDeps:T,matchStores:o,pendingMatchStores:s,cachedMatchStores:c,__store:E,getRouteMatchStore:O,setMatches:te,setPending:ne,setCached:re};te(e.matches),a?.(ee);function te(e){_r(e,o,_,n,i)}function ne(e){_r(e,s,v,n,i)}function re(e){_r(e,c,y,n,i)}return ee}function gr(e,t){let n=[];for(let r of t){let t=e.get(r);t&&n.push(t.get())}return n}function _r(e,t,n,r,i){let a=e.map(e=>e.id),o=new Set(a);i(()=>{for(let e of t.keys())o.has(e)||t.delete(e);for(let n of e){let e=t.get(n.id);if(!e){let e=r(n);e.routeId=n.routeId,t.set(n.id,e);continue}e.routeId=n.routeId,e.get()!==n&&e.set(n)}Kt(n.get(),a)||n.set(a)})}var vr=`__TSR_index`,yr=`popstate`,br=`beforeunload`;function xr(e){let t=e.getLocation(),n=new Set,r=r=>{t=e.getLocation(),n.forEach(e=>e({location:t,action:r}))},i=n=>{e.notifyOnIndexChange??!0?r(n):t=e.getLocation()},a=async({task:n,navigateOpts:r,...i})=>{if(r?.ignoreBlocker??!1){n();return}let a=e.getBlockers?.()??[],o=i.type===`PUSH`||i.type===`REPLACE`;if(typeof document<`u`&&a.length&&o)for(let n of a){let r=Tr(i.path,i.state);if(await n.blockerFn({currentLocation:t,nextLocation:r,action:i.type})){e.onBlocked?.();return}}n()};return{get location(){return t},get length(){return e.getLength()},subscribers:n,subscribe:e=>(n.add(e),()=>{n.delete(e)}),push:(n,i,o)=>{let s=t.state[vr];i=Sr(s+1,i),a({task:()=>{e.pushState(n,i),r({type:`PUSH`})},navigateOpts:o,type:`PUSH`,path:n,state:i})},replace:(n,i,o)=>{let s=t.state[vr];i=Sr(s,i),a({task:()=>{e.replaceState(n,i),r({type:`REPLACE`})},navigateOpts:o,type:`REPLACE`,path:n,state:i})},go:(t,n)=>{a({task:()=>{e.go(t),i({type:`GO`,index:t})},navigateOpts:n,type:`GO`})},back:t=>{a({task:()=>{e.back(t?.ignoreBlocker??!1),i({type:`BACK`})},navigateOpts:t,type:`BACK`})},forward:t=>{a({task:()=>{e.forward(t?.ignoreBlocker??!1),i({type:`FORWARD`})},navigateOpts:t,type:`FORWARD`})},canGoBack:()=>t.state[vr]!==0,createHref:t=>e.createHref(t),block:t=>{if(!e.setBlockers)return()=>{};let n=e.getBlockers?.()??[];return e.setBlockers([...n,t]),()=>{let n=e.getBlockers?.()??[];e.setBlockers?.(n.filter(e=>e!==t))}},flush:()=>e.flush?.(),destroy:()=>e.destroy?.(),notify:r}}function Sr(e,t){t||={};let n=Er();return{...t,key:n,__TSR_key:n,[vr]:e}}function Cr(e){let t=e?.window??(typeof document<`u`?window:void 0),n=t.history.pushState,r=t.history.replaceState,i=[],a=()=>i,o=e=>i=e,s=e?.createHref??(e=>e),c=e?.parseLocation??(()=>Tr(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!t.history.state?.__TSR_key&&!t.history.state?.key){let e=Er();t.history.replaceState({[vr]:0,key:e,__TSR_key:e},``)}let l=c(),u,d=!1,f=!1,p=!1,m=!1,h=()=>l,g,_,v=()=>{g&&(C._ignoreSubscribers=!0,(g.isPush?t.history.pushState:t.history.replaceState)(g.state,``,g.href),C._ignoreSubscribers=!1,g=void 0,_=void 0,u=void 0)},y=(e,t,n)=>{let r=s(t);_||(u=l),l=Tr(t,n),g={href:r,state:n,isPush:g?.isPush||e===`push`},_||=Promise.resolve().then(()=>v())},b=e=>{l=c(),C.notify({type:e})},x=async()=>{if(f){f=!1;return}let e=c(),n=e.state[vr]-l.state[vr],r=n===1,i=n===-1,o=!r&&!i||d;d=!1;let s=o?`GO`:i?`BACK`:`FORWARD`,u=o?{type:`GO`,index:n}:{type:i?`BACK`:`FORWARD`};if(p)p=!1;else{let n=a();if(typeof document<`u`&&n.length){for(let r of n)if(await r.blockerFn({currentLocation:l,nextLocation:e,action:s})){f=!0,t.history.go(1),C.notify(u);return}}}l=c(),C.notify(u)},S=e=>{if(m){m=!1;return}let t=!1,n=a();if(typeof document<`u`&&n.length)for(let e of n){let n=e.enableBeforeUnload??!0;if(n===!0){t=!0;break}if(typeof n==`function`&&n()===!0){t=!0;break}}if(t)return e.preventDefault(),e.returnValue=``},C=xr({getLocation:h,getLength:()=>t.history.length,pushState:(e,t)=>y(`push`,e,t),replaceState:(e,t)=>y(`replace`,e,t),back:e=>(e&&(p=!0),m=!0,t.history.back()),forward:e=>{e&&(p=!0),m=!0,t.history.forward()},go:e=>{d=!0,t.history.go(e)},createHref:e=>s(e),flush:v,destroy:()=>{t.history.pushState=n,t.history.replaceState=r,t.removeEventListener(br,S,{capture:!0}),t.removeEventListener(yr,x)},onBlocked:()=>{u&&l!==u&&(l=u)},getBlockers:a,setBlockers:o,notifyOnIndexChange:!1});return t.addEventListener(br,S,{capture:!0}),t.addEventListener(yr,x),t.history.pushState=function(...e){let r=n.apply(t.history,e);return C._ignoreSubscribers||b(`PUSH`),r},t.history.replaceState=function(...e){let n=r.apply(t.history,e);return C._ignoreSubscribers||b(`REPLACE`),n},C}function wr(e){let t=e.replace(/[\x00-\x1f\x7f]/g,``);return t.startsWith(`//`)&&(t=`/`+t.replace(/^\/+/,``)),t}function Tr(e,t){let n=wr(e),r=n.indexOf(`#`),i=n.indexOf(`?`),a=Er();return{href:n,pathname:n.substring(0,r>0?i>0?Math.min(r,i):r:i>0?i:n.length),hash:r>-1?n.substring(r):``,search:i>-1?n.slice(i,r===-1?void 0:r):``,state:t||{[vr]:0,key:a,__TSR_key:a}}}function Er(){return(Math.random()+1).toString(36).substring(7)}function Dr(e,t){let n=t,r=e;return{fromLocation:n,toLocation:r,pathChanged:n?.pathname!==r.pathname,hrefChanged:n?.href!==r.href,hashChanged:n?.hash!==r.hash}}var Or=new WeakMap,kr=class{constructor(e,t){this.tempLocationKey=`${Math.round(Math.random()*1e7)}`,this.resetNextScroll=!0,this.shouldViewTransition=void 0,this.isViewTransitionTypesSupported=void 0,this.subscribers=new Set,this.isScrollRestoring=!1,this.isScrollRestorationSetup=!1,this.routeBranchCache=new WeakMap,this.startTransition=e=>e(),this.update=e=>{let t=this.options,n=this.basepath??t?.basepath??`/`,r=this.basepath===void 0,i=t?.rewrite;if(this.options={...t,...e},this.isServer=this.options.isServer??typeof document>`u`,this.protocolAllowlist=new Set(this.options.protocolAllowlist),this.options.pathParamsAllowedCharacters&&(this.pathParamsDecoder=On(this.options.pathParamsAllowedCharacters)),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.options.history?this.history=this.options.history:this.history=Cr()),this.origin=this.options.origin,this.origin||(window?.origin&&window.origin!==`null`?this.origin=window.origin:this.origin=`http://localhost`),this.history&&this.updateLatestLocation(),this.options.routeTree!==this.routeTree){this.routeTree=this.options.routeTree;let e;this.resolvePathCache=Jt(1e3),e=this.buildRouteTree(),this.setRoutes(e)}if(!this.stores&&this.latestLocation){let e=this.getStoreConfig(this);this.batch=e.batch,this.stores=hr(Mr(this.latestLocation),e),Qr(this)}let a=!1,o=this.options.basepath??`/`,s=this.options.rewrite;if(r||n!==o||i!==s){this.basepath=o;let e=[],t=wn(o);t&&t!==`/`&&e.push(fr({basepath:o})),s&&e.push(s),this.rewrite=e.length===0?void 0:e.length===1?e[0]:dr(e),this.history&&this.updateLatestLocation(),a=!0}a&&this.stores&&this.stores.location.set(this.latestLocation),typeof window<`u`&&`CSS`in window&&typeof window.CSS?.supports==`function`&&(this.isViewTransitionTypesSupported=window.CSS.supports(`selector(:active-view-transition-type(a))`))},this.updateLatestLocation=()=>{this.latestLocation=this.parseLocation(this.history.location,this.latestLocation)},this.buildRouteTree=()=>{let e=un(this.routeTree,this.options.caseSensitive,(e,t)=>{e.init({originalIndex:t})});return this.options.routeMasks&&an(this.options.routeMasks,e.processedTree),e},this.subscribe=(e,t)=>{let n={eventType:e,fn:t};return this.subscribers.add(n),()=>{this.subscribers.delete(n)}},this.emit=e=>{this.subscribers.forEach(t=>{t.eventType===e.type&&t.fn(e)})},this.parseLocation=(e,t)=>{let n=({pathname:e,search:n,hash:r,href:i,state:a})=>{if(!this.rewrite&&!/[ \x00-\x1f\x7f\u0080-\uffff]/.test(e)){let i=this.options.parseSearch(n),o=this.options.stringifySearch(i);return{href:e+o+r,publicHref:e+o+r,pathname:Wt(e).path,external:!1,searchStr:o,search:jt(t?.search,i),hash:Wt(r.slice(1)).path,state:Mt(t?.state,a)}}let o=new URL(i,this.origin),s=pr(this.rewrite,o),c=this.options.parseSearch(s.search),l=this.options.stringifySearch(c);return s.search=l,{href:s.href.replace(s.origin,``),publicHref:i,pathname:Wt(s.pathname).path,external:!!this.rewrite&&s.origin!==this.origin,searchStr:l,search:jt(t?.search,c),hash:Wt(s.hash.slice(1)).path,state:Mt(t?.state,a)}},r=n(e),{__tempLocation:i,__tempKey:a}=r.state;if(i&&(!a||a===this.tempLocationKey)){let e=n(i);return e.state.key=r.state.key,e.state.__TSR_key=r.state.__TSR_key,delete e.state.__tempLocation,{...e,maskedLocation:r}}return r},this.resolvePathWithBase=(e,t)=>Dn({base:e,to:t.includes(`//`)?xn(t):t,trailingSlash:this.options.trailingSlash,cache:this.resolvePathCache}),this.matchRoutes=(e,t,n)=>typeof e==`string`?this.matchRoutesInternal({pathname:e,search:t},n):this.matchRoutesInternal(e,t),this.getMatchedRoutes=e=>Pr({pathname:e,routesById:this.routesById,processedTree:this.processedTree}),this.cancelMatch=e=>{let t=this.getMatch(e);t&&(t.abortController.abort(),clearTimeout(t._nonReactive.pendingTimeout),t._nonReactive.pendingTimeout=void 0)},this.cancelMatches=()=>{this.stores.pendingIds.get().forEach(e=>{this.cancelMatch(e)}),this.stores.matchesId.get().forEach(e=>{if(this.stores.pendingMatchStores.has(e))return;let t=this.stores.matchStores.get(e)?.get();t&&(t.status===`pending`||t.isFetching===`loader`)&&this.cancelMatch(e)})},this.buildLocation=e=>{let t=(t={})=>{let n=t._fromLocation||this.pendingBuiltLocation||this.latestLocation,r=this.matchRoutesLightweight(n);t.from;let i=t.unsafeRelative===`path`?n.pathname:t.from??r.fullPath,a=t.to?`${t.to}`:void 0,o=r.search,s=Object.assign(Object.create(null),r.params),c=a?.charCodeAt(0)===47?`/`:this.resolvePathWithBase(i,`.`),l=a?this.resolvePathWithBase(c,a):c,u=t.params===!1||t.params===null?Object.create(null):(t.params??!0)===!0?s:Object.assign(s,Et(t.params,s)),d=this.routesByPath[Cn(l)],f;if(d)f=this.getRouteBranch(d);else if(l.includes(`$`))f=[];else{let e=this.getMatchedRoutes(l);f=e.matchedRoutes,this.options.notFoundRoute&&(!e.foundRoute||e.foundRoute.path!==`/`&&e.routeParams[`**`])&&(f=[...f,this.options.notFoundRoute])}if(f.length&&kt(u))for(let e of f){let t=e.options.params?.stringify??e.options.stringifyParams;if(t)try{Object.assign(u,t(u))}catch{}}let p=e.leaveParams?l:Wt(An({path:l,params:u,decoder:this.pathParamsDecoder,server:this.isServer}).interpolatedPath).path,m=o;if(e._includeValidateSearch&&this.options.search?.strict){let e={};f.forEach(t=>{if(t.options.validateSearch)try{Object.assign(e,Nr(t.options.validateSearch,{...e,...m}))}catch{}}),m=e}m=Fr({search:m,dest:t,destRoutes:f,_includeValidateSearch:e._includeValidateSearch}),m=jt(o,m);let h=this.options.stringifySearch(m),g=t.hash===!0?n.hash:t.hash?Et(t.hash,n.hash):void 0,_=g?`#${g}`:``,v=t.state===!0?n.state:t.state?Et(t.state,n.state):{};v=Mt(n.state,v);let y=`${p}${h}${_}`,b,x,S=!1;if(this.rewrite){let e=new URL(y,this.origin),t=mr(this.rewrite,e);b=e.href.replace(e.origin,``),t.origin===this.origin?x=t.pathname+t.search+t.hash:(x=t.href,S=!0)}else b=Gt(y),x=b;return{publicHref:x,href:b,pathname:p,search:m,searchStr:h,state:v,hash:g??``,external:S,unmaskOnReload:t.unmaskOnReload}},n=(n={},r)=>{let i=t(n),a=r?t(r):void 0;if(!a){let n=Object.create(null);if(this.options.routeMasks){let o=on(i.pathname,this.processedTree);if(o){Object.assign(n,o.rawParams);let{from:i,params:s,...c}=o.route,l=s===!1||s===null?Object.create(null):(s??!0)===!0?n:Object.assign(n,Et(s,n));r={from:e.from,...c,params:l},a=t(r)}}}return a&&(i.maskedLocation=a),i};return e.mask?n(e,{from:e.from,...e.mask}):n(e)},this.commitLocation=async({viewTransition:e,ignoreBlocker:t,...n})=>{let r,i=()=>{let e=[`key`,`__TSR_key`,`__TSR_index`,`__hashScrollIntoViewOptions`];e.forEach(e=>{n.state[e]=this.latestLocation.state[e]});let t=Lt(n.state,this.latestLocation.state);return e.forEach(e=>{delete n.state[e]}),t},a=Cn(this.latestLocation.href)===Cn(n.href),o=this.commitLocationPromise;if(this.commitLocationPromise=Rt(()=>{o?.resolve(),o=void 0}),a&&i())this.load();else{let{maskedLocation:i,hashScrollIntoView:a,...o}=n;i&&(o={...i,state:{...i.state,__tempKey:void 0,__tempLocation:{...o,search:o.searchStr,state:{...o.state,__tempKey:void 0,__tempLocation:void 0,__TSR_key:void 0,key:void 0}}}},(o.unmaskOnReload??this.options.unmaskOnReload??!1)&&(o.state.__tempKey=this.tempLocationKey)),o.state.__hashScrollIntoViewOptions=a??this.options.defaultHashScrollIntoView??!0,this.shouldViewTransition=e,r=n.replace?`REPLACE`:`PUSH`,this.history[r===`REPLACE`?`replace`:`push`](o.publicHref,o.state,{ignoreBlocker:t})}return this.resetNextScroll=n.resetScroll??!0,this.history.subscribers.size||this.load(r?{action:{type:r}}:void 0),this.commitLocationPromise},this.buildAndCommitLocation=({replace:e,resetScroll:t,hashScrollIntoView:n,viewTransition:r,ignoreBlocker:i,href:a,...o}={})=>{if(a){let t=this.history.location.state.__TSR_index,n=Tr(a,{__TSR_index:e?t:t+1}),r=new URL(n.pathname,this.origin);o.to=pr(this.rewrite,r).pathname,o.search=this.options.parseSearch(n.search),o.hash=n.hash.slice(1)}let s=this.buildLocation({...o,_includeValidateSearch:!0});this.pendingBuiltLocation=s;let c=this.commitLocation({...s,viewTransition:r,replace:e,resetScroll:t,hashScrollIntoView:n,ignoreBlocker:i});return Promise.resolve().then(()=>{this.pendingBuiltLocation===s&&(this.pendingBuiltLocation=void 0)}),c},this.navigate=async({to:e,reloadDocument:t,href:n,publicHref:r,...i})=>{let a=!1;if(n)try{new URL(`${n}`),a=!0}catch{}if(a&&!t&&(t=!0),t){if(e!==void 0||!n){let t=this.buildLocation({to:e,...i});n??=t.publicHref,r??=t.publicHref}let t=!a&&r?r:n;if(Ut(t,this.protocolAllowlist))return Promise.resolve();if(!i.ignoreBlocker){let e=this.history.getBlockers?.()??[];for(let t of e)if(t?.blockerFn&&await t.blockerFn({currentLocation:this.latestLocation,nextLocation:this.latestLocation,action:`PUSH`}))return Promise.resolve()}return i.replace?window.location.replace(t):window.location.href=t,Promise.resolve()}return this.buildAndCommitLocation({...i,href:n,to:e,_isNavigate:!0})},this.beforeLoad=()=>{this.cancelMatches(),this.updateLatestLocation();let e=this.matchRoutes(this.latestLocation),t=this.stores.cachedMatches.get().filter(t=>!e.some(e=>e.id===t.id));this.batch(()=>{this.stores.status.set(`pending`),this.stores.statusCode.set(200),this.stores.isLoading.set(!0),this.stores.location.set(this.latestLocation),this.stores.setPending(e),this.stores.setCached(t)})},this.load=async e=>{let t=e?.action?.type,n,r,i,a=this.stores.resolvedLocation.get()??this.stores.location.get();for(i=new Promise(o=>{this.startTransition(async()=>{try{this.beforeLoad(),t?Or.set(this.latestLocation,t):Or.delete(this.latestLocation);let n=this.latestLocation,r=Dr(n,this.stores.resolvedLocation.get());this.stores.redirect.get()||this.emit({type:`onBeforeNavigate`,...r}),this.emit({type:`onBeforeLoad`,...r}),await or({router:this,sync:e?.sync,forceStaleReload:a.href===n.href,matches:this.stores.pendingMatches.get(),location:n,updateMatch:this.updateMatch,onReady:async()=>{this.startTransition(()=>{this.startViewTransition(async()=>{let e=null,t=null,n=null,r=null;this.batch(()=>{let i=this.stores.pendingMatches.get(),a=i.length,o=this.stores.matches.get();e=a?o.filter(e=>!this.stores.pendingMatchStores.has(e.id)):null;let s=new Set;for(let e of this.stores.pendingMatchStores.values())e.routeId&&s.add(e.routeId);let c=new Set;for(let e of this.stores.matchStores.values())e.routeId&&c.add(e.routeId);t=a?o.filter(e=>!s.has(e.routeId)):null,n=a?i.filter(e=>!c.has(e.routeId)):null,r=a?i.filter(e=>c.has(e.routeId)):o,this.stores.isLoading.set(!1),this.stores.loadedAt.set(Date.now()),a&&(this.stores.setMatches(i),this.stores.setPending([]),this.stores.setCached([...this.stores.cachedMatches.get(),...e.filter(e=>e.status!==`error`&&e.status!==`notFound`&&e.status!==`redirected`)]),this.clearExpiredCache())});for(let[e,i]of[[t,`onLeave`],[n,`onEnter`],[r,`onStay`]])if(e)for(let t of e)this.looseRoutesById[t.routeId].options[i]?.(t)})})}})}catch(e){Hn(e)?(n=e,this.navigate({...n.options,replace:!0,ignoreBlocker:!0})):Mn(e)&&(r=e);let t=n?n.status:r?404:this.stores.matches.get().some(e=>e.status===`error`)?500:200;this.batch(()=>{this.stores.statusCode.set(t),this.stores.redirect.set(n)})}this.latestLoadPromise===i&&(this.commitLocationPromise?.resolve(),this.latestLoadPromise=void 0,this.commitLocationPromise=void 0),o()})}),this.latestLoadPromise=i,await i;this.latestLoadPromise&&i!==this.latestLoadPromise;)await this.latestLoadPromise;let o;this.hasNotFoundMatch()?o=404:this.stores.matches.get().some(e=>e.status===`error`)&&(o=500),o!==void 0&&this.stores.statusCode.set(o)},this.startViewTransition=e=>{let t=this.shouldViewTransition??this.options.defaultViewTransition;if(this.shouldViewTransition=void 0,t&&typeof document<`u`&&`startViewTransition`in document&&typeof document.startViewTransition==`function`){let n;if(typeof t==`object`&&this.isViewTransitionTypesSupported){let r=this.latestLocation,i=this.stores.resolvedLocation.get(),a=typeof t.types==`function`?t.types(Dr(r,i)):t.types;if(a===!1){e();return}n={update:e,types:a}}else n=e;document.startViewTransition(n)}else e()},this.updateMatch=(e,t)=>{this.startTransition(()=>{let n=this.stores.pendingMatchStores.get(e);if(n){n.set(t);return}let r=this.stores.matchStores.get(e);if(r){r.set(t);return}let i=this.stores.cachedMatchStores.get(e);if(i){let n=t(i.get());n.status===`redirected`?this.stores.cachedMatchStores.delete(e)&&this.stores.cachedIds.set(t=>t.filter(t=>t!==e)):i.set(n)}})},this.getMatch=e=>this.stores.cachedMatchStores.get(e)?.get()??this.stores.pendingMatchStores.get(e)?.get()??this.stores.matchStores.get(e)?.get(),this.invalidate=e=>{let t=t=>e?.filter?.(t)??!0?{...t,invalid:!0,...e?.forcePending||t.status===`error`||t.status===`notFound`?{status:`pending`,error:void 0}:void 0}:t;return this.batch(()=>{this.stores.setMatches(this.stores.matches.get().map(t)),this.stores.setCached(this.stores.cachedMatches.get().map(t)),this.stores.setPending(this.stores.pendingMatches.get().map(t))}),this.shouldViewTransition=!1,this.load({sync:e?.sync})},this.getParsedLocationHref=e=>e.publicHref||`/`,this.resolveRedirect=e=>{let t=e.headers.get(`Location`);if(!e.options.href||e.options._builtLocation){let t=e.options._builtLocation??this.buildLocation(e.options),n=this.getParsedLocationHref(t);e.options.href=n,e.headers.set(`Location`,n)}else if(t)try{let n=new URL(t);if(this.origin&&n.origin===this.origin){let t=n.pathname+n.search+n.hash;e.options.href=t,e.headers.set(`Location`,t)}}catch{}if(e.options.href&&!e.options._builtLocation&&Ut(e.options.href,this.protocolAllowlist))throw Error(`Redirect blocked: unsafe protocol`);return e.headers.get(`Location`)||e.headers.set(`Location`,e.options.href),e},this.clearCache=e=>{let t=e?.filter;t===void 0?this.stores.setCached([]):this.stores.setCached(this.stores.cachedMatches.get().filter(e=>!t(e)))},this.clearExpiredCache=()=>{let e=Date.now();this.clearCache({filter:t=>{let n=this.looseRoutesById[t.routeId];if(!n.options.loader)return!0;let r=(t.preload?n.options.preloadGcTime??this.options.defaultPreloadGcTime:n.options.gcTime??this.options.defaultGcTime)??300*1e3;return t.status===`error`?!0:e-t.updatedAt>=r}})},this.loadRouteChunk=cr,this.preloadRoute=async e=>{let t=e._builtLocation??this.buildLocation(e),n=this.matchRoutes(t,{throwOnError:!0,preload:!0,dest:e}),r=new Set([...this.stores.matchesId.get(),...this.stores.pendingIds.get()]),i=new Set([...r,...this.stores.cachedIds.get()]),a=n.filter(e=>!i.has(e.id));if(a.length){let e=this.stores.cachedMatches.get();this.stores.setCached([...e,...a])}try{return n=await or({router:this,matches:n,location:t,preload:!0,updateMatch:(e,t)=>{r.has(e)?n=n.map(n=>n.id===e?t(n):n):this.updateMatch(e,t)}}),n}catch(e){if(Hn(e))return e.options.reloadDocument?void 0:await this.preloadRoute({...e.options,_fromLocation:t});Mn(e)||console.error(e);return}},this.matchRoute=(e,t)=>{let n={...e,to:e.to?this.resolvePathWithBase(e.from||``,e.to):void 0,params:e.params||{},leaveParams:!0},r=this.buildLocation(n);if(t?.pending&&this.stores.status.get()!==`pending`)return!1;let i=(t?.pending===void 0?!this.stores.isLoading.get():t.pending)?this.latestLocation:this.stores.resolvedLocation.get()||this.stores.location.get(),a=sn(r.pathname,t?.caseSensitive??!1,t?.fuzzy??!1,i.pathname,this.processedTree);return!a||e.params&&!Lt(a.rawParams,e.params,{partial:!0})?!1:t?.includeSearch??!0?Lt(i.search,r.search,{partial:!0})?a.rawParams:!1:a.rawParams},this.hasNotFoundMatch=()=>this.stores.matches.get().some(e=>e.status===`notFound`||e.globalNotFound),this.getStoreConfig=t,this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...e,caseSensitive:e.caseSensitive??!1,notFoundMode:e.notFoundMode??`fuzzy`,stringifySearch:e.stringifySearch??Ln,parseSearch:e.parseSearch??In,protocolAllowlist:e.protocolAllowlist??Ht}),typeof document<`u`&&(self.__TSR_ROUTER__=this)}isShell(){return!!this.options.isShell}isPrerendering(){return!!this.options.isPrerendering}get state(){return this.stores.__store.get()}setRoutes({routesById:e,routesByPath:t,processedTree:n}){this.routesById=e,this.routesByPath=t,this.processedTree=n;let r=this.options.notFoundRoute;r&&(r.init({originalIndex:99999999999}),this.routesById[r.id]=r)}getRouteBranch(e){let t=this.routeBranchCache.get(e);return t||(t=pn(e),this.routeBranchCache.set(e,t)),t}get looseRoutesById(){return this.routesById}getParentContext(e){return e?.id?e.context??this.options.context??void 0:this.options.context??void 0}matchRoutesInternal(e,t){let n=this.getMatchedRoutes(e.pathname),{foundRoute:r,routeParams:i}=n,{matchedRoutes:a}=n,o=!1;(r?r.path!==`/`&&i[`**`]:Cn(e.pathname))&&(this.options.notFoundRoute?a=[...a,this.options.notFoundRoute]:o=!0);let s=o?Lr(this.options.notFoundMode,a):void 0,c=Array(a.length),l=new Map;for(let e of this.stores.matchStores.values())e.routeId&&l.set(e.routeId,e.get());for(let n=0;n<a.length;n++){let r=a[n],o=c[n-1],u,d,f;{let n=o?.search??e.search,i=o?._strictSearch??void 0;try{let e=Nr(r.options.validateSearch,{...n})??void 0;u={...n,...e},d={...i,...e},f=void 0}catch(e){let r=e;if(e instanceof Ar||(r=new Ar(e.message,{cause:e})),t?.throwOnError)throw r;u=n,d={},f=r}}let p=r.options.loaderDeps?.({search:u})??``,m=p?JSON.stringify(p):``,{interpolatedPath:h,usedParams:g}=An({path:r.fullPath,params:i,decoder:this.pathParamsDecoder,server:this.isServer}),_=r.id+h+m,v=this.getMatch(_),y=l.get(r.id),b=v?._strictParams??g,x;if(!v)try{Rr(r,b)}catch(e){if(x=Mn(e)||Hn(e)?e:new jr(e.message,{cause:e}),t?.throwOnError)throw x}Object.assign(i,b);let S=y?`stay`:`enter`,C;if(v)C={...v,cause:S,params:y?.params??i,_strictParams:b,search:jt(y?y.search:v.search,u),_strictSearch:d};else{let e=r.options.loader||r.options.beforeLoad||r.lazyFn||lr(r)?`pending`:`success`;C={id:_,ssr:r.options.ssr,index:n,routeId:r.id,params:y?.params??i,_strictParams:b,pathname:h,updatedAt:Date.now(),search:y?jt(y.search,u):u,_strictSearch:d,searchError:void 0,status:e,isFetching:!1,error:void 0,paramsError:x,__routeContext:void 0,_nonReactive:{loadPromise:Rt()},__beforeLoadContext:void 0,context:{},abortController:new AbortController,fetchCount:0,cause:S,loaderDeps:y?Mt(y.loaderDeps,p):p,invalid:!1,preload:!1,links:void 0,scripts:void 0,headScripts:void 0,meta:void 0,staticData:r.options.staticData||{},fullPath:r.fullPath}}t?.preload||(C.globalNotFound=s===r.id),C.searchError=f;let w=this.getParentContext(o);C.context={...w,...C.__routeContext,...C.__beforeLoadContext},c[n]=C}for(let t=0;t<c.length;t++){let n=c[t],r=this.looseRoutesById[n.routeId],a=this.getMatch(n.id),o=l.get(n.routeId);if(n.params=o?jt(o.params,i):i,!a){let i=c[t-1],a=this.getParentContext(i);if(r.options.context){let t={deps:n.loaderDeps,params:n.params,context:a??{},location:e,navigate:t=>this.navigate({...t,_fromLocation:e}),buildLocation:this.buildLocation,cause:n.cause,abortController:n.abortController,preload:!!n.preload,matches:c,routeId:r.id};n.__routeContext=r.options.context(t)??void 0}n.context={...a,...n.__routeContext,...n.__beforeLoadContext}}}return c}matchRoutesLightweight(e){let{matchedRoutes:t,routeParams:n}=this.getMatchedRoutes(e.pathname),r=wt(t),i={...e.search};for(let e of t)try{Object.assign(i,Nr(e.options.validateSearch,i))}catch{}let a=wt(this.stores.matchesId.get()),o=a&&this.stores.matchStores.get(a)?.get(),s=o&&o.routeId===r.id&&o.pathname===e.pathname,c;if(s)c=o.params;else{let e=Object.assign(Object.create(null),n);for(let n of t)try{Rr(n,e)}catch{}c=e}return{matchedRoutes:t,fullPath:r.fullPath,search:i,params:c}}},Ar=class extends Error{},jr=class extends Error{};function Mr(e){return{loadedAt:0,isLoading:!1,isTransitioning:!1,status:`idle`,resolvedLocation:void 0,location:e,matches:[],statusCode:200}}function Nr(e,t){if(e==null)return{};if(`~standard`in e){let n=e[`~standard`].validate(t);if(n instanceof Promise)throw new Ar(`Async validation not supported`);if(n.issues)throw new Ar(JSON.stringify(n.issues,void 0,2),{cause:n});return n.value}return`parse`in e?e.parse(t):typeof e==`function`?e(t):{}}function Pr({pathname:e,routesById:t,processedTree:n}){let r=Object.create(null),i=Cn(e),a,o=cn(i,n,!0);return o&&(a=o.route,Object.assign(r,o.rawParams)),{matchedRoutes:o?.branch||[t.__root__],routeParams:r,foundRoute:a}}function Fr({search:e,dest:t,destRoutes:n,_includeValidateSearch:r}){return Ir(n)(e,t,r??!1)}function Ir(e){let t={dest:null,_includeValidateSearch:!1,middlewares:[]};for(let n of e)`search`in n.options?n.options.search?.middlewares&&t.middlewares.push(...n.options.search.middlewares):(n.options.preSearchFilters||n.options.postSearchFilters)&&t.middlewares.push(({search:e,next:t})=>{let r=e;`preSearchFilters`in n.options&&n.options.preSearchFilters&&(r=n.options.preSearchFilters.reduce((e,t)=>t(e),e));let i=t(r);return`postSearchFilters`in n.options&&n.options.postSearchFilters?n.options.postSearchFilters.reduce((e,t)=>t(e),i):i}),n.options.validateSearch&&t.middlewares.push(({search:e,next:r})=>{let i=r(e);if(!t._includeValidateSearch)return i;try{return{...i,...Nr(n.options.validateSearch,i)??void 0}}catch{return i}});t.middlewares.push(({search:e})=>{let n=t.dest;return n.search?n.search===!0?e:Et(n.search,e):{}});let n=(e,t,r)=>{if(e>=r.length)return t;let i=r[e];return i({search:t,next:t=>n(e+1,t,r)})};return function(e,r,i){return t.dest=r,t._includeValidateSearch=i,n(0,e,t.middlewares)}}function Lr(e,t){if(e!==`root`)for(let e=t.length-1;e>=0;e--){let n=t[e];if(n.children)return n.id}return Bn}function Rr(e,t){let n=e.options.params?.parse??e.options.parseParams;if(n){let e=n(t);if(e===!1)throw Error(`Route params.parse returned false for a matched route`);Object.assign(t,e)}}function zr(){try{return sessionStorage}catch{return}}var Br=`tsr-scroll-restoration-v1_3`,Vr=zr();function Hr(){try{return JSON.parse(Vr?.getItem(`tsr-scroll-restoration-v1_3`)||`{}`)}catch{return{}}}function Ur(){try{Vr?.setItem(Br,JSON.stringify(Wr))}catch{}}var Wr=Hr(),Gr=`data-scroll-restoration-id`,Kr=e=>e.state.__TSR_key||e.href;function qr(e){let t=e.getAttribute(Gr);if(t)return`[${Gr}="${t}"]`;let n=``,r=e,i;for(;i=r.parentNode;){let e=1,t=r;for(;t=t.previousElementSibling;)e++;let a=`${r.localName}:nth-child(${e})`;n=n?`${a} > ${n}`:a,r=i}return n}var Jr=!1,Yr=`window`;function Xr(e){try{return typeof e==`function`?e():document.querySelector(e)}catch{}}function Zr(e){let t=[];for(let n of e){if(n===Yr)continue;let e=Xr(n);e&&t.push(e)}return t}function Qr(e,t){if((t??e.options.scrollRestoration)&&(e.isScrollRestoring=!0),e.isScrollRestorationSetup)return;e.isScrollRestorationSetup=!0,Jr=!1;let n=e.options.getScrollRestorationKey||Kr,r=new Map,i=(e,t,n)=>{let i=r.get(e)||{};i.scrollX=t,i.scrollY=n,r.set(e,i)};history.scrollRestoration=`manual`;let a=t=>{if(!(Jr||!e.isScrollRestoring))if(t.target===document)i(Yr,scrollX,scrollY);else{let e=t.target;i(e,e.scrollLeft,e.scrollTop)}},o=t=>{if(!e.isScrollRestoring)return;let n=Wr[t]||={};for(let[e,t]of r)e===Yr?n[Yr]=t:e.isConnected&&(n[qr(e)]=t)};document.addEventListener(`scroll`,a,!0),e.subscribe(`onBeforeLoad`,e=>{e.fromLocation&&o(n(e.fromLocation)),r.clear()}),addEventListener(`pagehide`,()=>{o(n(e.stores.resolvedLocation.get()??e.stores.location.get())),Ur()}),e.subscribe(`onRendered`,t=>{let i=e.options.scrollRestorationBehavior,a=e.options.scrollToTopSelectors,o=e.resetNextScroll,s;if(r.clear(),o||(e.resetNextScroll=!0),typeof e.options.scrollRestoration==`function`&&!e.options.scrollRestoration({location:e.latestLocation}))return;let c=n(t.toLocation),l=t.fromLocation&&n(t.fromLocation);if(e.isScrollRestoring&&l&&l!==c){let e=Wr[l];if(e){let t=Wr[c];for(let n in e){if(n===Yr){if(o)continue}else{let e=Xr(n);if(!e||o&&a&&(s??=Zr(a),s.includes(e)))continue}t||=Wr[c]={},t[n]??=e[n]}}}Jr=!0;try{let n=t.toLocation.hash,r=t.toLocation.state.__hashScrollIntoViewOptions??!0,l=!1;if(o){let o=Or.get(t.toLocation),u=n&&r&&(o===`PUSH`||o===`REPLACE`),d=e.isScrollRestoring?Wr[c]:void 0;if(d)for(let e in d){let{scrollX:t,scrollY:n}=d[e];if(e===Yr){if(u)continue;scrollTo({top:n,left:t,behavior:i}),l=!0}else{let r=Xr(e);r&&(r.scrollLeft=t,r.scrollTop=n)}}if(!l&&!n){let e={top:0,left:0,behavior:i};if(scrollTo(e),a){s??=Zr(a);for(let t of s)t.scrollTo(e)}}}!l&&n&&r&&document.getElementById(n)?.scrollIntoView(r)}finally{Jr=!1}})}var $r=`Error preloading route! ☝️`,ei=class{get to(){return this._to}get id(){return this._id}get path(){return this._path}get fullPath(){return this._fullPath}constructor(e){if(this.init=e=>{this.originalIndex=e.originalIndex;let t=this.options,n=!t?.path&&!t?.id;this.parentRoute=this.options.getParentRoute?.(),n?this._path=Bn:this.parentRoute||qt();let r=n?Bn:t?.path;r&&r!==`/`&&(r=Sn(r));let i=t?.id||r,a=n?Bn:bn([this.parentRoute.id===`__root__`?``:this.parentRoute.id,i]);r===`__root__`&&(r=`/`),a!==`__root__`&&(a=bn([`/`,a]));let o=a===`__root__`?`/`:bn([this.parentRoute.fullPath,r]);this._path=r,this._id=a,this._fullPath=o,this._to=Cn(o)},this.addChildren=e=>this._addFileChildren(e),this._addFileChildren=e=>(Array.isArray(e)&&(this.children=e),typeof e==`object`&&e&&(this.children=Object.values(e)),this),this._addFileTypes=()=>this,this.updateLoader=e=>(Object.assign(this.options,e),this),this.update=e=>(Object.assign(this.options,e),this),this.lazy=e=>(this.lazyFn=e,this),this.redirect=e=>Vn({from:this.fullPath,...e}),this.options=e||{},this.isRoot=!e?.getParentRoute,e?.id&&e?.path)throw Error(`Route cannot have both an 'id' and a 'path' option.`)}},ti=class extends ei{constructor(e){super(e)}},ni=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),M=o(((e,t)=>{t.exports=ni()}))();function ri(e){let t=e.errorComponent??ai;return(0,M.jsx)(ii,{getResetKey:e.getResetKey,onCatch:e.onCatch,children:({error:n,reset:r})=>n?j.createElement(t,{error:n,reset:r}):e.children})}var ii=class extends j.Component{constructor(...e){super(...e),this.state={error:null}}static getDerivedStateFromProps(e,t){let n=e.getResetKey();return t.error&&t.resetKey!==n?{resetKey:n,error:null}:{resetKey:n}}static getDerivedStateFromError(e){return{error:e}}reset(){this.setState({error:null})}componentDidCatch(e,t){this.props.onCatch&&this.props.onCatch(e,t)}render(){return this.props.children({error:this.state.error,reset:()=>{this.reset()}})}};function ai({error:e}){let[t,n]=j.useState(!1);return(0,M.jsxs)(`div`,{style:{padding:`.5rem`,maxWidth:`100%`},children:[(0,M.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`.5rem`},children:[(0,M.jsx)(`strong`,{style:{fontSize:`1rem`},children:`Something went wrong!`}),(0,M.jsx)(`button`,{style:{appearance:`none`,fontSize:`.6em`,border:`1px solid currentColor`,padding:`.1rem .2rem`,fontWeight:`bold`,borderRadius:`.25rem`},onClick:()=>n(e=>!e),children:t?`Hide Error`:`Show Error`})]}),(0,M.jsx)(`div`,{style:{height:`.25rem`}}),t?(0,M.jsx)(`div`,{children:(0,M.jsx)(`pre`,{style:{fontSize:`.7em`,border:`1px solid red`,borderRadius:`.25rem`,padding:`.3rem`,color:`red`,overflow:`auto`},children:e.message?(0,M.jsx)(`code`,{children:e.message}):null})}):null]})}function oi({children:e,fallback:t=null}){return si()?(0,M.jsx)(j.Fragment,{children:e}):(0,M.jsx)(j.Fragment,{children:t})}function si(){return j.useSyncExternalStore(ci,()=>!0,()=>!1)}function ci(){return()=>{}}var li=j.createContext(null);function ui(e){return j.useContext(li)}var di=j.createContext(void 0),fi=j.createContext(void 0),pi=(e=>(e[e.None=0]=`None`,e[e.Mutable=1]=`Mutable`,e[e.Watching=2]=`Watching`,e[e.RecursedCheck=4]=`RecursedCheck`,e[e.Recursed=8]=`Recursed`,e[e.Dirty=16]=`Dirty`,e[e.Pending=32]=`Pending`,e))(pi||{});function mi({update:e,notify:t,unwatched:n}){return{link:r,unlink:i,propagate:a,checkDirty:o,shallowPropagate:s};function r(e,t,n){let r=t.depsTail;if(r!==void 0&&r.dep===e)return;let i=r===void 0?t.deps:r.nextDep;if(i!==void 0&&i.dep===e){i.version=n,t.depsTail=i;return}let a=e.subsTail;if(a!==void 0&&a.version===n&&a.sub===t)return;let o=t.depsTail=e.subsTail={version:n,dep:e,sub:t,prevDep:r,nextDep:i,prevSub:a,nextSub:void 0};i!==void 0&&(i.prevDep=o),r===void 0?t.deps=o:r.nextDep=o,a===void 0?e.subs=o:a.nextSub=o}function i(e,t=e.sub){let r=e.dep,i=e.prevDep,a=e.nextDep,o=e.nextSub,s=e.prevSub;return a===void 0?t.depsTail=i:a.prevDep=i,i===void 0?t.deps=a:i.nextDep=a,o===void 0?r.subsTail=s:o.prevSub=s,s===void 0?(r.subs=o)===void 0&&n(r):s.nextSub=o,a}function a(e){let n=e.nextSub,r;top:do{let i=e.sub,a=i.flags;if(a&60?a&12?a&4?!(a&48)&&c(e,i)?(i.flags=a|40,a&=1):a=0:i.flags=a&-9|32:a=0:i.flags=a|32,a&2&&t(i),a&1){let t=i.subs;if(t!==void 0){let i=(e=t).nextSub;i!==void 0&&(r={value:n,prev:r},n=i);continue}}if((e=n)!==void 0){n=e.nextSub;continue}for(;r!==void 0;)if(e=r.value,r=r.prev,e!==void 0){n=e.nextSub;continue top}break}while(!0)}function o(t,n){let r,i=0,a=!1;top:do{let o=t.dep,c=o.flags;if(n.flags&16)a=!0;else if((c&17)==17){if(e(o)){let e=o.subs;e.nextSub!==void 0&&s(e),a=!0}}else if((c&33)==33){(t.nextSub!==void 0||t.prevSub!==void 0)&&(r={value:t,prev:r}),t=o.deps,n=o,++i;continue}if(!a){let e=t.nextDep;if(e!==void 0){t=e;continue}}for(;i--;){let i=n.subs,o=i.nextSub!==void 0;if(o?(t=r.value,r=r.prev):t=i,a){if(e(n)){o&&s(i),n=t.sub;continue}a=!1}else n.flags&=-33;n=t.sub;let c=t.nextDep;if(c!==void 0){t=c;continue top}}return a}while(!0)}function s(e){do{let n=e.sub,r=n.flags;(r&48)==32&&(n.flags=r|16,(r&6)==2&&t(n))}while((e=e.nextSub)!==void 0)}function c(e,t){let n=t.depsTail;for(;n!==void 0;){if(n===e)return!0;n=n.prevDep}return!1}}function hi(e,t,n){let r=typeof e==`object`,i=r?e:void 0;return{next:(r?e.next:e)?.bind(i),error:(r?e.error:t)?.bind(i),complete:(r?e.complete:n)?.bind(i)}}var gi=[],_i=0,{link:vi,unlink:yi,propagate:bi,checkDirty:xi,shallowPropagate:Si}=mi({update(e){return e._update()},notify(e){gi[wi++]=e,e.flags&=~pi.Watching},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=pi.Mutable|pi.Dirty,Oi(e))}}),Ci=0,wi=0,Ti,Ei=0;function Di(e){try{++Ei,e()}finally{--Ei||ki()}}function Oi(e){let t=e.depsTail,n=t===void 0?e.deps:t.nextDep;for(;n!==void 0;)n=yi(n,e)}function ki(){if(!(Ei>0)){for(;Ci<wi;){let e=gi[Ci];gi[Ci++]=void 0,e.notify()}Ci=0,wi=0}}function Ai(e,t){let n=typeof e==`function`,r=e,i={_snapshot:n?void 0:e,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:n?pi.None:pi.Mutable,get(){return Ti!==void 0&&vi(i,Ti,_i),i._snapshot},subscribe(e){let t=hi(e),n={current:!1},r=ji(()=>{i.get(),n.current?t.next?.(i._snapshot):n.current=!0});return{unsubscribe:()=>{r.stop()}}},_update(e){let a=Ti,o=t?.compare??Object.is;if(n)Ti=i,++_i,i.depsTail=void 0;else if(e===void 0)return!1;n&&(i.flags=pi.Mutable|pi.RecursedCheck);try{let t=i._snapshot,a=typeof e==`function`?e(t):e===void 0&&n?r(t):e;return t===void 0||!o(t,a)?(i._snapshot=a,!0):!1}finally{Ti=a,n&&(i.flags&=~pi.RecursedCheck),Oi(i)}}};return n?(i.flags=pi.Mutable|pi.Dirty,i.get=function(){let e=i.flags;if(e&pi.Dirty||e&pi.Pending&&xi(i.deps,i)){if(i._update()){let e=i.subs;e!==void 0&&Si(e)}}else e&pi.Pending&&(i.flags=e&~pi.Pending);return Ti!==void 0&&vi(i,Ti,_i),i._snapshot}):i.set=function(e){if(i._update(e)){let e=i.subs;e!==void 0&&(bi(e),Si(e),ki())}},i}function ji(e){let t=()=>{let t=Ti;Ti=n,++_i,n.depsTail=void 0,n.flags=pi.Watching|pi.RecursedCheck;try{return e()}finally{Ti=t,n.flags&=~pi.RecursedCheck,Oi(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:pi.Watching|pi.RecursedCheck,notify(){let e=this.flags;e&pi.Dirty||e&pi.Pending&&xi(this.deps,this)?t():this.flags=pi.Watching},stop(){this.flags=pi.None,this.depsTail=void 0,Oi(this)}};return t(),n}var Mi=o((e=>{var t=d(),n=at();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),Ni=o(((e,t)=>{t.exports=Mi()}))();function Pi(e,t){return e===t}function Fi(e,t,n=Pi){let r=(0,j.useCallback)(t=>{if(!e)return()=>{};let{unsubscribe:n}=e.subscribe(t);return n},[e]),i=(0,j.useCallback)(()=>e?.get(),[e]);return(0,Ni.useSyncExternalStoreWithSelector)(r,i,i,t,n)}var Ii={get:()=>void 0,subscribe:()=>({unsubscribe:()=>{}})};function Li(e){let t=ui(),n=j.useContext(e.from?fi:di),r=e.from??n,i=r?e.from?t.stores.getRouteMatchStore(r):t.stores.matchStores.get(r):void 0,a=j.useRef(void 0);return Fi(i??Ii,n=>{if((e.shouldThrow??!0)&&!n&&qt(),n===void 0)return;let r=e.select?e.select(n):n;if(e.structuralSharing??t.options.defaultStructuralSharing){let e=Mt(a.current,r);return a.current=e,e}return r})}function Ri(e){return Li({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function zi(e){let{select:t,...n}=e;return Li({...n,select:e=>t?t(e.loaderDeps):e.loaderDeps})}function Bi(e){return Li({from:e.from,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,strict:e.strict,select:t=>{let n=e.strict===!1?t.params:t._strictParams;return e.select?e.select(n):n}})}function Vi(e){return Li({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function Hi(e){let t=ui();return j.useCallback(n=>t.navigate({...n,from:n.from??e?.from}),[e?.from,t])}function Ui(e){let t=ui(),n=Hi(),r=j.useRef(null);return bt(()=>{r.current!==e&&(n(e),r.current=e)},[t,e,n]),null}function Wi(e){return Li({...e,select:t=>e.select?e.select(t.context):t.context})}var Gi=c(h(),1);function Ki(e,t){let n=ui(),r=Ct(t),{activeProps:i,inactiveProps:a,activeOptions:o,to:s,preload:c,preloadDelay:l,preloadIntentProximity:u,hashScrollIntoView:d,replace:f,startTransition:p,resetScroll:m,viewTransition:h,children:g,target:_,disabled:v,style:y,className:b,onClick:x,onBlur:S,onFocus:C,onMouseEnter:w,onMouseLeave:T,onTouchStart:E,ignoreBlocker:D,params:O,search:ee,hash:te,state:ne,mask:re,reloadDocument:ie,unsafeRelative:ae,from:oe,_fromLocation:k,...se}=e,ce=si(),le=j.useMemo(()=>e,[n,e.from,e._fromLocation,e.hash,e.to,e.search,e.params,e.state,e.mask,e.unsafeRelative]),ue=Fi(n.stores.location,e=>e,(e,t)=>e.href===t.href),A=j.useMemo(()=>{let e={_fromLocation:ue,...le};return n.buildLocation(e)},[n,ue,le]),de=A.maskedLocation?A.maskedLocation.publicHref:A.publicHref,fe=A.maskedLocation?A.maskedLocation.external:A.external,pe=j.useMemo(()=>ta(de,fe,n.history,v),[v,fe,de,n.history]),me=j.useMemo(()=>{if(pe?.external)return Ut(pe.href,n.protocolAllowlist)?void 0:pe.href;if(!na(s)&&!(typeof s!=`string`||s.indexOf(`:`)===-1))try{return new URL(s),Ut(s,n.protocolAllowlist)?void 0:s}catch{}},[s,pe,n.protocolAllowlist]),he=j.useMemo(()=>{if(me)return!1;if(o?.exact){if(!En(ue.pathname,A.pathname,n.basepath))return!1}else{let e=Tn(ue.pathname,n.basepath),t=Tn(A.pathname,n.basepath);if(!(e.startsWith(t)&&(e.length===t.length||e[t.length]===`/`)))return!1}return(o?.includeSearch??!0)&&!Lt(ue.search,A.search,{partial:!o?.exact,ignoreUndefined:!o?.explicitUndefined})?!1:o?.includeHash?ce&&ue.hash===A.hash:!0},[o?.exact,o?.explicitUndefined,o?.includeHash,o?.includeSearch,ue,me,ce,A.hash,A.pathname,A.search,n.basepath]),ge=he?Et(i,{})??Ji:qi,_e=he?qi:Et(a,{})??qi,ve=[b,ge.className,_e.className].filter(Boolean).join(` `),ye=(y||ge.style||_e.style)&&{...y,...ge.style,..._e.style},[be,xe]=j.useState(!1),Se=j.useRef(!1),Ce=e.reloadDocument||me?!1:c??n.options.defaultPreload,we=l??n.options.defaultPreloadDelay??0,Te=j.useCallback(()=>{n.preloadRoute({...le,_builtLocation:A}).catch(e=>{console.warn(e),console.warn($r)})},[n,le,A]);St(r,j.useCallback(e=>{e?.isIntersecting&&Te()},[Te]),$i,{disabled:!!v||Ce!==`viewport`}),j.useEffect(()=>{Se.current||!v&&Ce===`render`&&(Te(),Se.current=!0)},[v,Te,Ce]);let Ee=e=>{let t=e.currentTarget.getAttribute(`target`),r=_===void 0?t:_;if(!v&&!ia(e)&&!e.defaultPrevented&&(!r||r===`_self`)&&e.button===0){e.preventDefault(),(0,Gi.flushSync)(()=>{xe(!0)});let t=n.subscribe(`onResolved`,()=>{t(),xe(!1)});n.navigate({...le,replace:f,resetScroll:m,hashScrollIntoView:d,startTransition:p,viewTransition:h,ignoreBlocker:D})}};if(me)return{...se,ref:r,href:me,...g&&{children:g},..._&&{target:_},...v&&{disabled:v},...y&&{style:y},...b&&{className:b},...x&&{onClick:x},...S&&{onBlur:S},...C&&{onFocus:C},...w&&{onMouseEnter:w},...T&&{onMouseLeave:T},...E&&{onTouchStart:E}};let De=e=>{if(v||Ce!==`intent`)return;if(!we){Te();return}let t=e.currentTarget;if(Qi.has(t))return;let n=setTimeout(()=>{Qi.delete(t),Te()},we);Qi.set(t,n)},Oe=e=>{v||Ce!==`intent`||Te()},ke=e=>{if(v||!Ce||!we)return;let t=e.currentTarget,n=Qi.get(t);n&&(clearTimeout(n),Qi.delete(t))};return{...se,...ge,..._e,href:pe?.href,ref:r,onClick:ea([x,Ee]),onBlur:ea([S,ke]),onFocus:ea([C,De]),onMouseEnter:ea([w,De]),onMouseLeave:ea([T,ke]),onTouchStart:ea([E,Oe]),disabled:!!v,target:_,...ye&&{style:ye},...ve&&{className:ve},...v&&Yi,...he&&Xi,...ce&&be&&Zi}}var qi={},Ji={className:`active`},Yi={role:`link`,"aria-disabled":!0},Xi={"data-status":`active`,"aria-current":`page`},Zi={"data-transitioning":`transitioning`},Qi=new WeakMap,$i={rootMargin:`100px`},ea=e=>t=>{for(let n of e)if(n){if(t.defaultPrevented)return;n(t)}};function ta(e,t,n,r){if(!r)return t?{href:e,external:!0}:{href:n.createHref(e)||`/`,external:!1}}function na(e){if(typeof e!=`string`)return!1;let t=e.charCodeAt(0);return t===47?e.charCodeAt(1)!==47:t===46}var ra=j.forwardRef((e,t)=>{let{_asChild:n,...r}=e,{type:i,...a}=Ki(r,t),o=typeof r.children==`function`?r.children({isActive:a[`data-status`]===`active`}):r.children;if(!n){let{disabled:e,...t}=a;return j.createElement(`a`,t,o)}return j.createElement(n,a,o)});function ia(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}var aa=class extends ei{constructor(e){super(e),this.useMatch=e=>Li({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>Wi({...e,from:this.id}),this.useSearch=e=>Vi({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>Bi({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>zi({...e,from:this.id}),this.useLoaderData=e=>Ri({...e,from:this.id}),this.useNavigate=()=>Hi({from:this.fullPath}),this.Link=j.forwardRef((e,t)=>(0,M.jsx)(ra,{ref:t,from:this.fullPath,...e}))}};function oa(e){return new aa(e)}var sa=class extends ti{constructor(e){super(e),this.useMatch=e=>Li({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>Wi({...e,from:this.id}),this.useSearch=e=>Vi({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>Bi({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>zi({...e,from:this.id}),this.useLoaderData=e=>Ri({...e,from:this.id}),this.useNavigate=()=>Hi({from:this.fullPath}),this.Link=j.forwardRef((e,t)=>(0,M.jsx)(ra,{ref:t,from:this.fullPath,...e}))}};function ca(e){return new sa(e)}function la(e){return new ua(e,{silent:!0}).createRoute}var ua=class{constructor(e,t){this.path=e,this.createRoute=e=>{let t=oa(e);return t.isRoot=!1,t},this.silent=t?.silent}};function da(e){let t=ui(),n=`not-found-${Fi(t.stores.location,e=>e.pathname)}-${Fi(t.stores.status,e=>e)}`;return(0,M.jsx)(ri,{getResetKey:()=>n,onCatch:(t,n)=>{if(Mn(t))e.onCatch?.(t,n);else throw t},errorComponent:({error:t})=>{if(Mn(t))return e.fallback?.(t);throw t},children:e.children})}function fa(){return(0,M.jsx)(`p`,{children:`Not Found`})}function pa(e){return(0,M.jsx)(M.Fragment,{children:e.children})}function ma(e,t,n){return t.options.notFoundComponent?(0,M.jsx)(t.options.notFoundComponent,{...n}):e.options.defaultNotFoundComponent?(0,M.jsx)(e.options.defaultNotFoundComponent,{...n}):(0,M.jsx)(fa,{})}var ha=j.memo(function({matchId:e}){let t=ui(),n=t.stores.matchStores.get(e);n||qt();let r=Fi(t.stores.loadedAt,e=>e),i=Fi(n,e=>e);return(0,M.jsx)(ga,{router:t,matchId:e,resetKey:r,matchState:j.useMemo(()=>{let e=i.routeId,n=t.routesById[e].parentRoute?.id;return{routeId:e,ssr:i.ssr,_displayPending:i._displayPending,parentRouteId:n}},[i._displayPending,i.routeId,i.ssr,t.routesById])})});function ga({router:e,matchId:t,resetKey:n,matchState:r}){let i=e.routesById[r.routeId],a=i.options.pendingComponent??e.options.defaultPendingComponent,o=a?(0,M.jsx)(a,{}):null,s=i.options.errorComponent??e.options.defaultErrorComponent,c=i.options.onCatch??e.options.defaultOnCatch,l=i.isRoot?i.options.notFoundComponent??e.options.notFoundRoute?.options.component:i.options.notFoundComponent,u=r.ssr===!1||r.ssr===`data-only`,d=(!i.isRoot||i.options.wrapInSuspense||u)&&(i.options.wrapInSuspense??a??(i.options.errorComponent?.preload||u))?j.Suspense:pa,f=s?ri:pa,p=l?da:pa;return(0,M.jsxs)(i.isRoot?i.options.shellComponent??pa:pa,{children:[(0,M.jsx)(di.Provider,{value:t,children:(0,M.jsx)(d,{fallback:o,children:(0,M.jsx)(f,{getResetKey:()=>n,errorComponent:s||ai,onCatch:(e,t)=>{if(Mn(e))throw e.routeId??=r.routeId,e;c?.(e,t)},children:(0,M.jsx)(p,{fallback:e=>{if(e.routeId??=r.routeId,!l||e.routeId&&e.routeId!==r.routeId||!e.routeId&&!i.isRoot)throw e;return j.createElement(l,e)},children:u||r._displayPending?(0,M.jsx)(oi,{fallback:o,children:(0,M.jsx)(va,{matchId:t})}):(0,M.jsx)(va,{matchId:t})})})})}),r.parentRouteId===`__root__`?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(_a,{resetKey:n}),(e.options.scrollRestoration,null)]}):null]})}function _a({resetKey:e}){let t=ui(),n=j.useRef(void 0);return bt(()=>{let e=t.latestLocation.href;(n.current===void 0||n.current!==e)&&(t.emit({type:`onRendered`,...Dr(t.stores.location.get(),t.stores.resolvedLocation.get())}),n.current=e)},[t.latestLocation.state.__TSR_key,e,t]),null}var va=j.memo(function({matchId:e}){let t=ui(),n=(e,n)=>t.getMatch(e.id)?._nonReactive[n]??e._nonReactive[n],r=t.stores.matchStores.get(e);r||qt();let i=Fi(r,e=>e),a=i.routeId,o=t.routesById[a],s=j.useMemo(()=>{let e=(t.routesById[a].options.remountDeps??t.options.defaultRemountDeps)?.({routeId:a,loaderDeps:i.loaderDeps,params:i._strictParams,search:i._strictSearch});return e?JSON.stringify(e):void 0},[a,i.loaderDeps,i._strictParams,i._strictSearch,t.options.defaultRemountDeps,t.routesById]),c=j.useMemo(()=>{let e=o.options.component??t.options.defaultComponent;return e?(0,M.jsx)(e,{},s):(0,M.jsx)(ya,{})},[s,o.options.component,t.options.defaultComponent]);if(i._displayPending)throw n(i,`displayPendingPromise`);if(i._forcePending)throw n(i,`minPendingPromise`);if(i.status===`pending`){let e=o.options.pendingMinMs??t.options.defaultPendingMinMs;if(e){let n=t.getMatch(i.id);if(n&&!n._nonReactive.minPendingPromise){let t=Rt();n._nonReactive.minPendingPromise=t,setTimeout(()=>{t.resolve(),n._nonReactive.minPendingPromise=void 0},e)}}throw n(i,`loadPromise`)}if(i.status===`notFound`)return Mn(i.error)||qt(),ma(t,o,i.error);if(i.status===`redirected`)throw Hn(i.error)||qt(),n(i,`loadPromise`);if(i.status===`error`)throw i.error;return c}),ya=j.memo(function(){let e=ui(),t=j.useContext(di),n,r=!1,i;{let a=t?e.stores.matchStores.get(t):void 0;[n,r]=Fi(a,e=>[e?.routeId,e?.globalNotFound??!1]),i=Fi(e.stores.matchesId,e=>e[e.findIndex(e=>e===t)+1])}let a=n?e.routesById[n]:void 0,o=e.options.defaultPendingComponent?(0,M.jsx)(e.options.defaultPendingComponent,{}):null;if(r)return a||qt(),ma(e,a,void 0);if(!i)return null;let s=(0,M.jsx)(ha,{matchId:i});return n===`__root__`?(0,M.jsx)(j.Suspense,{fallback:o,children:s}):s});function ba(){let e=ui(),t=j.useRef({router:e,mounted:!1}),[n,r]=j.useState(!1),i=Fi(e.stores.isLoading,e=>e),a=Fi(e.stores.hasPending,e=>e),o=xt(i),s=i||n||a,c=xt(s),l=i||a,u=xt(l);return e.startTransition=e=>{r(!0),j.startTransition(()=>{e(),r(!1)})},j.useEffect(()=>{let t=e.history.subscribe(e.load),n=e.buildLocation({to:e.latestLocation.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});return Cn(e.latestLocation.publicHref)!==Cn(n.publicHref)&&e.commitLocation({...n,replace:!0}),()=>{t()}},[e,e.history]),bt(()=>{typeof window<`u`&&e.ssr||t.current.router===e&&t.current.mounted||(t.current={router:e,mounted:!0},(async()=>{try{await e.load()}catch(e){console.error(e)}})())},[e]),bt(()=>{o&&!i&&e.emit({type:`onLoad`,...Dr(e.stores.location.get(),e.stores.resolvedLocation.get())})},[o,e,i]),bt(()=>{u&&!l&&e.emit({type:`onBeforeRouteMount`,...Dr(e.stores.location.get(),e.stores.resolvedLocation.get())})},[l,u,e]),bt(()=>{if(c&&!s){let t=Dr(e.stores.location.get(),e.stores.resolvedLocation.get());e.emit({type:`onResolved`,...t}),Di(()=>{e.stores.status.set(`idle`),e.stores.resolvedLocation.set(e.stores.location.get())})}},[s,c,e]),null}function xa(){let e=ui(),t=e.routesById.__root__.options.pendingComponent??e.options.defaultPendingComponent,n=t?(0,M.jsx)(t,{}):null,r=(0,M.jsxs)(typeof document<`u`&&e.ssr?pa:j.Suspense,{fallback:n,children:[(0,M.jsx)(ba,{}),(0,M.jsx)(Sa,{})]});return e.options.InnerWrap?(0,M.jsx)(e.options.InnerWrap,{children:r}):r}function Sa(){let e=ui(),t=Fi(e.stores.firstId,e=>e),n=Fi(e.stores.loadedAt,e=>e),r=t?(0,M.jsx)(ha,{matchId:t}):null;return(0,M.jsx)(di.Provider,{value:t,children:e.options.disableGlobalCatchBoundary?r:(0,M.jsx)(ri,{getResetKey:()=>n,errorComponent:ai,onCatch:void 0,children:r})})}var Ca=e=>({createMutableStore:Ai,createReadonlyStore:Ai,batch:Di}),wa=e=>new Ta(e),Ta=class extends kr{constructor(e){super(e,Ca)}};function Ea({router:e,children:t,...n}){kt(n)&&e.update({...e.options,...n,context:{...e.options.context,...n.context}});let r=(0,M.jsx)(li.Provider,{value:e,children:t});return e.options.Wrap?(0,M.jsx)(e.options.Wrap,{children:r}):r}function Da({router:e,...t}){return(0,M.jsx)(Ea,{router:e,...t,children:(0,M.jsx)(xa,{})})}function Oa(e){let t=ui(),n=(0,j.useRef)(void 0);return Fi(t.stores.location,r=>{let i=e?.select?e.select(r):r;if(e?.structuralSharing??t.options.defaultStructuralSharing){let e=Mt(n.current,i);return n.current=e,e}return i})}var ka;function N(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,"_zod",{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,"name",{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,"init",{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}var Aa=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},ja=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(ka=globalThis).__zod_globalConfig??(ka.__zod_globalConfig={});var Ma=globalThis.__zod_globalConfig;function Na(e){return e&&Object.assign(Ma,e),Ma}function Pa(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function Fa(e,t){return typeof t==`bigint`?t.toString():t}function Ia(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}throw Error(`cached value already set`)}}}function La(e){return e==null}function Ra(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function za(e,t){let n=e/t,r=Math.round(n),i=2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}var Ba=Symbol(`evaluating`);function Va(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==Ba)return r===void 0&&(r=Ba,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function Ha(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Ua(...e){let t={};for(let n of e)Object.assign(t,Object.getOwnPropertyDescriptors(n));return Object.defineProperties({},t)}function Wa(e){return JSON.stringify(e)}function Ga(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var Ka=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function qa(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var Ja=Ia(()=>{if(Ma.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function Ya(e){if(qa(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(qa(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function Xa(e){return Ya(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var Za=new Set([`string`,`number`,`symbol`]);function Qa(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function $a(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function P(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function eo(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}var to={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function no(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return $a(e,Ua(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return Ha(this,`shape`,e),e},checks:[]}))}function ro(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return $a(e,Ua(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return Ha(this,`shape`,r),r},checks:[]}))}function io(e,t){if(!Ya(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return $a(e,Ua(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Ha(this,`shape`,n),n}}))}function ao(e,t){if(!Ya(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return $a(e,Ua(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Ha(this,`shape`,n),n}}))}function oo(e,t){if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);return $a(e,Ua(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return Ha(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function so(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return $a(t,Ua(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return Ha(this,`shape`,i),i},checks:[]}))}function co(e,t,n){return $a(t,Ua(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return Ha(this,`shape`,i),i}}))}function lo(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function uo(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function fo(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function po(e){return typeof e==`string`?e:e?.message}function mo(e,t,n){let r=e.message?e.message:po(e.inst?._zod.def?.error?.(e))??po(t?.error?.(e))??po(n.customError?.(e))??po(n.localeError?.(e))??`Invalid input`,{inst:i,continue:a,input:o,...s}=e;return s.path??=[],s.message=r,t?.reportInput&&(s.input=o),s}function ho(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function go(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var _o=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Fa,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},vo=N(`$ZodError`,_o),F=N(`$ZodError`,_o,{Parent:Error});function yo(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function bo(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i];i===e.length-1?(r[n]=r[n]||{_errors:[]},r[n]._errors.push(t(a))):r[n]=r[n]||{_errors:[]},r=r[n],i++}}}};return r(e),n}var xo=e=>(t,n,r,i)=>{let a=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new Aa;if(o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>mo(e,a,Na())));throw Ka(t,i?.callee),t}return o.value},So=xo(F),Co=e=>async(t,n,r,i)=>{let a=r?{...r,async:!0}:{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>mo(e,a,Na())));throw Ka(t,i?.callee),t}return o.value},wo=Co(F),To=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new Aa;return a.issues.length?{success:!1,error:new(e??vo)(a.issues.map(e=>mo(e,i,Na())))}:{success:!0,data:a.value}},Eo=To(F),Do=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>mo(e,i,Na())))}:{success:!0,data:a.value}},Oo=Do(F),ko=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return xo(e)(t,n,i)},Ao=e=>(t,n,r)=>xo(e)(t,n,r),jo=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Co(e)(t,n,i)},Mo=e=>async(t,n,r)=>Co(e)(t,n,r),No=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return To(e)(t,n,i)},Po=e=>(t,n,r)=>To(e)(t,n,r),Fo=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Do(e)(t,n,i)},Io=e=>async(t,n,r)=>Do(e)(t,n,r),Lo=/^[cC][0-9a-z]{6,}$/,Ro=/^[0-9a-z]+$/,zo=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Bo=/^[0-9a-vA-V]{20}$/,Vo=/^[A-Za-z0-9]{27}$/,Ho=/^[a-zA-Z0-9_-]{21}$/,Uo=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Wo=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Go=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Ko=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,qo=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function Jo(){return new RegExp(qo,`u`)}var Yo=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Xo=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Zo=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Qo=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,$o=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,es=/^[A-Za-z0-9_-]*$/,ts=/^https?$/,ns=/^\+[1-9]\d{6,14}$/,rs=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`,is=RegExp(`^${rs}$`);function as(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function os(e){return RegExp(`^${as(e)}$`)}function ss(e){let t=as({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${rs}T(?:${r})$`)}var cs=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},ls=/^-?\d+$/,us=/^-?\d+(?:\.\d+)?$/,ds=/^(?:true|false)$/i,fs=/^null$/i,ps=/^[^A-Z]*$/,ms=/^[^a-z]*$/,hs=N(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),gs={number:`number`,bigint:`bigint`,object:`date`},_s=N(`$ZodCheckLessThan`,(e,t)=>{hs.init(e,t);let n=gs[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),vs=N(`$ZodCheckGreaterThan`,(e,t)=>{hs.init(e,t);let n=gs[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ys=N(`$ZodCheckMultipleOf`,(e,t)=>{hs.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):za(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),bs=N(`$ZodCheckNumberFormat`,(e,t)=>{hs.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=to[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=ls)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),xs=N(`$ZodCheckMaxLength`,(e,t)=>{var n;hs.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!La(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=ho(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Ss=N(`$ZodCheckMinLength`,(e,t)=>{var n;hs.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!La(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=ho(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Cs=N(`$ZodCheckLengthEquals`,(e,t)=>{var n;hs.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!La(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=ho(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),ws=N(`$ZodCheckStringFormat`,(e,t)=>{var n,r;hs.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),Ts=N(`$ZodCheckRegex`,(e,t)=>{ws.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Es=N(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=ps,ws.init(e,t)}),Ds=N(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=ms,ws.init(e,t)}),Os=N(`$ZodCheckIncludes`,(e,t)=>{hs.init(e,t);let n=Qa(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),ks=N(`$ZodCheckStartsWith`,(e,t)=>{hs.init(e,t);let n=RegExp(`^${Qa(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),As=N(`$ZodCheckEndsWith`,(e,t)=>{hs.init(e,t);let n=RegExp(`.*${Qa(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),js=N(`$ZodCheckOverwrite`,(e,t)=>{hs.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),Ms=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
|
|
40
40
|
`).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.args,n=[...(this?.content??[``]).map(e=>` ${e}`)];return new e(...t,n.join(`
|
|
41
41
|
`))}},Ns={major:4,minor:4,patch:3},Ps=N(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Ns;let r=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&r.unshift(e);for(let t of r)for(let n of t._zod.onattach)n(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,n)=>{let r=lo(e),i;for(let a of t){if(a._zod.def.when){if(uo(e)||!a._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&n?.async===!1)throw new Aa;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=lo(e,t))});else{if(e.issues.length===t)continue;r||=lo(e,t)}}return i?i.then(()=>e):e},n=(n,i,a)=>{if(lo(n))return n.aborted=!0,n;let o=t(i,r,a);if(o instanceof Promise){if(a.async===!1)throw new Aa;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction===`backward`){let t=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,i,a)):n(t,i,a)}let o=e._zod.parse(i,a);if(o instanceof Promise){if(a.async===!1)throw new Aa;return o.then(e=>t(e,r,a))}return t(o,r,a)}}Va(e,`~standard`,()=>({validate:t=>{try{let n=Eo(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return Oo(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),Fs=N(`$ZodString`,(e,t)=>{Ps.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??cs(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),Is=N(`$ZodStringFormat`,(e,t)=>{ws.init(e,t),Fs.init(e,t)}),Ls=N(`$ZodGUID`,(e,t)=>{t.pattern??=Wo,Is.init(e,t)}),Rs=N(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=Go(e)}else t.pattern??=Go();Is.init(e,t)}),zs=N(`$ZodEmail`,(e,t)=>{t.pattern??=Ko,Is.init(e,t)}),Bs=N(`$ZodURL`,(e,t)=>{Is.init(e,t),e._zod.check=n=>{try{let r=n.value.trim();if(!t.normalize&&t.protocol?.source===ts.source&&!/^https?:\/\//i.test(r)){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}let i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(`:`)?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=i.href:n.value=r;return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),Vs=N(`$ZodEmoji`,(e,t)=>{t.pattern??=Jo(),Is.init(e,t)}),Hs=N(`$ZodNanoID`,(e,t)=>{t.pattern??=Ho,Is.init(e,t)}),Us=N(`$ZodCUID`,(e,t)=>{t.pattern??=Lo,Is.init(e,t)}),Ws=N(`$ZodCUID2`,(e,t)=>{t.pattern??=Ro,Is.init(e,t)}),Gs=N(`$ZodULID`,(e,t)=>{t.pattern??=zo,Is.init(e,t)}),Ks=N(`$ZodXID`,(e,t)=>{t.pattern??=Bo,Is.init(e,t)}),qs=N(`$ZodKSUID`,(e,t)=>{t.pattern??=Vo,Is.init(e,t)}),Js=N(`$ZodISODateTime`,(e,t)=>{t.pattern??=ss(t),Is.init(e,t)}),Ys=N(`$ZodISODate`,(e,t)=>{t.pattern??=is,Is.init(e,t)}),Xs=N(`$ZodISOTime`,(e,t)=>{t.pattern??=os(t),Is.init(e,t)}),Zs=N(`$ZodISODuration`,(e,t)=>{t.pattern??=Uo,Is.init(e,t)}),Qs=N(`$ZodIPv4`,(e,t)=>{t.pattern??=Yo,Is.init(e,t),e._zod.bag.format=`ipv4`}),$s=N(`$ZodIPv6`,(e,t)=>{t.pattern??=Xo,Is.init(e,t),e._zod.bag.format=`ipv6`,e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}}),ec=N(`$ZodCIDRv4`,(e,t)=>{t.pattern??=Zo,Is.init(e,t)}),tc=N(`$ZodCIDRv6`,(e,t)=>{t.pattern??=Qo,Is.init(e,t),e._zod.check=n=>{let r=n.value.split(`/`);try{if(r.length!==2)throw Error();let[e,t]=r;if(!t)throw Error();let n=Number(t);if(`${n}`!==t||n<0||n>128)throw Error();new URL(`http://[${e}]`)}catch{n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}}});function nc(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var rc=N(`$ZodBase64`,(e,t)=>{t.pattern??=$o,Is.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{nc(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function ic(e){if(!es.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return nc(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var ac=N(`$ZodBase64URL`,(e,t)=>{t.pattern??=es,Is.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{ic(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),oc=N(`$ZodE164`,(e,t)=>{t.pattern??=ns,Is.init(e,t)});function sc(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}var cc=N(`$ZodJWT`,(e,t)=>{Is.init(e,t),e._zod.check=n=>{sc(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),lc=N(`$ZodNumber`,(e,t)=>{Ps.init(e,t),e._zod.pattern=e._zod.bag.pattern??us,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:`Infinity`:void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),uc=N(`$ZodNumberFormat`,(e,t)=>{bs.init(e,t),lc.init(e,t)}),dc=N(`$ZodBoolean`,(e,t)=>{Ps.init(e,t),e._zod.pattern=ds,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),fc=N(`$ZodNull`,(e,t)=>{Ps.init(e,t),e._zod.pattern=fs,e._zod.values=new Set([null]),e._zod.parse=(t,n)=>{let r=t.value;return r===null||t.issues.push({expected:`null`,code:`invalid_type`,input:r,inst:e}),t}}),pc=N(`$ZodAny`,(e,t)=>{Ps.init(e,t),e._zod.parse=e=>e}),mc=N(`$ZodUnknown`,(e,t)=>{Ps.init(e,t),e._zod.parse=e=>e}),hc=N(`$ZodNever`,(e,t)=>{Ps.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)}),gc=N(`$ZodVoid`,(e,t)=>{Ps.init(e,t),e._zod.parse=(t,n)=>{let r=t.value;return r===void 0||t.issues.push({expected:`void`,code:`invalid_type`,input:r,inst:e}),t}}),_c=N(`$ZodDate`,(e,t)=>{Ps.init(e,t),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=new Date(n.value)}catch{}let i=n.value,a=i instanceof Date;return a&&!Number.isNaN(i.getTime())||n.issues.push({expected:`date`,code:`invalid_type`,input:i,...a?{received:`Invalid Date`}:{},inst:e}),n}});function vc(e,t,n){e.issues.length&&t.issues.push(...fo(n,e.issues)),t.value[n]=e.value}var yc=N(`$ZodArray`,(e,t)=>{Ps.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},r);s instanceof Promise?a.push(s.then(t=>vc(t,n,e))):vc(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function bc(e,t,n,r,i,a){let o=n in r;if(e.issues.length){if(i&&a&&!o)return;t.issues.push(...fo(n,e.issues))}if(!o&&!i){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?o&&(t.value[n]=void 0):t.value[n]=e.value}function xc(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let n=eo(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function Sc(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optin===`optional`,d=c.optout===`optional`;for(let i in t){if(i===`__proto__`||s.has(i))continue;if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>bc(e,n,i,t,u,d))):bc(a,n,i,t,u,d)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}var Cc=N(`$ZodObject`,(e,t)=>{if(Ps.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;Object.defineProperty(t,"shape",{get:()=>{let n={...e};return Object.defineProperty(t,"shape",{value:n}),n}})}let n=Ia(()=>xc(t));Va(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(let e of r.values)n[t].add(e)}}return n});let r=qa,i=t.catchall,a;e._zod.parse=(t,o)=>{a??=n.value;let s=t.value;if(!r(s))return t.issues.push({expected:`object`,code:`invalid_type`,input:s,inst:e}),t;t.value={};let c=[],l=a.shape;for(let e of a.keys){let n=l[e],r=n._zod.optin===`optional`,i=n._zod.optout===`optional`,a=n._zod.run({value:s[e],issues:[]},o);a instanceof Promise?c.push(a.then(n=>bc(n,t,e,s,r,i))):bc(a,t,e,s,r,i)}return i?Sc(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),wc=N(`$ZodObjectJIT`,(e,t)=>{Cc.init(e,t);let n=e._zod.parse,r=Ia(()=>xc(t)),i=e=>{let t=new Ms([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=Wa(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write(`const input = payload.value;`);let a=Object.create(null),o=0;for(let e of n.keys)a[e]=`key_${o++}`;t.write(`const newResult = {};`);for(let r of n.keys){let n=a[r],o=Wa(r),s=e[r],c=s?._zod?.optin===`optional`,l=s?._zod?.optout===`optional`;t.write(`const ${n} = ${i(r)};`),c&&l?t.write(`
|
|
42
42
|
if (${n}.issues.length) {
|
|
@@ -99,8 +99,8 @@ The cached manifest will be removed. The app will remain loaded in the running k
|
|
|
99
99
|
|
|
100
100
|
`)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=qa,s=!Ma.jitless,c=s&&Ja.value,l=t.catchall,u;e._zod.parse=(d,f)=>{u??=r.value;let p=d.value;return o(p)?s&&c&&f?.async===!1&&f.jitless!==!0?(a||=i(t.shape),d=a(d,f),l?Sc([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function Tc(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!lo(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>mo(e,r,Na())))}),t)}var Ec=N(`$ZodUnion`,(e,t)=>{Ps.init(e,t),Va(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),Va(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),Va(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),Va(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>Ra(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>Tc(t,r,e,i)):Tc(o,r,e,i)}}),Dc=N(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,Ec.init(e,t);let n=e._zod.parse;Va(e._zod,`propValues`,()=>{let e={};for(let n of t.options){let r=n._zod.propValues;if(!r||Object.keys(r).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(let[t,n]of Object.entries(r)){e[t]||(e[t]=new Set);for(let r of n)e[t].add(r)}}return e});let r=Ia(()=>{let e=t.options,n=new Map;for(let r of e){let e=r._zod.propValues?.[t.discriminator];if(!e||e.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(let t of e){if(n.has(t))throw Error(`Duplicate discriminator value "${String(t)}"`);n.set(t,r)}}return n});e._zod.parse=(i,a)=>{let o=i.value;if(!qa(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=r.value.get(o?.[t.discriminator]);return s?s._zod.run(i,a):t.unionFallback||a.direction===`backward`?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,options:Array.from(r.value.keys()),input:o,path:[t.discriminator],inst:e}),i)}}),Oc=N(`$ZodIntersection`,(e,t)=>{Ps.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>Ac(e,t,n)):Ac(e,i,a)}});function kc(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Ya(e)&&Ya(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=kc(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=kc(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Ac(e,t,n){let r=new Map,i;for(let n of t.issues)if(n.code===`unrecognized_keys`){i??=n;for(let e of n.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(n);for(let t of n.issues)if(t.code===`unrecognized_keys`)for(let e of t.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(t);let a=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push({...i,keys:a}),lo(e))return e;let o=kc(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var jc=N(`$ZodTuple`,(e,t)=>{Ps.init(e,t);let n=t.items;e._zod.parse=(r,i)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({input:a,inst:e,expected:`tuple`,code:`invalid_type`}),r;r.value=[];let o=[],s=Mc(n,`optin`),c=Mc(n,`optout`);if(!t.rest){if(a.length<s)return r.issues.push({code:`too_small`,minimum:s,inclusive:!0,input:a,inst:e,origin:`array`}),r;a.length>n.length&&r.issues.push({code:`too_big`,maximum:n.length,inclusive:!0,input:a,inst:e,origin:`array`})}let l=Array(n.length);for(let e=0;e<n.length;e++){let t=n[e]._zod.run({value:a[e],issues:[]},i);t instanceof Promise?o.push(t.then(t=>{l[e]=t})):l[e]=t}if(t.rest){let e=n.length-1,s=a.slice(n.length);for(let n of s){e++;let a=t.rest._zod.run({value:n,issues:[]},i);a instanceof Promise?o.push(a.then(t=>Nc(t,r,e))):Nc(a,r,e)}}return o.length?Promise.all(o).then(()=>Pc(l,r,n,a,c)):Pc(l,r,n,a,c)}});function Mc(e,t){for(let n=e.length-1;n>=0;n--)if(e[n]._zod[t]!==`optional`)return n+1;return 0}function Nc(e,t,n){e.issues.length&&t.issues.push(...fo(n,e.issues)),t.value[n]=e.value}function Pc(e,t,n,r,i){for(let a=0;a<n.length;a++){let n=e[a],o=a<r.length;if(n.issues.length){if(!o&&a>=i){t.value.length=a;break}t.issues.push(...fo(a,n.issues))}t.value[a]=n.value}for(let e=t.value.length-1;e>=r.length&&n[e]._zod.optout===`optional`&&t.value[e]===void 0;e--)t.value.length=e;return t}var Fc=N(`$ZodRecord`,(e,t)=>{Ps.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Ya(i))return n.issues.push({expected:`record`,code:`invalid_type`,input:i,inst:e}),n;let a=[],o=t.keyType._zod.values;if(o){n.value={};let s=new Set;for(let c of o)if(typeof c==`string`||typeof c==`number`||typeof c==`symbol`){s.add(typeof c==`number`?c.toString():c);let o=t.keyType._zod.run({value:c,issues:[]},r);if(o instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(o.issues.length){n.issues.push({code:`invalid_key`,origin:`record`,issues:o.issues.map(e=>mo(e,r,Na())),input:c,path:[c],inst:e});continue}let l=o.value,u=t.valueType._zod.run({value:i[c],issues:[]},r);u instanceof Promise?a.push(u.then(e=>{e.issues.length&&n.issues.push(...fo(c,e.issues)),n.value[l]=e.value})):(u.issues.length&&n.issues.push(...fo(c,u.issues)),n.value[l]=u.value)}let c;for(let e in i)s.has(e)||(c??=[],c.push(e));c&&c.length>0&&n.issues.push({code:`unrecognized_keys`,input:i,inst:e,keys:c})}else{n.value={};for(let o of Reflect.ownKeys(i)){if(o===`__proto__`||!Object.prototype.propertyIsEnumerable.call(i,o))continue;let s=t.keyType._zod.run({value:o,issues:[]},r);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof o==`string`&&us.test(o)&&s.issues.length){let e=t.keyType._zod.run({value:Number(o),issues:[]},r);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(s=e)}if(s.issues.length){t.mode===`loose`?n.value[o]=i[o]:n.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>mo(e,r,Na())),input:o,path:[o],inst:e});continue}let c=t.valueType._zod.run({value:i[o],issues:[]},r);c instanceof Promise?a.push(c.then(e=>{e.issues.length&&n.issues.push(...fo(o,e.issues)),n.value[s.value]=e.value})):(c.issues.length&&n.issues.push(...fo(o,c.issues)),n.value[s.value]=c.value)}}return a.length?Promise.all(a).then(()=>n):n}}),Ic=N(`$ZodEnum`,(e,t)=>{Ps.init(e,t);let n=Pa(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>Za.has(typeof e)).map(e=>typeof e==`string`?Qa(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),Lc=N(`$ZodLiteral`,(e,t)=>{if(Ps.init(e,t),t.values.length===0)throw Error(`Cannot create literal schema with no valid values`);let n=new Set(t.values);e._zod.values=n,e._zod.pattern=RegExp(`^(${t.values.map(e=>typeof e==`string`?Qa(e):e?Qa(e.toString()):String(e)).join(`|`)})$`),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),Rc=N(`$ZodTransform`,(e,t)=>{Ps.init(e,t),e._zod.optin=`optional`,e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new ja(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n.fallback=!0,n));if(i instanceof Promise)throw new Aa;return n.value=i,n.fallback=!0,n}});function zc(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}var Bc=N(`$ZodOptional`,(e,t)=>{Ps.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,Va(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Va(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${Ra(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=e.value,i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then(e=>zc(e,r)):zc(i,r)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),Vc=N(`$ZodExactOptional`,(e,t)=>{Bc.init(e,t),Va(e._zod,`values`,()=>t.innerType._zod.values),Va(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Hc=N(`$ZodNullable`,(e,t)=>{Ps.init(e,t),Va(e._zod,`optin`,()=>t.innerType._zod.optin),Va(e._zod,`optout`,()=>t.innerType._zod.optout),Va(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${Ra(e.source)}|null)$`):void 0}),Va(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),Uc=N(`$ZodDefault`,(e,t)=>{Ps.init(e,t),e._zod.optin=`optional`,Va(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>Wc(e,t)):Wc(r,t)}});function Wc(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var Gc=N(`$ZodPrefault`,(e,t)=>{Ps.init(e,t),e._zod.optin=`optional`,Va(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),Kc=N(`$ZodNonOptional`,(e,t)=>{Ps.init(e,t),Va(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>qc(t,e)):qc(i,e)}});function qc(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}var Jc=N(`$ZodCatch`,(e,t)=>{Ps.init(e,t),e._zod.optin=`optional`,Va(e._zod,`optout`,()=>t.innerType._zod.optout),Va(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>mo(e,n,Na()))},input:e.value}),e.issues=[],e.fallback=!0),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>mo(e,n,Na()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),Yc=N(`$ZodPipe`,(e,t)=>{Ps.init(e,t),Va(e._zod,`values`,()=>t.in._zod.values),Va(e._zod,`optin`,()=>t.in._zod.optin),Va(e._zod,`optout`,()=>t.out._zod.optout),Va(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>Xc(e,t.in,n)):Xc(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Xc(e,t.out,n)):Xc(r,t.out,n)}});function Xc(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}var Zc=N(`$ZodReadonly`,(e,t)=>{Ps.init(e,t),Va(e._zod,`propValues`,()=>t.innerType._zod.propValues),Va(e._zod,`values`,()=>t.innerType._zod.values),Va(e._zod,`optin`,()=>t.innerType?._zod?.optin),Va(e._zod,`optout`,()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(Qc):Qc(r)}});function Qc(e){return e.value=Object.freeze(e.value),e}var $c=N(`$ZodFunction`,(e,t)=>(Ps.init(e,t),e._def=t,e._zod.def=t,e.implement=t=>{if(typeof t!=`function`)throw Error(`implement() must be called with a function`);return function(...n){let r=e._def.input?So(e._def.input,n):n,i=Reflect.apply(t,this,r);return e._def.output?So(e._def.output,i):i}},e.implementAsync=t=>{if(typeof t!=`function`)throw Error(`implementAsync() must be called with a function`);return async function(...n){let r=e._def.input?await wo(e._def.input,n):n,i=await Reflect.apply(t,this,r);return e._def.output?await wo(e._def.output,i):i}},e._zod.parse=(t,n)=>typeof t.value==`function`?(e._def.output&&e._def.output._zod.def.type===`promise`?t.value=e.implementAsync(t.value):t.value=e.implement(t.value),t):(t.issues.push({code:`invalid_type`,expected:`function`,input:t.value,inst:e}),t),e.input=(...t)=>{let n=e.constructor;return Array.isArray(t[0])?new n({type:`function`,input:new jc({type:`tuple`,items:t[0],rest:t[1]}),output:e._def.output}):new n({type:`function`,input:t[0],output:e._def.output})},e.output=t=>{let n=e.constructor;return new n({type:`function`,input:e._def.input,output:t})},e)),el=N(`$ZodPromise`,(e,t)=>{Ps.init(e,t),e._zod.parse=(e,n)=>Promise.resolve(e.value).then(e=>t.innerType._zod.run({value:e,issues:[]},n))}),tl=N(`$ZodLazy`,(e,t)=>{Ps.init(e,t),Va(e._zod,`innerType`,()=>{let e=t;return e._cachedInner||=t.getter(),e._cachedInner}),Va(e._zod,`pattern`,()=>e._zod.innerType?._zod?.pattern),Va(e._zod,`propValues`,()=>e._zod.innerType?._zod?.propValues),Va(e._zod,`optin`,()=>e._zod.innerType?._zod?.optin??void 0),Va(e._zod,`optout`,()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(t,n)=>e._zod.innerType._zod.run(t,n)}),nl=N(`$ZodCustom`,(e,t)=>{hs.init(e,t),Ps.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>rl(t,n,r,e));rl(i,n,r,e)}});function rl(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(go(e))}}var il,al=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function ol(){return new al}(il=globalThis).__zod_globalRegistry??(il.__zod_globalRegistry=ol());var sl=globalThis.__zod_globalRegistry;function cl(e,t){return new e({type:`string`,...P(t)})}function ll(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...P(t)})}function ul(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...P(t)})}function dl(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...P(t)})}function fl(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...P(t)})}function pl(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...P(t)})}function ml(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...P(t)})}function hl(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...P(t)})}function gl(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...P(t)})}function _l(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...P(t)})}function vl(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...P(t)})}function yl(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...P(t)})}function bl(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...P(t)})}function xl(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...P(t)})}function Sl(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...P(t)})}function Cl(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...P(t)})}function wl(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...P(t)})}function Tl(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...P(t)})}function El(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...P(t)})}function Dl(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...P(t)})}function Ol(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...P(t)})}function kl(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...P(t)})}function Al(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...P(t)})}function jl(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...P(t)})}function Ml(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...P(t)})}function Nl(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...P(t)})}function Pl(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...P(t)})}function Fl(e,t){return new e({type:`number`,checks:[],...P(t)})}function Il(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...P(t)})}function Ll(e,t){return new e({type:`boolean`,...P(t)})}function Rl(e,t){return new e({type:`null`,...P(t)})}function zl(e){return new e({type:`any`})}function Bl(e){return new e({type:`unknown`})}function Vl(e,t){return new e({type:`never`,...P(t)})}function Hl(e,t){return new e({type:`void`,...P(t)})}function Ul(e,t){return new e({type:`date`,...P(t)})}function Wl(e,t){return new _s({check:`less_than`,...P(t),value:e,inclusive:!1})}function Gl(e,t){return new _s({check:`less_than`,...P(t),value:e,inclusive:!0})}function Kl(e,t){return new vs({check:`greater_than`,...P(t),value:e,inclusive:!1})}function ql(e,t){return new vs({check:`greater_than`,...P(t),value:e,inclusive:!0})}function Jl(e,t){return new ys({check:`multiple_of`,...P(t),value:e})}function Yl(e,t){return new xs({check:`max_length`,...P(t),maximum:e})}function Xl(e,t){return new Ss({check:`min_length`,...P(t),minimum:e})}function Zl(e,t){return new Cs({check:`length_equals`,...P(t),length:e})}function Ql(e,t){return new Ts({check:`string_format`,format:`regex`,...P(t),pattern:e})}function $l(e){return new Es({check:`string_format`,format:`lowercase`,...P(e)})}function eu(e){return new Ds({check:`string_format`,format:`uppercase`,...P(e)})}function tu(e,t){return new Os({check:`string_format`,format:`includes`,...P(t),includes:e})}function nu(e,t){return new ks({check:`string_format`,format:`starts_with`,...P(t),prefix:e})}function ru(e,t){return new As({check:`string_format`,format:`ends_with`,...P(t),suffix:e})}function iu(e){return new js({check:`overwrite`,tx:e})}function au(e){return iu(t=>t.normalize(e))}function ou(){return iu(e=>e.trim())}function su(){return iu(e=>e.toLowerCase())}function cu(){return iu(e=>e.toUpperCase())}function lu(){return iu(e=>Ga(e))}function uu(e,t,n){return new e({type:`array`,element:t,...P(n)})}function du(e,t,n){let r=P(n);return r.abort??=!0,new e({type:`custom`,check:`custom`,fn:t,...r})}function fu(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...P(n)})}function pu(e,t){let n=mu(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(go(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=t.value,r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(go(r))}},e(t.value,t)),t);return n}function mu(e,t){let n=new hs({check:`custom`,...P(t)});return n._zod.check=e,n}function hu(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??sl,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,external:e?.external??void 0}}function gu(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,gu(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),t.io===`input`&&yu(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function _u(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${a}`}}if(t[1]===n)return{ref:`#`};let i=`#/${r}/`,a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+a}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
|
|
101
101
|
|
|
102
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function vu(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e===`$ref`||e===`allOf`||e in a||delete i[e];if(s.$ref&&n.def)for(let e in i)e===`$ref`||e===`allOf`||e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e===`$ref`||e===`allOf`||e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:xu(t,`input`,e.processors),output:xu(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function yu(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return yu(r.element,n);if(r.type===`set`)return yu(r.valueType,n);if(r.type===`lazy`)return yu(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type===`default`||r.type===`prefault`)return yu(r.innerType,n);if(r.type===`intersection`)return yu(r.left,n)||yu(r.right,n);if(r.type===`record`||r.type===`map`)return yu(r.keyType,n)||yu(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:yu(r.in,n)||yu(r.out,n);if(r.type===`object`){for(let e in r.shape)if(yu(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(yu(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(yu(e,n))return!0;return!!(r.rest&&yu(r.rest,n))}return!1}var bu=(e,t={})=>n=>{let r=hu({...n,processors:t});return gu(e,r),_u(r,e),vu(r,e)},xu=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=hu({...i??{},target:a,io:t,processors:n});return gu(e,o),_u(o,e),vu(o,e)},Su={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},Cu=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=Su[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},wu=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;typeof s==`string`&&s.includes(`int`)?i.type=`integer`:i.type=`number`;let d=typeof u==`number`&&u>=(a??-1/0),f=typeof l==`number`&&l<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;d?p?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l:typeof o==`number`&&(i.maximum=o),typeof c==`number`&&(i.multipleOf=c)},Tu=(e,t,n,r)=>{n.type=`boolean`},Eu=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},Du=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Void cannot be represented in JSON Schema`)},Ou=(e,t,n,r)=>{n.not={}},ku=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Date cannot be represented in JSON Schema`)},Au=(e,t,n,r)=>{let i=e._zod.def,a=Pa(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},ju=(e,t,n,r)=>{let i=e._zod.def,a=[];for(let e of i.values)if(e===void 0){if(t.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(t.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);a.push(Number(e))}else a.push(e);if(a.length!==0)if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a},Mu=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},Nu=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Function types cannot be represented in JSON Schema`)},Pu=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},Fu=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=gu(a.element,t,{...r,path:[...r.path,`items`]})},Iu=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=gu(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=gu(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Lu=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>gu(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Ru=(e,t,n,r)=>{let i=e._zod.def,a=gu(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=gu(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},zu=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`array`;let o=t.target===`draft-2020-12`?`prefixItems`:`items`,s=t.target===`draft-2020-12`||t.target===`openapi-3.0`?`items`:`additionalItems`,c=a.items.map((e,n)=>gu(e,t,{...r,path:[...r.path,o,n]})),l=a.rest?gu(a.rest,t,{...r,path:[...r.path,s,...t.target===`openapi-3.0`?[a.items.length]:[]]}):null;t.target===`draft-2020-12`?(i.prefixItems=c,l&&(i.items=l)):t.target===`openapi-3.0`?(i.items={anyOf:c},l&&i.items.anyOf.push(l),i.minItems=c.length,l||(i.maxItems=c.length)):(i.items=c,l&&(i.additionalItems=l));let{minimum:u,maximum:d}=e._zod.bag;typeof u==`number`&&(i.minItems=u),typeof d==`number`&&(i.maxItems=d)},Bu=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=o._zod.bag?.patterns;if(a.mode===`loose`&&s&&s.size>0){let e=gu(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)i.patternProperties[t.source]=e}else (t.target===`draft-07`||t.target===`draft-2020-12`)&&(i.propertyNames=gu(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=gu(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]});let c=o._zod.values;if(c){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e)}},Vu=(e,t,n,r)=>{let i=e._zod.def,a=gu(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},Hu=(e,t,n,r)=>{let i=e._zod.def;gu(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Uu=(e,t,n,r)=>{let i=e._zod.def;gu(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},Wu=(e,t,n,r)=>{let i=e._zod.def;gu(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},Gu=(e,t,n,r)=>{let i=e._zod.def;gu(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},Ku=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;gu(o,t,r);let s=t.seen.get(e);s.ref=o},qu=(e,t,n,r)=>{let i=e._zod.def;gu(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Ju=(e,t,n,r)=>{let i=e._zod.def;gu(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Yu=(e,t,n,r)=>{let i=e._zod.def;gu(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Xu=(e,t,n,r)=>{let i=e._zod.innerType;gu(i,t,r);let a=t.seen.get(e);a.ref=i},Zu=N(`ZodISODateTime`,(e,t)=>{Js.init(e,t),Cd.init(e,t)});function Qu(e){return jl(Zu,e)}var $u=N(`ZodISODate`,(e,t)=>{Ys.init(e,t),Cd.init(e,t)});function ed(e){return Ml($u,e)}var td=N(`ZodISOTime`,(e,t)=>{Xs.init(e,t),Cd.init(e,t)});function nd(e){return Nl(td,e)}var rd=N(`ZodISODuration`,(e,t)=>{Zs.init(e,t),Cd.init(e,t)});function id(e){return Pl(rd,e)}var ad=N(`ZodError`,(e,t)=>{vo.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>bo(e,t)},flatten:{value:t=>yo(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,Fa,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,Fa,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),od=xo(ad),sd=Co(ad),cd=To(ad),ld=Do(ad),ud=ko(ad),dd=Ao(ad),fd=jo(ad),pd=Mo(ad),md=No(ad),hd=Po(ad),gd=Fo(ad),_d=Io(ad),vd=new WeakMap;function yd(e,t,n){let r=Object.getPrototypeOf(e),i=vd.get(r);if(i||(i=new Set,vd.set(r,i)),!i.has(t)){i.add(t);for(let e in n){let t=n[e];Object.defineProperty(r,e,{configurable:!0,enumerable:!1,get(){let n=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:n}),n},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}}var bd=N(`ZodType`,(e,t)=>(Ps.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:xu(e,`input`),output:xu(e,`output`)}}),e.toJSONSchema=bu(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,n)=>od(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>cd(e,t,n),e.parseAsync=async(t,n)=>sd(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>ld(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>ud(e,t,n),e.decode=(t,n)=>dd(e,t,n),e.encodeAsync=async(t,n)=>fd(e,t,n),e.decodeAsync=async(t,n)=>pd(e,t,n),e.safeEncode=(t,n)=>md(e,t,n),e.safeDecode=(t,n)=>hd(e,t,n),e.safeEncodeAsync=async(t,n)=>gd(e,t,n),e.safeDecodeAsync=async(t,n)=>_d(e,t,n),yd(e,`ZodType`,{check(...e){let t=this.def;return this.clone(Ua(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return $a(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Gf(e,t))},superRefine(e,t){return this.check(Kf(e,t))},overwrite(e){return this.check(iu(e))},optional(){return bf(this)},exactOptional(){return Sf(this)},nullable(){return wf(this)},nullish(){return bf(wf(this))},nonoptional(e){return Af(this,e)},array(){return B(this)},or(e){return H([this,e])},and(e){return df(this,e)},transform(e){return Pf(this,vf(e))},default(e){return Ef(this,e)},prefault(e){return Of(this,e)},catch(e){return Mf(this,e)},pipe(e){return Pf(this,e)},readonly(){return If(this)},describe(e){let t=this.clone();return sl.add(t,{description:e}),t},meta(...e){if(e.length===0)return sl.get(this);let t=this.clone();return sl.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,"description",{get(){return sl.get(e)?.description},configurable:!0}),e)),xd=N(`_ZodString`,(e,t)=>{Fs.init(e,t),bd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Cu(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,yd(e,`_ZodString`,{regex(...e){return this.check(Ql(...e))},includes(...e){return this.check(tu(...e))},startsWith(...e){return this.check(nu(...e))},endsWith(...e){return this.check(ru(...e))},min(...e){return this.check(Xl(...e))},max(...e){return this.check(Yl(...e))},length(...e){return this.check(Zl(...e))},nonempty(...e){return this.check(Xl(1,...e))},lowercase(e){return this.check($l(e))},uppercase(e){return this.check(eu(e))},trim(){return this.check(ou())},normalize(...e){return this.check(au(...e))},toLowerCase(){return this.check(su())},toUpperCase(){return this.check(cu())},slugify(){return this.check(lu())}})}),Sd=N(`ZodString`,(e,t)=>{Fs.init(e,t),xd.init(e,t),e.email=t=>e.check(ll(wd,t)),e.url=t=>e.check(hl(Dd,t)),e.jwt=t=>e.check(Al(Hd,t)),e.emoji=t=>e.check(gl(Od,t)),e.guid=t=>e.check(ul(Td,t)),e.uuid=t=>e.check(dl(Ed,t)),e.uuidv4=t=>e.check(fl(Ed,t)),e.uuidv6=t=>e.check(pl(Ed,t)),e.uuidv7=t=>e.check(ml(Ed,t)),e.nanoid=t=>e.check(_l(kd,t)),e.guid=t=>e.check(ul(Td,t)),e.cuid=t=>e.check(vl(Ad,t)),e.cuid2=t=>e.check(yl(jd,t)),e.ulid=t=>e.check(bl(Md,t)),e.base64=t=>e.check(Dl(zd,t)),e.base64url=t=>e.check(Ol(Bd,t)),e.xid=t=>e.check(xl(Nd,t)),e.ksuid=t=>e.check(Sl(Pd,t)),e.ipv4=t=>e.check(Cl(Fd,t)),e.ipv6=t=>e.check(wl(Id,t)),e.cidrv4=t=>e.check(Tl(Ld,t)),e.cidrv6=t=>e.check(El(Rd,t)),e.e164=t=>e.check(kl(Vd,t)),e.datetime=t=>e.check(Qu(t)),e.date=t=>e.check(ed(t)),e.time=t=>e.check(nd(t)),e.duration=t=>e.check(id(t))});function I(e){return cl(Sd,e)}var Cd=N(`ZodStringFormat`,(e,t)=>{Is.init(e,t),xd.init(e,t)}),wd=N(`ZodEmail`,(e,t)=>{zs.init(e,t),Cd.init(e,t)}),Td=N(`ZodGUID`,(e,t)=>{Ls.init(e,t),Cd.init(e,t)}),Ed=N(`ZodUUID`,(e,t)=>{Rs.init(e,t),Cd.init(e,t)}),Dd=N(`ZodURL`,(e,t)=>{Bs.init(e,t),Cd.init(e,t)}),Od=N(`ZodEmoji`,(e,t)=>{Vs.init(e,t),Cd.init(e,t)}),kd=N(`ZodNanoID`,(e,t)=>{Hs.init(e,t),Cd.init(e,t)}),Ad=N(`ZodCUID`,(e,t)=>{Us.init(e,t),Cd.init(e,t)}),jd=N(`ZodCUID2`,(e,t)=>{Ws.init(e,t),Cd.init(e,t)}),Md=N(`ZodULID`,(e,t)=>{Gs.init(e,t),Cd.init(e,t)}),Nd=N(`ZodXID`,(e,t)=>{Ks.init(e,t),Cd.init(e,t)}),Pd=N(`ZodKSUID`,(e,t)=>{qs.init(e,t),Cd.init(e,t)}),Fd=N(`ZodIPv4`,(e,t)=>{Qs.init(e,t),Cd.init(e,t)}),Id=N(`ZodIPv6`,(e,t)=>{$s.init(e,t),Cd.init(e,t)}),Ld=N(`ZodCIDRv4`,(e,t)=>{ec.init(e,t),Cd.init(e,t)}),Rd=N(`ZodCIDRv6`,(e,t)=>{tc.init(e,t),Cd.init(e,t)}),zd=N(`ZodBase64`,(e,t)=>{rc.init(e,t),Cd.init(e,t)}),Bd=N(`ZodBase64URL`,(e,t)=>{ac.init(e,t),Cd.init(e,t)}),Vd=N(`ZodE164`,(e,t)=>{oc.init(e,t),Cd.init(e,t)}),Hd=N(`ZodJWT`,(e,t)=>{cc.init(e,t),Cd.init(e,t)}),Ud=N(`ZodNumber`,(e,t)=>{lc.init(e,t),bd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wu(e,t,n,r),yd(e,`ZodNumber`,{gt(e,t){return this.check(Kl(e,t))},gte(e,t){return this.check(ql(e,t))},min(e,t){return this.check(ql(e,t))},lt(e,t){return this.check(Wl(e,t))},lte(e,t){return this.check(Gl(e,t))},max(e,t){return this.check(Gl(e,t))},int(e){return this.check(Gd(e))},safe(e){return this.check(Gd(e))},positive(e){return this.check(Kl(0,e))},nonnegative(e){return this.check(ql(0,e))},negative(e){return this.check(Wl(0,e))},nonpositive(e){return this.check(Gl(0,e))},multipleOf(e,t){return this.check(Jl(e,t))},step(e,t){return this.check(Jl(e,t))},finite(){return this}});let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function L(e){return Fl(Ud,e)}var Wd=N(`ZodNumberFormat`,(e,t)=>{uc.init(e,t),Ud.init(e,t)});function Gd(e){return Il(Wd,e)}var Kd=N(`ZodBoolean`,(e,t)=>{dc.init(e,t),bd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Tu(e,t,n,r)});function R(e){return Ll(Kd,e)}var qd=N(`ZodNull`,(e,t)=>{fc.init(e,t),bd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Eu(e,t,n,r)});function Jd(e){return Rl(qd,e)}var Yd=N(`ZodAny`,(e,t)=>{pc.init(e,t),bd.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Xd(){return zl(Yd)}var Zd=N(`ZodUnknown`,(e,t)=>{mc.init(e,t),bd.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function z(){return Bl(Zd)}var Qd=N(`ZodNever`,(e,t)=>{hc.init(e,t),bd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ou(e,t,n,r)});function $d(e){return Vl(Qd,e)}var ef=N(`ZodVoid`,(e,t)=>{gc.init(e,t),bd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Du(e,t,n,r)});function tf(e){return Hl(ef,e)}var nf=N(`ZodDate`,(e,t)=>{_c.init(e,t),bd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ku(e,t,n,r),e.min=(t,n)=>e.check(ql(t,n)),e.max=(t,n)=>e.check(Gl(t,n));let n=e._zod.bag;e.minDate=n.minimum?new Date(n.minimum):null,e.maxDate=n.maximum?new Date(n.maximum):null});function rf(e){return Ul(nf,e)}var af=N(`ZodArray`,(e,t)=>{yc.init(e,t),bd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fu(e,t,n,r),e.element=t.element,yd(e,`ZodArray`,{min(e,t){return this.check(Xl(e,t))},nonempty(e){return this.check(Xl(1,e))},max(e,t){return this.check(Yl(e,t))},length(e,t){return this.check(Zl(e,t))},unwrap(){return this.element}})});function B(e,t){return uu(af,e,t)}var of=N(`ZodObject`,(e,t)=>{wc.init(e,t),bd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Iu(e,t,n,r),Va(e,`shape`,()=>t.shape),yd(e,`ZodObject`,{keyof(){return W(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:z()})},loose(){return this.clone({...this._zod.def,catchall:z()})},strict(){return this.clone({...this._zod.def,catchall:$d()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return io(this,e)},safeExtend(e){return ao(this,e)},merge(e){return oo(this,e)},pick(e){return no(this,e)},omit(e){return ro(this,e)},partial(...e){return so(yf,this,e[0])},required(...e){return co(kf,this,e[0])}})});function V(e,t){return new of({type:`object`,shape:e??{},...P(t)})}var sf=N(`ZodUnion`,(e,t)=>{Ec.init(e,t),bd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Lu(e,t,n,r),e.options=t.options});function H(e,t){return new sf({type:`union`,options:e,...P(t)})}var cf=N(`ZodDiscriminatedUnion`,(e,t)=>{sf.init(e,t),Dc.init(e,t)});function lf(e,t,n){return new cf({type:`union`,options:t,discriminator:e,...P(n)})}var uf=N(`ZodIntersection`,(e,t)=>{Oc.init(e,t),bd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ru(e,t,n,r)});function df(e,t){return new uf({type:`intersection`,left:e,right:t})}var ff=N(`ZodTuple`,(e,t)=>{jc.init(e,t),bd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>zu(e,t,n,r),e.rest=t=>e.clone({...e._zod.def,rest:t})});function pf(e,t,n){let r=t instanceof Ps;return new ff({type:`tuple`,items:e,rest:r?t:null,...P(r?n:t)})}var mf=N(`ZodRecord`,(e,t)=>{Fc.init(e,t),bd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Bu(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function U(e,t,n){return!t||!t._zod?new mf({type:`record`,keyType:I(),valueType:e,...P(t)}):new mf({type:`record`,keyType:e,valueType:t,...P(n)})}var hf=N(`ZodEnum`,(e,t)=>{Ic.init(e,t),bd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Au(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new hf({...t,checks:[],...P(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new hf({...t,checks:[],...P(r),entries:i})}});function W(e,t){return new hf({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...P(t)})}var gf=N(`ZodLiteral`,(e,t)=>{Lc.init(e,t),bd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ju(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function G(e,t){return new gf({type:`literal`,values:Array.isArray(e)?e:[e],...P(t)})}var _f=N(`ZodTransform`,(e,t)=>{Rc.init(e,t),bd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Pu(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new ja(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(go(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(go(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n.fallback=!0,n)):(n.value=i,n.fallback=!0,n)}});function vf(e){return new _f({type:`transform`,transform:e})}var yf=N(`ZodOptional`,(e,t)=>{Bc.init(e,t),bd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Yu(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function bf(e){return new yf({type:`optional`,innerType:e})}var xf=N(`ZodExactOptional`,(e,t)=>{Vc.init(e,t),bd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Yu(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Sf(e){return new xf({type:`optional`,innerType:e})}var Cf=N(`ZodNullable`,(e,t)=>{Hc.init(e,t),bd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Vu(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function wf(e){return new Cf({type:`nullable`,innerType:e})}var Tf=N(`ZodDefault`,(e,t)=>{Uc.init(e,t),bd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Uu(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Ef(e,t){return new Tf({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():Xa(t)}})}var Df=N(`ZodPrefault`,(e,t)=>{Gc.init(e,t),bd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Wu(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Of(e,t){return new Df({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():Xa(t)}})}var kf=N(`ZodNonOptional`,(e,t)=>{Kc.init(e,t),bd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Hu(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Af(e,t){return new kf({type:`nonoptional`,innerType:e,...P(t)})}var jf=N(`ZodCatch`,(e,t)=>{Jc.init(e,t),bd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Gu(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Mf(e,t){return new jf({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var Nf=N(`ZodPipe`,(e,t)=>{Yc.init(e,t),bd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ku(e,t,n,r),e.in=t.in,e.out=t.out});function Pf(e,t){return new Nf({type:`pipe`,in:e,out:t})}var Ff=N(`ZodReadonly`,(e,t)=>{Zc.init(e,t),bd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qu(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function If(e){return new Ff({type:`readonly`,innerType:e})}var Lf=N(`ZodLazy`,(e,t)=>{tl.init(e,t),bd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xu(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function Rf(e){return new Lf({type:`lazy`,getter:e})}var zf=N(`ZodPromise`,(e,t)=>{el.init(e,t),bd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ju(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Bf(e){return new zf({type:`promise`,innerType:e})}var Vf=N(`ZodFunction`,(e,t)=>{$c.init(e,t),bd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Nu(e,t,n,r)});function Hf(e){return new Vf({type:`function`,input:Array.isArray(e?.input)?pf(e?.input):e?.input??B(z()),output:e?.output??z()})}var Uf=N(`ZodCustom`,(e,t)=>{nl.init(e,t),bd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Mu(e,t,n,r)});function Wf(e,t){return du(Uf,e??(()=>!0),t)}function Gf(e,t={}){return fu(Uf,e,t)}function Kf(e,t){return pu(e,t)}var qf=c(_(),1);function K(e){if(typeof process<`u`&&{}.OS_EAGER_SCHEMAS===`1`)return e();let t,n=()=>(t===void 0&&(t=e()),t);return new Proxy(function(){},{get(e,t){let r=n(),i=r[t];return typeof i==`function`?i.bind(r):i},set(e,t,r){let i=n();return i[t]=r,!0},has(e,t){return t in n()},ownKeys(){return Reflect.ownKeys(n())},getOwnPropertyDescriptor(e,t){return Reflect.getOwnPropertyDescriptor(n(),t)},getPrototypeOf(){return Reflect.getPrototypeOf(n())}})}var Jf=K(()=>V({$field:I().describe(`Field Reference/Column Name`)}));K(()=>V({$eq:Xd().optional(),$ne:Xd().optional()})),K(()=>V({$gt:H([L(),rf(),Jf]).optional(),$gte:H([L(),rf(),Jf]).optional(),$lt:H([L(),rf(),Jf]).optional(),$lte:H([L(),rf(),Jf]).optional()})),K(()=>V({$in:B(Xd()).optional(),$nin:B(Xd()).optional()})),K(()=>V({$between:pf([H([L(),rf(),Jf]),H([L(),rf(),Jf])]).optional()})),K(()=>V({$contains:I().optional(),$notContains:I().optional(),$startsWith:I().optional(),$endsWith:I().optional()})),K(()=>V({$null:R().optional(),$exists:R().optional()}));var Yf=K(()=>V({$eq:Xd().optional(),$ne:Xd().optional(),$gt:H([L(),rf(),Jf]).optional(),$gte:H([L(),rf(),Jf]).optional(),$lt:H([L(),rf(),Jf]).optional(),$lte:H([L(),rf(),Jf]).optional(),$in:B(Xd()).optional(),$nin:B(Xd()).optional(),$between:pf([H([L(),rf(),Jf]),H([L(),rf(),Jf])]).optional(),$contains:I().optional(),$notContains:I().optional(),$startsWith:I().optional(),$endsWith:I().optional(),$null:R().optional(),$exists:R().optional()})),Xf=Rf(()=>U(I(),z()).and(V({$and:B(Xf).optional(),$or:B(Xf).optional(),$not:Xf.optional()})));K(()=>V({where:Xf.optional()}));var Zf=Rf(()=>V({$and:B(H([U(I(),Yf),Zf])).optional(),$or:B(H([U(I(),Yf),Zf])).optional(),$not:H([U(I(),Yf),Zf]).optional()})),Qf=new Set([`=`,`==`,`!=`,`<>`,`>`,`>=`,`<`,`<=`,`in`,`nin`,`not_in`,`contains`,`notcontains`,`not_contains`,`like`,`startswith`,`starts_with`,`endswith`,`ends_with`,`between`,`is_null`,`is_not_null`]);function $f(e){if(!Array.isArray(e)||e.length===0)return!1;let t=e[0];if(typeof t==`string`){let n=t.toLowerCase();if(n===`and`||n===`or`)return e.length>=2&&e.slice(1).every(e=>$f(e));if(e.length>=2&&typeof e[1]==`string`)return Qf.has(e[1].toLowerCase())}return e.every(e=>$f(e))?e.length>0:!1}var ep=[`$eq`,`$ne`,`$gt`,`$gte`,`$lt`,`$lte`,`$in`,`$nin`,`$between`,`$contains`,`$notContains`,`$startsWith`,`$endsWith`,`$null`,`$exists`],tp=[`$and`,`$or`,`$not`];[...ep,...tp];var np=K(()=>V({field:I(),order:W([`asc`,`desc`]).default(`asc`)})),rp=W([`count`,`sum`,`avg`,`min`,`max`,`count_distinct`,`array_agg`,`string_agg`]),ip=W([`day`,`week`,`month`,`quarter`,`year`]),ap=K(()=>H([I(),V({field:I().describe(`Field to group by`),dateGranularity:ip.optional().describe(`Bucket date values into uniform periods (day/week/month/quarter/year)`),alias:I().optional().describe(`Alias for the projected group value`)})])),op=K(()=>V({function:rp.describe(`Aggregation function`),field:I().optional().describe(`Field to aggregate (optional for COUNT(*))`),alias:I().describe(`Result column alias`),distinct:R().optional().describe(`Apply DISTINCT before aggregation`),filter:Xf.optional().describe(`Filter/Condition to apply to the aggregation (FILTER WHERE clause)`)})),sp=W([`inner`,`left`,`right`,`full`]),cp=W([`auto`,`database`,`hash`,`loop`]),lp=Rf(()=>V({type:sp.describe(`Join type`),strategy:cp.optional().describe(`Execution strategy hint`),object:I().describe(`Object/table to join`),alias:I().optional().describe(`Table alias`),on:Xf.describe(`Join condition`),subquery:Rf(()=>gp).optional().describe(`Subquery instead of object`)})),up=W([`row_number`,`rank`,`dense_rank`,`percent_rank`,`lag`,`lead`,`first_value`,`last_value`,`sum`,`avg`,`count`,`min`,`max`]),dp=K(()=>V({partitionBy:B(I()).optional().describe(`PARTITION BY fields`),orderBy:B(np).optional().describe(`ORDER BY specification`),frame:V({type:W([`rows`,`range`]).optional(),start:I().optional().describe(`Frame start (e.g., "UNBOUNDED PRECEDING", "1 PRECEDING")`),end:I().optional().describe(`Frame end (e.g., "CURRENT ROW", "1 FOLLOWING")`)}).optional().describe(`Window frame specification`)})),fp=K(()=>V({function:up.describe(`Window function name`),field:I().optional().describe(`Field to operate on (for aggregate window functions)`),alias:I().describe(`Result column alias`),over:dp.describe(`Window specification (OVER clause)`)})),pp=Rf(()=>H([I(),V({field:I(),fields:B(pp).optional(),alias:I().optional()})])),mp=K(()=>V({query:I().describe(`Search query text`),fields:B(I()).optional().describe(`Fields to search in (if not specified, searches all text fields)`),fuzzy:R().optional().default(!1).describe(`Enable fuzzy matching (tolerates typos)`),operator:W([`and`,`or`]).optional().default(`or`).describe(`Logical operator between terms`),boost:U(I(),L()).optional().describe(`Field-specific relevance boosting (field name -> boost factor)`),minScore:L().optional().describe(`Minimum relevance score threshold`),language:I().optional().describe(`Language for text analysis (e.g., "en", "zh", "es")`),highlight:R().optional().default(!1).describe(`Enable search result highlighting`)})),hp=V({object:I().describe(`Object name (e.g. account)`),fields:B(pp).optional().describe(`Fields to retrieve`),where:Xf.optional().describe(`Filtering criteria (WHERE)`),search:mp.optional().describe(`Full-text search configuration ($search parameter)`),orderBy:B(np).optional().describe(`Sorting instructions (ORDER BY)`),limit:L().optional().describe(`Max records to return (LIMIT)`),offset:L().optional().describe(`Records to skip (OFFSET)`),top:L().optional().describe(`Alias for limit (OData compatibility)`),cursor:U(I(),z()).optional().describe(`Cursor for keyset pagination`),joins:B(lp).optional().describe(`Explicit Table Joins`),aggregations:B(op).optional().describe(`Aggregation functions`),groupBy:B(ap).optional().describe("GROUP BY targets (strings or `{field, dateGranularity?}` objects for date bucketing)"),having:Xf.optional().describe(`HAVING clause for aggregation filtering`),windowFunctions:B(fp).optional().describe(`Window functions with OVER clause`),distinct:R().optional().describe(`SELECT DISTINCT flag`)}),gp=K(()=>hp.extend({expand:Rf(()=>U(I(),gp)).optional().describe(`Recursive relation loading map. Keys are lookup/master_detail field names; values are nested QueryAST objects that control select, filter, sort, and further expansion on the related object. The engine resolves expand via batch $in queries (driver-agnostic) with a default max depth of 3.`)})),_p=[`today`,`yesterday`,`tomorrow`,`now`],vp=[`current_week_start`,`current_week_end`,`current_month_start`,`current_month_end`,`current_quarter_start`,`current_quarter_end`,`current_year_start`,`current_year_end`,`last_week_start`,`last_week_end`,`last_month_start`,`last_month_end`,`last_quarter_start`,`last_quarter_end`,`last_year_start`,`last_year_end`,`next_week_start`,`next_week_end`,`next_month_start`,`next_month_end`,`next_quarter_start`,`next_quarter_end`,`next_year_start`,`next_year_end`],yp=[`week_start`,`week_end`,`month_start`,`month_end`,`quarter_start`,`quarter_end`,`year_start`,`year_end`],bp=[..._p,...vp,...yp],xp=/^(\d+)_(minutes?|hours?|days?|weeks?|months?|years?)_(ago|from_now)$/,Sp=[`minute`,`hour`,`day`,`week`,`month`,`year`];function Cp(e){return bp.includes(e)||xp.test(e)}I().refine(Cp,{message:`Unknown date macro. Must be a fixed token (see DATE_MACRO_TOKENS) or match {N_<unit>_(ago|from_now)} where unit is one of: `+Sp.join(`, `)});var wp=/^\$?\{([a-zA-Z0-9_]+)\}$/;I().refine(e=>{let t=e.match(wp);return!!t&&Cp(t[1])},{message:`Not a recognised {date-macro} placeholder`});var Tp=K(()=>I().min(2,{message:`System identifier must be at least 2 characters`}).regex(/^[a-z][a-z0-9_.]*$/,{message:`System identifier must be lowercase, starting with a letter, and may contain letters, numbers, underscores, or dots (e.g., "user_profile" or "order.created")`}).describe(`System identifier (lowercase with underscores or dots)`)),Ep=K(()=>I().min(2,{message:`Identifier must be at least 2 characters`}).regex(/^[a-z][a-z0-9_]*$/,{message:`Identifier must be lowercase snake_case, starting with a letter, and may contain only letters, numbers, and underscores (e.g., "user_profile")`}).describe(`Snake case identifier (lowercase with underscores only)`));K(()=>I().min(3,{message:`Event name must be at least 3 characters`}).regex(/^[a-z][a-z0-9_.]*$/,{message:`Event name must be lowercase with dots for namespacing (e.g., "user.created", "order.paid")`}).describe(`Event name (lowercase with dot notation for namespacing)`));var Dp=W([`cel`,`js`,`cron`,`template`]),Op=V({rationale:I().optional(),generatedBy:I().optional()}),kp=V({dialect:Dp,source:I().min(1).optional(),ast:z().optional(),meta:Op.optional()}).refine(e=>e.source!==void 0||e.ast!==void 0,{message:"Expression requires at least one of `source` or `ast`"}),Ap=H([I().min(1).transform(e=>({dialect:`cel`,source:e})),kp]);H([I().min(1).transform(e=>({dialect:`cron`,source:e})),kp]);var jp=H([I().min(1).transform(e=>({dialect:`template`,source:e})),kp]),Mp=K(()=>W([`aes-256-gcm`,`aes-256-cbc`,`chacha20-poly1305`]).describe(`Supported encryption algorithm`)),Np=K(()=>W([`local`,`aws-kms`,`azure-key-vault`,`gcp-kms`,`hashicorp-vault`]).describe(`Key management service provider`)),Pp=K(()=>V({enabled:R().default(!1).describe(`Enable automatic key rotation`),frequencyDays:L().min(1).default(90).describe(`Rotation frequency in days`),retainOldVersions:L().default(3).describe(`Number of old key versions to retain`),autoRotate:R().default(!0).describe(`Automatically rotate without manual approval`)}).describe(`Policy for automatic encryption key rotation`)),Fp=K(()=>V({enabled:R().default(!1).describe(`Enable field-level encryption`),algorithm:Mp.default(`aes-256-gcm`).describe(`Encryption algorithm`),keyManagement:V({provider:Np.describe(`Key management service provider`),keyId:I().optional().describe(`Key identifier in the provider`),rotationPolicy:Pp.optional().describe(`Key rotation policy`)}).describe(`Key management configuration`),scope:W([`field`,`record`,`table`,`database`]).describe(`Encryption scope level`),deterministicEncryption:R().default(!1).describe(`Allows equality queries on encrypted data`),searchableEncryption:R().default(!1).describe(`Allows search on encrypted data`)}).describe(`Field-level encryption configuration`));K(()=>V({fieldName:I().describe(`Name of the field to encrypt`),encryptionConfig:Fp.describe(`Encryption settings for this field`),indexable:R().default(!1).describe(`Allow indexing on encrypted field`)}).describe(`Per-field encryption assignment`));var Ip=K(()=>W([`redact`,`partial`,`hash`,`tokenize`,`randomize`,`nullify`,`substitute`]).describe(`Data masking strategy for PII protection`)),Lp=K(()=>V({field:I().describe(`Field name to apply masking to`),strategy:Ip.describe(`Masking strategy to use`),pattern:I().optional().describe(`Regex pattern for partial masking`),preserveFormat:R().default(!0).describe(`Keep the original data format after masking`),preserveLength:R().default(!0).describe(`Keep the original data length after masking`),roles:B(I()).optional().describe(`Roles that see masked data`),exemptRoles:B(I()).optional().describe(`Roles that see unmasked data`)}).describe(`Masking rule for a single field`));K(()=>V({enabled:R().default(!1).describe(`Enable data masking`),rules:B(Lp).describe(`List of field-level masking rules`),auditUnmasking:R().default(!0).describe(`Log when masked data is accessed unmasked`)}).describe(`Top-level data masking configuration for PII protection`));var Rp=W(`text.textarea.email.url.phone.password.secret.markdown.html.richtext.number.currency.percent.date.datetime.time.boolean.toggle.select.multiselect.radio.checkboxes.lookup.master_detail.tree.image.file.avatar.video.audio.formula.summary.autonumber.composite.repeater.record.location.address.code.json.color.rating.slider.signature.qrcode.progress.tags.vector`.split(`.`)),zp=K(()=>V({label:I().describe(`Display label (human-readable, any case allowed)`),value:Tp.describe(`Stored value (lowercase machine identifier)`),color:I().optional().describe(`Color code for badges/charts`),default:R().optional().describe(`Is default option`)}));K(()=>V({latitude:L().min(-90).max(90).describe(`Latitude coordinate`),longitude:L().min(-180).max(180).describe(`Longitude coordinate`),altitude:L().optional().describe(`Altitude in meters`),accuracy:L().optional().describe(`Accuracy in meters`)}));var Bp=K(()=>V({precision:L().int().min(0).max(10).default(2).describe(`Decimal precision (default: 2)`),currencyMode:W([`dynamic`,`fixed`]).default(`dynamic`).describe(`Currency mode: dynamic (user selectable) or fixed (single currency)`),defaultCurrency:I().length(3).default(`CNY`).describe(`Default or fixed currency code (ISO 4217, e.g., USD, CNY, EUR)`)}));K(()=>V({value:L().describe(`Monetary amount`),currency:I().length(3).describe(`Currency code (ISO 4217)`)})),K(()=>V({street:I().optional().describe(`Street address`),city:I().optional().describe(`City name`),state:I().optional().describe(`State/Province`),postalCode:I().optional().describe(`Postal/ZIP code`),country:I().optional().describe(`Country name or code`),countryCode:I().optional().describe(`ISO country code (e.g., US, GB)`),formatted:I().optional().describe(`Formatted address string`)}));var Vp=K(()=>V({dimensions:L().int().min(1).max(1e4).describe(`Vector dimensionality (e.g., 1536 for OpenAI embeddings)`),distanceMetric:W([`cosine`,`euclidean`,`dotProduct`,`manhattan`]).default(`cosine`).describe(`Distance/similarity metric for vector search`),normalized:R().default(!1).describe(`Whether vectors are normalized (unit length)`),indexed:R().default(!0).describe(`Whether to create a vector index for fast similarity search`),indexType:W([`hnsw`,`ivfflat`,`flat`]).optional().describe(`Vector index algorithm (HNSW for high accuracy, IVFFlat for large datasets)`)})),Hp=K(()=>V({minSize:L().min(0).optional().describe(`Minimum file size in bytes`),maxSize:L().min(1).optional().describe(`Maximum file size in bytes (e.g., 10485760 = 10MB)`),allowedTypes:B(I()).optional().describe(`Allowed file extensions (e.g., [".pdf", ".docx", ".jpg"])`),blockedTypes:B(I()).optional().describe(`Blocked file extensions (e.g., [".exe", ".bat", ".sh"])`),allowedMimeTypes:B(I()).optional().describe(`Allowed MIME types (e.g., ["image/jpeg", "application/pdf"])`),blockedMimeTypes:B(I()).optional().describe(`Blocked MIME types`),virusScan:R().default(!1).describe(`Enable virus scanning for uploaded files`),virusScanProvider:W([`clamav`,`virustotal`,`metadefender`,`custom`]).optional().describe(`Virus scanning service provider`),virusScanOnUpload:R().default(!0).describe(`Scan files immediately on upload`),quarantineOnThreat:R().default(!0).describe(`Quarantine files if threat detected`),storageProvider:I().optional().describe(`Object storage provider name (references ObjectStorageConfig)`),storageBucket:I().optional().describe(`Target bucket name`),storagePrefix:I().optional().describe(`Storage path prefix (e.g., "uploads/documents/")`),imageValidation:V({minWidth:L().min(1).optional().describe(`Minimum image width in pixels`),maxWidth:L().min(1).optional().describe(`Maximum image width in pixels`),minHeight:L().min(1).optional().describe(`Minimum image height in pixels`),maxHeight:L().min(1).optional().describe(`Maximum image height in pixels`),aspectRatio:I().optional().describe(`Required aspect ratio (e.g., "16:9", "1:1")`),generateThumbnails:R().default(!1).describe(`Auto-generate thumbnails`),thumbnailSizes:B(V({name:I().describe(`Thumbnail variant name (e.g., "small", "medium", "large")`),width:L().min(1).describe(`Thumbnail width in pixels`),height:L().min(1).describe(`Thumbnail height in pixels`),crop:R().default(!1).describe(`Crop to exact dimensions`)})).optional().describe(`Thumbnail size configurations`),preserveMetadata:R().default(!1).describe(`Preserve EXIF metadata`),autoRotate:R().default(!0).describe(`Auto-rotate based on EXIF orientation`)}).optional().describe(`Image-specific validation rules`),allowMultiple:R().default(!1).describe(`Allow multiple file uploads (overrides field.multiple)`),allowReplace:R().default(!0).describe(`Allow replacing existing files`),allowDelete:R().default(!0).describe(`Allow deleting uploaded files`),requireUpload:R().default(!1).describe(`Require at least one file when field is required`),extractMetadata:R().default(!0).describe(`Extract file metadata (name, size, type, etc.)`),extractText:R().default(!1).describe(`Extract text content from documents (OCR/parsing)`),versioningEnabled:R().default(!1).describe(`Keep previous versions of replaced files`),maxVersions:L().min(1).optional().describe(`Maximum number of versions to retain`),publicRead:R().default(!1).describe(`Allow public read access to uploaded files`),presignedUrlExpiry:L().min(60).max(604800).default(3600).describe(`Presigned URL expiration in seconds (default: 1 hour)`)}).refine(e=>!(e.minSize!==void 0&&e.maxSize!==void 0&&e.minSize>e.maxSize),{message:`minSize must be less than or equal to maxSize`}).refine(e=>!(e.virusScanProvider!==void 0&&e.virusScan!==!0),{message:`virusScanProvider requires virusScan to be enabled`})),Up=K(()=>V({uniqueness:R().default(!1).describe(`Enforce unique values across all records`),completeness:L().min(0).max(1).default(0).describe(`Minimum ratio of non-null values (0-1, default: 0 = no requirement)`),accuracy:V({source:I().describe(`Reference data source for validation (e.g., "api.verify.com", "master_data")`),threshold:L().min(0).max(1).describe(`Minimum accuracy threshold (0-1, e.g., 0.95 = 95% match required)`)}).optional().describe(`Accuracy validation configuration`)})),Wp=K(()=>V({enabled:R().describe(`Enable caching for computed field results`),ttl:L().min(0).describe(`Cache TTL in seconds (0 = no expiration)`),invalidateOn:B(I()).describe(`Field paths that invalidate cache (e.g., ["inventory.quantity", "pricing.base_price"])`)})),Gp=K(()=>V({name:I().regex(/^[a-z_][a-z0-9_]*$/).describe(`Machine name (snake_case)`).optional(),label:I().optional().describe(`Human readable label`),type:Rp.describe(`Field Data Type`),description:I().optional().describe(`Tooltip/Help text`),format:I().optional().describe(`Format string (e.g. email, phone)`),columnName:I().optional().describe(`Physical column name in the target datasource. Defaults to the field key when not set.`),required:R().default(!1).describe(`Is required`),searchable:R().default(!1).describe(`Is searchable`),multiple:R().default(!1).describe(`Allow multiple values (Stores as Array/JSON). Applicable for select, lookup, file, image.`),unique:R().default(!1).describe(`Is unique constraint`),defaultValue:z().optional().describe(`Default value`),maxLength:L().optional().describe(`Max character length`),minLength:L().optional().describe(`Min character length`),precision:L().optional().describe(`Total digits`),scale:L().optional().describe(`Decimal places`),min:L().optional().describe(`Minimum value`),max:L().optional().describe(`Maximum value`),options:B(zp).optional().describe(`Static options for select/multiselect`),reference:I().optional().describe(`Target object name (snake_case) for lookup/master_detail fields. Required for relationship types. Used by $expand to resolve foreign key IDs into full objects.`),referenceFilters:B(I()).optional().describe(`Filters applied to lookup dialogs (e.g. "active = true")`),writeRequiresMasterRead:R().optional().describe(`If true, user needs read access to master record to edit this field`),deleteBehavior:W([`set_null`,`cascade`,`restrict`]).optional().default(`set_null`).describe(`What happens if referenced record is deleted`),expression:Ap.optional().describe("Formula expression (CEL). e.g. F`record.amount * 0.1`"),summaryOperations:V({object:I().describe(`Source child object name for roll-up`),field:I().describe(`Field on child object to aggregate`),function:W([`count`,`sum`,`min`,`max`,`avg`]).describe(`Aggregation function to apply`)}).optional().describe(`Roll-up summary definition`),language:I().optional().describe(`Programming language for syntax highlighting (e.g., javascript, python, sql)`),theme:I().optional().describe(`Code editor theme (e.g., dark, light, monokai)`),lineNumbers:R().optional().describe(`Show line numbers in code editor`),maxRating:L().optional().describe(`Maximum rating value (default: 5)`),allowHalf:R().optional().describe(`Allow half-star ratings`),displayMap:R().optional().describe(`Display map widget for location field`),allowGeocoding:R().optional().describe(`Allow address-to-coordinate conversion`),addressFormat:W([`us`,`uk`,`international`]).optional().describe(`Address format template`),colorFormat:W([`hex`,`rgb`,`rgba`,`hsl`]).optional().describe(`Color value format`),allowAlpha:R().optional().describe(`Allow transparency/alpha channel`),presetColors:B(I()).optional().describe(`Preset color options`),step:L().optional().describe(`Step increment for slider (default: 1)`),showValue:R().optional().describe(`Display current value on slider`),marks:U(I(),I()).optional().describe(`Custom marks/labels at specific values (e.g., {0: "Low", 50: "Medium", 100: "High"})`),barcodeFormat:W([`qr`,`ean13`,`ean8`,`code128`,`code39`,`upca`,`upce`]).optional().describe(`Barcode format type`),qrErrorCorrection:W([`L`,`M`,`Q`,`H`]).optional().describe(`QR code error correction level (L=7%, M=15%, Q=25%, H=30%). Only applicable when barcodeFormat is "qr"`),displayValue:R().optional().describe(`Display human-readable value below barcode/QR code`),allowScanning:R().optional().describe(`Enable camera scanning for barcode/QR code input`),currencyConfig:Bp.optional().describe(`Configuration for currency field type`),vectorConfig:Vp.optional().describe(`Configuration for vector field type (AI/ML embeddings)`),fileAttachmentConfig:Hp.optional().describe(`Configuration for file and attachment field types`),encryptionConfig:Fp.optional().describe(`Field-level encryption configuration for sensitive data (GDPR/HIPAA/PCI-DSS)`),maskingRule:Lp.optional().describe(`Data masking rules for PII protection`),auditTrail:R().default(!1).describe(`Enable detailed audit trail for this field (tracks all changes with user and timestamp)`),dependencies:B(I()).optional().describe(`Array of field names that this field depends on (for formulas, visibility rules, etc.)`),cached:Wp.optional().describe(`Caching configuration for computed/formula fields`),dataQuality:Up.optional().describe(`Data quality validation and monitoring rules`),group:I().optional().describe(`Field group name for organizing fields in forms and layouts (e.g., "contact_info", "billing", "system")`),conditionalRequired:Ap.optional().describe("Predicate (CEL) — field is required when TRUE. e.g. P`record.status == 'closed_won'`"),hidden:R().default(!1).describe(`Hidden from default UI`),readonly:R().default(!1).describe(`Read-only in UI`),system:R().optional().describe(`Auto-injected system/audit field (e.g. created_at, updated_by, organization_id). Tools that surface system fields separately from author-declared business fields should branch on this flag.`),sortable:R().optional().default(!0).describe(`Whether field is sortable in list views`),inlineHelpText:I().optional().describe(`Help text displayed below the field in forms`),trackFeedHistory:R().optional().describe(`Track field changes in Chatter/activity feed (Salesforce pattern)`),caseSensitive:R().optional().describe(`Whether text comparisons are case-sensitive`),autonumberFormat:I().optional().describe(`Auto-number display format pattern (e.g., "CASE-{0000}")`),index:R().default(!1).describe(`Create standard database index`),externalId:R().default(!1).describe(`Is external ID for upsert operations`)})),Kp=V({name:I().regex(/^[a-z_][a-z0-9_]*$/).describe(`Unique rule name (snake_case)`),label:I().optional().describe(`Human-readable label for the rule listing`),description:I().optional().describe(`Administrative notes explaining the business reason`),active:R().default(!0),events:B(W([`insert`,`update`,`delete`])).default([`insert`,`update`]).describe(`Validation contexts`),priority:L().int().min(0).max(9999).default(100).describe(`Execution priority (lower runs first, default: 100)`),tags:B(I()).optional().describe(`Categorization tags (e.g., "compliance", "billing")`),severity:W([`error`,`warning`,`info`]).default(`error`),message:I().describe(`Error message to display to the user`)}),qp=K(()=>Kp.extend({type:G(`script`),condition:Ap.describe("Predicate (CEL). If TRUE, validation fails. e.g. P`record.amount < 0`")})),Jp=K(()=>Kp.extend({type:G(`unique`),fields:B(I()).describe(`Fields that must be combined unique`),scope:Ap.optional().describe("Predicate (CEL) limiting uniqueness scope. e.g. P`record.active == true`"),caseSensitive:R().default(!0)})),Yp=K(()=>Kp.extend({type:G(`state_machine`),field:I().describe(`State field (e.g. status)`),transitions:U(I(),B(I())).describe(`Map of { OldState: [AllowedNewStates] }`)})),Xp=K(()=>Kp.extend({type:G(`format`),field:I(),regex:I().optional(),format:W([`email`,`url`,`phone`,`json`]).optional()})),Zp=K(()=>Kp.extend({type:G(`cross_field`),condition:Ap.describe("Predicate (CEL) comparing fields. e.g. P`record.end_date > record.start_date`"),fields:B(I()).describe(`Fields involved in the validation`)})),Qp=K(()=>Kp.extend({type:G(`json_schema`),field:I().describe(`JSON field to validate`),schema:U(I(),z()).describe(`JSON Schema object definition`)})),$p=K(()=>Kp.extend({type:G(`async`),field:I().describe(`Field to validate`),validatorUrl:I().optional().describe(`External API endpoint for validation`),method:W([`GET`,`POST`]).default(`GET`).describe(`HTTP method for external call`),headers:U(I(),I()).optional().describe(`Custom headers for the request`),validatorFunction:I().optional().describe(`Reference to custom validator function`),timeout:L().optional().default(5e3).describe(`Timeout in milliseconds`),debounce:L().optional().describe(`Debounce delay in milliseconds`),params:U(I(),z()).optional().describe(`Additional parameters to pass to validator`)})),em=K(()=>Kp.extend({type:G(`custom`),handler:I().describe(`Name of the custom validation function registered in the system`),params:U(I(),z()).optional().describe(`Parameters passed to the custom handler`)})),tm=Rf(()=>lf(`type`,[qp,Jp,Yp,Xp,Zp,Qp,$p,em,nm])),nm=K(()=>Kp.extend({type:G(`conditional`),when:Ap.describe("Predicate (CEL). e.g. P`record.type == 'enterprise'`"),then:tm.describe(`Validation rule to apply when condition is true`),otherwise:tm.optional().describe(`Validation rule to apply when condition is false`)}));K(()=>V({key:I().describe(`Translation key (e.g., "views.task_list.label")`),defaultValue:I().optional().describe(`Fallback value when translation key is not found`),params:U(I(),H([I(),L(),R()])).optional().describe(`Interpolation parameters (e.g., { count: 5 })`)}));var rm=K(()=>I().describe(`Display label (plain string; i18n keys are auto-generated by the framework)`)),im=K(()=>V({ariaLabel:rm.optional().describe(`Accessible label for screen readers (WAI-ARIA aria-label)`),ariaDescribedBy:I().optional().describe(`ID of element providing additional description (WAI-ARIA aria-describedby)`),role:I().optional().describe(`WAI-ARIA role attribute (e.g., "dialog", "navigation", "alert")`)}).describe(`ARIA accessibility attributes`));K(()=>V({key:I().describe(`Translation key`),zero:I().optional().describe(`Zero form (e.g., "No items")`),one:I().optional().describe(`Singular form (e.g., "{count} item")`),two:I().optional().describe(`Dual form (e.g., "{count} items" for exactly 2)`),few:I().optional().describe(`Few form (e.g., for 2-4 in some languages)`),many:I().optional().describe(`Many form (e.g., for 5+ in some languages)`),other:I().describe(`Default plural form (e.g., "{count} items")`)}).describe(`ICU plural rules for a translation key`));var am=K(()=>V({style:W([`decimal`,`currency`,`percent`,`unit`]).default(`decimal`).describe(`Number formatting style`),currency:I().optional().describe(`ISO 4217 currency code (e.g., "USD", "EUR")`),unit:I().optional().describe(`Unit for unit formatting (e.g., "kilometer", "liter")`),minimumFractionDigits:L().optional().describe(`Minimum number of fraction digits`),maximumFractionDigits:L().optional().describe(`Maximum number of fraction digits`),useGrouping:R().optional().describe(`Whether to use grouping separators (e.g., 1,000)`)}).describe(`Number formatting rules`)),om=K(()=>V({dateStyle:W([`full`,`long`,`medium`,`short`]).optional().describe(`Date display style`),timeStyle:W([`full`,`long`,`medium`,`short`]).optional().describe(`Time display style`),timeZone:I().optional().describe(`IANA time zone (e.g., "America/New_York")`),hour12:R().optional().describe(`Use 12-hour format`)}).describe(`Date/time formatting rules`));K(()=>V({code:I().describe(`BCP 47 language code (e.g., "en-US", "zh-CN")`),fallbackChain:B(I()).optional().describe(`Fallback language codes in priority order (e.g., ["zh-TW", "en"])`),direction:W([`ltr`,`rtl`]).default(`ltr`).describe(`Text direction: left-to-right or right-to-left`),numberFormat:am.optional().describe(`Default number formatting rules`),dateFormat:om.optional().describe(`Default date/time formatting rules`)}).describe(`Locale configuration`));var sm=W([`api.read`,`api.write`,`crypto.uuid`,`crypto.hash`,`log`]),cm=lf(`language`,[V({language:G(`expression`),source:I().min(1).describe(`Formula expression source`)}).describe(`L1 expression body — pure formula, no IO`),V({language:G(`js`),source:I().min(1).describe(`Function body source`),capabilities:B(sm).default([]).describe(`Granted capability tokens`),timeoutMs:L().int().positive().max(3e4).optional().describe(`Per-invocation timeout (ms)`),memoryMb:L().int().positive().max(256).optional().describe(`Per-invocation memory cap (MB)`)}).describe(`L2 sandboxed JS body — runs inside an isolated VM with declared capabilities`)]).describe(`Hook/Action body — expression (L1) or sandboxed JS (L2)`),lm=K(()=>V({name:I().optional(),field:Ep.optional(),objectOverride:Ep.optional(),label:rm.optional(),type:Rp.optional(),required:R().optional().default(!1),options:B(V({label:rm,value:I()})).optional(),placeholder:I().optional(),helpText:I().optional(),defaultValue:z().optional(),defaultFromRow:R().optional()}).refine(e=>!!e.name||!!e.field,{message:`ActionParam requires either "name" or "field"`})),um=W([`script`,`url`,`modal`,`flow`,`api`,`form`]),dm=new Set(um.options.filter(e=>e!==`script`)),fm=W([`list_toolbar`,`list_item`,`record_header`,`record_more`,`record_related`,`record_section`,`global_nav`]),pm=K(()=>V({name:Ep.describe(`Machine name (lowercase snake_case)`),label:rm.describe(`Display label`),objectName:I().regex(/^[a-z_][a-z0-9_]*$/).optional().describe(`Target object this action belongs to. When set, the action is auto-merged into the object's actions array by defineStack().`),icon:I().optional().describe(`Icon name`),locations:B(fm).optional().describe(`Locations where this action is visible`),component:W([`action:button`,`action:icon`,`action:menu`,`action:group`]).optional().describe(`Visual component override`),type:um.default(`script`).describe(`Action functionality type`),target:I().optional().describe("URL, Script Name, Flow ID, or API Endpoint. Supports ${param.X} and ${ctx.X} interpolation."),body:cm.optional().describe("Action body — expression (L1) or sandboxed JS (L2). Only used when type is `script`."),execute:I().optional().describe(`@deprecated — Use target instead. Auto-migrated to target during parsing.`),params:B(lm).optional().describe(`Input parameters required from user`),variant:W([`primary`,`secondary`,`danger`,`ghost`,`link`]).optional().describe(`Button visual variant for styling (primary = highlighted, danger = destructive, ghost = transparent)`),confirmText:rm.optional().describe(`Confirmation message before execution`),successMessage:rm.optional().describe(`Success message to show after execution`),refreshAfter:R().default(!1).describe(`Refresh view after execution`),resultDialog:V({title:rm.optional(),description:rm.optional(),acknowledge:rm.optional().describe(`Acknowledge button label, e.g. "I have saved this"`),format:W([`qrcode`,`code-list`,`secret`,`text`,`json`]).optional().describe(`Default format for fields without their own format. Defaults to json when omitted.`),fields:B(V({path:I().describe(`Dot path into result.data (e.g. "totpURI", "client.client_secret").`),label:rm.optional(),format:W([`qrcode`,`code-list`,`secret`,`text`,`json`]).optional().describe(`Per-field format override.`)})).optional().describe(`Which fields from result.data to render. Omit to dump full JSON.`)}).optional().describe(`Render API response in a one-shot reveal dialog (suppresses successMessage when set).`),visible:Ap.optional().describe(`Visibility predicate (CEL).`),disabled:H([R(),Ap]).optional().describe(`Boolean or predicate (CEL) — action is disabled when TRUE.`),shortcut:I().optional().describe(`Keyboard shortcut to trigger this action (e.g., "Ctrl+S")`),bulkEnabled:R().optional().describe(`Whether this action can be applied to multiple selected records`),aiExposed:R().optional().describe(`Set to false to keep this action out of the AI tool registry.`),recordIdParam:I().optional().describe(`Body key to inject the row id into when running from a list_item context.`),recordIdField:I().optional().describe(`Row field whose value seeds recordIdParam. Defaults to "id".`),bodyShape:H([G(`flat`),V({wrap:I()})]).optional().describe(`Body wrapping: flat (default) or { wrap: key } to nest user-collected params under a key.`),method:W([`POST`,`PATCH`,`PUT`,`DELETE`]).optional().describe(`HTTP method for type:"api" actions. Defaults to POST.`),bodyExtra:U(I(),z()).optional().describe(`Constant body fields merged into the API request (applied last; overrides user params).`),mode:W([`create`,`edit`,`delete`,`custom`]).optional().describe(`Semantic mode of the action.`),timeout:L().optional().describe(`Maximum execution time in milliseconds for the action`),aria:im.optional().describe(`ARIA accessibility attributes`)}).transform(e=>e.execute&&!e.target?{...e,target:e.execute}:e).refine(e=>!(dm.has(e.type)&&!e.target),{message:`Action 'target' is required when type is 'url', 'flow', 'modal', 'api', or 'form'.`,path:[`target`]})),mm=W([`none`,`no-overlay`,`no-delete`,`full`]),hm=W([`artifact`,`package`,`env-forced`]),gm=W([`package`,`org`,`env-forced`]),_m={_lock:mm.optional().describe(`Item-level lock — controls overlay & delete (ADR-0010).`),_lockReason:I().max(500).optional().describe(`Human-readable reason shown when a write is refused by _lock.`),_lockSource:hm.optional().describe(`Layer that set _lock (artifact | package | env-forced).`),_provenance:gm.optional().describe(`Origin of the item (package | org | env-forced).`),_packageId:I().optional().describe(`Owning package machine id.`),_packageVersion:I().optional().describe(`Owning package version.`),_lockDocsUrl:I().optional().describe(`Optional documentation link surfaced next to _lockReason.`)},vm=V({lock:mm.describe(`Lock policy — none | no-overlay | no-delete | full.`),reason:I().min(1).max(500).describe(`User-visible reason shown when the lock blocks an action.`),docsUrl:I().url().optional().describe(`Optional URL the Studio banner links to for more context.`)}).strict(),ym=K(()=>V({enabled:R().default(!1).describe(`Enable public sharing`),publicLink:I().optional().describe(`Generated public share URL`),password:I().optional().describe(`Password required to access shared link`),allowedDomains:B(I()).optional().describe(`Restrict access to specific email domains (e.g. ["example.com"])`),expiresAt:I().optional().describe(`Expiration date/time in ISO 8601 format`),allowAnonymous:R().optional().default(!1).describe(`Allow access without authentication`)}));K(()=>V({enabled:R().default(!1).describe(`Enable iframe embedding`),allowedOrigins:B(I()).optional().describe(`Allowed iframe parent origins (e.g. ["https://example.com"])`),width:I().optional().default(`100%`).describe(`Embed width (CSS value)`),height:I().optional().default(`600px`).describe(`Embed height (CSS value)`),showHeader:R().optional().default(!0).describe(`Show interface header in embed`),showNavigation:R().optional().default(!1).describe(`Show navigation in embed`),responsive:R().optional().default(!0).describe(`Enable responsive resizing`)}));var bm=W([`xs`,`sm`,`md`,`lg`,`xl`,`2xl`]),xm=K(()=>V({xs:L().min(1).max(12).optional(),sm:L().min(1).max(12).optional(),md:L().min(1).max(12).optional(),lg:L().min(1).max(12).optional(),xl:L().min(1).max(12).optional(),"2xl":L().min(1).max(12).optional()}).describe(`Grid columns per breakpoint (1-12)`)),Sm=K(()=>V({xs:L().optional(),sm:L().optional(),md:L().optional(),lg:L().optional(),xl:L().optional(),"2xl":L().optional()}).describe(`Display order per breakpoint`)),Cm=K(()=>V({breakpoint:bm.optional().describe(`Minimum breakpoint for visibility`),hiddenOn:B(bm).optional().describe(`Hide on these breakpoints`),columns:xm.optional().describe(`Grid columns per breakpoint`),order:Sm.optional().describe(`Display order per breakpoint`)}).describe(`Responsive layout configuration`)),wm=K(()=>V({lazyLoad:R().optional().describe(`Enable lazy loading (defer rendering until visible)`),virtualScroll:V({enabled:R().default(!1).describe(`Enable virtual scrolling`),itemHeight:L().optional().describe(`Fixed item height in pixels (for estimation)`),overscan:L().optional().describe(`Number of extra items to render outside viewport`)}).optional().describe(`Virtual scrolling configuration`),cacheStrategy:W([`none`,`cache-first`,`network-first`,`stale-while-revalidate`]).optional().describe(`Client-side data caching strategy`),prefetch:R().optional().describe(`Prefetch data before component is visible`),pageSize:L().optional().describe(`Number of items per page for pagination`),debounceMs:L().optional().describe(`Debounce interval for user interactions in milliseconds`)}).describe(`Performance optimization configuration`)),Tm=W([`GET`,`POST`,`PUT`,`DELETE`,`PATCH`,`HEAD`,`OPTIONS`]),Em=K(()=>W([`GET`,`POST`,`PUT`,`PATCH`,`DELETE`])),Dm=K(()=>V({url:I().describe(`API endpoint URL`),method:Em.optional().default(`GET`).describe(`HTTP method`),headers:U(I(),I()).optional().describe(`Custom HTTP headers`),params:U(I(),z()).optional().describe(`Query parameters`),body:z().optional().describe(`Request body for POST/PUT/PATCH`)}));K(()=>V({enabled:R().default(!0).describe(`Enable CORS`),origins:H([I(),B(I())]).default(`*`).describe(`Allowed origins (* for all)`),methods:B(Tm).optional().describe(`Allowed HTTP methods`),credentials:R().default(!1).describe(`Allow credentials (cookies, authorization headers)`),maxAge:L().int().optional().describe(`Preflight cache duration in seconds`)})),K(()=>V({enabled:R().default(!1).describe(`Enable rate limiting`),windowMs:L().int().default(6e4).describe(`Time window in milliseconds`),maxRequests:L().int().default(100).describe(`Max requests per window`)})),K(()=>V({path:I().describe(`URL path to serve from`),directory:I().describe(`Physical directory to serve`),cacheControl:I().optional().describe(`Cache-Control header value`)}));var Om=K(()=>lf(`provider`,[V({provider:G(`object`),object:I().describe(`Target object name`)}),V({provider:G(`api`),read:Dm.optional().describe(`Configuration for fetching data`),write:Dm.optional().describe(`Configuration for submitting data (for forms/editable tables)`)}),V({provider:G(`value`),items:B(z()).describe(`Static data array`)}),V({provider:G(`schema`),schemaId:I().describe(`Schema identifier — typically the metadata type name`),schema:U(I(),z()).optional().describe(`Inline JSON Schema (Draft 2020-12). Optional when schemaId is resolvable.`)})])),km=K(()=>V({field:I().describe(`Field name to filter on`),operator:I().describe(`Filter operator (e.g. equals, not_equals, contains, this_quarter)`),value:H([I(),L(),R(),Jd(),B(H([I(),L()]))]).optional().describe(`Filter value`)}).describe(`View filter rule`)),Am=K(()=>W([`none`,`count`,`count_empty`,`count_filled`,`count_unique`,`percent_empty`,`percent_filled`,`sum`,`avg`,`min`,`max`]).describe(`Aggregation function for column footer summary`)),jm=K(()=>V({field:I().describe(`Field name (snake_case)`),label:rm.optional().describe(`Display label override`),width:L().positive().optional().describe(`Column width in pixels`),align:W([`left`,`center`,`right`]).optional().describe(`Text alignment`),hidden:R().optional().describe(`Hide column by default`),sortable:R().optional().describe(`Allow sorting by this column`),resizable:R().optional().describe(`Allow resizing this column`),wrap:R().optional().describe(`Allow text wrapping`),type:I().optional().describe(`Renderer type override (e.g., "currency", "date")`),pinned:W([`left`,`right`]).optional().describe(`Pin/freeze column to left or right side`),summary:Am.optional().describe(`Footer aggregation function for this column`),link:R().optional().describe(`Functions as the primary navigation link (triggers View navigation)`),action:I().optional().describe(`Registered Action ID to execute when clicked`)})),Mm=K(()=>V({type:W([`none`,`single`,`multiple`]).default(`none`).describe(`Selection mode`)})),Nm=K(()=>V({pageSize:L().int().positive().default(25).describe(`Number of records per page`),pageSizeOptions:B(L().int().positive()).optional().describe(`Available page size options`)})),Pm=K(()=>W([`compact`,`short`,`medium`,`tall`,`extra_tall`]).describe(`Row height / density setting for list view`)),Fm=K(()=>V({field:I().describe(`Field name to group by`),order:W([`asc`,`desc`]).default(`asc`).describe(`Group sort order`),collapsed:R().default(!1).describe(`Collapse groups by default`)})),Im=K(()=>V({fields:B(Fm).min(1).describe(`Fields to group by (supports up to 3 levels)`)}).describe(`Record grouping configuration`)),Lm=K(()=>V({coverField:I().optional().describe(`Attachment/image field to display as card cover`),coverFit:W([`cover`,`contain`]).default(`cover`).describe(`Image fit mode for card cover`),cardSize:W([`small`,`medium`,`large`]).default(`medium`).describe(`Card size in gallery view`),titleField:I().optional().describe(`Field to display as card title`),visibleFields:B(I()).optional().describe(`Fields to display on card body`)}).describe(`Gallery/card view configuration`)),Rm=K(()=>V({startDateField:I().describe(`Field for timeline item start date`),endDateField:I().optional().describe(`Field for timeline item end date`),titleField:I().describe(`Field to display as timeline item title`),groupByField:I().optional().describe(`Field to group timeline rows`),colorField:I().optional().describe(`Field to determine item color`),scale:W([`hour`,`day`,`week`,`month`,`quarter`,`year`]).default(`week`).describe(`Default timeline scale`)}).describe(`Timeline view configuration`)),zm=K(()=>V({type:W([`personal`,`collaborative`]).default(`collaborative`).describe(`View ownership type`),lockedBy:I().optional().describe(`User who locked the view configuration`)}).describe(`View sharing and access configuration`)),Bm=K(()=>V({field:I().describe(`Field to derive color from (typically a select/status field)`),colors:U(I(),I()).optional().describe(`Map of field value to color (hex/token)`)}).describe(`Row color configuration based on field values`)),Vm=K(()=>W([`grid`,`kanban`,`gallery`,`calendar`,`timeline`,`gantt`,`map`]).describe(`Visualization type that users can switch to`)),Hm=K(()=>V({sort:R().default(!0).describe(`Allow users to sort records`),search:R().default(!0).describe(`Allow users to search records`),filter:R().default(!0).describe(`Allow users to filter records`),rowHeight:R().default(!0).describe(`Allow users to toggle row height/density`),addRecordForm:R().default(!1).describe(`Add records through a form instead of inline`),buttons:B(I()).optional().describe(`Custom action button IDs to show in the toolbar`)}).describe(`User action toggles for the view toolbar`)),Um=K(()=>V({showDescription:R().default(!0).describe(`Show the view description text`),allowedVisualizations:B(Vm).optional().describe(`Whitelist of visualization types users can switch between (e.g. ["grid", "gallery", "kanban"])`)}).describe(`Appearance and visualization configuration`)),Wm=K(()=>V({name:Ep.describe(`Tab identifier (snake_case)`),label:rm.optional().describe(`Display label`),icon:I().optional().describe(`Tab icon name`),view:I().optional().describe(`Referenced list view name from listViews`),filter:B(km).optional().describe(`Tab-specific filter criteria`),order:L().int().min(0).optional().describe(`Tab display order`),pinned:R().default(!1).describe(`Pin tab (cannot be removed by users)`),isDefault:R().default(!1).describe(`Set as the default active tab`),visible:R().default(!0).describe(`Tab visibility`)}).describe(`Tab configuration for multi-tab view interface`)),Gm=K(()=>V({enabled:R().default(!0).describe(`Show the add record entry point`),position:W([`top`,`bottom`,`both`]).default(`bottom`).describe(`Position of the add record button`),mode:W([`inline`,`form`,`modal`]).default(`inline`).describe(`How to add a new record`),formView:I().optional().describe(`Named form view to use when mode is "form" or "modal"`)}).describe(`Add record entry point configuration`)),Km=K(()=>V({groupByField:I().describe(`Field to group columns by (usually status/select)`),summarizeField:I().optional().describe(`Field to sum at top of column (e.g. amount)`),columns:B(I()).describe(`Fields to show on cards`)})),qm=K(()=>V({chartType:W([`bar`,`line`,`pie`,`area`,`scatter`]).default(`bar`).describe(`Chart visualisation type`),xAxisField:I().describe(`Field used as the X axis / category dimension`),yAxisFields:B(I()).min(1).describe(`Field(s) used as the Y axis / measures`),aggregation:W([`sum`,`avg`,`count`,`min`,`max`]).optional().describe(`Aggregation function applied to Y axis fields`),groupByField:I().optional().describe(`Optional field used to split / stack the chart`)}).describe(`List chart view configuration`)),Jm=K(()=>V({startDateField:I(),endDateField:I().optional(),titleField:I(),colorField:I().optional()})),Ym=K(()=>V({startDateField:I(),endDateField:I(),titleField:I(),progressField:I().optional(),dependenciesField:I().optional()})),Xm=K(()=>W([`page`,`drawer`,`modal`,`split`,`popover`,`new_window`,`none`])),Zm=K(()=>V({mode:Xm.default(`page`),view:I().optional().describe(`Name of the form view to use for details (e.g. "summary_view", "edit_form")`),preventNavigation:R().default(!1).describe(`Disable standard navigation entirely`),openNewTab:R().default(!1).describe(`Force open in new tab (applies to page mode)`),width:H([I(),L()]).optional().describe(`Width of the drawer/modal (e.g. "600px", "50%")`)})),Qm=K(()=>V({name:Ep.optional().describe(`Internal view name (lowercase snake_case)`),label:rm.optional(),type:W([`grid`,`kanban`,`gallery`,`calendar`,`timeline`,`gantt`,`map`,`chart`]).default(`grid`),data:Om.optional().describe(`Data source configuration (defaults to "object" provider)`),columns:H([B(I()),B(jm)]).describe(`Fields to display as columns`),filter:B(km).optional().describe(`Filter criteria (JSON Rules)`),sort:H([I(),B(V({field:I(),order:W([`asc`,`desc`])}))]).optional(),searchableFields:B(I()).optional().describe(`Fields enabled for search`),filterableFields:B(I()).optional().describe(`Fields enabled for end-user filtering in the top bar`),resizable:R().optional().describe(`Enable column resizing`),striped:R().optional().describe(`Striped row styling`),bordered:R().optional().describe(`Show borders`),compactToolbar:R().optional().describe(`Collapse Group/Color/Density/Hide-fields into a single View settings popover`),selection:Mm.optional().describe(`Row selection configuration`),navigation:Zm.optional().describe(`Configuration for item click navigation (page, drawer, modal, etc.)`),pagination:Nm.optional().describe(`Pagination configuration`),kanban:Km.optional(),calendar:Jm.optional(),gantt:Ym.optional(),gallery:Lm.optional(),timeline:Rm.optional(),chart:qm.optional(),description:rm.optional().describe(`View description for documentation/tooltips`),sharing:zm.optional().describe(`View sharing and access configuration`),rowHeight:Pm.optional().describe(`Row height / density setting`),grouping:Im.optional().describe(`Group records by one or more fields`),rowColor:Bm.optional().describe(`Color rows based on field value`),hiddenFields:B(I()).optional().describe(`Fields to hide in this specific view`),fieldOrder:B(I()).optional().describe(`Explicit field display order for this view`),rowActions:B(I()).optional().describe(`Actions available for individual row items`),bulkActions:B(I()).optional().describe(`Actions available when multiple rows are selected`),bulkActionDefs:B(U(I(),Xd())).optional().describe(`Rich bulk action definitions (schema-driven, executed via BulkActionDialog)`),virtualScroll:R().optional().describe(`Enable virtual scrolling for large datasets`),conditionalFormatting:B(V({condition:Ap.describe(`Predicate (CEL) to evaluate.`),style:U(I(),I()).describe(`CSS styles to apply when condition is true`)})).optional().describe(`Conditional formatting rules for list rows`),inlineEdit:R().optional().describe(`Allow inline editing of records directly in the list view`),exportOptions:B(W([`csv`,`xlsx`,`pdf`,`json`])).optional().describe(`Available export format options`),userActions:Hm.optional().describe(`User action toggles for the view toolbar`),appearance:Um.optional().describe(`Appearance and visualization configuration`),tabs:B(Wm).optional().describe(`Tab definitions for multi-tab view interface`),addRecord:Gm.optional().describe(`Add record entry point configuration`),showRecordCount:R().optional().describe(`Show record count at the bottom of the list`),allowPrinting:R().optional().describe(`Allow users to print the view`),emptyState:V({title:rm.optional(),message:rm.optional(),icon:I().optional()}).optional().describe(`Empty state configuration when no records found`),aria:im.optional().describe(`ARIA accessibility attributes for the list view`),responsive:Cm.optional().describe(`Responsive layout configuration`),performance:wm.optional().describe(`Performance optimization settings`)})),$m=K(()=>V({field:I().describe(`Field name (snake_case)`),type:Rp.optional().describe(`Field type (auto-infers widget if omitted)`),options:B(zp).optional().describe(`Options for select/multiselect/radio/checkboxes fields`),reference:I().optional().describe(`Target object name for lookup/master_detail fields`),maxLength:L().optional().describe(`Maximum character length (for text/textarea/email/url/phone)`),minLength:L().optional().describe(`Minimum character length`),min:L().optional().describe(`Minimum value (for number/currency/percent/slider)`),max:L().optional().describe(`Maximum value`),precision:L().optional().describe(`Total digits (for number/currency)`),scale:L().optional().describe(`Decimal places`),multiple:R().optional().describe(`Allow multiple values (for select/lookup/file/image)`),label:rm.optional().describe(`Display label override`),placeholder:rm.optional().describe(`Placeholder text`),helpText:rm.optional().describe(`Help/hint text`),readonly:R().optional().describe(`Read-only override`),immutable:R().optional().describe(`Editable on create, locked once the record exists (e.g. machine names).`),required:R().optional().describe(`Required override`),hidden:R().optional().describe(`Hidden override`),colSpan:L().int().min(1).max(4).optional().describe(`Column span in grid layout (1-4)`),widget:I().optional().describe(`Custom widget/component name (overrides type-based inference)`),language:I().optional().describe(`Code editor language (for type=code)`),fields:B(Rf(()=>$m)).optional().describe(`Sub-fields for composite/repeater/record types`),keyField:V({field:I().default(`name`).describe(`Property name that holds the key inside each item (defaults to "name")`),label:rm.optional().describe(`Display label for the key column`),placeholder:rm.optional().describe(`Placeholder when entering a new key`),helpText:rm.optional().describe(`Help text under the key input`),regex:I().optional().describe(`JS regex source string the key must match (no flags)`),immutable:R().default(!0).describe(`If true, the key is read-only after creation`)}).optional().describe(`Key column config for record-typed fields`),dependsOn:I().optional().describe(`Parent field name for cascading`),visibleOn:Ap.optional().describe(`Visibility predicate (CEL).`)})),eh=K(()=>V({name:I().optional().describe(`Stable section identifier for i18n lookup (snake_case)`),label:rm.optional(),description:I().optional().describe(`Optional description rendered under the section header.`),collapsible:R().default(!1),collapsed:R().default(!1),visibleOn:Ap.optional().describe(`Visibility predicate (CEL). Hides the whole section when false.`),columns:H([W([`1`,`2`,`3`,`4`]),G(1),G(2),G(3),G(4)]).default(1).transform(e=>typeof e==`string`?parseInt(e):e),fields:B(H([I(),$m]))})),th=K(()=>V({type:W([`simple`,`tabbed`,`wizard`,`split`,`drawer`,`modal`]).default(`simple`),data:Om.optional().describe(`Data source configuration (defaults to "object" provider)`),sections:B(eh).optional(),groups:B(eh).optional(),defaultSort:B(V({field:I().describe(`Field name to sort by`),order:W([`asc`,`desc`]).default(`desc`).describe(`Sort direction`)})).optional().describe(`Default sort order for related list views within this form`),sharing:ym.optional().describe(`Public sharing configuration for this form`),submitBehavior:H([V({kind:G(`thank-you`),title:I().optional(),message:I().optional()}),V({kind:G(`redirect`),url:I(),delayMs:L().int().min(0).optional()}),V({kind:G(`continue`)}),V({kind:G(`next-record`)})]).optional().describe(`Post-submit behavior`),aria:im.optional().describe(`ARIA accessibility attributes for the form view`)}));K(()=>V({list:Qm.optional(),form:th.optional(),listViews:U(I(),Qm).optional().describe(`Additional named list views`),formViews:U(I(),th).optional().describe(`Additional named form views`),protection:vm.optional().describe(`Package author protection block — lock policy for this view.`),..._m}));var nh=I().regex(/^[a-z][a-z0-9_]*(\.[a-z][a-z0-9_]*)+$/,`View item name must be a dotted snake_case qualified name, e.g. "crm_lead.pipeline".`).describe("Globally-unique view id, `<object>.<viewKey>`."),rh=W([`package`,`shared`,`personal`]).describe(`View identity layer: package | shared | personal.`);W([`list`,`form`]).describe("Whether `config` is a ListView (list family) or a FormView.");function ih(){return{name:nh,object:I().describe(`Bound object name — the foreign key used to aggregate views.`),label:rm.optional().describe(`Display label (supports i18n).`),isDefault:R().optional().describe(`Whether this is the object's default view in the switcher.`),order:L().int().optional().describe(`Sort order within the object's view switcher / left rail.`),scope:rh.optional().describe("Identity layer (defaults to `package` for source-loaded views)."),owner:I().optional().describe("Owner user id — set when `scope` is `personal`."),hidden:R().optional().describe(`Hidden from the switcher (per-user / per-org declutter).`),protection:vm.optional().describe(`Package author protection block — lock policy for this view.`),..._m}}K(()=>lf(`viewKind`,[V({viewKind:G(`list`),config:Qm.describe(`List-family view configuration.`),...ih()}),V({viewKind:G(`form`),config:th.describe(`Form view configuration.`),...ih()})]));function ah(e){let{schemaId:t,...n}=e;return th.parse({...n,data:{provider:`schema`,schemaId:t}})}var oh=W([`get`,`list`,`create`,`update`,`delete`,`upsert`,`bulk`,`aggregate`,`history`,`search`,`restore`,`purge`,`import`,`export`]),sh=V({trackHistory:R().default(!1).describe(`Enable field history tracking for audit compliance`),searchable:R().default(!0).describe(`Index records for global search`),apiEnabled:R().default(!0).describe(`Expose object via automatic APIs`),apiMethods:B(oh).optional().describe(`Whitelist of allowed API operations`),files:R().default(!1).describe(`Enable file attachments and document management`),feeds:R().default(!1).describe(`Enable social feed, comments, and mentions (Chatter-like)`),activities:R().default(!1).describe(`Enable standard tasks and events tracking`),trash:R().default(!0).describe(`Enable soft-delete with restore capability`),mru:R().default(!0).describe(`Track Most Recently Used (MRU) list for users`),clone:R().default(!0).describe(`Allow record deep cloning`)}),ch=K(()=>V({name:I().optional().describe(`Index name (auto-generated if not provided)`),fields:B(I()).describe(`Fields included in the index`),type:W([`btree`,`hash`,`gin`,`gist`,`fulltext`]).optional().default(`btree`).describe(`Index algorithm type`),unique:R().optional().default(!1).describe(`Whether the index enforces uniqueness`),partial:I().optional().describe(`Partial index condition (SQL WHERE clause for conditional indexes)`)})),lh=K(()=>V({fields:B(I()).describe(`Fields to index for full-text search weighting`),displayFields:B(I()).optional().describe(`Fields to display in search result cards`),filters:B(I()).optional().describe(`Default filters for search results`)})),uh=K(()=>V({enabled:R().describe(`Enable multi-tenancy for this object`),strategy:W([`shared`,`isolated`,`hybrid`]).describe(`Tenant isolation strategy: shared (single DB, row-level), isolated (separate DB per tenant), hybrid (mix)`),tenantField:I().default(`tenant_id`).describe(`Field name for tenant identifier`),crossTenantAccess:R().default(!1).describe(`Allow cross-tenant data access (with explicit permission)`)})),dh=K(()=>V({enabled:R().describe(`Enable soft delete (trash/recycle bin)`),field:I().default(`deleted_at`).describe(`Field name for soft delete timestamp`),cascadeDelete:R().default(!1).describe(`Cascade soft delete to related records`)})),fh=K(()=>V({enabled:R().describe(`Enable record versioning`),strategy:W([`snapshot`,`delta`,`event-sourcing`]).describe(`Versioning strategy: snapshot (full copy), delta (changes only), event-sourcing (event log)`),retentionDays:L().min(1).optional().describe(`Number of days to retain old versions (undefined = infinite)`),versionField:I().default(`version`).describe(`Field name for version number/timestamp`)})),ph=K(()=>V({enabled:R().describe(`Enable table partitioning`),strategy:W([`range`,`hash`,`list`]).describe(`Partitioning strategy: range (date ranges), hash (consistent hashing), list (predefined values)`),key:I().describe(`Field name to partition by`),interval:I().optional().describe(`Partition interval for range strategy (e.g., "1 month", "1 year")`)}).refine(e=>!(e.strategy===`range`&&!e.interval),{message:`interval is required when strategy is "range"`})),mh=K(()=>V({enabled:R().describe(`Enable Change Data Capture`),events:B(W([`insert`,`update`,`delete`])).describe(`Event types to capture`),destination:I().describe(`Destination endpoint (e.g., "kafka://topic", "webhook://url")`)})),hh=K(()=>V({key:I().regex(/^[a-z_][a-z0-9_]*$/,{message:`Field group key must be lowercase snake_case (e.g., "contact_info", "billing", "system")`}).describe(`Group machine key (snake_case). Referenced by Field.group.`),label:I().describe(`Group display label`),icon:I().optional().describe(`Icon name (Lucide/Material) for the group header`),description:I().optional().describe(`Optional description shown under the group header`),defaultExpanded:R().optional().default(!0).describe(`Whether the group is expanded by default`),visibleOn:Ap.optional().describe(`Visibility predicate (CEL); group is hidden when FALSE.`)})),gh=V({remoteName:I().optional().describe(`Remote table/view name. Defaults to object.name.`),remoteSchema:I().optional().describe(`Remote schema/database qualifier.`),writable:R().default(!1).describe(`Per-object write opt-in (also requires datasource.external.allowWrites).`),columnMap:U(I(),I()).optional().describe(`Remote column name → local field name.`),introspectedAt:I().datetime().optional().describe("Set by `os datasource introspect`; informational."),ignoreColumns:B(I()).optional().describe(`Remote columns to skip during validation (dev convenience).`)}).describe(`External datasource binding (ADR-0015)`),_h=V({name:I().regex(/^[a-z_][a-z0-9_]*$/).describe(`Machine unique key (snake_case). Immutable.`),label:I().optional().describe(`Human readable singular label (e.g. "Account")`),pluralLabel:I().optional().describe(`Human readable plural label (e.g. "Accounts")`),description:I().optional().describe(`Developer documentation / description`),icon:I().optional().describe(`Icon name (Lucide/Material) for UI representation`),tags:B(I()).optional().describe(`Categorization tags (e.g. "sales", "system", "reference")`),active:R().optional().default(!0).describe(`Is the object active and usable`),isSystem:R().optional().default(!1).describe(`Is system object (protected from deletion)`),abstract:R().optional().default(!1).describe(`Is abstract base object (cannot be instantiated)`),managedBy:W([`platform`,`config`,`system`,`append-only`,`better-auth`]).optional().describe(`Lifecycle bucket — platform (user CRUD) | config (admin authored) | system (engine-managed) | append-only (audit) | better-auth (identity). UI clients honour the resolved affordance matrix.`),userActions:V({create:R().optional().describe(`Show generic "New" button.`),import:R().optional().describe(`Show CSV import wizard entry.`),edit:R().optional().describe(`Allow inline / form edit of existing rows.`),delete:R().optional().describe(`Show row-level delete + bulk delete.`),exportCsv:R().optional().describe(`Show CSV export entry.`)}).optional().describe(`Per-object override of the resolved CRUD affordance matrix.`),systemFields:H([G(!1),V({tenant:R().optional().describe(`Inject organization_id (multi-tenant only). Default true.`),owner:R().optional().describe(`Reserved for future owner_id auto-injection.`),audit:R().optional().describe(`Reserved for future created_by/updated_by auto-injection.`)})]).optional().describe(`Opt out of, or selectively disable, registry-level system-field auto-injection.`),datasource:I().optional().default(`default`).describe(`Target Datasource ID. "default" is the primary DB.`),external:gh.optional().describe(`Remote table binding for federated (external) objects.`),fields:U(I().regex(/^[a-z_][a-z0-9_]*$/,{message:`Field names must be lowercase snake_case (e.g., "first_name", "company", "annual_revenue")`}),Gp).describe(`Field definitions map. Keys must be snake_case identifiers.`),indexes:B(ch).optional().describe(`Database performance indexes`),fieldGroups:B(hh).refine(e=>new Set(e.map(e=>e.key)).size===e.length,{message:`fieldGroups[].key must be unique within an object`}).optional().describe(`Ordered list of field groups (array order = display order). See ObjectFieldGroupSchema.`),tenancy:uh.optional().describe(`Multi-tenancy configuration for SaaS applications`),softDelete:dh.optional().describe(`Soft delete (trash/recycle bin) configuration`),versioning:fh.optional().describe(`Record versioning and history tracking configuration`),partitioning:ph.optional().describe(`Table partitioning configuration for performance`),cdc:mh.optional().describe(`Change Data Capture (CDC) configuration for real-time data streaming`),validations:B(tm).optional().describe(`Object-level validation rules`),displayNameField:I().optional().describe(`Field to use as the record display name (e.g., "name", "title"). Defaults to "name" if present.`),recordName:V({type:W([`text`,`autonumber`]).describe(`Record name type: text (user-entered) or autonumber (system-generated)`),displayFormat:I().optional().describe(`Auto-number format pattern (e.g., "CASE-{0000}", "INV-{YYYY}-{0000}")`),startNumber:L().int().min(0).optional().describe(`Starting number for autonumber (default: 1)`)}).optional().describe(`Record name generation configuration (Salesforce pattern)`),titleFormat:jp.optional().describe(`Title template — supports {{record.field}} interpolation. Overrides displayNameField.`),compactLayout:B(I()).optional().describe(`Primary fields for hover/cards/lookups`),listViews:U(I(),Qm).optional().describe(`Built-in named list views (segmented tabs) shipped with the object schema`),defaultDetailForm:I().optional().describe(`Name of the default FormView for record detail / edit screens`),search:lh.optional().describe(`Search engine configuration`),enable:sh.optional().describe(`Enabled system features modules`),recordTypes:B(I()).optional().describe(`Record type names for this object`),sharingModel:W([`private`,`read`,`read_write`,`full`]).optional().describe(`Default sharing model`),publicSharing:V({enabled:R().default(!1).describe(`Allow records of this object to be published via share link`),allowedAudiences:B(W([`public`,`link_only`,`signed_in`,`email`])).optional().describe(`Audiences callers may select when creating a link`),allowedPermissions:B(W([`view`,`comment`,`edit`])).optional().describe(`Permission levels selectable on the share dialog`),maxExpiryDays:L().int().positive().optional().describe(`Reject links with expiry beyond this many days`),redactFields:B(I()).optional().describe(`Field names removed from records served via a share token`),eligibility:I().optional().describe(`CEL expression that must evaluate to true on the target record`)}).optional().describe(`Public share-link policy (Notion/Figma-style link sharing)`),keyPrefix:I().max(5).optional().describe(`Short prefix for record IDs (e.g., "001" for Account)`),detail:V({renderViaSchema:R().optional().describe(`Opt this object out of the schema-driven detail renderer`),hideReferenceRail:R().optional().describe(`Suppress the right-hand reference-rail on the detail page`),hideRelatedTab:R().optional().describe(`Suppress the Related tab on the detail page`)}).passthrough().optional().describe(`Detail-page UI hints consumed by @object-ui/plugin-detail synth`),actions:B(pm).optional().describe(`Actions associated with this object (auto-populated from top-level actions via objectName)`),protection:vm.optional().describe(`Package author protection block — lock policy for this object.`),..._m});function vh(e){return e.split(`_`).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}K(()=>Object.assign(_h,{create:e=>{let t={...e,label:e.label??vh(e.name)};return _h.parse(t)}})),W([`own`,`extend`]),K(()=>V({extend:I().describe(`Target object name (FQN) to extend`),fields:U(I(),Gp).optional().describe(`Fields to add/override`),label:I().optional().describe(`Override label for the extended object`),pluralLabel:I().optional().describe(`Override plural label for the extended object`),description:I().optional().describe(`Override description for the extended object`),validations:B(tm).optional().describe(`Additional validation rules to merge into the target object`),indexes:B(ch).optional().describe(`Additional indexes to merge into the target object`),priority:L().int().min(0).max(999).default(200).describe(`Merge priority (higher = applied later)`)}));var yh=W([`beforeFind`,`afterFind`,`beforeFindOne`,`afterFindOne`,`beforeCount`,`afterCount`,`beforeAggregate`,`afterAggregate`,`beforeInsert`,`afterInsert`,`beforeUpdate`,`afterUpdate`,`beforeDelete`,`afterDelete`,`beforeUpdateMany`,`afterUpdateMany`,`beforeDeleteMany`,`afterDeleteMany`]);K(()=>V({name:I().regex(/^[a-z_][a-z0-9_]*$/).describe(`Hook unique name (snake_case)`),label:I().optional().describe(`Description of what this hook does`),object:H([I(),B(I())]).describe(`Target object(s)`),events:B(yh).describe(`Lifecycle events`),handler:H([I(),Wf(e=>typeof e==`function`,{message:`Expected function`})]).optional().describe("Handler function name (string, post-build) or inline function (pre-build) — DEPRECATED, prefer `body`"),body:cm.optional().describe(`Hook body — expression (L1) or sandboxed JS (L2)`),priority:L().default(100).describe(`Execution priority`),async:R().default(!1).describe(`Run specifically as fire-and-forget`),condition:Ap.optional().describe('Predicate (CEL); hook runs only when TRUE. e.g. P`record.status == "closed" && record.amount > 1000`'),description:I().optional().describe(`Human-readable description of what this hook does`),retryPolicy:V({maxRetries:L().default(3).describe(`Maximum retry attempts on failure`),backoffMs:L().default(1e3).describe(`Backoff delay between retries in milliseconds`)}).optional().describe(`Retry policy for failed hook executions`),timeout:L().optional().describe(`Maximum execution time in milliseconds before the hook is aborted`),onError:W([`abort`,`log`]).default(`abort`).describe(`Error handling strategy`)})),K(()=>V({id:I().optional().describe(`Unique execution ID for tracing`),object:I(),event:yh,input:U(I(),z()).describe(`Mutable input parameters`),result:z().optional().describe(`Operation result (After hooks only)`),previous:U(I(),z()).optional().describe(`Record state before operation`),session:V({userId:I().optional(),tenantId:I().optional(),roles:B(I()).optional(),accessToken:I().optional(),isSystem:R().optional().describe(`True when the call was made with an elevated system context (engine self-writes)`)}).optional().describe(`Current session context`),transaction:z().optional().describe(`Database transaction handle`),ql:z().describe(`ObjectQL Engine Reference`),api:z().optional().describe(`Cross-object data access (ScopedContext)`),user:V({id:I().optional(),name:I().optional(),email:I().optional()}).optional().describe(`Current user info shortcut`)}));var bh=W([`none`,`constant`,`lookup`,`split`,`join`,`javascript`,`map`]),xh=K(()=>V({source:H([I(),B(I())]).describe(`Source column header(s)`),target:H([I(),B(I())]).describe(`Target object field(s)`),transform:bh.default(`none`),params:V({value:z().optional(),object:I().optional(),fromField:I().optional(),toField:I().optional(),autoCreate:R().optional(),valueMap:U(I(),z()).optional(),separator:I().optional()}).optional()}));K(()=>V({name:Ep.describe(`Mapping unique name (lowercase snake_case)`),label:I().optional(),sourceFormat:W([`csv`,`json`,`xml`,`sql`]).default(`csv`),targetObject:I().describe(`Target Object Name`),fieldMapping:B(xh),mode:W([`insert`,`update`,`upsert`]).default(`insert`),upsertKey:B(I()).optional().describe(`Fields to match for upsert (e.g. email)`),extractQuery:gp.optional().describe(`Query to run for export only`),errorPolicy:W([`skip`,`abort`,`retry`]).default(`skip`),batchSize:L().default(1e3)}));var Sh=K(()=>V({userId:I().optional(),tenantId:I().optional(),roles:B(I()).default([]),permissions:B(I()).default([]),systemPermissions:B(I()).optional(),tabPermissions:U(I(),W([`visible`,`hidden`,`default_on`,`default_off`])).optional(),org_user_ids:B(I()).optional(),isSystem:R().default(!1),accessToken:I().optional(),transaction:z().optional(),traceId:I().optional()})),Ch=K(()=>H([U(I(),z()),Xf]).describe(`Data Engine query filter conditions`)),wh=K(()=>H([U(I(),W([`asc`,`desc`])),U(I(),H([G(1),G(-1)])),B(np)]).describe(`Sort order definition`)),Th=K(()=>V({context:Sh.optional()})),Eh=K(()=>Th.extend({where:H([U(I(),z()),Xf]).optional(),fields:B(pp).optional(),orderBy:B(np).optional(),limit:L().optional(),offset:L().optional(),top:L().optional(),cursor:U(I(),z()).optional(),search:mp.optional(),expand:Rf(()=>U(I(),gp)).optional(),distinct:R().optional()}).describe(`QueryAST-aligned query options for IDataEngine.find() operations`));K(()=>Th.extend({filter:Ch.optional(),select:B(I()).optional(),sort:wh.optional(),limit:L().int().min(1).optional(),skip:L().int().min(0).optional(),top:L().int().min(1).optional(),populate:B(I()).optional()}).describe(`Query options for IDataEngine.find() operations`));var Dh=K(()=>Th.extend({returning:R().default(!0).optional()}).describe(`Options for DataEngine.insert operations`)),Oh=K(()=>Th.extend({where:H([U(I(),z()),Xf]).optional(),upsert:R().default(!1).optional(),multi:R().default(!1).optional(),returning:R().default(!1).optional()}).describe(`QueryAST-aligned options for DataEngine.update operations`));K(()=>Th.extend({filter:Ch.optional(),upsert:R().default(!1).optional(),multi:R().default(!1).optional(),returning:R().default(!1).optional()}).describe(`Options for DataEngine.update operations`));var kh=K(()=>Th.extend({where:H([U(I(),z()),Xf]).optional(),multi:R().default(!1).optional()}).describe(`QueryAST-aligned options for DataEngine.delete operations`));K(()=>Th.extend({filter:Ch.optional(),multi:R().default(!1).optional()}).describe(`Options for DataEngine.delete operations`));var Ah=K(()=>Th.extend({where:H([U(I(),z()),Xf]).optional(),groupBy:B(I()).optional(),aggregations:B(op).optional()}).describe(`QueryAST-aligned options for DataEngine.aggregate operations`));K(()=>Th.extend({filter:Ch.optional(),groupBy:B(I()).optional(),aggregations:B(V({field:I(),method:W([`count`,`sum`,`avg`,`min`,`max`,`count_distinct`]),alias:I().optional()})).optional()}).describe(`Options for DataEngine.aggregate operations`));var jh=K(()=>Th.extend({where:H([U(I(),z()),Xf]).optional()}).describe(`QueryAST-aligned options for DataEngine.count operations`));K(()=>Th.extend({filter:Ch.optional()}).describe(`Options for DataEngine.count operations`)),K(()=>V({find:Hf().input(pf([I(),Eh.optional()])).output(Bf(B(z()))),findOne:Hf().input(pf([I(),Eh.optional()])).output(Bf(z())),insert:Hf().input(pf([I(),H([U(I(),z()),B(U(I(),z()))]),Dh.optional()])).output(Bf(z())),update:Hf().input(pf([I(),U(I(),z()),Oh.optional()])).output(Bf(z())),delete:Hf().input(pf([I(),kh.optional()])).output(Bf(z())),count:Hf().input(pf([I(),jh.optional()])).output(Bf(L())),aggregate:Hf().input(pf([I(),Ah])).output(Bf(B(z())))}).describe(`Standard Data Engine Contract`));var Mh={filter:Ch.optional()},Nh=Eh.extend({...Mh,select:B(I()).optional(),sort:wh.optional(),skip:L().int().min(0).optional(),populate:B(I()).optional()}),Ph=K(()=>V({method:G(`find`),object:I(),query:Nh.optional()})),Fh=K(()=>V({method:G(`findOne`),object:I(),query:Nh.optional()})),Ih=K(()=>V({method:G(`insert`),object:I(),data:H([U(I(),z()),B(U(I(),z()))]),options:Dh.optional()})),Lh=K(()=>V({method:G(`update`),object:I(),data:U(I(),z()),id:H([I(),L()]).optional().describe(`ID for single update, or use where in options`),options:Oh.extend(Mh).optional()})),Rh=K(()=>V({method:G(`delete`),object:I(),id:H([I(),L()]).optional().describe(`ID for single delete, or use where in options`),options:kh.extend(Mh).optional()})),zh=K(()=>V({method:G(`count`),object:I(),query:jh.extend(Mh).optional()})),Bh=K(()=>V({method:G(`aggregate`),object:I(),query:Ah.extend(Mh)})),Vh=K(()=>V({method:G(`execute`),command:z(),options:U(I(),z()).optional()})),Hh=K(()=>V({method:G(`vectorFind`),object:I(),vector:B(L()),where:H([U(I(),z()),Xf]).optional(),fields:B(I()).optional(),limit:L().int().default(5).optional(),threshold:L().optional()})),Uh=K(()=>V({method:G(`batch`),requests:B(lf(`method`,[Ph,Fh,Ih,Lh,Rh,zh,Bh,Vh,Hh])),transaction:R().default(!0).optional()}));K(()=>lf(`method`,[Ph,Fh,Ih,Lh,Rh,zh,Bh,Uh,Vh,Hh]).describe(`Virtual ObjectQL Request Protocol`)),W([`count`,`sum`,`avg`,`min`,`max`,`count_distinct`,`percentile`,`median`,`stddev`,`variance`]).describe(`Standard aggregation functions`);var Wh=W([`asc`,`desc`]).describe(`Sort order direction`);K(()=>V({field:I().describe(`Field name to sort by`),order:Wh.describe(`Sort direction`)}).describe(`Sort field and direction pair`)),W([`insert`,`update`,`delete`,`upsert`]).describe(`Data mutation event types`);var Gh=W([`read_uncommitted`,`read_committed`,`repeatable_read`,`serializable`,`snapshot`]).describe(`Transaction isolation levels (snake_case standard)`);W([`lru`,`lfu`,`ttl`,`fifo`]).describe(`Cache eviction strategy`);var Kh=K(()=>V({transaction:z().optional().describe(`Transaction handle`),timeout:L().optional().describe(`Timeout in ms`),skipCache:R().optional().describe(`Bypass cache`),traceContext:U(I(),I()).optional().describe(`OpenTelemetry context or request ID`),tenantId:I().optional().describe(`Tenant Isolation identifier`)})),qh=K(()=>V({create:R().default(!0).describe(`Supports CREATE operations`),read:R().default(!0).describe(`Supports READ operations`),update:R().default(!0).describe(`Supports UPDATE operations`),delete:R().default(!0).describe(`Supports DELETE operations`),bulkCreate:R().default(!1).describe(`Supports bulk CREATE operations`),bulkUpdate:R().default(!1).describe(`Supports bulk UPDATE operations`),bulkDelete:R().default(!1).describe(`Supports bulk DELETE operations`),transactions:R().default(!1).describe(`Supports ACID transactions`),savepoints:R().default(!1).describe(`Supports transaction savepoints`),isolationLevels:B(Gh).optional().describe(`Supported isolation levels`),queryFilters:R().default(!0).describe(`Supports WHERE clause filtering`),queryAggregations:R().default(!1).describe(`Supports GROUP BY and aggregation functions`),queryDateGranularity:U(ip,R()).optional().describe(`Per-granularity native date bucketing (day/week/month/quarter/year). Missing keys fall back to in-memory bucketing.`),querySorting:R().default(!0).describe(`Supports ORDER BY sorting`),queryPagination:R().default(!0).describe(`Supports LIMIT/OFFSET pagination`),queryWindowFunctions:R().default(!1).describe(`Supports window functions with OVER clause`),querySubqueries:R().default(!1).describe(`Supports subqueries`),queryCTE:R().default(!1).describe(`Supports Common Table Expressions (WITH clause)`),joins:R().default(!1).describe(`Supports SQL joins`),fullTextSearch:R().default(!1).describe(`Supports full-text search`),jsonQuery:R().default(!1).describe(`Supports JSON field querying`),geospatialQuery:R().default(!1).describe(`Supports geospatial queries`),streaming:R().default(!1).describe(`Supports result streaming (cursors/iterators)`),jsonFields:R().default(!1).describe(`Supports JSON field types`),arrayFields:R().default(!1).describe(`Supports array field types`),vectorSearch:R().default(!1).describe(`Supports vector embeddings and similarity search`),schemaSync:R().default(!1).describe(`Supports automatic schema synchronization`),batchSchemaSync:R().default(!1).describe(`Supports batched schema sync to reduce schema DDL round-trips`),migrations:R().default(!1).describe(`Supports database migrations`),indexes:R().default(!1).describe(`Supports index creation and management`),connectionPooling:R().default(!1).describe(`Supports connection pooling`),preparedStatements:R().default(!1).describe(`Supports prepared statements (SQL injection prevention)`),queryCache:R().default(!1).describe(`Supports query result caching`)}));K(()=>V({name:I().describe(`Driver unique name`),version:I().describe(`Driver version`),supports:qh,connect:Hf().input(pf([])).output(Bf(tf())).describe(`Establish connection`),disconnect:Hf().input(pf([])).output(Bf(tf())).describe(`Close connection`),checkHealth:Hf().input(pf([])).output(Bf(R())).describe(`Health check`),getPoolStats:Hf().input(pf([])).output(V({total:L(),idle:L(),active:L(),waiting:L()}).optional()).optional().describe(`Get connection pool statistics`),execute:Hf().input(pf([z(),B(z()).optional(),Kh.optional()])).output(Bf(z())).describe(`Execute raw command`),find:Hf().input(pf([I(),gp,Kh.optional()])).output(Bf(B(U(I(),z())))).describe(`Find records`),findStream:Hf().input(pf([I(),gp,Kh.optional()])).output(z()).describe(`Stream records (AsyncIterable)`),findOne:Hf().input(pf([I(),gp,Kh.optional()])).output(Bf(U(I(),z()).nullable())).describe(`Find one record`),create:Hf().input(pf([I(),U(I(),z()),Kh.optional()])).output(Bf(U(I(),z()))).describe(`Create record`),update:Hf().input(pf([I(),I().or(L()),U(I(),z()),Kh.optional()])).output(Bf(U(I(),z()))).describe(`Update record`),upsert:Hf().input(pf([I(),U(I(),z()),B(I()).optional(),Kh.optional()])).output(Bf(U(I(),z()))).describe(`Upsert record`),delete:Hf().input(pf([I(),I().or(L()),Kh.optional()])).output(Bf(R())).describe(`Delete record`),count:Hf().input(pf([I(),gp.optional(),Kh.optional()])).output(Bf(L())).describe(`Count records`),bulkCreate:Hf().input(pf([I(),B(U(I(),z())),Kh.optional()])).output(Bf(B(U(I(),z())))),bulkUpdate:Hf().input(pf([I(),B(V({id:I().or(L()),data:U(I(),z())})),Kh.optional()])).output(Bf(B(U(I(),z())))),bulkDelete:Hf().input(pf([I(),B(I().or(L())),Kh.optional()])).output(Bf(tf())),updateMany:Hf().input(pf([I(),gp,U(I(),z()),Kh.optional()])).output(Bf(L())).optional(),deleteMany:Hf().input(pf([I(),gp,Kh.optional()])).output(Bf(L())).optional(),beginTransaction:Hf().input(pf([V({isolationLevel:Gh.optional()}).optional()])).output(Bf(z())).describe(`Start transaction`),commit:Hf().input(pf([z()])).output(Bf(tf())).describe(`Commit transaction`),rollback:Hf().input(pf([z()])).output(Bf(tf())).describe(`Rollback transaction`),syncSchema:Hf().input(pf([I(),z(),Kh.optional()])).output(Bf(tf())).describe(`Sync object schema to DB`),syncSchemasBatch:Hf().input(pf([B(V({object:I(),schema:z()})),Kh.optional()])).output(Bf(tf())).optional().describe(`Batch sync multiple schemas in one round-trip`),dropTable:Hf().input(pf([I(),Kh.optional()])).output(Bf(tf())),explain:Hf().input(pf([I(),gp,Kh.optional()])).output(Bf(z())).optional()}));var Jh=K(()=>V({min:L().min(0).default(2).describe(`Minimum number of connections in pool`),max:L().min(1).default(10).describe(`Maximum number of connections in pool`),idleTimeoutMillis:L().min(0).default(3e4).describe(`Time in ms before idle connection is closed`),connectionTimeoutMillis:L().min(0).default(5e3).describe(`Time in ms to wait for available connection`)})),Yh=K(()=>V({name:I().describe(`Driver instance name`),type:W([`sql`,`nosql`,`cache`,`search`,`graph`,`timeseries`]).describe(`Driver type category`),capabilities:qh.describe(`Driver capability flags`),connectionString:I().optional().describe(`Database connection string (driver-specific format)`),poolConfig:Jh.optional().describe(`Connection pool configuration`)})),Xh=K(()=>W([`postgresql`,`mysql`,`sqlite`,`mssql`,`oracle`,`mariadb`])),Zh=K(()=>V({text:I().describe(`SQL type for text fields (e.g., VARCHAR, TEXT)`),number:I().describe(`SQL type for number fields (e.g., NUMERIC, DECIMAL, INT)`),boolean:I().describe(`SQL type for boolean fields (e.g., BOOLEAN, BIT)`),date:I().describe(`SQL type for date fields (e.g., DATE)`),datetime:I().describe(`SQL type for datetime fields (e.g., TIMESTAMP, DATETIME)`),json:I().optional().describe(`SQL type for JSON fields (e.g., JSON, JSONB)`),uuid:I().optional().describe(`SQL type for UUID fields (e.g., UUID, CHAR(36))`),binary:I().optional().describe(`SQL type for binary fields (e.g., BLOB, BYTEA)`)})),Qh=K(()=>V({rejectUnauthorized:R().default(!0).describe(`Reject connections with invalid certificates`),ca:I().optional().describe(`CA certificate file path or content`),cert:I().optional().describe(`Client certificate file path or content`),key:I().optional().describe(`Client private key file path or content`)}).refine(e=>e.cert!==void 0==(e.key!==void 0),{message:`Client certificate (cert) and private key (key) must be provided together`}));K(()=>Yh.extend({type:G(`sql`).describe(`Driver type must be "sql"`),dialect:Xh.describe(`SQL database dialect`),dataTypeMapping:Zh.describe(`SQL data type mapping configuration`),ssl:R().default(!1).describe(`Enable SSL/TLS connection`),sslConfig:Qh.optional().describe(`SSL/TLS configuration (required when ssl is true)`)}).refine(e=>!(e.ssl&&!e.sslConfig),{message:`sslConfig is required when ssl is true`}));var $h=K(()=>W([`mongodb`,`couchdb`,`dynamodb`,`cassandra`,`redis`,`elasticsearch`,`neo4j`,`orientdb`]));K(()=>W([`find`,`findOne`,`insert`,`update`,`delete`,`aggregate`,`mapReduce`,`count`,`distinct`,`createIndex`,`dropIndex`]));var eg=K(()=>W([`all`,`quorum`,`one`,`local_quorum`,`each_quorum`,`eventual`])),tg=K(()=>W([`single`,`compound`,`unique`,`text`,`geospatial`,`hashed`,`ttl`,`sparse`])),ng=K(()=>V({enabled:R().default(!1).describe(`Enable sharding`),shardKey:I().optional().describe(`Field to use as shard key`),shardingStrategy:W([`hash`,`range`,`zone`]).optional().describe(`Sharding strategy`),numShards:L().int().positive().optional().describe(`Number of shards`)})),rg=K(()=>V({enabled:R().default(!1).describe(`Enable replication`),replicaSetName:I().optional().describe(`Replica set name`),replicas:L().int().positive().optional().describe(`Number of replicas`),readPreference:W([`primary`,`primaryPreferred`,`secondary`,`secondaryPreferred`,`nearest`]).optional().describe(`Read preference for replica set`),writeConcern:W([`majority`,`acknowledged`,`unacknowledged`]).optional().describe(`Write concern level`)})),ig=K(()=>V({enabled:R().default(!1).describe(`Enable schema validation`),validationLevel:W([`strict`,`moderate`,`off`]).optional().describe(`Validation strictness`),validationAction:W([`error`,`warn`]).optional().describe(`Action on validation failure`),jsonSchema:U(I(),z()).optional().describe(`JSON Schema for validation`)})),ag=K(()=>V({text:I().describe(`NoSQL type for text fields`),number:I().describe(`NoSQL type for number fields`),boolean:I().describe(`NoSQL type for boolean fields`),date:I().describe(`NoSQL type for date fields`),datetime:I().describe(`NoSQL type for datetime fields`),json:I().optional().describe(`NoSQL type for JSON/object fields`),uuid:I().optional().describe(`NoSQL type for UUID fields`),binary:I().optional().describe(`NoSQL type for binary fields`),array:I().optional().describe(`NoSQL type for array fields`),objectId:I().optional().describe(`NoSQL type for ObjectID fields (MongoDB)`),geopoint:I().optional().describe(`NoSQL type for geospatial point fields`)}));K(()=>Yh.extend({type:G(`nosql`).describe(`Driver type must be "nosql"`),databaseType:$h.describe(`Specific NoSQL database type`),dataTypeMapping:ag.describe(`NoSQL data type mapping configuration`),consistency:eg.optional().describe(`Consistency level for operations`),replication:rg.optional().describe(`Replication configuration`),sharding:ng.optional().describe(`Sharding configuration`),schemaValidation:ig.optional().describe(`Document schema validation`),region:I().optional().describe(`AWS region (for managed NoSQL services)`),accessKeyId:I().optional().describe(`AWS access key ID`),secretAccessKey:I().optional().describe(`AWS secret access key`),ttlField:I().optional().describe(`Field name for TTL (auto-deletion)`),maxDocumentSize:L().int().positive().optional().describe(`Maximum document size in bytes`),collectionPrefix:I().optional().describe(`Prefix for collection/table names`)}));var og=K(()=>V({consistency:eg.optional().describe(`Consistency level override`),readFromSecondary:R().optional().describe(`Allow reading from secondary replicas`),projection:U(I(),H([G(0),G(1)])).optional().describe(`Field projection`),timeout:L().int().positive().optional().describe(`Query timeout (ms)`),useCursor:R().optional().describe(`Use cursor instead of loading all results`),batchSize:L().int().positive().optional().describe(`Cursor batch size`),profile:R().optional().describe(`Enable query profiling`),hint:I().optional().describe(`Index hint for query optimization`)})),sg=K(()=>V({operator:I().describe(`Aggregation operator (e.g., $match, $group, $sort)`),options:U(I(),z()).describe(`Stage-specific options`)}));K(()=>V({collection:I().describe(`Collection/table name`),stages:B(sg).describe(`Aggregation pipeline stages`),options:og.optional().describe(`Query options`)})),K(()=>V({name:I().describe(`Index name`),type:tg.describe(`Index type`),fields:B(V({field:I().describe(`Field name`),order:W([`asc`,`desc`,`text`,`2dsphere`]).optional().describe(`Index order or type`)})).describe(`Fields to index`),unique:R().default(!1).describe(`Enforce uniqueness`),sparse:R().default(!1).describe(`Sparse index`),expireAfterSeconds:L().int().positive().optional().describe(`TTL in seconds`),partialFilterExpression:U(I(),z()).optional().describe(`Partial index filter`),background:R().default(!1).describe(`Create index in background`)})),K(()=>V({readConcern:W([`local`,`majority`,`linearizable`,`snapshot`]).optional().describe(`Read concern level`),writeConcern:W([`majority`,`acknowledged`,`unacknowledged`]).optional().describe(`Write concern level`),readPreference:W([`primary`,`primaryPreferred`,`secondary`,`secondaryPreferred`,`nearest`]).optional().describe(`Read preference`),maxCommitTimeMS:L().int().positive().optional().describe(`Transaction commit timeout (ms)`)}));var cg=W([`insert`,`update`,`upsert`,`replace`,`ignore`]),lg=K(()=>V({object:I().regex(/^[a-z_][a-z0-9_]*$/).describe(`Target Object Name`),externalId:I().default(`name`).describe(`Field match for uniqueness check`),mode:cg.default(`upsert`).describe(`Conflict resolution strategy`),env:B(W([`prod`,`dev`,`test`])).default([`prod`,`dev`,`test`]).describe(`Applicable environments`),records:B(U(I(),z())).describe(`Data records`)}));ah({schemaId:`object`,type:`simple`,sections:[{name:`basics`,label:`Basics`,description:`Identity, labels, and taxonomy.`,columns:2,fields:[{field:`name`,type:`text`,required:!0,immutable:!0,colSpan:1,helpText:`snake_case unique identifier (immutable after creation)`},{field:`label`,type:`text`,colSpan:1,helpText:`Singular display name (e.g. "Account")`},{field:`pluralLabel`,type:`text`,colSpan:1,helpText:`Plural display name (e.g. "Accounts")`},{field:`icon`,type:`text`,colSpan:1,helpText:`Lucide icon name (e.g. "building", "users")`},{field:`description`,type:`textarea`,colSpan:2,helpText:`Developer documentation`},{field:`tags`,type:`tags`,colSpan:2,helpText:`Categorization tags (e.g. "sales", "system")`},{field:`active`,type:`boolean`,colSpan:1,helpText:`Is the object active and usable`},{field:`isSystem`,type:`boolean`,colSpan:1,helpText:`System object (protected from deletion)`},{field:`abstract`,type:`boolean`,colSpan:1,helpText:`Abstract base (cannot be instantiated)`}]},{name:`fields`,label:`Fields`,description:`Define the data model — each entry becomes a column in the database table.`,fields:[{field:`fields`,type:`record`,required:!0,helpText:`Add the columns this object will store`,keyField:{field:`name`,label:`Name`,placeholder:`snake_case_identifier`,helpText:`snake_case machine name (used as column name and API key)`,regex:`^[a-z_][a-z0-9_]*$`,immutable:!0},fields:[{field:`label`,type:`text`,helpText:`Display label`},{field:`type`,type:`select`,required:!0,helpText:`Field type`,options:[{label:`Text`,value:`text`},{label:`Textarea`,value:`textarea`},{label:`Email`,value:`email`},{label:`URL`,value:`url`},{label:`Phone`,value:`phone`},{label:`Password`,value:`password`},{label:`Markdown`,value:`markdown`},{label:`HTML`,value:`html`},{label:`Rich Text`,value:`richtext`},{label:`Number`,value:`number`},{label:`Currency`,value:`currency`},{label:`Percent`,value:`percent`},{label:`Date`,value:`date`},{label:`Date & Time`,value:`datetime`},{label:`Time`,value:`time`},{label:`Boolean`,value:`boolean`},{label:`Toggle`,value:`toggle`},{label:`Select`,value:`select`},{label:`Multiselect`,value:`multiselect`},{label:`Radio`,value:`radio`},{label:`Checkboxes`,value:`checkboxes`},{label:`Lookup (reference)`,value:`lookup`},{label:`Master–Detail`,value:`master_detail`},{label:`Tree`,value:`tree`},{label:`Image`,value:`image`},{label:`File`,value:`file`},{label:`Avatar`,value:`avatar`},{label:`Video`,value:`video`},{label:`Audio`,value:`audio`},{label:`Formula (computed)`,value:`formula`},{label:`Summary (rollup)`,value:`summary`},{label:`Autonumber`,value:`autonumber`},{label:`Composite (embedded)`,value:`composite`},{label:`Repeater (embedded array)`,value:`repeater`},{label:`Record (keyed map)`,value:`record`},{label:`Location (GPS)`,value:`location`},{label:`Address`,value:`address`},{label:`Code`,value:`code`},{label:`JSON`,value:`json`},{label:`Color`,value:`color`},{label:`Rating`,value:`rating`},{label:`Slider`,value:`slider`},{label:`Signature`,value:`signature`},{label:`QR / Barcode`,value:`qrcode`},{label:`Progress`,value:`progress`},{label:`Tags`,value:`tags`},{label:`Vector embedding`,value:`vector`}]},{field:`description`,type:`textarea`,helpText:`Developer documentation for this column`},{field:`required`,type:`boolean`,helpText:`Must be set on every record`},{field:`unique`,type:`boolean`,helpText:`Disallow duplicate values`},{field:`indexed`,type:`boolean`,helpText:`Create a database index for faster querying`},{field:`readonly`,type:`boolean`,helpText:`Visible but never user-editable`},{field:`immutable`,type:`boolean`,helpText:`Editable on create, locked thereafter`},{field:`hidden`,type:`boolean`,helpText:`Hidden from default UI`},{field:`searchable`,type:`boolean`,helpText:`Include in full-text search`},{field:`sortable`,type:`boolean`,helpText:`Allow sorting on this column`},{field:`filterable`,type:`boolean`,helpText:`Allow filtering on this column`},{field:`defaultValue`,type:`text`,helpText:`Default value for new records (JSON literal)`},{field:`placeholder`,type:`text`,helpText:`Placeholder hint`},{field:`maxLength`,type:`number`,helpText:`Max characters`,visibleOn:`type in ['text','textarea','email','url','phone','password','markdown','html','richtext']`},{field:`minLength`,type:`number`,helpText:`Min characters`,visibleOn:`type in ['text','textarea','email','url','phone','password','markdown','html','richtext']`},{field:`min`,type:`number`,helpText:`Minimum value`,visibleOn:`type in ['number','currency','percent','rating','slider','progress']`},{field:`max`,type:`number`,helpText:`Maximum value`,visibleOn:`type in ['number','currency','percent','rating','slider','progress']`},{field:`precision`,type:`number`,helpText:`Total digits`,visibleOn:`type in ['number','currency','percent']`},{field:`scale`,type:`number`,helpText:`Decimal places`,visibleOn:`type in ['number','currency','percent']`},{field:`options`,type:`repeater`,helpText:`Available choices`,visibleOn:`type in ['select','multiselect','radio','checkboxes']`,fields:[{field:`label`,type:`text`,required:!0},{field:`value`,type:`text`,required:!0},{field:`color`,type:`color`},{field:`icon`,type:`text`,helpText:`Lucide icon name`},{field:`description`,type:`text`}]},{field:`reference`,type:`text`,helpText:`Target object name`,visibleOn:`type in ['lookup','master_detail','tree']`},{field:`referenceFilter`,type:`code`,language:`expression`,helpText:`CEL filter applied to the picker`,visibleOn:`type in ['lookup','master_detail']`},{field:`cascadeDelete`,type:`boolean`,helpText:`Delete children when parent is deleted`,visibleOn:`type == 'master_detail'`},{field:`multiple`,type:`boolean`,helpText:`Allow selecting multiple records`,visibleOn:`type in ['lookup']`},{field:`formula`,type:`code`,language:`expression`,helpText:`CEL formula expression`,visibleOn:`type == 'formula'`},{field:`returnType`,type:`select`,helpText:`Result type for formulas`,visibleOn:`type == 'formula'`,options:[{label:`Text`,value:`text`},{label:`Number`,value:`number`},{label:`Boolean`,value:`boolean`},{label:`Date`,value:`date`},{label:`Datetime`,value:`datetime`},{label:`Currency`,value:`currency`}]},{field:`summaryType`,type:`select`,helpText:`Aggregation`,visibleOn:`type == 'summary'`,options:[{label:`Count`,value:`count`},{label:`Sum`,value:`sum`},{label:`Avg`,value:`avg`},{label:`Min`,value:`min`},{label:`Max`,value:`max`}]},{field:`summaryField`,type:`text`,helpText:`Field on child object to aggregate`,visibleOn:`type == 'summary'`},{field:`displayFormat`,type:`text`,helpText:`e.g. "INV-{0000}"`,visibleOn:`type == 'autonumber'`},{field:`startingNumber`,type:`number`,helpText:`Starting sequence value`,visibleOn:`type == 'autonumber'`},{field:`language`,type:`text`,helpText:`Editor language (e.g. sql, javascript)`,visibleOn:`type == 'code'`},{field:`validation`,type:`code`,language:`expression`,helpText:`CEL predicate — must evaluate true`},{field:`errorMessage`,type:`text`,helpText:`Shown when validation fails`},{field:`audit`,type:`boolean`,helpText:`Audit changes to this field`},{field:`trackHistory`,type:`boolean`,helpText:`Keep change history`},{field:`pii`,type:`boolean`,helpText:`Personally identifiable information`},{field:`encrypted`,type:`boolean`,helpText:`Encrypt at rest`}]}]},{name:`capabilities`,label:`Capabilities`,description:`System features and API exposure.`,collapsible:!0,collapsed:!0,fields:[{field:`capabilities`,type:`composite`,helpText:`Enable/disable system features`,fields:[{field:`trackHistory`,type:`boolean`},{field:`searchable`,type:`boolean`},{field:`apiEnabled`,type:`boolean`},{field:`files`,type:`boolean`},{field:`feeds`,type:`boolean`},{field:`activities`,type:`boolean`},{field:`trash`,type:`boolean`},{field:`mru`,type:`boolean`},{field:`clone`,type:`boolean`}]}]},{name:`advanced`,label:`Advanced`,description:`State machines, actions, and storage.`,collapsible:!0,collapsed:!0,fields:[{field:`datasource`,type:`text`,helpText:`Target datasource ID (default: "default")`}]}]}),ah({schemaId:`field`,type:`simple`,sections:[{name:`basics`,label:`Basics`,description:`Core field identity and constraints.`,columns:2,fields:[{field:`name`,required:!0,immutable:!0,colSpan:1,helpText:`Unique identifier (snake_case, immutable after creation)`},{field:`label`,required:!0,colSpan:1,helpText:`Display name for users`},{field:`type`,required:!0,colSpan:1,helpText:`Data type of this field`},{field:`group`,colSpan:1,helpText:`Group name for form layout`},{field:`description`,widget:`textarea`,colSpan:2,helpText:`Help text shown to users`},{field:`required`,colSpan:1,helpText:`User must provide a value`},{field:`unique`,colSpan:1,helpText:`No two records can have the same value`},{field:`multiple`,colSpan:1,helpText:`Allow multiple values (for select/lookup)`}]},{name:`configuration`,label:`Configuration`,description:`Field-type specific settings (visible blocks depend on the chosen type).`,fields:[{field:`defaultValue`,helpText:`Default value for new records`},{field:`minLength`,visibleOn:`data.type == 'text' || data.type == 'textarea' || data.type == 'email'`,helpText:`Minimum character length`},{field:`maxLength`,visibleOn:`data.type == 'text' || data.type == 'textarea' || data.type == 'email'`,helpText:`Maximum character length`},{field:`min`,visibleOn:`data.type == 'number' || data.type == 'currency'`,helpText:`Minimum value`},{field:`max`,visibleOn:`data.type == 'number' || data.type == 'currency'`,helpText:`Maximum value`},{field:`precision`,visibleOn:`data.type == 'currency' || data.type == 'number'`,helpText:`Decimal places (e.g., 2 for $10.50)`},{field:`scale`,visibleOn:`data.type == 'number'`,helpText:`Number of decimal digits`},{field:`options`,type:`repeater`,visibleOn:`data.type == 'select' || data.type == 'multiselect'`,helpText:`Available options (label/value pairs)`},{field:`reference`,widget:`ref:object`,visibleOn:`data.type == 'lookup' || data.type == 'master_detail'`,helpText:`Referenced object name`},{field:`referenceFilters`,widget:`string-tags`,visibleOn:`data.type == 'lookup' || data.type == 'master_detail'`,helpText:`Filter expressions (e.g., "active = true")`},{field:`deleteBehavior`,visibleOn:`data.type == 'lookup' || data.type == 'master_detail'`,helpText:`What happens when referenced record is deleted`}]},{name:`formula`,label:`Formula & Computed`,description:`Calculated values and roll-up summaries.`,collapsible:!0,collapsed:!0,fields:[{field:`expression`,widget:`textarea`,helpText:`CEL expression to calculate this field (makes it read-only)`},{field:`summaryOperations`,type:`composite`,helpText:`Roll-up summary configuration (for parent-child relationships)`},{field:`cached`,type:`composite`,helpText:`Caching configuration for computed fields`}]},{name:`advanced`,label:`Advanced`,description:`Database, UI, audit, and security settings.`,collapsible:!0,collapsed:!0,columns:2,fields:[{field:`columnName`,colSpan:2,helpText:`Physical column name in database (defaults to field name)`},{field:`index`,colSpan:1,helpText:`Create database index for faster queries`},{field:`externalId`,colSpan:1,helpText:`Mark as external ID for upsert operations`},{field:`readonly`,colSpan:1,helpText:`Field is read-only in forms`},{field:`hidden`,colSpan:1,helpText:`Hide field from default UI views`},{field:`searchable`,colSpan:1,helpText:`Include in global search results`},{field:`sortable`,colSpan:1,helpText:`Allow sorting lists by this field`},{field:`auditTrail`,colSpan:1,helpText:`Track detailed changes with user and timestamp`},{field:`trackFeedHistory`,colSpan:1,helpText:`Show changes in activity feed`},{field:`encryptionConfig`,type:`composite`,colSpan:2,helpText:`Field-level encryption (GDPR/HIPAA/PCI-DSS)`},{field:`maskingRule`,type:`composite`,colSpan:2,helpText:`Data masking rules for PII protection`}]}]}),ah({schemaId:`hook`,type:`simple`,sections:[{label:`Identity`,description:`What this hook is and when it fires.`,columns:2,fields:[{field:`name`,type:`text`,required:!0,immutable:!0,colSpan:1,helpText:`snake_case identifier (immutable after creation)`},{field:`label`,type:`text`,colSpan:1},{field:`description`,type:`textarea`,colSpan:2},{field:`object`,type:`text`,required:!0,colSpan:1,helpText:`Target object name (or "*" for global)`},{field:`events`,type:`tags`,required:!0,colSpan:1,helpText:`Lifecycle events (e.g. beforeInsert, afterUpdate)`},{field:`priority`,type:`number`,colSpan:1,helpText:`Lower numbers run first`}]},{label:`Body`,description:`Inline expression or sandboxed JavaScript executed when the hook fires.`,fields:[{field:`body`,type:`composite`,helpText:`Either an L1 expression or an L2 sandboxed JS body`,fields:[{field:`language`,type:`select`,required:!0,helpText:`expression = pure formula; js = sandboxed JavaScript`,options:[{label:`Expression (L1)`,value:`expression`},{label:`JavaScript (L2 sandboxed)`,value:`js`}]},{field:`source`,type:`code`,language:`javascript`,required:!0,helpText:`Function body source — no top-level imports`},{field:`capabilities`,type:`tags`,helpText:`Allowed ctx APIs (api.read, api.write, crypto.uuid, log, …)`},{field:`timeoutMs`,type:`number`,helpText:`Per-invocation timeout (ms)`}]}]},{label:`Legacy handler`,description:`Function name reference — deprecated in favour of body.`,collapsible:!0,collapsed:!0,fields:[{field:`handler`,type:`text`,helpText:"Handler function name (deprecated — prefer `body`)"}]},{label:`Execution`,collapsible:!0,collapsed:!0,columns:2,fields:[{field:`async`,type:`boolean`,colSpan:1,helpText:`Run in background, do not block the transaction`},{field:`onError`,type:`select`,colSpan:1,options:[{label:`Abort`,value:`abort`},{label:`Log`,value:`log`}]},{field:`condition`,type:`code`,language:`javascript`,colSpan:2,helpText:`Optional formula — skip the hook when this evaluates to false`}]}]});var ug=K(()=>V({field:I().describe(`Source field name containing the reference value`),targetObject:I().regex(/^[a-z_][a-z0-9_]*$/).describe(`Target object name (snake_case)`),targetField:I().default(`name`).describe(`Field on target object used for matching`),fieldType:W([`lookup`,`master_detail`]).describe(`Relationship field type`)}).describe(`Describes how a field reference is resolved during seed loading`)),dg=K(()=>V({object:I().regex(/^[a-z_][a-z0-9_]*$/).describe(`Object name (snake_case)`),dependsOn:B(I()).describe(`Objects this object depends on`),references:B(ug).describe(`Field-level reference details`)}).describe(`Object node in the seed data dependency graph`)),fg=K(()=>V({nodes:B(dg).describe(`All objects in the dependency graph`),insertOrder:B(I()).describe(`Topologically sorted insert order`),circularDependencies:B(B(I())).default([]).describe(`Circular dependency chains (e.g., [["a", "b", "a"]])`)}).describe(`Complete object dependency graph for seed data loading`)),pg=K(()=>V({sourceObject:I().describe(`Object with the broken reference`),field:I().describe(`Field name with unresolved reference`),targetObject:I().describe(`Target object searched for the reference`),targetField:I().describe(`ExternalId field used for matching`),attemptedValue:z().describe(`Value that failed to resolve`),recordIndex:L().int().min(0).describe(`Index of the record in the dataset`),message:I().describe(`Human-readable error description`)}).describe(`Actionable error for a failed reference resolution`)),mg=V({user:V({id:I().min(1),role:I().optional(),email:I().optional()}).optional().describe(`Subject bound to os.user in seed CEL expressions`),org:V({id:I().min(1),tier:I().optional()}).optional().describe(`Organization bound to os.org in seed CEL expressions`)}).describe(`Identity context for resolving os.user / os.org in seed CEL values`),hg=K(()=>V({dryRun:R().default(!1).describe(`Validate references without writing data`),haltOnError:R().default(!1).describe(`Stop on first reference resolution error`),multiPass:R().default(!0).describe(`Enable multi-pass loading for circular dependencies`),defaultMode:cg.default(`upsert`).describe(`Default conflict resolution strategy`),batchSize:L().int().min(1).default(1e3).describe(`Maximum records per batch insert/upsert`),transaction:R().default(!1).describe(`Wrap entire load in a transaction (all-or-nothing)`),env:W([`prod`,`dev`,`test`]).optional().describe(`Only load datasets matching this environment`),organizationId:I().min(1).optional().describe(`Target organization id for per-tenant seed replay`),identity:mg.optional().describe(`Identity bound to os.user / os.org when resolving CEL seed values`)}).describe(`Seed data loader configuration`)),gg=K(()=>V({object:I().describe(`Object that was loaded`),mode:cg.describe(`Import mode used`),inserted:L().int().min(0).describe(`Records inserted`),updated:L().int().min(0).describe(`Records updated`),skipped:L().int().min(0).describe(`Records skipped`),errored:L().int().min(0).describe(`Records with errors`),total:L().int().min(0).describe(`Total records in dataset`),referencesResolved:L().int().min(0).describe(`References resolved via externalId`),referencesDeferred:L().int().min(0).describe(`References deferred to second pass`),errors:B(pg).default([]).describe(`Reference resolution errors`)}).describe(`Result of loading a single dataset`));K(()=>V({success:R().describe(`Overall success status`),dryRun:R().describe(`Whether this was a dry-run`),dependencyGraph:fg.describe(`Object dependency graph`),results:B(gg).describe(`Per-object load results`),errors:B(pg).describe(`All reference resolution errors`),summary:V({objectsProcessed:L().int().min(0).describe(`Total objects processed`),totalRecords:L().int().min(0).describe(`Total records across all objects`),totalInserted:L().int().min(0).describe(`Total records inserted`),totalUpdated:L().int().min(0).describe(`Total records updated`),totalSkipped:L().int().min(0).describe(`Total records skipped`),totalErrored:L().int().min(0).describe(`Total records with errors`),totalReferencesResolved:L().int().min(0).describe(`Total references resolved`),totalReferencesDeferred:L().int().min(0).describe(`Total references deferred`),circularDependencyCount:L().int().min(0).describe(`Circular dependency chains detected`),durationMs:L().min(0).describe(`Load duration in milliseconds`)}).describe(`Summary statistics`)}).describe(`Complete seed loader result`)),K(()=>V({datasets:B(lg).min(1).describe(`Datasets to load`),config:hg.default(()=>hg.parse({})).describe(`Loader configuration`)}).describe(`Seed loader request with datasets and configuration`));var _g=K(()=>V({versionNumber:L().describe(`Version number`),createdAt:L().describe(`Creation timestamp`),createdBy:I().describe(`Creator user ID`),size:L().describe(`File size in bytes`),checksum:I().describe(`File checksum`),downloadUrl:I().url().describe(`Download URL`),isLatest:R().optional().default(!1).describe(`Is latest version`)})),vg=K(()=>V({id:I().describe(`Template ID`),name:I().describe(`Template name`),description:I().optional().describe(`Template description`),fileUrl:I().url().describe(`Template file URL`),fileType:I().describe(`File MIME type`),placeholders:B(V({key:I().describe(`Placeholder key`),label:I().describe(`Placeholder label`),type:W([`text`,`number`,`date`,`image`]).describe(`Placeholder type`),required:R().optional().default(!1).describe(`Is required`)})).describe(`Template placeholders`)})),yg=K(()=>V({provider:W([`docusign`,`adobe-sign`,`hellosign`,`custom`]).describe(`E-signature provider`),enabled:R().optional().default(!1).describe(`E-signature enabled`),signers:B(V({email:I().email().describe(`Signer email`),name:I().describe(`Signer name`),role:I().describe(`Signer role`),order:L().describe(`Signing order`)})).describe(`Document signers`),expirationDays:L().optional().default(30).describe(`Expiration days`),reminderDays:L().optional().default(7).describe(`Reminder interval days`)}));K(()=>V({id:I().describe(`Document ID`),name:I().describe(`Document name`),description:I().optional().describe(`Document description`),fileType:I().describe(`File MIME type`),fileSize:L().describe(`File size in bytes`),category:I().optional().describe(`Document category`),tags:B(I()).optional().describe(`Document tags`),versioning:V({enabled:R().describe(`Versioning enabled`),versions:B(_g).describe(`Version history`),majorVersion:L().describe(`Major version`),minorVersion:L().describe(`Minor version`)}).optional().describe(`Version control`),template:vg.optional().describe(`Document template`),eSignature:yg.optional().describe(`E-signature config`),access:V({isPublic:R().optional().default(!1).describe(`Public access`),sharedWith:B(I()).optional().describe(`Shared with`),expiresAt:L().optional().describe(`Access expiration`)}).optional().describe(`Access control`),metadata:U(I(),z()).optional().describe(`Custom metadata`)}));var bg=K(()=>lf(`type`,[V({type:G(`constant`),value:z().describe(`Constant value to use`)}).describe(`Set a constant value`),V({type:G(`cast`),targetType:W([`string`,`number`,`boolean`,`date`]).describe(`Target data type`)}).describe(`Cast to a specific data type`),V({type:G(`lookup`),table:I().describe(`Lookup table name`),keyField:I().describe(`Field to match on`),valueField:I().describe(`Field to retrieve`)}).describe(`Lookup value from another table`),V({type:G(`javascript`),expression:Ap.describe(`JS expression (dialect="js" recommended). e.g. value.toUpperCase()`)}).describe(`Custom JavaScript transformation`),V({type:G(`map`),mappings:U(I(),z()).describe(`Value mappings (e.g., {"Active": "active"})`)}).describe(`Map values using a dictionary`)])),xg=K(()=>V({source:I().describe(`Source field name`),target:I().describe(`Target field name`),transform:bg.optional().describe(`Transformation to apply`),defaultValue:z().optional().describe(`Default if source is null/undefined`)})),Sg=K(()=>V({id:I().describe(`Data source ID`),name:I().describe(`Data source name`),type:W([`odata`,`rest-api`,`graphql`,`custom`]).describe(`Protocol type`),endpoint:I().url().describe(`API endpoint URL`),authentication:V({type:W([`oauth2`,`api-key`,`basic`,`none`]).describe(`Auth type`),config:U(I(),z()).describe(`Auth configuration`)}).describe(`Authentication`)})),Cg=K(()=>xg.extend({type:I().optional().describe(`Field type`),readonly:R().optional().default(!0).describe(`Read-only field`)}));K(()=>V({fieldName:I().describe(`Field name`),dataSource:Sg.describe(`External data source`),query:V({endpoint:I().describe(`Query endpoint path`),method:W([`GET`,`POST`]).optional().default(`GET`).describe(`HTTP method`),parameters:U(I(),z()).optional().describe(`Query parameters`)}).describe(`Query configuration`),fieldMappings:B(Cg).describe(`Field mappings`),caching:V({enabled:R().optional().default(!0).describe(`Cache enabled`),ttl:L().optional().default(300).describe(`Cache TTL (seconds)`),strategy:W([`lru`,`lfu`,`ttl`]).optional().default(`ttl`).describe(`Cache strategy`)}).optional().describe(`Caching configuration`),fallback:V({enabled:R().optional().default(!0).describe(`Fallback enabled`),defaultValue:z().optional().describe(`Default fallback value`),showError:R().optional().default(!0).describe(`Show error to user`)}).optional().describe(`Fallback configuration`),rateLimit:V({requestsPerSecond:L().describe(`Requests per second limit`),burstSize:L().optional().describe(`Burst size`)}).optional().describe(`Rate limiting`),retry:V({maxRetries:L().min(0).default(3).describe(`Maximum retry attempts`),initialDelayMs:L().default(1e3).describe(`Initial retry delay in milliseconds`),maxDelayMs:L().default(3e4).describe(`Maximum retry delay in milliseconds`),backoffMultiplier:L().default(2).describe(`Exponential backoff multiplier`),retryableStatusCodes:B(L()).default([429,500,502,503,504]).describe(`HTTP status codes that are retryable`)}).optional().describe(`Retry configuration with exponential backoff`),transform:V({request:V({headers:U(I(),I()).optional().describe(`Additional request headers`),queryParams:U(I(),I()).optional().describe(`Additional query parameters`)}).optional().describe(`Request transformation`),response:V({dataPath:I().optional().describe(`JSONPath to extract data (e.g., "$.data.results")`),totalPath:I().optional().describe(`JSONPath to extract total count (e.g., "$.meta.total")`)}).optional().describe(`Response transformation`)}).optional().describe(`Request/response transformation pipeline`),pagination:V({type:W([`offset`,`cursor`,`page`]).default(`offset`).describe(`Pagination type`),pageSize:L().default(100).describe(`Items per page`),maxPages:L().optional().describe(`Maximum number of pages to fetch`)}).optional().describe(`Pagination configuration for external data`)}));var wg=I().describe(`Underlying driver identifier`);K(()=>V({id:I().describe(`Unique driver identifier (e.g. "postgres")`),label:I().describe(`Display label (e.g. "PostgreSQL")`),description:I().optional(),icon:I().optional(),configSchema:U(I(),z()).describe(`JSON Schema for connection configuration`),capabilities:Rf(()=>Tg).optional()}));var Tg=V({transactions:R().default(!1),queryFilters:R().default(!1),queryAggregations:R().default(!1),querySorting:R().default(!1),queryPagination:R().default(!1),queryWindowFunctions:R().default(!1),querySubqueries:R().default(!1),joins:R().default(!1),fullTextSearch:R().default(!1),readOnly:R().default(!1),dynamicSchema:R().default(!1)}),Eg=W([`managed`,`external`,`validate-only`]).describe(`Schema ownership mode`),Dg=V({label:I().optional().describe(`Display label, e.g. "Snowflake — ANALYTICS / PROD"`),allowedSchemas:B(I()).optional().describe(`Whitelist of remote schemas/databases that may be exposed.`),allowWrites:R().default(!1).describe(`Global write gate. Individual objects must also opt in via object.external.writable.`),validation:V({onMismatch:W([`fail`,`warn`,`ignore`]).default(`fail`).describe(`What to do when a federated object diverges from the remote table.`),checkOnBoot:R().default(!0).describe(`Validate federated objects against the remote schema at boot.`),checkIntervalMs:L().optional().describe(`Optional background drift-check interval in milliseconds.`)}).default({onMismatch:`fail`,checkOnBoot:!0}).describe(`Boot/drift validation policy`),credentialsRef:I().optional().describe(`Reference into the secrets store; never inline credentials.`),queryTimeoutMs:L().default(3e4).describe(`Hard cap on per-query execution time.`),requirePermission:I().optional().describe(`Optional convenience: gate the entire datasource behind a single role.`)}).describe(`External datasource federation settings (schemaMode != "managed")`);K(()=>V({name:I().regex(/^[a-z_][a-z0-9_]*$/).describe(`Unique datasource identifier`),label:I().optional().describe(`Display label`),driver:wg.describe(`Underlying driver type`),config:U(I(),z()).describe(`Driver specific configuration`),pool:V({min:L().default(0).describe(`Minimum connections`),max:L().default(10).describe(`Maximum connections`),idleTimeoutMillis:L().default(3e4).describe(`Idle timeout`),connectionTimeoutMillis:L().default(3e3).describe(`Connection establishment timeout`)}).optional().describe(`Connection pool settings`),readReplicas:B(U(I(),z())).optional().describe(`Read-only replica configurations`),capabilities:Tg.optional().describe(`Capability overrides`),healthCheck:V({enabled:R().default(!0).describe(`Enable health check endpoint`),intervalMs:L().default(3e4).describe(`Health check interval in milliseconds`),timeoutMs:L().default(5e3).describe(`Health check timeout in milliseconds`)}).optional().describe(`Datasource health check configuration`),ssl:V({enabled:R().default(!1).describe(`Enable SSL/TLS for database connection`),rejectUnauthorized:R().default(!0).describe(`Reject connections with invalid/self-signed certificates`),ca:I().optional().describe(`CA certificate (PEM format or path to file)`),cert:I().optional().describe(`Client certificate (PEM format or path to file)`),key:I().optional().describe(`Client private key (PEM format or path to file)`)}).optional().describe(`SSL/TLS configuration for secure database connections`),retryPolicy:V({maxRetries:L().default(3).describe(`Maximum number of retry attempts`),baseDelayMs:L().default(1e3).describe(`Base delay between retries in milliseconds`),maxDelayMs:L().default(3e4).describe(`Maximum delay between retries in milliseconds`),backoffMultiplier:L().default(2).describe(`Exponential backoff multiplier`)}).optional().describe(`Connection retry policy for transient failures`),description:I().optional().describe(`Internal description`),active:R().default(!0).describe(`Is datasource enabled`),schemaMode:Eg.default(`managed`),external:Dg.optional(),origin:W([`code`,`runtime`]).default(`code`).describe(`Datasource provenance (server-managed, read-only)`)}).superRefine((e,t)=>{e.schemaMode!==`managed`&&!e.external&&t.addIssue({code:`custom`,path:[`external`],message:`schemaMode='${e.schemaMode}' requires 'external' settings.`}),e.schemaMode===`managed`&&e.external&&t.addIssue({code:`custom`,path:[`external`],message:`'external' settings only apply when schemaMode != 'managed'.`})}));var Og=V({name:I().describe(`Remote column name`),sqlType:I().describe(`Raw remote SQL type (e.g. "numeric(10,2)")`),nullable:R().describe(`Whether the remote column is nullable`),primaryKey:R().default(!1).describe(`Part of the remote primary key`),suggestedFieldType:I().optional().describe(`ObjectStack field type suggested by the type-compat matrix`)}),kg=V({remoteSchema:I().optional().describe(`Remote schema/database qualifier`),remoteName:I().describe(`Remote table/view name`),columns:B(Og).describe(`Remote columns`),indexes:B(V({name:I(),columns:B(I()),unique:R()})).optional().describe(`Remote indexes, when introspectable`),rowCountEstimate:L().optional().describe(`Approximate row count`)});K(()=>V({name:I().regex(/^[a-z_][a-z0-9_]*$/).describe("Catalog id, conventionally `<datasource>_catalog`."),datasource:I().describe(`Datasource.name this catalog snapshots.`),snapshotAt:I().datetime().describe(`When the snapshot was taken (ISO 8601).`),dialect:I().optional().describe(`Remote SQL dialect, when known.`),tables:B(kg).describe(`Snapshotted remote tables.`)}));var Ag=W([`count`,`sum`,`avg`,`min`,`max`,`count_distinct`,`number`,`string`,`boolean`]),jg=W([`string`,`number`,`boolean`,`time`,`geo`]),Mg=W([`second`,`minute`,`hour`,`day`,`week`,`month`,`quarter`,`year`]),Ng=K(()=>V({name:I().regex(/^[a-z_][a-z0-9_]*$/).describe(`Unique metric ID`),label:I().describe(`Human readable label`),description:I().optional(),type:Ag,sql:I().describe(`SQL expression or field reference`),filters:B(V({sql:I()})).optional(),format:I().optional()})),Pg=K(()=>V({name:I().regex(/^[a-z_][a-z0-9_]*$/).describe(`Unique dimension ID`),label:I().describe(`Human readable label`),description:I().optional(),type:jg,sql:I().describe(`SQL expression or column reference`),granularities:B(Mg).optional()})),Fg=K(()=>V({name:I().describe(`Target cube name`),relationship:W([`one_to_one`,`one_to_many`,`many_to_one`]).default(`many_to_one`),sql:I().describe(`Join condition (ON clause)`)}));K(()=>V({name:I().regex(/^[a-z_][a-z0-9_]*$/).describe(`Cube name (snake_case)`),title:I().optional(),description:I().optional(),sql:I().describe(`Base SQL statement or Table Name`),measures:U(I(),Ng).describe(`Quantitative metrics`),dimensions:U(I(),Pg).describe(`Qualitative attributes`),joins:U(I(),Fg).optional(),refreshKey:V({every:I().optional(),sql:I().optional()}).optional(),public:R().default(!1)})),K(()=>V({cube:I().optional().describe(`Target cube name (optional when provided externally, e.g. in API request wrapper)`),measures:B(I()).describe(`List of metrics to calculate`),dimensions:B(I()).optional().describe(`List of dimensions to group by`),where:Xf.optional().describe(`Filtering criteria (canonical Query DSL FilterCondition)`),timeDimensions:B(V({dimension:I(),granularity:Mg.optional(),dateRange:H([I(),B(I())]).optional()})).optional(),order:U(I(),W([`asc`,`desc`])).optional(),limit:L().optional(),offset:L().optional(),timezone:I().optional().default(`UTC`)}));var Ig=W([`comment`,`field_change`,`task`,`event`,`email`,`call`,`note`,`file`,`record_create`,`record_delete`,`approval`,`sharing`,`system`]),Lg=K(()=>V({type:W([`user`,`team`,`record`]).describe(`Mention target type`),id:I().describe(`Target ID`),name:I().describe(`Display name for rendering`),offset:L().int().min(0).describe(`Character offset in body text`),length:L().int().min(1).describe(`Length of mention token in body text`)})),Rg=K(()=>V({field:I().describe(`Field machine name`),fieldLabel:I().optional().describe(`Field display label`),oldValue:z().optional().describe(`Previous value`),newValue:z().optional().describe(`New value`),oldDisplayValue:I().optional().describe(`Human-readable old value`),newDisplayValue:I().optional().describe(`Human-readable new value`)})),zg=K(()=>V({emoji:I().describe(`Emoji character or shortcode (e.g., "👍", ":thumbsup:")`),userIds:B(I()).describe(`Users who reacted`),count:L().int().min(1).describe(`Total reaction count`)})),Bg=K(()=>V({type:W([`user`,`system`,`service`,`automation`]).describe(`Actor type`),id:I().describe(`Actor ID`),name:I().optional().describe(`Actor display name`),avatarUrl:I().url().optional().describe(`Actor avatar URL`),source:I().optional().describe(`Source application (e.g., "Omni", "API", "Studio")`)})),Vg=W([`public`,`internal`,`private`]);K(()=>V({id:I().describe(`Feed item ID`),type:Ig.describe(`Activity type`),object:I().describe(`Object name (e.g., "account")`),recordId:I().describe(`Record ID this feed item belongs to`),actor:Bg.describe(`Who performed this action`),body:I().optional().describe(`Rich text body (Markdown supported)`),mentions:B(Lg).optional().describe(`Mentioned users/teams/records`),changes:B(Rg).optional().describe(`Field-level changes`),reactions:B(zg).optional().describe(`Emoji reactions on this item`),parentId:I().optional().describe(`Parent feed item ID for threaded replies`),replyCount:L().int().min(0).default(0).describe(`Number of replies`),pinned:R().default(!1).describe(`Whether the feed item is pinned to the top of the timeline`),pinnedAt:I().datetime().optional().describe(`Timestamp when the item was pinned`),pinnedBy:I().optional().describe(`User ID who pinned the item`),starred:R().default(!1).describe(`Whether the feed item is starred/bookmarked by the current user`),starredAt:I().datetime().optional().describe(`Timestamp when the item was starred`),visibility:Vg.default(`public`).describe(`Visibility: public (all users), internal (team only), private (author + mentioned)`),createdAt:I().datetime().describe(`Creation timestamp`),updatedAt:I().datetime().optional().describe(`Last update timestamp`),editedAt:I().datetime().optional().describe(`When comment was last edited`),isEdited:R().default(!1).describe(`Whether comment has been edited`)})),W([`all`,`comments_only`,`changes_only`,`tasks_only`]);var Hg=W([`comment`,`mention`,`field_change`,`task`,`approval`,`all`]),Ug=W([`in_app`,`email`,`push`,`slack`]);K(()=>V({object:I().describe(`Object name`),recordId:I().describe(`Record ID`),userId:I().describe(`Subscribing user ID`),events:B(Hg).default([`all`]).describe(`Event types to receive notifications for`),channels:B(Ug).default([`in_app`]).describe(`Notification delivery channels`),active:R().default(!0).describe(`Whether the subscription is active`),createdAt:I().datetime().describe(`Subscription creation timestamp`)}));var Wg=(e=>l===void 0?typeof Proxy<`u`?new Proxy(e,{get:(e,t)=>(l===void 0?e:l)[t]}):e:l)(function(e){if(l!==void 0)return l.apply(this,arguments);throw Error(`Dynamic require of "`+e+`" is not supported`)}),Gg={debug:0,info:1,warn:2,error:3,fatal:4,silent:5},Kg={debug:`\x1B[36m`,info:`\x1B[32m`,warn:`\x1B[33m`,error:`\x1B[31m`,fatal:`\x1B[35m`,silent:``},qg=`\x1B[0m`,Jg=class e{constructor(e={},t={}){this.config={name:e.name,level:e.level??`info`,format:e.format??`pretty`,redact:e.redact??[`password`,`token`,`secret`,`key`],sourceLocation:e.sourceLocation??!1,file:e.file,rotation:e.rotation??{maxSize:`10m`,maxFiles:5}},this.bindings=t,this.config.file&&typeof process<`u`&&this.openFileStream(this.config.file)}openFileStream(e){try{let t=Wg(`fs`),n=Wg(`path`).dirname(e);t.mkdirSync(n,{recursive:!0}),this.fileStream=t.createWriteStream(e,{flags:`a`})}catch{}}isEnabled(e){return Gg[e]>=Gg[this.config.level]}redactSensitive(e){if(!e||typeof e!=`object`)return e;let t=Array.isArray(e)?[...e]:{...e};for(let e in t){let n=e.toLowerCase();this.config.redact.some(e=>n.includes(e.toLowerCase()))?t[e]=`***REDACTED***`:typeof t[e]==`object`&&t[e]!==null&&(t[e]=this.redactSensitive(t[e]))}return t}write(e,t,n,r){if(!this.isEnabled(e))return;let i=this.redactSensitive({...this.bindings,...n,...r?{error:{message:r.message,stack:r.stack}}:{}}),a=Object.keys(i).length>0,o=new Date().toISOString(),s;if(this.config.format===`json`)s=JSON.stringify({time:o,level:e,...this.config.name?{name:this.config.name}:{},msg:t,...i});else if(this.config.format===`text`){let n=[o,e.toUpperCase(),t];a&&n.push(JSON.stringify(i)),s=n.join(` | `)}else{let n=Kg[e]||``,r=this.config.name?`[${this.config.name}] `:``;s=`${n}${o} ${e.toUpperCase()}${qg} ${r}${t}`,a&&(s+=` ${JSON.stringify(i)}`)}let c=s+`
|
|
103
|
-
`;typeof process<`u`&&process.stderr?e===`error`||e===`fatal`?process.stderr.write(c):process.stdout?.write(c):typeof console<`u`&&(e===`error`||e===`fatal`?console.error:e===`warn`?console.warn:e===`debug`?console.debug:console.log)(s),this.fileStream&&this.fileStream.write(c)}debug(e,t){this.write(`debug`,e,t)}info(e,t){this.write(`info`,e,t)}warn(e,t){this.write(`warn`,e,t)}error(e,t,n){t instanceof Error?this.write(`error`,e,n,t):this.write(`error`,e,t)}fatal(e,t,n){t instanceof Error?this.write(`fatal`,e,n,t):this.write(`fatal`,e,t)}log(e,...t){this.info(e,t.length>0?{args:t}:void 0)}child(t){let n=new e(this.config,{...this.bindings,...t});return n.fileStream=this.fileStream,n}withTrace(e,t){return this.child({traceId:e,spanId:t})}async destroy(){this.fileStream&&=(await new Promise(e=>this.fileStream.end(e)),void 0)}};function Yg(e){return new Jg(e)}var Xg=class{constructor(e,t){this.subscriptions=new Map,this.eventBuffer=[],this._baseUrl=e,this._token=t}subscribeMetadata(e,t,n){let r=`metadata-${e}-${Date.now()}`;return this.subscriptions.set(r,{filter:{type:e,packageId:n?.packageId,eventTypes:[`metadata.${e}.created`,`metadata.${e}.updated`,`metadata.${e}.deleted`]},handler:e=>{e.type.startsWith(`metadata.`)&&t(e)}}),this.startPolling(),()=>{this.subscriptions.delete(r),this.subscriptions.size===0&&this.stopPolling()}}subscribeData(e,t,n){let r=`data-${e}-${Date.now()}`;return this.subscriptions.set(r,{filter:{type:e,recordId:n?.recordId,eventTypes:[`data.record.created`,`data.record.updated`,`data.record.deleted`]},handler:r=>{r.type.startsWith(`data.`)&&r.object===e&&(!n?.recordId||r.payload?.recordId===n.recordId)&&t(r)}}),this.startPolling(),()=>{this.subscriptions.delete(r),this.subscriptions.size===0&&this.stopPolling()}}emitEvent(e){for(let t of this.subscriptions.values()){let n=!t.filter.type||e.type.includes(t.filter.type)||e.object===t.filter.type,r=!t.filter.eventTypes?.length||t.filter.eventTypes.includes(e.type),i=!t.filter.packageId||e.payload?.packageId===t.filter.packageId;if(n&&r&&i)try{t.handler(e)}catch(e){console.error(`Error in realtime event handler:`,e)}}}startPolling(){this.pollInterval||=setInterval(()=>{for(;this.eventBuffer.length>0;){let e=this.eventBuffer.shift();e&&this.emitEvent(e)}},2e3)}stopPolling(){this.pollInterval&&=(clearInterval(this.pollInterval),void 0)}_bufferEvent(e){this.eventBuffer.push(e)}disconnect(){this.stopPolling(),this.subscriptions.clear(),this.eventBuffer=[]}},Zg=class{constructor(e){this.meta={getTypes:async()=>{let e=this.getRoute(`metadata`),t=await this.fetch(`${this.baseUrl}${e}`);return this.unwrapResponse(t)},getItems:async(e,t)=>{let n=this.getRoute(`metadata`),r=new URLSearchParams;t?.packageId&&r.set(`package`,t.packageId);let i=r.toString(),a=`${this.baseUrl}${n}/${e}${i?`?${i}`:``}`,o=await this.fetch(a);return this.unwrapResponse(o)},getItem:async(e,t,n)=>{let r=this.getRoute(`metadata`),i=new URLSearchParams;n?.packageId&&i.set(`package`,n.packageId);let a=i.toString(),o=`${this.baseUrl}${r}/${e}/${t}${a?`?${a}`:``}`,s=await this.fetch(o);return this.unwrapResponse(s)},saveItem:async(e,t,n)=>{let r=this.getRoute(`metadata`),i=await this.fetch(`${this.baseUrl}${r}/${e}/${t}`,{method:`PUT`,body:JSON.stringify(n)});return this.unwrapResponse(i)},deleteItem:async(e,t)=>{let n=this.getRoute(`metadata`),r=await this.fetch(`${this.baseUrl}${n}/${encodeURIComponent(e)}/${encodeURIComponent(t)}`,{method:`DELETE`});return this.unwrapResponse(r)},getHistory:async(e,t,n)=>{let r=this.getRoute(`metadata`),i=new URLSearchParams;n?.sinceSeq!==void 0&&i.set(`sinceSeq`,String(n.sinceSeq)),n?.limit!==void 0&&i.set(`limit`,String(n.limit));let a=i.toString(),o=`${this.baseUrl}${r}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/history${a?`?${a}`:``}`,s=await this.fetch(o);return this.unwrapResponse(s)},getCached:async(e,t)=>{let n=this.getRoute(`metadata`),r={};t?.ifNoneMatch&&(r[`If-None-Match`]=t.ifNoneMatch),t?.ifModifiedSince&&(r[`If-Modified-Since`]=t.ifModifiedSince);let i=await this.fetch(`${this.baseUrl}${n}/object/${e}`,{headers:r});if(i.status===304)return{notModified:!0,etag:t?.ifNoneMatch?{value:t.ifNoneMatch.replace(/^W\/|"/g,``),weak:t.ifNoneMatch.startsWith(`W/`)}:void 0};let a=await i.json(),o=i.headers.get(`ETag`),s=i.headers.get(`Last-Modified`);return{data:a,etag:o?{value:o.replace(/^W\/|"/g,``),weak:o.startsWith(`W/`)}:void 0,lastModified:s||void 0,notModified:!1}},getView:async(e,t=`list`)=>{let n=this.getRoute(`ui`),r=await this.fetch(`${this.baseUrl}${n}/view/${e}?type=${t}`);return this.unwrapResponse(r)}},this.analytics={query:async e=>{let t=this.getRoute(`analytics`);return(await this.fetch(`${this.baseUrl}${t}/query`,{method:`POST`,body:JSON.stringify(e)})).json()},meta:async e=>{let t=this.getRoute(`analytics`);return(await this.fetch(`${this.baseUrl}${t}/meta/${e}`)).json()},explain:async e=>{let t=this.getRoute(`analytics`);return(await this.fetch(`${this.baseUrl}${t}/explain`,{method:`POST`,body:JSON.stringify(e)})).json()}},this.packages={list:async e=>{let t=this.getRoute(`packages`),n=new URLSearchParams;e?.status&&n.set(`status`,e.status),e?.type&&n.set(`type`,e.type),e?.enabled!==void 0&&n.set(`enabled`,String(e.enabled));let r=n.toString(),i=`${this.baseUrl}${t}${r?`?`+r:``}`,a=await this.fetch(i);return this.unwrapResponse(a)},get:async e=>{let t=this.getRoute(`packages`),n=await this.fetch(`${this.baseUrl}${t}/${encodeURIComponent(e)}`);return this.unwrapResponse(n)},install:async(e,t)=>{let n=this.getRoute(`packages`),r=await this.fetch(`${this.baseUrl}${n}`,{method:`POST`,body:JSON.stringify({manifest:e,settings:t?.settings,enableOnInstall:t?.enableOnInstall})});return this.unwrapResponse(r)},uninstall:async e=>{let t=this.getRoute(`packages`),n=await this.fetch(`${this.baseUrl}${t}/${encodeURIComponent(e)}`,{method:`DELETE`});return this.unwrapResponse(n)},enable:async e=>{let t=this.getRoute(`packages`),n=await this.fetch(`${this.baseUrl}${t}/${encodeURIComponent(e)}/enable`,{method:`PATCH`});return this.unwrapResponse(n)},disable:async e=>{let t=this.getRoute(`packages`),n=await this.fetch(`${this.baseUrl}${t}/${encodeURIComponent(e)}/disable`,{method:`PATCH`});return this.unwrapResponse(n)}},this.projects={list:async e=>{let t=new URLSearchParams;e?.organization_id&&t.set(`organizationId`,e.organization_id),e?.env_type&&t.set(`envType`,e.env_type),e?.status&&t.set(`status`,e.status);let n=t.toString(),r=`${this.baseUrl}/api/v1/cloud/environments${n?`?`+n:``}`,i=await this.fetch(r);return this.unwrapResponse(i)},get:async e=>{let t=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}`);return this.unwrapResponse(t)},create:async e=>{let t=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments`,{method:`POST`,body:JSON.stringify(e)});return this.unwrapResponse(t)},update:async(e,t)=>{let n=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}`,{method:`PATCH`,body:JSON.stringify(t)});return this.unwrapResponse(n)},delete:async(e,t)=>{let n=t?.force?`?force=1`:``,r=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}${n}`,{method:`DELETE`});return this.unwrapResponse(r)},activate:async e=>{let t=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/activate`,{method:`POST`});return this.unwrapResponse(t)},rotateCredential:async(e,t)=>{let n=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/credentials/rotate`,{method:`POST`,body:JSON.stringify({plaintext:t})});return this.unwrapResponse(n)},updateHostname:async(e,t)=>{let n=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/hostname`,{method:`POST`,body:JSON.stringify({hostname:t})});return this.unwrapResponse(n)},updateVisibility:async(e,t)=>{let n=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}`,{method:`PATCH`,body:JSON.stringify({visibility:t})});return this.unwrapResponse(n)},listRevisions:async(e,t)=>{let n=new URLSearchParams;t?.limit&&n.set(`limit`,String(t.limit)),t?.cursor&&n.set(`cursor`,t.cursor),t?.branch&&n.set(`branch`,t.branch);let r=n.toString(),i=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/revisions${r?`?${r}`:``}`);return this.unwrapResponse(i)},listBranches:async e=>{let t=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/branches`);return this.unwrapResponse(t)},renameBranch:async(e,t,n)=>{let r=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/branches/${encodeURIComponent(t)}/rename`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({newName:n})});return this.unwrapResponse(r)},deleteBranch:async(e,t)=>{let n=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/branches/${encodeURIComponent(t)}`,{method:`DELETE`});return this.unwrapResponse(n)},activateRevision:async(e,t)=>{let n=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/revisions/${encodeURIComponent(t)}/activate`,{method:`POST`});return this.unwrapResponse(n)},retryProvisioning:async e=>{let t=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/retry`,{method:`POST`});return this.unwrapResponse(t)},listMembers:async e=>{let t=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/members`);return this.unwrapResponse(t)},addMember:async(e,t)=>{let n=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/members`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(t)});return this.unwrapResponse(n)},updateMemberRole:async(e,t,n)=>{let r=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/members/${encodeURIComponent(t)}`,{method:`PATCH`,headers:{"content-type":`application/json`},body:JSON.stringify({role:n})});return this.unwrapResponse(r)},removeMember:async(e,t)=>{let n=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/members/${encodeURIComponent(t)}`,{method:`DELETE`});return this.unwrapResponse(n)},listDrivers:async()=>{let e=await this.fetch(`${this.baseUrl}/api/v1/cloud/drivers`);return this.unwrapResponse(e)},listTemplates:async()=>{let e=await this.fetch(`${this.baseUrl}/api/v1/cloud/templates`);return this.unwrapResponse(e)},packages:{list:async e=>{let t=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/packages`);return this.unwrapResponse(t)},install:async(e,t)=>{let n=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/packages`,{method:`POST`,body:JSON.stringify(t)});return this.unwrapResponse(n)},get:async(e,t)=>{let n=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/packages/${encodeURIComponent(t)}`);return this.unwrapResponse(n)},enable:async(e,t)=>{let n=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/packages/${encodeURIComponent(t)}/enable`,{method:`PATCH`});return this.unwrapResponse(n)},disable:async(e,t)=>{let n=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/packages/${encodeURIComponent(t)}/disable`,{method:`PATCH`});return this.unwrapResponse(n)},uninstall:async(e,t)=>{let n=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/packages/${encodeURIComponent(t)}`,{method:`DELETE`});return this.unwrapResponse(n)},upgrade:async(e,t,n)=>{let r=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/packages/${encodeURIComponent(t)}/upgrade`,{method:`POST`,body:JSON.stringify({targetVersion:n})});return this.unwrapResponse(r)}}},this.organizations={list:async()=>{let e=this.getRoute(`auth`),t=await(await this.fetch(`${this.baseUrl}${e}/organization/list`)).json();return{organizations:Array.isArray(t)?t:t?.data??[]}},create:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/create`,{method:`POST`,body:JSON.stringify(e)})).json()},update:async(e,t)=>{let n=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${n}/organization/update`,{method:`POST`,body:JSON.stringify({organizationId:e,data:t})})).json()},setActive:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/set-active`,{method:`POST`,body:JSON.stringify({organizationId:e})})).json()},get:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/get-full-organization?organizationId=${encodeURIComponent(e)}`)).json()},listMembers:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/list-members?organizationId=${encodeURIComponent(e)}`)).json()},invite:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/invite-member`,{method:`POST`,body:JSON.stringify(e)})).json()},leave:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/leave`,{method:`POST`,body:JSON.stringify({organizationId:e})})).json()},delete:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/delete`,{method:`POST`,body:JSON.stringify({organizationId:e})})).json()},removeMember:async(e,t)=>{let n=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${n}/organization/remove-member`,{method:`POST`,body:JSON.stringify({memberIdOrEmail:t.memberIdOrEmail,organizationId:e})})).json()},updateMemberRole:async(e,t)=>{let n=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${n}/organization/update-member-role`,{method:`POST`,body:JSON.stringify({memberId:t.memberId,role:t.role,organizationId:e})})).json()},getActiveMember:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/get-active-member?organizationId=${encodeURIComponent(e)}`)).json()},invitations:{list:async e=>{let t=this.getRoute(`auth`),n=await(await this.fetch(`${this.baseUrl}${t}/organization/list-invitations?organizationId=${encodeURIComponent(e)}`)).json();return{invitations:Array.isArray(n)?n:n?.data??n?.invitations??[]}},listMine:async()=>{let e=this.getRoute(`auth`),t=await(await this.fetch(`${this.baseUrl}${e}/organization/list-user-invitations`)).json();return{invitations:Array.isArray(t)?t:t?.data??t?.invitations??[]}},cancel:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/cancel-invitation`,{method:`POST`,body:JSON.stringify({invitationId:e})})).json()},accept:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/accept-invitation`,{method:`POST`,body:JSON.stringify({invitationId:e})})).json()},reject:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/reject-invitation`,{method:`POST`,body:JSON.stringify({invitationId:e})})).json()},resend:async e=>{if(e.id)try{await this.organizations.invitations.cancel(e.id)}catch{}return this.organizations.invite({email:e.email,role:e.role??`member`,organizationId:e.organizationId})}},teams:{list:async e=>{let t=this.getRoute(`auth`),n=await(await this.fetch(`${this.baseUrl}${t}/organization/list-teams?organizationId=${encodeURIComponent(e)}`)).json();return{teams:Array.isArray(n)?n:n?.data??n?.teams??[]}},create:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/create-team`,{method:`POST`,body:JSON.stringify(e)})).json()},update:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/update-team`,{method:`POST`,body:JSON.stringify(e)})).json()},delete:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/remove-team`,{method:`POST`,body:JSON.stringify(e)})).json()},listMembers:async e=>{let t=this.getRoute(`auth`),n=await(await this.fetch(`${this.baseUrl}${t}/organization/list-team-members?teamId=${encodeURIComponent(e)}`)).json();return{members:Array.isArray(n)?n:n?.data??n?.members??[]}},addMember:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/add-team-member`,{method:`POST`,body:JSON.stringify(e)})).json()},removeMember:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/remove-team-member`,{method:`POST`,body:JSON.stringify(e)})).json()}}},this.oauth={applications:{register:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/oauth2/create-client`,{method:`POST`,body:JSON.stringify(e)})).json()},get:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/oauth2/get-client?client_id=${encodeURIComponent(e)}`)).json()},getPublic:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/oauth2/public-client?client_id=${encodeURIComponent(e)}`)).json()},list:async()=>{let e=this.getRoute(`auth`),t=await(await this.fetch(`${this.baseUrl}${e}/oauth2/get-clients`)).json();return{applications:Array.isArray(t)?t:t?.clients??t?.data??[]}},delete:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/oauth2/delete-client`,{method:`POST`,body:JSON.stringify({client_id:e})})).json()}},consent:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/oauth2/consent`,{method:`POST`,body:JSON.stringify(e)})).json()}},this.auth={getConfig:async()=>{let e=this.getRoute(`auth`),t=await this.fetch(`${this.baseUrl}${e}/config`);return this.unwrapResponse(t)},login:async e=>{let t=this.getRoute(`auth`),n=await this.fetch(`${this.baseUrl}${t}/sign-in/email`,{method:`POST`,headers:{Origin:this.baseUrl},body:JSON.stringify(e)}),r=await n.json().catch(()=>({}));if(!n.ok){let e=r?.message||r?.error?.message||`Login failed (HTTP ${n.status})`,t=Error(e);throw r?.code&&(t.code=r.code),t.status=n.status,t}let i=r&&(r.data??(r.token||r.user?{token:r.token,user:r.user}:void 0)),a=i?{...r,data:i}:r;return a.data?.token&&(this.token=a.data.token),a},logout:async()=>{let e=this.getRoute(`auth`);await this.fetch(`${this.baseUrl}${e}/sign-out`,{method:`POST`,headers:{"Content-Type":`application/json`,Origin:this.baseUrl},body:`{}`}),this.token=void 0},me:async()=>{let e=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${e}/get-session`,{headers:{Origin:this.baseUrl}})).json()},register:async e=>{let t=this.getRoute(`auth`),n=await(await this.fetch(`${this.baseUrl}${t}/sign-up/email`,{method:`POST`,headers:{Origin:this.baseUrl},body:JSON.stringify(e)})).json(),r=n&&(n.data??(n.token||n.user?{token:n.token,user:n.user}:void 0)),i=r?{...n,data:r}:n;return i.data?.token&&(this.token=i.data.token),i},signInWithProvider:async(e,t)=>{if(typeof window>`u`)throw Error(`signInWithProvider requires a browser environment`);let n=this.getRoute(`auth`),r=t?.callbackURL??window.location.origin+`/login`,i=t?.type===`oidc`,a=i?`/sign-in/oauth2`:`/sign-in/social`,o=i?{providerId:e,callbackURL:r}:{provider:e,callbackURL:r};t?.errorCallbackURL&&(o.errorCallbackURL=t.errorCallbackURL);let s=await(await this.fetch(`${this.baseUrl}${n}${a}`,{method:`POST`,body:JSON.stringify(o)})).json(),c=s?.url??s?.data?.url;if(c)window.location.assign(c);else throw Error(`signInWithProvider: no redirect URL returned for provider "${e}"`)},refreshToken:async e=>{let t=this.getRoute(`auth`),n=await(await this.fetch(`${this.baseUrl}${t}/get-session`,{method:`GET`})).json();return n.data?.token&&(this.token=n.data.token),n},bootstrapStatus:async()=>{let e=this.getRoute(`auth`),t=await(await this.fetch(`${this.baseUrl}${e}/bootstrap-status`)).json();return{hasOwner:!!(t?.data??t)?.hasOwner}},updateUser:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/update-user`,{method:`POST`,body:JSON.stringify(e)})).json()},changePassword:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/change-password`,{method:`POST`,body:JSON.stringify(e)})).json()},changeEmail:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/change-email`,{method:`POST`,body:JSON.stringify(e)})).json()},sendVerificationEmail:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/send-verification-email`,{method:`POST`,body:JSON.stringify(e)})).json()},verifyEmail:async e=>{let t=this.getRoute(`auth`),n=new URL(`${this.baseUrl}${t}/verify-email`);return n.searchParams.set(`token`,e.token),e.callbackURL&&n.searchParams.set(`callbackURL`,e.callbackURL),(await this.fetch(n.toString())).json()},deleteUser:async e=>{let t=this.getRoute(`auth`),n=await this.fetch(`${this.baseUrl}${t}/delete-user`,{method:`POST`,body:JSON.stringify(e)});return this.token=void 0,n.json()},sessions:{list:async()=>{let e=this.getRoute(`auth`),t=await(await this.fetch(`${this.baseUrl}${e}/list-sessions`)).json();return{sessions:Array.isArray(t)?t:t?.data??t?.sessions??[]}},revoke:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/revoke-session`,{method:`POST`,body:JSON.stringify({token:e})})).json()},revokeOthers:async()=>{let e=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${e}/revoke-other-sessions`,{method:`POST`,body:`{}`})).json()},revokeAll:async()=>{let e=this.getRoute(`auth`),t=await this.fetch(`${this.baseUrl}${e}/revoke-sessions`,{method:`POST`,body:`{}`});return this.token=void 0,t.json()}},twoFactor:{enable:async e=>{let t=this.getRoute(`auth`),n=await(await this.fetch(`${this.baseUrl}${t}/two-factor/enable`,{method:`POST`,body:JSON.stringify(e)})).json();return n?.data??n},verifyTotp:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/two-factor/verify-totp`,{method:`POST`,body:JSON.stringify(e)})).json()},disable:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/two-factor/disable`,{method:`POST`,body:JSON.stringify(e)})).json()},generateBackupCodes:async e=>{let t=this.getRoute(`auth`),n=await(await this.fetch(`${this.baseUrl}${t}/two-factor/generate-backup-codes`,{method:`POST`,body:JSON.stringify(e)})).json();return n?.data??n},verifyBackupCode:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/two-factor/verify-backup-code`,{method:`POST`,body:JSON.stringify(e)})).json()}},accounts:{list:async()=>{let e=this.getRoute(`auth`),t=await(await this.fetch(`${this.baseUrl}${e}/list-accounts`)).json();return{accounts:Array.isArray(t)?t:t?.data??t?.accounts??[]}},unlink:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/unlink-account`,{method:`POST`,body:JSON.stringify(e)})).json()},linkSocial:async e=>{let t=this.getRoute(`auth`),n=e.callbackURL??(typeof window<`u`?window.location.href:void 0),r=await(await this.fetch(`${this.baseUrl}${t}/link-social`,{method:`POST`,body:JSON.stringify({provider:e.provider,callbackURL:n})})).json();return r?.data??r}}},this.storage={upload:async(e,t=`user`)=>{let n={filename:e.name,mimeType:e.type,size:e.size,scope:t},r=this.getRoute(`storage`),{data:i}=await(await this.fetch(`${this.baseUrl}${r}/upload/presigned`,{method:`POST`,body:JSON.stringify(n)})).json(),a=await this.fetchImpl(i.uploadUrl,{method:i.method,headers:i.headers,body:e});if(!a.ok)throw Error(`Storage Upload Failed: ${a.statusText}`);let o={fileId:i.fileId};return(await this.fetch(`${this.baseUrl}${r}/upload/complete`,{method:`POST`,body:JSON.stringify(o)})).json()},getDownloadUrl:async e=>{let t=this.getRoute(`storage`);return(await(await this.fetch(`${this.baseUrl}${t}/files/${e}/url`)).json()).url},getPresignedUrl:async e=>{let t=this.getRoute(`storage`);return(await this.fetch(`${this.baseUrl}${t}/upload/presigned`,{method:`POST`,body:JSON.stringify(e)})).json()},initChunkedUpload:async e=>{let t=this.getRoute(`storage`);return(await this.fetch(`${this.baseUrl}${t}/upload/chunked`,{method:`POST`,body:JSON.stringify(e)})).json()},uploadPart:async(e,t,n,r)=>{let i=this.getRoute(`storage`);return(await this.fetch(`${this.baseUrl}${i}/upload/chunked/${e}/chunk/${t}`,{method:`PUT`,headers:{"x-resume-token":n},body:r})).json()},completeChunkedUpload:async e=>{let t=this.getRoute(`storage`);return(await this.fetch(`${this.baseUrl}${t}/upload/chunked/${e.uploadId}/complete`,{method:`POST`,body:JSON.stringify(e)})).json()},resumeUpload:async(e,t,n,r)=>{let i=this.getRoute(`storage`),{totalChunks:a,uploadedChunks:o}=(await(await this.fetch(`${this.baseUrl}${i}/upload/chunked/${e}/progress`)).json()).data,s=[],c=t instanceof ArrayBuffer?t:await t.arrayBuffer();for(let t=o;t<a;t++){let i=t*n,a=Math.min(i+n,c.byteLength),o=new Blob([c.slice(i,a)]),l=await this.storage.uploadPart(e,t,r,o);s.push({chunkIndex:t,eTag:l.data.eTag})}return this.storage.completeChunkedUpload({uploadId:e,parts:s})}},this.automation={trigger:async(e,t)=>{let n=this.getRoute(`automation`);return(await this.fetch(`${this.baseUrl}${n}/trigger/${e}`,{method:`POST`,body:JSON.stringify(t)})).json()},list:async()=>{let e=this.getRoute(`automation`),t=await this.fetch(`${this.baseUrl}${e}`);return this.unwrapResponse(t)},get:async e=>{let t=this.getRoute(`automation`),n=await this.fetch(`${this.baseUrl}${t}/${e}`);return this.unwrapResponse(n)},create:async(e,t)=>{let n=this.getRoute(`automation`),r=await this.fetch(`${this.baseUrl}${n}`,{method:`POST`,body:JSON.stringify({name:e,...t})});return this.unwrapResponse(r)},update:async(e,t)=>{let n=this.getRoute(`automation`),r=await this.fetch(`${this.baseUrl}${n}/${e}`,{method:`PUT`,body:JSON.stringify({definition:t})});return this.unwrapResponse(r)},delete:async e=>{let t=this.getRoute(`automation`),n=await this.fetch(`${this.baseUrl}${t}/${e}`,{method:`DELETE`});return this.unwrapResponse(n)},toggle:async(e,t)=>{let n=this.getRoute(`automation`),r=await this.fetch(`${this.baseUrl}${n}/${e}/toggle`,{method:`POST`,body:JSON.stringify({enabled:t})});return this.unwrapResponse(r)},runs:{list:async(e,t)=>{let n=this.getRoute(`automation`),r=new URLSearchParams;t?.limit&&r.set(`limit`,String(t.limit)),t?.cursor&&r.set(`cursor`,t.cursor);let i=r.toString(),a=await this.fetch(`${this.baseUrl}${n}/${e}/runs${i?`?${i}`:``}`);return this.unwrapResponse(a)},get:async(e,t)=>{let n=this.getRoute(`automation`),r=await this.fetch(`${this.baseUrl}${n}/${e}/runs/${t}`);return this.unwrapResponse(r)}},getFlow:async e=>{let t=this.getRoute(`automation`),n=await this.fetch(`${this.baseUrl}${t}/${encodeURIComponent(e)}`);return this.unwrapResponse(n)},execute:async(e,t)=>{let n=this.getRoute(`automation`),r=await this.fetch(`${this.baseUrl}${n}/${encodeURIComponent(e)}/trigger`,{method:`POST`,body:JSON.stringify(t??{})});return this.unwrapResponse(r)},listRuns:async(e,t)=>{let n=this.getRoute(`automation`),r=new URLSearchParams;t?.limit!=null&&r.set(`limit`,String(t.limit)),t?.cursor&&r.set(`cursor`,t.cursor);let i=r.toString(),a=await this.fetch(`${this.baseUrl}${n}/${encodeURIComponent(e)}/runs${i?`?${i}`:``}`);return this.unwrapResponse(a)},getRun:async(e,t)=>{let n=this.getRoute(`automation`),r=await this.fetch(`${this.baseUrl}${n}/${encodeURIComponent(e)}/runs/${encodeURIComponent(t)}`);return this.unwrapResponse(r)}},this.permissions={check:async e=>{let t=this.getRoute(`permissions`),n=new URLSearchParams({object:e.object,action:e.action});e.recordId!==void 0&&n.set(`recordId`,e.recordId),e.field!==void 0&&n.set(`field`,e.field);let r=await this.fetch(`${this.baseUrl}${t}/check?${n.toString()}`);return this.unwrapResponse(r)},getObjectPermissions:async e=>{let t=this.getRoute(`permissions`),n=await this.fetch(`${this.baseUrl}${t}/objects/${encodeURIComponent(e)}`);return this.unwrapResponse(n)},getEffectivePermissions:async()=>{let e=this.getRoute(`permissions`),t=await this.fetch(`${this.baseUrl}${e}/effective`);return this.unwrapResponse(t)}},this.realtime={connect:async e=>{let t=this.getRoute(`realtime`),n=await this.fetch(`${this.baseUrl}${t}/connect`,{method:`POST`,body:JSON.stringify(e||{})});return this.unwrapResponse(n)},disconnect:async()=>{let e=this.getRoute(`realtime`);await this.fetch(`${this.baseUrl}${e}/disconnect`,{method:`POST`})},subscribe:async e=>{let t=this.getRoute(`realtime`),n=await this.fetch(`${this.baseUrl}${t}/subscribe`,{method:`POST`,body:JSON.stringify(e)});return this.unwrapResponse(n)},unsubscribe:async e=>{let t=this.getRoute(`realtime`);await this.fetch(`${this.baseUrl}${t}/unsubscribe`,{method:`POST`,body:JSON.stringify({subscriptionId:e})})},setPresence:async(e,t)=>{let n=this.getRoute(`realtime`);await this.fetch(`${this.baseUrl}${n}/presence`,{method:`PUT`,body:JSON.stringify({channel:e,state:t})})},getPresence:async e=>{let t=this.getRoute(`realtime`),n=await this.fetch(`${this.baseUrl}${t}/presence/${encodeURIComponent(e)}`);return this.unwrapResponse(n)}},this.workflow={getConfig:async e=>{let t=this.getRoute(`workflow`),n=await this.fetch(`${this.baseUrl}${t}/${encodeURIComponent(e)}/config`);return this.unwrapResponse(n)},getState:async(e,t)=>{let n=this.getRoute(`workflow`),r=await this.fetch(`${this.baseUrl}${n}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/state`);return this.unwrapResponse(r)},transition:async e=>{let t=this.getRoute(`workflow`),n=await this.fetch(`${this.baseUrl}${t}/${encodeURIComponent(e.object)}/${encodeURIComponent(e.recordId)}/transition`,{method:`POST`,body:JSON.stringify({transition:e.transition,comment:e.comment,data:e.data})});return this.unwrapResponse(n)},approve:async e=>{let t=this.getRoute(`workflow`),n=await this.fetch(`${this.baseUrl}${t}/${encodeURIComponent(e.object)}/${encodeURIComponent(e.recordId)}/approve`,{method:`POST`,body:JSON.stringify({comment:e.comment,data:e.data})});return this.unwrapResponse(n)},reject:async e=>{let t=this.getRoute(`workflow`),n=await this.fetch(`${this.baseUrl}${t}/${encodeURIComponent(e.object)}/${encodeURIComponent(e.recordId)}/reject`,{method:`POST`,body:JSON.stringify({reason:e.reason,comment:e.comment})});return this.unwrapResponse(n)}},this.views={list:async(e,t)=>{let n=this.getRoute(`views`),r=new URLSearchParams;t&&r.set(`type`,t);let i=r.toString(),a=await this.fetch(`${this.baseUrl}${n}/${encodeURIComponent(e)}${i?`?${i}`:``}`);return this.unwrapResponse(a)},get:async(e,t)=>{let n=this.getRoute(`views`),r=await this.fetch(`${this.baseUrl}${n}/${encodeURIComponent(e)}/${encodeURIComponent(t)}`);return this.unwrapResponse(r)},create:async(e,t)=>{let n=this.getRoute(`views`),r=await this.fetch(`${this.baseUrl}${n}/${encodeURIComponent(e)}`,{method:`POST`,body:JSON.stringify({object:e,data:t})});return this.unwrapResponse(r)},update:async(e,t,n)=>{let r=this.getRoute(`views`),i=await this.fetch(`${this.baseUrl}${r}/${encodeURIComponent(e)}/${encodeURIComponent(t)}`,{method:`PUT`,body:JSON.stringify({object:e,viewId:t,data:n})});return this.unwrapResponse(i)},delete:async(e,t)=>{let n=this.getRoute(`views`),r=await this.fetch(`${this.baseUrl}${n}/${encodeURIComponent(e)}/${encodeURIComponent(t)}`,{method:`DELETE`});return this.unwrapResponse(r)}},this.notifications={registerDevice:async e=>{let t=this.getRoute(`notifications`),n=await this.fetch(`${this.baseUrl}${t}/devices`,{method:`POST`,body:JSON.stringify(e)});return this.unwrapResponse(n)},unregisterDevice:async e=>{let t=this.getRoute(`notifications`),n=await this.fetch(`${this.baseUrl}${t}/devices/${encodeURIComponent(e)}`,{method:`DELETE`});return this.unwrapResponse(n)},getPreferences:async()=>{let e=this.getRoute(`notifications`),t=await this.fetch(`${this.baseUrl}${e}/preferences`);return this.unwrapResponse(t)},updatePreferences:async e=>{let t=this.getRoute(`notifications`),n=await this.fetch(`${this.baseUrl}${t}/preferences`,{method:`PUT`,body:JSON.stringify({preferences:e})});return this.unwrapResponse(n)},list:async e=>{let t=this.getRoute(`notifications`),n=new URLSearchParams;e?.read!==void 0&&n.set(`read`,String(e.read)),e?.type&&n.set(`type`,e.type),e?.limit&&n.set(`limit`,String(e.limit)),e?.cursor&&n.set(`cursor`,e.cursor);let r=n.toString(),i=await this.fetch(`${this.baseUrl}${t}${r?`?${r}`:``}`);return this.unwrapResponse(i)},markRead:async e=>{let t=this.getRoute(`notifications`),n=await this.fetch(`${this.baseUrl}${t}/read`,{method:`POST`,body:JSON.stringify({ids:e})});return this.unwrapResponse(n)},markAllRead:async()=>{let e=this.getRoute(`notifications`),t=await this.fetch(`${this.baseUrl}${e}/read/all`,{method:`POST`});return this.unwrapResponse(t)}},this.ai={nlq:async e=>{let t=this.getRoute(`ai`),n=await this.fetch(`${this.baseUrl}${t}/nlq`,{method:`POST`,body:JSON.stringify(e)});return this.unwrapResponse(n)},suggest:async e=>{let t=this.getRoute(`ai`),n=await this.fetch(`${this.baseUrl}${t}/suggest`,{method:`POST`,body:JSON.stringify(e)});return this.unwrapResponse(n)},insights:async e=>{let t=this.getRoute(`ai`),n=await this.fetch(`${this.baseUrl}${t}/insights`,{method:`POST`,body:JSON.stringify(e)});return this.unwrapResponse(n)}},this.i18n={getLocales:async()=>{let e=this.getRoute(`i18n`),t=await this.fetch(`${this.baseUrl}${e}/locales`);return this.unwrapResponse(t)},getTranslations:async(e,t)=>{let n=this.getRoute(`i18n`),r=new URLSearchParams;r.set(`locale`,e),t?.namespace&&r.set(`namespace`,t.namespace),t?.keys&&r.set(`keys`,t.keys.join(`,`));let i=await this.fetch(`${this.baseUrl}${n}/translations?${r.toString()}`);return this.unwrapResponse(i)},getFieldLabels:async(e,t)=>{let n=this.getRoute(`i18n`),r=await this.fetch(`${this.baseUrl}${n}/labels/${encodeURIComponent(e)}?locale=${encodeURIComponent(t)}`);return this.unwrapResponse(r)}},this.feed={list:async(e,t,n)=>{let r=this.getRoute(`data`),i=new URLSearchParams;n?.type&&i.set(`type`,n.type),n?.limit&&i.set(`limit`,String(n.limit)),n?.cursor&&i.set(`cursor`,n.cursor);let a=i.toString(),o=await this.fetch(`${this.baseUrl}${r}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/feed${a?`?${a}`:``}`);return this.unwrapResponse(o)},create:async(e,t,n)=>{let r=this.getRoute(`data`),i=await this.fetch(`${this.baseUrl}${r}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/feed`,{method:`POST`,body:JSON.stringify(n)});return this.unwrapResponse(i)},update:async(e,t,n,r)=>{let i=this.getRoute(`data`),a=await this.fetch(`${this.baseUrl}${i}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/feed/${encodeURIComponent(n)}`,{method:`PUT`,body:JSON.stringify(r)});return this.unwrapResponse(a)},delete:async(e,t,n)=>{let r=this.getRoute(`data`),i=await this.fetch(`${this.baseUrl}${r}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/feed/${encodeURIComponent(n)}`,{method:`DELETE`});return this.unwrapResponse(i)},addReaction:async(e,t,n,r)=>{let i=this.getRoute(`data`),a=await this.fetch(`${this.baseUrl}${i}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/feed/${encodeURIComponent(n)}/reactions`,{method:`POST`,body:JSON.stringify({emoji:r})});return this.unwrapResponse(a)},removeReaction:async(e,t,n,r)=>{let i=this.getRoute(`data`),a=await this.fetch(`${this.baseUrl}${i}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/feed/${encodeURIComponent(n)}/reactions/${encodeURIComponent(r)}`,{method:`DELETE`});return this.unwrapResponse(a)},pin:async(e,t,n)=>{let r=this.getRoute(`data`),i=await this.fetch(`${this.baseUrl}${r}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/feed/${encodeURIComponent(n)}/pin`,{method:`POST`});return this.unwrapResponse(i)},unpin:async(e,t,n)=>{let r=this.getRoute(`data`),i=await this.fetch(`${this.baseUrl}${r}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/feed/${encodeURIComponent(n)}/pin`,{method:`DELETE`});return this.unwrapResponse(i)},star:async(e,t,n)=>{let r=this.getRoute(`data`),i=await this.fetch(`${this.baseUrl}${r}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/feed/${encodeURIComponent(n)}/star`,{method:`POST`});return this.unwrapResponse(i)},unstar:async(e,t,n)=>{let r=this.getRoute(`data`),i=await this.fetch(`${this.baseUrl}${r}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/feed/${encodeURIComponent(n)}/star`,{method:`DELETE`});return this.unwrapResponse(i)},search:async(e,t,n,r)=>{let i=this.getRoute(`data`),a=new URLSearchParams;a.set(`query`,n),r?.type&&a.set(`type`,r.type),r?.actorId&&a.set(`actorId`,r.actorId),r?.dateFrom&&a.set(`dateFrom`,r.dateFrom),r?.dateTo&&a.set(`dateTo`,r.dateTo),r?.limit&&a.set(`limit`,String(r.limit)),r?.cursor&&a.set(`cursor`,r.cursor);let o=await this.fetch(`${this.baseUrl}${i}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/feed/search?${a.toString()}`);return this.unwrapResponse(o)},getChangelog:async(e,t,n)=>{let r=this.getRoute(`data`),i=new URLSearchParams;n?.field&&i.set(`field`,n.field),n?.actorId&&i.set(`actorId`,n.actorId),n?.dateFrom&&i.set(`dateFrom`,n.dateFrom),n?.dateTo&&i.set(`dateTo`,n.dateTo),n?.limit&&i.set(`limit`,String(n.limit)),n?.cursor&&i.set(`cursor`,n.cursor);let a=i.toString(),o=await this.fetch(`${this.baseUrl}${r}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/changelog${a?`?${a}`:``}`);return this.unwrapResponse(o)},subscribe:async(e,t,n)=>{let r=this.getRoute(`data`),i=await this.fetch(`${this.baseUrl}${r}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/subscribe`,{method:`POST`,body:JSON.stringify(n||{})});return this.unwrapResponse(i)},unsubscribe:async(e,t)=>{let n=this.getRoute(`data`),r=await this.fetch(`${this.baseUrl}${n}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/subscribe`,{method:`DELETE`});return this.unwrapResponse(r)}},this.data={query:async(e,t)=>{let n=this.getRoute(`data`),r=await this.fetch(`${this.baseUrl}${n}/${e}/query`,{method:`POST`,body:JSON.stringify(t)});return this.unwrapResponse(r)},find:async(e,t={})=>{let n=this.getRoute(`data`),r=new URLSearchParams,i=t,a={};if(`where`in t||`fields`in t||`orderBy`in t||`offset`in t?(i.where&&(a.filter=i.where),i.fields&&(a.select=i.fields),i.orderBy&&(a.sort=i.orderBy),i.limit!=null&&(a.top=i.limit),i.offset!=null&&(a.skip=i.offset),i.aggregations&&(a.aggregations=i.aggregations),i.groupBy&&(a.groupBy=i.groupBy)):Object.assign(a,t),a.top&&r.set(`top`,a.top.toString()),a.skip&&r.set(`skip`,a.skip.toString()),a.sort)if(Array.isArray(a.sort)&&typeof a.sort[0]==`object`)r.set(`sort`,JSON.stringify(a.sort));else{let e=Array.isArray(a.sort)?a.sort.join(`,`):a.sort;r.set(`sort`,e)}a.select&&r.set(`select`,a.select.join(`,`));let o=a.filter??a.filters;o&&(this.isFilterAST(o)||Array.isArray(o)?r.set(`filter`,JSON.stringify(o)):typeof o==`object`&&o&&Object.entries(o).forEach(([e,t])=>{t!=null&&r.append(e,String(t))})),a.aggregations&&r.set(`aggregations`,JSON.stringify(a.aggregations)),a.groupBy&&r.set(`groupBy`,a.groupBy.join(`,`));let s=await this.fetch(`${this.baseUrl}${n}/${e}?${r.toString()}`);return this.unwrapResponse(s)},get:async(e,t)=>{let n=this.getRoute(`data`),r=await this.fetch(`${this.baseUrl}${n}/${e}/${t}`);return this.unwrapResponse(r)},create:async(e,t)=>{let n=this.getRoute(`data`),r=await this.fetch(`${this.baseUrl}${n}/${e}`,{method:`POST`,body:JSON.stringify(t)});return this.unwrapResponse(r)},createMany:async(e,t)=>{let n=this.getRoute(`data`),r=await this.fetch(`${this.baseUrl}${n}/${e}/createMany`,{method:`POST`,body:JSON.stringify(t)});return this.unwrapResponse(r)},update:async(e,t,n,r)=>{let i=this.getRoute(`data`),a={};r?.ifMatch&&(a[`If-Match`]=String(r.ifMatch));let o=await this.fetch(`${this.baseUrl}${i}/${e}/${t}`,{method:`PATCH`,body:JSON.stringify(n),...Object.keys(a).length?{headers:a}:{}});return this.unwrapResponse(o)},batch:async(e,t)=>{let n=this.getRoute(`data`),r=await this.fetch(`${this.baseUrl}${n}/${e}/batch`,{method:`POST`,body:JSON.stringify(t)});return this.unwrapResponse(r)},updateMany:async(e,t,n)=>{let r=this.getRoute(`data`),i={records:t,options:n},a=await this.fetch(`${this.baseUrl}${r}/${e}/updateMany`,{method:`POST`,body:JSON.stringify(i)});return this.unwrapResponse(a)},delete:async(e,t,n)=>{let r=this.getRoute(`data`),i={};n?.ifMatch&&(i[`If-Match`]=String(n.ifMatch));let a=await this.fetch(`${this.baseUrl}${r}/${e}/${t}`,{method:`DELETE`,...Object.keys(i).length?{headers:i}:{}});return this.unwrapResponse(a)},deleteMany:async(e,t,n)=>{let r=this.getRoute(`data`),i={ids:t,options:n},a=await this.fetch(`${this.baseUrl}${r}/${e}/deleteMany`,{method:`POST`,body:JSON.stringify(i)});return this.unwrapResponse(a)}},this.baseUrl=e.baseUrl.replace(/\/$/,``),this.token=e.token,this.environmentId=e.environmentId,this.locale=e.locale,this.fetchImpl=e.fetch||globalThis.fetch.bind(globalThis),this.logger=e.logger||Yg({level:e.debug?`debug`:`info`,format:`pretty`}),this.realtimeAPI=new Xg(this.baseUrl,this.token),this.logger.debug(`ObjectStack client created`,{baseUrl:this.baseUrl})}async connect(){this.logger.debug(`Connecting to ObjectStack server`,{baseUrl:this.baseUrl});try{let e;try{let t=`${this.baseUrl}/api/v1/discovery`;this.logger.debug(`Probing protocol-standard discovery endpoint`,{url:t});let n=await this.fetchImpl(t);if(n.ok){let t=await n.json();e=t.data||t,this.logger.debug(`Discovered via /api/v1/discovery`)}}catch(e){this.logger.debug(`Protocol-standard discovery probe failed`,{error:e.message})}if(!e){let t;try{t=`${new URL(this.baseUrl).origin}/.well-known/objectstack`}catch{t=`/.well-known/objectstack`}this.logger.debug(`Falling back to .well-known discovery`,{url:t});let n=await this.fetchImpl(t);if(!n.ok)throw Error(`Failed to connect to ${t}: ${n.statusText}`);let r=await n.json();e=r.data||r}if(!e)throw Error(`Connection failed: No discovery data returned`);return this.discoveryInfo=e,this.logger.info(`Connected to ObjectStack server`,{version:e.version,apiName:e.apiName,services:e.services}),e}catch(e){throw this.logger.error(`Failed to connect to ObjectStack server`,e,{baseUrl:this.baseUrl}),e}}get capabilities(){let e=this.discoveryInfo?.capabilities;if(!e)return;let t={};for(let[n,r]of Object.entries(e))t[n]=typeof r==`object`&&r?!!r.enabled:!!r;return t}project(e){if(!e)throw Error(`[ObjectStack] project(id): environmentId is required`);return new Qg(this,e)}_baseUrl(){return this.baseUrl}_fetch(e,t){return this.fetch(e,t)}_unwrap(e){return this.unwrapResponse(e)}_isFilterAST(e){return this.isFilterAST(e)}setProjectId(e){this.environmentId=e,this.logger.debug(`Active project changed`,{environmentId:e})}getProjectId(){return this.environmentId}setLocale(e){this.locale=e,this.logger.debug(`Active locale changed`,{locale:e})}getLocale(){return this.locale}get events(){return this.realtimeAPI}isFilterAST(e){return $f(e)}async unwrapResponse(e){let t=await e.json();return t&&typeof t.success==`boolean`&&`data`in t?t.data:t}async fetch(e,t={}){this.logger.debug(`HTTP request`,{method:t.method||`GET`,url:e,hasBody:!!t.body});let n={"Content-Type":`application/json`,...t.headers||{}};this.token&&(n.Authorization=`Bearer ${this.token}`),this.environmentId&&(n[`X-Environment-Id`]=this.environmentId),this.locale&&!Object.keys(n).some(e=>e.toLowerCase()===`accept-language`)&&(n[`Accept-Language`]=this.locale);let r=await this.fetchImpl(e,{...t,headers:n});if(this.logger.debug(`HTTP response`,{method:t.method||`GET`,url:e,status:r.status,ok:r.ok}),!r.ok){let n;try{n=await r.json()}catch{n={message:r.statusText}}this.logger.error(`HTTP request failed`,void 0,{method:t.method||`GET`,url:e,status:r.status,error:n});let i=n?.message??n?.error?.message??(typeof n?.error==`string`?n.error:void 0)??r.statusText,a=n?.code||n?.error?.code,o=Error(`[ObjectStack] ${a?`${a}: `:``}${i}`);throw o.code=a,o.category=n?.category,o.httpStatus=r.status,o.retryable=n?.retryable,o.details=n?.details||n,o}return r}getRoute(e){let t=this.discoveryInfo?.routes;if(t){let n=t[e];if(n)return n}return{data:`/api/v1/data`,metadata:`/api/v1/meta`,discovery:`/api/v1/discovery`,ui:`/api/v1/ui`,auth:`/api/v1/auth`,analytics:`/api/v1/analytics`,storage:`/api/v1/storage`,automation:`/api/v1/automation`,packages:`/api/v1/packages`,permissions:`/api/v1/permissions`,realtime:`/api/v1/realtime`,workflow:`/api/v1/workflow`,views:`/api/v1/ui/views`,notifications:`/api/v1/notifications`,ai:`/api/v1/ai`,i18n:`/api/v1/i18n`,feed:`/api/v1/feed`,graphql:`/graphql`}[e]||`/api/v1/${e}`}},Qg=class{constructor(e,t){this.meta={getTypes:async()=>{let e=await this.parent._fetch(this.url(`/meta`));return this.parent._unwrap(e)},getItems:async(e,t)=>{let n=new URLSearchParams;t?.packageId&&n.set(`package`,t.packageId);let r=n.toString(),i=await this.parent._fetch(this.url(`/meta/${e}${r?`?${r}`:``}`));return this.parent._unwrap(i)},getItem:async(e,t,n)=>{let r=new URLSearchParams;n?.packageId&&r.set(`package`,n.packageId);let i=r.toString(),a=await this.parent._fetch(this.url(`/meta/${e}/${t}${i?`?${i}`:``}`));return this.parent._unwrap(a)},saveItem:async(e,t,n)=>{let r=await this.parent._fetch(this.url(`/meta/${e}/${t}`),{method:`PUT`,body:JSON.stringify(n)});return this.parent._unwrap(r)},deleteItem:async(e,t)=>{let n=await this.parent._fetch(this.url(`/meta/${encodeURIComponent(e)}/${encodeURIComponent(t)}`),{method:`DELETE`});return this.parent._unwrap(n)},getHistory:async(e,t,n)=>{let r=new URLSearchParams;n?.sinceSeq!==void 0&&r.set(`sinceSeq`,String(n.sinceSeq)),n?.limit!==void 0&&r.set(`limit`,String(n.limit));let i=r.toString(),a=await this.parent._fetch(this.url(`/meta/${encodeURIComponent(e)}/${encodeURIComponent(t)}/history${i?`?${i}`:``}`));return this.parent._unwrap(a)}},this.data={query:async(e,t)=>{let n=await this.parent._fetch(this.url(`/data/${e}/query`),{method:`POST`,body:JSON.stringify(t)});return this.parent._unwrap(n)},find:async(e,t={})=>{let n=new URLSearchParams,r=t,i={};if(`where`in t||`fields`in t||`orderBy`in t||`offset`in t?(r.where&&(i.filter=r.where),r.fields&&(i.select=r.fields),r.orderBy&&(i.sort=r.orderBy),r.limit!=null&&(i.top=r.limit),r.offset!=null&&(i.skip=r.offset),r.aggregations&&(i.aggregations=r.aggregations),r.groupBy&&(i.groupBy=r.groupBy)):Object.assign(i,t),i.top&&n.set(`top`,i.top.toString()),i.skip&&n.set(`skip`,i.skip.toString()),i.sort)if(Array.isArray(i.sort)&&typeof i.sort[0]==`object`)n.set(`sort`,JSON.stringify(i.sort));else{let e=Array.isArray(i.sort)?i.sort.join(`,`):i.sort;n.set(`sort`,e)}i.select&&n.set(`select`,i.select.join(`,`));let a=i.filter??i.filters;a&&(this.parent._isFilterAST(a)||Array.isArray(a)?n.set(`filter`,JSON.stringify(a)):typeof a==`object`&&a&&Object.entries(a).forEach(([e,t])=>{t!=null&&n.append(e,String(t))})),i.aggregations&&n.set(`aggregations`,JSON.stringify(i.aggregations)),i.groupBy&&n.set(`groupBy`,i.groupBy.join(`,`));let o=n.toString(),s=await this.parent._fetch(this.url(`/data/${e}${o?`?${o}`:``}`));return this.parent._unwrap(s)},get:async(e,t)=>{let n=await this.parent._fetch(this.url(`/data/${e}/${t}`));return this.parent._unwrap(n)},create:async(e,t)=>{let n=await this.parent._fetch(this.url(`/data/${e}`),{method:`POST`,body:JSON.stringify(t)});return this.parent._unwrap(n)},createMany:async(e,t)=>{let n=await this.parent._fetch(this.url(`/data/${e}/createMany`),{method:`POST`,body:JSON.stringify(t)});return this.parent._unwrap(n)},update:async(e,t,n)=>{let r=await this.parent._fetch(this.url(`/data/${e}/${t}`),{method:`PATCH`,body:JSON.stringify(n)});return this.parent._unwrap(r)},batch:async(e,t)=>{let n=await this.parent._fetch(this.url(`/data/${e}/batch`),{method:`POST`,body:JSON.stringify(t)});return this.parent._unwrap(n)},updateMany:async(e,t,n)=>{let r={records:t,options:n},i=await this.parent._fetch(this.url(`/data/${e}/updateMany`),{method:`POST`,body:JSON.stringify(r)});return this.parent._unwrap(i)},delete:async(e,t)=>{let n=await this.parent._fetch(this.url(`/data/${e}/${t}`),{method:`DELETE`});return this.parent._unwrap(n)},deleteMany:async(e,t,n)=>{let r={ids:t,options:n},i=await this.parent._fetch(this.url(`/data/${e}/deleteMany`),{method:`POST`,body:JSON.stringify(r)});return this.parent._unwrap(i)}},this.packages={list:async()=>{let e=await this.parent._fetch(this.url(`/packages`));return this.parent._unwrap(e)},get:async(e,t)=>{let n=t?`?version=${encodeURIComponent(t)}`:``,r=await this.parent._fetch(this.url(`/packages/${encodeURIComponent(e)}${n}`));return this.parent._unwrap(r)}},this.automation={getFlow:async e=>{let t=await this.parent._fetch(this.url(`/automation/${encodeURIComponent(e)}`));return this.parent._unwrap(t)},execute:async(e,t)=>{let n=await this.parent._fetch(this.url(`/automation/${encodeURIComponent(e)}/trigger`),{method:`POST`,body:JSON.stringify(t??{})});return this.parent._unwrap(n)},listRuns:async(e,t)=>{let n=new URLSearchParams;t?.limit!=null&&n.set(`limit`,String(t.limit)),t?.cursor&&n.set(`cursor`,t.cursor);let r=n.toString(),i=await this.parent._fetch(this.url(`/automation/${encodeURIComponent(e)}/runs${r?`?${r}`:``}`));return this.parent._unwrap(i)},getRun:async(e,t)=>{let n=await this.parent._fetch(this.url(`/automation/${encodeURIComponent(e)}/runs/${encodeURIComponent(t)}`));return this.parent._unwrap(n)}},this.parent=e,this.environmentId=t}getProjectId(){return this.environmentId}scope(){return`/api/v1/environments/${encodeURIComponent(this.environmentId)}`}url(e){return`${this.parent._baseUrl()}${this.scope()}${e}`}},$g=(0,j.createContext)(null),e_=(0,j.createContext)(void 0);function t_({client:e,locale:t,children:n}){let r=(0,j.useRef)(null);return(r.current?.client!==e||r.current?.locale!==t)&&(r.current={client:e,locale:t},e.setLocale?.(t)),j.createElement($g.Provider,{value:e},j.createElement(e_.Provider,{value:t},n))}function n_(){let e=(0,j.useContext)($g);if(!e)throw Error(`useClient must be used within an ObjectStackProvider. Make sure your component is wrapped with <ObjectStackProvider client={...}>.`);return e}var r_=1,i_=1e6,a_=0;function o_(){return a_=(a_+1)%(2**53-1),a_.toString()}var s_=new Map,c_=e=>{if(s_.has(e))return;let t=setTimeout(()=>{s_.delete(e),f_({type:`REMOVE_TOAST`,toastId:e})},i_);s_.set(e,t)},l_=(e,t)=>{switch(t.type){case`ADD_TOAST`:return{...e,toasts:[t.toast,...e.toasts].slice(0,r_)};case`UPDATE_TOAST`:return{...e,toasts:e.toasts.map(e=>e.id===t.toast.id?{...e,...t.toast}:e)};case`DISMISS_TOAST`:{let{toastId:n}=t;return n?c_(n):e.toasts.forEach(e=>{c_(e.id)}),{...e,toasts:e.toasts.map(e=>e.id===n||n===void 0?{...e,open:!1}:e)}}case`REMOVE_TOAST`:return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(e=>e.id!==t.toastId)}}},u_=[],d_={toasts:[]};function f_(e){d_=l_(d_,e),u_.forEach(e=>{e(d_)})}function q({...e}){let t=o_(),n=e=>f_({type:`UPDATE_TOAST`,toast:{...e,id:t}}),r=()=>f_({type:`DISMISS_TOAST`,toastId:t});return f_({type:`ADD_TOAST`,toast:{...e,id:t,open:!0,onOpenChange:e=>{e||r()}}}),{id:t,dismiss:r,update:n}}function p_(){let[e,t]=j.useState(d_);return j.useEffect(()=>(u_.push(t),()=>{let e=u_.indexOf(t);e>-1&&u_.splice(e,1)}),[e]),{...e,toast:q,dismiss:e=>f_({type:`DISMISS_TOAST`,toastId:e})}}typeof window<`u`&&window.document&&window.document.createElement;function J(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r.defaultPrevented)return t?.(r)}}function m_(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function h_(...e){return t=>{let n=!1,r=e.map(e=>{let r=m_(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():m_(e[t],null)}}}}function g_(...e){return j.useCallback(h_(...e),e)}function __(e,t){let n=j.createContext(t),r=e=>{let{children:t,...r}=e,i=j.useMemo(()=>r,Object.values(r));return(0,M.jsx)(n.Provider,{value:i,children:t})};r.displayName=e+`Provider`;function i(r){let i=j.useContext(n);if(i)return i;if(t!==void 0)return t;throw Error(`\`${r}\` must be used within \`${e}\``)}return[r,i]}function v_(e,t=[]){let n=[];function r(t,r){let i=j.createContext(r),a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=j.useMemo(()=>o,Object.values(o));return(0,M.jsx)(s.Provider,{value:c,children:r})};o.displayName=t+`Provider`;function s(n,o){let s=o?.[e]?.[a]||i,c=j.useContext(s);if(c)return c;if(r!==void 0)return r;throw Error(`\`${n}\` must be used within \`${t}\``)}return[o,s]}let i=()=>{let t=n.map(e=>j.createContext(e));return function(n){let r=n?.[e]||t;return j.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,y_(i,...t)]}function y_(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return j.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}function b_(e){let t=x_(e),n=j.forwardRef((e,n)=>{let{children:r,...i}=e,a=j.Children.toArray(r),o=a.find(w_);if(o){let e=o.props.children,r=a.map(t=>t===o?j.Children.count(e)>1?j.Children.only(null):j.isValidElement(e)?e.props.children:null:t);return(0,M.jsx)(t,{...i,ref:n,children:j.isValidElement(e)?j.cloneElement(e,void 0,r):null})}return(0,M.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function x_(e){let t=j.forwardRef((e,t)=>{let{children:n,...r}=e;if(j.isValidElement(n)){let e=E_(n),i=T_(r,n.props);return n.type!==j.Fragment&&(i.ref=t?h_(t,e):e),j.cloneElement(n,i)}return j.Children.count(n)>1?j.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var S_=Symbol(`radix.slottable`);function C_(e){let t=({children:e})=>(0,M.jsx)(M.Fragment,{children:e});return t.displayName=`${e}.Slottable`,t.__radixId=S_,t}function w_(e){return j.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===S_}function T_(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function E_(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function D_(e){let t=e+`CollectionProvider`,[n,r]=v_(t),[i,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=e=>{let{scope:t,children:n}=e,r=j.useRef(null),a=j.useRef(new Map).current;return(0,M.jsx)(i,{scope:t,itemMap:a,collectionRef:r,children:n})};o.displayName=t;let s=e+`CollectionSlot`,c=b_(s),l=j.forwardRef((e,t)=>{let{scope:n,children:r}=e;return(0,M.jsx)(c,{ref:g_(t,a(s,n).collectionRef),children:r})});l.displayName=s;let u=e+`CollectionItemSlot`,d=`data-radix-collection-item`,f=b_(u),p=j.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=j.useRef(null),s=g_(t,o),c=a(u,n);return j.useEffect(()=>(c.itemMap.set(o,{ref:o,...i}),()=>void c.itemMap.delete(o))),(0,M.jsx)(f,{[d]:``,ref:s,children:r})});p.displayName=u;function m(t){let n=a(e+`CollectionConsumer`,t);return j.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${d}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return[{Provider:o,Slot:l,ItemSlot:p},m,r]}var O_=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=b_(`Primitive.${t}`),r=j.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,M.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function k_(e,t){e&&Gi.flushSync(()=>e.dispatchEvent(t))}function A_(e){let t=j.useRef(e);return j.useEffect(()=>{t.current=e}),j.useMemo(()=>(...e)=>t.current?.(...e),[])}function j_(e,t=globalThis?.document){let n=A_(e);j.useEffect(()=>{let e=e=>{e.key===`Escape`&&n(e)};return t.addEventListener(`keydown`,e,{capture:!0}),()=>t.removeEventListener(`keydown`,e,{capture:!0})},[n,t])}var M_=`DismissableLayer`,N_=`dismissableLayer.update`,P_=`dismissableLayer.pointerDownOutside`,F_=`dismissableLayer.focusOutside`,I_,L_=j.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),R_=j.forwardRef((e,t)=>{let{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:a,onInteractOutside:o,onDismiss:s,...c}=e,l=j.useContext(L_),[u,d]=j.useState(null),f=u?.ownerDocument??globalThis?.document,[,p]=j.useState({}),m=g_(t,e=>d(e)),h=Array.from(l.layers),[g]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),_=h.indexOf(g),v=u?h.indexOf(u):-1,y=l.layersWithOutsidePointerEventsDisabled.size>0,b=v>=_,x=V_(e=>{let t=e.target,n=[...l.branches].some(e=>e.contains(t));!b||n||(i?.(e),o?.(e),e.defaultPrevented||s?.())},f),S=H_(e=>{let t=e.target;[...l.branches].some(e=>e.contains(t))||(a?.(e),o?.(e),e.defaultPrevented||s?.())},f);return j_(e=>{v===l.layers.size-1&&(r?.(e),!e.defaultPrevented&&s&&(e.preventDefault(),s()))},f),j.useEffect(()=>{if(u)return n&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(I_=f.body.style.pointerEvents,f.body.style.pointerEvents=`none`),l.layersWithOutsidePointerEventsDisabled.add(u)),l.layers.add(u),U_(),()=>{n&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=I_)}},[u,f,n,l]),j.useEffect(()=>()=>{u&&(l.layers.delete(u),l.layersWithOutsidePointerEventsDisabled.delete(u),U_())},[u,l]),j.useEffect(()=>{let e=()=>p({});return document.addEventListener(N_,e),()=>document.removeEventListener(N_,e)},[]),(0,M.jsx)(O_.div,{...c,ref:m,style:{pointerEvents:y?b?`auto`:`none`:void 0,...e.style},onFocusCapture:J(e.onFocusCapture,S.onFocusCapture),onBlurCapture:J(e.onBlurCapture,S.onBlurCapture),onPointerDownCapture:J(e.onPointerDownCapture,x.onPointerDownCapture)})});R_.displayName=M_;var z_=`DismissableLayerBranch`,B_=j.forwardRef((e,t)=>{let n=j.useContext(L_),r=j.useRef(null),i=g_(t,r);return j.useEffect(()=>{let e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),(0,M.jsx)(O_.div,{...e,ref:i})});B_.displayName=z_;function V_(e,t=globalThis?.document){let n=A_(e),r=j.useRef(!1),i=j.useRef(()=>{});return j.useEffect(()=>{let e=e=>{if(e.target&&!r.current){let r=function(){W_(P_,n,a,{discrete:!0})},a={originalEvent:e};e.pointerType===`touch`?(t.removeEventListener(`click`,i.current),i.current=r,t.addEventListener(`click`,i.current,{once:!0})):r()}else t.removeEventListener(`click`,i.current);r.current=!1},a=window.setTimeout(()=>{t.addEventListener(`pointerdown`,e)},0);return()=>{window.clearTimeout(a),t.removeEventListener(`pointerdown`,e),t.removeEventListener(`click`,i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function H_(e,t=globalThis?.document){let n=A_(e),r=j.useRef(!1);return j.useEffect(()=>{let e=e=>{e.target&&!r.current&&W_(F_,n,{originalEvent:e},{discrete:!1})};return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function U_(){let e=new CustomEvent(N_);document.dispatchEvent(e)}function W_(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?k_(i,a):i.dispatchEvent(a)}var G_=R_,K_=B_,q_=globalThis?.document?j.useLayoutEffect:()=>{},J_=`Portal`,Y_=j.forwardRef((e,t)=>{let{container:n,...r}=e,[i,a]=j.useState(!1);q_(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?Gi.createPortal((0,M.jsx)(O_.div,{...r,ref:t}),o):null});Y_.displayName=J_;function X_(e,t){return j.useReducer((e,n)=>t[e][n]??e,e)}var Z_=e=>{let{present:t,children:n}=e,r=Q_(t),i=typeof n==`function`?n({present:r.isPresent}):j.Children.only(n),a=g_(r.ref,ev(i));return typeof n==`function`||r.isPresent?j.cloneElement(i,{ref:a}):null};Z_.displayName=`Presence`;function Q_(e){let[t,n]=j.useState(),r=j.useRef(null),i=j.useRef(e),a=j.useRef(`none`),[o,s]=X_(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return j.useEffect(()=>{let e=$_(r.current);a.current=o===`mounted`?e:`none`},[o]),q_(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,o=$_(t);e?s(`MOUNT`):o===`none`||t?.display===`none`?s(`UNMOUNT`):s(n&&r!==o?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,s]),q_(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=a=>{let o=$_(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(s(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},c=e=>{e.target===t&&(a.current=$_(r.current))};return t.addEventListener(`animationstart`,c),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,c),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}else s(`ANIMATION_END`)},[t,s]),{isPresent:[`mounted`,`unmountSuspended`].includes(o),ref:j.useCallback(e=>{r.current=e?getComputedStyle(e):null,n(e)},[])}}function $_(e){return e?.animationName||`none`}function ev(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var tv=j.useInsertionEffect||q_;function nv({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){let[i,a,o]=rv({defaultProp:t,onChange:n}),s=e!==void 0,c=s?e:i;{let t=j.useRef(e!==void 0);j.useEffect(()=>{let e=t.current;e!==s&&console.warn(`${r} is changing from ${e?`controlled`:`uncontrolled`} to ${s?`controlled`:`uncontrolled`}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),t.current=s},[s,r])}return[c,j.useCallback(t=>{if(s){let n=iv(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}function rv({defaultProp:e,onChange:t}){let[n,r]=j.useState(e),i=j.useRef(n),a=j.useRef(t);return tv(()=>{a.current=t},[t]),j.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}function iv(e){return typeof e==`function`}var av=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),ov=`VisuallyHidden`,sv=j.forwardRef((e,t)=>(0,M.jsx)(O_.span,{...e,ref:t,style:{...av,...e.style}}));sv.displayName=ov;var cv=sv,lv=`ToastProvider`,[uv,dv,fv]=D_(`Toast`),[pv,mv]=v_(`Toast`,[fv]),[hv,gv]=pv(lv),_v=e=>{let{__scopeToast:t,label:n=`Notification`,duration:r=5e3,swipeDirection:i=`right`,swipeThreshold:a=50,children:o}=e,[s,c]=j.useState(null),[l,u]=j.useState(0),d=j.useRef(!1),f=j.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${lv}\`. Expected non-empty \`string\`.`),(0,M.jsx)(uv.Provider,{scope:t,children:(0,M.jsx)(hv,{scope:t,label:n,duration:r,swipeDirection:i,swipeThreshold:a,toastCount:l,viewport:s,onViewportChange:c,onToastAdd:j.useCallback(()=>u(e=>e+1),[]),onToastRemove:j.useCallback(()=>u(e=>e-1),[]),isFocusedToastEscapeKeyDownRef:d,isClosePausedRef:f,children:o})})};_v.displayName=lv;var vv=`ToastViewport`,yv=[`F8`],bv=`toast.viewportPause`,xv=`toast.viewportResume`,Sv=j.forwardRef((e,t)=>{let{__scopeToast:n,hotkey:r=yv,label:i=`Notifications ({hotkey})`,...a}=e,o=gv(vv,n),s=dv(n),c=j.useRef(null),l=j.useRef(null),u=j.useRef(null),d=j.useRef(null),f=g_(t,d,o.onViewportChange),p=r.join(`+`).replace(/Key/g,``).replace(/Digit/g,``),m=o.toastCount>0;j.useEffect(()=>{let e=e=>{r.length!==0&&r.every(t=>e[t]||e.code===t)&&d.current?.focus()};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[r]),j.useEffect(()=>{let e=c.current,t=d.current;if(m&&e&&t){let n=()=>{if(!o.isClosePausedRef.current){let e=new CustomEvent(bv);t.dispatchEvent(e),o.isClosePausedRef.current=!0}},r=()=>{if(o.isClosePausedRef.current){let e=new CustomEvent(xv);t.dispatchEvent(e),o.isClosePausedRef.current=!1}},i=t=>{e.contains(t.relatedTarget)||r()},a=()=>{e.contains(document.activeElement)||r()};return e.addEventListener(`focusin`,n),e.addEventListener(`focusout`,i),e.addEventListener(`pointermove`,n),e.addEventListener(`pointerleave`,a),window.addEventListener(`blur`,n),window.addEventListener(`focus`,r),()=>{e.removeEventListener(`focusin`,n),e.removeEventListener(`focusout`,i),e.removeEventListener(`pointermove`,n),e.removeEventListener(`pointerleave`,a),window.removeEventListener(`blur`,n),window.removeEventListener(`focus`,r)}}},[m,o.isClosePausedRef]);let h=j.useCallback(({tabbingDirection:e})=>{let t=s().map(t=>{let n=t.ref.current,r=[n,...Yv(n)];return e===`forwards`?r:r.reverse()});return(e===`forwards`?t.reverse():t).flat()},[s]);return j.useEffect(()=>{let e=d.current;if(e){let t=t=>{let n=t.altKey||t.ctrlKey||t.metaKey;if(t.key===`Tab`&&!n){let n=document.activeElement,r=t.shiftKey;if(t.target===e&&r){l.current?.focus();return}let i=h({tabbingDirection:r?`backwards`:`forwards`}),a=i.findIndex(e=>e===n);Xv(i.slice(a+1))?t.preventDefault():r?l.current?.focus():u.current?.focus()}};return e.addEventListener(`keydown`,t),()=>e.removeEventListener(`keydown`,t)}},[s,h]),(0,M.jsxs)(K_,{ref:c,role:`region`,"aria-label":i.replace(`{hotkey}`,p),tabIndex:-1,style:{pointerEvents:m?void 0:`none`},children:[m&&(0,M.jsx)(wv,{ref:l,onFocusFromOutsideViewport:()=>{Xv(h({tabbingDirection:`forwards`}))}}),(0,M.jsx)(uv.Slot,{scope:n,children:(0,M.jsx)(O_.ol,{tabIndex:-1,...a,ref:f})}),m&&(0,M.jsx)(wv,{ref:u,onFocusFromOutsideViewport:()=>{Xv(h({tabbingDirection:`backwards`}))}})]})});Sv.displayName=vv;var Cv=`ToastFocusProxy`,wv=j.forwardRef((e,t)=>{let{__scopeToast:n,onFocusFromOutsideViewport:r,...i}=e,a=gv(Cv,n);return(0,M.jsx)(sv,{tabIndex:0,...i,ref:t,style:{position:`fixed`},onFocus:e=>{let t=e.relatedTarget;a.viewport?.contains(t)||r()}})});wv.displayName=Cv;var Tv=`Toast`,Ev=`toast.swipeStart`,Dv=`toast.swipeMove`,Ov=`toast.swipeCancel`,kv=`toast.swipeEnd`,Av=j.forwardRef((e,t)=>{let{forceMount:n,open:r,defaultOpen:i,onOpenChange:a,...o}=e,[s,c]=nv({prop:r,defaultProp:i??!0,onChange:a,caller:Tv});return(0,M.jsx)(Z_,{present:n||s,children:(0,M.jsx)(Nv,{open:s,...o,ref:t,onClose:()=>c(!1),onPause:A_(e.onPause),onResume:A_(e.onResume),onSwipeStart:J(e.onSwipeStart,e=>{e.currentTarget.setAttribute(`data-swipe`,`start`)}),onSwipeMove:J(e.onSwipeMove,e=>{let{x:t,y:n}=e.detail.delta;e.currentTarget.setAttribute(`data-swipe`,`move`),e.currentTarget.style.setProperty(`--radix-toast-swipe-move-x`,`${t}px`),e.currentTarget.style.setProperty(`--radix-toast-swipe-move-y`,`${n}px`)}),onSwipeCancel:J(e.onSwipeCancel,e=>{e.currentTarget.setAttribute(`data-swipe`,`cancel`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-move-x`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-move-y`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-end-x`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-end-y`)}),onSwipeEnd:J(e.onSwipeEnd,e=>{let{x:t,y:n}=e.detail.delta;e.currentTarget.setAttribute(`data-swipe`,`end`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-move-x`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-move-y`),e.currentTarget.style.setProperty(`--radix-toast-swipe-end-x`,`${t}px`),e.currentTarget.style.setProperty(`--radix-toast-swipe-end-y`,`${n}px`),c(!1)})})})});Av.displayName=Tv;var[jv,Mv]=pv(Tv,{onClose(){}}),Nv=j.forwardRef((e,t)=>{let{__scopeToast:n,type:r=`foreground`,duration:i,open:a,onClose:o,onEscapeKeyDown:s,onPause:c,onResume:l,onSwipeStart:u,onSwipeMove:d,onSwipeCancel:f,onSwipeEnd:p,...m}=e,h=gv(Tv,n),[g,_]=j.useState(null),v=g_(t,e=>_(e)),y=j.useRef(null),b=j.useRef(null),x=i||h.duration,S=j.useRef(0),C=j.useRef(x),w=j.useRef(0),{onToastAdd:T,onToastRemove:E}=h,D=A_(()=>{g?.contains(document.activeElement)&&h.viewport?.focus(),o()}),O=j.useCallback(e=>{!e||e===1/0||(window.clearTimeout(w.current),S.current=new Date().getTime(),w.current=window.setTimeout(D,e))},[D]);j.useEffect(()=>{let e=h.viewport;if(e){let t=()=>{O(C.current),l?.()},n=()=>{let e=new Date().getTime()-S.current;C.current-=e,window.clearTimeout(w.current),c?.()};return e.addEventListener(bv,n),e.addEventListener(xv,t),()=>{e.removeEventListener(bv,n),e.removeEventListener(xv,t)}}},[h.viewport,x,c,l,O]),j.useEffect(()=>{a&&!h.isClosePausedRef.current&&O(x)},[a,x,h.isClosePausedRef,O]),j.useEffect(()=>(T(),()=>E()),[T,E]);let ee=j.useMemo(()=>g?Wv(g):null,[g]);return h.viewport?(0,M.jsxs)(M.Fragment,{children:[ee&&(0,M.jsx)(Pv,{__scopeToast:n,role:`status`,"aria-live":r===`foreground`?`assertive`:`polite`,children:ee}),(0,M.jsx)(jv,{scope:n,onClose:D,children:Gi.createPortal((0,M.jsx)(uv.ItemSlot,{scope:n,children:(0,M.jsx)(G_,{asChild:!0,onEscapeKeyDown:J(s,()=>{h.isFocusedToastEscapeKeyDownRef.current||D(),h.isFocusedToastEscapeKeyDownRef.current=!1}),children:(0,M.jsx)(O_.li,{tabIndex:0,"data-state":a?`open`:`closed`,"data-swipe-direction":h.swipeDirection,...m,ref:v,style:{userSelect:`none`,touchAction:`none`,...e.style},onKeyDown:J(e.onKeyDown,e=>{e.key===`Escape`&&(s?.(e.nativeEvent),e.nativeEvent.defaultPrevented||(h.isFocusedToastEscapeKeyDownRef.current=!0,D()))}),onPointerDown:J(e.onPointerDown,e=>{e.button===0&&(y.current={x:e.clientX,y:e.clientY})}),onPointerMove:J(e.onPointerMove,e=>{if(!y.current)return;let t=e.clientX-y.current.x,n=e.clientY-y.current.y,r=!!b.current,i=[`left`,`right`].includes(h.swipeDirection),a=[`left`,`up`].includes(h.swipeDirection)?Math.min:Math.max,o=i?a(0,t):0,s=i?0:a(0,n),c=e.pointerType===`touch`?10:2,l={x:o,y:s},f={originalEvent:e,delta:l};r?(b.current=l,Gv(Dv,d,f,{discrete:!1})):Kv(l,h.swipeDirection,c)?(b.current=l,Gv(Ev,u,f,{discrete:!1}),e.target.setPointerCapture(e.pointerId)):(Math.abs(t)>c||Math.abs(n)>c)&&(y.current=null)}),onPointerUp:J(e.onPointerUp,e=>{let t=b.current,n=e.target;if(n.hasPointerCapture(e.pointerId)&&n.releasePointerCapture(e.pointerId),b.current=null,y.current=null,t){let n=e.currentTarget,r={originalEvent:e,delta:t};Kv(t,h.swipeDirection,h.swipeThreshold)?Gv(kv,p,r,{discrete:!0}):Gv(Ov,f,r,{discrete:!0}),n.addEventListener(`click`,e=>e.preventDefault(),{once:!0})}})})})}),h.viewport)})]}):null}),Pv=e=>{let{__scopeToast:t,children:n,...r}=e,i=gv(Tv,t),[a,o]=j.useState(!1),[s,c]=j.useState(!1);return qv(()=>o(!0)),j.useEffect(()=>{let e=window.setTimeout(()=>c(!0),1e3);return()=>window.clearTimeout(e)},[]),s?null:(0,M.jsx)(Y_,{asChild:!0,children:(0,M.jsx)(sv,{...r,children:a&&(0,M.jsxs)(M.Fragment,{children:[i.label,` `,n]})})})},Fv=`ToastTitle`,Iv=j.forwardRef((e,t)=>{let{__scopeToast:n,...r}=e;return(0,M.jsx)(O_.div,{...r,ref:t})});Iv.displayName=Fv;var Lv=`ToastDescription`,Rv=j.forwardRef((e,t)=>{let{__scopeToast:n,...r}=e;return(0,M.jsx)(O_.div,{...r,ref:t})});Rv.displayName=Lv;var zv=`ToastAction`,Bv=j.forwardRef((e,t)=>{let{altText:n,...r}=e;return n.trim()?(0,M.jsx)(Uv,{altText:n,asChild:!0,children:(0,M.jsx)(Hv,{...r,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${zv}\`. Expected non-empty \`string\`.`),null)});Bv.displayName=zv;var Vv=`ToastClose`,Hv=j.forwardRef((e,t)=>{let{__scopeToast:n,...r}=e,i=Mv(Vv,n);return(0,M.jsx)(Uv,{asChild:!0,children:(0,M.jsx)(O_.button,{type:`button`,...r,ref:t,onClick:J(e.onClick,i.onClose)})})});Hv.displayName=Vv;var Uv=j.forwardRef((e,t)=>{let{__scopeToast:n,altText:r,...i}=e;return(0,M.jsx)(O_.div,{"data-radix-toast-announce-exclude":``,"data-radix-toast-announce-alt":r||void 0,...i,ref:t})});function Wv(e){let t=[];return Array.from(e.childNodes).forEach(e=>{if(e.nodeType===e.TEXT_NODE&&e.textContent&&t.push(e.textContent),Jv(e)){let n=e.ariaHidden||e.hidden||e.style.display===`none`,r=e.dataset.radixToastAnnounceExclude===``;if(!n)if(r){let n=e.dataset.radixToastAnnounceAlt;n&&t.push(n)}else t.push(...Wv(e))}}),t}function Gv(e,t,n,{discrete:r}){let i=n.originalEvent.currentTarget,a=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?k_(i,a):i.dispatchEvent(a)}var Kv=(e,t,n=0)=>{let r=Math.abs(e.x),i=Math.abs(e.y),a=r>i;return t===`left`||t===`right`?a&&r>n:!a&&i>n};function qv(e=()=>{}){let t=A_(e);q_(()=>{let e=0,n=0;return e=window.requestAnimationFrame(()=>n=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(e),window.cancelAnimationFrame(n)}},[t])}function Jv(e){return e.nodeType===e.ELEMENT_NODE}function Yv(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Xv(e){let t=document.activeElement;return e.some(e=>e===t?!0:(e.focus(),document.activeElement!==t))}var Zv=_v,Qv=Sv,$v=Av,ey=Iv,ty=Rv,ny=Bv,ry=Hv;function iy(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=iy(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function ay(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=iy(e))&&(r&&(r+=` `),r+=t);return r}var oy=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,sy=ay,cy=(e,t)=>n=>{if(t?.variants==null)return sy(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=oy(t)||oy(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return sy(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},ly=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),uy=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),dy=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),fy=e=>{let t=dy(e);return t.charAt(0).toUpperCase()+t.slice(1)},py={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},my=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},hy=(0,j.createContext)({}),gy=()=>(0,j.useContext)(hy),_y=(0,j.forwardRef)(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>{let{size:l=24,strokeWidth:u=2,absoluteStrokeWidth:d=!1,color:f=`currentColor`,className:p=``}=gy()??{},m=r??d?Number(n??u)*24/Number(t??l):n??u;return(0,j.createElement)(`svg`,{ref:c,...py,width:t??l??py.width,height:t??l??py.height,stroke:e??f,strokeWidth:m,className:ly(`lucide`,p,i),...!a&&!my(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,j.createElement)(e,t)),...Array.isArray(a)?a:[a]])}),vy=(e,t)=>{let n=(0,j.forwardRef)(({className:n,...r},i)=>(0,j.createElement)(_y,{ref:i,iconNode:t,className:ly(`lucide-${uy(fy(e))}`,`lucide-${e}`,n),...r}));return n.displayName=fy(e),n},yy=vy(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),by=vy(`building-2`,[[`path`,{d:`M10 12h4`,key:`a56b0p`}],[`path`,{d:`M10 8h4`,key:`1sr2af`}],[`path`,{d:`M14 21v-3a2 2 0 0 0-4 0v3`,key:`1rgiei`}],[`path`,{d:`M6 10H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-2`,key:`secmi2`}],[`path`,{d:`M6 21V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v16`,key:`16ra0t`}]]),xy=vy(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),Sy=vy(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),Cy=vy(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),wy=vy(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),Ty=vy(`chevrons-up-down`,[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]),Ey=vy(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Dy=vy(`circle-user-round`,[[`path`,{d:`M17.925 20.056a6 6 0 0 0-11.851.001`,key:`z69sun`}],[`circle`,{cx:`12`,cy:`11`,r:`4`,key:`1gt34v`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),Oy=vy(`circle-x`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),ky=vy(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),Ay=vy(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),jy=vy(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),My=vy(`ellipsis-vertical`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]]),Ny=vy(`gallery-vertical-end`,[[`path`,{d:`M7 2h10`,key:`nczekb`}],[`path`,{d:`M5 6h14`,key:`u2x4p`}],[`rect`,{width:`18`,height:`12`,x:`3`,y:`10`,rx:`2`,key:`l0tzu3`}]]),Py=vy(`globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),Fy=vy(`house`,[[`path`,{d:`M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8`,key:`5wwlr5`}],[`path`,{d:`M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z`,key:`r6nss1`}]]),Iy=vy(`inbox`,[[`polyline`,{points:`22 12 16 12 14 15 10 15 8 12 2 12`,key:`o97t9d`}],[`path`,{d:`M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`oot6mr`}]]),Ly=vy(`key-round`,[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]),Ry=vy(`languages`,[[`path`,{d:`m5 8 6 6`,key:`1wu5hv`}],[`path`,{d:`m4 14 6-6 2-3`,key:`1k1g8d`}],[`path`,{d:`M2 5h12`,key:`or177f`}],[`path`,{d:`M7 2h1`,key:`1t2jsx`}],[`path`,{d:`m22 22-5-10-5 10`,key:`don7ne`}],[`path`,{d:`M14 18h6`,key:`1m8k6r`}]]),zy=vy(`link-2-off`,[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7`,key:`10o201`}],[`path`,{d:`M15 7h2a5 5 0 0 1 4 8`,key:`1d3206`}],[`line`,{x1:`8`,x2:`12`,y1:`12`,y2:`12`,key:`rvw6j4`}],[`line`,{x1:`2`,x2:`22`,y1:`2`,y2:`22`,key:`a6p6uj`}]]),By=vy(`link-2`,[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7h2`,key:`8i5ue5`}],[`path`,{d:`M15 7h2a5 5 0 1 1 0 10h-2`,key:`1b9ql8`}],[`line`,{x1:`8`,x2:`16`,y1:`12`,y2:`12`,key:`1jonct`}]]),Vy=vy(`log-out`,[[`path`,{d:`m16 17 5-5-5-5`,key:`1bji2h`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}]]),Hy=vy(`mail-check`,[[`path`,{d:`M22 13V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h8`,key:`12jkf8`}],[`path`,{d:`m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7`,key:`1ocrg3`}],[`path`,{d:`m16 19 2 2 4-4`,key:`1b14m6`}]]),Uy=vy(`mail`,[[`path`,{d:`m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7`,key:`132q7q`}],[`rect`,{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`,key:`izxlao`}]]),Wy=vy(`monitor`,[[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`line`,{x1:`8`,x2:`16`,y1:`21`,y2:`21`,key:`1svkeh`}],[`line`,{x1:`12`,x2:`12`,y1:`17`,y2:`21`,key:`vw1qmm`}]]),Gy=vy(`moon`,[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]),Ky=vy(`panel-left`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}]]),qy=vy(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),Jy=vy(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),Yy=vy(`save`,[[`path`,{d:`M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z`,key:`1c8476`}],[`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`,key:`1ydtos`}],[`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`,key:`t51u73`}]]),Xy=vy(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),Zy=vy(`shield-check`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Qy=vy(`shield`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}]]),$y=vy(`smartphone`,[[`rect`,{width:`14`,height:`20`,x:`5`,y:`2`,rx:`2`,ry:`2`,key:`1yt0o3`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}]]),eb=vy(`sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),tb=vy(`tablet`,[[`rect`,{width:`16`,height:`20`,x:`4`,y:`2`,rx:`2`,ry:`2`,key:`76otgf`}],[`line`,{x1:`12`,x2:`12.01`,y1:`18`,y2:`18`,key:`1dp563`}]]),nb=vy(`trash-2`,[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]),rb=vy(`triangle-alert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),ib=vy(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),ab=vy(`user-minus`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}],[`line`,{x1:`22`,x2:`16`,y1:`11`,y2:`11`,key:`1shjgl`}]]),ob=vy(`user-plus`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}],[`line`,{x1:`19`,x2:`19`,y1:`8`,y2:`14`,key:`1bvyxn`}],[`line`,{x1:`22`,x2:`16`,y1:`11`,y2:`11`,key:`1shjgl`}]]),sb=vy(`user`,[[`path`,{d:`M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2`,key:`975kel`}],[`circle`,{cx:`12`,cy:`7`,r:`4`,key:`17ys0d`}]]),cb=vy(`users-round`,[[`path`,{d:`M18 21a8 8 0 0 0-16 0`,key:`3ypg7q`}],[`circle`,{cx:`10`,cy:`8`,r:`5`,key:`o932ke`}],[`path`,{d:`M22 20c0-3.37-2-6.5-4-8a5 5 0 0 0-.45-8.3`,key:`10s06x`}]]),lb=vy(`users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),ub=vy(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),db=(e,t)=>{let n=Array(e.length+t.length);for(let t=0;t<e.length;t++)n[t]=e[t];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},fb=(e,t)=>({classGroupId:e,validator:t}),pb=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),mb=`-`,hb=[],gb=`arbitrary..`,_b=e=>{let t=bb(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return yb(e);let n=e.split(mb);return vb(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?db(i,t):t:i||hb}return n[e]||hb}}},vb=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=vb(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(mb):e.slice(t).join(mb),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},yb=e=>e.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?gb+r:void 0})(),bb=e=>{let{theme:t,classGroups:n}=e;return xb(n,t)},xb=(e,t)=>{let n=pb();for(let r in e){let i=e[r];Sb(i,n,r,t)}return n},Sb=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];Cb(i,t,n,r)}},Cb=(e,t,n,r)=>{if(typeof e==`string`){wb(e,t,n);return}if(typeof e==`function`){Tb(e,t,n,r);return}Eb(e,t,n,r)},wb=(e,t,n)=>{let r=e===``?t:Db(t,e);r.classGroupId=n},Tb=(e,t,n,r)=>{if(Ob(e)){Sb(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(fb(n,e))},Eb=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];Sb(o,Db(t,a),n,r)}},Db=(e,t)=>{let n=e,r=t.split(mb),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=pb(),n.nextPart.set(t,i)),n=i}return n},Ob=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,kb=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return i(e,t),t},set(e,t){e in n?n[e]=t:i(e,t)}}},Ab=`!`,jb=`:`,Mb=[],Nb=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),Pb=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,i=0,a,o=e.length;for(let s=0;s<o;s++){let o=e[s];if(n===0&&r===0){if(o===jb){t.push(e.slice(i,s)),i=s+1;continue}if(o===`/`){a=s;continue}}o===`[`?n++:o===`]`?n--:o===`(`?r++:o===`)`&&r--}let s=t.length===0?e:e.slice(i),c=s,l=!1;s.endsWith(Ab)?(c=s.slice(0,-1),l=!0):s.startsWith(Ab)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return Nb(t,l,c,u)};if(t){let e=t+jb,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):Nb(Mb,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},Fb=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let i=0;i<e.length;i++){let a=e[i],o=a[0]===`[`,s=t.has(a);o||s?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(a)):r.push(a)}return r.length>0&&(r.sort(),n.push(...r)),n}},Ib=e=>({cache:kb(e.cacheSize),parseClassName:Pb(e),sortModifiers:Fb(e),postfixLookupClassGroupIds:Lb(e),..._b(e)}),Lb=e=>{let t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let e=0;e<n.length;e++)t[n[e]]=!0;return t},Rb=/\s+/,zb=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a,postfixLookupClassGroupIds:o}=t,s=[],c=e.trim().split(Rb),l=``;for(let e=c.length-1;e>=0;--e){let t=c[e],{isExternal:u,modifiers:d,hasImportantModifier:f,baseClassName:p,maybePostfixModifierPosition:m}=n(t);if(u){l=t+(l.length>0?` `+l:l);continue}let h=!!m,g;if(h){g=r(p.substring(0,m));let e=g&&o[g]?r(p):void 0;e&&e!==g&&(g=e,h=!1)}else g=r(p);if(!g){if(!h){l=t+(l.length>0?` `+l:l);continue}if(g=r(p),!g){l=t+(l.length>0?` `+l:l);continue}h=!1}let _=d.length===0?``:d.length===1?d[0]:a(d).join(`:`),v=f?_+Ab:_,y=v+g;if(s.indexOf(y)>-1)continue;s.push(y);let b=i(g,h);for(let e=0;e<b.length;++e){let t=b[e];s.push(v+t)}l=t+(l.length>0?` `+l:l)}return l},Bb=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=Vb(n))&&(i&&(i+=` `),i+=r);return i},Vb=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=Vb(e[r]))&&(n&&(n+=` `),n+=t);return n},Hb=(e,...t)=>{let n,r,i,a,o=o=>(n=Ib(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)),s=e=>{let t=r(e);if(t)return t;let a=zb(e,n);return i(e,a),a};return a=o,(...e)=>a(Bb(...e))},Ub=[],Wb=e=>{let t=t=>t[e]||Ub;return t.isThemeGetter=!0,t},Gb=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Kb=/^\((?:(\w[\w-]*):)?(.+)\)$/i,qb=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Jb=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Yb=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Xb=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Zb=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Qb=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,$b=e=>qb.test(e),ex=e=>!!e&&!Number.isNaN(Number(e)),tx=e=>!!e&&Number.isInteger(Number(e)),nx=e=>e.endsWith(`%`)&&ex(e.slice(0,-1)),rx=e=>Jb.test(e),ix=()=>!0,ax=e=>Yb.test(e)&&!Xb.test(e),ox=()=>!1,sx=e=>Zb.test(e),cx=e=>Qb.test(e),lx=e=>!Y(e)&&!X(e),ux=e=>e.startsWith(`@container`)&&(e[10]===`/`&&e[11]!==void 0||e[11]===`s`&&e[16]!==void 0&&e.startsWith(`-size/`,10)||e[11]===`n`&&e[18]!==void 0&&e.startsWith(`-normal/`,10)),dx=e=>Ex(e,Ax,ox),Y=e=>Gb.test(e),fx=e=>Ex(e,jx,ax),px=e=>Ex(e,Mx,ex),mx=e=>Ex(e,Px,ix),hx=e=>Ex(e,Nx,ox),gx=e=>Ex(e,Ox,ox),_x=e=>Ex(e,kx,cx),vx=e=>Ex(e,Fx,sx),X=e=>Kb.test(e),yx=e=>Dx(e,jx),bx=e=>Dx(e,Nx),xx=e=>Dx(e,Ox),Sx=e=>Dx(e,Ax),Cx=e=>Dx(e,kx),wx=e=>Dx(e,Fx,!0),Tx=e=>Dx(e,Px,!0),Ex=(e,t,n)=>{let r=Gb.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},Dx=(e,t,n=!1)=>{let r=Kb.exec(e);return r?r[1]?t(r[1]):n:!1},Ox=e=>e===`position`||e===`percentage`,kx=e=>e===`image`||e===`url`,Ax=e=>e===`length`||e===`size`||e===`bg-size`,jx=e=>e===`length`,Mx=e=>e===`number`,Nx=e=>e===`family-name`,Px=e=>e===`number`||e===`weight`,Fx=e=>e===`shadow`,Ix=Hb(()=>{let e=Wb(`color`),t=Wb(`font`),n=Wb(`text`),r=Wb(`font-weight`),i=Wb(`tracking`),a=Wb(`leading`),o=Wb(`breakpoint`),s=Wb(`container`),c=Wb(`spacing`),l=Wb(`radius`),u=Wb(`shadow`),d=Wb(`inset-shadow`),f=Wb(`text-shadow`),p=Wb(`drop-shadow`),m=Wb(`blur`),h=Wb(`perspective`),g=Wb(`aspect`),_=Wb(`ease`),v=Wb(`animate`),y=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],b=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],x=()=>[...b(),X,Y],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[X,Y,c],T=()=>[$b,`full`,`auto`,...w()],E=()=>[tx,`none`,`subgrid`,X,Y],D=()=>[`auto`,{span:[`full`,tx,X,Y]},tx,X,Y],O=()=>[tx,`auto`,X,Y],ee=()=>[`auto`,`min`,`max`,`fr`,X,Y],te=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],ne=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],re=()=>[`auto`,...w()],ie=()=>[$b,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],ae=()=>[$b,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],oe=()=>[$b,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],k=()=>[e,X,Y],se=()=>[...b(),xx,gx,{position:[X,Y]}],ce=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],le=()=>[`auto`,`cover`,`contain`,Sx,dx,{size:[X,Y]}],ue=()=>[nx,yx,fx],A=()=>[``,`none`,`full`,l,X,Y],de=()=>[``,ex,yx,fx],fe=()=>[`solid`,`dashed`,`dotted`,`double`],pe=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],me=()=>[ex,nx,xx,gx],he=()=>[``,`none`,m,X,Y],ge=()=>[`none`,ex,X,Y],_e=()=>[`none`,ex,X,Y],ve=()=>[ex,X,Y],ye=()=>[$b,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[rx],breakpoint:[rx],color:[ix],container:[rx],"drop-shadow":[rx],ease:[`in`,`out`,`in-out`],font:[lx],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[rx],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[rx],shadow:[rx],spacing:[`px`,ex],text:[rx],"text-shadow":[rx],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,$b,Y,X,g]}],container:[`container`],"container-type":[{"@container":[``,`normal`,`size`,X,Y]}],"container-named":[ux],columns:[{columns:[ex,Y,X,s]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],sr:[`sr-only`,`not-sr-only`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:x()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{"inset-s":T(),start:T()}],end:[{"inset-e":T(),end:T()}],"inset-bs":[{"inset-bs":T()}],"inset-be":[{"inset-be":T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[tx,`auto`,X,Y]}],basis:[{basis:[$b,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[ex,$b,`auto`,`initial`,`none`,Y]}],grow:[{grow:[``,ex,X,Y]}],shrink:[{shrink:[``,ex,X,Y]}],order:[{order:[tx,`first`,`last`,`none`,X,Y]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":ee()}],"auto-rows":[{"auto-rows":ee()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...te(),`normal`]}],"justify-items":[{"justify-items":[...ne(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...ne()]}],"align-content":[{content:[`normal`,...te()]}],"align-items":[{items:[...ne(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...ne(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":te()}],"place-items":[{"place-items":[...ne(),`baseline`]}],"place-self":[{"place-self":[`auto`,...ne()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pbs:[{pbs:w()}],pbe:[{pbe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:re()}],mx:[{mx:re()}],my:[{my:re()}],ms:[{ms:re()}],me:[{me:re()}],mbs:[{mbs:re()}],mbe:[{mbe:re()}],mt:[{mt:re()}],mr:[{mr:re()}],mb:[{mb:re()}],ml:[{ml:re()}],"space-x":[{"space-x":w()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":w()}],"space-y-reverse":[`space-y-reverse`],size:[{size:ie()}],"inline-size":[{inline:[`auto`,...ae()]}],"min-inline-size":[{"min-inline":[`auto`,...ae()]}],"max-inline-size":[{"max-inline":[`none`,...ae()]}],"block-size":[{block:[`auto`,...oe()]}],"min-block-size":[{"min-block":[`auto`,...oe()]}],"max-block-size":[{"max-block":[`none`,...oe()]}],w:[{w:[s,`screen`,...ie()]}],"min-w":[{"min-w":[s,`screen`,`none`,...ie()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...ie()]}],h:[{h:[`screen`,`lh`,...ie()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...ie()]}],"max-h":[{"max-h":[`screen`,`lh`,...ie()]}],"font-size":[{text:[`base`,n,yx,fx]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,Tx,mx]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,nx,Y]}],"font-family":[{font:[bx,hx,t]}],"font-features":[{"font-features":[Y]}],"fvn-normal":[`normal-nums`],"fvn-ordinal":[`ordinal`],"fvn-slashed-zero":[`slashed-zero`],"fvn-figure":[`lining-nums`,`oldstyle-nums`],"fvn-spacing":[`proportional-nums`,`tabular-nums`],"fvn-fraction":[`diagonal-fractions`,`stacked-fractions`],tracking:[{tracking:[i,X,Y]}],"line-clamp":[{"line-clamp":[ex,`none`,X,px]}],leading:[{leading:[a,...w()]}],"list-image":[{"list-image":[`none`,X,Y]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,X,Y]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:k()}],"text-color":[{text:k()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...fe(),`wavy`]}],"text-decoration-thickness":[{decoration:[ex,`from-font`,`auto`,X,fx]}],"text-decoration-color":[{decoration:k()}],"underline-offset":[{"underline-offset":[ex,`auto`,X,Y]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:w()}],"tab-size":[{tab:[tx,X,Y]}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,X,Y]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],wrap:[{wrap:[`break-word`,`anywhere`,`normal`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,X,Y]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:se()}],"bg-repeat":[{bg:ce()}],"bg-size":[{bg:le()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},tx,X,Y],radial:[``,X,Y],conic:[tx,X,Y]},Cx,_x]}],"bg-color":[{bg:k()}],"gradient-from-pos":[{from:ue()}],"gradient-via-pos":[{via:ue()}],"gradient-to-pos":[{to:ue()}],"gradient-from":[{from:k()}],"gradient-via":[{via:k()}],"gradient-to":[{to:k()}],rounded:[{rounded:A()}],"rounded-s":[{"rounded-s":A()}],"rounded-e":[{"rounded-e":A()}],"rounded-t":[{"rounded-t":A()}],"rounded-r":[{"rounded-r":A()}],"rounded-b":[{"rounded-b":A()}],"rounded-l":[{"rounded-l":A()}],"rounded-ss":[{"rounded-ss":A()}],"rounded-se":[{"rounded-se":A()}],"rounded-ee":[{"rounded-ee":A()}],"rounded-es":[{"rounded-es":A()}],"rounded-tl":[{"rounded-tl":A()}],"rounded-tr":[{"rounded-tr":A()}],"rounded-br":[{"rounded-br":A()}],"rounded-bl":[{"rounded-bl":A()}],"border-w":[{border:de()}],"border-w-x":[{"border-x":de()}],"border-w-y":[{"border-y":de()}],"border-w-s":[{"border-s":de()}],"border-w-e":[{"border-e":de()}],"border-w-bs":[{"border-bs":de()}],"border-w-be":[{"border-be":de()}],"border-w-t":[{"border-t":de()}],"border-w-r":[{"border-r":de()}],"border-w-b":[{"border-b":de()}],"border-w-l":[{"border-l":de()}],"divide-x":[{"divide-x":de()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":de()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...fe(),`hidden`,`none`]}],"divide-style":[{divide:[...fe(),`hidden`,`none`]}],"border-color":[{border:k()}],"border-color-x":[{"border-x":k()}],"border-color-y":[{"border-y":k()}],"border-color-s":[{"border-s":k()}],"border-color-e":[{"border-e":k()}],"border-color-bs":[{"border-bs":k()}],"border-color-be":[{"border-be":k()}],"border-color-t":[{"border-t":k()}],"border-color-r":[{"border-r":k()}],"border-color-b":[{"border-b":k()}],"border-color-l":[{"border-l":k()}],"divide-color":[{divide:k()}],"outline-style":[{outline:[...fe(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[ex,X,Y]}],"outline-w":[{outline:[``,ex,yx,fx]}],"outline-color":[{outline:k()}],shadow:[{shadow:[``,`none`,u,wx,vx]}],"shadow-color":[{shadow:k()}],"inset-shadow":[{"inset-shadow":[`none`,d,wx,vx]}],"inset-shadow-color":[{"inset-shadow":k()}],"ring-w":[{ring:de()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:k()}],"ring-offset-w":[{"ring-offset":[ex,fx]}],"ring-offset-color":[{"ring-offset":k()}],"inset-ring-w":[{"inset-ring":de()}],"inset-ring-color":[{"inset-ring":k()}],"text-shadow":[{"text-shadow":[`none`,f,wx,vx]}],"text-shadow-color":[{"text-shadow":k()}],opacity:[{opacity:[ex,X,Y]}],"mix-blend":[{"mix-blend":[...pe(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":pe()}],"mask-clip":[{"mask-clip":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]},`mask-no-clip`],"mask-composite":[{mask:[`add`,`subtract`,`intersect`,`exclude`]}],"mask-image-linear-pos":[{"mask-linear":[ex]}],"mask-image-linear-from-pos":[{"mask-linear-from":me()}],"mask-image-linear-to-pos":[{"mask-linear-to":me()}],"mask-image-linear-from-color":[{"mask-linear-from":k()}],"mask-image-linear-to-color":[{"mask-linear-to":k()}],"mask-image-t-from-pos":[{"mask-t-from":me()}],"mask-image-t-to-pos":[{"mask-t-to":me()}],"mask-image-t-from-color":[{"mask-t-from":k()}],"mask-image-t-to-color":[{"mask-t-to":k()}],"mask-image-r-from-pos":[{"mask-r-from":me()}],"mask-image-r-to-pos":[{"mask-r-to":me()}],"mask-image-r-from-color":[{"mask-r-from":k()}],"mask-image-r-to-color":[{"mask-r-to":k()}],"mask-image-b-from-pos":[{"mask-b-from":me()}],"mask-image-b-to-pos":[{"mask-b-to":me()}],"mask-image-b-from-color":[{"mask-b-from":k()}],"mask-image-b-to-color":[{"mask-b-to":k()}],"mask-image-l-from-pos":[{"mask-l-from":me()}],"mask-image-l-to-pos":[{"mask-l-to":me()}],"mask-image-l-from-color":[{"mask-l-from":k()}],"mask-image-l-to-color":[{"mask-l-to":k()}],"mask-image-x-from-pos":[{"mask-x-from":me()}],"mask-image-x-to-pos":[{"mask-x-to":me()}],"mask-image-x-from-color":[{"mask-x-from":k()}],"mask-image-x-to-color":[{"mask-x-to":k()}],"mask-image-y-from-pos":[{"mask-y-from":me()}],"mask-image-y-to-pos":[{"mask-y-to":me()}],"mask-image-y-from-color":[{"mask-y-from":k()}],"mask-image-y-to-color":[{"mask-y-to":k()}],"mask-image-radial":[{"mask-radial":[X,Y]}],"mask-image-radial-from-pos":[{"mask-radial-from":me()}],"mask-image-radial-to-pos":[{"mask-radial-to":me()}],"mask-image-radial-from-color":[{"mask-radial-from":k()}],"mask-image-radial-to-color":[{"mask-radial-to":k()}],"mask-image-radial-shape":[{"mask-radial":[`circle`,`ellipse`]}],"mask-image-radial-size":[{"mask-radial":[{closest:[`side`,`corner`],farthest:[`side`,`corner`]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[ex]}],"mask-image-conic-from-pos":[{"mask-conic-from":me()}],"mask-image-conic-to-pos":[{"mask-conic-to":me()}],"mask-image-conic-from-color":[{"mask-conic-from":k()}],"mask-image-conic-to-color":[{"mask-conic-to":k()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:se()}],"mask-repeat":[{mask:ce()}],"mask-size":[{mask:le()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,X,Y]}],filter:[{filter:[``,`none`,X,Y]}],blur:[{blur:he()}],brightness:[{brightness:[ex,X,Y]}],contrast:[{contrast:[ex,X,Y]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,wx,vx]}],"drop-shadow-color":[{"drop-shadow":k()}],grayscale:[{grayscale:[``,ex,X,Y]}],"hue-rotate":[{"hue-rotate":[ex,X,Y]}],invert:[{invert:[``,ex,X,Y]}],saturate:[{saturate:[ex,X,Y]}],sepia:[{sepia:[``,ex,X,Y]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,X,Y]}],"backdrop-blur":[{"backdrop-blur":he()}],"backdrop-brightness":[{"backdrop-brightness":[ex,X,Y]}],"backdrop-contrast":[{"backdrop-contrast":[ex,X,Y]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,ex,X,Y]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[ex,X,Y]}],"backdrop-invert":[{"backdrop-invert":[``,ex,X,Y]}],"backdrop-opacity":[{"backdrop-opacity":[ex,X,Y]}],"backdrop-saturate":[{"backdrop-saturate":[ex,X,Y]}],"backdrop-sepia":[{"backdrop-sepia":[``,ex,X,Y]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,X,Y]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[ex,`initial`,X,Y]}],ease:[{ease:[`linear`,`initial`,_,X,Y]}],delay:[{delay:[ex,X,Y]}],animate:[{animate:[`none`,v,X,Y]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,X,Y]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:ge()}],"rotate-x":[{"rotate-x":ge()}],"rotate-y":[{"rotate-y":ge()}],"rotate-z":[{"rotate-z":ge()}],scale:[{scale:_e()}],"scale-x":[{"scale-x":_e()}],"scale-y":[{"scale-y":_e()}],"scale-z":[{"scale-z":_e()}],"scale-3d":[`scale-3d`],skew:[{skew:ve()}],"skew-x":[{"skew-x":ve()}],"skew-y":[{"skew-y":ve()}],transform:[{transform:[X,Y,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:ye()}],"translate-x":[{"translate-x":ye()}],"translate-y":[{"translate-y":ye()}],"translate-z":[{"translate-z":ye()}],"translate-none":[`translate-none`],zoom:[{zoom:[tx,X,Y]}],accent:[{accent:k()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:k()}],"color-scheme":[{scheme:[`normal`,`dark`,`light`,`light-dark`,`only-dark`,`only-light`]}],cursor:[{cursor:[`auto`,`default`,`pointer`,`wait`,`text`,`move`,`help`,`not-allowed`,`none`,`context-menu`,`progress`,`cell`,`crosshair`,`vertical-text`,`alias`,`copy`,`no-drop`,`grab`,`grabbing`,`all-scroll`,`col-resize`,`row-resize`,`n-resize`,`e-resize`,`s-resize`,`w-resize`,`ne-resize`,`nw-resize`,`se-resize`,`sw-resize`,`ew-resize`,`ns-resize`,`nesw-resize`,`nwse-resize`,`zoom-in`,`zoom-out`,X,Y]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scrollbar-thumb-color":[{"scrollbar-thumb":k()}],"scrollbar-track-color":[{"scrollbar-track":k()}],"scrollbar-gutter":[{"scrollbar-gutter":[`auto`,`stable`,`both`]}],"scrollbar-w":[{scrollbar:[`auto`,`thin`,`none`]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mbs":[{"scroll-mbs":w()}],"scroll-mbe":[{"scroll-mbe":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pbs":[{"scroll-pbs":w()}],"scroll-pbe":[{"scroll-pbe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}],touch:[{touch:[`auto`,`none`,`manipulation`]}],"touch-x":[{"touch-pan":[`x`,`left`,`right`]}],"touch-y":[{"touch-pan":[`y`,`up`,`down`]}],"touch-pz":[`touch-pinch-zoom`],select:[{select:[`none`,`text`,`all`,`auto`]}],"will-change":[{"will-change":[`auto`,`scroll`,`contents`,`transform`,X,Y]}],fill:[{fill:[`none`,...k()]}],"stroke-w":[{stroke:[ex,yx,fx,px]}],stroke:[{stroke:[`none`,...k()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{"container-named":[`container-type`],overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`inset-bs`,`inset-be`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`right`,`left`],"inset-y":[`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pbs`,`pbe`,`pt`,`pr`,`pb`,`pl`],px:[`pr`,`pl`],py:[`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mbs`,`mbe`,`mt`,`mr`,`mb`,`ml`],mx:[`mr`,`ml`],my:[`mt`,`mb`],size:[`w`,`h`],"font-size":[`leading`],"fvn-normal":[`fvn-ordinal`,`fvn-slashed-zero`,`fvn-figure`,`fvn-spacing`,`fvn-fraction`],"fvn-ordinal":[`fvn-normal`],"fvn-slashed-zero":[`fvn-normal`],"fvn-figure":[`fvn-normal`],"fvn-spacing":[`fvn-normal`],"fvn-fraction":[`fvn-normal`],"line-clamp":[`display`,`overflow`],rounded:[`rounded-s`,`rounded-e`,`rounded-t`,`rounded-r`,`rounded-b`,`rounded-l`,`rounded-ss`,`rounded-se`,`rounded-ee`,`rounded-es`,`rounded-tl`,`rounded-tr`,`rounded-br`,`rounded-bl`],"rounded-s":[`rounded-ss`,`rounded-es`],"rounded-e":[`rounded-se`,`rounded-ee`],"rounded-t":[`rounded-tl`,`rounded-tr`],"rounded-r":[`rounded-tr`,`rounded-br`],"rounded-b":[`rounded-br`,`rounded-bl`],"rounded-l":[`rounded-tl`,`rounded-bl`],"border-spacing":[`border-spacing-x`,`border-spacing-y`],"border-w":[`border-w-x`,`border-w-y`,`border-w-s`,`border-w-e`,`border-w-bs`,`border-w-be`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-r`,`border-w-l`],"border-w-y":[`border-w-t`,`border-w-b`],"border-color":[`border-color-x`,`border-color-y`,`border-color-s`,`border-color-e`,`border-color-bs`,`border-color-be`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-r`,`border-color-l`],"border-color-y":[`border-color-t`,`border-color-b`],translate:[`translate-x`,`translate-y`,`translate-none`],"translate-none":[`translate`,`translate-x`,`translate-y`,`translate-z`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mbs`,`scroll-mbe`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pbs`,`scroll-pbe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]},postfixLookupClassGroups:[`container-type`],orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}});function Z(...e){return Ix(ay(e))}var Lx=Zv,Rx=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(Qv,{ref:n,className:Z(`fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]`,e),...t}));Rx.displayName=Qv.displayName;var zx=cy(`group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full`,{variants:{variant:{default:`border bg-background text-foreground`,destructive:`destructive group border-destructive bg-destructive text-destructive-foreground`}},defaultVariants:{variant:`default`}}),Bx=j.forwardRef(({className:e,variant:t,...n},r)=>(0,M.jsx)($v,{ref:r,className:Z(zx({variant:t}),e),...n}));Bx.displayName=$v.displayName;var Vx=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(ny,{ref:n,className:Z(`inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive`,e),...t}));Vx.displayName=ny.displayName;var Hx=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(ry,{ref:n,className:Z(`absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600`,e),"toast-close":``,...t,children:(0,M.jsx)(ub,{className:`h-4 w-4`})}));Hx.displayName=ry.displayName;var Ux=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(ey,{ref:n,className:Z(`text-sm font-semibold`,e),...t}));Ux.displayName=ey.displayName;var Wx=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(ty,{ref:n,className:Z(`text-sm opacity-90`,e),...t}));Wx.displayName=ty.displayName;function Gx(){let{toasts:e}=p_();return(0,M.jsxs)(Lx,{children:[e.map(function({id:e,title:t,description:n,action:r,...i}){return(0,M.jsxs)(Bx,{...i,children:[(0,M.jsxs)(`div`,{className:`grid gap-1`,children:[t&&(0,M.jsx)(Ux,{children:t}),n&&(0,M.jsx)(Wx,{children:n})]}),r,(0,M.jsx)(Hx,{})]},e)}),(0,M.jsx)(Rx,{})]})}var Kx=Symbol.for(`react.lazy`),qx=j.use;function Jx(e){return typeof e==`object`&&!!e&&`then`in e}function Yx(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===Kx&&`_payload`in e&&Jx(e._payload)}function Xx(e){let t=Qx(e),n=j.forwardRef((e,n)=>{let{children:r,...i}=e;Yx(r)&&typeof qx==`function`&&(r=qx(r._payload));let a=j.Children.toArray(r),o=a.find(eS);if(o){let e=o.props.children,r=a.map(t=>t===o?j.Children.count(e)>1?j.Children.only(null):j.isValidElement(e)?e.props.children:null:t);return(0,M.jsx)(t,{...i,ref:n,children:j.isValidElement(e)?j.cloneElement(e,void 0,r):null})}return(0,M.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}var Zx=Xx(`Slot`);function Qx(e){let t=j.forwardRef((e,t)=>{let{children:n,...r}=e;if(Yx(n)&&typeof qx==`function`&&(n=qx(n._payload)),j.isValidElement(n)){let e=nS(n),i=tS(r,n.props);return n.type!==j.Fragment&&(i.ref=t?h_(t,e):e),j.cloneElement(n,i)}return j.Children.count(n)>1?j.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var $x=Symbol(`radix.slottable`);function eS(e){return j.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===$x}function tS(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function nS(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var rS=768;function iS(){let[e,t]=j.useState(void 0);return j.useEffect(()=>{let e=window.matchMedia(`(max-width: ${rS-1}px)`),n=()=>{t(window.innerWidth<rS)};return e.addEventListener(`change`,n),t(window.innerWidth<rS),()=>e.removeEventListener(`change`,n)},[]),!!e}var aS=cy(`inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0`,{variants:{variant:{default:`bg-primary text-primary-foreground shadow hover:bg-primary/90`,destructive:`bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90`,outline:`border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground`,secondary:`bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80`,ghost:`hover:bg-accent hover:text-accent-foreground`,link:`text-primary underline-offset-4 hover:underline`},size:{default:`h-9 px-4 py-2`,sm:`h-8 rounded-md px-3 text-xs`,lg:`h-10 rounded-md px-8`,icon:`h-9 w-9`}},defaultVariants:{variant:`default`,size:`default`}}),Q=j.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...i},a)=>(0,M.jsx)(r?Zx:`button`,{className:Z(aS({variant:t,size:n,className:e})),ref:a,...i}));Q.displayName=`Button`;var oS=j.forwardRef(({className:e,type:t,...n},r)=>(0,M.jsx)(`input`,{type:t,className:Z(`flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50`,e),ref:r,...n}));oS.displayName=`Input`;var sS=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=Xx(`Primitive.${t}`),r=j.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,M.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),cS=`Separator`,lS=`horizontal`,uS=[`horizontal`,`vertical`],dS=j.forwardRef((e,t)=>{let{decorative:n,orientation:r=lS,...i}=e,a=fS(r)?r:lS,o=n?{role:`none`}:{"aria-orientation":a===`vertical`?a:void 0,role:`separator`};return(0,M.jsx)(sS.div,{"data-orientation":a,...o,...i,ref:t})});dS.displayName=cS;function fS(e){return uS.includes(e)}var pS=dS,mS=j.forwardRef(({className:e,orientation:t=`horizontal`,decorative:n=!0,...r},i)=>(0,M.jsx)(pS,{ref:i,decorative:n,orientation:t,className:Z(`shrink-0 bg-border`,t===`horizontal`?`h-[1px] w-full`:`h-full w-[1px]`,e),...r}));mS.displayName=pS.displayName;var hS=j.useId||(()=>void 0),gS=0;function _S(e){let[t,n]=j.useState(hS());return q_(()=>{e||n(e=>e??String(gS++))},[e]),e||(t?`radix-${t}`:``)}var vS=`focusScope.autoFocusOnMount`,yS=`focusScope.autoFocusOnUnmount`,bS={bubbles:!1,cancelable:!0},xS=`FocusScope`,SS=j.forwardRef((e,t)=>{let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=j.useState(null),l=A_(i),u=A_(a),d=j.useRef(null),f=g_(t,e=>c(e)),p=j.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;j.useEffect(()=>{if(r){let e=function(e){if(p.paused||!s)return;let t=e.target;s.contains(t)?d.current=t:kS(d.current,{select:!0})},t=function(e){if(p.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||kS(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&kS(s)};document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,s,p.paused]),j.useEffect(()=>{if(s){AS.add(p);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(vS,bS);s.addEventListener(vS,l),s.dispatchEvent(t),t.defaultPrevented||(CS(NS(TS(s)),{select:!0}),document.activeElement===e&&kS(s))}return()=>{s.removeEventListener(vS,l),setTimeout(()=>{let t=new CustomEvent(yS,bS);s.addEventListener(yS,u),s.dispatchEvent(t),t.defaultPrevented||kS(e??document.body,{select:!0}),s.removeEventListener(yS,u),AS.remove(p)},0)}}},[s,l,u,p]);let m=j.useCallback(e=>{if(!n&&!r||p.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=wS(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&kS(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&kS(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,p.paused]);return(0,M.jsx)(O_.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})});SS.displayName=xS;function CS(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(kS(r,{select:t}),document.activeElement!==n)return}function wS(e){let t=TS(e);return[ES(t,e),ES(t.reverse(),e)]}function TS(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function ES(e,t){for(let n of e)if(!DS(n,{upTo:t}))return n}function DS(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}function OS(e){return e instanceof HTMLInputElement&&`select`in e}function kS(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&OS(e)&&t&&e.select()}}var AS=jS();function jS(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=MS(e,t),e.unshift(t)},remove(t){e=MS(e,t),e[0]?.resume()}}}function MS(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function NS(e){return e.filter(e=>e.tagName!==`A`)}var PS=0;function FS(){j.useEffect(()=>{let e=document.querySelectorAll(`[data-radix-focus-guard]`);return document.body.insertAdjacentElement(`afterbegin`,e[0]??IS()),document.body.insertAdjacentElement(`beforeend`,e[1]??IS()),PS++,()=>{PS===1&&document.querySelectorAll(`[data-radix-focus-guard]`).forEach(e=>e.remove()),PS--}},[])}function IS(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}var LS=function(){return LS=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},LS.apply(this,arguments)};function RS(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function zS(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var BS=`right-scroll-bar-position`,VS=`width-before-scroll-bar`,HS=`with-scroll-bars-hidden`,US=`--removed-body-scroll-bar-size`;function WS(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function GS(e,t){var n=(0,j.useState)(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(e){var t=n.value;t!==e&&(n.value=e,n.callback(e,t))}}}})[0];return n.callback=t,n.facade}var KS=typeof window<`u`?j.useLayoutEffect:j.useEffect,qS=new WeakMap;function JS(e,t){var n=GS(t||null,function(t){return e.forEach(function(e){return WS(e,t)})});return KS(function(){var t=qS.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||WS(e,null)}),i.forEach(function(e){r.has(e)||WS(e,a)})}qS.set(n,e)},[e]),n}function YS(e){return e}function XS(e,t){t===void 0&&(t=YS);var n=[],r=!1;return{read:function(){if(r)throw 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(e){var i=t(e,r);return n.push(i),function(){n=n.filter(function(e){return e!==i})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var i=n;n=[],i.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},o=function(){return Promise.resolve().then(a)};o(),n={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),n}}}}}function ZS(e){e===void 0&&(e={});var t=XS(null);return t.options=LS({async:!0,ssr:!1},e),t}var QS=function(e){var t=e.sideCar,n=RS(e,[`sideCar`]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error(`Sidecar medium not found`);return j.createElement(r,LS({},n))};QS.isSideCarExport=!0;function $S(e,t){return e.useMedium(t),QS}var eC=ZS(),tC=function(){},nC=j.forwardRef(function(e,t){var n=j.useRef(null),r=j.useState({onScrollCapture:tC,onWheelCapture:tC,onTouchMoveCapture:tC}),i=r[0],a=r[1],o=e.forwardProps,s=e.children,c=e.className,l=e.removeScrollBar,u=e.enabled,d=e.shards,f=e.sideCar,p=e.noRelative,m=e.noIsolation,h=e.inert,g=e.allowPinchZoom,_=e.as,v=_===void 0?`div`:_,y=e.gapMode,b=RS(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),x=f,S=JS([n,t]),C=LS(LS({},b),i);return j.createElement(j.Fragment,null,u&&j.createElement(x,{sideCar:eC,removeScrollBar:l,shards:d,noRelative:p,noIsolation:m,inert:h,setCallbacks:a,allowPinchZoom:!!g,lockRef:n,gapMode:y}),o?j.cloneElement(j.Children.only(s),LS(LS({},C),{ref:S})):j.createElement(v,LS({},C,{className:c,ref:S}),s))});nC.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},nC.classNames={fullWidth:VS,zeroRight:BS};var rC,iC=function(){if(rC)return rC;if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function aC(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=iC();return t&&e.setAttribute(`nonce`,t),e}function oC(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function sC(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var cC=function(){var e=0,t=null;return{add:function(n){e==0&&(t=aC())&&(oC(t,n),sC(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},lC=function(){var e=cC();return function(t,n){j.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},uC=function(){var e=lC();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},dC={left:0,top:0,right:0,gap:0},fC=function(e){return parseInt(e||``,10)||0},pC=function(e){var t=window.getComputedStyle(document.body),n=t[e===`padding`?`paddingLeft`:`marginLeft`],r=t[e===`padding`?`paddingTop`:`marginTop`],i=t[e===`padding`?`paddingRight`:`marginRight`];return[fC(n),fC(r),fC(i)]},mC=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return dC;var t=pC(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},hC=uC(),gC=`data-scroll-locked`,_C=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
|
|
102
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function vu(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e===`$ref`||e===`allOf`||e in a||delete i[e];if(s.$ref&&n.def)for(let e in i)e===`$ref`||e===`allOf`||e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e===`$ref`||e===`allOf`||e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:xu(t,`input`,e.processors),output:xu(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function yu(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return yu(r.element,n);if(r.type===`set`)return yu(r.valueType,n);if(r.type===`lazy`)return yu(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`)return yu(r.innerType,n);if(r.type===`intersection`)return yu(r.left,n)||yu(r.right,n);if(r.type===`record`||r.type===`map`)return yu(r.keyType,n)||yu(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:yu(r.in,n)||yu(r.out,n);if(r.type===`object`){for(let e in r.shape)if(yu(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(yu(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(yu(e,n))return!0;return!!(r.rest&&yu(r.rest,n))}return!1}var bu=(e,t={})=>n=>{let r=hu({...n,processors:t});return gu(e,r),_u(r,e),vu(r,e)},xu=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=hu({...i??{},target:a,io:t,processors:n});return gu(e,o),_u(o,e),vu(o,e)},Su={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},Cu=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=Su[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},wu=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;typeof s==`string`&&s.includes(`int`)?i.type=`integer`:i.type=`number`;let d=typeof u==`number`&&u>=(a??-1/0),f=typeof l==`number`&&l<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;d?p?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l:typeof o==`number`&&(i.maximum=o),typeof c==`number`&&(i.multipleOf=c)},Tu=(e,t,n,r)=>{n.type=`boolean`},Eu=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},Du=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Void cannot be represented in JSON Schema`)},Ou=(e,t,n,r)=>{n.not={}},ku=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Date cannot be represented in JSON Schema`)},Au=(e,t,n,r)=>{let i=e._zod.def,a=Pa(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},ju=(e,t,n,r)=>{let i=e._zod.def,a=[];for(let e of i.values)if(e===void 0){if(t.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(t.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);a.push(Number(e))}else a.push(e);if(a.length!==0)if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a},Mu=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},Nu=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Function types cannot be represented in JSON Schema`)},Pu=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},Fu=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=gu(a.element,t,{...r,path:[...r.path,`items`]})},Iu=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=gu(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=gu(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Lu=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>gu(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Ru=(e,t,n,r)=>{let i=e._zod.def,a=gu(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=gu(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},zu=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`array`;let o=t.target===`draft-2020-12`?`prefixItems`:`items`,s=t.target===`draft-2020-12`||t.target===`openapi-3.0`?`items`:`additionalItems`,c=a.items.map((e,n)=>gu(e,t,{...r,path:[...r.path,o,n]})),l=a.rest?gu(a.rest,t,{...r,path:[...r.path,s,...t.target===`openapi-3.0`?[a.items.length]:[]]}):null;t.target===`draft-2020-12`?(i.prefixItems=c,l&&(i.items=l)):t.target===`openapi-3.0`?(i.items={anyOf:c},l&&i.items.anyOf.push(l),i.minItems=c.length,l||(i.maxItems=c.length)):(i.items=c,l&&(i.additionalItems=l));let{minimum:u,maximum:d}=e._zod.bag;typeof u==`number`&&(i.minItems=u),typeof d==`number`&&(i.maxItems=d)},Bu=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=o._zod.bag?.patterns;if(a.mode===`loose`&&s&&s.size>0){let e=gu(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)i.patternProperties[t.source]=e}else (t.target===`draft-07`||t.target===`draft-2020-12`)&&(i.propertyNames=gu(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=gu(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]});let c=o._zod.values;if(c){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e)}},Vu=(e,t,n,r)=>{let i=e._zod.def,a=gu(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},Hu=(e,t,n,r)=>{let i=e._zod.def;gu(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Uu=(e,t,n,r)=>{let i=e._zod.def;gu(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},Wu=(e,t,n,r)=>{let i=e._zod.def;gu(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},Gu=(e,t,n,r)=>{let i=e._zod.def;gu(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},Ku=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;gu(o,t,r);let s=t.seen.get(e);s.ref=o},qu=(e,t,n,r)=>{let i=e._zod.def;gu(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Ju=(e,t,n,r)=>{let i=e._zod.def;gu(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Yu=(e,t,n,r)=>{let i=e._zod.def;gu(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Xu=(e,t,n,r)=>{let i=e._zod.innerType;gu(i,t,r);let a=t.seen.get(e);a.ref=i},Zu=N(`ZodISODateTime`,(e,t)=>{Js.init(e,t),Cd.init(e,t)});function Qu(e){return jl(Zu,e)}var $u=N(`ZodISODate`,(e,t)=>{Ys.init(e,t),Cd.init(e,t)});function ed(e){return Ml($u,e)}var td=N(`ZodISOTime`,(e,t)=>{Xs.init(e,t),Cd.init(e,t)});function nd(e){return Nl(td,e)}var rd=N(`ZodISODuration`,(e,t)=>{Zs.init(e,t),Cd.init(e,t)});function id(e){return Pl(rd,e)}var ad=N(`ZodError`,(e,t)=>{vo.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>bo(e,t)},flatten:{value:t=>yo(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,Fa,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,Fa,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),od=xo(ad),sd=Co(ad),cd=To(ad),ld=Do(ad),ud=ko(ad),dd=Ao(ad),fd=jo(ad),pd=Mo(ad),md=No(ad),hd=Po(ad),gd=Fo(ad),_d=Io(ad),vd=new WeakMap;function yd(e,t,n){let r=Object.getPrototypeOf(e),i=vd.get(r);if(i||(i=new Set,vd.set(r,i)),!i.has(t)){i.add(t);for(let e in n){let t=n[e];Object.defineProperty(r,e,{configurable:!0,enumerable:!1,get(){let n=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:n}),n},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}}var bd=N(`ZodType`,(e,t)=>(Ps.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:xu(e,`input`),output:xu(e,`output`)}}),e.toJSONSchema=bu(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,n)=>od(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>cd(e,t,n),e.parseAsync=async(t,n)=>sd(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>ld(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>ud(e,t,n),e.decode=(t,n)=>dd(e,t,n),e.encodeAsync=async(t,n)=>fd(e,t,n),e.decodeAsync=async(t,n)=>pd(e,t,n),e.safeEncode=(t,n)=>md(e,t,n),e.safeDecode=(t,n)=>hd(e,t,n),e.safeEncodeAsync=async(t,n)=>gd(e,t,n),e.safeDecodeAsync=async(t,n)=>_d(e,t,n),yd(e,`ZodType`,{check(...e){let t=this.def;return this.clone(Ua(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return $a(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Gf(e,t))},superRefine(e,t){return this.check(Kf(e,t))},overwrite(e){return this.check(iu(e))},optional(){return bf(this)},exactOptional(){return Sf(this)},nullable(){return wf(this)},nullish(){return bf(wf(this))},nonoptional(e){return Af(this,e)},array(){return B(this)},or(e){return H([this,e])},and(e){return df(this,e)},transform(e){return Pf(this,vf(e))},default(e){return Ef(this,e)},prefault(e){return Of(this,e)},catch(e){return Mf(this,e)},pipe(e){return Pf(this,e)},readonly(){return If(this)},describe(e){let t=this.clone();return sl.add(t,{description:e}),t},meta(...e){if(e.length===0)return sl.get(this);let t=this.clone();return sl.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,"description",{get(){return sl.get(e)?.description},configurable:!0}),e)),xd=N(`_ZodString`,(e,t)=>{Fs.init(e,t),bd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Cu(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,yd(e,`_ZodString`,{regex(...e){return this.check(Ql(...e))},includes(...e){return this.check(tu(...e))},startsWith(...e){return this.check(nu(...e))},endsWith(...e){return this.check(ru(...e))},min(...e){return this.check(Xl(...e))},max(...e){return this.check(Yl(...e))},length(...e){return this.check(Zl(...e))},nonempty(...e){return this.check(Xl(1,...e))},lowercase(e){return this.check($l(e))},uppercase(e){return this.check(eu(e))},trim(){return this.check(ou())},normalize(...e){return this.check(au(...e))},toLowerCase(){return this.check(su())},toUpperCase(){return this.check(cu())},slugify(){return this.check(lu())}})}),Sd=N(`ZodString`,(e,t)=>{Fs.init(e,t),xd.init(e,t),e.email=t=>e.check(ll(wd,t)),e.url=t=>e.check(hl(Dd,t)),e.jwt=t=>e.check(Al(Hd,t)),e.emoji=t=>e.check(gl(Od,t)),e.guid=t=>e.check(ul(Td,t)),e.uuid=t=>e.check(dl(Ed,t)),e.uuidv4=t=>e.check(fl(Ed,t)),e.uuidv6=t=>e.check(pl(Ed,t)),e.uuidv7=t=>e.check(ml(Ed,t)),e.nanoid=t=>e.check(_l(kd,t)),e.guid=t=>e.check(ul(Td,t)),e.cuid=t=>e.check(vl(Ad,t)),e.cuid2=t=>e.check(yl(jd,t)),e.ulid=t=>e.check(bl(Md,t)),e.base64=t=>e.check(Dl(zd,t)),e.base64url=t=>e.check(Ol(Bd,t)),e.xid=t=>e.check(xl(Nd,t)),e.ksuid=t=>e.check(Sl(Pd,t)),e.ipv4=t=>e.check(Cl(Fd,t)),e.ipv6=t=>e.check(wl(Id,t)),e.cidrv4=t=>e.check(Tl(Ld,t)),e.cidrv6=t=>e.check(El(Rd,t)),e.e164=t=>e.check(kl(Vd,t)),e.datetime=t=>e.check(Qu(t)),e.date=t=>e.check(ed(t)),e.time=t=>e.check(nd(t)),e.duration=t=>e.check(id(t))});function I(e){return cl(Sd,e)}var Cd=N(`ZodStringFormat`,(e,t)=>{Is.init(e,t),xd.init(e,t)}),wd=N(`ZodEmail`,(e,t)=>{zs.init(e,t),Cd.init(e,t)}),Td=N(`ZodGUID`,(e,t)=>{Ls.init(e,t),Cd.init(e,t)}),Ed=N(`ZodUUID`,(e,t)=>{Rs.init(e,t),Cd.init(e,t)}),Dd=N(`ZodURL`,(e,t)=>{Bs.init(e,t),Cd.init(e,t)}),Od=N(`ZodEmoji`,(e,t)=>{Vs.init(e,t),Cd.init(e,t)}),kd=N(`ZodNanoID`,(e,t)=>{Hs.init(e,t),Cd.init(e,t)}),Ad=N(`ZodCUID`,(e,t)=>{Us.init(e,t),Cd.init(e,t)}),jd=N(`ZodCUID2`,(e,t)=>{Ws.init(e,t),Cd.init(e,t)}),Md=N(`ZodULID`,(e,t)=>{Gs.init(e,t),Cd.init(e,t)}),Nd=N(`ZodXID`,(e,t)=>{Ks.init(e,t),Cd.init(e,t)}),Pd=N(`ZodKSUID`,(e,t)=>{qs.init(e,t),Cd.init(e,t)}),Fd=N(`ZodIPv4`,(e,t)=>{Qs.init(e,t),Cd.init(e,t)}),Id=N(`ZodIPv6`,(e,t)=>{$s.init(e,t),Cd.init(e,t)}),Ld=N(`ZodCIDRv4`,(e,t)=>{ec.init(e,t),Cd.init(e,t)}),Rd=N(`ZodCIDRv6`,(e,t)=>{tc.init(e,t),Cd.init(e,t)}),zd=N(`ZodBase64`,(e,t)=>{rc.init(e,t),Cd.init(e,t)}),Bd=N(`ZodBase64URL`,(e,t)=>{ac.init(e,t),Cd.init(e,t)}),Vd=N(`ZodE164`,(e,t)=>{oc.init(e,t),Cd.init(e,t)}),Hd=N(`ZodJWT`,(e,t)=>{cc.init(e,t),Cd.init(e,t)}),Ud=N(`ZodNumber`,(e,t)=>{lc.init(e,t),bd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wu(e,t,n,r),yd(e,`ZodNumber`,{gt(e,t){return this.check(Kl(e,t))},gte(e,t){return this.check(ql(e,t))},min(e,t){return this.check(ql(e,t))},lt(e,t){return this.check(Wl(e,t))},lte(e,t){return this.check(Gl(e,t))},max(e,t){return this.check(Gl(e,t))},int(e){return this.check(Gd(e))},safe(e){return this.check(Gd(e))},positive(e){return this.check(Kl(0,e))},nonnegative(e){return this.check(ql(0,e))},negative(e){return this.check(Wl(0,e))},nonpositive(e){return this.check(Gl(0,e))},multipleOf(e,t){return this.check(Jl(e,t))},step(e,t){return this.check(Jl(e,t))},finite(){return this}});let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function L(e){return Fl(Ud,e)}var Wd=N(`ZodNumberFormat`,(e,t)=>{uc.init(e,t),Ud.init(e,t)});function Gd(e){return Il(Wd,e)}var Kd=N(`ZodBoolean`,(e,t)=>{dc.init(e,t),bd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Tu(e,t,n,r)});function R(e){return Ll(Kd,e)}var qd=N(`ZodNull`,(e,t)=>{fc.init(e,t),bd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Eu(e,t,n,r)});function Jd(e){return Rl(qd,e)}var Yd=N(`ZodAny`,(e,t)=>{pc.init(e,t),bd.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Xd(){return zl(Yd)}var Zd=N(`ZodUnknown`,(e,t)=>{mc.init(e,t),bd.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function z(){return Bl(Zd)}var Qd=N(`ZodNever`,(e,t)=>{hc.init(e,t),bd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ou(e,t,n,r)});function $d(e){return Vl(Qd,e)}var ef=N(`ZodVoid`,(e,t)=>{gc.init(e,t),bd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Du(e,t,n,r)});function tf(e){return Hl(ef,e)}var nf=N(`ZodDate`,(e,t)=>{_c.init(e,t),bd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ku(e,t,n,r),e.min=(t,n)=>e.check(ql(t,n)),e.max=(t,n)=>e.check(Gl(t,n));let n=e._zod.bag;e.minDate=n.minimum?new Date(n.minimum):null,e.maxDate=n.maximum?new Date(n.maximum):null});function rf(e){return Ul(nf,e)}var af=N(`ZodArray`,(e,t)=>{yc.init(e,t),bd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fu(e,t,n,r),e.element=t.element,yd(e,`ZodArray`,{min(e,t){return this.check(Xl(e,t))},nonempty(e){return this.check(Xl(1,e))},max(e,t){return this.check(Yl(e,t))},length(e,t){return this.check(Zl(e,t))},unwrap(){return this.element}})});function B(e,t){return uu(af,e,t)}var of=N(`ZodObject`,(e,t)=>{wc.init(e,t),bd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Iu(e,t,n,r),Va(e,`shape`,()=>t.shape),yd(e,`ZodObject`,{keyof(){return W(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:z()})},loose(){return this.clone({...this._zod.def,catchall:z()})},strict(){return this.clone({...this._zod.def,catchall:$d()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return io(this,e)},safeExtend(e){return ao(this,e)},merge(e){return oo(this,e)},pick(e){return no(this,e)},omit(e){return ro(this,e)},partial(...e){return so(yf,this,e[0])},required(...e){return co(kf,this,e[0])}})});function V(e,t){return new of({type:`object`,shape:e??{},...P(t)})}var sf=N(`ZodUnion`,(e,t)=>{Ec.init(e,t),bd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Lu(e,t,n,r),e.options=t.options});function H(e,t){return new sf({type:`union`,options:e,...P(t)})}var cf=N(`ZodDiscriminatedUnion`,(e,t)=>{sf.init(e,t),Dc.init(e,t)});function lf(e,t,n){return new cf({type:`union`,options:t,discriminator:e,...P(n)})}var uf=N(`ZodIntersection`,(e,t)=>{Oc.init(e,t),bd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ru(e,t,n,r)});function df(e,t){return new uf({type:`intersection`,left:e,right:t})}var ff=N(`ZodTuple`,(e,t)=>{jc.init(e,t),bd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>zu(e,t,n,r),e.rest=t=>e.clone({...e._zod.def,rest:t})});function pf(e,t,n){let r=t instanceof Ps;return new ff({type:`tuple`,items:e,rest:r?t:null,...P(r?n:t)})}var mf=N(`ZodRecord`,(e,t)=>{Fc.init(e,t),bd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Bu(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function U(e,t,n){return!t||!t._zod?new mf({type:`record`,keyType:I(),valueType:e,...P(t)}):new mf({type:`record`,keyType:e,valueType:t,...P(n)})}var hf=N(`ZodEnum`,(e,t)=>{Ic.init(e,t),bd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Au(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new hf({...t,checks:[],...P(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new hf({...t,checks:[],...P(r),entries:i})}});function W(e,t){return new hf({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...P(t)})}var gf=N(`ZodLiteral`,(e,t)=>{Lc.init(e,t),bd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ju(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function G(e,t){return new gf({type:`literal`,values:Array.isArray(e)?e:[e],...P(t)})}var _f=N(`ZodTransform`,(e,t)=>{Rc.init(e,t),bd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Pu(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new ja(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(go(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(go(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n.fallback=!0,n)):(n.value=i,n.fallback=!0,n)}});function vf(e){return new _f({type:`transform`,transform:e})}var yf=N(`ZodOptional`,(e,t)=>{Bc.init(e,t),bd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Yu(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function bf(e){return new yf({type:`optional`,innerType:e})}var xf=N(`ZodExactOptional`,(e,t)=>{Vc.init(e,t),bd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Yu(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Sf(e){return new xf({type:`optional`,innerType:e})}var Cf=N(`ZodNullable`,(e,t)=>{Hc.init(e,t),bd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Vu(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function wf(e){return new Cf({type:`nullable`,innerType:e})}var Tf=N(`ZodDefault`,(e,t)=>{Uc.init(e,t),bd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Uu(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Ef(e,t){return new Tf({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():Xa(t)}})}var Df=N(`ZodPrefault`,(e,t)=>{Gc.init(e,t),bd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Wu(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Of(e,t){return new Df({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():Xa(t)}})}var kf=N(`ZodNonOptional`,(e,t)=>{Kc.init(e,t),bd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Hu(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Af(e,t){return new kf({type:`nonoptional`,innerType:e,...P(t)})}var jf=N(`ZodCatch`,(e,t)=>{Jc.init(e,t),bd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Gu(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Mf(e,t){return new jf({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var Nf=N(`ZodPipe`,(e,t)=>{Yc.init(e,t),bd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ku(e,t,n,r),e.in=t.in,e.out=t.out});function Pf(e,t){return new Nf({type:`pipe`,in:e,out:t})}var Ff=N(`ZodReadonly`,(e,t)=>{Zc.init(e,t),bd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qu(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function If(e){return new Ff({type:`readonly`,innerType:e})}var Lf=N(`ZodLazy`,(e,t)=>{tl.init(e,t),bd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xu(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function Rf(e){return new Lf({type:`lazy`,getter:e})}var zf=N(`ZodPromise`,(e,t)=>{el.init(e,t),bd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ju(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Bf(e){return new zf({type:`promise`,innerType:e})}var Vf=N(`ZodFunction`,(e,t)=>{$c.init(e,t),bd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Nu(e,t,n,r)});function Hf(e){return new Vf({type:`function`,input:Array.isArray(e?.input)?pf(e?.input):e?.input??B(z()),output:e?.output??z()})}var Uf=N(`ZodCustom`,(e,t)=>{nl.init(e,t),bd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Mu(e,t,n,r)});function Wf(e,t){return du(Uf,e??(()=>!0),t)}function Gf(e,t={}){return fu(Uf,e,t)}function Kf(e,t){return pu(e,t)}var qf=c(_(),1);function K(e){if(typeof process<`u`&&{}.OS_EAGER_SCHEMAS===`1`)return e();let t,n=()=>(t===void 0&&(t=e()),t);return new Proxy(function(){},{get(e,t){let r=n(),i=r[t];return typeof i==`function`?i.bind(r):i},set(e,t,r){let i=n();return i[t]=r,!0},has(e,t){return t in n()},ownKeys(){return Reflect.ownKeys(n())},getOwnPropertyDescriptor(e,t){return Reflect.getOwnPropertyDescriptor(n(),t)},getPrototypeOf(){return Reflect.getPrototypeOf(n())}})}var Jf=K(()=>V({$field:I().describe(`Field Reference/Column Name`)}));K(()=>V({$eq:Xd().optional(),$ne:Xd().optional()})),K(()=>V({$gt:H([L(),rf(),Jf]).optional(),$gte:H([L(),rf(),Jf]).optional(),$lt:H([L(),rf(),Jf]).optional(),$lte:H([L(),rf(),Jf]).optional()})),K(()=>V({$in:B(Xd()).optional(),$nin:B(Xd()).optional()})),K(()=>V({$between:pf([H([L(),rf(),Jf]),H([L(),rf(),Jf])]).optional()})),K(()=>V({$contains:I().optional(),$notContains:I().optional(),$startsWith:I().optional(),$endsWith:I().optional()})),K(()=>V({$null:R().optional(),$exists:R().optional()}));var Yf=K(()=>V({$eq:Xd().optional(),$ne:Xd().optional(),$gt:H([L(),rf(),Jf]).optional(),$gte:H([L(),rf(),Jf]).optional(),$lt:H([L(),rf(),Jf]).optional(),$lte:H([L(),rf(),Jf]).optional(),$in:B(Xd()).optional(),$nin:B(Xd()).optional(),$between:pf([H([L(),rf(),Jf]),H([L(),rf(),Jf])]).optional(),$contains:I().optional(),$notContains:I().optional(),$startsWith:I().optional(),$endsWith:I().optional(),$null:R().optional(),$exists:R().optional()})),Xf=Rf(()=>U(I(),z()).and(V({$and:B(Xf).optional(),$or:B(Xf).optional(),$not:Xf.optional()})));K(()=>V({where:Xf.optional()}));var Zf=Rf(()=>V({$and:B(H([U(I(),Yf),Zf])).optional(),$or:B(H([U(I(),Yf),Zf])).optional(),$not:H([U(I(),Yf),Zf]).optional()})),Qf=new Set([`=`,`==`,`!=`,`<>`,`>`,`>=`,`<`,`<=`,`in`,`nin`,`not_in`,`contains`,`notcontains`,`not_contains`,`like`,`startswith`,`starts_with`,`endswith`,`ends_with`,`between`,`is_null`,`is_not_null`]);function $f(e){if(!Array.isArray(e)||e.length===0)return!1;let t=e[0];if(typeof t==`string`){let n=t.toLowerCase();if(n===`and`||n===`or`)return e.length>=2&&e.slice(1).every(e=>$f(e));if(e.length>=2&&typeof e[1]==`string`)return Qf.has(e[1].toLowerCase())}return e.every(e=>$f(e))?e.length>0:!1}var ep=[`$eq`,`$ne`,`$gt`,`$gte`,`$lt`,`$lte`,`$in`,`$nin`,`$between`,`$contains`,`$notContains`,`$startsWith`,`$endsWith`,`$null`,`$exists`],tp=[`$and`,`$or`,`$not`];[...ep,...tp];var np=K(()=>V({field:I(),order:W([`asc`,`desc`]).default(`asc`)})),rp=W([`count`,`sum`,`avg`,`min`,`max`,`count_distinct`,`array_agg`,`string_agg`]),ip=W([`day`,`week`,`month`,`quarter`,`year`]),ap=K(()=>H([I(),V({field:I().describe(`Field to group by`),dateGranularity:ip.optional().describe(`Bucket date values into uniform periods (day/week/month/quarter/year)`),alias:I().optional().describe(`Alias for the projected group value`)})])),op=K(()=>V({function:rp.describe(`Aggregation function`),field:I().optional().describe(`Field to aggregate (optional for COUNT(*))`),alias:I().describe(`Result column alias`),distinct:R().optional().describe(`Apply DISTINCT before aggregation`),filter:Xf.optional().describe(`Filter/Condition to apply to the aggregation (FILTER WHERE clause)`)})),sp=W([`inner`,`left`,`right`,`full`]),cp=W([`auto`,`database`,`hash`,`loop`]),lp=Rf(()=>V({type:sp.describe(`Join type`),strategy:cp.optional().describe(`Execution strategy hint`),object:I().describe(`Object/table to join`),alias:I().optional().describe(`Table alias`),on:Xf.describe(`Join condition`),subquery:Rf(()=>gp).optional().describe(`Subquery instead of object`)})),up=W([`row_number`,`rank`,`dense_rank`,`percent_rank`,`lag`,`lead`,`first_value`,`last_value`,`sum`,`avg`,`count`,`min`,`max`]),dp=K(()=>V({partitionBy:B(I()).optional().describe(`PARTITION BY fields`),orderBy:B(np).optional().describe(`ORDER BY specification`),frame:V({type:W([`rows`,`range`]).optional(),start:I().optional().describe(`Frame start (e.g., "UNBOUNDED PRECEDING", "1 PRECEDING")`),end:I().optional().describe(`Frame end (e.g., "CURRENT ROW", "1 FOLLOWING")`)}).optional().describe(`Window frame specification`)})),fp=K(()=>V({function:up.describe(`Window function name`),field:I().optional().describe(`Field to operate on (for aggregate window functions)`),alias:I().describe(`Result column alias`),over:dp.describe(`Window specification (OVER clause)`)})),pp=Rf(()=>H([I(),V({field:I(),fields:B(pp).optional(),alias:I().optional()})])),mp=K(()=>V({query:I().describe(`Search query text`),fields:B(I()).optional().describe(`Fields to search in (if not specified, searches all text fields)`),fuzzy:R().optional().default(!1).describe(`Enable fuzzy matching (tolerates typos)`),operator:W([`and`,`or`]).optional().default(`or`).describe(`Logical operator between terms`),boost:U(I(),L()).optional().describe(`Field-specific relevance boosting (field name -> boost factor)`),minScore:L().optional().describe(`Minimum relevance score threshold`),language:I().optional().describe(`Language for text analysis (e.g., "en", "zh", "es")`),highlight:R().optional().default(!1).describe(`Enable search result highlighting`)})),hp=V({object:I().describe(`Object name (e.g. account)`),fields:B(pp).optional().describe(`Fields to retrieve`),where:Xf.optional().describe(`Filtering criteria (WHERE)`),search:mp.optional().describe(`Full-text search configuration ($search parameter)`),orderBy:B(np).optional().describe(`Sorting instructions (ORDER BY)`),limit:L().optional().describe(`Max records to return (LIMIT)`),offset:L().optional().describe(`Records to skip (OFFSET)`),top:L().optional().describe(`Alias for limit (OData compatibility)`),cursor:U(I(),z()).optional().describe(`Cursor for keyset pagination`),joins:B(lp).optional().describe(`Explicit Table Joins`),aggregations:B(op).optional().describe(`Aggregation functions`),groupBy:B(ap).optional().describe("GROUP BY targets (strings or `{field, dateGranularity?}` objects for date bucketing)"),having:Xf.optional().describe(`HAVING clause for aggregation filtering`),windowFunctions:B(fp).optional().describe(`Window functions with OVER clause`),distinct:R().optional().describe(`SELECT DISTINCT flag`)}),gp=K(()=>hp.extend({expand:Rf(()=>U(I(),gp)).optional().describe(`Recursive relation loading map. Keys are lookup/master_detail field names; values are nested QueryAST objects that control select, filter, sort, and further expansion on the related object. The engine resolves expand via batch $in queries (driver-agnostic) with a default max depth of 3.`)})),_p=[`today`,`yesterday`,`tomorrow`,`now`],vp=[`current_week_start`,`current_week_end`,`current_month_start`,`current_month_end`,`current_quarter_start`,`current_quarter_end`,`current_year_start`,`current_year_end`,`last_week_start`,`last_week_end`,`last_month_start`,`last_month_end`,`last_quarter_start`,`last_quarter_end`,`last_year_start`,`last_year_end`,`next_week_start`,`next_week_end`,`next_month_start`,`next_month_end`,`next_quarter_start`,`next_quarter_end`,`next_year_start`,`next_year_end`],yp=[`week_start`,`week_end`,`month_start`,`month_end`,`quarter_start`,`quarter_end`,`year_start`,`year_end`],bp=[..._p,...vp,...yp],xp=/^(\d+)_(minutes?|hours?|days?|weeks?|months?|years?)_(ago|from_now)$/,Sp=[`minute`,`hour`,`day`,`week`,`month`,`year`];function Cp(e){return bp.includes(e)||xp.test(e)}I().refine(Cp,{message:`Unknown date macro. Must be a fixed token (see DATE_MACRO_TOKENS) or match {N_<unit>_(ago|from_now)} where unit is one of: `+Sp.join(`, `)});var wp=/^\$?\{([a-zA-Z0-9_]+)\}$/;I().refine(e=>{let t=e.match(wp);return!!t&&Cp(t[1])},{message:`Not a recognised {date-macro} placeholder`});var Tp=K(()=>I().min(2,{message:`System identifier must be at least 2 characters`}).regex(/^[a-z][a-z0-9_.]*$/,{message:`System identifier must be lowercase, starting with a letter, and may contain letters, numbers, underscores, or dots (e.g., "user_profile" or "order.created")`}).describe(`System identifier (lowercase with underscores or dots)`)),Ep=K(()=>I().min(2,{message:`Identifier must be at least 2 characters`}).regex(/^[a-z][a-z0-9_]*$/,{message:`Identifier must be lowercase snake_case, starting with a letter, and may contain only letters, numbers, and underscores (e.g., "user_profile")`}).describe(`Snake case identifier (lowercase with underscores only)`));K(()=>I().min(3,{message:`Event name must be at least 3 characters`}).regex(/^[a-z][a-z0-9_.]*$/,{message:`Event name must be lowercase with dots for namespacing (e.g., "user.created", "order.paid")`}).describe(`Event name (lowercase with dot notation for namespacing)`));var Dp=W([`cel`,`js`,`cron`,`template`]),Op=V({rationale:I().optional(),generatedBy:I().optional()}),kp=V({dialect:Dp,source:I().min(1).optional(),ast:z().optional(),meta:Op.optional()}).refine(e=>e.source!==void 0||e.ast!==void 0,{message:"Expression requires at least one of `source` or `ast`"}),Ap=H([I().min(1).transform(e=>({dialect:`cel`,source:e})),kp]);H([I().min(1).transform(e=>({dialect:`cron`,source:e})),kp]);var jp=H([I().min(1).transform(e=>({dialect:`template`,source:e})),kp]),Mp=K(()=>W([`aes-256-gcm`,`aes-256-cbc`,`chacha20-poly1305`]).describe(`Supported encryption algorithm`)),Np=K(()=>W([`local`,`aws-kms`,`azure-key-vault`,`gcp-kms`,`hashicorp-vault`]).describe(`Key management service provider`)),Pp=K(()=>V({enabled:R().default(!1).describe(`Enable automatic key rotation`),frequencyDays:L().min(1).default(90).describe(`Rotation frequency in days`),retainOldVersions:L().default(3).describe(`Number of old key versions to retain`),autoRotate:R().default(!0).describe(`Automatically rotate without manual approval`)}).describe(`Policy for automatic encryption key rotation`)),Fp=K(()=>V({enabled:R().default(!1).describe(`Enable field-level encryption`),algorithm:Mp.default(`aes-256-gcm`).describe(`Encryption algorithm`),keyManagement:V({provider:Np.describe(`Key management service provider`),keyId:I().optional().describe(`Key identifier in the provider`),rotationPolicy:Pp.optional().describe(`Key rotation policy`)}).describe(`Key management configuration`),scope:W([`field`,`record`,`table`,`database`]).describe(`Encryption scope level`),deterministicEncryption:R().default(!1).describe(`Allows equality queries on encrypted data`),searchableEncryption:R().default(!1).describe(`Allows search on encrypted data`)}).describe(`Field-level encryption configuration`));K(()=>V({fieldName:I().describe(`Name of the field to encrypt`),encryptionConfig:Fp.describe(`Encryption settings for this field`),indexable:R().default(!1).describe(`Allow indexing on encrypted field`)}).describe(`Per-field encryption assignment`));var Ip=K(()=>W([`redact`,`partial`,`hash`,`tokenize`,`randomize`,`nullify`,`substitute`]).describe(`Data masking strategy for PII protection`)),Lp=K(()=>V({field:I().describe(`Field name to apply masking to`),strategy:Ip.describe(`Masking strategy to use`),pattern:I().optional().describe(`Regex pattern for partial masking`),preserveFormat:R().default(!0).describe(`Keep the original data format after masking`),preserveLength:R().default(!0).describe(`Keep the original data length after masking`),roles:B(I()).optional().describe(`Roles that see masked data`),exemptRoles:B(I()).optional().describe(`Roles that see unmasked data`)}).describe(`Masking rule for a single field`));K(()=>V({enabled:R().default(!1).describe(`Enable data masking`),rules:B(Lp).describe(`List of field-level masking rules`),auditUnmasking:R().default(!0).describe(`Log when masked data is accessed unmasked`)}).describe(`Top-level data masking configuration for PII protection`));var Rp=W(`text.textarea.email.url.phone.password.secret.markdown.html.richtext.number.currency.percent.date.datetime.time.boolean.toggle.select.multiselect.radio.checkboxes.lookup.master_detail.tree.image.file.avatar.video.audio.formula.summary.autonumber.composite.repeater.record.location.address.code.json.color.rating.slider.signature.qrcode.progress.tags.vector`.split(`.`)),zp=K(()=>V({label:I().describe(`Display label (human-readable, any case allowed)`),value:Tp.describe(`Stored value (lowercase machine identifier)`),color:I().optional().describe(`Color code for badges/charts`),default:R().optional().describe(`Is default option`)}));K(()=>V({latitude:L().min(-90).max(90).describe(`Latitude coordinate`),longitude:L().min(-180).max(180).describe(`Longitude coordinate`),altitude:L().optional().describe(`Altitude in meters`),accuracy:L().optional().describe(`Accuracy in meters`)}));var Bp=K(()=>V({precision:L().int().min(0).max(10).default(2).describe(`Decimal precision (default: 2)`),currencyMode:W([`dynamic`,`fixed`]).default(`dynamic`).describe(`Currency mode: dynamic (user selectable) or fixed (single currency)`),defaultCurrency:I().length(3).default(`CNY`).describe(`Default or fixed currency code (ISO 4217, e.g., USD, CNY, EUR)`)}));K(()=>V({value:L().describe(`Monetary amount`),currency:I().length(3).describe(`Currency code (ISO 4217)`)})),K(()=>V({street:I().optional().describe(`Street address`),city:I().optional().describe(`City name`),state:I().optional().describe(`State/Province`),postalCode:I().optional().describe(`Postal/ZIP code`),country:I().optional().describe(`Country name or code`),countryCode:I().optional().describe(`ISO country code (e.g., US, GB)`),formatted:I().optional().describe(`Formatted address string`)}));var Vp=K(()=>V({dimensions:L().int().min(1).max(1e4).describe(`Vector dimensionality (e.g., 1536 for OpenAI embeddings)`),distanceMetric:W([`cosine`,`euclidean`,`dotProduct`,`manhattan`]).default(`cosine`).describe(`Distance/similarity metric for vector search`),normalized:R().default(!1).describe(`Whether vectors are normalized (unit length)`),indexed:R().default(!0).describe(`Whether to create a vector index for fast similarity search`),indexType:W([`hnsw`,`ivfflat`,`flat`]).optional().describe(`Vector index algorithm (HNSW for high accuracy, IVFFlat for large datasets)`)})),Hp=K(()=>V({minSize:L().min(0).optional().describe(`Minimum file size in bytes`),maxSize:L().min(1).optional().describe(`Maximum file size in bytes (e.g., 10485760 = 10MB)`),allowedTypes:B(I()).optional().describe(`Allowed file extensions (e.g., [".pdf", ".docx", ".jpg"])`),blockedTypes:B(I()).optional().describe(`Blocked file extensions (e.g., [".exe", ".bat", ".sh"])`),allowedMimeTypes:B(I()).optional().describe(`Allowed MIME types (e.g., ["image/jpeg", "application/pdf"])`),blockedMimeTypes:B(I()).optional().describe(`Blocked MIME types`),virusScan:R().default(!1).describe(`Enable virus scanning for uploaded files`),virusScanProvider:W([`clamav`,`virustotal`,`metadefender`,`custom`]).optional().describe(`Virus scanning service provider`),virusScanOnUpload:R().default(!0).describe(`Scan files immediately on upload`),quarantineOnThreat:R().default(!0).describe(`Quarantine files if threat detected`),storageProvider:I().optional().describe(`Object storage provider name (references ObjectStorageConfig)`),storageBucket:I().optional().describe(`Target bucket name`),storagePrefix:I().optional().describe(`Storage path prefix (e.g., "uploads/documents/")`),imageValidation:V({minWidth:L().min(1).optional().describe(`Minimum image width in pixels`),maxWidth:L().min(1).optional().describe(`Maximum image width in pixels`),minHeight:L().min(1).optional().describe(`Minimum image height in pixels`),maxHeight:L().min(1).optional().describe(`Maximum image height in pixels`),aspectRatio:I().optional().describe(`Required aspect ratio (e.g., "16:9", "1:1")`),generateThumbnails:R().default(!1).describe(`Auto-generate thumbnails`),thumbnailSizes:B(V({name:I().describe(`Thumbnail variant name (e.g., "small", "medium", "large")`),width:L().min(1).describe(`Thumbnail width in pixels`),height:L().min(1).describe(`Thumbnail height in pixels`),crop:R().default(!1).describe(`Crop to exact dimensions`)})).optional().describe(`Thumbnail size configurations`),preserveMetadata:R().default(!1).describe(`Preserve EXIF metadata`),autoRotate:R().default(!0).describe(`Auto-rotate based on EXIF orientation`)}).optional().describe(`Image-specific validation rules`),allowMultiple:R().default(!1).describe(`Allow multiple file uploads (overrides field.multiple)`),allowReplace:R().default(!0).describe(`Allow replacing existing files`),allowDelete:R().default(!0).describe(`Allow deleting uploaded files`),requireUpload:R().default(!1).describe(`Require at least one file when field is required`),extractMetadata:R().default(!0).describe(`Extract file metadata (name, size, type, etc.)`),extractText:R().default(!1).describe(`Extract text content from documents (OCR/parsing)`),versioningEnabled:R().default(!1).describe(`Keep previous versions of replaced files`),maxVersions:L().min(1).optional().describe(`Maximum number of versions to retain`),publicRead:R().default(!1).describe(`Allow public read access to uploaded files`),presignedUrlExpiry:L().min(60).max(604800).default(3600).describe(`Presigned URL expiration in seconds (default: 1 hour)`)}).refine(e=>!(e.minSize!==void 0&&e.maxSize!==void 0&&e.minSize>e.maxSize),{message:`minSize must be less than or equal to maxSize`}).refine(e=>!(e.virusScanProvider!==void 0&&e.virusScan!==!0),{message:`virusScanProvider requires virusScan to be enabled`})),Up=K(()=>V({uniqueness:R().default(!1).describe(`Enforce unique values across all records`),completeness:L().min(0).max(1).default(0).describe(`Minimum ratio of non-null values (0-1, default: 0 = no requirement)`),accuracy:V({source:I().describe(`Reference data source for validation (e.g., "api.verify.com", "master_data")`),threshold:L().min(0).max(1).describe(`Minimum accuracy threshold (0-1, e.g., 0.95 = 95% match required)`)}).optional().describe(`Accuracy validation configuration`)})),Wp=K(()=>V({enabled:R().describe(`Enable caching for computed field results`),ttl:L().min(0).describe(`Cache TTL in seconds (0 = no expiration)`),invalidateOn:B(I()).describe(`Field paths that invalidate cache (e.g., ["inventory.quantity", "pricing.base_price"])`)})),Gp=K(()=>V({name:I().regex(/^[a-z_][a-z0-9_]*$/).describe(`Machine name (snake_case)`).optional(),label:I().optional().describe(`Human readable label`),type:Rp.describe(`Field Data Type`),description:I().optional().describe(`Tooltip/Help text`),format:I().optional().describe(`Format string (e.g. email, phone)`),columnName:I().optional().describe(`Physical column name in the target datasource. Defaults to the field key when not set.`),required:R().default(!1).describe(`Is required`),searchable:R().default(!1).describe(`Is searchable`),multiple:R().default(!1).describe(`Allow multiple values (Stores as Array/JSON). Applicable for select, lookup, file, image.`),unique:R().default(!1).describe(`Is unique constraint`),defaultValue:z().optional().describe(`Default value`),maxLength:L().optional().describe(`Max character length`),minLength:L().optional().describe(`Min character length`),precision:L().optional().describe(`Total digits`),scale:L().optional().describe(`Decimal places`),min:L().optional().describe(`Minimum value`),max:L().optional().describe(`Maximum value`),options:B(zp).optional().describe(`Static options for select/multiselect`),reference:I().optional().describe(`Target object name (snake_case) for lookup/master_detail fields. Required for relationship types. Used by $expand to resolve foreign key IDs into full objects.`),referenceFilters:B(I()).optional().describe(`Filters applied to lookup dialogs (e.g. "active = true")`),writeRequiresMasterRead:R().optional().describe(`If true, user needs read access to master record to edit this field`),deleteBehavior:W([`set_null`,`cascade`,`restrict`]).optional().default(`set_null`).describe(`What happens if referenced record is deleted`),expression:Ap.optional().describe("Formula expression (CEL). e.g. F`record.amount * 0.1`"),summaryOperations:V({object:I().describe(`Source child object name for roll-up`),field:I().describe(`Field on child object to aggregate`),function:W([`count`,`sum`,`min`,`max`,`avg`]).describe(`Aggregation function to apply`)}).optional().describe(`Roll-up summary definition`),language:I().optional().describe(`Programming language for syntax highlighting (e.g., javascript, python, sql)`),theme:I().optional().describe(`Code editor theme (e.g., dark, light, monokai)`),lineNumbers:R().optional().describe(`Show line numbers in code editor`),maxRating:L().optional().describe(`Maximum rating value (default: 5)`),allowHalf:R().optional().describe(`Allow half-star ratings`),displayMap:R().optional().describe(`Display map widget for location field`),allowGeocoding:R().optional().describe(`Allow address-to-coordinate conversion`),addressFormat:W([`us`,`uk`,`international`]).optional().describe(`Address format template`),colorFormat:W([`hex`,`rgb`,`rgba`,`hsl`]).optional().describe(`Color value format`),allowAlpha:R().optional().describe(`Allow transparency/alpha channel`),presetColors:B(I()).optional().describe(`Preset color options`),step:L().optional().describe(`Step increment for slider (default: 1)`),showValue:R().optional().describe(`Display current value on slider`),marks:U(I(),I()).optional().describe(`Custom marks/labels at specific values (e.g., {0: "Low", 50: "Medium", 100: "High"})`),barcodeFormat:W([`qr`,`ean13`,`ean8`,`code128`,`code39`,`upca`,`upce`]).optional().describe(`Barcode format type`),qrErrorCorrection:W([`L`,`M`,`Q`,`H`]).optional().describe(`QR code error correction level (L=7%, M=15%, Q=25%, H=30%). Only applicable when barcodeFormat is "qr"`),displayValue:R().optional().describe(`Display human-readable value below barcode/QR code`),allowScanning:R().optional().describe(`Enable camera scanning for barcode/QR code input`),currencyConfig:Bp.optional().describe(`Configuration for currency field type`),vectorConfig:Vp.optional().describe(`Configuration for vector field type (AI/ML embeddings)`),fileAttachmentConfig:Hp.optional().describe(`Configuration for file and attachment field types`),encryptionConfig:Fp.optional().describe(`Field-level encryption configuration for sensitive data (GDPR/HIPAA/PCI-DSS)`),maskingRule:Lp.optional().describe(`Data masking rules for PII protection`),auditTrail:R().default(!1).describe(`Enable detailed audit trail for this field (tracks all changes with user and timestamp)`),dependencies:B(I()).optional().describe(`Array of field names that this field depends on (for formulas, visibility rules, etc.)`),cached:Wp.optional().describe(`Caching configuration for computed/formula fields`),dataQuality:Up.optional().describe(`Data quality validation and monitoring rules`),group:I().optional().describe(`Field group name for organizing fields in forms and layouts (e.g., "contact_info", "billing", "system")`),conditionalRequired:Ap.optional().describe("Predicate (CEL) — field is required when TRUE. e.g. P`record.status == 'closed_won'`"),hidden:R().default(!1).describe(`Hidden from default UI`),readonly:R().default(!1).describe(`Read-only in UI`),system:R().optional().describe(`Auto-injected system/audit field (e.g. created_at, updated_by, organization_id). Tools that surface system fields separately from author-declared business fields should branch on this flag.`),sortable:R().optional().default(!0).describe(`Whether field is sortable in list views`),inlineHelpText:I().optional().describe(`Help text displayed below the field in forms`),trackFeedHistory:R().optional().describe(`Track field changes in Chatter/activity feed (Salesforce pattern)`),caseSensitive:R().optional().describe(`Whether text comparisons are case-sensitive`),autonumberFormat:I().optional().describe(`Auto-number display format pattern (e.g., "CASE-{0000}")`),index:R().default(!1).describe(`Create standard database index`),externalId:R().default(!1).describe(`Is external ID for upsert operations`)})),Kp=V({name:I().regex(/^[a-z_][a-z0-9_]*$/).describe(`Unique rule name (snake_case)`),label:I().optional().describe(`Human-readable label for the rule listing`),description:I().optional().describe(`Administrative notes explaining the business reason`),active:R().default(!0),events:B(W([`insert`,`update`,`delete`])).default([`insert`,`update`]).describe(`Validation contexts`),priority:L().int().min(0).max(9999).default(100).describe(`Execution priority (lower runs first, default: 100)`),tags:B(I()).optional().describe(`Categorization tags (e.g., "compliance", "billing")`),severity:W([`error`,`warning`,`info`]).default(`error`),message:I().describe(`Error message to display to the user`)}),qp=K(()=>Kp.extend({type:G(`script`),condition:Ap.describe("Predicate (CEL). If TRUE, validation fails. e.g. P`record.amount < 0`")})),Jp=K(()=>Kp.extend({type:G(`unique`),fields:B(I()).describe(`Fields that must be combined unique`),scope:Ap.optional().describe("Predicate (CEL) limiting uniqueness scope. e.g. P`record.active == true`"),caseSensitive:R().default(!0)})),Yp=K(()=>Kp.extend({type:G(`state_machine`),field:I().describe(`State field (e.g. status)`),transitions:U(I(),B(I())).describe(`Map of { OldState: [AllowedNewStates] }`)})),Xp=K(()=>Kp.extend({type:G(`format`),field:I(),regex:I().optional(),format:W([`email`,`url`,`phone`,`json`]).optional()})),Zp=K(()=>Kp.extend({type:G(`cross_field`),condition:Ap.describe("Predicate (CEL) comparing fields. e.g. P`record.end_date > record.start_date`"),fields:B(I()).describe(`Fields involved in the validation`)})),Qp=K(()=>Kp.extend({type:G(`json_schema`),field:I().describe(`JSON field to validate`),schema:U(I(),z()).describe(`JSON Schema object definition`)})),$p=K(()=>Kp.extend({type:G(`async`),field:I().describe(`Field to validate`),validatorUrl:I().optional().describe(`External API endpoint for validation`),method:W([`GET`,`POST`]).default(`GET`).describe(`HTTP method for external call`),headers:U(I(),I()).optional().describe(`Custom headers for the request`),validatorFunction:I().optional().describe(`Reference to custom validator function`),timeout:L().optional().default(5e3).describe(`Timeout in milliseconds`),debounce:L().optional().describe(`Debounce delay in milliseconds`),params:U(I(),z()).optional().describe(`Additional parameters to pass to validator`)})),em=K(()=>Kp.extend({type:G(`custom`),handler:I().describe(`Name of the custom validation function registered in the system`),params:U(I(),z()).optional().describe(`Parameters passed to the custom handler`)})),tm=Rf(()=>lf(`type`,[qp,Jp,Yp,Xp,Zp,Qp,$p,em,nm])),nm=K(()=>Kp.extend({type:G(`conditional`),when:Ap.describe("Predicate (CEL). e.g. P`record.type == 'enterprise'`"),then:tm.describe(`Validation rule to apply when condition is true`),otherwise:tm.optional().describe(`Validation rule to apply when condition is false`)}));K(()=>V({key:I().describe(`Translation key (e.g., "views.task_list.label")`),defaultValue:I().optional().describe(`Fallback value when translation key is not found`),params:U(I(),H([I(),L(),R()])).optional().describe(`Interpolation parameters (e.g., { count: 5 })`)}));var rm=K(()=>I().describe(`Display label (plain string; i18n keys are auto-generated by the framework)`)),im=K(()=>V({ariaLabel:rm.optional().describe(`Accessible label for screen readers (WAI-ARIA aria-label)`),ariaDescribedBy:I().optional().describe(`ID of element providing additional description (WAI-ARIA aria-describedby)`),role:I().optional().describe(`WAI-ARIA role attribute (e.g., "dialog", "navigation", "alert")`)}).describe(`ARIA accessibility attributes`));K(()=>V({key:I().describe(`Translation key`),zero:I().optional().describe(`Zero form (e.g., "No items")`),one:I().optional().describe(`Singular form (e.g., "{count} item")`),two:I().optional().describe(`Dual form (e.g., "{count} items" for exactly 2)`),few:I().optional().describe(`Few form (e.g., for 2-4 in some languages)`),many:I().optional().describe(`Many form (e.g., for 5+ in some languages)`),other:I().describe(`Default plural form (e.g., "{count} items")`)}).describe(`ICU plural rules for a translation key`));var am=K(()=>V({style:W([`decimal`,`currency`,`percent`,`unit`]).default(`decimal`).describe(`Number formatting style`),currency:I().optional().describe(`ISO 4217 currency code (e.g., "USD", "EUR")`),unit:I().optional().describe(`Unit for unit formatting (e.g., "kilometer", "liter")`),minimumFractionDigits:L().optional().describe(`Minimum number of fraction digits`),maximumFractionDigits:L().optional().describe(`Maximum number of fraction digits`),useGrouping:R().optional().describe(`Whether to use grouping separators (e.g., 1,000)`)}).describe(`Number formatting rules`)),om=K(()=>V({dateStyle:W([`full`,`long`,`medium`,`short`]).optional().describe(`Date display style`),timeStyle:W([`full`,`long`,`medium`,`short`]).optional().describe(`Time display style`),timeZone:I().optional().describe(`IANA time zone (e.g., "America/New_York")`),hour12:R().optional().describe(`Use 12-hour format`)}).describe(`Date/time formatting rules`));K(()=>V({code:I().describe(`BCP 47 language code (e.g., "en-US", "zh-CN")`),fallbackChain:B(I()).optional().describe(`Fallback language codes in priority order (e.g., ["zh-TW", "en"])`),direction:W([`ltr`,`rtl`]).default(`ltr`).describe(`Text direction: left-to-right or right-to-left`),numberFormat:am.optional().describe(`Default number formatting rules`),dateFormat:om.optional().describe(`Default date/time formatting rules`)}).describe(`Locale configuration`));var sm=W([`api.read`,`api.write`,`crypto.uuid`,`crypto.hash`,`log`]),cm=lf(`language`,[V({language:G(`expression`),source:I().min(1).describe(`Formula expression source`)}).describe(`L1 expression body — pure formula, no IO`),V({language:G(`js`),source:I().min(1).describe(`Function body source`),capabilities:B(sm).default([]).describe(`Granted capability tokens`),timeoutMs:L().int().positive().max(3e4).optional().describe(`Per-invocation timeout (ms)`),memoryMb:L().int().positive().max(256).optional().describe(`Per-invocation memory cap (MB)`)}).describe(`L2 sandboxed JS body — runs inside an isolated VM with declared capabilities`)]).describe(`Hook/Action body — expression (L1) or sandboxed JS (L2)`),lm=K(()=>V({name:I().optional(),field:Ep.optional(),objectOverride:Ep.optional(),label:rm.optional(),type:Rp.optional(),required:R().optional().default(!1),options:B(V({label:rm,value:I()})).optional(),placeholder:I().optional(),helpText:I().optional(),defaultValue:z().optional(),defaultFromRow:R().optional()}).refine(e=>!!e.name||!!e.field,{message:`ActionParam requires either "name" or "field"`})),um=W([`script`,`url`,`modal`,`flow`,`api`,`form`]),dm=new Set(um.options.filter(e=>e!==`script`)),fm=W([`list_toolbar`,`list_item`,`record_header`,`record_more`,`record_related`,`record_section`,`global_nav`]),pm=K(()=>V({name:Ep.describe(`Machine name (lowercase snake_case)`),label:rm.describe(`Display label`),objectName:I().regex(/^[a-z_][a-z0-9_]*$/).optional().describe(`Target object this action belongs to. When set, the action is auto-merged into the object's actions array by defineStack().`),icon:I().optional().describe(`Icon name`),locations:B(fm).optional().describe(`Locations where this action is visible`),component:W([`action:button`,`action:icon`,`action:menu`,`action:group`]).optional().describe(`Visual component override`),type:um.default(`script`).describe(`Action functionality type`),target:I().optional().describe("URL, Script Name, Flow ID, or API Endpoint. Supports ${param.X} and ${ctx.X} interpolation."),body:cm.optional().describe("Action body — expression (L1) or sandboxed JS (L2). Only used when type is `script`."),execute:I().optional().describe(`@deprecated — Use target instead. Auto-migrated to target during parsing.`),params:B(lm).optional().describe(`Input parameters required from user`),variant:W([`primary`,`secondary`,`danger`,`ghost`,`link`]).optional().describe(`Button visual variant for styling (primary = highlighted, danger = destructive, ghost = transparent)`),confirmText:rm.optional().describe(`Confirmation message before execution`),successMessage:rm.optional().describe(`Success message to show after execution`),refreshAfter:R().default(!1).describe(`Refresh view after execution`),resultDialog:V({title:rm.optional(),description:rm.optional(),acknowledge:rm.optional().describe(`Acknowledge button label, e.g. "I have saved this"`),format:W([`qrcode`,`code-list`,`secret`,`text`,`json`]).optional().describe(`Default format for fields without their own format. Defaults to json when omitted.`),fields:B(V({path:I().describe(`Dot path into result.data (e.g. "totpURI", "client.client_secret").`),label:rm.optional(),format:W([`qrcode`,`code-list`,`secret`,`text`,`json`]).optional().describe(`Per-field format override.`)})).optional().describe(`Which fields from result.data to render. Omit to dump full JSON.`)}).optional().describe(`Render API response in a one-shot reveal dialog (suppresses successMessage when set).`),visible:Ap.optional().describe(`Visibility predicate (CEL).`),disabled:H([R(),Ap]).optional().describe(`Boolean or predicate (CEL) — action is disabled when TRUE.`),shortcut:I().optional().describe(`Keyboard shortcut to trigger this action (e.g., "Ctrl+S")`),bulkEnabled:R().optional().describe(`Whether this action can be applied to multiple selected records`),aiExposed:R().optional().describe(`Set to false to keep this action out of the AI tool registry.`),recordIdParam:I().optional().describe(`Body key to inject the row id into when running from a list_item context.`),recordIdField:I().optional().describe(`Row field whose value seeds recordIdParam. Defaults to "id".`),bodyShape:H([G(`flat`),V({wrap:I()})]).optional().describe(`Body wrapping: flat (default) or { wrap: key } to nest user-collected params under a key.`),method:W([`POST`,`PATCH`,`PUT`,`DELETE`]).optional().describe(`HTTP method for type:"api" actions. Defaults to POST.`),bodyExtra:U(I(),z()).optional().describe(`Constant body fields merged into the API request (applied last; overrides user params).`),mode:W([`create`,`edit`,`delete`,`custom`]).optional().describe(`Semantic mode of the action.`),timeout:L().optional().describe(`Maximum execution time in milliseconds for the action`),aria:im.optional().describe(`ARIA accessibility attributes`)}).transform(e=>e.execute&&!e.target?{...e,target:e.execute}:e).refine(e=>!(dm.has(e.type)&&!e.target),{message:`Action 'target' is required when type is 'url', 'flow', 'modal', 'api', or 'form'.`,path:[`target`]})),mm=W([`none`,`no-overlay`,`no-delete`,`full`]),hm=W([`artifact`,`package`,`env-forced`]),gm=W([`package`,`org`,`env-forced`]),_m={_lock:mm.optional().describe(`Item-level lock — controls overlay & delete (ADR-0010).`),_lockReason:I().max(500).optional().describe(`Human-readable reason shown when a write is refused by _lock.`),_lockSource:hm.optional().describe(`Layer that set _lock (artifact | package | env-forced).`),_provenance:gm.optional().describe(`Origin of the item (package | org | env-forced).`),_packageId:I().optional().describe(`Owning package machine id.`),_packageVersion:I().optional().describe(`Owning package version.`),_lockDocsUrl:I().optional().describe(`Optional documentation link surfaced next to _lockReason.`)},vm=V({lock:mm.describe(`Lock policy — none | no-overlay | no-delete | full.`),reason:I().min(1).max(500).describe(`User-visible reason shown when the lock blocks an action.`),docsUrl:I().url().optional().describe(`Optional URL the Studio banner links to for more context.`)}).strict(),ym=K(()=>V({enabled:R().default(!1).describe(`Enable public sharing`),publicLink:I().optional().describe(`Generated public share URL`),password:I().optional().describe(`Password required to access shared link`),allowedDomains:B(I()).optional().describe(`Restrict access to specific email domains (e.g. ["example.com"])`),expiresAt:I().optional().describe(`Expiration date/time in ISO 8601 format`),allowAnonymous:R().optional().default(!1).describe(`Allow access without authentication`)}));K(()=>V({enabled:R().default(!1).describe(`Enable iframe embedding`),allowedOrigins:B(I()).optional().describe(`Allowed iframe parent origins (e.g. ["https://example.com"])`),width:I().optional().default(`100%`).describe(`Embed width (CSS value)`),height:I().optional().default(`600px`).describe(`Embed height (CSS value)`),showHeader:R().optional().default(!0).describe(`Show interface header in embed`),showNavigation:R().optional().default(!1).describe(`Show navigation in embed`),responsive:R().optional().default(!0).describe(`Enable responsive resizing`)}));var bm=W([`xs`,`sm`,`md`,`lg`,`xl`,`2xl`]),xm=K(()=>V({xs:L().min(1).max(12).optional(),sm:L().min(1).max(12).optional(),md:L().min(1).max(12).optional(),lg:L().min(1).max(12).optional(),xl:L().min(1).max(12).optional(),"2xl":L().min(1).max(12).optional()}).describe(`Grid columns per breakpoint (1-12)`)),Sm=K(()=>V({xs:L().optional(),sm:L().optional(),md:L().optional(),lg:L().optional(),xl:L().optional(),"2xl":L().optional()}).describe(`Display order per breakpoint`)),Cm=K(()=>V({breakpoint:bm.optional().describe(`Minimum breakpoint for visibility`),hiddenOn:B(bm).optional().describe(`Hide on these breakpoints`),columns:xm.optional().describe(`Grid columns per breakpoint`),order:Sm.optional().describe(`Display order per breakpoint`)}).describe(`Responsive layout configuration`)),wm=K(()=>V({lazyLoad:R().optional().describe(`Enable lazy loading (defer rendering until visible)`),virtualScroll:V({enabled:R().default(!1).describe(`Enable virtual scrolling`),itemHeight:L().optional().describe(`Fixed item height in pixels (for estimation)`),overscan:L().optional().describe(`Number of extra items to render outside viewport`)}).optional().describe(`Virtual scrolling configuration`),cacheStrategy:W([`none`,`cache-first`,`network-first`,`stale-while-revalidate`]).optional().describe(`Client-side data caching strategy`),prefetch:R().optional().describe(`Prefetch data before component is visible`),pageSize:L().optional().describe(`Number of items per page for pagination`),debounceMs:L().optional().describe(`Debounce interval for user interactions in milliseconds`)}).describe(`Performance optimization configuration`)),Tm=W([`GET`,`POST`,`PUT`,`DELETE`,`PATCH`,`HEAD`,`OPTIONS`]),Em=K(()=>W([`GET`,`POST`,`PUT`,`PATCH`,`DELETE`])),Dm=K(()=>V({url:I().describe(`API endpoint URL`),method:Em.optional().default(`GET`).describe(`HTTP method`),headers:U(I(),I()).optional().describe(`Custom HTTP headers`),params:U(I(),z()).optional().describe(`Query parameters`),body:z().optional().describe(`Request body for POST/PUT/PATCH`)}));K(()=>V({enabled:R().default(!0).describe(`Enable CORS`),origins:H([I(),B(I())]).default(`*`).describe(`Allowed origins (* for all)`),methods:B(Tm).optional().describe(`Allowed HTTP methods`),credentials:R().default(!1).describe(`Allow credentials (cookies, authorization headers)`),maxAge:L().int().optional().describe(`Preflight cache duration in seconds`)})),K(()=>V({enabled:R().default(!1).describe(`Enable rate limiting`),windowMs:L().int().default(6e4).describe(`Time window in milliseconds`),maxRequests:L().int().default(100).describe(`Max requests per window`)})),K(()=>V({path:I().describe(`URL path to serve from`),directory:I().describe(`Physical directory to serve`),cacheControl:I().optional().describe(`Cache-Control header value`)}));var Om=K(()=>lf(`provider`,[V({provider:G(`object`),object:I().describe(`Target object name`)}),V({provider:G(`api`),read:Dm.optional().describe(`Configuration for fetching data`),write:Dm.optional().describe(`Configuration for submitting data (for forms/editable tables)`)}),V({provider:G(`value`),items:B(z()).describe(`Static data array`)}),V({provider:G(`schema`),schemaId:I().describe(`Schema identifier — typically the metadata type name`),schema:U(I(),z()).optional().describe(`Inline JSON Schema (Draft 2020-12). Optional when schemaId is resolvable.`)})])),km=K(()=>V({field:I().describe(`Field name to filter on`),operator:I().describe(`Filter operator (e.g. equals, not_equals, contains, this_quarter)`),value:H([I(),L(),R(),Jd(),B(H([I(),L()]))]).optional().describe(`Filter value`)}).describe(`View filter rule`)),Am=K(()=>W([`none`,`count`,`count_empty`,`count_filled`,`count_unique`,`percent_empty`,`percent_filled`,`sum`,`avg`,`min`,`max`]).describe(`Aggregation function for column footer summary`)),jm=K(()=>V({field:I().describe(`Field name (snake_case)`),label:rm.optional().describe(`Display label override`),width:L().positive().optional().describe(`Column width in pixels`),align:W([`left`,`center`,`right`]).optional().describe(`Text alignment`),hidden:R().optional().describe(`Hide column by default`),sortable:R().optional().describe(`Allow sorting by this column`),resizable:R().optional().describe(`Allow resizing this column`),wrap:R().optional().describe(`Allow text wrapping`),type:I().optional().describe(`Renderer type override (e.g., "currency", "date")`),pinned:W([`left`,`right`]).optional().describe(`Pin/freeze column to left or right side`),summary:Am.optional().describe(`Footer aggregation function for this column`),link:R().optional().describe(`Functions as the primary navigation link (triggers View navigation)`),action:I().optional().describe(`Registered Action ID to execute when clicked`)})),Mm=K(()=>V({type:W([`none`,`single`,`multiple`]).default(`none`).describe(`Selection mode`)})),Nm=K(()=>V({pageSize:L().int().positive().default(25).describe(`Number of records per page`),pageSizeOptions:B(L().int().positive()).optional().describe(`Available page size options`)})),Pm=K(()=>W([`compact`,`short`,`medium`,`tall`,`extra_tall`]).describe(`Row height / density setting for list view`)),Fm=K(()=>V({field:I().describe(`Field name to group by`),order:W([`asc`,`desc`]).default(`asc`).describe(`Group sort order`),collapsed:R().default(!1).describe(`Collapse groups by default`)})),Im=K(()=>V({fields:B(Fm).min(1).describe(`Fields to group by (supports up to 3 levels)`)}).describe(`Record grouping configuration`)),Lm=K(()=>V({coverField:I().optional().describe(`Attachment/image field to display as card cover`),coverFit:W([`cover`,`contain`]).default(`cover`).describe(`Image fit mode for card cover`),cardSize:W([`small`,`medium`,`large`]).default(`medium`).describe(`Card size in gallery view`),titleField:I().optional().describe(`Field to display as card title`),visibleFields:B(I()).optional().describe(`Fields to display on card body`)}).describe(`Gallery/card view configuration`)),Rm=K(()=>V({startDateField:I().describe(`Field for timeline item start date`),endDateField:I().optional().describe(`Field for timeline item end date`),titleField:I().describe(`Field to display as timeline item title`),groupByField:I().optional().describe(`Field to group timeline rows`),colorField:I().optional().describe(`Field to determine item color`),scale:W([`hour`,`day`,`week`,`month`,`quarter`,`year`]).default(`week`).describe(`Default timeline scale`)}).describe(`Timeline view configuration`)),zm=K(()=>V({type:W([`personal`,`collaborative`]).default(`collaborative`).describe(`View ownership type`),lockedBy:I().optional().describe(`User who locked the view configuration`)}).describe(`View sharing and access configuration`)),Bm=K(()=>V({field:I().describe(`Field to derive color from (typically a select/status field)`),colors:U(I(),I()).optional().describe(`Map of field value to color (hex/token)`)}).describe(`Row color configuration based on field values`)),Vm=K(()=>W([`grid`,`kanban`,`gallery`,`calendar`,`timeline`,`gantt`,`map`]).describe(`Visualization type that users can switch to`)),Hm=K(()=>V({sort:R().default(!0).describe(`Allow users to sort records`),search:R().default(!0).describe(`Allow users to search records`),filter:R().default(!0).describe(`Allow users to filter records`),rowHeight:R().default(!0).describe(`Allow users to toggle row height/density`),addRecordForm:R().default(!1).describe(`Add records through a form instead of inline`),buttons:B(I()).optional().describe(`Custom action button IDs to show in the toolbar`)}).describe(`User action toggles for the view toolbar`)),Um=K(()=>V({showDescription:R().default(!0).describe(`Show the view description text`),allowedVisualizations:B(Vm).optional().describe(`Whitelist of visualization types users can switch between (e.g. ["grid", "gallery", "kanban"])`)}).describe(`Appearance and visualization configuration`)),Wm=K(()=>V({name:Ep.describe(`Tab identifier (snake_case)`),label:rm.optional().describe(`Display label`),icon:I().optional().describe(`Tab icon name`),view:I().optional().describe(`Referenced list view name from listViews`),filter:B(km).optional().describe(`Tab-specific filter criteria`),order:L().int().min(0).optional().describe(`Tab display order`),pinned:R().default(!1).describe(`Pin tab (cannot be removed by users)`),isDefault:R().default(!1).describe(`Set as the default active tab`),visible:R().default(!0).describe(`Tab visibility`)}).describe(`Tab configuration for multi-tab view interface`)),Gm=K(()=>V({enabled:R().default(!0).describe(`Show the add record entry point`),position:W([`top`,`bottom`,`both`]).default(`bottom`).describe(`Position of the add record button`),mode:W([`inline`,`form`,`modal`]).default(`inline`).describe(`How to add a new record`),formView:I().optional().describe(`Named form view to use when mode is "form" or "modal"`)}).describe(`Add record entry point configuration`)),Km=K(()=>V({groupByField:I().describe(`Field to group columns by (usually status/select)`),summarizeField:I().optional().describe(`Field to sum at top of column (e.g. amount)`),columns:B(I()).describe(`Fields to show on cards`)})),qm=K(()=>V({chartType:W([`bar`,`line`,`pie`,`area`,`scatter`]).default(`bar`).describe(`Chart visualisation type`),xAxisField:I().describe(`Field used as the X axis / category dimension`),yAxisFields:B(I()).min(1).describe(`Field(s) used as the Y axis / measures`),aggregation:W([`sum`,`avg`,`count`,`min`,`max`]).optional().describe(`Aggregation function applied to Y axis fields`),groupByField:I().optional().describe(`Optional field used to split / stack the chart`)}).describe(`List chart view configuration`)),Jm=K(()=>V({startDateField:I(),endDateField:I().optional(),titleField:I(),colorField:I().optional()})),Ym=K(()=>V({startDateField:I(),endDateField:I(),titleField:I(),progressField:I().optional(),dependenciesField:I().optional()})),Xm=K(()=>W([`page`,`drawer`,`modal`,`split`,`popover`,`new_window`,`none`])),Zm=K(()=>V({mode:Xm.default(`page`),view:I().optional().describe(`Name of the form view to use for details (e.g. "summary_view", "edit_form")`),preventNavigation:R().default(!1).describe(`Disable standard navigation entirely`),openNewTab:R().default(!1).describe(`Force open in new tab (applies to page mode)`),width:H([I(),L()]).optional().describe(`Width of the drawer/modal (e.g. "600px", "50%")`)})),Qm=K(()=>V({name:Ep.optional().describe(`Internal view name (lowercase snake_case)`),label:rm.optional(),type:W([`grid`,`kanban`,`gallery`,`calendar`,`timeline`,`gantt`,`map`,`chart`]).default(`grid`),data:Om.optional().describe(`Data source configuration (defaults to "object" provider)`),columns:H([B(I()),B(jm)]).describe(`Fields to display as columns`),filter:B(km).optional().describe(`Filter criteria (JSON Rules)`),sort:H([I(),B(V({field:I(),order:W([`asc`,`desc`])}))]).optional(),searchableFields:B(I()).optional().describe(`Fields enabled for search`),filterableFields:B(I()).optional().describe(`Fields enabled for end-user filtering in the top bar`),resizable:R().optional().describe(`Enable column resizing`),striped:R().optional().describe(`Striped row styling`),bordered:R().optional().describe(`Show borders`),compactToolbar:R().optional().describe(`Collapse Group/Color/Density/Hide-fields into a single View settings popover`),selection:Mm.optional().describe(`Row selection configuration`),navigation:Zm.optional().describe(`Configuration for item click navigation (page, drawer, modal, etc.)`),pagination:Nm.optional().describe(`Pagination configuration`),kanban:Km.optional(),calendar:Jm.optional(),gantt:Ym.optional(),gallery:Lm.optional(),timeline:Rm.optional(),chart:qm.optional(),description:rm.optional().describe(`View description for documentation/tooltips`),sharing:zm.optional().describe(`View sharing and access configuration`),rowHeight:Pm.optional().describe(`Row height / density setting`),grouping:Im.optional().describe(`Group records by one or more fields`),rowColor:Bm.optional().describe(`Color rows based on field value`),hiddenFields:B(I()).optional().describe(`Fields to hide in this specific view`),fieldOrder:B(I()).optional().describe(`Explicit field display order for this view`),rowActions:B(I()).optional().describe(`Actions available for individual row items`),bulkActions:B(I()).optional().describe(`Actions available when multiple rows are selected`),bulkActionDefs:B(U(I(),Xd())).optional().describe(`Rich bulk action definitions (schema-driven, executed via BulkActionDialog)`),virtualScroll:R().optional().describe(`Enable virtual scrolling for large datasets`),conditionalFormatting:B(V({condition:Ap.describe(`Predicate (CEL) to evaluate.`),style:U(I(),I()).describe(`CSS styles to apply when condition is true`)})).optional().describe(`Conditional formatting rules for list rows`),inlineEdit:R().optional().describe(`Allow inline editing of records directly in the list view`),exportOptions:B(W([`csv`,`xlsx`,`pdf`,`json`])).optional().describe(`Available export format options`),userActions:Hm.optional().describe(`User action toggles for the view toolbar`),appearance:Um.optional().describe(`Appearance and visualization configuration`),tabs:B(Wm).optional().describe(`Tab definitions for multi-tab view interface`),addRecord:Gm.optional().describe(`Add record entry point configuration`),showRecordCount:R().optional().describe(`Show record count at the bottom of the list`),allowPrinting:R().optional().describe(`Allow users to print the view`),emptyState:V({title:rm.optional(),message:rm.optional(),icon:I().optional()}).optional().describe(`Empty state configuration when no records found`),aria:im.optional().describe(`ARIA accessibility attributes for the list view`),responsive:Cm.optional().describe(`Responsive layout configuration`),performance:wm.optional().describe(`Performance optimization settings`)})),$m=K(()=>V({field:I().describe(`Field name (snake_case)`),type:Rp.optional().describe(`Field type (auto-infers widget if omitted)`),options:B(zp).optional().describe(`Options for select/multiselect/radio/checkboxes fields`),reference:I().optional().describe(`Target object name for lookup/master_detail fields`),maxLength:L().optional().describe(`Maximum character length (for text/textarea/email/url/phone)`),minLength:L().optional().describe(`Minimum character length`),min:L().optional().describe(`Minimum value (for number/currency/percent/slider)`),max:L().optional().describe(`Maximum value`),precision:L().optional().describe(`Total digits (for number/currency)`),scale:L().optional().describe(`Decimal places`),multiple:R().optional().describe(`Allow multiple values (for select/lookup/file/image)`),label:rm.optional().describe(`Display label override`),placeholder:rm.optional().describe(`Placeholder text`),helpText:rm.optional().describe(`Help/hint text`),readonly:R().optional().describe(`Read-only override`),immutable:R().optional().describe(`Editable on create, locked once the record exists (e.g. machine names).`),required:R().optional().describe(`Required override`),hidden:R().optional().describe(`Hidden override`),colSpan:L().int().min(1).max(4).optional().describe(`Column span in grid layout (1-4)`),widget:I().optional().describe(`Custom widget/component name (overrides type-based inference)`),language:I().optional().describe(`Code editor language (for type=code)`),fields:B(Rf(()=>$m)).optional().describe(`Sub-fields for composite/repeater/record types`),keyField:V({field:I().default(`name`).describe(`Property name that holds the key inside each item (defaults to "name")`),label:rm.optional().describe(`Display label for the key column`),placeholder:rm.optional().describe(`Placeholder when entering a new key`),helpText:rm.optional().describe(`Help text under the key input`),regex:I().optional().describe(`JS regex source string the key must match (no flags)`),immutable:R().default(!0).describe(`If true, the key is read-only after creation`)}).optional().describe(`Key column config for record-typed fields`),dependsOn:I().optional().describe(`Parent field name for cascading`),visibleOn:Ap.optional().describe(`Visibility predicate (CEL).`)})),eh=K(()=>V({name:I().optional().describe(`Stable section identifier for i18n lookup (snake_case)`),label:rm.optional(),description:I().optional().describe(`Optional description rendered under the section header.`),collapsible:R().default(!1),collapsed:R().default(!1),visibleOn:Ap.optional().describe(`Visibility predicate (CEL). Hides the whole section when false.`),columns:H([W([`1`,`2`,`3`,`4`]),G(1),G(2),G(3),G(4)]).default(1).transform(e=>typeof e==`string`?parseInt(e):e),fields:B(H([I(),$m]))})),th=K(()=>V({type:W([`simple`,`tabbed`,`wizard`,`split`,`drawer`,`modal`]).default(`simple`),data:Om.optional().describe(`Data source configuration (defaults to "object" provider)`),sections:B(eh).optional(),groups:B(eh).optional(),defaultSort:B(V({field:I().describe(`Field name to sort by`),order:W([`asc`,`desc`]).default(`desc`).describe(`Sort direction`)})).optional().describe(`Default sort order for related list views within this form`),sharing:ym.optional().describe(`Public sharing configuration for this form`),submitBehavior:H([V({kind:G(`thank-you`),title:I().optional(),message:I().optional()}),V({kind:G(`redirect`),url:I(),delayMs:L().int().min(0).optional()}),V({kind:G(`continue`)}),V({kind:G(`next-record`)})]).optional().describe(`Post-submit behavior`),aria:im.optional().describe(`ARIA accessibility attributes for the form view`)}));K(()=>V({list:Qm.optional(),form:th.optional(),listViews:U(I(),Qm).optional().describe(`Additional named list views`),formViews:U(I(),th).optional().describe(`Additional named form views`),protection:vm.optional().describe(`Package author protection block — lock policy for this view.`),..._m}));var nh=I().regex(/^[a-z][a-z0-9_]*(\.[a-z][a-z0-9_]*)+$/,`View item name must be a dotted snake_case qualified name, e.g. "crm_lead.pipeline".`).describe("Globally-unique view id, `<object>.<viewKey>`."),rh=W([`package`,`shared`,`personal`]).describe(`View identity layer: package | shared | personal.`);W([`list`,`form`]).describe("Whether `config` is a ListView (list family) or a FormView.");function ih(){return{name:nh,object:I().describe(`Bound object name — the foreign key used to aggregate views.`),label:rm.optional().describe(`Display label (supports i18n).`),isDefault:R().optional().describe(`Whether this is the object's default view in the switcher.`),order:L().int().optional().describe(`Sort order within the object's view switcher / left rail.`),scope:rh.optional().describe("Identity layer (defaults to `package` for source-loaded views)."),owner:I().optional().describe("Owner user id — set when `scope` is `personal`."),hidden:R().optional().describe(`Hidden from the switcher (per-user / per-org declutter).`),protection:vm.optional().describe(`Package author protection block — lock policy for this view.`),..._m}}K(()=>lf(`viewKind`,[V({viewKind:G(`list`),config:Qm.describe(`List-family view configuration.`),...ih()}),V({viewKind:G(`form`),config:th.describe(`Form view configuration.`),...ih()})]));function ah(e){let{schemaId:t,...n}=e;return th.parse({...n,data:{provider:`schema`,schemaId:t}})}var oh=W([`get`,`list`,`create`,`update`,`delete`,`upsert`,`bulk`,`aggregate`,`history`,`search`,`restore`,`purge`,`import`,`export`]),sh=V({trackHistory:R().default(!1).describe(`Enable field history tracking for audit compliance`),searchable:R().default(!0).describe(`Index records for global search`),apiEnabled:R().default(!0).describe(`Expose object via automatic APIs`),apiMethods:B(oh).optional().describe(`Whitelist of allowed API operations`),files:R().default(!1).describe(`Enable file attachments and document management`),feeds:R().default(!1).describe(`Enable social feed, comments, and mentions (Chatter-like)`),activities:R().default(!1).describe(`Enable standard tasks and events tracking`),trash:R().default(!0).describe(`Enable soft-delete with restore capability`),mru:R().default(!0).describe(`Track Most Recently Used (MRU) list for users`),clone:R().default(!0).describe(`Allow record deep cloning`)}),ch=K(()=>V({name:I().optional().describe(`Index name (auto-generated if not provided)`),fields:B(I()).describe(`Fields included in the index`),type:W([`btree`,`hash`,`gin`,`gist`,`fulltext`]).optional().default(`btree`).describe(`Index algorithm type`),unique:R().optional().default(!1).describe(`Whether the index enforces uniqueness`),partial:I().optional().describe(`Partial index condition (SQL WHERE clause for conditional indexes)`)})),lh=K(()=>V({fields:B(I()).describe(`Fields to index for full-text search weighting`),displayFields:B(I()).optional().describe(`Fields to display in search result cards`),filters:B(I()).optional().describe(`Default filters for search results`)})),uh=K(()=>V({enabled:R().describe(`Enable multi-tenancy for this object`),strategy:W([`shared`,`isolated`,`hybrid`]).describe(`Tenant isolation strategy: shared (single DB, row-level), isolated (separate DB per tenant), hybrid (mix)`),tenantField:I().default(`tenant_id`).describe(`Field name for tenant identifier`),crossTenantAccess:R().default(!1).describe(`Allow cross-tenant data access (with explicit permission)`)})),dh=K(()=>V({enabled:R().describe(`Enable soft delete (trash/recycle bin)`),field:I().default(`deleted_at`).describe(`Field name for soft delete timestamp`),cascadeDelete:R().default(!1).describe(`Cascade soft delete to related records`)})),fh=K(()=>V({enabled:R().describe(`Enable record versioning`),strategy:W([`snapshot`,`delta`,`event-sourcing`]).describe(`Versioning strategy: snapshot (full copy), delta (changes only), event-sourcing (event log)`),retentionDays:L().min(1).optional().describe(`Number of days to retain old versions (undefined = infinite)`),versionField:I().default(`version`).describe(`Field name for version number/timestamp`)})),ph=K(()=>V({enabled:R().describe(`Enable table partitioning`),strategy:W([`range`,`hash`,`list`]).describe(`Partitioning strategy: range (date ranges), hash (consistent hashing), list (predefined values)`),key:I().describe(`Field name to partition by`),interval:I().optional().describe(`Partition interval for range strategy (e.g., "1 month", "1 year")`)}).refine(e=>!(e.strategy===`range`&&!e.interval),{message:`interval is required when strategy is "range"`})),mh=K(()=>V({enabled:R().describe(`Enable Change Data Capture`),events:B(W([`insert`,`update`,`delete`])).describe(`Event types to capture`),destination:I().describe(`Destination endpoint (e.g., "kafka://topic", "webhook://url")`)})),hh=K(()=>V({key:I().regex(/^[a-z_][a-z0-9_]*$/,{message:`Field group key must be lowercase snake_case (e.g., "contact_info", "billing", "system")`}).describe(`Group machine key (snake_case). Referenced by Field.group.`),label:I().describe(`Group display label`),icon:I().optional().describe(`Icon name (Lucide/Material) for the group header`),description:I().optional().describe(`Optional description shown under the group header`),defaultExpanded:R().optional().default(!0).describe(`Whether the group is expanded by default`),visibleOn:Ap.optional().describe(`Visibility predicate (CEL); group is hidden when FALSE.`)})),gh=V({remoteName:I().optional().describe(`Remote table/view name. Defaults to object.name.`),remoteSchema:I().optional().describe(`Remote schema/database qualifier.`),writable:R().default(!1).describe(`Per-object write opt-in (also requires datasource.external.allowWrites).`),columnMap:U(I(),I()).optional().describe(`Remote column name → local field name.`),introspectedAt:I().datetime().optional().describe("Set by `os datasource introspect`; informational."),ignoreColumns:B(I()).optional().describe(`Remote columns to skip during validation (dev convenience).`)}).describe(`External datasource binding (ADR-0015)`),_h=V({name:I().regex(/^[a-z_][a-z0-9_]*$/).describe(`Machine unique key (snake_case). Immutable.`),label:I().optional().describe(`Human readable singular label (e.g. "Account")`),pluralLabel:I().optional().describe(`Human readable plural label (e.g. "Accounts")`),description:I().optional().describe(`Developer documentation / description`),icon:I().optional().describe(`Icon name (Lucide/Material) for UI representation`),tags:B(I()).optional().describe(`Categorization tags (e.g. "sales", "system", "reference")`),active:R().optional().default(!0).describe(`Is the object active and usable`),isSystem:R().optional().default(!1).describe(`Is system object (protected from deletion)`),abstract:R().optional().default(!1).describe(`Is abstract base object (cannot be instantiated)`),managedBy:W([`platform`,`config`,`system`,`append-only`,`better-auth`]).optional().describe(`Lifecycle bucket — platform (user CRUD) | config (admin authored) | system (engine-managed) | append-only (audit) | better-auth (identity). UI clients honour the resolved affordance matrix.`),userActions:V({create:R().optional().describe(`Show generic "New" button.`),import:R().optional().describe(`Show CSV import wizard entry.`),edit:R().optional().describe(`Allow inline / form edit of existing rows.`),delete:R().optional().describe(`Show row-level delete + bulk delete.`),exportCsv:R().optional().describe(`Show CSV export entry.`)}).optional().describe(`Per-object override of the resolved CRUD affordance matrix.`),systemFields:H([G(!1),V({tenant:R().optional().describe(`Inject organization_id (multi-tenant only). Default true.`),owner:R().optional().describe(`Reserved for future owner_id auto-injection.`),audit:R().optional().describe(`Reserved for future created_by/updated_by auto-injection.`)})]).optional().describe(`Opt out of, or selectively disable, registry-level system-field auto-injection.`),datasource:I().optional().default(`default`).describe(`Target Datasource ID. "default" is the primary DB.`),external:gh.optional().describe(`Remote table binding for federated (external) objects.`),fields:U(I().regex(/^[a-z_][a-z0-9_]*$/,{message:`Field names must be lowercase snake_case (e.g., "first_name", "company", "annual_revenue")`}),Gp).describe(`Field definitions map. Keys must be snake_case identifiers.`),indexes:B(ch).optional().describe(`Database performance indexes`),fieldGroups:B(hh).refine(e=>new Set(e.map(e=>e.key)).size===e.length,{message:`fieldGroups[].key must be unique within an object`}).optional().describe(`Ordered list of field groups (array order = display order). See ObjectFieldGroupSchema.`),tenancy:uh.optional().describe(`Multi-tenancy configuration for SaaS applications`),softDelete:dh.optional().describe(`Soft delete (trash/recycle bin) configuration`),versioning:fh.optional().describe(`Record versioning and history tracking configuration`),partitioning:ph.optional().describe(`Table partitioning configuration for performance`),cdc:mh.optional().describe(`Change Data Capture (CDC) configuration for real-time data streaming`),validations:B(tm).optional().describe(`Object-level validation rules`),displayNameField:I().optional().describe(`Field to use as the record display name (e.g., "name", "title"). Defaults to "name" if present.`),recordName:V({type:W([`text`,`autonumber`]).describe(`Record name type: text (user-entered) or autonumber (system-generated)`),displayFormat:I().optional().describe(`Auto-number format pattern (e.g., "CASE-{0000}", "INV-{YYYY}-{0000}")`),startNumber:L().int().min(0).optional().describe(`Starting number for autonumber (default: 1)`)}).optional().describe(`Record name generation configuration (Salesforce pattern)`),titleFormat:jp.optional().describe(`Title template — supports {{record.field}} interpolation. Overrides displayNameField.`),compactLayout:B(I()).optional().describe(`Primary fields for hover/cards/lookups`),listViews:U(I(),Qm).optional().describe(`Built-in named list views (segmented tabs) shipped with the object schema`),defaultDetailForm:I().optional().describe(`Name of the default FormView for record detail / edit screens`),search:lh.optional().describe(`Search engine configuration`),enable:sh.optional().describe(`Enabled system features modules`),recordTypes:B(I()).optional().describe(`Record type names for this object`),sharingModel:W([`private`,`read`,`read_write`,`full`]).optional().describe(`Default sharing model`),publicSharing:V({enabled:R().default(!1).describe(`Allow records of this object to be published via share link`),allowedAudiences:B(W([`public`,`link_only`,`signed_in`,`email`])).optional().describe(`Audiences callers may select when creating a link`),allowedPermissions:B(W([`view`,`comment`,`edit`])).optional().describe(`Permission levels selectable on the share dialog`),maxExpiryDays:L().int().positive().optional().describe(`Reject links with expiry beyond this many days`),redactFields:B(I()).optional().describe(`Field names removed from records served via a share token`),eligibility:I().optional().describe(`CEL expression that must evaluate to true on the target record`)}).optional().describe(`Public share-link policy (Notion/Figma-style link sharing)`),keyPrefix:I().max(5).optional().describe(`Short prefix for record IDs (e.g., "001" for Account)`),detail:V({renderViaSchema:R().optional().describe(`Opt this object out of the schema-driven detail renderer`),hideReferenceRail:R().optional().describe(`Suppress the right-hand reference-rail on the detail page`),hideRelatedTab:R().optional().describe(`Suppress the Related tab on the detail page`)}).passthrough().optional().describe(`Detail-page UI hints consumed by @object-ui/plugin-detail synth`),actions:B(pm).optional().describe(`Actions associated with this object (auto-populated from top-level actions via objectName)`),protection:vm.optional().describe(`Package author protection block — lock policy for this object.`),..._m});function vh(e){return e.split(`_`).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}K(()=>Object.assign(_h,{create:e=>{let t={...e,label:e.label??vh(e.name)};return _h.parse(t)}})),W([`own`,`extend`]),K(()=>V({extend:I().describe(`Target object name (FQN) to extend`),fields:U(I(),Gp).optional().describe(`Fields to add/override`),label:I().optional().describe(`Override label for the extended object`),pluralLabel:I().optional().describe(`Override plural label for the extended object`),description:I().optional().describe(`Override description for the extended object`),validations:B(tm).optional().describe(`Additional validation rules to merge into the target object`),indexes:B(ch).optional().describe(`Additional indexes to merge into the target object`),priority:L().int().min(0).max(999).default(200).describe(`Merge priority (higher = applied later)`)}));var yh=W([`beforeFind`,`afterFind`,`beforeFindOne`,`afterFindOne`,`beforeCount`,`afterCount`,`beforeAggregate`,`afterAggregate`,`beforeInsert`,`afterInsert`,`beforeUpdate`,`afterUpdate`,`beforeDelete`,`afterDelete`,`beforeUpdateMany`,`afterUpdateMany`,`beforeDeleteMany`,`afterDeleteMany`]);K(()=>V({name:I().regex(/^[a-z_][a-z0-9_]*$/).describe(`Hook unique name (snake_case)`),label:I().optional().describe(`Description of what this hook does`),object:H([I(),B(I())]).describe(`Target object(s)`),events:B(yh).describe(`Lifecycle events`),handler:H([I(),Wf(e=>typeof e==`function`,{message:`Expected function`})]).optional().describe("Handler function name (string, post-build) or inline function (pre-build) — DEPRECATED, prefer `body`"),body:cm.optional().describe(`Hook body — expression (L1) or sandboxed JS (L2)`),priority:L().default(100).describe(`Execution priority`),async:R().default(!1).describe(`Run specifically as fire-and-forget`),condition:Ap.optional().describe('Predicate (CEL); hook runs only when TRUE. e.g. P`record.status == "closed" && record.amount > 1000`'),description:I().optional().describe(`Human-readable description of what this hook does`),retryPolicy:V({maxRetries:L().default(3).describe(`Maximum retry attempts on failure`),backoffMs:L().default(1e3).describe(`Backoff delay between retries in milliseconds`)}).optional().describe(`Retry policy for failed hook executions`),timeout:L().optional().describe(`Maximum execution time in milliseconds before the hook is aborted`),onError:W([`abort`,`log`]).default(`abort`).describe(`Error handling strategy`)})),K(()=>V({id:I().optional().describe(`Unique execution ID for tracing`),object:I(),event:yh,input:U(I(),z()).describe(`Mutable input parameters`),result:z().optional().describe(`Operation result (After hooks only)`),previous:U(I(),z()).optional().describe(`Record state before operation`),session:V({userId:I().optional(),tenantId:I().optional(),roles:B(I()).optional(),accessToken:I().optional(),isSystem:R().optional().describe(`True when the call was made with an elevated system context (engine self-writes)`)}).optional().describe(`Current session context`),transaction:z().optional().describe(`Database transaction handle`),ql:z().describe(`ObjectQL Engine Reference`),api:z().optional().describe(`Cross-object data access (ScopedContext)`),user:V({id:I().optional(),name:I().optional(),email:I().optional()}).optional().describe(`Current user info shortcut`)}));var bh=W([`none`,`constant`,`lookup`,`split`,`join`,`javascript`,`map`]),xh=K(()=>V({source:H([I(),B(I())]).describe(`Source column header(s)`),target:H([I(),B(I())]).describe(`Target object field(s)`),transform:bh.default(`none`),params:V({value:z().optional(),object:I().optional(),fromField:I().optional(),toField:I().optional(),autoCreate:R().optional(),valueMap:U(I(),z()).optional(),separator:I().optional()}).optional()}));K(()=>V({name:Ep.describe(`Mapping unique name (lowercase snake_case)`),label:I().optional(),sourceFormat:W([`csv`,`json`,`xml`,`sql`]).default(`csv`),targetObject:I().describe(`Target Object Name`),fieldMapping:B(xh),mode:W([`insert`,`update`,`upsert`]).default(`insert`),upsertKey:B(I()).optional().describe(`Fields to match for upsert (e.g. email)`),extractQuery:gp.optional().describe(`Query to run for export only`),errorPolicy:W([`skip`,`abort`,`retry`]).default(`skip`),batchSize:L().default(1e3)}));var Sh=K(()=>V({userId:I().optional(),tenantId:I().optional(),roles:B(I()).default([]),permissions:B(I()).default([]),systemPermissions:B(I()).optional(),tabPermissions:U(I(),W([`visible`,`hidden`,`default_on`,`default_off`])).optional(),org_user_ids:B(I()).optional(),isSystem:R().default(!1),accessToken:I().optional(),transaction:z().optional(),traceId:I().optional()})),Ch=K(()=>H([U(I(),z()),Xf]).describe(`Data Engine query filter conditions`)),wh=K(()=>H([U(I(),W([`asc`,`desc`])),U(I(),H([G(1),G(-1)])),B(np)]).describe(`Sort order definition`)),Th=K(()=>V({context:Sh.optional()})),Eh=K(()=>Th.extend({where:H([U(I(),z()),Xf]).optional(),fields:B(pp).optional(),orderBy:B(np).optional(),limit:L().optional(),offset:L().optional(),top:L().optional(),cursor:U(I(),z()).optional(),search:mp.optional(),expand:Rf(()=>U(I(),gp)).optional(),distinct:R().optional()}).describe(`QueryAST-aligned query options for IDataEngine.find() operations`));K(()=>Th.extend({filter:Ch.optional(),select:B(I()).optional(),sort:wh.optional(),limit:L().int().min(1).optional(),skip:L().int().min(0).optional(),top:L().int().min(1).optional(),populate:B(I()).optional()}).describe(`Query options for IDataEngine.find() operations`));var Dh=K(()=>Th.extend({returning:R().default(!0).optional()}).describe(`Options for DataEngine.insert operations`)),Oh=K(()=>Th.extend({where:H([U(I(),z()),Xf]).optional(),upsert:R().default(!1).optional(),multi:R().default(!1).optional(),returning:R().default(!1).optional()}).describe(`QueryAST-aligned options for DataEngine.update operations`));K(()=>Th.extend({filter:Ch.optional(),upsert:R().default(!1).optional(),multi:R().default(!1).optional(),returning:R().default(!1).optional()}).describe(`Options for DataEngine.update operations`));var kh=K(()=>Th.extend({where:H([U(I(),z()),Xf]).optional(),multi:R().default(!1).optional()}).describe(`QueryAST-aligned options for DataEngine.delete operations`));K(()=>Th.extend({filter:Ch.optional(),multi:R().default(!1).optional()}).describe(`Options for DataEngine.delete operations`));var Ah=K(()=>Th.extend({where:H([U(I(),z()),Xf]).optional(),groupBy:B(I()).optional(),aggregations:B(op).optional()}).describe(`QueryAST-aligned options for DataEngine.aggregate operations`));K(()=>Th.extend({filter:Ch.optional(),groupBy:B(I()).optional(),aggregations:B(V({field:I(),method:W([`count`,`sum`,`avg`,`min`,`max`,`count_distinct`]),alias:I().optional()})).optional()}).describe(`Options for DataEngine.aggregate operations`));var jh=K(()=>Th.extend({where:H([U(I(),z()),Xf]).optional()}).describe(`QueryAST-aligned options for DataEngine.count operations`));K(()=>Th.extend({filter:Ch.optional()}).describe(`Options for DataEngine.count operations`)),K(()=>V({find:Hf().input(pf([I(),Eh.optional()])).output(Bf(B(z()))),findOne:Hf().input(pf([I(),Eh.optional()])).output(Bf(z())),insert:Hf().input(pf([I(),H([U(I(),z()),B(U(I(),z()))]),Dh.optional()])).output(Bf(z())),update:Hf().input(pf([I(),U(I(),z()),Oh.optional()])).output(Bf(z())),delete:Hf().input(pf([I(),kh.optional()])).output(Bf(z())),count:Hf().input(pf([I(),jh.optional()])).output(Bf(L())),aggregate:Hf().input(pf([I(),Ah])).output(Bf(B(z())))}).describe(`Standard Data Engine Contract`));var Mh={filter:Ch.optional()},Nh=Eh.extend({...Mh,select:B(I()).optional(),sort:wh.optional(),skip:L().int().min(0).optional(),populate:B(I()).optional()}),Ph=K(()=>V({method:G(`find`),object:I(),query:Nh.optional()})),Fh=K(()=>V({method:G(`findOne`),object:I(),query:Nh.optional()})),Ih=K(()=>V({method:G(`insert`),object:I(),data:H([U(I(),z()),B(U(I(),z()))]),options:Dh.optional()})),Lh=K(()=>V({method:G(`update`),object:I(),data:U(I(),z()),id:H([I(),L()]).optional().describe(`ID for single update, or use where in options`),options:Oh.extend(Mh).optional()})),Rh=K(()=>V({method:G(`delete`),object:I(),id:H([I(),L()]).optional().describe(`ID for single delete, or use where in options`),options:kh.extend(Mh).optional()})),zh=K(()=>V({method:G(`count`),object:I(),query:jh.extend(Mh).optional()})),Bh=K(()=>V({method:G(`aggregate`),object:I(),query:Ah.extend(Mh)})),Vh=K(()=>V({method:G(`execute`),command:z(),options:U(I(),z()).optional()})),Hh=K(()=>V({method:G(`vectorFind`),object:I(),vector:B(L()),where:H([U(I(),z()),Xf]).optional(),fields:B(I()).optional(),limit:L().int().default(5).optional(),threshold:L().optional()})),Uh=K(()=>V({method:G(`batch`),requests:B(lf(`method`,[Ph,Fh,Ih,Lh,Rh,zh,Bh,Vh,Hh])),transaction:R().default(!0).optional()}));K(()=>lf(`method`,[Ph,Fh,Ih,Lh,Rh,zh,Bh,Uh,Vh,Hh]).describe(`Virtual ObjectQL Request Protocol`)),W([`count`,`sum`,`avg`,`min`,`max`,`count_distinct`,`percentile`,`median`,`stddev`,`variance`]).describe(`Standard aggregation functions`);var Wh=W([`asc`,`desc`]).describe(`Sort order direction`);K(()=>V({field:I().describe(`Field name to sort by`),order:Wh.describe(`Sort direction`)}).describe(`Sort field and direction pair`)),W([`insert`,`update`,`delete`,`upsert`]).describe(`Data mutation event types`);var Gh=W([`read_uncommitted`,`read_committed`,`repeatable_read`,`serializable`,`snapshot`]).describe(`Transaction isolation levels (snake_case standard)`);W([`lru`,`lfu`,`ttl`,`fifo`]).describe(`Cache eviction strategy`);var Kh=K(()=>V({transaction:z().optional().describe(`Transaction handle`),timeout:L().optional().describe(`Timeout in ms`),skipCache:R().optional().describe(`Bypass cache`),traceContext:U(I(),I()).optional().describe(`OpenTelemetry context or request ID`),tenantId:I().optional().describe(`Tenant Isolation identifier`)})),qh=K(()=>V({create:R().default(!0).describe(`Supports CREATE operations`),read:R().default(!0).describe(`Supports READ operations`),update:R().default(!0).describe(`Supports UPDATE operations`),delete:R().default(!0).describe(`Supports DELETE operations`),bulkCreate:R().default(!1).describe(`Supports bulk CREATE operations`),bulkUpdate:R().default(!1).describe(`Supports bulk UPDATE operations`),bulkDelete:R().default(!1).describe(`Supports bulk DELETE operations`),transactions:R().default(!1).describe(`Supports ACID transactions`),savepoints:R().default(!1).describe(`Supports transaction savepoints`),isolationLevels:B(Gh).optional().describe(`Supported isolation levels`),queryFilters:R().default(!0).describe(`Supports WHERE clause filtering`),queryAggregations:R().default(!1).describe(`Supports GROUP BY and aggregation functions`),queryDateGranularity:U(ip,R()).optional().describe(`Per-granularity native date bucketing (day/week/month/quarter/year). Missing keys fall back to in-memory bucketing.`),querySorting:R().default(!0).describe(`Supports ORDER BY sorting`),queryPagination:R().default(!0).describe(`Supports LIMIT/OFFSET pagination`),queryWindowFunctions:R().default(!1).describe(`Supports window functions with OVER clause`),querySubqueries:R().default(!1).describe(`Supports subqueries`),queryCTE:R().default(!1).describe(`Supports Common Table Expressions (WITH clause)`),joins:R().default(!1).describe(`Supports SQL joins`),fullTextSearch:R().default(!1).describe(`Supports full-text search`),jsonQuery:R().default(!1).describe(`Supports JSON field querying`),geospatialQuery:R().default(!1).describe(`Supports geospatial queries`),streaming:R().default(!1).describe(`Supports result streaming (cursors/iterators)`),jsonFields:R().default(!1).describe(`Supports JSON field types`),arrayFields:R().default(!1).describe(`Supports array field types`),vectorSearch:R().default(!1).describe(`Supports vector embeddings and similarity search`),schemaSync:R().default(!1).describe(`Supports automatic schema synchronization`),batchSchemaSync:R().default(!1).describe(`Supports batched schema sync to reduce schema DDL round-trips`),migrations:R().default(!1).describe(`Supports database migrations`),indexes:R().default(!1).describe(`Supports index creation and management`),connectionPooling:R().default(!1).describe(`Supports connection pooling`),preparedStatements:R().default(!1).describe(`Supports prepared statements (SQL injection prevention)`),queryCache:R().default(!1).describe(`Supports query result caching`)}));K(()=>V({name:I().describe(`Driver unique name`),version:I().describe(`Driver version`),supports:qh,connect:Hf().input(pf([])).output(Bf(tf())).describe(`Establish connection`),disconnect:Hf().input(pf([])).output(Bf(tf())).describe(`Close connection`),checkHealth:Hf().input(pf([])).output(Bf(R())).describe(`Health check`),getPoolStats:Hf().input(pf([])).output(V({total:L(),idle:L(),active:L(),waiting:L()}).optional()).optional().describe(`Get connection pool statistics`),execute:Hf().input(pf([z(),B(z()).optional(),Kh.optional()])).output(Bf(z())).describe(`Execute raw command`),find:Hf().input(pf([I(),gp,Kh.optional()])).output(Bf(B(U(I(),z())))).describe(`Find records`),findStream:Hf().input(pf([I(),gp,Kh.optional()])).output(z()).describe(`Stream records (AsyncIterable)`),findOne:Hf().input(pf([I(),gp,Kh.optional()])).output(Bf(U(I(),z()).nullable())).describe(`Find one record`),create:Hf().input(pf([I(),U(I(),z()),Kh.optional()])).output(Bf(U(I(),z()))).describe(`Create record`),update:Hf().input(pf([I(),I().or(L()),U(I(),z()),Kh.optional()])).output(Bf(U(I(),z()))).describe(`Update record`),upsert:Hf().input(pf([I(),U(I(),z()),B(I()).optional(),Kh.optional()])).output(Bf(U(I(),z()))).describe(`Upsert record`),delete:Hf().input(pf([I(),I().or(L()),Kh.optional()])).output(Bf(R())).describe(`Delete record`),count:Hf().input(pf([I(),gp.optional(),Kh.optional()])).output(Bf(L())).describe(`Count records`),bulkCreate:Hf().input(pf([I(),B(U(I(),z())),Kh.optional()])).output(Bf(B(U(I(),z())))),bulkUpdate:Hf().input(pf([I(),B(V({id:I().or(L()),data:U(I(),z())})),Kh.optional()])).output(Bf(B(U(I(),z())))),bulkDelete:Hf().input(pf([I(),B(I().or(L())),Kh.optional()])).output(Bf(tf())),updateMany:Hf().input(pf([I(),gp,U(I(),z()),Kh.optional()])).output(Bf(L())).optional(),deleteMany:Hf().input(pf([I(),gp,Kh.optional()])).output(Bf(L())).optional(),beginTransaction:Hf().input(pf([V({isolationLevel:Gh.optional()}).optional()])).output(Bf(z())).describe(`Start transaction`),commit:Hf().input(pf([z()])).output(Bf(tf())).describe(`Commit transaction`),rollback:Hf().input(pf([z()])).output(Bf(tf())).describe(`Rollback transaction`),syncSchema:Hf().input(pf([I(),z(),Kh.optional()])).output(Bf(tf())).describe(`Sync object schema to DB`),syncSchemasBatch:Hf().input(pf([B(V({object:I(),schema:z()})),Kh.optional()])).output(Bf(tf())).optional().describe(`Batch sync multiple schemas in one round-trip`),dropTable:Hf().input(pf([I(),Kh.optional()])).output(Bf(tf())),explain:Hf().input(pf([I(),gp,Kh.optional()])).output(Bf(z())).optional()}));var Jh=K(()=>V({min:L().min(0).default(2).describe(`Minimum number of connections in pool`),max:L().min(1).default(10).describe(`Maximum number of connections in pool`),idleTimeoutMillis:L().min(0).default(3e4).describe(`Time in ms before idle connection is closed`),connectionTimeoutMillis:L().min(0).default(5e3).describe(`Time in ms to wait for available connection`)})),Yh=K(()=>V({name:I().describe(`Driver instance name`),type:W([`sql`,`nosql`,`cache`,`search`,`graph`,`timeseries`]).describe(`Driver type category`),capabilities:qh.describe(`Driver capability flags`),connectionString:I().optional().describe(`Database connection string (driver-specific format)`),poolConfig:Jh.optional().describe(`Connection pool configuration`)})),Xh=K(()=>W([`postgresql`,`mysql`,`sqlite`,`mssql`,`oracle`,`mariadb`])),Zh=K(()=>V({text:I().describe(`SQL type for text fields (e.g., VARCHAR, TEXT)`),number:I().describe(`SQL type for number fields (e.g., NUMERIC, DECIMAL, INT)`),boolean:I().describe(`SQL type for boolean fields (e.g., BOOLEAN, BIT)`),date:I().describe(`SQL type for date fields (e.g., DATE)`),datetime:I().describe(`SQL type for datetime fields (e.g., TIMESTAMP, DATETIME)`),json:I().optional().describe(`SQL type for JSON fields (e.g., JSON, JSONB)`),uuid:I().optional().describe(`SQL type for UUID fields (e.g., UUID, CHAR(36))`),binary:I().optional().describe(`SQL type for binary fields (e.g., BLOB, BYTEA)`)})),Qh=K(()=>V({rejectUnauthorized:R().default(!0).describe(`Reject connections with invalid certificates`),ca:I().optional().describe(`CA certificate file path or content`),cert:I().optional().describe(`Client certificate file path or content`),key:I().optional().describe(`Client private key file path or content`)}).refine(e=>e.cert!==void 0==(e.key!==void 0),{message:`Client certificate (cert) and private key (key) must be provided together`}));K(()=>Yh.extend({type:G(`sql`).describe(`Driver type must be "sql"`),dialect:Xh.describe(`SQL database dialect`),dataTypeMapping:Zh.describe(`SQL data type mapping configuration`),ssl:R().default(!1).describe(`Enable SSL/TLS connection`),sslConfig:Qh.optional().describe(`SSL/TLS configuration (required when ssl is true)`)}).refine(e=>!(e.ssl&&!e.sslConfig),{message:`sslConfig is required when ssl is true`}));var $h=K(()=>W([`mongodb`,`couchdb`,`dynamodb`,`cassandra`,`redis`,`elasticsearch`,`neo4j`,`orientdb`]));K(()=>W([`find`,`findOne`,`insert`,`update`,`delete`,`aggregate`,`mapReduce`,`count`,`distinct`,`createIndex`,`dropIndex`]));var eg=K(()=>W([`all`,`quorum`,`one`,`local_quorum`,`each_quorum`,`eventual`])),tg=K(()=>W([`single`,`compound`,`unique`,`text`,`geospatial`,`hashed`,`ttl`,`sparse`])),ng=K(()=>V({enabled:R().default(!1).describe(`Enable sharding`),shardKey:I().optional().describe(`Field to use as shard key`),shardingStrategy:W([`hash`,`range`,`zone`]).optional().describe(`Sharding strategy`),numShards:L().int().positive().optional().describe(`Number of shards`)})),rg=K(()=>V({enabled:R().default(!1).describe(`Enable replication`),replicaSetName:I().optional().describe(`Replica set name`),replicas:L().int().positive().optional().describe(`Number of replicas`),readPreference:W([`primary`,`primaryPreferred`,`secondary`,`secondaryPreferred`,`nearest`]).optional().describe(`Read preference for replica set`),writeConcern:W([`majority`,`acknowledged`,`unacknowledged`]).optional().describe(`Write concern level`)})),ig=K(()=>V({enabled:R().default(!1).describe(`Enable schema validation`),validationLevel:W([`strict`,`moderate`,`off`]).optional().describe(`Validation strictness`),validationAction:W([`error`,`warn`]).optional().describe(`Action on validation failure`),jsonSchema:U(I(),z()).optional().describe(`JSON Schema for validation`)})),ag=K(()=>V({text:I().describe(`NoSQL type for text fields`),number:I().describe(`NoSQL type for number fields`),boolean:I().describe(`NoSQL type for boolean fields`),date:I().describe(`NoSQL type for date fields`),datetime:I().describe(`NoSQL type for datetime fields`),json:I().optional().describe(`NoSQL type for JSON/object fields`),uuid:I().optional().describe(`NoSQL type for UUID fields`),binary:I().optional().describe(`NoSQL type for binary fields`),array:I().optional().describe(`NoSQL type for array fields`),objectId:I().optional().describe(`NoSQL type for ObjectID fields (MongoDB)`),geopoint:I().optional().describe(`NoSQL type for geospatial point fields`)}));K(()=>Yh.extend({type:G(`nosql`).describe(`Driver type must be "nosql"`),databaseType:$h.describe(`Specific NoSQL database type`),dataTypeMapping:ag.describe(`NoSQL data type mapping configuration`),consistency:eg.optional().describe(`Consistency level for operations`),replication:rg.optional().describe(`Replication configuration`),sharding:ng.optional().describe(`Sharding configuration`),schemaValidation:ig.optional().describe(`Document schema validation`),region:I().optional().describe(`AWS region (for managed NoSQL services)`),accessKeyId:I().optional().describe(`AWS access key ID`),secretAccessKey:I().optional().describe(`AWS secret access key`),ttlField:I().optional().describe(`Field name for TTL (auto-deletion)`),maxDocumentSize:L().int().positive().optional().describe(`Maximum document size in bytes`),collectionPrefix:I().optional().describe(`Prefix for collection/table names`)}));var og=K(()=>V({consistency:eg.optional().describe(`Consistency level override`),readFromSecondary:R().optional().describe(`Allow reading from secondary replicas`),projection:U(I(),H([G(0),G(1)])).optional().describe(`Field projection`),timeout:L().int().positive().optional().describe(`Query timeout (ms)`),useCursor:R().optional().describe(`Use cursor instead of loading all results`),batchSize:L().int().positive().optional().describe(`Cursor batch size`),profile:R().optional().describe(`Enable query profiling`),hint:I().optional().describe(`Index hint for query optimization`)})),sg=K(()=>V({operator:I().describe(`Aggregation operator (e.g., $match, $group, $sort)`),options:U(I(),z()).describe(`Stage-specific options`)}));K(()=>V({collection:I().describe(`Collection/table name`),stages:B(sg).describe(`Aggregation pipeline stages`),options:og.optional().describe(`Query options`)})),K(()=>V({name:I().describe(`Index name`),type:tg.describe(`Index type`),fields:B(V({field:I().describe(`Field name`),order:W([`asc`,`desc`,`text`,`2dsphere`]).optional().describe(`Index order or type`)})).describe(`Fields to index`),unique:R().default(!1).describe(`Enforce uniqueness`),sparse:R().default(!1).describe(`Sparse index`),expireAfterSeconds:L().int().positive().optional().describe(`TTL in seconds`),partialFilterExpression:U(I(),z()).optional().describe(`Partial index filter`),background:R().default(!1).describe(`Create index in background`)})),K(()=>V({readConcern:W([`local`,`majority`,`linearizable`,`snapshot`]).optional().describe(`Read concern level`),writeConcern:W([`majority`,`acknowledged`,`unacknowledged`]).optional().describe(`Write concern level`),readPreference:W([`primary`,`primaryPreferred`,`secondary`,`secondaryPreferred`,`nearest`]).optional().describe(`Read preference`),maxCommitTimeMS:L().int().positive().optional().describe(`Transaction commit timeout (ms)`)}));var cg=W([`insert`,`update`,`upsert`,`replace`,`ignore`]),lg=K(()=>V({object:I().regex(/^[a-z_][a-z0-9_]*$/).describe(`Target Object Name`),externalId:I().default(`name`).describe(`Field match for uniqueness check`),mode:cg.default(`upsert`).describe(`Conflict resolution strategy`),env:B(W([`prod`,`dev`,`test`])).default([`prod`,`dev`,`test`]).describe(`Applicable environments`),records:B(U(I(),z())).describe(`Data records`)}));ah({schemaId:`object`,type:`simple`,sections:[{name:`basics`,label:`Basics`,description:`Identity, labels, and taxonomy.`,columns:2,fields:[{field:`name`,type:`text`,required:!0,immutable:!0,colSpan:1,helpText:`snake_case unique identifier (immutable after creation)`},{field:`label`,type:`text`,colSpan:1,helpText:`Singular display name (e.g. "Account")`},{field:`pluralLabel`,type:`text`,colSpan:1,helpText:`Plural display name (e.g. "Accounts")`},{field:`icon`,type:`text`,colSpan:1,helpText:`Lucide icon name (e.g. "building", "users")`},{field:`description`,type:`textarea`,colSpan:2,helpText:`Developer documentation`},{field:`tags`,type:`tags`,colSpan:2,helpText:`Categorization tags (e.g. "sales", "system")`},{field:`active`,type:`boolean`,colSpan:1,helpText:`Is the object active and usable`},{field:`isSystem`,type:`boolean`,colSpan:1,helpText:`System object (protected from deletion)`},{field:`abstract`,type:`boolean`,colSpan:1,helpText:`Abstract base (cannot be instantiated)`}]},{name:`fields`,label:`Fields`,description:`Define the data model — each entry becomes a column in the database table.`,fields:[{field:`fields`,type:`record`,required:!0,helpText:`Add the columns this object will store`,keyField:{field:`name`,label:`Name`,placeholder:`snake_case_identifier`,helpText:`snake_case machine name (used as column name and API key)`,regex:`^[a-z_][a-z0-9_]*$`,immutable:!0},fields:[{field:`label`,type:`text`,helpText:`Display label`},{field:`type`,type:`select`,required:!0,helpText:`Field type`,options:[{label:`Text`,value:`text`},{label:`Textarea`,value:`textarea`},{label:`Email`,value:`email`},{label:`URL`,value:`url`},{label:`Phone`,value:`phone`},{label:`Password`,value:`password`},{label:`Markdown`,value:`markdown`},{label:`HTML`,value:`html`},{label:`Rich Text`,value:`richtext`},{label:`Number`,value:`number`},{label:`Currency`,value:`currency`},{label:`Percent`,value:`percent`},{label:`Date`,value:`date`},{label:`Date & Time`,value:`datetime`},{label:`Time`,value:`time`},{label:`Boolean`,value:`boolean`},{label:`Toggle`,value:`toggle`},{label:`Select`,value:`select`},{label:`Multiselect`,value:`multiselect`},{label:`Radio`,value:`radio`},{label:`Checkboxes`,value:`checkboxes`},{label:`Lookup (reference)`,value:`lookup`},{label:`Master–Detail`,value:`master_detail`},{label:`Tree`,value:`tree`},{label:`Image`,value:`image`},{label:`File`,value:`file`},{label:`Avatar`,value:`avatar`},{label:`Video`,value:`video`},{label:`Audio`,value:`audio`},{label:`Formula (computed)`,value:`formula`},{label:`Summary (rollup)`,value:`summary`},{label:`Autonumber`,value:`autonumber`},{label:`Composite (embedded)`,value:`composite`},{label:`Repeater (embedded array)`,value:`repeater`},{label:`Record (keyed map)`,value:`record`},{label:`Location (GPS)`,value:`location`},{label:`Address`,value:`address`},{label:`Code`,value:`code`},{label:`JSON`,value:`json`},{label:`Color`,value:`color`},{label:`Rating`,value:`rating`},{label:`Slider`,value:`slider`},{label:`Signature`,value:`signature`},{label:`QR / Barcode`,value:`qrcode`},{label:`Progress`,value:`progress`},{label:`Tags`,value:`tags`},{label:`Vector embedding`,value:`vector`}]},{field:`description`,type:`textarea`,helpText:`Developer documentation for this column`},{field:`required`,type:`boolean`,helpText:`Must be set on every record`},{field:`unique`,type:`boolean`,helpText:`Disallow duplicate values`},{field:`indexed`,type:`boolean`,helpText:`Create a database index for faster querying`},{field:`readonly`,type:`boolean`,helpText:`Visible but never user-editable`},{field:`immutable`,type:`boolean`,helpText:`Editable on create, locked thereafter`},{field:`hidden`,type:`boolean`,helpText:`Hidden from default UI`},{field:`searchable`,type:`boolean`,helpText:`Include in full-text search`},{field:`sortable`,type:`boolean`,helpText:`Allow sorting on this column`},{field:`filterable`,type:`boolean`,helpText:`Allow filtering on this column`},{field:`defaultValue`,type:`text`,helpText:`Default value for new records (JSON literal)`},{field:`placeholder`,type:`text`,helpText:`Placeholder hint`},{field:`maxLength`,type:`number`,helpText:`Max characters`,visibleOn:`type in ['text','textarea','email','url','phone','password','markdown','html','richtext']`},{field:`minLength`,type:`number`,helpText:`Min characters`,visibleOn:`type in ['text','textarea','email','url','phone','password','markdown','html','richtext']`},{field:`min`,type:`number`,helpText:`Minimum value`,visibleOn:`type in ['number','currency','percent','rating','slider','progress']`},{field:`max`,type:`number`,helpText:`Maximum value`,visibleOn:`type in ['number','currency','percent','rating','slider','progress']`},{field:`precision`,type:`number`,helpText:`Total digits`,visibleOn:`type in ['number','currency','percent']`},{field:`scale`,type:`number`,helpText:`Decimal places`,visibleOn:`type in ['number','currency','percent']`},{field:`options`,type:`repeater`,helpText:`Available choices`,visibleOn:`type in ['select','multiselect','radio','checkboxes']`,fields:[{field:`label`,type:`text`,required:!0},{field:`value`,type:`text`,required:!0},{field:`color`,type:`color`},{field:`icon`,type:`text`,helpText:`Lucide icon name`},{field:`description`,type:`text`}]},{field:`reference`,type:`text`,helpText:`Target object name`,visibleOn:`type in ['lookup','master_detail','tree']`},{field:`referenceFilter`,type:`code`,language:`expression`,helpText:`CEL filter applied to the picker`,visibleOn:`type in ['lookup','master_detail']`},{field:`cascadeDelete`,type:`boolean`,helpText:`Delete children when parent is deleted`,visibleOn:`type == 'master_detail'`},{field:`multiple`,type:`boolean`,helpText:`Allow selecting multiple records`,visibleOn:`type in ['lookup']`},{field:`formula`,type:`code`,language:`expression`,helpText:`CEL formula expression`,visibleOn:`type == 'formula'`},{field:`returnType`,type:`select`,helpText:`Result type for formulas`,visibleOn:`type == 'formula'`,options:[{label:`Text`,value:`text`},{label:`Number`,value:`number`},{label:`Boolean`,value:`boolean`},{label:`Date`,value:`date`},{label:`Datetime`,value:`datetime`},{label:`Currency`,value:`currency`}]},{field:`summaryType`,type:`select`,helpText:`Aggregation`,visibleOn:`type == 'summary'`,options:[{label:`Count`,value:`count`},{label:`Sum`,value:`sum`},{label:`Avg`,value:`avg`},{label:`Min`,value:`min`},{label:`Max`,value:`max`}]},{field:`summaryField`,type:`text`,helpText:`Field on child object to aggregate`,visibleOn:`type == 'summary'`},{field:`displayFormat`,type:`text`,helpText:`e.g. "INV-{0000}"`,visibleOn:`type == 'autonumber'`},{field:`startingNumber`,type:`number`,helpText:`Starting sequence value`,visibleOn:`type == 'autonumber'`},{field:`language`,type:`text`,helpText:`Editor language (e.g. sql, javascript)`,visibleOn:`type == 'code'`},{field:`validation`,type:`code`,language:`expression`,helpText:`CEL predicate — must evaluate true`},{field:`errorMessage`,type:`text`,helpText:`Shown when validation fails`},{field:`audit`,type:`boolean`,helpText:`Audit changes to this field`},{field:`trackHistory`,type:`boolean`,helpText:`Keep change history`},{field:`pii`,type:`boolean`,helpText:`Personally identifiable information`},{field:`encrypted`,type:`boolean`,helpText:`Encrypt at rest`}]}]},{name:`capabilities`,label:`Capabilities`,description:`System features and API exposure.`,collapsible:!0,collapsed:!0,fields:[{field:`capabilities`,type:`composite`,helpText:`Enable/disable system features`,fields:[{field:`trackHistory`,type:`boolean`},{field:`searchable`,type:`boolean`},{field:`apiEnabled`,type:`boolean`},{field:`files`,type:`boolean`},{field:`feeds`,type:`boolean`},{field:`activities`,type:`boolean`},{field:`trash`,type:`boolean`},{field:`mru`,type:`boolean`},{field:`clone`,type:`boolean`}]}]},{name:`advanced`,label:`Advanced`,description:`State machines, actions, and storage.`,collapsible:!0,collapsed:!0,fields:[{field:`datasource`,type:`text`,helpText:`Target datasource ID (default: "default")`}]}]}),ah({schemaId:`field`,type:`simple`,sections:[{name:`basics`,label:`Basics`,description:`Core field identity and constraints.`,columns:2,fields:[{field:`name`,required:!0,immutable:!0,colSpan:1,helpText:`Unique identifier (snake_case, immutable after creation)`},{field:`label`,required:!0,colSpan:1,helpText:`Display name for users`},{field:`type`,required:!0,colSpan:1,helpText:`Data type of this field`},{field:`group`,colSpan:1,helpText:`Group name for form layout`},{field:`description`,widget:`textarea`,colSpan:2,helpText:`Help text shown to users`},{field:`required`,colSpan:1,helpText:`User must provide a value`},{field:`unique`,colSpan:1,helpText:`No two records can have the same value`},{field:`multiple`,colSpan:1,helpText:`Allow multiple values (for select/lookup)`}]},{name:`configuration`,label:`Configuration`,description:`Field-type specific settings (visible blocks depend on the chosen type).`,fields:[{field:`defaultValue`,helpText:`Default value for new records`},{field:`minLength`,visibleOn:`data.type == 'text' || data.type == 'textarea' || data.type == 'email'`,helpText:`Minimum character length`},{field:`maxLength`,visibleOn:`data.type == 'text' || data.type == 'textarea' || data.type == 'email'`,helpText:`Maximum character length`},{field:`min`,visibleOn:`data.type == 'number' || data.type == 'currency'`,helpText:`Minimum value`},{field:`max`,visibleOn:`data.type == 'number' || data.type == 'currency'`,helpText:`Maximum value`},{field:`precision`,visibleOn:`data.type == 'currency' || data.type == 'number'`,helpText:`Decimal places (e.g., 2 for $10.50)`},{field:`scale`,visibleOn:`data.type == 'number'`,helpText:`Number of decimal digits`},{field:`options`,type:`repeater`,visibleOn:`data.type == 'select' || data.type == 'multiselect'`,helpText:`Available options (label/value pairs)`},{field:`reference`,widget:`ref:object`,visibleOn:`data.type == 'lookup' || data.type == 'master_detail'`,helpText:`Referenced object name`},{field:`referenceFilters`,widget:`string-tags`,visibleOn:`data.type == 'lookup' || data.type == 'master_detail'`,helpText:`Filter expressions (e.g., "active = true")`},{field:`deleteBehavior`,visibleOn:`data.type == 'lookup' || data.type == 'master_detail'`,helpText:`What happens when referenced record is deleted`}]},{name:`formula`,label:`Formula & Computed`,description:`Calculated values and roll-up summaries.`,collapsible:!0,collapsed:!0,fields:[{field:`expression`,widget:`textarea`,helpText:`CEL expression to calculate this field (makes it read-only)`},{field:`summaryOperations`,type:`composite`,helpText:`Roll-up summary configuration (for parent-child relationships)`},{field:`cached`,type:`composite`,helpText:`Caching configuration for computed fields`}]},{name:`advanced`,label:`Advanced`,description:`Database, UI, audit, and security settings.`,collapsible:!0,collapsed:!0,columns:2,fields:[{field:`columnName`,colSpan:2,helpText:`Physical column name in database (defaults to field name)`},{field:`index`,colSpan:1,helpText:`Create database index for faster queries`},{field:`externalId`,colSpan:1,helpText:`Mark as external ID for upsert operations`},{field:`readonly`,colSpan:1,helpText:`Field is read-only in forms`},{field:`hidden`,colSpan:1,helpText:`Hide field from default UI views`},{field:`searchable`,colSpan:1,helpText:`Include in global search results`},{field:`sortable`,colSpan:1,helpText:`Allow sorting lists by this field`},{field:`auditTrail`,colSpan:1,helpText:`Track detailed changes with user and timestamp`},{field:`trackFeedHistory`,colSpan:1,helpText:`Show changes in activity feed`},{field:`encryptionConfig`,type:`composite`,colSpan:2,helpText:`Field-level encryption (GDPR/HIPAA/PCI-DSS)`},{field:`maskingRule`,type:`composite`,colSpan:2,helpText:`Data masking rules for PII protection`}]}]}),ah({schemaId:`hook`,type:`simple`,sections:[{label:`Identity`,description:`What this hook is and when it fires.`,columns:2,fields:[{field:`name`,type:`text`,required:!0,immutable:!0,colSpan:1,helpText:`snake_case identifier (immutable after creation)`},{field:`label`,type:`text`,colSpan:1},{field:`description`,type:`textarea`,colSpan:2},{field:`object`,type:`text`,required:!0,colSpan:1,helpText:`Target object name (or "*" for global)`},{field:`events`,type:`tags`,required:!0,colSpan:1,helpText:`Lifecycle events (e.g. beforeInsert, afterUpdate)`},{field:`priority`,type:`number`,colSpan:1,helpText:`Lower numbers run first`}]},{label:`Body`,description:`Inline expression or sandboxed JavaScript executed when the hook fires.`,fields:[{field:`body`,type:`composite`,helpText:`Either an L1 expression or an L2 sandboxed JS body`,fields:[{field:`language`,type:`select`,required:!0,helpText:`expression = pure formula; js = sandboxed JavaScript`,options:[{label:`Expression (L1)`,value:`expression`},{label:`JavaScript (L2 sandboxed)`,value:`js`}]},{field:`source`,type:`code`,language:`javascript`,required:!0,helpText:`Function body source — no top-level imports`},{field:`capabilities`,type:`tags`,helpText:`Allowed ctx APIs (api.read, api.write, crypto.uuid, log, …)`},{field:`timeoutMs`,type:`number`,helpText:`Per-invocation timeout (ms)`}]}]},{label:`Legacy handler`,description:`Function name reference — deprecated in favour of body.`,collapsible:!0,collapsed:!0,fields:[{field:`handler`,type:`text`,helpText:"Handler function name (deprecated — prefer `body`)"}]},{label:`Execution`,collapsible:!0,collapsed:!0,columns:2,fields:[{field:`async`,type:`boolean`,colSpan:1,helpText:`Run in background, do not block the transaction`},{field:`onError`,type:`select`,colSpan:1,options:[{label:`Abort`,value:`abort`},{label:`Log`,value:`log`}]},{field:`condition`,type:`code`,language:`javascript`,colSpan:2,helpText:`Optional formula — skip the hook when this evaluates to false`}]}]});var ug=K(()=>V({field:I().describe(`Source field name containing the reference value`),targetObject:I().regex(/^[a-z_][a-z0-9_]*$/).describe(`Target object name (snake_case)`),targetField:I().default(`name`).describe(`Field on target object used for matching`),fieldType:W([`lookup`,`master_detail`]).describe(`Relationship field type`)}).describe(`Describes how a field reference is resolved during seed loading`)),dg=K(()=>V({object:I().regex(/^[a-z_][a-z0-9_]*$/).describe(`Object name (snake_case)`),dependsOn:B(I()).describe(`Objects this object depends on`),references:B(ug).describe(`Field-level reference details`)}).describe(`Object node in the seed data dependency graph`)),fg=K(()=>V({nodes:B(dg).describe(`All objects in the dependency graph`),insertOrder:B(I()).describe(`Topologically sorted insert order`),circularDependencies:B(B(I())).default([]).describe(`Circular dependency chains (e.g., [["a", "b", "a"]])`)}).describe(`Complete object dependency graph for seed data loading`)),pg=K(()=>V({sourceObject:I().describe(`Object with the broken reference`),field:I().describe(`Field name with unresolved reference`),targetObject:I().describe(`Target object searched for the reference`),targetField:I().describe(`ExternalId field used for matching`),attemptedValue:z().describe(`Value that failed to resolve`),recordIndex:L().int().min(0).describe(`Index of the record in the dataset`),message:I().describe(`Human-readable error description`)}).describe(`Actionable error for a failed reference resolution`)),mg=V({user:V({id:I().min(1),role:I().optional(),email:I().optional()}).optional().describe(`Subject bound to os.user in seed CEL expressions`),org:V({id:I().min(1),tier:I().optional()}).optional().describe(`Organization bound to os.org in seed CEL expressions`)}).describe(`Identity context for resolving os.user / os.org in seed CEL values`),hg=K(()=>V({dryRun:R().default(!1).describe(`Validate references without writing data`),haltOnError:R().default(!1).describe(`Stop on first reference resolution error`),multiPass:R().default(!0).describe(`Enable multi-pass loading for circular dependencies`),defaultMode:cg.default(`upsert`).describe(`Default conflict resolution strategy`),batchSize:L().int().min(1).default(1e3).describe(`Maximum records per batch insert/upsert`),transaction:R().default(!1).describe(`Wrap entire load in a transaction (all-or-nothing)`),env:W([`prod`,`dev`,`test`]).optional().describe(`Only load datasets matching this environment`),organizationId:I().min(1).optional().describe(`Target organization id for per-tenant seed replay`),identity:mg.optional().describe(`Identity bound to os.user / os.org when resolving CEL seed values`)}).describe(`Seed data loader configuration`)),gg=K(()=>V({object:I().describe(`Object that was loaded`),mode:cg.describe(`Import mode used`),inserted:L().int().min(0).describe(`Records inserted`),updated:L().int().min(0).describe(`Records updated`),skipped:L().int().min(0).describe(`Records skipped`),errored:L().int().min(0).describe(`Records with errors`),total:L().int().min(0).describe(`Total records in dataset`),referencesResolved:L().int().min(0).describe(`References resolved via externalId`),referencesDeferred:L().int().min(0).describe(`References deferred to second pass`),errors:B(pg).default([]).describe(`Reference resolution errors`)}).describe(`Result of loading a single dataset`));K(()=>V({success:R().describe(`Overall success status`),dryRun:R().describe(`Whether this was a dry-run`),dependencyGraph:fg.describe(`Object dependency graph`),results:B(gg).describe(`Per-object load results`),errors:B(pg).describe(`All reference resolution errors`),summary:V({objectsProcessed:L().int().min(0).describe(`Total objects processed`),totalRecords:L().int().min(0).describe(`Total records across all objects`),totalInserted:L().int().min(0).describe(`Total records inserted`),totalUpdated:L().int().min(0).describe(`Total records updated`),totalSkipped:L().int().min(0).describe(`Total records skipped`),totalErrored:L().int().min(0).describe(`Total records with errors`),totalReferencesResolved:L().int().min(0).describe(`Total references resolved`),totalReferencesDeferred:L().int().min(0).describe(`Total references deferred`),circularDependencyCount:L().int().min(0).describe(`Circular dependency chains detected`),durationMs:L().min(0).describe(`Load duration in milliseconds`)}).describe(`Summary statistics`)}).describe(`Complete seed loader result`)),K(()=>V({datasets:B(lg).min(1).describe(`Datasets to load`),config:hg.default(()=>hg.parse({})).describe(`Loader configuration`)}).describe(`Seed loader request with datasets and configuration`));var _g=K(()=>V({versionNumber:L().describe(`Version number`),createdAt:L().describe(`Creation timestamp`),createdBy:I().describe(`Creator user ID`),size:L().describe(`File size in bytes`),checksum:I().describe(`File checksum`),downloadUrl:I().url().describe(`Download URL`),isLatest:R().optional().default(!1).describe(`Is latest version`)})),vg=K(()=>V({id:I().describe(`Template ID`),name:I().describe(`Template name`),description:I().optional().describe(`Template description`),fileUrl:I().url().describe(`Template file URL`),fileType:I().describe(`File MIME type`),placeholders:B(V({key:I().describe(`Placeholder key`),label:I().describe(`Placeholder label`),type:W([`text`,`number`,`date`,`image`]).describe(`Placeholder type`),required:R().optional().default(!1).describe(`Is required`)})).describe(`Template placeholders`)})),yg=K(()=>V({provider:W([`docusign`,`adobe-sign`,`hellosign`,`custom`]).describe(`E-signature provider`),enabled:R().optional().default(!1).describe(`E-signature enabled`),signers:B(V({email:I().email().describe(`Signer email`),name:I().describe(`Signer name`),role:I().describe(`Signer role`),order:L().describe(`Signing order`)})).describe(`Document signers`),expirationDays:L().optional().default(30).describe(`Expiration days`),reminderDays:L().optional().default(7).describe(`Reminder interval days`)}));K(()=>V({id:I().describe(`Document ID`),name:I().describe(`Document name`),description:I().optional().describe(`Document description`),fileType:I().describe(`File MIME type`),fileSize:L().describe(`File size in bytes`),category:I().optional().describe(`Document category`),tags:B(I()).optional().describe(`Document tags`),versioning:V({enabled:R().describe(`Versioning enabled`),versions:B(_g).describe(`Version history`),majorVersion:L().describe(`Major version`),minorVersion:L().describe(`Minor version`)}).optional().describe(`Version control`),template:vg.optional().describe(`Document template`),eSignature:yg.optional().describe(`E-signature config`),access:V({isPublic:R().optional().default(!1).describe(`Public access`),sharedWith:B(I()).optional().describe(`Shared with`),expiresAt:L().optional().describe(`Access expiration`)}).optional().describe(`Access control`),metadata:U(I(),z()).optional().describe(`Custom metadata`)}));var bg=K(()=>lf(`type`,[V({type:G(`constant`),value:z().describe(`Constant value to use`)}).describe(`Set a constant value`),V({type:G(`cast`),targetType:W([`string`,`number`,`boolean`,`date`]).describe(`Target data type`)}).describe(`Cast to a specific data type`),V({type:G(`lookup`),table:I().describe(`Lookup table name`),keyField:I().describe(`Field to match on`),valueField:I().describe(`Field to retrieve`)}).describe(`Lookup value from another table`),V({type:G(`javascript`),expression:Ap.describe(`JS expression (dialect="js" recommended). e.g. value.toUpperCase()`)}).describe(`Custom JavaScript transformation`),V({type:G(`map`),mappings:U(I(),z()).describe(`Value mappings (e.g., {"Active": "active"})`)}).describe(`Map values using a dictionary`)])),xg=K(()=>V({source:I().describe(`Source field name`),target:I().describe(`Target field name`),transform:bg.optional().describe(`Transformation to apply`),defaultValue:z().optional().describe(`Default if source is null/undefined`)})),Sg=K(()=>V({id:I().describe(`Data source ID`),name:I().describe(`Data source name`),type:W([`odata`,`rest-api`,`graphql`,`custom`]).describe(`Protocol type`),endpoint:I().url().describe(`API endpoint URL`),authentication:V({type:W([`oauth2`,`api-key`,`basic`,`none`]).describe(`Auth type`),config:U(I(),z()).describe(`Auth configuration`)}).describe(`Authentication`)})),Cg=K(()=>xg.extend({type:I().optional().describe(`Field type`),readonly:R().optional().default(!0).describe(`Read-only field`)}));K(()=>V({fieldName:I().describe(`Field name`),dataSource:Sg.describe(`External data source`),query:V({endpoint:I().describe(`Query endpoint path`),method:W([`GET`,`POST`]).optional().default(`GET`).describe(`HTTP method`),parameters:U(I(),z()).optional().describe(`Query parameters`)}).describe(`Query configuration`),fieldMappings:B(Cg).describe(`Field mappings`),caching:V({enabled:R().optional().default(!0).describe(`Cache enabled`),ttl:L().optional().default(300).describe(`Cache TTL (seconds)`),strategy:W([`lru`,`lfu`,`ttl`]).optional().default(`ttl`).describe(`Cache strategy`)}).optional().describe(`Caching configuration`),fallback:V({enabled:R().optional().default(!0).describe(`Fallback enabled`),defaultValue:z().optional().describe(`Default fallback value`),showError:R().optional().default(!0).describe(`Show error to user`)}).optional().describe(`Fallback configuration`),rateLimit:V({requestsPerSecond:L().describe(`Requests per second limit`),burstSize:L().optional().describe(`Burst size`)}).optional().describe(`Rate limiting`),retry:V({maxRetries:L().min(0).default(3).describe(`Maximum retry attempts`),initialDelayMs:L().default(1e3).describe(`Initial retry delay in milliseconds`),maxDelayMs:L().default(3e4).describe(`Maximum retry delay in milliseconds`),backoffMultiplier:L().default(2).describe(`Exponential backoff multiplier`),retryableStatusCodes:B(L()).default([429,500,502,503,504]).describe(`HTTP status codes that are retryable`)}).optional().describe(`Retry configuration with exponential backoff`),transform:V({request:V({headers:U(I(),I()).optional().describe(`Additional request headers`),queryParams:U(I(),I()).optional().describe(`Additional query parameters`)}).optional().describe(`Request transformation`),response:V({dataPath:I().optional().describe(`JSONPath to extract data (e.g., "$.data.results")`),totalPath:I().optional().describe(`JSONPath to extract total count (e.g., "$.meta.total")`)}).optional().describe(`Response transformation`)}).optional().describe(`Request/response transformation pipeline`),pagination:V({type:W([`offset`,`cursor`,`page`]).default(`offset`).describe(`Pagination type`),pageSize:L().default(100).describe(`Items per page`),maxPages:L().optional().describe(`Maximum number of pages to fetch`)}).optional().describe(`Pagination configuration for external data`)}));var wg=I().describe(`Underlying driver identifier`);K(()=>V({id:I().describe(`Unique driver identifier (e.g. "postgres")`),label:I().describe(`Display label (e.g. "PostgreSQL")`),description:I().optional(),icon:I().optional(),configSchema:U(I(),z()).describe(`JSON Schema for connection configuration`),capabilities:Rf(()=>Tg).optional()}));var Tg=V({transactions:R().default(!1),queryFilters:R().default(!1),queryAggregations:R().default(!1),querySorting:R().default(!1),queryPagination:R().default(!1),queryWindowFunctions:R().default(!1),querySubqueries:R().default(!1),joins:R().default(!1),fullTextSearch:R().default(!1),readOnly:R().default(!1),dynamicSchema:R().default(!1)}),Eg=W([`managed`,`external`,`validate-only`]).describe(`Schema ownership mode`),Dg=V({label:I().optional().describe(`Display label, e.g. "Snowflake — ANALYTICS / PROD"`),allowedSchemas:B(I()).optional().describe(`Whitelist of remote schemas/databases that may be exposed.`),allowWrites:R().default(!1).describe(`Global write gate. Individual objects must also opt in via object.external.writable.`),validation:V({onMismatch:W([`fail`,`warn`,`ignore`]).default(`fail`).describe(`What to do when a federated object diverges from the remote table.`),checkOnBoot:R().default(!0).describe(`Validate federated objects against the remote schema at boot.`),checkIntervalMs:L().optional().describe(`Optional background drift-check interval in milliseconds.`)}).default({onMismatch:`fail`,checkOnBoot:!0}).describe(`Boot/drift validation policy`),credentialsRef:I().optional().describe(`Reference into the secrets store; never inline credentials.`),queryTimeoutMs:L().default(3e4).describe(`Hard cap on per-query execution time.`),requirePermission:I().optional().describe(`Optional convenience: gate the entire datasource behind a single role.`)}).describe(`External datasource federation settings (schemaMode != "managed")`);K(()=>V({name:I().regex(/^[a-z_][a-z0-9_]*$/).describe(`Unique datasource identifier`),label:I().optional().describe(`Display label`),driver:wg.describe(`Underlying driver type`),config:U(I(),z()).describe(`Driver specific configuration`),pool:V({min:L().default(0).describe(`Minimum connections`),max:L().default(10).describe(`Maximum connections`),idleTimeoutMillis:L().default(3e4).describe(`Idle timeout`),connectionTimeoutMillis:L().default(3e3).describe(`Connection establishment timeout`)}).optional().describe(`Connection pool settings`),readReplicas:B(U(I(),z())).optional().describe(`Read-only replica configurations`),capabilities:Tg.optional().describe(`Capability overrides`),healthCheck:V({enabled:R().default(!0).describe(`Enable health check endpoint`),intervalMs:L().default(3e4).describe(`Health check interval in milliseconds`),timeoutMs:L().default(5e3).describe(`Health check timeout in milliseconds`)}).optional().describe(`Datasource health check configuration`),ssl:V({enabled:R().default(!1).describe(`Enable SSL/TLS for database connection`),rejectUnauthorized:R().default(!0).describe(`Reject connections with invalid/self-signed certificates`),ca:I().optional().describe(`CA certificate (PEM format or path to file)`),cert:I().optional().describe(`Client certificate (PEM format or path to file)`),key:I().optional().describe(`Client private key (PEM format or path to file)`)}).optional().describe(`SSL/TLS configuration for secure database connections`),retryPolicy:V({maxRetries:L().default(3).describe(`Maximum number of retry attempts`),baseDelayMs:L().default(1e3).describe(`Base delay between retries in milliseconds`),maxDelayMs:L().default(3e4).describe(`Maximum delay between retries in milliseconds`),backoffMultiplier:L().default(2).describe(`Exponential backoff multiplier`)}).optional().describe(`Connection retry policy for transient failures`),description:I().optional().describe(`Internal description`),active:R().default(!0).describe(`Is datasource enabled`),schemaMode:Eg.default(`managed`),external:Dg.optional(),origin:W([`code`,`runtime`]).default(`code`).describe(`Datasource provenance (server-managed, read-only)`)}).superRefine((e,t)=>{e.schemaMode!==`managed`&&!e.external&&t.addIssue({code:`custom`,path:[`external`],message:`schemaMode='${e.schemaMode}' requires 'external' settings.`}),e.schemaMode===`managed`&&e.external&&t.addIssue({code:`custom`,path:[`external`],message:`'external' settings only apply when schemaMode != 'managed'.`})}));var Og=V({name:I().describe(`Remote column name`),sqlType:I().describe(`Raw remote SQL type (e.g. "numeric(10,2)")`),nullable:R().describe(`Whether the remote column is nullable`),primaryKey:R().default(!1).describe(`Part of the remote primary key`),suggestedFieldType:I().optional().describe(`ObjectStack field type suggested by the type-compat matrix`)}),kg=V({remoteSchema:I().optional().describe(`Remote schema/database qualifier`),remoteName:I().describe(`Remote table/view name`),columns:B(Og).describe(`Remote columns`),indexes:B(V({name:I(),columns:B(I()),unique:R()})).optional().describe(`Remote indexes, when introspectable`),rowCountEstimate:L().optional().describe(`Approximate row count`)});K(()=>V({name:I().regex(/^[a-z_][a-z0-9_]*$/).describe("Catalog id, conventionally `<datasource>_catalog`."),datasource:I().describe(`Datasource.name this catalog snapshots.`),snapshotAt:I().datetime().describe(`When the snapshot was taken (ISO 8601).`),dialect:I().optional().describe(`Remote SQL dialect, when known.`),tables:B(kg).describe(`Snapshotted remote tables.`)}));var Ag=W([`count`,`sum`,`avg`,`min`,`max`,`count_distinct`,`number`,`string`,`boolean`]),jg=W([`string`,`number`,`boolean`,`time`,`geo`]),Mg=W([`second`,`minute`,`hour`,`day`,`week`,`month`,`quarter`,`year`]),Ng=K(()=>V({name:I().regex(/^[a-z_][a-z0-9_]*$/).describe(`Unique metric ID`),label:I().describe(`Human readable label`),description:I().optional(),type:Ag,sql:I().describe(`SQL expression or field reference`),filters:B(V({sql:I()})).optional(),format:I().optional()})),Pg=K(()=>V({name:I().regex(/^[a-z_][a-z0-9_]*$/).describe(`Unique dimension ID`),label:I().describe(`Human readable label`),description:I().optional(),type:jg,sql:I().describe(`SQL expression or column reference`),granularities:B(Mg).optional()})),Fg=K(()=>V({name:I().describe(`Target cube name`),relationship:W([`one_to_one`,`one_to_many`,`many_to_one`]).default(`many_to_one`),sql:I().describe(`Join condition (ON clause)`)}));K(()=>V({name:I().regex(/^[a-z_][a-z0-9_]*$/).describe(`Cube name (snake_case)`),title:I().optional(),description:I().optional(),sql:I().describe(`Base SQL statement or Table Name`),measures:U(I(),Ng).describe(`Quantitative metrics`),dimensions:U(I(),Pg).describe(`Qualitative attributes`),joins:U(I(),Fg).optional(),refreshKey:V({every:I().optional(),sql:I().optional()}).optional(),public:R().default(!1)})),K(()=>V({cube:I().optional().describe(`Target cube name (optional when provided externally, e.g. in API request wrapper)`),measures:B(I()).describe(`List of metrics to calculate`),dimensions:B(I()).optional().describe(`List of dimensions to group by`),where:Xf.optional().describe(`Filtering criteria (canonical Query DSL FilterCondition)`),timeDimensions:B(V({dimension:I(),granularity:Mg.optional(),dateRange:H([I(),B(I())]).optional()})).optional(),order:U(I(),W([`asc`,`desc`])).optional(),limit:L().optional(),offset:L().optional(),timezone:I().optional().default(`UTC`)}));var Ig=W([`comment`,`field_change`,`task`,`event`,`email`,`call`,`note`,`file`,`record_create`,`record_delete`,`approval`,`sharing`,`system`]),Lg=K(()=>V({type:W([`user`,`team`,`record`]).describe(`Mention target type`),id:I().describe(`Target ID`),name:I().describe(`Display name for rendering`),offset:L().int().min(0).describe(`Character offset in body text`),length:L().int().min(1).describe(`Length of mention token in body text`)})),Rg=K(()=>V({field:I().describe(`Field machine name`),fieldLabel:I().optional().describe(`Field display label`),oldValue:z().optional().describe(`Previous value`),newValue:z().optional().describe(`New value`),oldDisplayValue:I().optional().describe(`Human-readable old value`),newDisplayValue:I().optional().describe(`Human-readable new value`)})),zg=K(()=>V({emoji:I().describe(`Emoji character or shortcode (e.g., "👍", ":thumbsup:")`),userIds:B(I()).describe(`Users who reacted`),count:L().int().min(1).describe(`Total reaction count`)})),Bg=K(()=>V({type:W([`user`,`system`,`service`,`automation`]).describe(`Actor type`),id:I().describe(`Actor ID`),name:I().optional().describe(`Actor display name`),avatarUrl:I().url().optional().describe(`Actor avatar URL`),source:I().optional().describe(`Source application (e.g., "Omni", "API", "Studio")`)})),Vg=W([`public`,`internal`,`private`]);K(()=>V({id:I().describe(`Feed item ID`),type:Ig.describe(`Activity type`),object:I().describe(`Object name (e.g., "account")`),recordId:I().describe(`Record ID this feed item belongs to`),actor:Bg.describe(`Who performed this action`),body:I().optional().describe(`Rich text body (Markdown supported)`),mentions:B(Lg).optional().describe(`Mentioned users/teams/records`),changes:B(Rg).optional().describe(`Field-level changes`),reactions:B(zg).optional().describe(`Emoji reactions on this item`),parentId:I().optional().describe(`Parent feed item ID for threaded replies`),replyCount:L().int().min(0).default(0).describe(`Number of replies`),pinned:R().default(!1).describe(`Whether the feed item is pinned to the top of the timeline`),pinnedAt:I().datetime().optional().describe(`Timestamp when the item was pinned`),pinnedBy:I().optional().describe(`User ID who pinned the item`),starred:R().default(!1).describe(`Whether the feed item is starred/bookmarked by the current user`),starredAt:I().datetime().optional().describe(`Timestamp when the item was starred`),visibility:Vg.default(`public`).describe(`Visibility: public (all users), internal (team only), private (author + mentioned)`),createdAt:I().datetime().describe(`Creation timestamp`),updatedAt:I().datetime().optional().describe(`Last update timestamp`),editedAt:I().datetime().optional().describe(`When comment was last edited`),isEdited:R().default(!1).describe(`Whether comment has been edited`)})),W([`all`,`comments_only`,`changes_only`,`tasks_only`]);var Hg=W([`comment`,`mention`,`field_change`,`task`,`approval`,`all`]),Ug=W([`in_app`,`email`,`push`,`slack`]);K(()=>V({object:I().describe(`Object name`),recordId:I().describe(`Record ID`),userId:I().describe(`Subscribing user ID`),events:B(Hg).default([`all`]).describe(`Event types to receive notifications for`),channels:B(Ug).default([`in_app`]).describe(`Notification delivery channels`),active:R().default(!0).describe(`Whether the subscription is active`),createdAt:I().datetime().describe(`Subscription creation timestamp`)}));var Wg=(e=>l===void 0?typeof Proxy<`u`?new Proxy(e,{get:(e,t)=>(l===void 0?e:l)[t]}):e:l)(function(e){if(l!==void 0)return l.apply(this,arguments);throw Error(`Dynamic require of "`+e+`" is not supported`)}),Gg={debug:0,info:1,warn:2,error:3,fatal:4,silent:5},Kg={debug:`\x1B[36m`,info:`\x1B[32m`,warn:`\x1B[33m`,error:`\x1B[31m`,fatal:`\x1B[35m`,silent:``},qg=`\x1B[0m`,Jg=class e{constructor(e={},t={}){this.config={name:e.name,level:e.level??`info`,format:e.format??`pretty`,redact:e.redact??[`password`,`token`,`secret`,`key`],sourceLocation:e.sourceLocation??!1,file:e.file,rotation:e.rotation??{maxSize:`10m`,maxFiles:5}},this.bindings=t,this.config.file&&typeof process<`u`&&this.openFileStream(this.config.file)}openFileStream(e){try{let t=Wg(`fs`),n=Wg(`path`).dirname(e);t.mkdirSync(n,{recursive:!0}),this.fileStream=t.createWriteStream(e,{flags:`a`})}catch{}}isEnabled(e){return Gg[e]>=Gg[this.config.level]}redactSensitive(e){if(!e||typeof e!=`object`)return e;let t=Array.isArray(e)?[...e]:{...e};for(let e in t){let n=e.toLowerCase();this.config.redact.some(e=>n.includes(e.toLowerCase()))?t[e]=`***REDACTED***`:typeof t[e]==`object`&&t[e]!==null&&(t[e]=this.redactSensitive(t[e]))}return t}write(e,t,n,r){if(!this.isEnabled(e))return;let i=this.redactSensitive({...this.bindings,...n,...r?{error:{message:r.message,stack:r.stack}}:{}}),a=Object.keys(i).length>0,o=new Date().toISOString(),s;if(this.config.format===`json`)s=JSON.stringify({time:o,level:e,...this.config.name?{name:this.config.name}:{},msg:t,...i});else if(this.config.format===`text`){let n=[o,e.toUpperCase(),t];a&&n.push(JSON.stringify(i)),s=n.join(` | `)}else{let n=Kg[e]||``,r=this.config.name?`[${this.config.name}] `:``;s=`${n}${o} ${e.toUpperCase()}${qg} ${r}${t}`,a&&(s+=` ${JSON.stringify(i)}`)}let c=s+`
|
|
103
|
+
`;typeof process<`u`&&process.stderr?e===`error`||e===`fatal`?process.stderr.write(c):process.stdout?.write(c):typeof console<`u`&&(e===`error`||e===`fatal`?console.error:e===`warn`?console.warn:e===`debug`?console.debug:console.log)(s),this.fileStream&&this.fileStream.write(c)}debug(e,t){this.write(`debug`,e,t)}info(e,t){this.write(`info`,e,t)}warn(e,t){this.write(`warn`,e,t)}error(e,t,n){t instanceof Error?this.write(`error`,e,n,t):this.write(`error`,e,t)}fatal(e,t,n){t instanceof Error?this.write(`fatal`,e,n,t):this.write(`fatal`,e,t)}log(e,...t){this.info(e,t.length>0?{args:t}:void 0)}child(t){let n=new e(this.config,{...this.bindings,...t});return n.fileStream=this.fileStream,n}withTrace(e,t){return this.child({traceId:e,spanId:t})}async destroy(){this.fileStream&&=(await new Promise(e=>this.fileStream.end(e)),void 0)}};function Yg(e){return new Jg(e)}var Xg=class{constructor(e,t){this.subscriptions=new Map,this.eventBuffer=[],this._baseUrl=e,this._token=t}subscribeMetadata(e,t,n){let r=`metadata-${e}-${Date.now()}`;return this.subscriptions.set(r,{filter:{type:e,packageId:n?.packageId,eventTypes:[`metadata.${e}.created`,`metadata.${e}.updated`,`metadata.${e}.deleted`]},handler:e=>{e.type.startsWith(`metadata.`)&&t(e)}}),this.startPolling(),()=>{this.subscriptions.delete(r),this.subscriptions.size===0&&this.stopPolling()}}subscribeData(e,t,n){let r=`data-${e}-${Date.now()}`;return this.subscriptions.set(r,{filter:{type:e,recordId:n?.recordId,eventTypes:[`data.record.created`,`data.record.updated`,`data.record.deleted`]},handler:r=>{r.type.startsWith(`data.`)&&r.object===e&&(!n?.recordId||r.payload?.recordId===n.recordId)&&t(r)}}),this.startPolling(),()=>{this.subscriptions.delete(r),this.subscriptions.size===0&&this.stopPolling()}}emitEvent(e){for(let t of this.subscriptions.values()){let n=!t.filter.type||e.type.includes(t.filter.type)||e.object===t.filter.type,r=!t.filter.eventTypes?.length||t.filter.eventTypes.includes(e.type),i=!t.filter.packageId||e.payload?.packageId===t.filter.packageId;if(n&&r&&i)try{t.handler(e)}catch(e){console.error(`Error in realtime event handler:`,e)}}}startPolling(){this.pollInterval||=setInterval(()=>{for(;this.eventBuffer.length>0;){let e=this.eventBuffer.shift();e&&this.emitEvent(e)}},2e3)}stopPolling(){this.pollInterval&&=(clearInterval(this.pollInterval),void 0)}_bufferEvent(e){this.eventBuffer.push(e)}disconnect(){this.stopPolling(),this.subscriptions.clear(),this.eventBuffer=[]}},Zg=class{constructor(e){this.meta={getTypes:async()=>{let e=this.getRoute(`metadata`),t=await this.fetch(`${this.baseUrl}${e}`);return this.unwrapResponse(t)},getItems:async(e,t)=>{let n=this.getRoute(`metadata`),r=new URLSearchParams;t?.packageId&&r.set(`package`,t.packageId);let i=r.toString(),a=`${this.baseUrl}${n}/${e}${i?`?${i}`:``}`,o=await this.fetch(a);return this.unwrapResponse(o)},getItem:async(e,t,n)=>{let r=this.getRoute(`metadata`),i=new URLSearchParams;n?.packageId&&i.set(`package`,n.packageId);let a=i.toString(),o=`${this.baseUrl}${r}/${e}/${t}${a?`?${a}`:``}`,s=await this.fetch(o);return this.unwrapResponse(s)},saveItem:async(e,t,n)=>{let r=this.getRoute(`metadata`),i=await this.fetch(`${this.baseUrl}${r}/${e}/${t}`,{method:`PUT`,body:JSON.stringify(n)});return this.unwrapResponse(i)},deleteItem:async(e,t)=>{let n=this.getRoute(`metadata`),r=await this.fetch(`${this.baseUrl}${n}/${encodeURIComponent(e)}/${encodeURIComponent(t)}`,{method:`DELETE`});return this.unwrapResponse(r)},getHistory:async(e,t,n)=>{let r=this.getRoute(`metadata`),i=new URLSearchParams;n?.sinceSeq!==void 0&&i.set(`sinceSeq`,String(n.sinceSeq)),n?.limit!==void 0&&i.set(`limit`,String(n.limit));let a=i.toString(),o=`${this.baseUrl}${r}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/history${a?`?${a}`:``}`,s=await this.fetch(o);return this.unwrapResponse(s)},getCached:async(e,t)=>{let n=this.getRoute(`metadata`),r={};t?.ifNoneMatch&&(r[`If-None-Match`]=t.ifNoneMatch),t?.ifModifiedSince&&(r[`If-Modified-Since`]=t.ifModifiedSince);let i=await this.fetch(`${this.baseUrl}${n}/object/${e}`,{headers:r});if(i.status===304)return{notModified:!0,etag:t?.ifNoneMatch?{value:t.ifNoneMatch.replace(/^W\/|"/g,``),weak:t.ifNoneMatch.startsWith(`W/`)}:void 0};let a=await i.json(),o=i.headers.get(`ETag`),s=i.headers.get(`Last-Modified`);return{data:a,etag:o?{value:o.replace(/^W\/|"/g,``),weak:o.startsWith(`W/`)}:void 0,lastModified:s||void 0,notModified:!1}},getView:async(e,t=`list`)=>{let n=this.getRoute(`ui`),r=await this.fetch(`${this.baseUrl}${n}/view/${e}?type=${t}`);return this.unwrapResponse(r)}},this.analytics={query:async e=>{let t=this.getRoute(`analytics`);return(await this.fetch(`${this.baseUrl}${t}/query`,{method:`POST`,body:JSON.stringify(e)})).json()},meta:async e=>{let t=this.getRoute(`analytics`);return(await this.fetch(`${this.baseUrl}${t}/meta/${e}`)).json()},explain:async e=>{let t=this.getRoute(`analytics`);return(await this.fetch(`${this.baseUrl}${t}/explain`,{method:`POST`,body:JSON.stringify(e)})).json()}},this.packages={list:async e=>{let t=this.getRoute(`packages`),n=new URLSearchParams;e?.status&&n.set(`status`,e.status),e?.type&&n.set(`type`,e.type),e?.enabled!==void 0&&n.set(`enabled`,String(e.enabled));let r=n.toString(),i=`${this.baseUrl}${t}${r?`?`+r:``}`,a=await this.fetch(i);return this.unwrapResponse(a)},get:async e=>{let t=this.getRoute(`packages`),n=await this.fetch(`${this.baseUrl}${t}/${encodeURIComponent(e)}`);return this.unwrapResponse(n)},install:async(e,t)=>{let n=this.getRoute(`packages`),r=await this.fetch(`${this.baseUrl}${n}`,{method:`POST`,body:JSON.stringify({manifest:e,settings:t?.settings,enableOnInstall:t?.enableOnInstall})});return this.unwrapResponse(r)},uninstall:async e=>{let t=this.getRoute(`packages`),n=await this.fetch(`${this.baseUrl}${t}/${encodeURIComponent(e)}`,{method:`DELETE`});return this.unwrapResponse(n)},enable:async e=>{let t=this.getRoute(`packages`),n=await this.fetch(`${this.baseUrl}${t}/${encodeURIComponent(e)}/enable`,{method:`PATCH`});return this.unwrapResponse(n)},disable:async e=>{let t=this.getRoute(`packages`),n=await this.fetch(`${this.baseUrl}${t}/${encodeURIComponent(e)}/disable`,{method:`PATCH`});return this.unwrapResponse(n)}},this.projects={list:async e=>{let t=new URLSearchParams;e?.organization_id&&t.set(`organizationId`,e.organization_id),e?.env_type&&t.set(`envType`,e.env_type),e?.status&&t.set(`status`,e.status);let n=t.toString(),r=`${this.baseUrl}/api/v1/cloud/environments${n?`?`+n:``}`,i=await this.fetch(r);return this.unwrapResponse(i)},get:async e=>{let t=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}`);return this.unwrapResponse(t)},create:async e=>{let t=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments`,{method:`POST`,body:JSON.stringify(e)});return this.unwrapResponse(t)},update:async(e,t)=>{let n=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}`,{method:`PATCH`,body:JSON.stringify(t)});return this.unwrapResponse(n)},delete:async(e,t)=>{let n=t?.force?`?force=1`:``,r=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}${n}`,{method:`DELETE`});return this.unwrapResponse(r)},activate:async e=>{let t=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/activate`,{method:`POST`});return this.unwrapResponse(t)},rotateCredential:async(e,t)=>{let n=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/credentials/rotate`,{method:`POST`,body:JSON.stringify({plaintext:t})});return this.unwrapResponse(n)},updateHostname:async(e,t)=>{let n=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/hostname`,{method:`POST`,body:JSON.stringify({hostname:t})});return this.unwrapResponse(n)},updateVisibility:async(e,t)=>{let n=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}`,{method:`PATCH`,body:JSON.stringify({visibility:t})});return this.unwrapResponse(n)},listRevisions:async(e,t)=>{let n=new URLSearchParams;t?.limit&&n.set(`limit`,String(t.limit)),t?.cursor&&n.set(`cursor`,t.cursor),t?.branch&&n.set(`branch`,t.branch);let r=n.toString(),i=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/revisions${r?`?${r}`:``}`);return this.unwrapResponse(i)},listBranches:async e=>{let t=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/branches`);return this.unwrapResponse(t)},renameBranch:async(e,t,n)=>{let r=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/branches/${encodeURIComponent(t)}/rename`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({newName:n})});return this.unwrapResponse(r)},deleteBranch:async(e,t)=>{let n=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/branches/${encodeURIComponent(t)}`,{method:`DELETE`});return this.unwrapResponse(n)},activateRevision:async(e,t)=>{let n=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/revisions/${encodeURIComponent(t)}/activate`,{method:`POST`});return this.unwrapResponse(n)},retryProvisioning:async e=>{let t=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/retry`,{method:`POST`});return this.unwrapResponse(t)},listMembers:async e=>{let t=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/members`);return this.unwrapResponse(t)},addMember:async(e,t)=>{let n=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/members`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(t)});return this.unwrapResponse(n)},updateMemberRole:async(e,t,n)=>{let r=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/members/${encodeURIComponent(t)}`,{method:`PATCH`,headers:{"content-type":`application/json`},body:JSON.stringify({role:n})});return this.unwrapResponse(r)},removeMember:async(e,t)=>{let n=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/members/${encodeURIComponent(t)}`,{method:`DELETE`});return this.unwrapResponse(n)},listDrivers:async()=>{let e=await this.fetch(`${this.baseUrl}/api/v1/cloud/drivers`);return this.unwrapResponse(e)},listTemplates:async()=>{let e=await this.fetch(`${this.baseUrl}/api/v1/cloud/templates`);return this.unwrapResponse(e)},packages:{list:async e=>{let t=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/packages`);return this.unwrapResponse(t)},install:async(e,t)=>{let n=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/packages`,{method:`POST`,body:JSON.stringify(t)});return this.unwrapResponse(n)},get:async(e,t)=>{let n=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/packages/${encodeURIComponent(t)}`);return this.unwrapResponse(n)},enable:async(e,t)=>{let n=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/packages/${encodeURIComponent(t)}/enable`,{method:`PATCH`});return this.unwrapResponse(n)},disable:async(e,t)=>{let n=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/packages/${encodeURIComponent(t)}/disable`,{method:`PATCH`});return this.unwrapResponse(n)},uninstall:async(e,t)=>{let n=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/packages/${encodeURIComponent(t)}`,{method:`DELETE`});return this.unwrapResponse(n)},upgrade:async(e,t,n)=>{let r=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/packages/${encodeURIComponent(t)}/upgrade`,{method:`POST`,body:JSON.stringify({targetVersion:n})});return this.unwrapResponse(r)}}},this.organizations={list:async()=>{let e=this.getRoute(`auth`),t=await(await this.fetch(`${this.baseUrl}${e}/organization/list`)).json();return{organizations:Array.isArray(t)?t:t?.data??[]}},create:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/create`,{method:`POST`,body:JSON.stringify(e)})).json()},update:async(e,t)=>{let n=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${n}/organization/update`,{method:`POST`,body:JSON.stringify({organizationId:e,data:t})})).json()},setActive:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/set-active`,{method:`POST`,body:JSON.stringify({organizationId:e})})).json()},get:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/get-full-organization?organizationId=${encodeURIComponent(e)}`)).json()},listMembers:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/list-members?organizationId=${encodeURIComponent(e)}`)).json()},invite:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/invite-member`,{method:`POST`,body:JSON.stringify(e)})).json()},leave:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/leave`,{method:`POST`,body:JSON.stringify({organizationId:e})})).json()},delete:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/delete`,{method:`POST`,body:JSON.stringify({organizationId:e})})).json()},removeMember:async(e,t)=>{let n=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${n}/organization/remove-member`,{method:`POST`,body:JSON.stringify({memberIdOrEmail:t.memberIdOrEmail,organizationId:e})})).json()},updateMemberRole:async(e,t)=>{let n=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${n}/organization/update-member-role`,{method:`POST`,body:JSON.stringify({memberId:t.memberId,role:t.role,organizationId:e})})).json()},getActiveMember:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/get-active-member?organizationId=${encodeURIComponent(e)}`)).json()},invitations:{list:async e=>{let t=this.getRoute(`auth`),n=await(await this.fetch(`${this.baseUrl}${t}/organization/list-invitations?organizationId=${encodeURIComponent(e)}`)).json();return{invitations:Array.isArray(n)?n:n?.data??n?.invitations??[]}},listMine:async()=>{let e=this.getRoute(`auth`),t=await(await this.fetch(`${this.baseUrl}${e}/organization/list-user-invitations`)).json();return{invitations:Array.isArray(t)?t:t?.data??t?.invitations??[]}},cancel:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/cancel-invitation`,{method:`POST`,body:JSON.stringify({invitationId:e})})).json()},accept:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/accept-invitation`,{method:`POST`,body:JSON.stringify({invitationId:e})})).json()},reject:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/reject-invitation`,{method:`POST`,body:JSON.stringify({invitationId:e})})).json()},resend:async e=>{if(e.id)try{await this.organizations.invitations.cancel(e.id)}catch{}return this.organizations.invite({email:e.email,role:e.role??`member`,organizationId:e.organizationId})}},teams:{list:async e=>{let t=this.getRoute(`auth`),n=await(await this.fetch(`${this.baseUrl}${t}/organization/list-teams?organizationId=${encodeURIComponent(e)}`)).json();return{teams:Array.isArray(n)?n:n?.data??n?.teams??[]}},create:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/create-team`,{method:`POST`,body:JSON.stringify(e)})).json()},update:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/update-team`,{method:`POST`,body:JSON.stringify(e)})).json()},delete:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/remove-team`,{method:`POST`,body:JSON.stringify(e)})).json()},listMembers:async e=>{let t=this.getRoute(`auth`),n=await(await this.fetch(`${this.baseUrl}${t}/organization/list-team-members?teamId=${encodeURIComponent(e)}`)).json();return{members:Array.isArray(n)?n:n?.data??n?.members??[]}},addMember:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/add-team-member`,{method:`POST`,body:JSON.stringify(e)})).json()},removeMember:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/remove-team-member`,{method:`POST`,body:JSON.stringify(e)})).json()}}},this.oauth={applications:{register:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/oauth2/create-client`,{method:`POST`,body:JSON.stringify(e)})).json()},get:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/oauth2/get-client?client_id=${encodeURIComponent(e)}`)).json()},getPublic:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/oauth2/public-client?client_id=${encodeURIComponent(e)}`)).json()},list:async()=>{let e=this.getRoute(`auth`),t=await(await this.fetch(`${this.baseUrl}${e}/oauth2/get-clients`)).json();return{applications:Array.isArray(t)?t:t?.clients??t?.data??[]}},delete:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/oauth2/delete-client`,{method:`POST`,body:JSON.stringify({client_id:e})})).json()}},consent:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/oauth2/consent`,{method:`POST`,body:JSON.stringify(e)})).json()}},this.auth={getConfig:async()=>{let e=this.getRoute(`auth`),t=await this.fetch(`${this.baseUrl}${e}/config`);return this.unwrapResponse(t)},login:async e=>{let t=this.getRoute(`auth`),n=await this.fetch(`${this.baseUrl}${t}/sign-in/email`,{method:`POST`,headers:{Origin:this.baseUrl},body:JSON.stringify(e)}),r=await n.json().catch(()=>({}));if(!n.ok){let e=r?.message||r?.error?.message||`Login failed (HTTP ${n.status})`,t=Error(e);throw r?.code&&(t.code=r.code),t.status=n.status,t}let i=r&&(r.data??(r.token||r.user?{token:r.token,user:r.user}:void 0)),a=i?{...r,data:i}:r;return a.data?.token&&(this.token=a.data.token),a},logout:async()=>{let e=this.getRoute(`auth`);await this.fetch(`${this.baseUrl}${e}/sign-out`,{method:`POST`,headers:{"Content-Type":`application/json`,Origin:this.baseUrl},body:`{}`}),this.token=void 0},me:async()=>{let e=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${e}/get-session`,{headers:{Origin:this.baseUrl}})).json()},register:async e=>{let t=this.getRoute(`auth`),n=await(await this.fetch(`${this.baseUrl}${t}/sign-up/email`,{method:`POST`,headers:{Origin:this.baseUrl},body:JSON.stringify(e)})).json(),r=n&&(n.data??(n.token||n.user?{token:n.token,user:n.user}:void 0)),i=r?{...n,data:r}:n;return i.data?.token&&(this.token=i.data.token),i},signInWithProvider:async(e,t)=>{if(typeof window>`u`)throw Error(`signInWithProvider requires a browser environment`);let n=this.getRoute(`auth`),r=t?.callbackURL??window.location.origin+`/login`,i=t?.type===`oidc`,a=i?`/sign-in/oauth2`:`/sign-in/social`,o=i?{providerId:e,callbackURL:r}:{provider:e,callbackURL:r};t?.errorCallbackURL&&(o.errorCallbackURL=t.errorCallbackURL);let s=await(await this.fetch(`${this.baseUrl}${n}${a}`,{method:`POST`,body:JSON.stringify(o)})).json(),c=s?.url??s?.data?.url;if(c)window.location.assign(c);else throw Error(`signInWithProvider: no redirect URL returned for provider "${e}"`)},refreshToken:async e=>{let t=this.getRoute(`auth`),n=await(await this.fetch(`${this.baseUrl}${t}/get-session`,{method:`GET`})).json();return n.data?.token&&(this.token=n.data.token),n},bootstrapStatus:async()=>{let e=this.getRoute(`auth`),t=await(await this.fetch(`${this.baseUrl}${e}/bootstrap-status`)).json();return{hasOwner:!!(t?.data??t)?.hasOwner}},updateUser:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/update-user`,{method:`POST`,body:JSON.stringify(e)})).json()},changePassword:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/change-password`,{method:`POST`,body:JSON.stringify(e)})).json()},changeEmail:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/change-email`,{method:`POST`,body:JSON.stringify(e)})).json()},sendVerificationEmail:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/send-verification-email`,{method:`POST`,body:JSON.stringify(e)})).json()},verifyEmail:async e=>{let t=this.getRoute(`auth`),n=new URL(`${this.baseUrl}${t}/verify-email`);return n.searchParams.set(`token`,e.token),e.callbackURL&&n.searchParams.set(`callbackURL`,e.callbackURL),(await this.fetch(n.toString())).json()},deleteUser:async e=>{let t=this.getRoute(`auth`),n=await this.fetch(`${this.baseUrl}${t}/delete-user`,{method:`POST`,body:JSON.stringify(e)});return this.token=void 0,n.json()},sessions:{list:async()=>{let e=this.getRoute(`auth`),t=await(await this.fetch(`${this.baseUrl}${e}/list-sessions`)).json();return{sessions:Array.isArray(t)?t:t?.data??t?.sessions??[]}},revoke:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/revoke-session`,{method:`POST`,body:JSON.stringify({token:e})})).json()},revokeOthers:async()=>{let e=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${e}/revoke-other-sessions`,{method:`POST`,body:`{}`})).json()},revokeAll:async()=>{let e=this.getRoute(`auth`),t=await this.fetch(`${this.baseUrl}${e}/revoke-sessions`,{method:`POST`,body:`{}`});return this.token=void 0,t.json()}},twoFactor:{enable:async e=>{let t=this.getRoute(`auth`),n=await(await this.fetch(`${this.baseUrl}${t}/two-factor/enable`,{method:`POST`,body:JSON.stringify(e)})).json();return n?.data??n},verifyTotp:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/two-factor/verify-totp`,{method:`POST`,body:JSON.stringify(e)})).json()},disable:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/two-factor/disable`,{method:`POST`,body:JSON.stringify(e)})).json()},generateBackupCodes:async e=>{let t=this.getRoute(`auth`),n=await(await this.fetch(`${this.baseUrl}${t}/two-factor/generate-backup-codes`,{method:`POST`,body:JSON.stringify(e)})).json();return n?.data??n},verifyBackupCode:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/two-factor/verify-backup-code`,{method:`POST`,body:JSON.stringify(e)})).json()}},accounts:{list:async()=>{let e=this.getRoute(`auth`),t=await(await this.fetch(`${this.baseUrl}${e}/list-accounts`)).json();return{accounts:Array.isArray(t)?t:t?.data??t?.accounts??[]}},unlink:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/unlink-account`,{method:`POST`,body:JSON.stringify(e)})).json()},linkSocial:async e=>{let t=this.getRoute(`auth`),n=e.callbackURL??(typeof window<`u`?window.location.href:void 0),r=await(await this.fetch(`${this.baseUrl}${t}/link-social`,{method:`POST`,body:JSON.stringify({provider:e.provider,callbackURL:n})})).json();return r?.data??r}}},this.storage={upload:async(e,t=`user`)=>{let n={filename:e.name,mimeType:e.type,size:e.size,scope:t},r=this.getRoute(`storage`),{data:i}=await(await this.fetch(`${this.baseUrl}${r}/upload/presigned`,{method:`POST`,body:JSON.stringify(n)})).json(),a=await this.fetchImpl(i.uploadUrl,{method:i.method,headers:i.headers,body:e});if(!a.ok)throw Error(`Storage Upload Failed: ${a.statusText}`);let o={fileId:i.fileId};return(await this.fetch(`${this.baseUrl}${r}/upload/complete`,{method:`POST`,body:JSON.stringify(o)})).json()},getDownloadUrl:async e=>{let t=this.getRoute(`storage`);return(await(await this.fetch(`${this.baseUrl}${t}/files/${e}/url`)).json()).url},getPresignedUrl:async e=>{let t=this.getRoute(`storage`);return(await this.fetch(`${this.baseUrl}${t}/upload/presigned`,{method:`POST`,body:JSON.stringify(e)})).json()},initChunkedUpload:async e=>{let t=this.getRoute(`storage`);return(await this.fetch(`${this.baseUrl}${t}/upload/chunked`,{method:`POST`,body:JSON.stringify(e)})).json()},uploadPart:async(e,t,n,r)=>{let i=this.getRoute(`storage`);return(await this.fetch(`${this.baseUrl}${i}/upload/chunked/${e}/chunk/${t}`,{method:`PUT`,headers:{"x-resume-token":n},body:r})).json()},completeChunkedUpload:async e=>{let t=this.getRoute(`storage`);return(await this.fetch(`${this.baseUrl}${t}/upload/chunked/${e.uploadId}/complete`,{method:`POST`,body:JSON.stringify(e)})).json()},resumeUpload:async(e,t,n,r)=>{let i=this.getRoute(`storage`),{totalChunks:a,uploadedChunks:o}=(await(await this.fetch(`${this.baseUrl}${i}/upload/chunked/${e}/progress`)).json()).data,s=[],c=t instanceof ArrayBuffer?t:await t.arrayBuffer();for(let t=o;t<a;t++){let i=t*n,a=Math.min(i+n,c.byteLength),o=new Blob([c.slice(i,a)]),l=await this.storage.uploadPart(e,t,r,o);s.push({chunkIndex:t,eTag:l.data.eTag})}return this.storage.completeChunkedUpload({uploadId:e,parts:s})}},this.automation={trigger:async(e,t)=>{let n=this.getRoute(`automation`);return(await this.fetch(`${this.baseUrl}${n}/trigger/${e}`,{method:`POST`,body:JSON.stringify(t)})).json()},list:async()=>{let e=this.getRoute(`automation`),t=await this.fetch(`${this.baseUrl}${e}`);return this.unwrapResponse(t)},get:async e=>{let t=this.getRoute(`automation`),n=await this.fetch(`${this.baseUrl}${t}/${e}`);return this.unwrapResponse(n)},create:async(e,t)=>{let n=this.getRoute(`automation`),r=await this.fetch(`${this.baseUrl}${n}`,{method:`POST`,body:JSON.stringify({name:e,...t})});return this.unwrapResponse(r)},update:async(e,t)=>{let n=this.getRoute(`automation`),r=await this.fetch(`${this.baseUrl}${n}/${e}`,{method:`PUT`,body:JSON.stringify({definition:t})});return this.unwrapResponse(r)},delete:async e=>{let t=this.getRoute(`automation`),n=await this.fetch(`${this.baseUrl}${t}/${e}`,{method:`DELETE`});return this.unwrapResponse(n)},toggle:async(e,t)=>{let n=this.getRoute(`automation`),r=await this.fetch(`${this.baseUrl}${n}/${e}/toggle`,{method:`POST`,body:JSON.stringify({enabled:t})});return this.unwrapResponse(r)},runs:{list:async(e,t)=>{let n=this.getRoute(`automation`),r=new URLSearchParams;t?.limit&&r.set(`limit`,String(t.limit)),t?.cursor&&r.set(`cursor`,t.cursor);let i=r.toString(),a=await this.fetch(`${this.baseUrl}${n}/${e}/runs${i?`?${i}`:``}`);return this.unwrapResponse(a)},get:async(e,t)=>{let n=this.getRoute(`automation`),r=await this.fetch(`${this.baseUrl}${n}/${e}/runs/${t}`);return this.unwrapResponse(r)}},getFlow:async e=>{let t=this.getRoute(`automation`),n=await this.fetch(`${this.baseUrl}${t}/${encodeURIComponent(e)}`);return this.unwrapResponse(n)},execute:async(e,t)=>{let n=this.getRoute(`automation`),r=await this.fetch(`${this.baseUrl}${n}/${encodeURIComponent(e)}/trigger`,{method:`POST`,body:JSON.stringify(t??{})});return this.unwrapResponse(r)},listRuns:async(e,t)=>{let n=this.getRoute(`automation`),r=new URLSearchParams;t?.limit!=null&&r.set(`limit`,String(t.limit)),t?.cursor&&r.set(`cursor`,t.cursor);let i=r.toString(),a=await this.fetch(`${this.baseUrl}${n}/${encodeURIComponent(e)}/runs${i?`?${i}`:``}`);return this.unwrapResponse(a)},getRun:async(e,t)=>{let n=this.getRoute(`automation`),r=await this.fetch(`${this.baseUrl}${n}/${encodeURIComponent(e)}/runs/${encodeURIComponent(t)}`);return this.unwrapResponse(r)}},this.permissions={check:async e=>{let t=this.getRoute(`permissions`),n=new URLSearchParams({object:e.object,action:e.action});e.recordId!==void 0&&n.set(`recordId`,e.recordId),e.field!==void 0&&n.set(`field`,e.field);let r=await this.fetch(`${this.baseUrl}${t}/check?${n.toString()}`);return this.unwrapResponse(r)},getObjectPermissions:async e=>{let t=this.getRoute(`permissions`),n=await this.fetch(`${this.baseUrl}${t}/objects/${encodeURIComponent(e)}`);return this.unwrapResponse(n)},getEffectivePermissions:async()=>{let e=this.getRoute(`permissions`),t=await this.fetch(`${this.baseUrl}${e}/effective`);return this.unwrapResponse(t)}},this.realtime={connect:async e=>{let t=this.getRoute(`realtime`),n=await this.fetch(`${this.baseUrl}${t}/connect`,{method:`POST`,body:JSON.stringify(e||{})});return this.unwrapResponse(n)},disconnect:async()=>{let e=this.getRoute(`realtime`);await this.fetch(`${this.baseUrl}${e}/disconnect`,{method:`POST`})},subscribe:async e=>{let t=this.getRoute(`realtime`),n=await this.fetch(`${this.baseUrl}${t}/subscribe`,{method:`POST`,body:JSON.stringify(e)});return this.unwrapResponse(n)},unsubscribe:async e=>{let t=this.getRoute(`realtime`);await this.fetch(`${this.baseUrl}${t}/unsubscribe`,{method:`POST`,body:JSON.stringify({subscriptionId:e})})},setPresence:async(e,t)=>{let n=this.getRoute(`realtime`);await this.fetch(`${this.baseUrl}${n}/presence`,{method:`PUT`,body:JSON.stringify({channel:e,state:t})})},getPresence:async e=>{let t=this.getRoute(`realtime`),n=await this.fetch(`${this.baseUrl}${t}/presence/${encodeURIComponent(e)}`);return this.unwrapResponse(n)}},this.workflow={getConfig:async e=>{let t=this.getRoute(`workflow`),n=await this.fetch(`${this.baseUrl}${t}/${encodeURIComponent(e)}/config`);return this.unwrapResponse(n)},getState:async(e,t)=>{let n=this.getRoute(`workflow`),r=await this.fetch(`${this.baseUrl}${n}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/state`);return this.unwrapResponse(r)},transition:async e=>{let t=this.getRoute(`workflow`),n=await this.fetch(`${this.baseUrl}${t}/${encodeURIComponent(e.object)}/${encodeURIComponent(e.recordId)}/transition`,{method:`POST`,body:JSON.stringify({transition:e.transition,comment:e.comment,data:e.data})});return this.unwrapResponse(n)},approve:async e=>{let t=this.getRoute(`workflow`),n=await this.fetch(`${this.baseUrl}${t}/${encodeURIComponent(e.object)}/${encodeURIComponent(e.recordId)}/approve`,{method:`POST`,body:JSON.stringify({comment:e.comment,data:e.data})});return this.unwrapResponse(n)},reject:async e=>{let t=this.getRoute(`workflow`),n=await this.fetch(`${this.baseUrl}${t}/${encodeURIComponent(e.object)}/${encodeURIComponent(e.recordId)}/reject`,{method:`POST`,body:JSON.stringify({reason:e.reason,comment:e.comment})});return this.unwrapResponse(n)}},this.views={list:async(e,t)=>{let n=this.getRoute(`views`),r=new URLSearchParams;t&&r.set(`type`,t);let i=r.toString(),a=await this.fetch(`${this.baseUrl}${n}/${encodeURIComponent(e)}${i?`?${i}`:``}`);return this.unwrapResponse(a)},get:async(e,t)=>{let n=this.getRoute(`views`),r=await this.fetch(`${this.baseUrl}${n}/${encodeURIComponent(e)}/${encodeURIComponent(t)}`);return this.unwrapResponse(r)},create:async(e,t)=>{let n=this.getRoute(`views`),r=await this.fetch(`${this.baseUrl}${n}/${encodeURIComponent(e)}`,{method:`POST`,body:JSON.stringify({object:e,data:t})});return this.unwrapResponse(r)},update:async(e,t,n)=>{let r=this.getRoute(`views`),i=await this.fetch(`${this.baseUrl}${r}/${encodeURIComponent(e)}/${encodeURIComponent(t)}`,{method:`PUT`,body:JSON.stringify({object:e,viewId:t,data:n})});return this.unwrapResponse(i)},delete:async(e,t)=>{let n=this.getRoute(`views`),r=await this.fetch(`${this.baseUrl}${n}/${encodeURIComponent(e)}/${encodeURIComponent(t)}`,{method:`DELETE`});return this.unwrapResponse(r)}},this.notifications={registerDevice:async e=>{let t=this.getRoute(`notifications`),n=await this.fetch(`${this.baseUrl}${t}/devices`,{method:`POST`,body:JSON.stringify(e)});return this.unwrapResponse(n)},unregisterDevice:async e=>{let t=this.getRoute(`notifications`),n=await this.fetch(`${this.baseUrl}${t}/devices/${encodeURIComponent(e)}`,{method:`DELETE`});return this.unwrapResponse(n)},getPreferences:async()=>{let e=this.getRoute(`notifications`),t=await this.fetch(`${this.baseUrl}${e}/preferences`);return this.unwrapResponse(t)},updatePreferences:async e=>{let t=this.getRoute(`notifications`),n=await this.fetch(`${this.baseUrl}${t}/preferences`,{method:`PUT`,body:JSON.stringify({preferences:e})});return this.unwrapResponse(n)},list:async e=>{let t=this.getRoute(`notifications`),n=new URLSearchParams;e?.read!==void 0&&n.set(`read`,String(e.read)),e?.type&&n.set(`type`,e.type),e?.limit&&n.set(`limit`,String(e.limit)),e?.cursor&&n.set(`cursor`,e.cursor);let r=n.toString(),i=await this.fetch(`${this.baseUrl}${t}${r?`?${r}`:``}`);return this.unwrapResponse(i)},markRead:async e=>{let t=this.getRoute(`notifications`),n=await this.fetch(`${this.baseUrl}${t}/read`,{method:`POST`,body:JSON.stringify({ids:e})});return this.unwrapResponse(n)},markAllRead:async()=>{let e=this.getRoute(`notifications`),t=await this.fetch(`${this.baseUrl}${e}/read/all`,{method:`POST`});return this.unwrapResponse(t)}},this.ai={nlq:async e=>{let t=this.getRoute(`ai`),n=await this.fetch(`${this.baseUrl}${t}/nlq`,{method:`POST`,body:JSON.stringify(e)});return this.unwrapResponse(n)},suggest:async e=>{let t=this.getRoute(`ai`),n=await this.fetch(`${this.baseUrl}${t}/suggest`,{method:`POST`,body:JSON.stringify(e)});return this.unwrapResponse(n)},insights:async e=>{let t=this.getRoute(`ai`),n=await this.fetch(`${this.baseUrl}${t}/insights`,{method:`POST`,body:JSON.stringify(e)});return this.unwrapResponse(n)}},this.i18n={getLocales:async()=>{let e=this.getRoute(`i18n`),t=await this.fetch(`${this.baseUrl}${e}/locales`);return this.unwrapResponse(t)},getTranslations:async(e,t)=>{let n=this.getRoute(`i18n`),r=new URLSearchParams;r.set(`locale`,e),t?.namespace&&r.set(`namespace`,t.namespace),t?.keys&&r.set(`keys`,t.keys.join(`,`));let i=await this.fetch(`${this.baseUrl}${n}/translations?${r.toString()}`);return this.unwrapResponse(i)},getFieldLabels:async(e,t)=>{let n=this.getRoute(`i18n`),r=await this.fetch(`${this.baseUrl}${n}/labels/${encodeURIComponent(e)}?locale=${encodeURIComponent(t)}`);return this.unwrapResponse(r)}},this.feed={list:async(e,t,n)=>{let r=this.getRoute(`data`),i=new URLSearchParams;n?.type&&i.set(`type`,n.type),n?.limit&&i.set(`limit`,String(n.limit)),n?.cursor&&i.set(`cursor`,n.cursor);let a=i.toString(),o=await this.fetch(`${this.baseUrl}${r}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/feed${a?`?${a}`:``}`);return this.unwrapResponse(o)},create:async(e,t,n)=>{let r=this.getRoute(`data`),i=await this.fetch(`${this.baseUrl}${r}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/feed`,{method:`POST`,body:JSON.stringify(n)});return this.unwrapResponse(i)},update:async(e,t,n,r)=>{let i=this.getRoute(`data`),a=await this.fetch(`${this.baseUrl}${i}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/feed/${encodeURIComponent(n)}`,{method:`PUT`,body:JSON.stringify(r)});return this.unwrapResponse(a)},delete:async(e,t,n)=>{let r=this.getRoute(`data`),i=await this.fetch(`${this.baseUrl}${r}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/feed/${encodeURIComponent(n)}`,{method:`DELETE`});return this.unwrapResponse(i)},addReaction:async(e,t,n,r)=>{let i=this.getRoute(`data`),a=await this.fetch(`${this.baseUrl}${i}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/feed/${encodeURIComponent(n)}/reactions`,{method:`POST`,body:JSON.stringify({emoji:r})});return this.unwrapResponse(a)},removeReaction:async(e,t,n,r)=>{let i=this.getRoute(`data`),a=await this.fetch(`${this.baseUrl}${i}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/feed/${encodeURIComponent(n)}/reactions/${encodeURIComponent(r)}`,{method:`DELETE`});return this.unwrapResponse(a)},pin:async(e,t,n)=>{let r=this.getRoute(`data`),i=await this.fetch(`${this.baseUrl}${r}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/feed/${encodeURIComponent(n)}/pin`,{method:`POST`});return this.unwrapResponse(i)},unpin:async(e,t,n)=>{let r=this.getRoute(`data`),i=await this.fetch(`${this.baseUrl}${r}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/feed/${encodeURIComponent(n)}/pin`,{method:`DELETE`});return this.unwrapResponse(i)},star:async(e,t,n)=>{let r=this.getRoute(`data`),i=await this.fetch(`${this.baseUrl}${r}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/feed/${encodeURIComponent(n)}/star`,{method:`POST`});return this.unwrapResponse(i)},unstar:async(e,t,n)=>{let r=this.getRoute(`data`),i=await this.fetch(`${this.baseUrl}${r}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/feed/${encodeURIComponent(n)}/star`,{method:`DELETE`});return this.unwrapResponse(i)},search:async(e,t,n,r)=>{let i=this.getRoute(`data`),a=new URLSearchParams;a.set(`query`,n),r?.type&&a.set(`type`,r.type),r?.actorId&&a.set(`actorId`,r.actorId),r?.dateFrom&&a.set(`dateFrom`,r.dateFrom),r?.dateTo&&a.set(`dateTo`,r.dateTo),r?.limit&&a.set(`limit`,String(r.limit)),r?.cursor&&a.set(`cursor`,r.cursor);let o=await this.fetch(`${this.baseUrl}${i}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/feed/search?${a.toString()}`);return this.unwrapResponse(o)},getChangelog:async(e,t,n)=>{let r=this.getRoute(`data`),i=new URLSearchParams;n?.field&&i.set(`field`,n.field),n?.actorId&&i.set(`actorId`,n.actorId),n?.dateFrom&&i.set(`dateFrom`,n.dateFrom),n?.dateTo&&i.set(`dateTo`,n.dateTo),n?.limit&&i.set(`limit`,String(n.limit)),n?.cursor&&i.set(`cursor`,n.cursor);let a=i.toString(),o=await this.fetch(`${this.baseUrl}${r}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/changelog${a?`?${a}`:``}`);return this.unwrapResponse(o)},subscribe:async(e,t,n)=>{let r=this.getRoute(`data`),i=await this.fetch(`${this.baseUrl}${r}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/subscribe`,{method:`POST`,body:JSON.stringify(n||{})});return this.unwrapResponse(i)},unsubscribe:async(e,t)=>{let n=this.getRoute(`data`),r=await this.fetch(`${this.baseUrl}${n}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/subscribe`,{method:`DELETE`});return this.unwrapResponse(r)}},this.data={query:async(e,t)=>{let n=this.getRoute(`data`),r=await this.fetch(`${this.baseUrl}${n}/${e}/query`,{method:`POST`,body:JSON.stringify(t)});return this.unwrapResponse(r)},find:async(e,t={})=>{let n=this.getRoute(`data`),r=new URLSearchParams,i=t,a={};if(`where`in t||`fields`in t||`orderBy`in t||`offset`in t?(i.where&&(a.filter=i.where),i.fields&&(a.select=i.fields),i.orderBy&&(a.sort=i.orderBy),i.limit!=null&&(a.top=i.limit),i.offset!=null&&(a.skip=i.offset),i.aggregations&&(a.aggregations=i.aggregations),i.groupBy&&(a.groupBy=i.groupBy)):Object.assign(a,t),a.top&&r.set(`top`,a.top.toString()),a.skip&&r.set(`skip`,a.skip.toString()),a.sort)if(Array.isArray(a.sort)&&typeof a.sort[0]==`object`)r.set(`sort`,JSON.stringify(a.sort));else{let e=Array.isArray(a.sort)?a.sort.join(`,`):a.sort;r.set(`sort`,e)}a.select&&r.set(`select`,a.select.join(`,`));let o=a.filter??a.filters;o&&(this.isFilterAST(o)||Array.isArray(o)?r.set(`filter`,JSON.stringify(o)):typeof o==`object`&&o&&Object.entries(o).forEach(([e,t])=>{t!=null&&r.append(e,String(t))})),a.aggregations&&r.set(`aggregations`,JSON.stringify(a.aggregations)),a.groupBy&&r.set(`groupBy`,a.groupBy.join(`,`));let s=await this.fetch(`${this.baseUrl}${n}/${e}?${r.toString()}`);return this.unwrapResponse(s)},get:async(e,t)=>{let n=this.getRoute(`data`),r=await this.fetch(`${this.baseUrl}${n}/${e}/${t}`);return this.unwrapResponse(r)},create:async(e,t)=>{let n=this.getRoute(`data`),r=await this.fetch(`${this.baseUrl}${n}/${e}`,{method:`POST`,body:JSON.stringify(t)});return this.unwrapResponse(r)},createMany:async(e,t)=>{let n=this.getRoute(`data`),r=await this.fetch(`${this.baseUrl}${n}/${e}/createMany`,{method:`POST`,body:JSON.stringify(t)});return this.unwrapResponse(r)},update:async(e,t,n,r)=>{let i=this.getRoute(`data`),a={};r?.ifMatch&&(a[`If-Match`]=String(r.ifMatch));let o=await this.fetch(`${this.baseUrl}${i}/${e}/${t}`,{method:`PATCH`,body:JSON.stringify(n),...Object.keys(a).length?{headers:a}:{}});return this.unwrapResponse(o)},batch:async(e,t)=>{let n=this.getRoute(`data`),r=await this.fetch(`${this.baseUrl}${n}/${e}/batch`,{method:`POST`,body:JSON.stringify(t)});return this.unwrapResponse(r)},updateMany:async(e,t,n)=>{let r=this.getRoute(`data`),i={records:t,options:n},a=await this.fetch(`${this.baseUrl}${r}/${e}/updateMany`,{method:`POST`,body:JSON.stringify(i)});return this.unwrapResponse(a)},delete:async(e,t,n)=>{let r=this.getRoute(`data`),i={};n?.ifMatch&&(i[`If-Match`]=String(n.ifMatch));let a=await this.fetch(`${this.baseUrl}${r}/${e}/${t}`,{method:`DELETE`,...Object.keys(i).length?{headers:i}:{}});return this.unwrapResponse(a)},deleteMany:async(e,t,n)=>{let r=this.getRoute(`data`),i={ids:t,options:n},a=await this.fetch(`${this.baseUrl}${r}/${e}/deleteMany`,{method:`POST`,body:JSON.stringify(i)});return this.unwrapResponse(a)}},this.baseUrl=e.baseUrl.replace(/\/$/,``),this.token=e.token,this.environmentId=e.environmentId,this.locale=e.locale,this.fetchImpl=e.fetch||globalThis.fetch.bind(globalThis),this.logger=e.logger||Yg({level:e.debug?`debug`:`info`,format:`pretty`}),this.realtimeAPI=new Xg(this.baseUrl,this.token),this.logger.debug(`ObjectStack client created`,{baseUrl:this.baseUrl})}async connect(){this.logger.debug(`Connecting to ObjectStack server`,{baseUrl:this.baseUrl});try{let e;try{let t=`${this.baseUrl}/api/v1/discovery`;this.logger.debug(`Probing protocol-standard discovery endpoint`,{url:t});let n=await this.fetchImpl(t);if(n.ok){let t=await n.json();e=t.data||t,this.logger.debug(`Discovered via /api/v1/discovery`)}}catch(e){this.logger.debug(`Protocol-standard discovery probe failed`,{error:e.message})}if(!e){let t;try{t=`${new URL(this.baseUrl).origin}/.well-known/objectstack`}catch{t=`/.well-known/objectstack`}this.logger.debug(`Falling back to .well-known discovery`,{url:t});let n=await this.fetchImpl(t);if(!n.ok)throw Error(`Failed to connect to ${t}: ${n.statusText}`);let r=await n.json();e=r.data||r}if(!e)throw Error(`Connection failed: No discovery data returned`);return this.discoveryInfo=e,this.logger.info(`Connected to ObjectStack server`,{version:e.version,apiName:e.apiName,services:e.services}),e}catch(e){throw this.logger.error(`Failed to connect to ObjectStack server`,e,{baseUrl:this.baseUrl}),e}}get capabilities(){let e=this.discoveryInfo?.capabilities;if(!e)return;let t={};for(let[n,r]of Object.entries(e))t[n]=typeof r==`object`&&r?!!r.enabled:!!r;return t}project(e){if(!e)throw Error(`[ObjectStack] project(id): environmentId is required`);return new Qg(this,e)}_baseUrl(){return this.baseUrl}_fetch(e,t){return this.fetch(e,t)}_unwrap(e){return this.unwrapResponse(e)}_isFilterAST(e){return this.isFilterAST(e)}setProjectId(e){this.environmentId=e,this.logger.debug(`Active project changed`,{environmentId:e})}getProjectId(){return this.environmentId}setLocale(e){this.locale=e,this.logger.debug(`Active locale changed`,{locale:e})}getLocale(){return this.locale}get events(){return this.realtimeAPI}isFilterAST(e){return $f(e)}async unwrapResponse(e){let t=await e.json();return t&&typeof t.success==`boolean`&&`data`in t?t.data:t}async fetch(e,t={}){this.logger.debug(`HTTP request`,{method:t.method||`GET`,url:e,hasBody:!!t.body});let n={"Content-Type":`application/json`,...t.headers||{}};this.token&&(n.Authorization=`Bearer ${this.token}`),this.environmentId&&(n[`X-Environment-Id`]=this.environmentId),this.locale&&!Object.keys(n).some(e=>e.toLowerCase()===`accept-language`)&&(n[`Accept-Language`]=this.locale);let r=await this.fetchImpl(e,{...t,headers:n});if(this.logger.debug(`HTTP response`,{method:t.method||`GET`,url:e,status:r.status,ok:r.ok}),!r.ok){let n;try{n=await r.json()}catch{n={message:r.statusText}}this.logger.error(`HTTP request failed`,void 0,{method:t.method||`GET`,url:e,status:r.status,error:n});let i=n?.message??n?.error?.message??(typeof n?.error==`string`?n.error:void 0)??r.statusText,a=n?.code||n?.error?.code,o=Error(`[ObjectStack] ${a?`${a}: `:``}${i}`);throw o.code=a,o.category=n?.category,o.httpStatus=r.status,o.retryable=n?.retryable,o.details=n?.details||n,o}return r}getRoute(e){let t=this.discoveryInfo?.routes;if(t){let n=t[e];if(n)return n}return{data:`/api/v1/data`,metadata:`/api/v1/meta`,discovery:`/api/v1/discovery`,ui:`/api/v1/ui`,auth:`/api/v1/auth`,analytics:`/api/v1/analytics`,storage:`/api/v1/storage`,automation:`/api/v1/automation`,packages:`/api/v1/packages`,permissions:`/api/v1/permissions`,realtime:`/api/v1/realtime`,workflow:`/api/v1/workflow`,views:`/api/v1/ui/views`,notifications:`/api/v1/notifications`,ai:`/api/v1/ai`,i18n:`/api/v1/i18n`,feed:`/api/v1/feed`,graphql:`/graphql`}[e]||`/api/v1/${e}`}},Qg=class{constructor(e,t){this.meta={getTypes:async()=>{let e=await this.parent._fetch(this.url(`/meta`));return this.parent._unwrap(e)},getItems:async(e,t)=>{let n=new URLSearchParams;t?.packageId&&n.set(`package`,t.packageId);let r=n.toString(),i=await this.parent._fetch(this.url(`/meta/${e}${r?`?${r}`:``}`));return this.parent._unwrap(i)},getItem:async(e,t,n)=>{let r=new URLSearchParams;n?.packageId&&r.set(`package`,n.packageId);let i=r.toString(),a=await this.parent._fetch(this.url(`/meta/${e}/${t}${i?`?${i}`:``}`));return this.parent._unwrap(a)},saveItem:async(e,t,n)=>{let r=await this.parent._fetch(this.url(`/meta/${e}/${t}`),{method:`PUT`,body:JSON.stringify(n)});return this.parent._unwrap(r)},deleteItem:async(e,t)=>{let n=await this.parent._fetch(this.url(`/meta/${encodeURIComponent(e)}/${encodeURIComponent(t)}`),{method:`DELETE`});return this.parent._unwrap(n)},getHistory:async(e,t,n)=>{let r=new URLSearchParams;n?.sinceSeq!==void 0&&r.set(`sinceSeq`,String(n.sinceSeq)),n?.limit!==void 0&&r.set(`limit`,String(n.limit));let i=r.toString(),a=await this.parent._fetch(this.url(`/meta/${encodeURIComponent(e)}/${encodeURIComponent(t)}/history${i?`?${i}`:``}`));return this.parent._unwrap(a)}},this.data={query:async(e,t)=>{let n=await this.parent._fetch(this.url(`/data/${e}/query`),{method:`POST`,body:JSON.stringify(t)});return this.parent._unwrap(n)},find:async(e,t={})=>{let n=new URLSearchParams,r=t,i={};if(`where`in t||`fields`in t||`orderBy`in t||`offset`in t?(r.where&&(i.filter=r.where),r.fields&&(i.select=r.fields),r.orderBy&&(i.sort=r.orderBy),r.limit!=null&&(i.top=r.limit),r.offset!=null&&(i.skip=r.offset),r.aggregations&&(i.aggregations=r.aggregations),r.groupBy&&(i.groupBy=r.groupBy)):Object.assign(i,t),i.top&&n.set(`top`,i.top.toString()),i.skip&&n.set(`skip`,i.skip.toString()),i.sort)if(Array.isArray(i.sort)&&typeof i.sort[0]==`object`)n.set(`sort`,JSON.stringify(i.sort));else{let e=Array.isArray(i.sort)?i.sort.join(`,`):i.sort;n.set(`sort`,e)}i.select&&n.set(`select`,i.select.join(`,`));let a=i.filter??i.filters;a&&(this.parent._isFilterAST(a)||Array.isArray(a)?n.set(`filter`,JSON.stringify(a)):typeof a==`object`&&a&&Object.entries(a).forEach(([e,t])=>{t!=null&&n.append(e,String(t))})),i.aggregations&&n.set(`aggregations`,JSON.stringify(i.aggregations)),i.groupBy&&n.set(`groupBy`,i.groupBy.join(`,`));let o=n.toString(),s=await this.parent._fetch(this.url(`/data/${e}${o?`?${o}`:``}`));return this.parent._unwrap(s)},get:async(e,t)=>{let n=await this.parent._fetch(this.url(`/data/${e}/${t}`));return this.parent._unwrap(n)},create:async(e,t)=>{let n=await this.parent._fetch(this.url(`/data/${e}`),{method:`POST`,body:JSON.stringify(t)});return this.parent._unwrap(n)},createMany:async(e,t)=>{let n=await this.parent._fetch(this.url(`/data/${e}/createMany`),{method:`POST`,body:JSON.stringify(t)});return this.parent._unwrap(n)},update:async(e,t,n)=>{let r=await this.parent._fetch(this.url(`/data/${e}/${t}`),{method:`PATCH`,body:JSON.stringify(n)});return this.parent._unwrap(r)},batch:async(e,t)=>{let n=await this.parent._fetch(this.url(`/data/${e}/batch`),{method:`POST`,body:JSON.stringify(t)});return this.parent._unwrap(n)},updateMany:async(e,t,n)=>{let r={records:t,options:n},i=await this.parent._fetch(this.url(`/data/${e}/updateMany`),{method:`POST`,body:JSON.stringify(r)});return this.parent._unwrap(i)},delete:async(e,t)=>{let n=await this.parent._fetch(this.url(`/data/${e}/${t}`),{method:`DELETE`});return this.parent._unwrap(n)},deleteMany:async(e,t,n)=>{let r={ids:t,options:n},i=await this.parent._fetch(this.url(`/data/${e}/deleteMany`),{method:`POST`,body:JSON.stringify(r)});return this.parent._unwrap(i)}},this.packages={list:async()=>{let e=await this.parent._fetch(this.url(`/packages`));return this.parent._unwrap(e)},get:async(e,t)=>{let n=t?`?version=${encodeURIComponent(t)}`:``,r=await this.parent._fetch(this.url(`/packages/${encodeURIComponent(e)}${n}`));return this.parent._unwrap(r)}},this.automation={getFlow:async e=>{let t=await this.parent._fetch(this.url(`/automation/${encodeURIComponent(e)}`));return this.parent._unwrap(t)},execute:async(e,t)=>{let n=await this.parent._fetch(this.url(`/automation/${encodeURIComponent(e)}/trigger`),{method:`POST`,body:JSON.stringify(t??{})});return this.parent._unwrap(n)},listRuns:async(e,t)=>{let n=new URLSearchParams;t?.limit!=null&&n.set(`limit`,String(t.limit)),t?.cursor&&n.set(`cursor`,t.cursor);let r=n.toString(),i=await this.parent._fetch(this.url(`/automation/${encodeURIComponent(e)}/runs${r?`?${r}`:``}`));return this.parent._unwrap(i)},getRun:async(e,t)=>{let n=await this.parent._fetch(this.url(`/automation/${encodeURIComponent(e)}/runs/${encodeURIComponent(t)}`));return this.parent._unwrap(n)}},this.parent=e,this.environmentId=t}getProjectId(){return this.environmentId}scope(){return`/api/v1/environments/${encodeURIComponent(this.environmentId)}`}url(e){return`${this.parent._baseUrl()}${this.scope()}${e}`}},$g=(0,j.createContext)(null),e_=(0,j.createContext)(void 0);function t_({client:e,locale:t,children:n}){let r=(0,j.useRef)(null);return(r.current?.client!==e||r.current?.locale!==t)&&(r.current={client:e,locale:t},e.setLocale?.(t)),j.createElement($g.Provider,{value:e},j.createElement(e_.Provider,{value:t},n))}function n_(){let e=(0,j.useContext)($g);if(!e)throw Error(`useClient must be used within an ObjectStackProvider. Make sure your component is wrapped with <ObjectStackProvider client={...}>.`);return e}var r_=1,i_=1e6,a_=0;function o_(){return a_=(a_+1)%(2**53-1),a_.toString()}var s_=new Map,c_=e=>{if(s_.has(e))return;let t=setTimeout(()=>{s_.delete(e),f_({type:`REMOVE_TOAST`,toastId:e})},i_);s_.set(e,t)},l_=(e,t)=>{switch(t.type){case`ADD_TOAST`:return{...e,toasts:[t.toast,...e.toasts].slice(0,r_)};case`UPDATE_TOAST`:return{...e,toasts:e.toasts.map(e=>e.id===t.toast.id?{...e,...t.toast}:e)};case`DISMISS_TOAST`:{let{toastId:n}=t;return n?c_(n):e.toasts.forEach(e=>{c_(e.id)}),{...e,toasts:e.toasts.map(e=>e.id===n||n===void 0?{...e,open:!1}:e)}}case`REMOVE_TOAST`:return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(e=>e.id!==t.toastId)}}},u_=[],d_={toasts:[]};function f_(e){d_=l_(d_,e),u_.forEach(e=>{e(d_)})}function q({...e}){let t=o_(),n=e=>f_({type:`UPDATE_TOAST`,toast:{...e,id:t}}),r=()=>f_({type:`DISMISS_TOAST`,toastId:t});return f_({type:`ADD_TOAST`,toast:{...e,id:t,open:!0,onOpenChange:e=>{e||r()}}}),{id:t,dismiss:r,update:n}}function p_(){let[e,t]=j.useState(d_);return j.useEffect(()=>(u_.push(t),()=>{let e=u_.indexOf(t);e>-1&&u_.splice(e,1)}),[e]),{...e,toast:q,dismiss:e=>f_({type:`DISMISS_TOAST`,toastId:e})}}typeof window<`u`&&window.document&&window.document.createElement;function J(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r.defaultPrevented)return t?.(r)}}function m_(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function h_(...e){return t=>{let n=!1,r=e.map(e=>{let r=m_(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():m_(e[t],null)}}}}function g_(...e){return j.useCallback(h_(...e),e)}function __(e,t){let n=j.createContext(t),r=e=>{let{children:t,...r}=e,i=j.useMemo(()=>r,Object.values(r));return(0,M.jsx)(n.Provider,{value:i,children:t})};r.displayName=e+`Provider`;function i(r){let i=j.useContext(n);if(i)return i;if(t!==void 0)return t;throw Error(`\`${r}\` must be used within \`${e}\``)}return[r,i]}function v_(e,t=[]){let n=[];function r(t,r){let i=j.createContext(r),a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=j.useMemo(()=>o,Object.values(o));return(0,M.jsx)(s.Provider,{value:c,children:r})};o.displayName=t+`Provider`;function s(n,o){let s=o?.[e]?.[a]||i,c=j.useContext(s);if(c)return c;if(r!==void 0)return r;throw Error(`\`${n}\` must be used within \`${t}\``)}return[o,s]}let i=()=>{let t=n.map(e=>j.createContext(e));return function(n){let r=n?.[e]||t;return j.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,y_(i,...t)]}function y_(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return j.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}function b_(e){let t=x_(e),n=j.forwardRef((e,n)=>{let{children:r,...i}=e,a=j.Children.toArray(r),o=a.find(w_);if(o){let e=o.props.children,r=a.map(t=>t===o?j.Children.count(e)>1?j.Children.only(null):j.isValidElement(e)?e.props.children:null:t);return(0,M.jsx)(t,{...i,ref:n,children:j.isValidElement(e)?j.cloneElement(e,void 0,r):null})}return(0,M.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function x_(e){let t=j.forwardRef((e,t)=>{let{children:n,...r}=e;if(j.isValidElement(n)){let e=E_(n),i=T_(r,n.props);return n.type!==j.Fragment&&(i.ref=t?h_(t,e):e),j.cloneElement(n,i)}return j.Children.count(n)>1?j.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var S_=Symbol(`radix.slottable`);function C_(e){let t=({children:e})=>(0,M.jsx)(M.Fragment,{children:e});return t.displayName=`${e}.Slottable`,t.__radixId=S_,t}function w_(e){return j.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===S_}function T_(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function E_(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function D_(e){let t=e+`CollectionProvider`,[n,r]=v_(t),[i,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=e=>{let{scope:t,children:n}=e,r=j.useRef(null),a=j.useRef(new Map).current;return(0,M.jsx)(i,{scope:t,itemMap:a,collectionRef:r,children:n})};o.displayName=t;let s=e+`CollectionSlot`,c=b_(s),l=j.forwardRef((e,t)=>{let{scope:n,children:r}=e;return(0,M.jsx)(c,{ref:g_(t,a(s,n).collectionRef),children:r})});l.displayName=s;let u=e+`CollectionItemSlot`,d=`data-radix-collection-item`,f=b_(u),p=j.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=j.useRef(null),s=g_(t,o),c=a(u,n);return j.useEffect(()=>(c.itemMap.set(o,{ref:o,...i}),()=>void c.itemMap.delete(o))),(0,M.jsx)(f,{[d]:``,ref:s,children:r})});p.displayName=u;function m(t){let n=a(e+`CollectionConsumer`,t);return j.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${d}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return[{Provider:o,Slot:l,ItemSlot:p},m,r]}var O_=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=b_(`Primitive.${t}`),r=j.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,M.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function k_(e,t){e&&Gi.flushSync(()=>e.dispatchEvent(t))}function A_(e){let t=j.useRef(e);return j.useEffect(()=>{t.current=e}),j.useMemo(()=>(...e)=>t.current?.(...e),[])}function j_(e,t=globalThis?.document){let n=A_(e);j.useEffect(()=>{let e=e=>{e.key===`Escape`&&n(e)};return t.addEventListener(`keydown`,e,{capture:!0}),()=>t.removeEventListener(`keydown`,e,{capture:!0})},[n,t])}var M_=`DismissableLayer`,N_=`dismissableLayer.update`,P_=`dismissableLayer.pointerDownOutside`,F_=`dismissableLayer.focusOutside`,I_,L_=j.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),R_=j.forwardRef((e,t)=>{let{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:a,onInteractOutside:o,onDismiss:s,...c}=e,l=j.useContext(L_),[u,d]=j.useState(null),f=u?.ownerDocument??globalThis?.document,[,p]=j.useState({}),m=g_(t,e=>d(e)),h=Array.from(l.layers),[g]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),_=h.indexOf(g),v=u?h.indexOf(u):-1,y=l.layersWithOutsidePointerEventsDisabled.size>0,b=v>=_,x=V_(e=>{let t=e.target,n=[...l.branches].some(e=>e.contains(t));!b||n||(i?.(e),o?.(e),e.defaultPrevented||s?.())},f),S=H_(e=>{let t=e.target;[...l.branches].some(e=>e.contains(t))||(a?.(e),o?.(e),e.defaultPrevented||s?.())},f);return j_(e=>{v===l.layers.size-1&&(r?.(e),!e.defaultPrevented&&s&&(e.preventDefault(),s()))},f),j.useEffect(()=>{if(u)return n&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(I_=f.body.style.pointerEvents,f.body.style.pointerEvents=`none`),l.layersWithOutsidePointerEventsDisabled.add(u)),l.layers.add(u),U_(),()=>{n&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=I_)}},[u,f,n,l]),j.useEffect(()=>()=>{u&&(l.layers.delete(u),l.layersWithOutsidePointerEventsDisabled.delete(u),U_())},[u,l]),j.useEffect(()=>{let e=()=>p({});return document.addEventListener(N_,e),()=>document.removeEventListener(N_,e)},[]),(0,M.jsx)(O_.div,{...c,ref:m,style:{pointerEvents:y?b?`auto`:`none`:void 0,...e.style},onFocusCapture:J(e.onFocusCapture,S.onFocusCapture),onBlurCapture:J(e.onBlurCapture,S.onBlurCapture),onPointerDownCapture:J(e.onPointerDownCapture,x.onPointerDownCapture)})});R_.displayName=M_;var z_=`DismissableLayerBranch`,B_=j.forwardRef((e,t)=>{let n=j.useContext(L_),r=j.useRef(null),i=g_(t,r);return j.useEffect(()=>{let e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),(0,M.jsx)(O_.div,{...e,ref:i})});B_.displayName=z_;function V_(e,t=globalThis?.document){let n=A_(e),r=j.useRef(!1),i=j.useRef(()=>{});return j.useEffect(()=>{let e=e=>{if(e.target&&!r.current){let r=function(){W_(P_,n,a,{discrete:!0})},a={originalEvent:e};e.pointerType===`touch`?(t.removeEventListener(`click`,i.current),i.current=r,t.addEventListener(`click`,i.current,{once:!0})):r()}else t.removeEventListener(`click`,i.current);r.current=!1},a=window.setTimeout(()=>{t.addEventListener(`pointerdown`,e)},0);return()=>{window.clearTimeout(a),t.removeEventListener(`pointerdown`,e),t.removeEventListener(`click`,i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function H_(e,t=globalThis?.document){let n=A_(e),r=j.useRef(!1);return j.useEffect(()=>{let e=e=>{e.target&&!r.current&&W_(F_,n,{originalEvent:e},{discrete:!1})};return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function U_(){let e=new CustomEvent(N_);document.dispatchEvent(e)}function W_(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?k_(i,a):i.dispatchEvent(a)}var G_=R_,K_=B_,q_=globalThis?.document?j.useLayoutEffect:()=>{},J_=`Portal`,Y_=j.forwardRef((e,t)=>{let{container:n,...r}=e,[i,a]=j.useState(!1);q_(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?Gi.createPortal((0,M.jsx)(O_.div,{...r,ref:t}),o):null});Y_.displayName=J_;function X_(e,t){return j.useReducer((e,n)=>t[e][n]??e,e)}var Z_=e=>{let{present:t,children:n}=e,r=Q_(t),i=typeof n==`function`?n({present:r.isPresent}):j.Children.only(n),a=g_(r.ref,ev(i));return typeof n==`function`||r.isPresent?j.cloneElement(i,{ref:a}):null};Z_.displayName=`Presence`;function Q_(e){let[t,n]=j.useState(),r=j.useRef(null),i=j.useRef(e),a=j.useRef(`none`),[o,s]=X_(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return j.useEffect(()=>{let e=$_(r.current);a.current=o===`mounted`?e:`none`},[o]),q_(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,o=$_(t);e?s(`MOUNT`):o===`none`||t?.display===`none`?s(`UNMOUNT`):s(n&&r!==o?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,s]),q_(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=a=>{let o=$_(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(s(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},c=e=>{e.target===t&&(a.current=$_(r.current))};return t.addEventListener(`animationstart`,c),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,c),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}else s(`ANIMATION_END`)},[t,s]),{isPresent:[`mounted`,`unmountSuspended`].includes(o),ref:j.useCallback(e=>{r.current=e?getComputedStyle(e):null,n(e)},[])}}function $_(e){return e?.animationName||`none`}function ev(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var tv=j.useInsertionEffect||q_;function nv({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){let[i,a,o]=rv({defaultProp:t,onChange:n}),s=e!==void 0,c=s?e:i;{let t=j.useRef(e!==void 0);j.useEffect(()=>{let e=t.current;e!==s&&console.warn(`${r} is changing from ${e?`controlled`:`uncontrolled`} to ${s?`controlled`:`uncontrolled`}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),t.current=s},[s,r])}return[c,j.useCallback(t=>{if(s){let n=iv(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}function rv({defaultProp:e,onChange:t}){let[n,r]=j.useState(e),i=j.useRef(n),a=j.useRef(t);return tv(()=>{a.current=t},[t]),j.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}function iv(e){return typeof e==`function`}var av=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),ov=`VisuallyHidden`,sv=j.forwardRef((e,t)=>(0,M.jsx)(O_.span,{...e,ref:t,style:{...av,...e.style}}));sv.displayName=ov;var cv=sv,lv=`ToastProvider`,[uv,dv,fv]=D_(`Toast`),[pv,mv]=v_(`Toast`,[fv]),[hv,gv]=pv(lv),_v=e=>{let{__scopeToast:t,label:n=`Notification`,duration:r=5e3,swipeDirection:i=`right`,swipeThreshold:a=50,children:o}=e,[s,c]=j.useState(null),[l,u]=j.useState(0),d=j.useRef(!1),f=j.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${lv}\`. Expected non-empty \`string\`.`),(0,M.jsx)(uv.Provider,{scope:t,children:(0,M.jsx)(hv,{scope:t,label:n,duration:r,swipeDirection:i,swipeThreshold:a,toastCount:l,viewport:s,onViewportChange:c,onToastAdd:j.useCallback(()=>u(e=>e+1),[]),onToastRemove:j.useCallback(()=>u(e=>e-1),[]),isFocusedToastEscapeKeyDownRef:d,isClosePausedRef:f,children:o})})};_v.displayName=lv;var vv=`ToastViewport`,yv=[`F8`],bv=`toast.viewportPause`,xv=`toast.viewportResume`,Sv=j.forwardRef((e,t)=>{let{__scopeToast:n,hotkey:r=yv,label:i=`Notifications ({hotkey})`,...a}=e,o=gv(vv,n),s=dv(n),c=j.useRef(null),l=j.useRef(null),u=j.useRef(null),d=j.useRef(null),f=g_(t,d,o.onViewportChange),p=r.join(`+`).replace(/Key/g,``).replace(/Digit/g,``),m=o.toastCount>0;j.useEffect(()=>{let e=e=>{r.length!==0&&r.every(t=>e[t]||e.code===t)&&d.current?.focus()};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[r]),j.useEffect(()=>{let e=c.current,t=d.current;if(m&&e&&t){let n=()=>{if(!o.isClosePausedRef.current){let e=new CustomEvent(bv);t.dispatchEvent(e),o.isClosePausedRef.current=!0}},r=()=>{if(o.isClosePausedRef.current){let e=new CustomEvent(xv);t.dispatchEvent(e),o.isClosePausedRef.current=!1}},i=t=>{e.contains(t.relatedTarget)||r()},a=()=>{e.contains(document.activeElement)||r()};return e.addEventListener(`focusin`,n),e.addEventListener(`focusout`,i),e.addEventListener(`pointermove`,n),e.addEventListener(`pointerleave`,a),window.addEventListener(`blur`,n),window.addEventListener(`focus`,r),()=>{e.removeEventListener(`focusin`,n),e.removeEventListener(`focusout`,i),e.removeEventListener(`pointermove`,n),e.removeEventListener(`pointerleave`,a),window.removeEventListener(`blur`,n),window.removeEventListener(`focus`,r)}}},[m,o.isClosePausedRef]);let h=j.useCallback(({tabbingDirection:e})=>{let t=s().map(t=>{let n=t.ref.current,r=[n,...Yv(n)];return e===`forwards`?r:r.reverse()});return(e===`forwards`?t.reverse():t).flat()},[s]);return j.useEffect(()=>{let e=d.current;if(e){let t=t=>{let n=t.altKey||t.ctrlKey||t.metaKey;if(t.key===`Tab`&&!n){let n=document.activeElement,r=t.shiftKey;if(t.target===e&&r){l.current?.focus();return}let i=h({tabbingDirection:r?`backwards`:`forwards`}),a=i.findIndex(e=>e===n);Xv(i.slice(a+1))?t.preventDefault():r?l.current?.focus():u.current?.focus()}};return e.addEventListener(`keydown`,t),()=>e.removeEventListener(`keydown`,t)}},[s,h]),(0,M.jsxs)(K_,{ref:c,role:`region`,"aria-label":i.replace(`{hotkey}`,p),tabIndex:-1,style:{pointerEvents:m?void 0:`none`},children:[m&&(0,M.jsx)(wv,{ref:l,onFocusFromOutsideViewport:()=>{Xv(h({tabbingDirection:`forwards`}))}}),(0,M.jsx)(uv.Slot,{scope:n,children:(0,M.jsx)(O_.ol,{tabIndex:-1,...a,ref:f})}),m&&(0,M.jsx)(wv,{ref:u,onFocusFromOutsideViewport:()=>{Xv(h({tabbingDirection:`backwards`}))}})]})});Sv.displayName=vv;var Cv=`ToastFocusProxy`,wv=j.forwardRef((e,t)=>{let{__scopeToast:n,onFocusFromOutsideViewport:r,...i}=e,a=gv(Cv,n);return(0,M.jsx)(sv,{tabIndex:0,...i,ref:t,style:{position:`fixed`},onFocus:e=>{let t=e.relatedTarget;a.viewport?.contains(t)||r()}})});wv.displayName=Cv;var Tv=`Toast`,Ev=`toast.swipeStart`,Dv=`toast.swipeMove`,Ov=`toast.swipeCancel`,kv=`toast.swipeEnd`,Av=j.forwardRef((e,t)=>{let{forceMount:n,open:r,defaultOpen:i,onOpenChange:a,...o}=e,[s,c]=nv({prop:r,defaultProp:i??!0,onChange:a,caller:Tv});return(0,M.jsx)(Z_,{present:n||s,children:(0,M.jsx)(Nv,{open:s,...o,ref:t,onClose:()=>c(!1),onPause:A_(e.onPause),onResume:A_(e.onResume),onSwipeStart:J(e.onSwipeStart,e=>{e.currentTarget.setAttribute(`data-swipe`,`start`)}),onSwipeMove:J(e.onSwipeMove,e=>{let{x:t,y:n}=e.detail.delta;e.currentTarget.setAttribute(`data-swipe`,`move`),e.currentTarget.style.setProperty(`--radix-toast-swipe-move-x`,`${t}px`),e.currentTarget.style.setProperty(`--radix-toast-swipe-move-y`,`${n}px`)}),onSwipeCancel:J(e.onSwipeCancel,e=>{e.currentTarget.setAttribute(`data-swipe`,`cancel`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-move-x`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-move-y`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-end-x`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-end-y`)}),onSwipeEnd:J(e.onSwipeEnd,e=>{let{x:t,y:n}=e.detail.delta;e.currentTarget.setAttribute(`data-swipe`,`end`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-move-x`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-move-y`),e.currentTarget.style.setProperty(`--radix-toast-swipe-end-x`,`${t}px`),e.currentTarget.style.setProperty(`--radix-toast-swipe-end-y`,`${n}px`),c(!1)})})})});Av.displayName=Tv;var[jv,Mv]=pv(Tv,{onClose(){}}),Nv=j.forwardRef((e,t)=>{let{__scopeToast:n,type:r=`foreground`,duration:i,open:a,onClose:o,onEscapeKeyDown:s,onPause:c,onResume:l,onSwipeStart:u,onSwipeMove:d,onSwipeCancel:f,onSwipeEnd:p,...m}=e,h=gv(Tv,n),[g,_]=j.useState(null),v=g_(t,e=>_(e)),y=j.useRef(null),b=j.useRef(null),x=i||h.duration,S=j.useRef(0),C=j.useRef(x),w=j.useRef(0),{onToastAdd:T,onToastRemove:E}=h,D=A_(()=>{g?.contains(document.activeElement)&&h.viewport?.focus(),o()}),O=j.useCallback(e=>{!e||e===1/0||(window.clearTimeout(w.current),S.current=new Date().getTime(),w.current=window.setTimeout(D,e))},[D]);j.useEffect(()=>{let e=h.viewport;if(e){let t=()=>{O(C.current),l?.()},n=()=>{let e=new Date().getTime()-S.current;C.current-=e,window.clearTimeout(w.current),c?.()};return e.addEventListener(bv,n),e.addEventListener(xv,t),()=>{e.removeEventListener(bv,n),e.removeEventListener(xv,t)}}},[h.viewport,x,c,l,O]),j.useEffect(()=>{a&&!h.isClosePausedRef.current&&O(x)},[a,x,h.isClosePausedRef,O]),j.useEffect(()=>(T(),()=>E()),[T,E]);let ee=j.useMemo(()=>g?Wv(g):null,[g]);return h.viewport?(0,M.jsxs)(M.Fragment,{children:[ee&&(0,M.jsx)(Pv,{__scopeToast:n,role:`status`,"aria-live":r===`foreground`?`assertive`:`polite`,children:ee}),(0,M.jsx)(jv,{scope:n,onClose:D,children:Gi.createPortal((0,M.jsx)(uv.ItemSlot,{scope:n,children:(0,M.jsx)(G_,{asChild:!0,onEscapeKeyDown:J(s,()=>{h.isFocusedToastEscapeKeyDownRef.current||D(),h.isFocusedToastEscapeKeyDownRef.current=!1}),children:(0,M.jsx)(O_.li,{tabIndex:0,"data-state":a?`open`:`closed`,"data-swipe-direction":h.swipeDirection,...m,ref:v,style:{userSelect:`none`,touchAction:`none`,...e.style},onKeyDown:J(e.onKeyDown,e=>{e.key===`Escape`&&(s?.(e.nativeEvent),e.nativeEvent.defaultPrevented||(h.isFocusedToastEscapeKeyDownRef.current=!0,D()))}),onPointerDown:J(e.onPointerDown,e=>{e.button===0&&(y.current={x:e.clientX,y:e.clientY})}),onPointerMove:J(e.onPointerMove,e=>{if(!y.current)return;let t=e.clientX-y.current.x,n=e.clientY-y.current.y,r=!!b.current,i=[`left`,`right`].includes(h.swipeDirection),a=[`left`,`up`].includes(h.swipeDirection)?Math.min:Math.max,o=i?a(0,t):0,s=i?0:a(0,n),c=e.pointerType===`touch`?10:2,l={x:o,y:s},f={originalEvent:e,delta:l};r?(b.current=l,Gv(Dv,d,f,{discrete:!1})):Kv(l,h.swipeDirection,c)?(b.current=l,Gv(Ev,u,f,{discrete:!1}),e.target.setPointerCapture(e.pointerId)):(Math.abs(t)>c||Math.abs(n)>c)&&(y.current=null)}),onPointerUp:J(e.onPointerUp,e=>{let t=b.current,n=e.target;if(n.hasPointerCapture(e.pointerId)&&n.releasePointerCapture(e.pointerId),b.current=null,y.current=null,t){let n=e.currentTarget,r={originalEvent:e,delta:t};Kv(t,h.swipeDirection,h.swipeThreshold)?Gv(kv,p,r,{discrete:!0}):Gv(Ov,f,r,{discrete:!0}),n.addEventListener(`click`,e=>e.preventDefault(),{once:!0})}})})})}),h.viewport)})]}):null}),Pv=e=>{let{__scopeToast:t,children:n,...r}=e,i=gv(Tv,t),[a,o]=j.useState(!1),[s,c]=j.useState(!1);return qv(()=>o(!0)),j.useEffect(()=>{let e=window.setTimeout(()=>c(!0),1e3);return()=>window.clearTimeout(e)},[]),s?null:(0,M.jsx)(Y_,{asChild:!0,children:(0,M.jsx)(sv,{...r,children:a&&(0,M.jsxs)(M.Fragment,{children:[i.label,` `,n]})})})},Fv=`ToastTitle`,Iv=j.forwardRef((e,t)=>{let{__scopeToast:n,...r}=e;return(0,M.jsx)(O_.div,{...r,ref:t})});Iv.displayName=Fv;var Lv=`ToastDescription`,Rv=j.forwardRef((e,t)=>{let{__scopeToast:n,...r}=e;return(0,M.jsx)(O_.div,{...r,ref:t})});Rv.displayName=Lv;var zv=`ToastAction`,Bv=j.forwardRef((e,t)=>{let{altText:n,...r}=e;return n.trim()?(0,M.jsx)(Uv,{altText:n,asChild:!0,children:(0,M.jsx)(Hv,{...r,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${zv}\`. Expected non-empty \`string\`.`),null)});Bv.displayName=zv;var Vv=`ToastClose`,Hv=j.forwardRef((e,t)=>{let{__scopeToast:n,...r}=e,i=Mv(Vv,n);return(0,M.jsx)(Uv,{asChild:!0,children:(0,M.jsx)(O_.button,{type:`button`,...r,ref:t,onClick:J(e.onClick,i.onClose)})})});Hv.displayName=Vv;var Uv=j.forwardRef((e,t)=>{let{__scopeToast:n,altText:r,...i}=e;return(0,M.jsx)(O_.div,{"data-radix-toast-announce-exclude":``,"data-radix-toast-announce-alt":r||void 0,...i,ref:t})});function Wv(e){let t=[];return Array.from(e.childNodes).forEach(e=>{if(e.nodeType===e.TEXT_NODE&&e.textContent&&t.push(e.textContent),Jv(e)){let n=e.ariaHidden||e.hidden||e.style.display===`none`,r=e.dataset.radixToastAnnounceExclude===``;if(!n)if(r){let n=e.dataset.radixToastAnnounceAlt;n&&t.push(n)}else t.push(...Wv(e))}}),t}function Gv(e,t,n,{discrete:r}){let i=n.originalEvent.currentTarget,a=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?k_(i,a):i.dispatchEvent(a)}var Kv=(e,t,n=0)=>{let r=Math.abs(e.x),i=Math.abs(e.y),a=r>i;return t===`left`||t===`right`?a&&r>n:!a&&i>n};function qv(e=()=>{}){let t=A_(e);q_(()=>{let e=0,n=0;return e=window.requestAnimationFrame(()=>n=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(e),window.cancelAnimationFrame(n)}},[t])}function Jv(e){return e.nodeType===e.ELEMENT_NODE}function Yv(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Xv(e){let t=document.activeElement;return e.some(e=>e===t?!0:(e.focus(),document.activeElement!==t))}var Zv=_v,Qv=Sv,$v=Av,ey=Iv,ty=Rv,ny=Bv,ry=Hv;function iy(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=iy(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function ay(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=iy(e))&&(r&&(r+=` `),r+=t);return r}var oy=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,sy=ay,cy=(e,t)=>n=>{if(t?.variants==null)return sy(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=oy(t)||oy(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return sy(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},ly=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),uy=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),dy=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),fy=e=>{let t=dy(e);return t.charAt(0).toUpperCase()+t.slice(1)},py={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},my=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},hy=(0,j.createContext)({}),gy=()=>(0,j.useContext)(hy),_y=(0,j.forwardRef)(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>{let{size:l=24,strokeWidth:u=2,absoluteStrokeWidth:d=!1,color:f=`currentColor`,className:p=``}=gy()??{},m=r??d?Number(n??u)*24/Number(t??l):n??u;return(0,j.createElement)(`svg`,{ref:c,...py,width:t??l??py.width,height:t??l??py.height,stroke:e??f,strokeWidth:m,className:ly(`lucide`,p,i),...!a&&!my(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,j.createElement)(e,t)),...Array.isArray(a)?a:[a]])}),vy=(e,t)=>{let n=(0,j.forwardRef)(({className:n,...r},i)=>(0,j.createElement)(_y,{ref:i,iconNode:t,className:ly(`lucide-${uy(fy(e))}`,`lucide-${e}`,n),...r}));return n.displayName=fy(e),n},yy=vy(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),by=vy(`building-2`,[[`path`,{d:`M10 12h4`,key:`a56b0p`}],[`path`,{d:`M10 8h4`,key:`1sr2af`}],[`path`,{d:`M14 21v-3a2 2 0 0 0-4 0v3`,key:`1rgiei`}],[`path`,{d:`M6 10H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-2`,key:`secmi2`}],[`path`,{d:`M6 21V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v16`,key:`16ra0t`}]]),xy=vy(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),Sy=vy(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),Cy=vy(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),wy=vy(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),Ty=vy(`chevrons-up-down`,[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]),Ey=vy(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Dy=vy(`circle-user-round`,[[`path`,{d:`M17.925 20.056a6 6 0 0 0-11.851.001`,key:`z69sun`}],[`circle`,{cx:`12`,cy:`11`,r:`4`,key:`1gt34v`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),Oy=vy(`circle-x`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),ky=vy(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),Ay=vy(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),jy=vy(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),My=vy(`ellipsis-vertical`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]]),Ny=vy(`gallery-vertical-end`,[[`path`,{d:`M7 2h10`,key:`nczekb`}],[`path`,{d:`M5 6h14`,key:`u2x4p`}],[`rect`,{width:`18`,height:`12`,x:`3`,y:`10`,rx:`2`,key:`l0tzu3`}]]),Py=vy(`globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),Fy=vy(`house`,[[`path`,{d:`M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8`,key:`5wwlr5`}],[`path`,{d:`M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z`,key:`r6nss1`}]]),Iy=vy(`inbox`,[[`polyline`,{points:`22 12 16 12 14 15 10 15 8 12 2 12`,key:`o97t9d`}],[`path`,{d:`M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`oot6mr`}]]),Ly=vy(`key-round`,[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]),Ry=vy(`languages`,[[`path`,{d:`m5 8 6 6`,key:`1wu5hv`}],[`path`,{d:`m4 14 6-6 2-3`,key:`1k1g8d`}],[`path`,{d:`M2 5h12`,key:`or177f`}],[`path`,{d:`M7 2h1`,key:`1t2jsx`}],[`path`,{d:`m22 22-5-10-5 10`,key:`don7ne`}],[`path`,{d:`M14 18h6`,key:`1m8k6r`}]]),zy=vy(`link-2-off`,[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7`,key:`10o201`}],[`path`,{d:`M15 7h2a5 5 0 0 1 4 8`,key:`1d3206`}],[`line`,{x1:`8`,x2:`12`,y1:`12`,y2:`12`,key:`rvw6j4`}],[`line`,{x1:`2`,x2:`22`,y1:`2`,y2:`22`,key:`a6p6uj`}]]),By=vy(`link-2`,[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7h2`,key:`8i5ue5`}],[`path`,{d:`M15 7h2a5 5 0 1 1 0 10h-2`,key:`1b9ql8`}],[`line`,{x1:`8`,x2:`16`,y1:`12`,y2:`12`,key:`1jonct`}]]),Vy=vy(`log-out`,[[`path`,{d:`m16 17 5-5-5-5`,key:`1bji2h`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}]]),Hy=vy(`mail-check`,[[`path`,{d:`M22 13V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h8`,key:`12jkf8`}],[`path`,{d:`m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7`,key:`1ocrg3`}],[`path`,{d:`m16 19 2 2 4-4`,key:`1b14m6`}]]),Uy=vy(`mail`,[[`path`,{d:`m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7`,key:`132q7q`}],[`rect`,{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`,key:`izxlao`}]]),Wy=vy(`monitor`,[[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`line`,{x1:`8`,x2:`16`,y1:`21`,y2:`21`,key:`1svkeh`}],[`line`,{x1:`12`,x2:`12`,y1:`17`,y2:`21`,key:`vw1qmm`}]]),Gy=vy(`moon`,[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]),Ky=vy(`panel-left`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}]]),qy=vy(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),Jy=vy(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),Yy=vy(`save`,[[`path`,{d:`M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z`,key:`1c8476`}],[`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`,key:`1ydtos`}],[`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`,key:`t51u73`}]]),Xy=vy(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),Zy=vy(`shield-check`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Qy=vy(`shield`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}]]),$y=vy(`smartphone`,[[`rect`,{width:`14`,height:`20`,x:`5`,y:`2`,rx:`2`,ry:`2`,key:`1yt0o3`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}]]),eb=vy(`sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),tb=vy(`tablet`,[[`rect`,{width:`16`,height:`20`,x:`4`,y:`2`,rx:`2`,ry:`2`,key:`76otgf`}],[`line`,{x1:`12`,x2:`12.01`,y1:`18`,y2:`18`,key:`1dp563`}]]),nb=vy(`trash-2`,[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]),rb=vy(`triangle-alert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),ib=vy(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),ab=vy(`user-minus`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}],[`line`,{x1:`22`,x2:`16`,y1:`11`,y2:`11`,key:`1shjgl`}]]),ob=vy(`user-plus`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}],[`line`,{x1:`19`,x2:`19`,y1:`8`,y2:`14`,key:`1bvyxn`}],[`line`,{x1:`22`,x2:`16`,y1:`11`,y2:`11`,key:`1shjgl`}]]),sb=vy(`users-round`,[[`path`,{d:`M18 21a8 8 0 0 0-16 0`,key:`3ypg7q`}],[`circle`,{cx:`10`,cy:`8`,r:`5`,key:`o932ke`}],[`path`,{d:`M22 20c0-3.37-2-6.5-4-8a5 5 0 0 0-.45-8.3`,key:`10s06x`}]]),cb=vy(`user`,[[`path`,{d:`M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2`,key:`975kel`}],[`circle`,{cx:`12`,cy:`7`,r:`4`,key:`17ys0d`}]]),lb=vy(`users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),ub=vy(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),db=(e,t)=>{let n=Array(e.length+t.length);for(let t=0;t<e.length;t++)n[t]=e[t];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},fb=(e,t)=>({classGroupId:e,validator:t}),pb=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),mb=`-`,hb=[],gb=`arbitrary..`,_b=e=>{let t=bb(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return yb(e);let n=e.split(mb);return vb(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?db(i,t):t:i||hb}return n[e]||hb}}},vb=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=vb(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(mb):e.slice(t).join(mb),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},yb=e=>e.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?gb+r:void 0})(),bb=e=>{let{theme:t,classGroups:n}=e;return xb(n,t)},xb=(e,t)=>{let n=pb();for(let r in e){let i=e[r];Sb(i,n,r,t)}return n},Sb=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];Cb(i,t,n,r)}},Cb=(e,t,n,r)=>{if(typeof e==`string`){wb(e,t,n);return}if(typeof e==`function`){Tb(e,t,n,r);return}Eb(e,t,n,r)},wb=(e,t,n)=>{let r=e===``?t:Db(t,e);r.classGroupId=n},Tb=(e,t,n,r)=>{if(Ob(e)){Sb(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(fb(n,e))},Eb=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];Sb(o,Db(t,a),n,r)}},Db=(e,t)=>{let n=e,r=t.split(mb),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=pb(),n.nextPart.set(t,i)),n=i}return n},Ob=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,kb=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return i(e,t),t},set(e,t){e in n?n[e]=t:i(e,t)}}},Ab=`!`,jb=`:`,Mb=[],Nb=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),Pb=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,i=0,a,o=e.length;for(let s=0;s<o;s++){let o=e[s];if(n===0&&r===0){if(o===jb){t.push(e.slice(i,s)),i=s+1;continue}if(o===`/`){a=s;continue}}o===`[`?n++:o===`]`?n--:o===`(`?r++:o===`)`&&r--}let s=t.length===0?e:e.slice(i),c=s,l=!1;s.endsWith(Ab)?(c=s.slice(0,-1),l=!0):s.startsWith(Ab)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return Nb(t,l,c,u)};if(t){let e=t+jb,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):Nb(Mb,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},Fb=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let i=0;i<e.length;i++){let a=e[i],o=a[0]===`[`,s=t.has(a);o||s?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(a)):r.push(a)}return r.length>0&&(r.sort(),n.push(...r)),n}},Ib=e=>({cache:kb(e.cacheSize),parseClassName:Pb(e),sortModifiers:Fb(e),postfixLookupClassGroupIds:Lb(e),..._b(e)}),Lb=e=>{let t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let e=0;e<n.length;e++)t[n[e]]=!0;return t},Rb=/\s+/,zb=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a,postfixLookupClassGroupIds:o}=t,s=[],c=e.trim().split(Rb),l=``;for(let e=c.length-1;e>=0;--e){let t=c[e],{isExternal:u,modifiers:d,hasImportantModifier:f,baseClassName:p,maybePostfixModifierPosition:m}=n(t);if(u){l=t+(l.length>0?` `+l:l);continue}let h=!!m,g;if(h){g=r(p.substring(0,m));let e=g&&o[g]?r(p):void 0;e&&e!==g&&(g=e,h=!1)}else g=r(p);if(!g){if(!h){l=t+(l.length>0?` `+l:l);continue}if(g=r(p),!g){l=t+(l.length>0?` `+l:l);continue}h=!1}let _=d.length===0?``:d.length===1?d[0]:a(d).join(`:`),v=f?_+Ab:_,y=v+g;if(s.indexOf(y)>-1)continue;s.push(y);let b=i(g,h);for(let e=0;e<b.length;++e){let t=b[e];s.push(v+t)}l=t+(l.length>0?` `+l:l)}return l},Bb=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=Vb(n))&&(i&&(i+=` `),i+=r);return i},Vb=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=Vb(e[r]))&&(n&&(n+=` `),n+=t);return n},Hb=(e,...t)=>{let n,r,i,a,o=o=>(n=Ib(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)),s=e=>{let t=r(e);if(t)return t;let a=zb(e,n);return i(e,a),a};return a=o,(...e)=>a(Bb(...e))},Ub=[],Wb=e=>{let t=t=>t[e]||Ub;return t.isThemeGetter=!0,t},Gb=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Kb=/^\((?:(\w[\w-]*):)?(.+)\)$/i,qb=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Jb=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Yb=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Xb=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Zb=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Qb=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,$b=e=>qb.test(e),ex=e=>!!e&&!Number.isNaN(Number(e)),tx=e=>!!e&&Number.isInteger(Number(e)),nx=e=>e.endsWith(`%`)&&ex(e.slice(0,-1)),rx=e=>Jb.test(e),ix=()=>!0,ax=e=>Yb.test(e)&&!Xb.test(e),ox=()=>!1,sx=e=>Zb.test(e),cx=e=>Qb.test(e),lx=e=>!Y(e)&&!X(e),ux=e=>e.startsWith(`@container`)&&(e[10]===`/`&&e[11]!==void 0||e[11]===`s`&&e[16]!==void 0&&e.startsWith(`-size/`,10)||e[11]===`n`&&e[18]!==void 0&&e.startsWith(`-normal/`,10)),dx=e=>Ex(e,Ax,ox),Y=e=>Gb.test(e),fx=e=>Ex(e,jx,ax),px=e=>Ex(e,Mx,ex),mx=e=>Ex(e,Px,ix),hx=e=>Ex(e,Nx,ox),gx=e=>Ex(e,Ox,ox),_x=e=>Ex(e,kx,cx),vx=e=>Ex(e,Fx,sx),X=e=>Kb.test(e),yx=e=>Dx(e,jx),bx=e=>Dx(e,Nx),xx=e=>Dx(e,Ox),Sx=e=>Dx(e,Ax),Cx=e=>Dx(e,kx),wx=e=>Dx(e,Fx,!0),Tx=e=>Dx(e,Px,!0),Ex=(e,t,n)=>{let r=Gb.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},Dx=(e,t,n=!1)=>{let r=Kb.exec(e);return r?r[1]?t(r[1]):n:!1},Ox=e=>e===`position`||e===`percentage`,kx=e=>e===`image`||e===`url`,Ax=e=>e===`length`||e===`size`||e===`bg-size`,jx=e=>e===`length`,Mx=e=>e===`number`,Nx=e=>e===`family-name`,Px=e=>e===`number`||e===`weight`,Fx=e=>e===`shadow`,Ix=Hb(()=>{let e=Wb(`color`),t=Wb(`font`),n=Wb(`text`),r=Wb(`font-weight`),i=Wb(`tracking`),a=Wb(`leading`),o=Wb(`breakpoint`),s=Wb(`container`),c=Wb(`spacing`),l=Wb(`radius`),u=Wb(`shadow`),d=Wb(`inset-shadow`),f=Wb(`text-shadow`),p=Wb(`drop-shadow`),m=Wb(`blur`),h=Wb(`perspective`),g=Wb(`aspect`),_=Wb(`ease`),v=Wb(`animate`),y=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],b=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],x=()=>[...b(),X,Y],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[X,Y,c],T=()=>[$b,`full`,`auto`,...w()],E=()=>[tx,`none`,`subgrid`,X,Y],D=()=>[`auto`,{span:[`full`,tx,X,Y]},tx,X,Y],O=()=>[tx,`auto`,X,Y],ee=()=>[`auto`,`min`,`max`,`fr`,X,Y],te=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],ne=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],re=()=>[`auto`,...w()],ie=()=>[$b,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],ae=()=>[$b,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],oe=()=>[$b,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],k=()=>[e,X,Y],se=()=>[...b(),xx,gx,{position:[X,Y]}],ce=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],le=()=>[`auto`,`cover`,`contain`,Sx,dx,{size:[X,Y]}],ue=()=>[nx,yx,fx],A=()=>[``,`none`,`full`,l,X,Y],de=()=>[``,ex,yx,fx],fe=()=>[`solid`,`dashed`,`dotted`,`double`],pe=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],me=()=>[ex,nx,xx,gx],he=()=>[``,`none`,m,X,Y],ge=()=>[`none`,ex,X,Y],_e=()=>[`none`,ex,X,Y],ve=()=>[ex,X,Y],ye=()=>[$b,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[rx],breakpoint:[rx],color:[ix],container:[rx],"drop-shadow":[rx],ease:[`in`,`out`,`in-out`],font:[lx],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[rx],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[rx],shadow:[rx],spacing:[`px`,ex],text:[rx],"text-shadow":[rx],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,$b,Y,X,g]}],container:[`container`],"container-type":[{"@container":[``,`normal`,`size`,X,Y]}],"container-named":[ux],columns:[{columns:[ex,Y,X,s]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],sr:[`sr-only`,`not-sr-only`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:x()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{"inset-s":T(),start:T()}],end:[{"inset-e":T(),end:T()}],"inset-bs":[{"inset-bs":T()}],"inset-be":[{"inset-be":T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[tx,`auto`,X,Y]}],basis:[{basis:[$b,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[ex,$b,`auto`,`initial`,`none`,Y]}],grow:[{grow:[``,ex,X,Y]}],shrink:[{shrink:[``,ex,X,Y]}],order:[{order:[tx,`first`,`last`,`none`,X,Y]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":ee()}],"auto-rows":[{"auto-rows":ee()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...te(),`normal`]}],"justify-items":[{"justify-items":[...ne(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...ne()]}],"align-content":[{content:[`normal`,...te()]}],"align-items":[{items:[...ne(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...ne(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":te()}],"place-items":[{"place-items":[...ne(),`baseline`]}],"place-self":[{"place-self":[`auto`,...ne()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pbs:[{pbs:w()}],pbe:[{pbe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:re()}],mx:[{mx:re()}],my:[{my:re()}],ms:[{ms:re()}],me:[{me:re()}],mbs:[{mbs:re()}],mbe:[{mbe:re()}],mt:[{mt:re()}],mr:[{mr:re()}],mb:[{mb:re()}],ml:[{ml:re()}],"space-x":[{"space-x":w()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":w()}],"space-y-reverse":[`space-y-reverse`],size:[{size:ie()}],"inline-size":[{inline:[`auto`,...ae()]}],"min-inline-size":[{"min-inline":[`auto`,...ae()]}],"max-inline-size":[{"max-inline":[`none`,...ae()]}],"block-size":[{block:[`auto`,...oe()]}],"min-block-size":[{"min-block":[`auto`,...oe()]}],"max-block-size":[{"max-block":[`none`,...oe()]}],w:[{w:[s,`screen`,...ie()]}],"min-w":[{"min-w":[s,`screen`,`none`,...ie()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...ie()]}],h:[{h:[`screen`,`lh`,...ie()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...ie()]}],"max-h":[{"max-h":[`screen`,`lh`,...ie()]}],"font-size":[{text:[`base`,n,yx,fx]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,Tx,mx]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,nx,Y]}],"font-family":[{font:[bx,hx,t]}],"font-features":[{"font-features":[Y]}],"fvn-normal":[`normal-nums`],"fvn-ordinal":[`ordinal`],"fvn-slashed-zero":[`slashed-zero`],"fvn-figure":[`lining-nums`,`oldstyle-nums`],"fvn-spacing":[`proportional-nums`,`tabular-nums`],"fvn-fraction":[`diagonal-fractions`,`stacked-fractions`],tracking:[{tracking:[i,X,Y]}],"line-clamp":[{"line-clamp":[ex,`none`,X,px]}],leading:[{leading:[a,...w()]}],"list-image":[{"list-image":[`none`,X,Y]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,X,Y]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:k()}],"text-color":[{text:k()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...fe(),`wavy`]}],"text-decoration-thickness":[{decoration:[ex,`from-font`,`auto`,X,fx]}],"text-decoration-color":[{decoration:k()}],"underline-offset":[{"underline-offset":[ex,`auto`,X,Y]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:w()}],"tab-size":[{tab:[tx,X,Y]}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,X,Y]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],wrap:[{wrap:[`break-word`,`anywhere`,`normal`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,X,Y]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:se()}],"bg-repeat":[{bg:ce()}],"bg-size":[{bg:le()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},tx,X,Y],radial:[``,X,Y],conic:[tx,X,Y]},Cx,_x]}],"bg-color":[{bg:k()}],"gradient-from-pos":[{from:ue()}],"gradient-via-pos":[{via:ue()}],"gradient-to-pos":[{to:ue()}],"gradient-from":[{from:k()}],"gradient-via":[{via:k()}],"gradient-to":[{to:k()}],rounded:[{rounded:A()}],"rounded-s":[{"rounded-s":A()}],"rounded-e":[{"rounded-e":A()}],"rounded-t":[{"rounded-t":A()}],"rounded-r":[{"rounded-r":A()}],"rounded-b":[{"rounded-b":A()}],"rounded-l":[{"rounded-l":A()}],"rounded-ss":[{"rounded-ss":A()}],"rounded-se":[{"rounded-se":A()}],"rounded-ee":[{"rounded-ee":A()}],"rounded-es":[{"rounded-es":A()}],"rounded-tl":[{"rounded-tl":A()}],"rounded-tr":[{"rounded-tr":A()}],"rounded-br":[{"rounded-br":A()}],"rounded-bl":[{"rounded-bl":A()}],"border-w":[{border:de()}],"border-w-x":[{"border-x":de()}],"border-w-y":[{"border-y":de()}],"border-w-s":[{"border-s":de()}],"border-w-e":[{"border-e":de()}],"border-w-bs":[{"border-bs":de()}],"border-w-be":[{"border-be":de()}],"border-w-t":[{"border-t":de()}],"border-w-r":[{"border-r":de()}],"border-w-b":[{"border-b":de()}],"border-w-l":[{"border-l":de()}],"divide-x":[{"divide-x":de()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":de()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...fe(),`hidden`,`none`]}],"divide-style":[{divide:[...fe(),`hidden`,`none`]}],"border-color":[{border:k()}],"border-color-x":[{"border-x":k()}],"border-color-y":[{"border-y":k()}],"border-color-s":[{"border-s":k()}],"border-color-e":[{"border-e":k()}],"border-color-bs":[{"border-bs":k()}],"border-color-be":[{"border-be":k()}],"border-color-t":[{"border-t":k()}],"border-color-r":[{"border-r":k()}],"border-color-b":[{"border-b":k()}],"border-color-l":[{"border-l":k()}],"divide-color":[{divide:k()}],"outline-style":[{outline:[...fe(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[ex,X,Y]}],"outline-w":[{outline:[``,ex,yx,fx]}],"outline-color":[{outline:k()}],shadow:[{shadow:[``,`none`,u,wx,vx]}],"shadow-color":[{shadow:k()}],"inset-shadow":[{"inset-shadow":[`none`,d,wx,vx]}],"inset-shadow-color":[{"inset-shadow":k()}],"ring-w":[{ring:de()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:k()}],"ring-offset-w":[{"ring-offset":[ex,fx]}],"ring-offset-color":[{"ring-offset":k()}],"inset-ring-w":[{"inset-ring":de()}],"inset-ring-color":[{"inset-ring":k()}],"text-shadow":[{"text-shadow":[`none`,f,wx,vx]}],"text-shadow-color":[{"text-shadow":k()}],opacity:[{opacity:[ex,X,Y]}],"mix-blend":[{"mix-blend":[...pe(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":pe()}],"mask-clip":[{"mask-clip":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]},`mask-no-clip`],"mask-composite":[{mask:[`add`,`subtract`,`intersect`,`exclude`]}],"mask-image-linear-pos":[{"mask-linear":[ex]}],"mask-image-linear-from-pos":[{"mask-linear-from":me()}],"mask-image-linear-to-pos":[{"mask-linear-to":me()}],"mask-image-linear-from-color":[{"mask-linear-from":k()}],"mask-image-linear-to-color":[{"mask-linear-to":k()}],"mask-image-t-from-pos":[{"mask-t-from":me()}],"mask-image-t-to-pos":[{"mask-t-to":me()}],"mask-image-t-from-color":[{"mask-t-from":k()}],"mask-image-t-to-color":[{"mask-t-to":k()}],"mask-image-r-from-pos":[{"mask-r-from":me()}],"mask-image-r-to-pos":[{"mask-r-to":me()}],"mask-image-r-from-color":[{"mask-r-from":k()}],"mask-image-r-to-color":[{"mask-r-to":k()}],"mask-image-b-from-pos":[{"mask-b-from":me()}],"mask-image-b-to-pos":[{"mask-b-to":me()}],"mask-image-b-from-color":[{"mask-b-from":k()}],"mask-image-b-to-color":[{"mask-b-to":k()}],"mask-image-l-from-pos":[{"mask-l-from":me()}],"mask-image-l-to-pos":[{"mask-l-to":me()}],"mask-image-l-from-color":[{"mask-l-from":k()}],"mask-image-l-to-color":[{"mask-l-to":k()}],"mask-image-x-from-pos":[{"mask-x-from":me()}],"mask-image-x-to-pos":[{"mask-x-to":me()}],"mask-image-x-from-color":[{"mask-x-from":k()}],"mask-image-x-to-color":[{"mask-x-to":k()}],"mask-image-y-from-pos":[{"mask-y-from":me()}],"mask-image-y-to-pos":[{"mask-y-to":me()}],"mask-image-y-from-color":[{"mask-y-from":k()}],"mask-image-y-to-color":[{"mask-y-to":k()}],"mask-image-radial":[{"mask-radial":[X,Y]}],"mask-image-radial-from-pos":[{"mask-radial-from":me()}],"mask-image-radial-to-pos":[{"mask-radial-to":me()}],"mask-image-radial-from-color":[{"mask-radial-from":k()}],"mask-image-radial-to-color":[{"mask-radial-to":k()}],"mask-image-radial-shape":[{"mask-radial":[`circle`,`ellipse`]}],"mask-image-radial-size":[{"mask-radial":[{closest:[`side`,`corner`],farthest:[`side`,`corner`]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[ex]}],"mask-image-conic-from-pos":[{"mask-conic-from":me()}],"mask-image-conic-to-pos":[{"mask-conic-to":me()}],"mask-image-conic-from-color":[{"mask-conic-from":k()}],"mask-image-conic-to-color":[{"mask-conic-to":k()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:se()}],"mask-repeat":[{mask:ce()}],"mask-size":[{mask:le()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,X,Y]}],filter:[{filter:[``,`none`,X,Y]}],blur:[{blur:he()}],brightness:[{brightness:[ex,X,Y]}],contrast:[{contrast:[ex,X,Y]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,wx,vx]}],"drop-shadow-color":[{"drop-shadow":k()}],grayscale:[{grayscale:[``,ex,X,Y]}],"hue-rotate":[{"hue-rotate":[ex,X,Y]}],invert:[{invert:[``,ex,X,Y]}],saturate:[{saturate:[ex,X,Y]}],sepia:[{sepia:[``,ex,X,Y]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,X,Y]}],"backdrop-blur":[{"backdrop-blur":he()}],"backdrop-brightness":[{"backdrop-brightness":[ex,X,Y]}],"backdrop-contrast":[{"backdrop-contrast":[ex,X,Y]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,ex,X,Y]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[ex,X,Y]}],"backdrop-invert":[{"backdrop-invert":[``,ex,X,Y]}],"backdrop-opacity":[{"backdrop-opacity":[ex,X,Y]}],"backdrop-saturate":[{"backdrop-saturate":[ex,X,Y]}],"backdrop-sepia":[{"backdrop-sepia":[``,ex,X,Y]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,X,Y]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[ex,`initial`,X,Y]}],ease:[{ease:[`linear`,`initial`,_,X,Y]}],delay:[{delay:[ex,X,Y]}],animate:[{animate:[`none`,v,X,Y]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,X,Y]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:ge()}],"rotate-x":[{"rotate-x":ge()}],"rotate-y":[{"rotate-y":ge()}],"rotate-z":[{"rotate-z":ge()}],scale:[{scale:_e()}],"scale-x":[{"scale-x":_e()}],"scale-y":[{"scale-y":_e()}],"scale-z":[{"scale-z":_e()}],"scale-3d":[`scale-3d`],skew:[{skew:ve()}],"skew-x":[{"skew-x":ve()}],"skew-y":[{"skew-y":ve()}],transform:[{transform:[X,Y,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:ye()}],"translate-x":[{"translate-x":ye()}],"translate-y":[{"translate-y":ye()}],"translate-z":[{"translate-z":ye()}],"translate-none":[`translate-none`],zoom:[{zoom:[tx,X,Y]}],accent:[{accent:k()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:k()}],"color-scheme":[{scheme:[`normal`,`dark`,`light`,`light-dark`,`only-dark`,`only-light`]}],cursor:[{cursor:[`auto`,`default`,`pointer`,`wait`,`text`,`move`,`help`,`not-allowed`,`none`,`context-menu`,`progress`,`cell`,`crosshair`,`vertical-text`,`alias`,`copy`,`no-drop`,`grab`,`grabbing`,`all-scroll`,`col-resize`,`row-resize`,`n-resize`,`e-resize`,`s-resize`,`w-resize`,`ne-resize`,`nw-resize`,`se-resize`,`sw-resize`,`ew-resize`,`ns-resize`,`nesw-resize`,`nwse-resize`,`zoom-in`,`zoom-out`,X,Y]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scrollbar-thumb-color":[{"scrollbar-thumb":k()}],"scrollbar-track-color":[{"scrollbar-track":k()}],"scrollbar-gutter":[{"scrollbar-gutter":[`auto`,`stable`,`both`]}],"scrollbar-w":[{scrollbar:[`auto`,`thin`,`none`]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mbs":[{"scroll-mbs":w()}],"scroll-mbe":[{"scroll-mbe":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pbs":[{"scroll-pbs":w()}],"scroll-pbe":[{"scroll-pbe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}],touch:[{touch:[`auto`,`none`,`manipulation`]}],"touch-x":[{"touch-pan":[`x`,`left`,`right`]}],"touch-y":[{"touch-pan":[`y`,`up`,`down`]}],"touch-pz":[`touch-pinch-zoom`],select:[{select:[`none`,`text`,`all`,`auto`]}],"will-change":[{"will-change":[`auto`,`scroll`,`contents`,`transform`,X,Y]}],fill:[{fill:[`none`,...k()]}],"stroke-w":[{stroke:[ex,yx,fx,px]}],stroke:[{stroke:[`none`,...k()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{"container-named":[`container-type`],overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`inset-bs`,`inset-be`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`right`,`left`],"inset-y":[`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pbs`,`pbe`,`pt`,`pr`,`pb`,`pl`],px:[`pr`,`pl`],py:[`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mbs`,`mbe`,`mt`,`mr`,`mb`,`ml`],mx:[`mr`,`ml`],my:[`mt`,`mb`],size:[`w`,`h`],"font-size":[`leading`],"fvn-normal":[`fvn-ordinal`,`fvn-slashed-zero`,`fvn-figure`,`fvn-spacing`,`fvn-fraction`],"fvn-ordinal":[`fvn-normal`],"fvn-slashed-zero":[`fvn-normal`],"fvn-figure":[`fvn-normal`],"fvn-spacing":[`fvn-normal`],"fvn-fraction":[`fvn-normal`],"line-clamp":[`display`,`overflow`],rounded:[`rounded-s`,`rounded-e`,`rounded-t`,`rounded-r`,`rounded-b`,`rounded-l`,`rounded-ss`,`rounded-se`,`rounded-ee`,`rounded-es`,`rounded-tl`,`rounded-tr`,`rounded-br`,`rounded-bl`],"rounded-s":[`rounded-ss`,`rounded-es`],"rounded-e":[`rounded-se`,`rounded-ee`],"rounded-t":[`rounded-tl`,`rounded-tr`],"rounded-r":[`rounded-tr`,`rounded-br`],"rounded-b":[`rounded-br`,`rounded-bl`],"rounded-l":[`rounded-tl`,`rounded-bl`],"border-spacing":[`border-spacing-x`,`border-spacing-y`],"border-w":[`border-w-x`,`border-w-y`,`border-w-s`,`border-w-e`,`border-w-bs`,`border-w-be`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-r`,`border-w-l`],"border-w-y":[`border-w-t`,`border-w-b`],"border-color":[`border-color-x`,`border-color-y`,`border-color-s`,`border-color-e`,`border-color-bs`,`border-color-be`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-r`,`border-color-l`],"border-color-y":[`border-color-t`,`border-color-b`],translate:[`translate-x`,`translate-y`,`translate-none`],"translate-none":[`translate`,`translate-x`,`translate-y`,`translate-z`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mbs`,`scroll-mbe`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pbs`,`scroll-pbe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]},postfixLookupClassGroups:[`container-type`],orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}});function Z(...e){return Ix(ay(e))}var Lx=Zv,Rx=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(Qv,{ref:n,className:Z(`fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]`,e),...t}));Rx.displayName=Qv.displayName;var zx=cy(`group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full`,{variants:{variant:{default:`border bg-background text-foreground`,destructive:`destructive group border-destructive bg-destructive text-destructive-foreground`}},defaultVariants:{variant:`default`}}),Bx=j.forwardRef(({className:e,variant:t,...n},r)=>(0,M.jsx)($v,{ref:r,className:Z(zx({variant:t}),e),...n}));Bx.displayName=$v.displayName;var Vx=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(ny,{ref:n,className:Z(`inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive`,e),...t}));Vx.displayName=ny.displayName;var Hx=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(ry,{ref:n,className:Z(`absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600`,e),"toast-close":``,...t,children:(0,M.jsx)(ub,{className:`h-4 w-4`})}));Hx.displayName=ry.displayName;var Ux=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(ey,{ref:n,className:Z(`text-sm font-semibold`,e),...t}));Ux.displayName=ey.displayName;var Wx=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(ty,{ref:n,className:Z(`text-sm opacity-90`,e),...t}));Wx.displayName=ty.displayName;function Gx(){let{toasts:e}=p_();return(0,M.jsxs)(Lx,{children:[e.map(function({id:e,title:t,description:n,action:r,...i}){return(0,M.jsxs)(Bx,{...i,children:[(0,M.jsxs)(`div`,{className:`grid gap-1`,children:[t&&(0,M.jsx)(Ux,{children:t}),n&&(0,M.jsx)(Wx,{children:n})]}),r,(0,M.jsx)(Hx,{})]},e)}),(0,M.jsx)(Rx,{})]})}var Kx=Symbol.for(`react.lazy`),qx=j.use;function Jx(e){return typeof e==`object`&&!!e&&`then`in e}function Yx(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===Kx&&`_payload`in e&&Jx(e._payload)}function Xx(e){let t=Qx(e),n=j.forwardRef((e,n)=>{let{children:r,...i}=e;Yx(r)&&typeof qx==`function`&&(r=qx(r._payload));let a=j.Children.toArray(r),o=a.find(eS);if(o){let e=o.props.children,r=a.map(t=>t===o?j.Children.count(e)>1?j.Children.only(null):j.isValidElement(e)?e.props.children:null:t);return(0,M.jsx)(t,{...i,ref:n,children:j.isValidElement(e)?j.cloneElement(e,void 0,r):null})}return(0,M.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}var Zx=Xx(`Slot`);function Qx(e){let t=j.forwardRef((e,t)=>{let{children:n,...r}=e;if(Yx(n)&&typeof qx==`function`&&(n=qx(n._payload)),j.isValidElement(n)){let e=nS(n),i=tS(r,n.props);return n.type!==j.Fragment&&(i.ref=t?h_(t,e):e),j.cloneElement(n,i)}return j.Children.count(n)>1?j.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var $x=Symbol(`radix.slottable`);function eS(e){return j.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===$x}function tS(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function nS(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var rS=768;function iS(){let[e,t]=j.useState(void 0);return j.useEffect(()=>{let e=window.matchMedia(`(max-width: ${rS-1}px)`),n=()=>{t(window.innerWidth<rS)};return e.addEventListener(`change`,n),t(window.innerWidth<rS),()=>e.removeEventListener(`change`,n)},[]),!!e}var aS=cy(`inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0`,{variants:{variant:{default:`bg-primary text-primary-foreground shadow hover:bg-primary/90`,destructive:`bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90`,outline:`border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground`,secondary:`bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80`,ghost:`hover:bg-accent hover:text-accent-foreground`,link:`text-primary underline-offset-4 hover:underline`},size:{default:`h-9 px-4 py-2`,sm:`h-8 rounded-md px-3 text-xs`,lg:`h-10 rounded-md px-8`,icon:`h-9 w-9`}},defaultVariants:{variant:`default`,size:`default`}}),Q=j.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...i},a)=>(0,M.jsx)(r?Zx:`button`,{className:Z(aS({variant:t,size:n,className:e})),ref:a,...i}));Q.displayName=`Button`;var oS=j.forwardRef(({className:e,type:t,...n},r)=>(0,M.jsx)(`input`,{type:t,className:Z(`flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50`,e),ref:r,...n}));oS.displayName=`Input`;var sS=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=Xx(`Primitive.${t}`),r=j.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,M.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),cS=`Separator`,lS=`horizontal`,uS=[`horizontal`,`vertical`],dS=j.forwardRef((e,t)=>{let{decorative:n,orientation:r=lS,...i}=e,a=fS(r)?r:lS,o=n?{role:`none`}:{"aria-orientation":a===`vertical`?a:void 0,role:`separator`};return(0,M.jsx)(sS.div,{"data-orientation":a,...o,...i,ref:t})});dS.displayName=cS;function fS(e){return uS.includes(e)}var pS=dS,mS=j.forwardRef(({className:e,orientation:t=`horizontal`,decorative:n=!0,...r},i)=>(0,M.jsx)(pS,{ref:i,decorative:n,orientation:t,className:Z(`shrink-0 bg-border`,t===`horizontal`?`h-[1px] w-full`:`h-full w-[1px]`,e),...r}));mS.displayName=pS.displayName;var hS=j.useId||(()=>void 0),gS=0;function _S(e){let[t,n]=j.useState(hS());return q_(()=>{e||n(e=>e??String(gS++))},[e]),e||(t?`radix-${t}`:``)}var vS=`focusScope.autoFocusOnMount`,yS=`focusScope.autoFocusOnUnmount`,bS={bubbles:!1,cancelable:!0},xS=`FocusScope`,SS=j.forwardRef((e,t)=>{let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=j.useState(null),l=A_(i),u=A_(a),d=j.useRef(null),f=g_(t,e=>c(e)),p=j.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;j.useEffect(()=>{if(r){let e=function(e){if(p.paused||!s)return;let t=e.target;s.contains(t)?d.current=t:kS(d.current,{select:!0})},t=function(e){if(p.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||kS(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&kS(s)};document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,s,p.paused]),j.useEffect(()=>{if(s){AS.add(p);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(vS,bS);s.addEventListener(vS,l),s.dispatchEvent(t),t.defaultPrevented||(CS(NS(TS(s)),{select:!0}),document.activeElement===e&&kS(s))}return()=>{s.removeEventListener(vS,l),setTimeout(()=>{let t=new CustomEvent(yS,bS);s.addEventListener(yS,u),s.dispatchEvent(t),t.defaultPrevented||kS(e??document.body,{select:!0}),s.removeEventListener(yS,u),AS.remove(p)},0)}}},[s,l,u,p]);let m=j.useCallback(e=>{if(!n&&!r||p.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=wS(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&kS(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&kS(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,p.paused]);return(0,M.jsx)(O_.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})});SS.displayName=xS;function CS(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(kS(r,{select:t}),document.activeElement!==n)return}function wS(e){let t=TS(e);return[ES(t,e),ES(t.reverse(),e)]}function TS(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function ES(e,t){for(let n of e)if(!DS(n,{upTo:t}))return n}function DS(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}function OS(e){return e instanceof HTMLInputElement&&`select`in e}function kS(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&OS(e)&&t&&e.select()}}var AS=jS();function jS(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=MS(e,t),e.unshift(t)},remove(t){e=MS(e,t),e[0]?.resume()}}}function MS(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function NS(e){return e.filter(e=>e.tagName!==`A`)}var PS=0;function FS(){j.useEffect(()=>{let e=document.querySelectorAll(`[data-radix-focus-guard]`);return document.body.insertAdjacentElement(`afterbegin`,e[0]??IS()),document.body.insertAdjacentElement(`beforeend`,e[1]??IS()),PS++,()=>{PS===1&&document.querySelectorAll(`[data-radix-focus-guard]`).forEach(e=>e.remove()),PS--}},[])}function IS(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}var LS=function(){return LS=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},LS.apply(this,arguments)};function RS(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function zS(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var BS=`right-scroll-bar-position`,VS=`width-before-scroll-bar`,HS=`with-scroll-bars-hidden`,US=`--removed-body-scroll-bar-size`;function WS(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function GS(e,t){var n=(0,j.useState)(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(e){var t=n.value;t!==e&&(n.value=e,n.callback(e,t))}}}})[0];return n.callback=t,n.facade}var KS=typeof window<`u`?j.useLayoutEffect:j.useEffect,qS=new WeakMap;function JS(e,t){var n=GS(t||null,function(t){return e.forEach(function(e){return WS(e,t)})});return KS(function(){var t=qS.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||WS(e,null)}),i.forEach(function(e){r.has(e)||WS(e,a)})}qS.set(n,e)},[e]),n}function YS(e){return e}function XS(e,t){t===void 0&&(t=YS);var n=[],r=!1;return{read:function(){if(r)throw 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(e){var i=t(e,r);return n.push(i),function(){n=n.filter(function(e){return e!==i})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var i=n;n=[],i.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},o=function(){return Promise.resolve().then(a)};o(),n={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),n}}}}}function ZS(e){e===void 0&&(e={});var t=XS(null);return t.options=LS({async:!0,ssr:!1},e),t}var QS=function(e){var t=e.sideCar,n=RS(e,[`sideCar`]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error(`Sidecar medium not found`);return j.createElement(r,LS({},n))};QS.isSideCarExport=!0;function $S(e,t){return e.useMedium(t),QS}var eC=ZS(),tC=function(){},nC=j.forwardRef(function(e,t){var n=j.useRef(null),r=j.useState({onScrollCapture:tC,onWheelCapture:tC,onTouchMoveCapture:tC}),i=r[0],a=r[1],o=e.forwardProps,s=e.children,c=e.className,l=e.removeScrollBar,u=e.enabled,d=e.shards,f=e.sideCar,p=e.noRelative,m=e.noIsolation,h=e.inert,g=e.allowPinchZoom,_=e.as,v=_===void 0?`div`:_,y=e.gapMode,b=RS(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),x=f,S=JS([n,t]),C=LS(LS({},b),i);return j.createElement(j.Fragment,null,u&&j.createElement(x,{sideCar:eC,removeScrollBar:l,shards:d,noRelative:p,noIsolation:m,inert:h,setCallbacks:a,allowPinchZoom:!!g,lockRef:n,gapMode:y}),o?j.cloneElement(j.Children.only(s),LS(LS({},C),{ref:S})):j.createElement(v,LS({},C,{className:c,ref:S}),s))});nC.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},nC.classNames={fullWidth:VS,zeroRight:BS};var rC,iC=function(){if(rC)return rC;if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function aC(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=iC();return t&&e.setAttribute(`nonce`,t),e}function oC(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function sC(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var cC=function(){var e=0,t=null;return{add:function(n){e==0&&(t=aC())&&(oC(t,n),sC(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},lC=function(){var e=cC();return function(t,n){j.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},uC=function(){var e=lC();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},dC={left:0,top:0,right:0,gap:0},fC=function(e){return parseInt(e||``,10)||0},pC=function(e){var t=window.getComputedStyle(document.body),n=t[e===`padding`?`paddingLeft`:`marginLeft`],r=t[e===`padding`?`paddingTop`:`marginTop`],i=t[e===`padding`?`paddingRight`:`marginRight`];return[fC(n),fC(r),fC(i)]},mC=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return dC;var t=pC(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},hC=uC(),gC=`data-scroll-locked`,_C=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
|
|
104
104
|
.${HS} {
|
|
105
105
|
overflow: hidden ${r};
|
|
106
106
|
padding-right: ${s}px ${r};
|
|
@@ -144,5 +144,5 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
144
144
|
|
|
145
145
|
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
146
146
|
|
|
147
|
-
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return j.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},Nw=`DialogDescriptionWarning`,Pw=({contentRef:e,descriptionId:t})=>{let n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${jw(Nw).contentName}}.`;return j.useEffect(()=>{let r=e.current?.getAttribute(`aria-describedby`);t&&r&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},Fw=ow,Iw=fw,Lw=mw,Rw=vw,zw=Cw,Bw=Tw,Vw=Dw,Hw=Fw,Uw=Iw,Ww=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(Lw,{className:Z(`fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`,e),...t,ref:n}));Ww.displayName=Lw.displayName;var Gw=cy(`fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500`,{variants:{side:{top:`inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top`,bottom:`inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom`,left:`inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm`,right:`inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm`}},defaultVariants:{side:`right`}}),Kw=j.forwardRef(({side:e=`right`,className:t,children:n,...r},i)=>(0,M.jsxs)(Uw,{children:[(0,M.jsx)(Ww,{}),(0,M.jsxs)(Rw,{ref:i,className:Z(Gw({side:e}),t),...r,children:[n,(0,M.jsxs)(Vw,{className:`absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary`,children:[(0,M.jsx)(ub,{className:`h-4 w-4`}),(0,M.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]}));Kw.displayName=Rw.displayName;var qw=({className:e,...t})=>(0,M.jsx)(`div`,{className:Z(`flex flex-col space-y-2 text-center sm:text-left`,e),...t});qw.displayName=`SheetHeader`;var Jw=({className:e,...t})=>(0,M.jsx)(`div`,{className:Z(`flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2`,e),...t});Jw.displayName=`SheetFooter`;var Yw=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(zw,{ref:n,className:Z(`text-lg font-semibold text-foreground`,e),...t}));Yw.displayName=zw.displayName;var Xw=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(Bw,{ref:n,className:Z(`text-sm text-muted-foreground`,e),...t}));Xw.displayName=Bw.displayName;function Zw({className:e,...t}){return(0,M.jsx)(`div`,{className:Z(`bg-muted animate-pulse rounded-md`,e),...t})}var Qw=[`top`,`right`,`bottom`,`left`],$w=Math.min,eT=Math.max,tT=Math.round,nT=Math.floor,rT=e=>({x:e,y:e}),iT={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function aT(e,t,n){return eT(e,$w(t,n))}function oT(e,t){return typeof e==`function`?e(t):e}function sT(e){return e.split(`-`)[0]}function cT(e){return e.split(`-`)[1]}function lT(e){return e===`x`?`y`:`x`}function uT(e){return e===`y`?`height`:`width`}function dT(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function fT(e){return lT(dT(e))}function pT(e,t,n){n===void 0&&(n=!1);let r=cT(e),i=fT(e),a=uT(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=ST(o)),[o,ST(o)]}function mT(e){let t=ST(e);return[hT(e),t,hT(t)]}function hT(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var gT=[`left`,`right`],_T=[`right`,`left`],vT=[`top`,`bottom`],yT=[`bottom`,`top`];function bT(e,t,n){switch(e){case`top`:case`bottom`:return n?t?_T:gT:t?gT:_T;case`left`:case`right`:return t?vT:yT;default:return[]}}function xT(e,t,n,r){let i=cT(e),a=bT(sT(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(hT)))),a}function ST(e){let t=sT(e);return iT[t]+e.slice(t.length)}function CT(e){return{top:0,right:0,bottom:0,left:0,...e}}function wT(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:CT(e)}function TT(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function ET(e,t,n){let{reference:r,floating:i}=e,a=dT(t),o=fT(t),s=uT(o),c=sT(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(cT(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}async function DT(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=oT(t,e),p=wT(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=TT(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=TT(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var OT=50,kT=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:DT},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=ET(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<OT&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=ET(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},AT=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=oT(e,t)||{};if(l==null)return{};let d=wT(u),f={x:n,y:r},p=fT(i),m=uT(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=$w(d[_],T),D=$w(d[v],T),O=E,ee=C-h[m]-D,te=C/2-h[m]/2+w,ne=aT(O,te,ee),re=!c.arrow&&cT(i)!=null&&te!==ne&&a.reference[m]/2-(te<O?E:D)-h[m]/2<0,ie=re?te<O?te-O:te-ee:0;return{[p]:f[p]+ie,data:{[p]:ne,centerOffset:te-ne-ie,...re&&{alignmentOffset:ie}},reset:re}}}),jT=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=oT(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=sT(r),_=dT(o),v=sT(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[ST(o)]:mT(o)),x=p!==`none`;!d&&x&&b.push(...xT(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=pT(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==dT(t))||T.every(e=>dT(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=dT(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function MT(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function NT(e){return Qw.some(t=>e[t]>=0)}var PT=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=oT(e,t);switch(i){case`referenceHidden`:{let e=MT(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:NT(e)}}}case`escaped`:{let e=MT(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:NT(e)}}}default:return{}}}}},FT=new Set([`left`,`top`]);async function IT(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=sT(n),s=cT(n),c=dT(n)===`y`,l=FT.has(o)?-1:1,u=a&&c?-1:1,d=oT(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var LT=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await IT(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},RT=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=oT(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=dT(sT(i)),p=lT(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=aT(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=aT(n,h,r)}let g=c.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}}}}},zT=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=oT(e,t),u={x:n,y:r},d=dT(i),f=lT(d),p=u[f],m=u[d],h=oT(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=FT.has(sT(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},BT=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=oT(e,t),u=await o.detectOverflow(t,l),d=sT(i),f=cT(i),p=dT(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=$w(h-u[g],v),x=$w(m-u[_],y),S=!t.middlewareData.shift,C=b,w=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(w=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=v),S&&!f){let e=eT(u.left,0),t=eT(u.right,0),n=eT(u.top,0),r=eT(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:eT(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:eT(u.top,u.bottom))}await c({...t,availableWidth:w,availableHeight:C});let T=await o.getDimensions(s.floating);return m!==T.width||h!==T.height?{reset:{rects:!0}}:{}}}};function VT(){return typeof window<`u`}function HT(e){return GT(e)?(e.nodeName||``).toLowerCase():`#document`}function UT(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function WT(e){return((GT(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function GT(e){return VT()?e instanceof Node||e instanceof UT(e).Node:!1}function KT(e){return VT()?e instanceof Element||e instanceof UT(e).Element:!1}function qT(e){return VT()?e instanceof HTMLElement||e instanceof UT(e).HTMLElement:!1}function JT(e){return!VT()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof UT(e).ShadowRoot}function YT(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=oE(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function XT(e){return/^(table|td|th)$/.test(HT(e))}function ZT(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var QT=/transform|translate|scale|rotate|perspective|filter/,$T=/paint|layout|strict|content/,eE=e=>!!e&&e!==`none`,tE;function nE(e){let t=KT(e)?oE(e):e;return eE(t.transform)||eE(t.translate)||eE(t.scale)||eE(t.rotate)||eE(t.perspective)||!iE()&&(eE(t.backdropFilter)||eE(t.filter))||QT.test(t.willChange||``)||$T.test(t.contain||``)}function rE(e){let t=cE(e);for(;qT(t)&&!aE(t);){if(nE(t))return t;if(ZT(t))return null;t=cE(t)}return null}function iE(){return tE??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),tE}function aE(e){return/^(html|body|#document)$/.test(HT(e))}function oE(e){return UT(e).getComputedStyle(e)}function sE(e){return KT(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function cE(e){if(HT(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||JT(e)&&e.host||WT(e);return JT(t)?t.host:t}function lE(e){let t=cE(e);return aE(t)?e.ownerDocument?e.ownerDocument.body:e.body:qT(t)&&YT(t)?t:lE(t)}function uE(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=lE(e),i=r===e.ownerDocument?.body,a=UT(r);if(i){let e=dE(a);return t.concat(a,a.visualViewport||[],YT(r)?r:[],e&&n?uE(e):[])}else return t.concat(r,uE(r,[],n))}function dE(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function fE(e){let t=oE(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=qT(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=tT(n)!==a||tT(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function pE(e){return KT(e)?e:e.contextElement}function mE(e){let t=pE(e);if(!qT(t))return rT(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=fE(t),o=(a?tT(n.width):n.width)/r,s=(a?tT(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var hE=rT(0);function gE(e){let t=UT(e);return!iE()||!t.visualViewport?hE:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function _E(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==UT(e)?!1:t}function vE(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=pE(e),o=rT(1);t&&(r?KT(r)&&(o=mE(r)):o=mE(e));let s=_E(a,n,r)?gE(a):rT(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=UT(a),t=r&&KT(r)?UT(r):r,n=e,i=dE(n);for(;i&&r&&t!==n;){let e=mE(i),t=i.getBoundingClientRect(),r=oE(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=UT(i),i=dE(n)}}return TT({width:u,height:d,x:c,y:l})}function yE(e,t){let n=sE(e).scrollLeft;return t?t.left+n:vE(WT(e)).left+n}function bE(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-yE(e,n),y:n.top+t.scrollTop}}function xE(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=WT(r),s=t?ZT(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=rT(1),u=rT(0),d=qT(r);if((d||!d&&!a)&&((HT(r)!==`body`||YT(o))&&(c=sE(r)),d)){let e=vE(r);l=mE(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?bE(o,c):rT(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function SE(e){return Array.from(e.getClientRects())}function CE(e){let t=WT(e),n=sE(e),r=e.ownerDocument.body,i=eT(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=eT(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+yE(e),s=-n.scrollTop;return oE(r).direction===`rtl`&&(o+=eT(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var wE=25;function TE(e,t){let n=UT(e),r=WT(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=iE();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=yE(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=wE&&(a-=o)}else l<=wE&&(a+=l);return{width:a,height:o,x:s,y:c}}function EE(e,t){let n=vE(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=qT(e)?mE(e):rT(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function DE(e,t,n){let r;if(t===`viewport`)r=TE(e,n);else if(t===`document`)r=CE(WT(e));else if(KT(t))r=EE(t,n);else{let n=gE(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return TT(r)}function OE(e,t){let n=cE(e);return n===t||!KT(n)||aE(n)?!1:oE(n).position===`fixed`||OE(n,t)}function kE(e,t){let n=t.get(e);if(n)return n;let r=uE(e,[],!1).filter(e=>KT(e)&&HT(e)!==`body`),i=null,a=oE(e).position===`fixed`,o=a?cE(e):e;for(;KT(o)&&!aE(o);){let t=oE(o),n=nE(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||YT(o)&&!n&&OE(e,o))?r=r.filter(e=>e!==o):i=t,o=cE(o)}return t.set(e,r),r}function AE(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?ZT(t)?[]:kE(t,this._c):[].concat(n),r],o=DE(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=DE(t,a[e],i);s=eT(n.top,s),c=$w(n.right,c),l=$w(n.bottom,l),u=eT(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function jE(e){let{width:t,height:n}=fE(e);return{width:t,height:n}}function ME(e,t,n){let r=qT(t),i=WT(t),a=n===`fixed`,o=vE(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=rT(0);function l(){c.x=yE(i)}if(r||!r&&!a)if((HT(t)!==`body`||YT(i))&&(s=sE(t)),r){let e=vE(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l();a&&!r&&i&&l();let u=i&&!r&&!a?bE(i,s):rT(0);return{x:o.left+s.scrollLeft-c.x-u.x,y:o.top+s.scrollTop-c.y-u.y,width:o.width,height:o.height}}function NE(e){return oE(e).position===`static`}function PE(e,t){if(!qT(e)||oE(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return WT(e)===n&&(n=n.ownerDocument.body),n}function FE(e,t){let n=UT(e);if(ZT(e))return n;if(!qT(e)){let t=cE(e);for(;t&&!aE(t);){if(KT(t)&&!NE(t))return t;t=cE(t)}return n}let r=PE(e,t);for(;r&&XT(r)&&NE(r);)r=PE(r,t);return r&&aE(r)&&NE(r)&&!nE(r)?n:r||rE(e)||n}var IE=async function(e){let t=this.getOffsetParent||FE,n=this.getDimensions,r=await n(e.floating);return{reference:ME(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function LE(e){return oE(e).direction===`rtl`}var RE={convertOffsetParentRelativeRectToViewportRelativeRect:xE,getDocumentElement:WT,getClippingRect:AE,getOffsetParent:FE,getElementRects:IE,getClientRects:SE,getDimensions:jE,getScale:mE,isElement:KT,isRTL:LE};function zE(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function BE(e,t){let n=null,r,i=WT(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=nT(d),h=nT(i.clientWidth-(u+f)),g=nT(i.clientHeight-(d+p)),_=nT(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:eT(0,$w(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(n!==c){if(!y)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!zE(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function VE(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=pE(e),u=i||a?[...l?uE(l):[],...t?uE(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?BE(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?vE(e):null;c&&g();function g(){let t=vE(e);h&&!zE(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var HE=LT,UE=RT,WE=jT,GE=BT,KE=PT,qE=AT,JE=zT,YE=(e,t,n)=>{let r=new Map,i={platform:RE,...n},a={...i.platform,_c:r};return kT(e,t,{...i,platform:a})},XE=typeof document<`u`?j.useLayoutEffect:function(){};function ZE(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!ZE(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!ZE(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function QE(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function $E(e,t){let n=QE(e);return Math.round(t*n)/n}function eD(e){let t=j.useRef(e);return XE(()=>{t.current=e}),t}function tD(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=j.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=j.useState(r);ZE(f,r)||p(r);let[m,h]=j.useState(null),[g,_]=j.useState(null),v=j.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=j.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=j.useRef(null),C=j.useRef(null),w=j.useRef(u),T=c!=null,E=eD(c),D=eD(i),O=eD(l),ee=j.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),YE(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};te.current&&!ZE(w.current,t)&&(w.current=t,Gi.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);XE(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let te=j.useRef(!1);XE(()=>(te.current=!0,()=>{te.current=!1}),[]),XE(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(E.current)return E.current(b,x,ee);ee()}},[b,x,ee,E,T]);let ne=j.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),re=j.useMemo(()=>({reference:b,floating:x}),[b,x]),ie=j.useMemo(()=>{let e={position:n,left:0,top:0};if(!re.floating)return e;let t=$E(re.floating,u.x),r=$E(re.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...QE(re.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,re.floating,u.x,u.y]);return j.useMemo(()=>({...u,update:ee,refs:ne,elements:re,floatingStyles:ie}),[u,ee,ne,re,ie])}var nD=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:qE({element:r.current,padding:i}).fn(n):r?qE({element:r,padding:i}).fn(n):{}}}},rD=(e,t)=>{let n=HE(e);return{name:n.name,fn:n.fn,options:[e,t]}},iD=(e,t)=>{let n=UE(e);return{name:n.name,fn:n.fn,options:[e,t]}},aD=(e,t)=>({fn:JE(e).fn,options:[e,t]}),oD=(e,t)=>{let n=WE(e);return{name:n.name,fn:n.fn,options:[e,t]}},sD=(e,t)=>{let n=GE(e);return{name:n.name,fn:n.fn,options:[e,t]}},cD=(e,t)=>{let n=KE(e);return{name:n.name,fn:n.fn,options:[e,t]}},lD=(e,t)=>{let n=nD(e);return{name:n.name,fn:n.fn,options:[e,t]}},uD=`Arrow`,dD=j.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,M.jsx)(O_.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,M.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});dD.displayName=uD;var fD=dD;function pD(e){let[t,n]=j.useState(void 0);return q_(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}else n(void 0)},[e]),t}var mD=`Popper`,[hD,gD]=v_(mD),[_D,vD]=hD(mD),yD=e=>{let{__scopePopper:t,children:n}=e,[r,i]=j.useState(null);return(0,M.jsx)(_D,{scope:t,anchor:r,onAnchorChange:i,children:n})};yD.displayName=mD;var bD=`PopperAnchor`,xD=j.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,a=vD(bD,n),o=j.useRef(null),s=g_(t,o),c=j.useRef(null);return j.useEffect(()=>{let e=c.current;c.current=r?.current||o.current,e!==c.current&&a.onAnchorChange(c.current)}),r?null:(0,M.jsx)(O_.div,{...i,ref:s})});xD.displayName=bD;var SD=`PopperContent`,[CD,wD]=hD(SD),TD=j.forwardRef((e,t)=>{let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:u=0,sticky:d=`partial`,hideWhenDetached:f=!1,updatePositionStrategy:p=`optimized`,onPlaced:m,...h}=e,g=vD(SD,n),[_,v]=j.useState(null),y=g_(t,e=>v(e)),[b,x]=j.useState(null),S=pD(b),C=S?.width??0,w=S?.height??0,T=r+(a===`center`?``:`-`+a),E=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},D=Array.isArray(l)?l:[l],O=D.length>0,ee={padding:E,boundary:D.filter(kD),altBoundary:O},{refs:te,floatingStyles:ne,placement:re,isPositioned:ie,middlewareData:ae}=tD({strategy:`fixed`,placement:T,whileElementsMounted:(...e)=>VE(...e,{animationFrame:p===`always`}),elements:{reference:g.anchor},middleware:[rD({mainAxis:i+w,alignmentAxis:o}),c&&iD({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?aD():void 0,...ee}),c&&oD({...ee}),sD({...ee,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)}}),b&&lD({element:b,padding:s}),AD({arrowWidth:C,arrowHeight:w}),f&&cD({strategy:`referenceHidden`,...ee})]}),[oe,k]=jD(re),se=A_(m);q_(()=>{ie&&se?.()},[ie,se]);let ce=ae.arrow?.x,le=ae.arrow?.y,ue=ae.arrow?.centerOffset!==0,[A,de]=j.useState();return q_(()=>{_&&de(window.getComputedStyle(_).zIndex)},[_]),(0,M.jsx)(`div`,{ref:te.setFloating,"data-radix-popper-content-wrapper":``,style:{...ne,transform:ie?ne.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:A,"--radix-popper-transform-origin":[ae.transformOrigin?.x,ae.transformOrigin?.y].join(` `),...ae.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,M.jsx)(CD,{scope:n,placedSide:oe,onArrowChange:x,arrowX:ce,arrowY:le,shouldHideArrow:ue,children:(0,M.jsx)(O_.div,{"data-side":oe,"data-align":k,...h,ref:y,style:{...h.style,animation:ie?void 0:`none`}})})})});TD.displayName=SD;var ED=`PopperArrow`,DD={top:`bottom`,right:`left`,bottom:`top`,left:`right`},OD=j.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=wD(ED,n),a=DD[i.placedSide];return(0,M.jsx)(`span`,{ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:(0,M.jsx)(fD,{...r,ref:t,style:{...r.style,display:`block`}})})});OD.displayName=ED;function kD(e){return e!==null}var AD=e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=jD(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}});function jD(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var MD=yD,ND=xD,PD=TD,FD=OD,[ID,LD]=v_(`Tooltip`,[gD]),RD=gD(),zD=`TooltipProvider`,BD=700,VD=`tooltip.open`,[HD,UD]=ID(zD),WD=e=>{let{__scopeTooltip:t,delayDuration:n=BD,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=j.useRef(!0),s=j.useRef(!1),c=j.useRef(0);return j.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,M.jsx)(HD,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:j.useCallback(()=>{window.clearTimeout(c.current),o.current=!1},[]),onClose:j.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:s,onPointerInTransitChange:j.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};WD.displayName=zD;var GD=`Tooltip`,[KD,qD]=ID(GD),JD=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=UD(GD,e.__scopeTooltip),l=RD(t),[u,d]=j.useState(null),f=_S(),p=j.useRef(0),m=o??c.disableHoverableContent,h=s??c.delayDuration,g=j.useRef(!1),[_,v]=nv({prop:r,defaultProp:i??!1,onChange:e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(VD))):c.onClose(),a?.(e)},caller:GD}),y=j.useMemo(()=>_?g.current?`delayed-open`:`instant-open`:`closed`,[_]),b=j.useCallback(()=>{window.clearTimeout(p.current),p.current=0,g.current=!1,v(!0)},[v]),x=j.useCallback(()=>{window.clearTimeout(p.current),p.current=0,v(!1)},[v]),S=j.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{g.current=!0,v(!0),p.current=0},h)},[h,v]);return j.useEffect(()=>()=>{p.current&&=(window.clearTimeout(p.current),0)},[]),(0,M.jsx)(MD,{...l,children:(0,M.jsx)(KD,{scope:t,contentId:f,open:_,stateAttribute:y,trigger:u,onTriggerChange:d,onTriggerEnter:j.useCallback(()=>{c.isOpenDelayedRef.current?S():b()},[c.isOpenDelayedRef,S,b]),onTriggerLeave:j.useCallback(()=>{m?x():(window.clearTimeout(p.current),p.current=0)},[x,m]),onOpen:b,onClose:x,disableHoverableContent:m,children:n})})};JD.displayName=GD;var YD=`TooltipTrigger`,XD=j.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=qD(YD,n),a=UD(YD,n),o=RD(n),s=g_(t,j.useRef(null),i.onTriggerChange),c=j.useRef(!1),l=j.useRef(!1),u=j.useCallback(()=>c.current=!1,[]);return j.useEffect(()=>()=>document.removeEventListener(`pointerup`,u),[u]),(0,M.jsx)(ND,{asChild:!0,...o,children:(0,M.jsx)(O_.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:s,onPointerMove:J(e.onPointerMove,e=>{e.pointerType!==`touch`&&!l.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),l.current=!0)}),onPointerLeave:J(e.onPointerLeave,()=>{i.onTriggerLeave(),l.current=!1}),onPointerDown:J(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener(`pointerup`,u,{once:!0})}),onFocus:J(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:J(e.onBlur,i.onClose),onClick:J(e.onClick,i.onClose)})})});XD.displayName=YD;var ZD=`TooltipPortal`,[QD,$D]=ID(ZD,{forceMount:void 0}),eO=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=qD(ZD,t);return(0,M.jsx)(QD,{scope:t,forceMount:n,children:(0,M.jsx)(Z_,{present:n||a.open,children:(0,M.jsx)(Y_,{asChild:!0,container:i,children:r})})})};eO.displayName=ZD;var tO=`TooltipContent`,nO=j.forwardRef((e,t)=>{let n=$D(tO,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=qD(tO,e.__scopeTooltip);return(0,M.jsx)(Z_,{present:r||o.open,children:o.disableHoverableContent?(0,M.jsx)(sO,{side:i,...a,ref:t}):(0,M.jsx)(rO,{side:i,...a,ref:t})})}),rO=j.forwardRef((e,t)=>{let n=qD(tO,e.__scopeTooltip),r=UD(tO,e.__scopeTooltip),i=j.useRef(null),a=g_(t,i),[o,s]=j.useState(null),{trigger:c,onClose:l}=n,u=i.current,{onPointerInTransitChange:d}=r,f=j.useCallback(()=>{s(null),d(!1)},[d]),p=j.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=dO(r,uO(r,n.getBoundingClientRect())),a=fO(t.getBoundingClientRect());s(mO([...i,...a])),d(!0)},[d]);return j.useEffect(()=>()=>f(),[f]),j.useEffect(()=>{if(c&&u){let e=e=>p(e,u),t=e=>p(e,c);return c.addEventListener(`pointerleave`,e),u.addEventListener(`pointerleave`,t),()=>{c.removeEventListener(`pointerleave`,e),u.removeEventListener(`pointerleave`,t)}}},[c,u,p,f]),j.useEffect(()=>{if(o){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||u?.contains(t),i=!pO(n,o);r?f():i&&(f(),l())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,f]),(0,M.jsx)(sO,{...e,ref:a})}),[iO,aO]=ID(GD,{isInside:!1}),oO=C_(`TooltipContent`),sO=j.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,c=qD(tO,n),l=RD(n),{onClose:u}=c;return j.useEffect(()=>(document.addEventListener(VD,u),()=>document.removeEventListener(VD,u)),[u]),j.useEffect(()=>{if(c.trigger){let e=e=>{e.target?.contains(c.trigger)&&u()};return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[c.trigger,u]),(0,M.jsx)(R_,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:u,children:(0,M.jsxs)(PD,{"data-state":c.stateAttribute,...l,...s,ref:t,style:{...s.style,"--radix-tooltip-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-tooltip-content-available-width":`var(--radix-popper-available-width)`,"--radix-tooltip-content-available-height":`var(--radix-popper-available-height)`,"--radix-tooltip-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-tooltip-trigger-height":`var(--radix-popper-anchor-height)`},children:[(0,M.jsx)(oO,{children:r}),(0,M.jsx)(iO,{scope:n,isInside:!0,children:(0,M.jsx)(cv,{id:c.contentId,role:`tooltip`,children:i||r})})]})})});nO.displayName=tO;var cO=`TooltipArrow`,lO=j.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=RD(n);return aO(cO,n).isInside?null:(0,M.jsx)(FD,{...i,...r,ref:t})});lO.displayName=cO;function uO(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}function dO(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function fO(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function pO(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function mO(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:+(e.y>t.y)),hO(t)}function hO(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var gO=WD,_O=JD,vO=XD,yO=nO,bO=gO,xO=_O,SO=vO,CO=j.forwardRef(({className:e,sideOffset:t=4,...n},r)=>(0,M.jsx)(yO,{ref:r,sideOffset:t,className:Z(`z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,e),...n}));CO.displayName=yO.displayName;var wO=`sidebar_state`,TO=3600*24*7,EO=`16rem`,DO=`18rem`,OO=`3rem`,kO=`b`,AO=j.createContext(null);function jO(){let e=j.useContext(AO);if(!e)throw Error(`useSidebar must be used within a SidebarProvider`);return e}var MO=j.forwardRef(({defaultOpen:e=!0,open:t,onOpenChange:n,className:r,style:i,children:a,...o},s)=>{let c=iS(),[l,u]=j.useState(!1),[d,f]=j.useState(e),p=t??d,m=j.useCallback(e=>{let t=typeof e==`function`?e(p):e;n?n(t):f(t),document.cookie=`${wO}=${t}; path=/; max-age=${TO}`},[n,p]),h=j.useCallback(()=>c?u(e=>!e):m(e=>!e),[c,m,u]);j.useEffect(()=>{let e=e=>{e.key===kO&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),h())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[h]);let g=p?`expanded`:`collapsed`,_=j.useMemo(()=>({state:g,open:p,setOpen:m,isMobile:c,openMobile:l,setOpenMobile:u,toggleSidebar:h}),[g,p,m,c,l,u,h]);return(0,M.jsx)(AO.Provider,{value:_,children:(0,M.jsx)(bO,{delayDuration:0,children:(0,M.jsx)(`div`,{style:{"--sidebar-width":EO,"--sidebar-width-icon":OO,...i},className:Z(`group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex min-h-0 w-full`,r),ref:s,...o,children:a})})})});MO.displayName=`SidebarProvider`;var NO=j.forwardRef(({side:e=`left`,variant:t=`sidebar`,collapsible:n=`offcanvas`,className:r,children:i,...a},o)=>{let{isMobile:s,state:c,openMobile:l,setOpenMobile:u}=jO();return n===`none`?(0,M.jsx)(`div`,{className:Z(`bg-sidebar text-sidebar-foreground flex h-full w-[var(--sidebar-width)] flex-col`,r),ref:o,...a,children:i}):s?(0,M.jsx)(Hw,{open:l,onOpenChange:u,...a,children:(0,M.jsx)(Kw,{"data-sidebar":`sidebar`,"data-mobile":`true`,className:`bg-sidebar text-sidebar-foreground w-[var(--sidebar-width)] p-0 [&>button]:hidden`,style:{"--sidebar-width":DO},side:e,children:(0,M.jsx)(`div`,{className:`flex h-full w-full flex-col`,children:i})})}):(0,M.jsx)(`div`,{ref:o,className:Z(`bg-sidebar text-sidebar-foreground hidden md:flex h-svh w-[var(--sidebar-width)] shrink-0 flex-col border-r transition-[width] duration-200 ease-linear overflow-hidden`,c===`collapsed`&&n===`offcanvas`&&`w-0 border-0`,c===`collapsed`&&n===`icon`&&`w-[var(--sidebar-width-icon)]`,r),"data-state":c,"data-collapsible":c===`collapsed`?n:``,"data-variant":t,"data-side":e,...a,children:i})});NO.displayName=`Sidebar`;var PO=j.forwardRef(({className:e,onClick:t,...n},r)=>{let{toggleSidebar:i}=jO();return(0,M.jsxs)(Q,{ref:r,"data-sidebar":`trigger`,variant:`ghost`,size:`icon`,className:Z(`h-7 w-7`,e),onClick:e=>{t?.(e),i()},...n,children:[(0,M.jsx)(Ky,{}),(0,M.jsx)(`span`,{className:`sr-only`,children:`Toggle Sidebar`})]})});PO.displayName=`SidebarTrigger`;var FO=j.forwardRef(({className:e,...t},n)=>{let{toggleSidebar:r}=jO();return(0,M.jsx)(`button`,{ref:n,"data-sidebar":`rail`,"aria-label":`Toggle Sidebar`,tabIndex:-1,onClick:r,title:`Toggle Sidebar`,className:Z(`hover:after:bg-sidebar-border absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] group-data-[side=left]:-right-4 group-data-[side=right]:left-0 sm:flex`,`[[data-side=left]_&]:cursor-w-resize [[data-side=right]_&]:cursor-e-resize`,`[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize`,`group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full group-data-[collapsible=offcanvas]:hover:bg-sidebar`,`[[data-side=left][data-collapsible=offcanvas]_&]:-right-2`,`[[data-side=right][data-collapsible=offcanvas]_&]:-left-2`,e),...t})});FO.displayName=`SidebarRail`;var IO=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`main`,{ref:n,className:Z(`relative flex min-h-svh flex-1 flex-col bg-background`,`peer-data-[variant=inset]:min-h-[calc(100svh-theme(spacing.4))] md:peer-data-[variant=inset]:m-2 md:peer-data-[state=collapsed]:peer-data-[variant=inset]:ml-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow`,e),...t}));IO.displayName=`SidebarInset`;var LO=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(oS,{ref:n,"data-sidebar":`input`,className:Z(`h-8 w-full bg-background shadow-none focus-visible:ring-2 focus-visible:ring-sidebar-ring`,e),...t}));LO.displayName=`SidebarInput`;var RO=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`div`,{ref:n,"data-sidebar":`header`,className:Z(`flex flex-col gap-2 p-2`,e),...t}));RO.displayName=`SidebarHeader`;var zO=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`div`,{ref:n,"data-sidebar":`footer`,className:Z(`flex flex-col gap-2 p-2`,e),...t}));zO.displayName=`SidebarFooter`;var BO=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(mS,{ref:n,"data-sidebar":`separator`,className:Z(`mx-2 w-auto bg-sidebar-border`,e),...t}));BO.displayName=`SidebarSeparator`;var VO=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`div`,{ref:n,"data-sidebar":`content`,className:Z(`flex min-h-0 flex-1 flex-col gap-2 overflow-auto`,e),...t}));VO.displayName=`SidebarContent`;var HO=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`div`,{ref:n,"data-sidebar":`group`,className:Z(`relative flex w-full min-w-0 flex-col p-2`,e),...t}));HO.displayName=`SidebarGroup`;var UO=j.forwardRef(({className:e,asChild:t=!1,...n},r)=>(0,M.jsx)(t?Zx:`div`,{ref:r,"data-sidebar":`group-label`,className:Z(`text-xs/6 font-medium text-sidebar-foreground/70 ring-sidebar-ring flex h-8 shrink-0 items-center rounded-md px-2 outline-none transition-[margin,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0 [[data-collapsible=icon]_&]:-mt-8 [[data-collapsible=icon]_&]:opacity-0 [[data-collapsible=icon]_&]:overflow-hidden`,e),...n}));UO.displayName=`SidebarGroupLabel`;var WO=j.forwardRef(({className:e,asChild:t=!1,...n},r)=>(0,M.jsx)(t?Zx:`button`,{ref:r,"data-sidebar":`group-action`,className:Z(`absolute right-3 top-3.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0`,`after:absolute after:-inset-2 after:md:hidden`,`group-data-[collapsible=icon]:hidden`,e),...n}));WO.displayName=`SidebarGroupAction`;var GO=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`div`,{ref:n,"data-sidebar":`group-content`,className:Z(`w-full text-sm`,e),...t}));GO.displayName=`SidebarGroupContent`;var KO=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`ul`,{ref:n,"data-sidebar":`menu`,className:Z(`flex w-full min-w-0 flex-col gap-1`,e),...t}));KO.displayName=`SidebarMenu`;var qO=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`li`,{ref:n,"data-sidebar":`menu-item`,className:Z(`group/menu-item relative`,e),...t}));qO.displayName=`SidebarMenuItem`;var JO=j.forwardRef(({asChild:e=!1,isActive:t=!1,variant:n=`default`,size:r=`default`,tooltip:i,className:a,...o},s)=>{let c=e?Zx:`button`,{isMobile:l,state:u}=jO(),d=(0,M.jsx)(c,{ref:s,"data-sidebar":`menu-button`,"data-size":r,"data-active":t,className:Z(YO({variant:n,size:r}),a),...o});return i?(typeof i==`string`&&(i={children:i}),(0,M.jsxs)(xO,{children:[(0,M.jsx)(SO,{asChild:!0,children:d}),(0,M.jsx)(CO,{side:`right`,align:`center`,hidden:u!==`collapsed`||l,...i})]})):d});JO.displayName=`SidebarMenuButton`;var YO=cy(`peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-none ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-[[data-sidebar=menu-action]]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:!size-8 group-data-[collapsible=icon]:!p-2 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0`,{variants:{variant:{default:`hover:bg-sidebar-accent hover:text-sidebar-accent-foreground`,outline:`bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]`},size:{default:`h-8 text-sm`,sm:`h-7 text-xs`,lg:`h-12 text-sm group-data-[collapsible=icon]:!p-0`}},defaultVariants:{variant:`default`,size:`default`}}),XO=j.forwardRef(({className:e,asChild:t=!1,showOnHover:n=!1,...r},i)=>(0,M.jsx)(t?Zx:`button`,{ref:i,"data-sidebar":`menu-action`,className:Z(`absolute right-1 top-1.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0`,`after:absolute after:-inset-2 after:md:hidden`,`peer-data-[size=sm]/menu-button:top-1`,`peer-data-[size=default]/menu-button:top-1.5`,`peer-data-[size=lg]/menu-button:top-2.5`,`group-data-[collapsible=icon]:hidden`,n&&`group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 peer-data-[active=true]/menu-button:text-sidebar-accent-foreground md:opacity-0`,e),...r}));XO.displayName=`SidebarMenuAction`;var ZO=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`div`,{ref:n,"data-sidebar":`menu-badge`,className:Z(`text-sidebar-foreground pointer-events-none absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums select-none`,`peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground`,`peer-data-[size=sm]/menu-button:top-1`,`peer-data-[size=default]/menu-button:top-1.5`,`peer-data-[size=lg]/menu-button:top-2.5`,`group-data-[collapsible=icon]:hidden`,e),...t}));ZO.displayName=`SidebarMenuBadge`;var QO=j.forwardRef(({className:e,showIcon:t=!1,...n},r)=>{let i=j.useMemo(()=>`${Math.floor(Math.random()*40)+50}%`,[]);return(0,M.jsxs)(`div`,{ref:r,"data-sidebar":`menu-skeleton`,className:Z(`rounded-md h-8 flex gap-2 px-2 items-center`,e),...n,children:[t&&(0,M.jsx)(Zw,{className:`size-4 rounded-md`,"data-sidebar":`menu-skeleton-icon`}),(0,M.jsx)(Zw,{className:`h-4 flex-1 max-w-[var(--skeleton-width)]`,"data-sidebar":`menu-skeleton-text`,style:{"--skeleton-width":i}})]})});QO.displayName=`SidebarMenuSkeleton`;var $O=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`ul`,{ref:n,"data-sidebar":`menu-sub`,className:Z(`mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5`,`group-data-[collapsible=icon]:hidden`,e),...t}));$O.displayName=`SidebarMenuSub`;var ek=j.forwardRef(({...e},t)=>(0,M.jsx)(`li`,{ref:t,...e}));ek.displayName=`SidebarMenuSubItem`;var tk=j.forwardRef(({asChild:e=!1,size:t=`md`,isActive:n,className:r,...i},a)=>(0,M.jsx)(e?Zx:`a`,{ref:a,"data-sidebar":`menu-sub-button`,"data-size":t,"data-active":n,className:Z(`flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground outline-none ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground`,`data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground`,t===`sm`&&`text-xs`,t===`md`&&`text-sm`,r),...i}));tk.displayName=`SidebarMenuSubButton`;var nk=cy(`text-muted-foreground flex flex-wrap items-center gap-1.5 break-words text-sm sm:gap-2.5`),rk=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`nav`,{ref:n,"aria-label":`breadcrumb`,className:Z(nk(),e),...t}));rk.displayName=`Breadcrumb`;var ik=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`ol`,{ref:n,className:Z(`text-muted-foreground flex flex-wrap items-center gap-1.5 break-words text-sm sm:gap-2.5`,e),...t}));ik.displayName=`BreadcrumbList`;var ak=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`li`,{ref:n,className:Z(`inline-flex items-center gap-1.5`,e),...t}));ak.displayName=`BreadcrumbItem`;var ok=j.forwardRef(({asChild:e,className:t,...n},r)=>(0,M.jsx)(e?Zx:`a`,{ref:r,className:Z(`hover:text-foreground transition-colors`,t),...n}));ok.displayName=`BreadcrumbLink`;var sk=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`span`,{ref:n,role:`link`,"aria-disabled":`true`,"aria-current":`page`,className:Z(`text-foreground font-normal`,e),...t}));sk.displayName=`BreadcrumbPage`;var ck=({children:e,className:t,...n})=>(0,M.jsx)(`li`,{role:`presentation`,"aria-hidden":`true`,className:Z(`[&>svg]:size-3.5`,t),...n,children:e??(0,M.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,className:`size-4`,children:(0,M.jsx)(`path`,{d:`m9 18 6-6-6-6`})})});ck.displayName=`BreadcrumbSeparator`;var lk=({className:e,...t})=>(0,M.jsxs)(`span`,{role:`presentation`,"aria-hidden":`true`,className:Z(`flex h-9 w-9 items-center justify-center`,e),...t,children:[(0,M.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,className:`size-4`,children:[(0,M.jsx)(`circle`,{cx:`12`,cy:`12`,r:`1`}),(0,M.jsx)(`circle`,{cx:`19`,cy:`12`,r:`1`}),(0,M.jsx)(`circle`,{cx:`5`,cy:`12`,r:`1`})]}),(0,M.jsx)(`span`,{className:`sr-only`,children:`More`})]});lk.displayName=`BreadcrumbElipssis`;var uk=j.createContext(void 0);function dk(e){let t=j.useContext(uk);return e||t||`ltr`}var fk=`rovingFocusGroup.onEntryFocus`,pk={bubbles:!1,cancelable:!0},mk=`RovingFocusGroup`,[hk,gk,_k]=D_(mk),[vk,yk]=v_(mk,[_k]),[bk,xk]=vk(mk),Sk=j.forwardRef((e,t)=>(0,M.jsx)(hk.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,M.jsx)(hk.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,M.jsx)(Ck,{...e,ref:t})})}));Sk.displayName=mk;var Ck=j.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:u=!1,...d}=e,f=j.useRef(null),p=g_(t,f),m=dk(a),[h,g]=nv({prop:o,defaultProp:s??null,onChange:c,caller:mk}),[_,v]=j.useState(!1),y=A_(l),b=gk(n),x=j.useRef(!1),[S,C]=j.useState(0);return j.useEffect(()=>{let e=f.current;if(e)return e.addEventListener(fk,y),()=>e.removeEventListener(fk,y)},[y]),(0,M.jsx)(bk,{scope:n,orientation:r,dir:m,loop:i,currentTabStopId:h,onItemFocus:j.useCallback(e=>g(e),[g]),onItemShiftTab:j.useCallback(()=>v(!0),[]),onFocusableItemAdd:j.useCallback(()=>C(e=>e+1),[]),onFocusableItemRemove:j.useCallback(()=>C(e=>e-1),[]),children:(0,M.jsx)(O_.div,{tabIndex:_||S===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:`none`,...e.style},onMouseDown:J(e.onMouseDown,()=>{x.current=!0}),onFocus:J(e.onFocus,e=>{let t=!x.current;if(e.target===e.currentTarget&&t&&!_){let t=new CustomEvent(fk,pk);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=b().filter(e=>e.focusable);kk([e.find(e=>e.active),e.find(e=>e.id===h),...e].filter(Boolean).map(e=>e.ref.current),u)}}x.current=!1}),onBlur:J(e.onBlur,()=>v(!1))})})}),wk=`RovingFocusGroupItem`,Tk=j.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=_S(),l=a||c,u=xk(wk,n),d=u.currentTabStopId===l,f=gk(n),{onFocusableItemAdd:p,onFocusableItemRemove:m,currentTabStopId:h}=u;return j.useEffect(()=>{if(r)return p(),()=>m()},[r,p,m]),(0,M.jsx)(hk.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,M.jsx)(O_.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:J(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:J(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:J(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=Ok(e,u.orientation,u.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=f().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=u.loop?Ak(n,r+1):n.slice(r+1)}setTimeout(()=>kk(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:h!=null}):o})})});Tk.displayName=wk;var Ek={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function Dk(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}function Ok(e,t,n){let r=Dk(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return Ek[r]}function kk(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function Ak(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var jk=Sk,Mk=Tk,Nk=[`Enter`,` `],Pk=[`ArrowDown`,`PageUp`,`Home`],Fk=[`ArrowUp`,`PageDown`,`End`],Ik=[...Pk,...Fk],Lk={ltr:[...Nk,`ArrowRight`],rtl:[...Nk,`ArrowLeft`]},Rk={ltr:[`ArrowLeft`],rtl:[`ArrowRight`]},zk=`Menu`,[Bk,Vk,Hk]=D_(zk),[Uk,Wk]=v_(zk,[Hk,gD,yk]),Gk=gD(),Kk=yk(),[qk,Jk]=Uk(zk),[Yk,Xk]=Uk(zk),Zk=e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=Gk(t),[c,l]=j.useState(null),u=j.useRef(!1),d=A_(a),f=dk(i);return j.useEffect(()=>{let e=()=>{u.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},t=()=>u.current=!1;return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),(0,M.jsx)(MD,{...s,children:(0,M.jsx)(qk,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,M.jsx)(Yk,{scope:t,onClose:j.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})};Zk.displayName=zk;var Qk=`MenuAnchor`,$k=j.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=Gk(n);return(0,M.jsx)(ND,{...i,...r,ref:t})});$k.displayName=Qk;var eA=`MenuPortal`,[tA,nA]=Uk(eA,{forceMount:void 0}),rA=e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=Jk(eA,t);return(0,M.jsx)(tA,{scope:t,forceMount:n,children:(0,M.jsx)(Z_,{present:n||a.open,children:(0,M.jsx)(Y_,{asChild:!0,container:i,children:r})})})};rA.displayName=eA;var iA=`MenuContent`,[aA,oA]=Uk(iA),sA=j.forwardRef((e,t)=>{let n=nA(iA,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=Jk(iA,e.__scopeMenu),o=Xk(iA,e.__scopeMenu);return(0,M.jsx)(Bk.Provider,{scope:e.__scopeMenu,children:(0,M.jsx)(Z_,{present:r||a.open,children:(0,M.jsx)(Bk.Slot,{scope:e.__scopeMenu,children:o.modal?(0,M.jsx)(cA,{...i,ref:t}):(0,M.jsx)(lA,{...i,ref:t})})})})}),cA=j.forwardRef((e,t)=>{let n=Jk(iA,e.__scopeMenu),r=j.useRef(null),i=g_(t,r);return j.useEffect(()=>{let e=r.current;if(e)return ew(e)},[]),(0,M.jsx)(dA,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:J(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),lA=j.forwardRef((e,t)=>{let n=Jk(iA,e.__scopeMenu);return(0,M.jsx)(dA,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),uA=b_(`MenuContent.ScrollLock`),dA=j.forwardRef((e,t)=>{let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEntryFocus:c,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,disableOutsideScroll:m,...h}=e,g=Jk(iA,n),_=Xk(iA,n),v=Gk(n),y=Kk(n),b=Vk(n),[x,S]=j.useState(null),C=j.useRef(null),w=g_(t,C,g.onContentChange),T=j.useRef(0),E=j.useRef(``),D=j.useRef(0),O=j.useRef(null),ee=j.useRef(`right`),te=j.useRef(0),ne=m?GC:j.Fragment,re=m?{as:uA,allowPinchZoom:!0}:void 0,ie=e=>{let t=E.current+e,n=b().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=YA(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;(function e(t){E.current=t,window.clearTimeout(T.current),t!==``&&(T.current=window.setTimeout(()=>e(``),1e3))})(t),o&&setTimeout(()=>o.focus())};j.useEffect(()=>()=>window.clearTimeout(T.current),[]),FS();let ae=j.useCallback(e=>ee.current===O.current?.side&&ZA(e,O.current?.area),[]);return(0,M.jsx)(aA,{scope:n,searchRef:E,onItemEnter:j.useCallback(e=>{ae(e)&&e.preventDefault()},[ae]),onItemLeave:j.useCallback(e=>{ae(e)||(C.current?.focus(),S(null))},[ae]),onTriggerLeave:j.useCallback(e=>{ae(e)&&e.preventDefault()},[ae]),pointerGraceTimerRef:D,onPointerGraceIntentChange:j.useCallback(e=>{O.current=e},[]),children:(0,M.jsx)(ne,{...re,children:(0,M.jsx)(SS,{asChild:!0,trapped:i,onMountAutoFocus:J(a,e=>{e.preventDefault(),C.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,M.jsx)(R_,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:(0,M.jsx)(jk,{asChild:!0,...y,dir:_.dir,orientation:`vertical`,loop:r,currentTabStopId:x,onCurrentTabStopIdChange:S,onEntryFocus:J(c,e=>{_.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,M.jsx)(PD,{role:`menu`,"aria-orientation":`vertical`,"data-state":WA(g.open),"data-radix-menu-content":``,dir:_.dir,...v,...h,ref:w,style:{outline:`none`,...h.style},onKeyDown:J(h.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&ie(e.key));let i=C.current;if(e.target!==i||!Ik.includes(e.key))return;e.preventDefault();let a=b().filter(e=>!e.disabled).map(e=>e.ref.current);Fk.includes(e.key)&&a.reverse(),qA(a)}),onBlur:J(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(T.current),E.current=``)}),onPointerMove:J(e.onPointerMove,QA(e=>{let t=e.target,n=te.current!==e.clientX;e.currentTarget.contains(t)&&n&&(ee.current=e.clientX>te.current?`right`:`left`,te.current=e.clientX)}))})})})})})})});sA.displayName=iA;var fA=`MenuGroup`,pA=j.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,M.jsx)(O_.div,{role:`group`,...r,ref:t})});pA.displayName=fA;var mA=`MenuLabel`,hA=j.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,M.jsx)(O_.div,{...r,ref:t})});hA.displayName=mA;var gA=`MenuItem`,_A=`menu.itemSelect`,vA=j.forwardRef((e,t)=>{let{disabled:n=!1,onSelect:r,...i}=e,a=j.useRef(null),o=Xk(gA,e.__scopeMenu),s=oA(gA,e.__scopeMenu),c=g_(t,a),l=j.useRef(!1),u=()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(_A,{bubbles:!0,cancelable:!0});e.addEventListener(_A,e=>r?.(e),{once:!0}),k_(e,t),t.defaultPrevented?l.current=!1:o.onClose()}};return(0,M.jsx)(yA,{...i,ref:c,disabled:n,onClick:J(e.onClick,u),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:J(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:J(e.onKeyDown,e=>{let t=s.searchRef.current!==``;n||t&&e.key===` `||Nk.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});vA.displayName=gA;var yA=j.forwardRef((e,t)=>{let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=oA(gA,n),s=Kk(n),c=j.useRef(null),l=g_(t,c),[u,d]=j.useState(!1),[f,p]=j.useState(``);return j.useEffect(()=>{let e=c.current;e&&p((e.textContent??``).trim())},[a.children]),(0,M.jsx)(Bk.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:(0,M.jsx)(Mk,{asChild:!0,...s,focusable:!r,children:(0,M.jsx)(O_.div,{role:`menuitem`,"data-highlighted":u?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:l,onPointerMove:J(e.onPointerMove,QA(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:J(e.onPointerLeave,QA(e=>o.onItemLeave(e))),onFocus:J(e.onFocus,()=>d(!0)),onBlur:J(e.onBlur,()=>d(!1))})})})}),bA=`MenuCheckboxItem`,xA=j.forwardRef((e,t)=>{let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,M.jsx)(kA,{scope:e.__scopeMenu,checked:n,children:(0,M.jsx)(vA,{role:`menuitemcheckbox`,"aria-checked":GA(n)?`mixed`:n,...i,ref:t,"data-state":KA(n),onSelect:J(i.onSelect,()=>r?.(GA(n)?!0:!n),{checkForDefaultPrevented:!1})})})});xA.displayName=bA;var SA=`MenuRadioGroup`,[CA,wA]=Uk(SA,{value:void 0,onValueChange:()=>{}}),TA=j.forwardRef((e,t)=>{let{value:n,onValueChange:r,...i}=e,a=A_(r);return(0,M.jsx)(CA,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,M.jsx)(pA,{...i,ref:t})})});TA.displayName=SA;var EA=`MenuRadioItem`,DA=j.forwardRef((e,t)=>{let{value:n,...r}=e,i=wA(EA,e.__scopeMenu),a=n===i.value;return(0,M.jsx)(kA,{scope:e.__scopeMenu,checked:a,children:(0,M.jsx)(vA,{role:`menuitemradio`,"aria-checked":a,...r,ref:t,"data-state":KA(a),onSelect:J(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});DA.displayName=EA;var OA=`MenuItemIndicator`,[kA,AA]=Uk(OA,{checked:!1}),jA=j.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:r,...i}=e,a=AA(OA,n);return(0,M.jsx)(Z_,{present:r||GA(a.checked)||a.checked===!0,children:(0,M.jsx)(O_.span,{...i,ref:t,"data-state":KA(a.checked)})})});jA.displayName=OA;var MA=`MenuSeparator`,NA=j.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,M.jsx)(O_.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})});NA.displayName=MA;var PA=`MenuArrow`,FA=j.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=Gk(n);return(0,M.jsx)(FD,{...i,...r,ref:t})});FA.displayName=PA;var IA=`MenuSub`,[LA,RA]=Uk(IA),zA=e=>{let{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,a=Jk(IA,t),o=Gk(t),[s,c]=j.useState(null),[l,u]=j.useState(null),d=A_(i);return j.useEffect(()=>(a.open===!1&&d(!1),()=>d(!1)),[a.open,d]),(0,M.jsx)(MD,{...o,children:(0,M.jsx)(qk,{scope:t,open:r,onOpenChange:d,content:l,onContentChange:u,children:(0,M.jsx)(LA,{scope:t,contentId:_S(),triggerId:_S(),trigger:s,onTriggerChange:c,children:n})})})};zA.displayName=IA;var BA=`MenuSubTrigger`,VA=j.forwardRef((e,t)=>{let n=Jk(BA,e.__scopeMenu),r=Xk(BA,e.__scopeMenu),i=RA(BA,e.__scopeMenu),a=oA(BA,e.__scopeMenu),o=j.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:c}=a,l={__scopeMenu:e.__scopeMenu},u=j.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return j.useEffect(()=>u,[u]),j.useEffect(()=>{let e=s.current;return()=>{window.clearTimeout(e),c(null)}},[s,c]),(0,M.jsx)($k,{asChild:!0,...l,children:(0,M.jsx)(yA,{id:i.triggerId,"aria-haspopup":`menu`,"aria-expanded":n.open,"aria-controls":i.contentId,"data-state":WA(n.open),...e,ref:h_(t,i.onTriggerChange),onClick:t=>{e.onClick?.(t),!(e.disabled||t.defaultPrevented)&&(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:J(e.onPointerMove,QA(t=>{a.onItemEnter(t),!t.defaultPrevented&&!e.disabled&&!n.open&&!o.current&&(a.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:J(e.onPointerLeave,QA(e=>{u();let t=n.content?.getBoundingClientRect();if(t){let r=n.content?.dataset.side,i=r===`right`,o=i?-5:5,c=t[i?`left`:`right`],l=t[i?`right`:`left`];a.onPointerGraceIntentChange({area:[{x:e.clientX+o,y:e.clientY},{x:c,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:c,y:t.bottom}],side:r}),window.clearTimeout(s.current),s.current=window.setTimeout(()=>a.onPointerGraceIntentChange(null),300)}else{if(a.onTriggerLeave(e),e.defaultPrevented)return;a.onPointerGraceIntentChange(null)}})),onKeyDown:J(e.onKeyDown,t=>{let i=a.searchRef.current!==``;e.disabled||i&&t.key===` `||Lk[r.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})});VA.displayName=BA;var HA=`MenuSubContent`,UA=j.forwardRef((e,t)=>{let n=nA(iA,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=Jk(iA,e.__scopeMenu),o=Xk(iA,e.__scopeMenu),s=RA(HA,e.__scopeMenu),c=j.useRef(null),l=g_(t,c);return(0,M.jsx)(Bk.Provider,{scope:e.__scopeMenu,children:(0,M.jsx)(Z_,{present:r||a.open,children:(0,M.jsx)(Bk.Slot,{scope:e.__scopeMenu,children:(0,M.jsx)(dA,{id:s.contentId,"aria-labelledby":s.triggerId,...i,ref:l,align:`start`,side:o.dir===`rtl`?`left`:`right`,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{o.isUsingKeyboardRef.current&&c.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:J(e.onFocusOutside,e=>{e.target!==s.trigger&&a.onOpenChange(!1)}),onEscapeKeyDown:J(e.onEscapeKeyDown,e=>{o.onClose(),e.preventDefault()}),onKeyDown:J(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=Rk[o.dir].includes(e.key);t&&n&&(a.onOpenChange(!1),s.trigger?.focus(),e.preventDefault())})})})})})});UA.displayName=HA;function WA(e){return e?`open`:`closed`}function GA(e){return e===`indeterminate`}function KA(e){return GA(e)?`indeterminate`:e?`checked`:`unchecked`}function qA(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function JA(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function YA(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=JA(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function XA(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function ZA(e,t){return t?XA({x:e.clientX,y:e.clientY},t):!1}function QA(e){return t=>t.pointerType===`mouse`?e(t):void 0}var $A=Zk,ej=$k,tj=rA,nj=sA,rj=pA,ij=hA,aj=vA,oj=xA,sj=TA,cj=DA,lj=jA,uj=NA,dj=FA,fj=VA,pj=UA,mj=`DropdownMenu`,[hj,gj]=v_(mj,[Wk]),_j=Wk(),[vj,yj]=hj(mj),bj=e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=_j(t),l=j.useRef(null),[u,d]=nv({prop:i,defaultProp:a??!1,onChange:o,caller:mj});return(0,M.jsx)(vj,{scope:t,triggerId:_S(),triggerRef:l,contentId:_S(),open:u,onOpenChange:d,onOpenToggle:j.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,M.jsx)($A,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})};bj.displayName=mj;var xj=`DropdownMenuTrigger`,Sj=j.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=yj(xj,n),o=_j(n);return(0,M.jsx)(ej,{asChild:!0,...o,children:(0,M.jsx)(O_.button,{type:`button`,id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,disabled:r,...i,ref:h_(t,a.triggerRef),onPointerDown:J(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:J(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})});Sj.displayName=xj;var Cj=`DropdownMenuPortal`,wj=e=>{let{__scopeDropdownMenu:t,...n}=e,r=_j(t);return(0,M.jsx)(tj,{...r,...n})};wj.displayName=Cj;var Tj=`DropdownMenuContent`,Ej=j.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=yj(Tj,n),a=_j(n),o=j.useRef(!1);return(0,M.jsx)(nj,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:J(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:J(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});Ej.displayName=Tj;var Dj=`DropdownMenuGroup`,Oj=j.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=_j(n);return(0,M.jsx)(rj,{...i,...r,ref:t})});Oj.displayName=Dj;var kj=`DropdownMenuLabel`,Aj=j.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=_j(n);return(0,M.jsx)(ij,{...i,...r,ref:t})});Aj.displayName=kj;var jj=`DropdownMenuItem`,Mj=j.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=_j(n);return(0,M.jsx)(aj,{...i,...r,ref:t})});Mj.displayName=jj;var Nj=`DropdownMenuCheckboxItem`,Pj=j.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=_j(n);return(0,M.jsx)(oj,{...i,...r,ref:t})});Pj.displayName=Nj;var Fj=`DropdownMenuRadioGroup`,Ij=j.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=_j(n);return(0,M.jsx)(sj,{...i,...r,ref:t})});Ij.displayName=Fj;var Lj=`DropdownMenuRadioItem`,Rj=j.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=_j(n);return(0,M.jsx)(cj,{...i,...r,ref:t})});Rj.displayName=Lj;var zj=`DropdownMenuItemIndicator`,Bj=j.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=_j(n);return(0,M.jsx)(lj,{...i,...r,ref:t})});Bj.displayName=zj;var Vj=`DropdownMenuSeparator`,Hj=j.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=_j(n);return(0,M.jsx)(uj,{...i,...r,ref:t})});Hj.displayName=Vj;var Uj=`DropdownMenuArrow`,Wj=j.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=_j(n);return(0,M.jsx)(dj,{...i,...r,ref:t})});Wj.displayName=Uj;var Gj=`DropdownMenuSubTrigger`,Kj=j.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=_j(n);return(0,M.jsx)(fj,{...i,...r,ref:t})});Kj.displayName=Gj;var qj=`DropdownMenuSubContent`,Jj=j.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=_j(n);return(0,M.jsx)(pj,{...i,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});Jj.displayName=qj;var Yj=bj,Xj=Sj,Zj=wj,Qj=Ej,$j=Aj,eM=Mj,tM=Pj,nM=Rj,rM=Bj,iM=Hj,aM=Kj,oM=Jj,sM=Yj,cM=Xj,lM=j.forwardRef(({className:e,inset:t,children:n,...r},i)=>(0,M.jsxs)(aM,{ref:i,className:Z(`flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0`,t&&`pl-8`,e),...r,children:[n,(0,M.jsx)(Cy,{className:`ml-auto`})]}));lM.displayName=aM.displayName;var uM=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(oM,{ref:n,className:Z(`z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,e),...t}));uM.displayName=oM.displayName;var dM=j.forwardRef(({className:e,sideOffset:t=4,...n},r)=>(0,M.jsx)(Zj,{children:(0,M.jsx)(Qj,{ref:r,sideOffset:t,className:Z(`z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,e),...n})}));dM.displayName=Qj.displayName;var fM=j.forwardRef(({className:e,inset:t,...n},r)=>(0,M.jsx)(eM,{ref:r,className:Z(`relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0`,t&&`pl-8`,e),...n}));fM.displayName=eM.displayName;var pM=j.forwardRef(({className:e,children:t,checked:n,...r},i)=>(0,M.jsxs)(tM,{ref:i,className:Z(`relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,e),checked:n,...r,children:[(0,M.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,M.jsx)(rM,{children:(0,M.jsx)(xy,{className:`h-4 w-4`})})}),t]}));pM.displayName=tM.displayName;var mM=j.forwardRef(({className:e,children:t,...n},r)=>(0,M.jsxs)(nM,{ref:r,className:Z(`relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,e),...n,children:[(0,M.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,M.jsx)(rM,{children:(0,M.jsx)(ky,{className:`h-2 w-2 fill-current`})})}),t]}));mM.displayName=nM.displayName;var hM=j.forwardRef(({className:e,inset:t,...n},r)=>(0,M.jsx)($j,{ref:r,className:Z(`px-2 py-1.5 text-sm font-semibold`,t&&`pl-8`,e),...n}));hM.displayName=$j.displayName;var gM=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(iM,{ref:n,className:Z(`-mx-1 my-1 h-px bg-muted`,e),...t}));gM.displayName=iM.displayName;var _M=({className:e,...t})=>(0,M.jsx)(`span`,{className:Z(`ml-auto text-xs tracking-widest opacity-60`,e),...t});_M.displayName=`DropdownMenuShortcut`;var vM=`modulepreload`,yM=function(e){return`/_account/`+e},bM={},xM=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}r=o(t.map(t=>{if(t=yM(t,n),t in bM)return;bM[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:vM,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},SM=[`en`,`zh-CN`],CM={en:()=>xM(()=>import(`./en-QM3gmMOi.js`),[]),"zh-CN":()=>xM(()=>import(`./zh-CN-B0Jn4kQl.js`),[])};function wM(e){return SM.includes(e)?e:e.toLowerCase().startsWith(`zh`)?`zh-CN`:`en`}async function TM(e){let t=wM(e);try{return(await CM[t]()).default}catch(t){return console.warn(`[account/i18n] Failed to load language pack '${e}':`,t),{}}}var EM={en:`English`,"zh-CN":`中文`};function DM(){let{t:e,language:t,changeLanguage:n}=vt();async function r(e){await n(e);try{localStorage.setItem(`account.lang`,e)}catch{}}return(0,M.jsxs)(sM,{children:[(0,M.jsx)(cM,{asChild:!0,children:(0,M.jsxs)(Q,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,"aria-label":e(`common.language`),children:[(0,M.jsx)(Ry,{className:`h-4 w-4`}),(0,M.jsx)(`span`,{className:`sr-only`,children:e(`common.language`)})]})}),(0,M.jsx)(dM,{align:`end`,children:SM.map(e=>(0,M.jsx)(fM,{onSelect:()=>void r(e),className:e===t?`font-medium`:void 0,children:EM[e]},e))})]})}function OM(e){let t=document.documentElement;e===`dark`?t.classList.add(`dark`):t.classList.remove(`dark`)}function kM(){let{t:e}=vt(),[,t]=(0,j.useState)(`light`);(0,j.useEffect)(()=>{let e=localStorage.getItem(`theme`);e?(t(e),OM(e===`system`?window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:e)):(t(`system`),OM(window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`))},[]);function n(e){t(e),localStorage.setItem(`theme`,e),OM(e===`system`?window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:e)}return(0,M.jsxs)(sM,{children:[(0,M.jsx)(cM,{asChild:!0,children:(0,M.jsxs)(Q,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,children:[(0,M.jsx)(eb,{className:`h-4 w-4 rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0`}),(0,M.jsx)(Gy,{className:`absolute h-4 w-4 rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100`}),(0,M.jsx)(`span`,{className:`sr-only`,children:e(`common.toggleTheme`)})]})}),(0,M.jsxs)(dM,{align:`end`,children:[(0,M.jsxs)(fM,{onClick:()=>n(`light`),children:[(0,M.jsx)(eb,{className:`mr-2 h-4 w-4`}),e(`common.light`)]}),(0,M.jsxs)(fM,{onClick:()=>n(`dark`),children:[(0,M.jsx)(Gy,{className:`mr-2 h-4 w-4`}),e(`common.dark`)]}),(0,M.jsx)(fM,{onClick:()=>n(`system`),children:e(`common.system`)})]})]})}function AM(e,t=[]){let n=[];function r(t,r){let i=j.createContext(r);i.displayName=t+`Context`;let a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=j.useMemo(()=>o,Object.values(o));return(0,M.jsx)(s.Provider,{value:c,children:r})};o.displayName=t+`Provider`;function s(n,o){let s=o?.[e]?.[a]||i,c=j.useContext(s);if(c)return c;if(r!==void 0)return r;throw Error(`\`${n}\` must be used within \`${t}\``)}return[o,s]}let i=()=>{let t=n.map(e=>j.createContext(e));return function(n){let r=n?.[e]||t;return j.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,jM(i,...t)]}function jM(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return j.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}function MM(){return(0,ot.useSyncExternalStore)(NM,()=>!0,()=>!1)}function NM(){return()=>{}}var PM=`Avatar`,[FM,IM]=AM(PM),[LM,RM]=FM(PM),zM=j.forwardRef((e,t)=>{let{__scopeAvatar:n,...r}=e,[i,a]=j.useState(`idle`);return(0,M.jsx)(LM,{scope:n,imageLoadingStatus:i,onImageLoadingStatusChange:a,children:(0,M.jsx)(sS.span,{...r,ref:t})})});zM.displayName=PM;var BM=`AvatarImage`,VM=j.forwardRef((e,t)=>{let{__scopeAvatar:n,src:r,onLoadingStatusChange:i=()=>{},...a}=e,o=RM(BM,n),s=GM(r,a),c=A_(e=>{i(e),o.onImageLoadingStatusChange(e)});return q_(()=>{s!==`idle`&&c(s)},[s,c]),s===`loaded`?(0,M.jsx)(sS.img,{...a,ref:t,src:r}):null});VM.displayName=BM;var HM=`AvatarFallback`,UM=j.forwardRef((e,t)=>{let{__scopeAvatar:n,delayMs:r,...i}=e,a=RM(HM,n),[o,s]=j.useState(r===void 0);return j.useEffect(()=>{if(r!==void 0){let e=window.setTimeout(()=>s(!0),r);return()=>window.clearTimeout(e)}},[r]),o&&a.imageLoadingStatus!==`loaded`?(0,M.jsx)(sS.span,{...i,ref:t}):null});UM.displayName=HM;function WM(e,t){return e?t?(e.src!==t&&(e.src=t),e.complete&&e.naturalWidth>0?`loaded`:`loading`):`error`:`idle`}function GM(e,{referrerPolicy:t,crossOrigin:n}){let r=MM(),i=j.useRef(null),a=r?(i.current||=new window.Image,i.current):null,[o,s]=j.useState(()=>WM(a,e));return q_(()=>{s(WM(a,e))},[a,e]),q_(()=>{let e=e=>()=>{s(e)};if(!a)return;let r=e(`loaded`),i=e(`error`);return a.addEventListener(`load`,r),a.addEventListener(`error`,i),t&&(a.referrerPolicy=t),typeof n==`string`&&(a.crossOrigin=n),()=>{a.removeEventListener(`load`,r),a.removeEventListener(`error`,i)}},[a,n,t]),o}var KM=zM,qM=VM,JM=UM,YM=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(KM,{ref:n,className:Z(`relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full`,e),...t}));YM.displayName=KM.displayName;var XM=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(qM,{ref:n,className:Z(`aspect-square h-full w-full`,e),...t}));XM.displayName=qM.displayName;var ZM=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(JM,{ref:n,className:Z(`flex h-full w-full items-center justify-center rounded-full bg-muted`,e),...t}));ZM.displayName=JM.displayName;var QM=(0,j.createContext)(null),$M=`auth-session-token`,eN=`auth-active-organization-id`;function tN(e){if(!(typeof window>`u`))try{e?.token?localStorage.setItem($M,e.token):localStorage.removeItem($M),e?.activeOrganizationId?localStorage.setItem(eN,e.activeOrganizationId):localStorage.removeItem(eN)}catch{}}function nN(e){if(!e)return{user:null,session:null};let t=e.data===void 0?e:e.data;return t?{user:t.user??null,session:t.session??null}:{user:null,session:null}}function rN({children:e}){let t=n_(),[n,r]=(0,j.useState)(null),[i,a]=(0,j.useState)(null),[o,s]=(0,j.useState)(!0),[c,l]=(0,j.useState)(null),[u,d]=(0,j.useState)([]),[f,p]=(0,j.useState)(!1),[m,h]=(0,j.useState)(!1),[g,_]=(0,j.useState)(null);(0,j.useEffect)(()=>{if(!t?.auth?.getConfig)return;let e=!1;return t.auth.getConfig().then(t=>{if(e)return;let n=t?.data??t??{},r={...n.features??{}};n.emailPassword?.disableSignUp===!0&&(r.signUpDisabled=!0),_(r)}).catch(()=>{e||_(null)}),()=>{e=!0}},[t]);let v=(0,j.useCallback)(async()=>{if(t?.organizations){p(!0);try{d((await t.organizations.list())?.organizations??[])}catch{d([])}finally{p(!1),h(!0)}}},[t]),y=(0,j.useCallback)(async()=>{if(t?.auth){s(!0),l(null);try{let{user:e,session:n}=nN(await t.auth.me());r(e),a(n),tN(e?n:null)}catch(e){l(e),r(null),a(null),tN(null)}finally{s(!1)}}},[t]);(0,j.useEffect)(()=>{y()},[y]),(0,j.useEffect)(()=>{n?v():(d([]),h(!1))},[n,v]);let b=(0,j.useCallback)(async()=>{if(t?.auth)try{await t.auth.logout()}finally{r(null),a(null),d([]),h(!1),tN(null)}},[t]),x=(0,j.useCallback)(async e=>{if(t?.organizations){await t.organizations.setActive(e),await y();try{localStorage.setItem(eN,e)}catch{}}},[t,y]),S=(0,j.useMemo)(()=>({user:n,session:i,loading:o,error:c,refresh:y,logout:b,setActiveOrganization:x,organizations:u,organizationsLoading:f,organizationsFetched:m,reloadOrganizations:v,features:g}),[n,i,o,c,y,b,x,u,f,m,v,g]);return(0,j.createElement)(QM.Provider,{value:S},e)}function iN(){let e=(0,j.useContext)(QM);if(!e)throw Error(`useSession must be used inside <SessionProvider>.`);return e}function aN(){let{organizations:e,organizationsLoading:t,reloadOrganizations:n}=iN();return{organizations:e,loading:t,error:null,reload:n}}function oN(){let e=n_(),[t,n]=(0,j.useState)(!1),[r,i]=(0,j.useState)(null);return{create:(0,j.useCallback)(async t=>{if(!e?.organizations)throw Error(`Client not ready`);n(!0),i(null);try{return await e.organizations.create(t)}catch(e){throw i(e),e}finally{n(!1)}},[e]),creating:t,error:r}}function sN(){let e=n_(),{reloadOrganizations:t,refresh:n}=iN(),[r,i]=(0,j.useState)(!1),[a,o]=(0,j.useState)(null);return{update:(0,j.useCallback)(async(r,a)=>{if(!e?.organizations?.update)throw Error(`Client not ready`);i(!0),o(null);try{let i=await e.organizations.update(r,a);return await t(),await n(),i}catch(e){throw o(e),e}finally{i(!1)}},[e,t,n]),updating:r,error:a}}function cN(){let e=n_(),{reloadOrganizations:t,refresh:n}=iN(),[r,i]=(0,j.useState)(!1),[a,o]=(0,j.useState)(null);return{remove:(0,j.useCallback)(async r=>{if(!e?.organizations?.delete)throw Error(`Client not ready`);i(!0),o(null);try{let i=await e.organizations.delete(r);return await t(),await n(),i}catch(e){throw o(e),e}finally{i(!1)}},[e,t,n]),deleting:r,error:a}}function lN({message:e}){return typeof document>`u`?null:(0,Gi.createPortal)((0,M.jsx)(`div`,{role:`status`,"aria-live":`polite`,className:`fixed inset-0 z-[100] flex items-center justify-center bg-background/80 backdrop-blur-sm`,children:(0,M.jsxs)(`div`,{className:`flex flex-col items-center gap-3 text-sm text-muted-foreground`,children:[(0,M.jsx)(`div`,{className:`size-8 animate-spin rounded-full border-2 border-muted-foreground border-t-transparent`}),(0,M.jsx)(`span`,{children:e})]})}),document.body)}function uN(e,t){let n=(e||t||`?`).trim(),r=n.split(/\s+/);return r.length>=2?(r[0][0]+r[1][0]).toUpperCase():n.slice(0,2).toUpperCase()}function dN(){let{t:e}=vt(),t=Hi(),{user:n,loading:r,logout:i}=iN(),[a,o]=(0,j.useState)(!1);return r&&!n?(0,M.jsx)(`div`,{className:`h-8 w-8 animate-pulse rounded-full bg-muted`,"aria-hidden":!0}):n?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(sM,{children:[(0,M.jsx)(cM,{asChild:!0,children:(0,M.jsx)(Q,{variant:`ghost`,size:`icon`,className:`h-8 w-8 rounded-full`,children:(0,M.jsxs)(YM,{className:`h-7 w-7`,children:[n.image?(0,M.jsx)(XM,{src:n.image,alt:n.name??n.email??e(`userMenu.user`)}):null,(0,M.jsx)(ZM,{className:`text-[11px]`,children:uN(n.name,n.email)})]})})}),(0,M.jsxs)(dM,{align:`end`,className:`w-64`,children:[(0,M.jsx)(hM,{children:(0,M.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,M.jsx)(`span`,{className:`truncate text-sm font-medium`,children:n.name||n.email}),n.email&&(0,M.jsx)(`span`,{className:`truncate text-[11px] text-muted-foreground`,children:n.email})]})}),(0,M.jsx)(gM,{}),(0,M.jsxs)(fM,{onSelect:()=>t({to:`/account`}),children:[(0,M.jsx)(sb,{className:`mr-2 h-3.5 w-3.5`}),e(`userMenu.account`)]}),(0,M.jsxs)(fM,{onSelect:()=>t({to:`/organizations`}),children:[(0,M.jsx)(by,{className:`mr-2 h-3.5 w-3.5`}),e(`userMenu.organizations`)]}),(0,M.jsx)(gM,{}),(0,M.jsxs)(fM,{onSelect:async()=>{o(!0);try{await i()}finally{window.location.assign(`/_account/login`)}},disabled:a,children:[(0,M.jsx)(Vy,{className:`mr-2 h-3.5 w-3.5`}),e(`userMenu.signOut`)]})]})]}),a?(0,M.jsx)(lN,{message:e(`auth.userMenu.signingOut`,{defaultValue:`Signing you out…`})}):null]}):(0,M.jsx)(Q,{variant:`outline`,size:`sm`,className:`h-8`,onClick:()=>t({to:`/login`}),children:e(`userMenu.signIn`)})}function fN(){let{t:e}=vt(),t=Hi(),n=Oa(),{organizations:r,loading:i,reload:a}=aN(),{session:o,setActiveOrganization:s}=iN(),[c,l]=(0,j.useState)(!1),[u,d]=(0,j.useState)(!1),f=o?.activeOrganizationId??void 0,p=(0,j.useMemo)(()=>r.find(e=>e.id===f)??null,[r,f]),m=async r=>{if(l(!1),r===f){t({to:`/organizations/$orgId/general`,params:{orgId:r}});return}d(!0);try{await s(r),await a(),q({title:e(`organizations.general.switched`)});let i=n.pathname.match(/^\/organizations\/[^/]+\/(general|members)\/?$/);t({to:(i?i[1]:`general`)===`members`?`/organizations/$orgId/members`:`/organizations/$orgId/general`,params:{orgId:r}})}catch(t){q({title:e(`organizations.switchFailed`),description:t.message,variant:`destructive`})}finally{d(!1)}};return(0,M.jsxs)(sM,{open:c,onOpenChange:l,children:[(0,M.jsx)(cM,{asChild:!0,children:(0,M.jsxs)(Q,{variant:`ghost`,size:`sm`,className:`h-8 gap-2 px-2 text-sm font-medium`,disabled:u,children:[p?(0,M.jsx)(`span`,{className:`max-w-[160px] truncate`,children:p.name}):(0,M.jsx)(`span`,{className:`text-muted-foreground`,children:e(i?`organizations.loading`:`organizationSwitcher.select`)}),(0,M.jsx)(Ty,{className:`h-3 w-3 opacity-50`})]})}),(0,M.jsxs)(dM,{align:`start`,className:`w-[280px]`,sideOffset:4,children:[(0,M.jsx)(hM,{className:`text-[10px] uppercase tracking-wider text-muted-foreground`,children:e(`organizations.title`)}),r.length===0&&!i&&(0,M.jsx)(`div`,{className:`px-3 py-4 text-center text-xs text-muted-foreground`,children:e(`organizations.emptyTitle`)}),r.map(e=>(0,M.jsxs)(fM,{onSelect:t=>{t.preventDefault(),m(e.id)},className:`flex items-center gap-2`,children:[(0,M.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,M.jsx)(`div`,{className:`truncate font-medium`,children:e.name}),e.slug&&(0,M.jsx)(`code`,{className:`text-[11px] text-muted-foreground font-mono`,children:e.slug})]}),e.id===f&&(0,M.jsx)(xy,{className:`h-3.5 w-3.5 text-primary`})]},e.id)),(0,M.jsx)(gM,{}),(0,M.jsxs)(fM,{onSelect:e=>{e.preventDefault(),l(!1),t({to:`/organizations/new`})},className:`gap-2 text-sm`,children:[(0,M.jsx)(qy,{className:`h-3.5 w-3.5`}),e(`organizationSwitcher.new`)]}),(0,M.jsx)(fM,{onSelect:e=>{e.preventDefault(),l(!1),t({to:`/organizations`})},className:`gap-2 text-sm text-muted-foreground`,children:e(`organizationSwitcher.manage`)})]})]})}function pN({label:e}){return(0,M.jsx)(`a`,{href:`/`,className:`flex h-8 w-8 items-center justify-center rounded-md bg-brand-gradient text-primary-foreground shadow-sm shadow-primary/30 ring-1 ring-white/15 transition-transform hover:scale-105`,"aria-label":e,children:(0,M.jsx)(Dy,{className:`h-4 w-4`})})}function mN(){return(0,M.jsx)(Cy,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-muted-foreground/50`})}function hN(){let{t:e}=vt(),t=Oa(),n=Bi({strict:!1}),r=(0,j.useMemo)(()=>{let r=t.pathname,i=t=>e(`topBar.breadcrumb.${t}`);if(r.startsWith(`/account`)){let e=[{label:i(`account`)}];return r===`/account/profile`?e.push({label:i(`profile`)}):r===`/account/security`?e.push({label:i(`security`)}):r===`/account/sessions`?e.push({label:i(`sessions`)}):r===`/account/two-factor`?e.push({label:i(`twoFactor`)}):r===`/account/oauth-applications`?e.push({label:i(`oauthApps`)}):r===`/account/oauth-applications/new`?e.push({label:i(`oauthApps`)},{label:i(`new`)}):r.startsWith(`/account/oauth-applications/`)&&e.push({label:i(`oauthApps`)}),e}if(r===`/organizations/new`)return[{label:i(`organizations`)},{label:i(`new`)}];if(n.orgId){let e=r.endsWith(`/general`)?i(`general`):r.endsWith(`/members`)?i(`members`):i(`settings`);return[{label:i(`organizations`)},{label:e}]}return r===`/organizations`||r.startsWith(`/organizations/`)?[{label:i(`organizations`)}]:r.startsWith(`/accept-invitation/`)?[{label:i(`acceptInvitation`)}]:r.startsWith(`/auth/device`)?[{label:i(`deviceAuthorization`)}]:[{label:i(`account`)}]},[t.pathname,n.orgId,e]);return(0,M.jsxs)(`header`,{className:`sticky top-0 z-30 flex h-14 shrink-0 items-center justify-between gap-2 border-b bg-background/80 px-2 backdrop-blur supports-[backdrop-filter]:bg-background/70 sm:px-4`,children:[(0,M.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 sm:gap-2.5`,children:[(0,M.jsx)(`div`,{className:`sm:hidden`,children:(0,M.jsx)(PO,{className:`h-9 w-9`})}),(0,M.jsx)(pN,{label:e(`topBar.accountHome`)}),(0,M.jsx)(`span`,{className:`hidden text-sm font-semibold tracking-tight sm:inline`,children:e(`topBar.brand`)}),(0,M.jsxs)(`div`,{className:`hidden items-center gap-1.5 sm:flex`,children:[(0,M.jsx)(mS,{orientation:`vertical`,className:`mx-1 h-4`}),(0,M.jsx)(fN,{}),(0,M.jsx)(mN,{}),(0,M.jsx)(rk,{children:(0,M.jsx)(ik,{children:r.map((e,t)=>(0,M.jsxs)(`div`,{className:`flex items-center`,children:[t>0&&(0,M.jsx)(ck,{}),(0,M.jsx)(ak,{children:(0,M.jsx)(sk,{className:`font-medium`,children:e.label})})]},t))})})]}),(0,M.jsx)(`div`,{className:`min-w-0 flex-1 sm:hidden`,children:r.length>0&&(0,M.jsx)(`span`,{className:`truncate text-sm font-medium`,children:r[r.length-1].label})})]}),(0,M.jsxs)(`div`,{className:`flex items-center gap-1 sm:gap-2`,children:[(0,M.jsx)(`div`,{className:`hidden sm:block`,children:(0,M.jsx)(DM,{})}),(0,M.jsx)(`div`,{className:`hidden sm:block`,children:(0,M.jsx)(kM,{})}),(0,M.jsx)(dN,{})]})]})}var gN=[{to:`/account`,label:`home`,icon:Fy,exact:!0},{to:`/account/profile`,label:`profile`,icon:sb},{to:`/account/security`,label:`security`,icon:Qy},{to:`/account/sessions`,label:`sessions`,icon:Wy},{to:`/account/two-factor`,label:`twoFactor`,icon:Zy},{to:`/account/invitations`,label:`invitations`,icon:Iy},{to:`/account/linked-accounts`,label:`linkedAccounts`,icon:By}],_N=[`group/nav relative transition-all duration-150`,`before:absolute before:left-0 before:top-1/2 before:h-5 before:w-[3px] before:-translate-y-1/2 before:rounded-r-full before:bg-brand-gradient before:opacity-0 before:transition-opacity`,`data-[active=true]:before:opacity-100`,`data-[active=true]:bg-sidebar-accent/80 data-[active=true]:text-sidebar-accent-foreground`,`[&>svg]:transition-transform [&>svg]:duration-150 hover:[&>svg]:scale-110`,`data-[active=true]:[&>svg]:text-primary`].join(` `);function vN(){let{t:e}=vt(),{pathname:t}=Oa(),{organizations:n}=aN(),r=t,i=t.match(/^\/organizations\/([^/]+)(?:\/.*)?$/),a=i&&n.some(e=>e.id===i[1])?i[1]:null;return(0,M.jsxs)(NO,{collapsible:`icon`,className:`h-full`,children:[(0,M.jsxs)(VO,{children:[(0,M.jsxs)(HO,{children:[(0,M.jsx)(UO,{children:e(`sidebar.groups.account`)}),(0,M.jsx)(GO,{children:(0,M.jsx)(KO,{children:gN.map(t=>{let n=t.icon;return(0,M.jsx)(qO,{children:(0,M.jsx)(JO,{asChild:!0,isActive:t.exact?r===t.to||r===`${t.to}/`:r===t.to||r.startsWith(`${t.to}/`),tooltip:e(`sidebar.items.${t.label}`),className:_N,children:(0,M.jsxs)(ra,{to:t.to,children:[(0,M.jsx)(n,{className:`size-4`}),(0,M.jsx)(`span`,{children:e(`sidebar.items.${t.label}`)})]})})},t.to)})})})]}),(0,M.jsx)(BO,{}),(0,M.jsxs)(HO,{children:[(0,M.jsx)(UO,{children:e(`sidebar.groups.organization`)}),(0,M.jsx)(GO,{children:(0,M.jsxs)(KO,{children:[(0,M.jsx)(qO,{children:(0,M.jsx)(JO,{asChild:!0,isActive:t===`/organizations`,tooltip:e(`sidebar.items.overview`),className:_N,children:(0,M.jsxs)(ra,{to:`/organizations`,children:[(0,M.jsx)(by,{className:`size-4`}),(0,M.jsx)(`span`,{children:e(`sidebar.items.overview`)})]})})}),a&&(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(qO,{children:(0,M.jsx)(JO,{asChild:!0,isActive:t===`/organizations/${a}/general`,tooltip:e(`sidebar.items.general`),className:_N,children:(0,M.jsxs)(ra,{to:`/organizations/$orgId/general`,params:{orgId:a},children:[(0,M.jsx)(Xy,{className:`size-4`}),(0,M.jsx)(`span`,{children:e(`sidebar.items.general`)})]})})}),(0,M.jsx)(qO,{children:(0,M.jsx)(JO,{asChild:!0,isActive:t===`/organizations/${a}/members`,tooltip:e(`sidebar.items.members`),className:_N,children:(0,M.jsxs)(ra,{to:`/organizations/$orgId/members`,params:{orgId:a},children:[(0,M.jsx)(lb,{className:`size-4`}),(0,M.jsx)(`span`,{children:e(`sidebar.items.members`)})]})})}),(0,M.jsx)(qO,{children:(0,M.jsx)(JO,{asChild:!0,isActive:t===`/organizations/${a}/teams`,tooltip:e(`sidebar.items.teams`),className:_N,children:(0,M.jsxs)(ra,{to:`/organizations/$orgId/teams`,params:{orgId:a},children:[(0,M.jsx)(cb,{className:`size-4`}),(0,M.jsx)(`span`,{children:e(`sidebar.items.teams`)})]})})})]})]})})]}),(0,M.jsx)(BO,{}),(0,M.jsxs)(HO,{children:[(0,M.jsx)(UO,{children:e(`sidebar.groups.developer`)}),(0,M.jsx)(GO,{children:(0,M.jsx)(KO,{children:(0,M.jsx)(qO,{children:(0,M.jsx)(JO,{asChild:!0,isActive:t.startsWith(`/account/oauth-applications`),tooltip:e(`sidebar.items.oauthApps`),className:_N,children:(0,M.jsxs)(ra,{to:`/account/oauth-applications`,children:[(0,M.jsx)(Ly,{className:`size-4`}),(0,M.jsx)(`span`,{children:e(`sidebar.items.oauthApps`)})]})})})})})]})]}),(0,M.jsx)(zO,{children:(0,M.jsx)(KO,{children:(0,M.jsx)(qO,{children:(0,M.jsx)(yN,{})})})})]})}function yN(){let{t:e}=vt(),{state:t,toggleSidebar:n}=jO(),r=e(t===`collapsed`?`sidebar.expand`:`sidebar.collapse`);return(0,M.jsx)(JO,{onClick:n,tooltip:r,"aria-label":r,children:(0,M.jsx)(Ky,{className:`size-4`})})}function bN(){return typeof window<`u`&&window.location.pathname.startsWith(`/_account`)?window.location.origin:`http://localhost:3000`}var xN=new Set([`/login`,`/register`,`/forgot-password`,`/reset-password`,`/verify-email`,`/verify-email-prompt`,`/auth/device`,`/setup`]);function SN(e){return xN.has(e)||e.startsWith(`/accept-invitation/`)}function CN(){let[e,t]=(0,j.useState)(null);return(0,j.useEffect)(()=>{let e=!1;return(async()=>{try{let n=await fetch(`/api/v1/auth/bootstrap-status`);if(!n.ok){e||t(!0);return}let r=await n.json();e||t(r.hasOwner!==!1)}catch{e||t(!0)}})(),()=>{e=!0}},[]),e}function wN({children:e}){let{user:t,loading:n}=iN(),r=Hi(),i=Oa(),a=SN(i.pathname),o=i.pathname.startsWith(`/oauth/`)||i.pathname===`/organizations/new`,s=CN(),c=i.pathname===`/setup`;return(0,j.useEffect)(()=>{s===!1&&!c&&!t&&r({to:`/setup`,replace:!0})},[s,c,t,r]),(0,j.useEffect)(()=>{n||s!==!1&&!t&&!a&&r({to:`/login`,search:{redirect:i.pathname+i.searchStr},replace:!0})},[t,n,a,r,i.pathname,i.searchStr,s]),s===null||n&&!t?(0,M.jsx)(`div`,{className:`flex min-h-screen w-full flex-1 items-center justify-center bg-background`,children:(0,M.jsx)(`div`,{className:`h-8 w-8 animate-spin rounded-full border-4 border-muted border-t-primary`})}):s===!1&&!c||!t&&!a?null:a||o?(0,M.jsx)(`div`,{className:`flex min-h-screen w-full`,children:e}):(0,M.jsxs)(MO,{className:`flex h-svh w-full flex-col`,children:[(0,M.jsx)(hN,{}),(0,M.jsxs)(`div`,{className:`flex min-h-0 flex-1 w-full`,children:[(0,M.jsx)(vN,{}),(0,M.jsx)(IO,{className:`flex min-w-0 flex-1 flex-col overflow-hidden`,children:(0,M.jsx)(`main`,{className:`flex min-h-0 flex-1 flex-col overflow-auto bg-background`,children:e})})]})]})}function TN(){let e=bN(),t=(0,j.useMemo)(()=>new Zg({baseUrl:e}),[e]),{language:n}=vt();return(0,M.jsx)(t_,{client:t,locale:n,children:(0,M.jsxs)(rN,{children:[(0,M.jsx)(wN,{children:(0,M.jsx)(ya,{})}),(0,M.jsx)(Gx,{})]})})}var EN=ca({component:TN}),$=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`div`,{ref:n,className:Z(`rounded-lg border bg-card text-card-foreground shadow-sm`,e),...t}));$.displayName=`Card`;var DN=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`div`,{ref:n,className:Z(`flex flex-col space-y-1.5 p-6`,e),...t}));DN.displayName=`CardHeader`;var ON=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`h3`,{ref:n,className:Z(`text-2xl font-semibold leading-none tracking-tight`,e),...t}));ON.displayName=`CardTitle`;var kN=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`p`,{ref:n,className:Z(`text-sm text-muted-foreground`,e),...t}));kN.displayName=`CardDescription`;var AN=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`div`,{ref:n,className:Z(`p-6 pt-0`,e),...t}));AN.displayName=`CardContent`;var jN=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`div`,{ref:n,className:Z(`flex items-center p-6 pt-0`,e),...t}));jN.displayName=`CardFooter`;function MN(e){let t=e.split(`:`)[0].toLowerCase();return/^cloud\./.test(t)}function NN(){return typeof window>`u`?null:window.location.host||null}function PN({children:e,formWidth:t=`sm`}){let{t:n}=vt(),r=t===`md`?`max-w-md`:`max-w-sm`,i=NN(),a=!!i&&!MN(i);return j.useEffect(()=>{if(typeof document>`u`||!i)return;let e=document.title;return a&&(document.title=i),()=>{document.title=e}},[i,a]),(0,M.jsx)(`div`,{className:`flex min-h-svh w-full items-center justify-center bg-muted p-6`,children:(0,M.jsxs)(`div`,{className:Z(`flex w-full flex-col gap-4`,r),children:[a?(0,M.jsx)(`div`,{className:`flex justify-center`,children:(0,M.jsx)(`span`,{className:`rounded-full border border-border/60 bg-background/60 px-2 py-0.5 font-mono text-[10px] uppercase tracking-wide text-muted-foreground`,title:n(`auth.shell.tenantHostHint`,{defaultValue:`You are signing in to this workspace`}),children:i})}):null,e]})})}var FN=la(`/verify-email-prompt`)({validateSearch:e=>({email:typeof e.email==`string`?e.email:void 0,redirect:typeof e.redirect==`string`?e.redirect:void 0}),component:IN});function IN(){let{t:e}=vt(),t=Hi(),{email:n,redirect:r}=FN.useSearch(),i=n_(),[a,o]=(0,j.useState)(!1),[s,c]=(0,j.useState)(!1);return(0,M.jsx)(PN,{children:(0,M.jsx)(`div`,{className:`flex flex-col gap-6`,children:(0,M.jsxs)($,{className:`border-border/60 shadow-sm shadow-primary/5 backdrop-blur supports-[backdrop-filter]:bg-card/95`,children:[(0,M.jsxs)(DN,{className:`text-center`,children:[(0,M.jsx)(`div`,{className:`mx-auto mb-4 flex size-16 items-center justify-center rounded-full bg-primary/10`,children:(0,M.jsx)(Hy,{className:`size-8 text-primary`})}),(0,M.jsx)(ON,{className:`text-xl tracking-tight`,children:e(`auth.verifyEmail.title`,{defaultValue:`Verify your email address`})}),(0,M.jsx)(kN,{children:e(`auth.verifyEmail.description`,{defaultValue:`We sent a verification link to your email address. Please click the link to verify your account.`})})]}),(0,M.jsx)(AN,{children:(0,M.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[n?(0,M.jsxs)(`p`,{className:`text-center text-sm text-muted-foreground`,children:[e(`auth.verifyEmail.sentTo`,{defaultValue:`Sent to:`}),` `,(0,M.jsx)(`span`,{className:`font-medium text-foreground`,children:n})]}):null,(0,M.jsx)(Q,{onClick:async()=>{if(!n||!i?.auth){q({title:e(`auth.verifyEmail.resendFailed`,{defaultValue:`Cannot resend verification email`}),description:e(`auth.verifyEmail.emailMissing`,{defaultValue:`Email address is missing`}),variant:`destructive`});return}o(!0);try{let t=await fetch(`/api/v1/auth/send-verification-email`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({email:n,callbackURL:r||`/`})});if(!t.ok){let e=await t.json().catch(()=>({message:`Unknown error`}));throw Error(e.message||`Failed to send verification email`)}c(!0),q({title:e(`auth.verifyEmail.resentSuccess`,{defaultValue:`Verification email sent!`}),description:e(`auth.verifyEmail.resentDescription`,{defaultValue:`Please check your inbox and click the verification link.`})})}catch(t){q({title:e(`auth.verifyEmail.resendFailed`,{defaultValue:`Failed to resend verification email`}),description:t.message,variant:`destructive`})}finally{o(!1)}},disabled:a||s,className:`w-full`,variant:s?`outline`:`default`,children:a?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(Jy,{className:`mr-2 size-4 animate-spin`}),e(`auth.verifyEmail.resending`,{defaultValue:`Sending...`})]}):s?e(`auth.verifyEmail.resent`,{defaultValue:`Email sent! Check your inbox`}):(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(Jy,{className:`mr-2 size-4`}),e(`auth.verifyEmail.resendButton`,{defaultValue:`Resend verification email`})]})}),(0,M.jsxs)(`div`,{className:`relative`,children:[(0,M.jsx)(`div`,{className:`absolute inset-0 flex items-center`,children:(0,M.jsx)(`span`,{className:`w-full border-t`})}),(0,M.jsx)(`div`,{className:`relative flex justify-center text-xs uppercase`,children:(0,M.jsx)(`span`,{className:`bg-card px-2 text-muted-foreground`,children:e(`auth.verifyEmail.or`,{defaultValue:`Or`})})})]}),(0,M.jsx)(Q,{onClick:()=>{t({to:`/login`,search:r?{redirect:r}:void 0})},variant:`ghost`,className:`w-full`,children:e(`auth.verifyEmail.backToLogin`,{defaultValue:`Back to login`})}),(0,M.jsx)(`p`,{className:`text-center text-xs text-muted-foreground`,children:e(`auth.verifyEmail.checkSpam`,{defaultValue:`Didn't receive the email? Check your spam folder or contact support.`})})]})})]})})})}var LN=la(`/verify-email`)({validateSearch:e=>{let t=e.token;return typeof t==`string`?{token:t}:{}},component:RN});function RN(){let{t:e}=vt(),{token:t}=LN.useSearch(),n=n_(),[r,i]=(0,j.useState)(`loading`),[a,o]=(0,j.useState)(``);return(0,j.useEffect)(()=>{if(!t){i(`error`),o(e(`auth.verifyEmail.missingToken`));return}let r=!1;return(async()=>{try{await n.auth.verifyEmail({token:t}),r||i(`success`)}catch(t){r||(i(`error`),o(t.message||e(`auth.verifyEmail.errorDescription`)))}})(),()=>{r=!0}},[t,e,n]),(0,M.jsx)(PN,{children:(0,M.jsxs)($,{className:`border-border/60 shadow-sm shadow-primary/5 backdrop-blur supports-[backdrop-filter]:bg-card/95`,children:[r===`loading`&&(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(DN,{className:`text-center`,children:[(0,M.jsx)(ON,{className:`text-xl tracking-tight`,children:e(`auth.verifyEmail.verifyingTitle`)}),(0,M.jsx)(kN,{children:e(`auth.verifyEmail.verifyingDescription`)})]}),(0,M.jsx)(AN,{className:`flex justify-center py-6`,children:(0,M.jsx)(`div`,{className:`h-10 w-10 animate-spin rounded-full border-4 border-muted border-t-primary`})})]}),r===`success`&&(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(DN,{className:`text-center`,children:[(0,M.jsx)(`div`,{className:`mx-auto mb-2 flex size-12 items-center justify-center rounded-full bg-emerald-500/10 text-emerald-500 ring-1 ring-emerald-500/30`,children:(0,M.jsx)(Ey,{className:`size-6`})}),(0,M.jsx)(ON,{className:`text-xl tracking-tight`,children:e(`auth.verifyEmail.successTitle`)}),(0,M.jsx)(kN,{children:e(`auth.verifyEmail.successDescription`)})]}),(0,M.jsx)(AN,{className:`text-center`,children:(0,M.jsx)(ra,{to:`/login`,className:`text-sm font-medium text-primary underline-offset-4 hover:underline`,children:e(`auth.verifyEmail.signInLink`)})})]}),r===`error`&&(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(DN,{className:`text-center`,children:[(0,M.jsx)(`div`,{className:`mx-auto mb-2 flex size-12 items-center justify-center rounded-full bg-destructive/10 text-destructive ring-1 ring-destructive/30`,children:(0,M.jsx)(Oy,{className:`size-6`})}),(0,M.jsx)(ON,{className:`text-xl tracking-tight`,children:e(`auth.verifyEmail.errorTitle`)}),(0,M.jsx)(kN,{children:a||e(`auth.verifyEmail.errorDescription`)})]}),(0,M.jsx)(AN,{className:`text-center`,children:(0,M.jsx)(ra,{to:`/login`,className:`text-sm font-medium text-primary underline-offset-4 hover:underline`,children:e(`auth.verifyEmail.backToSignIn`)})})]})]})})}var zN=`Label`,BN=j.forwardRef((e,t)=>(0,M.jsx)(sS.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));BN.displayName=zN;var VN=BN,HN=cy(`text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70`),UN=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(VN,{ref:n,className:Z(HN(),e),...t}));UN.displayName=VN.displayName;var WN=la(`/setup`)({component:KN});function GN(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)}function KN(){let{t:e}=vt(),t=Hi(),n=n_(),{user:r,refresh:i}=iN(),[a,o]=(0,j.useState)(``),[s,c]=(0,j.useState)(``),[l,u]=(0,j.useState)(``),[d,f]=(0,j.useState)(``),[p,m]=(0,j.useState)(!1),[h,g]=(0,j.useState)(null);return(0,j.useEffect)(()=>{let e=!1;return(async()=>{try{let{hasOwner:t}=await n.auth.bootstrapStatus();e||g(t)}catch{e||g(!1)}})(),()=>{e=!0}},[n]),(0,j.useEffect)(()=>{h===!0&&!r&&t({to:`/login`,replace:!0})},[h,r,t]),(0,j.useEffect)(()=>{r&&window.location.assign(`/`)},[r]),h===null?(0,M.jsx)(`div`,{className:`flex min-h-svh w-full items-center justify-center bg-muted`,children:(0,M.jsx)(`div`,{className:`h-8 w-8 animate-spin rounded-full border-4 border-muted-foreground/20 border-t-primary`})}):(0,M.jsx)(`div`,{className:`flex min-h-svh w-full items-center justify-center bg-muted p-6`,children:(0,M.jsx)(`div`,{className:`flex w-full max-w-md flex-col gap-6`,children:(0,M.jsxs)($,{children:[(0,M.jsxs)(DN,{className:`text-center`,children:[(0,M.jsx)(ON,{children:e(`auth.setup.welcomeTitle`)}),(0,M.jsx)(kN,{children:e(`auth.setup.description`)})]}),(0,M.jsx)(AN,{children:(0,M.jsxs)(`form`,{onSubmit:async t=>{if(t.preventDefault(),n?.auth){m(!0);try{await n.auth.register({name:a,email:s,password:l}),await i();let e=d.trim();if(e)try{let{organizations:t}=await n.organizations.list(),r=t?.[0],i;if(r?.id)await n.organizations.update(r.id,{name:e,slug:GN(e)}),i=r.id;else{let t=await n.organizations.create({name:e,slug:GN(e)});i=t?.id??t?.data?.id}i&&await n.organizations.setActive(i).catch(()=>{})}catch(e){console.warn(`[setup] organization rename/create failed`,e)}window.location.assign(`/`)}catch(t){q({title:e(`auth.setup.failed`),description:t.message,variant:`destructive`})}finally{m(!1)}}},className:`flex flex-col gap-4`,children:[(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsx)(UN,{htmlFor:`name`,children:e(`auth.setup.yourName`)}),(0,M.jsx)(oS,{id:`name`,autoComplete:`name`,required:!0,value:a,onChange:e=>o(e.target.value)})]}),(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsx)(UN,{htmlFor:`orgName`,children:e(`auth.setup.orgName`)}),(0,M.jsx)(oS,{id:`orgName`,required:!0,placeholder:e(`auth.setup.orgNamePlaceholder`),value:d,onChange:e=>f(e.target.value)})]}),(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsx)(UN,{htmlFor:`email`,children:e(`auth.emailLabel`)}),(0,M.jsx)(oS,{id:`email`,type:`email`,placeholder:e(`auth.emailPlaceholder`),autoComplete:`email`,required:!0,value:s,onChange:e=>c(e.target.value)})]}),(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsx)(UN,{htmlFor:`password`,children:e(`auth.passwordLabel`)}),(0,M.jsx)(oS,{id:`password`,type:`password`,autoComplete:`new-password`,required:!0,minLength:8,placeholder:e(`auth.setup.passwordHint`),value:l,onChange:e=>u(e.target.value)})]}),(0,M.jsx)(Q,{type:`submit`,className:`mt-2 w-full`,disabled:p,children:e(p?`auth.setup.submitting`:`auth.setup.submit`)})]})})]})})})}var qN=la(`/reset-password`)({validateSearch:e=>{let t=e.token;return typeof t==`string`?{token:t}:{}},component:JN});function JN(){let{t:e}=vt(),t=Hi(),{token:n}=qN.useSearch(),[r,i]=(0,j.useState)(``),[a,o]=(0,j.useState)(``),[s,c]=(0,j.useState)(!1);return(0,M.jsx)(PN,{children:(0,M.jsxs)($,{className:`border-border/60 shadow-sm shadow-primary/5 backdrop-blur supports-[backdrop-filter]:bg-card/95`,children:[(0,M.jsxs)(DN,{className:`text-center`,children:[(0,M.jsx)(ON,{className:`text-xl tracking-tight`,children:e(`auth.resetPassword.title`)}),(0,M.jsx)(kN,{children:e(`auth.resetPassword.description`)})]}),(0,M.jsx)(AN,{children:n?(0,M.jsxs)(`form`,{onSubmit:async i=>{if(i.preventDefault(),r!==a){q({title:e(`auth.resetPassword.passwordsMismatch`),variant:`destructive`});return}if(!n){q({title:e(`auth.resetPassword.missingToken`),variant:`destructive`});return}c(!0);try{let i=await fetch(`/api/v1/auth/reset-password`,{method:`POST`,headers:{"Content-Type":`application/json`},credentials:`include`,body:JSON.stringify({token:n,newPassword:r})});if(!i.ok){let e=await i.json().catch(()=>({}));throw Error(e?.message||`Request failed: ${i.status}`)}q({title:e(`auth.resetPassword.success`)}),t({to:`/login`})}catch(t){q({title:e(`auth.resetPassword.failed`),description:t.message,variant:`destructive`})}finally{c(!1)}},className:`flex flex-col gap-4`,children:[(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsx)(UN,{htmlFor:`new-password`,children:e(`auth.resetPassword.newPassword`)}),(0,M.jsx)(oS,{id:`new-password`,type:`password`,autoComplete:`new-password`,required:!0,minLength:8,value:r,onChange:e=>i(e.target.value)})]}),(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsx)(UN,{htmlFor:`confirm-password`,children:e(`auth.resetPassword.confirmPassword`)}),(0,M.jsx)(oS,{id:`confirm-password`,type:`password`,autoComplete:`new-password`,required:!0,minLength:8,value:a,onChange:e=>o(e.target.value)})]}),(0,M.jsx)(Q,{type:`submit`,className:`w-full bg-brand-gradient text-primary-foreground shadow-sm shadow-primary/20 transition-all hover:opacity-95 hover:shadow-md hover:shadow-primary/30`,disabled:s,children:e(s?`auth.resetPassword.submitting`:`auth.resetPassword.submit`)})]}):(0,M.jsxs)(`p`,{className:`text-sm text-muted-foreground text-center`,children:[e(`auth.resetPassword.invalidToken`),` `,(0,M.jsx)(ra,{to:`/forgot-password`,className:`font-medium text-primary underline-offset-4 hover:underline`,children:e(`auth.resetPassword.requestNewLink`)})]})})]})})}function YN({mode:e,redirect:t}){let{t:n}=vt(),r=n_(),[i,a]=(0,j.useState)([]),[o,s]=(0,j.useState)(!0),[c,l]=(0,j.useState)(null);if((0,j.useEffect)(()=>{r?.auth?.getConfig&&r.auth.getConfig().then(e=>{a((e?.socialProviders??e?.data?.socialProviders??[]).filter(e=>e.enabled))}).catch(e=>{console.warn(`[SocialSignInButtons] failed to load auth config`,e)}).finally(()=>s(!1))},[r]),o||i.length===0)return null;let u=n(e===`sign-in`?`auth.social.continueWith`:`auth.social.signUpWith`),d=window.location.origin+`/_account/login`+(t?`?redirect=${encodeURIComponent(t)}`:``),f=e=>{c||(l(e),Promise.resolve(r.auth.signInWithProvider(e.id,{callbackURL:d,errorCallbackURL:d,type:e.type??`social`})).catch(e=>{console.warn(`[SocialSignInButtons] signInWithProvider failed`,e),l(null)}))};return(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[i.map(e=>{let t=c?.id===e.id;return(0,M.jsxs)(Q,{type:`button`,variant:`outline`,className:`w-full`,disabled:!!c,onClick:()=>f(e),children:[t?(0,M.jsx)(`span`,{className:`mr-2 inline-block size-4 animate-spin rounded-full border-2 border-muted-foreground border-t-transparent`}):(0,M.jsx)(`span`,{className:`mr-2 flex h-4 w-4 items-center justify-center rounded-sm bg-muted text-[10px] font-bold uppercase`,children:e.id[0]}),t?n(`auth.social.redirectingTo`,{provider:e.name,defaultValue:`Redirecting to ${e.name}…`}):`${u} ${e.name}`]},e.id)}),(0,M.jsxs)(`div`,{className:`relative my-1`,children:[(0,M.jsx)(`div`,{className:`absolute inset-0 flex items-center`,children:(0,M.jsx)(`span`,{className:`w-full border-t`})}),(0,M.jsx)(`div`,{className:`relative flex justify-center text-xs uppercase`,children:(0,M.jsx)(`span`,{className:`bg-card px-2 text-muted-foreground`,children:n(`auth.social.orContinueEmail`)})})]}),c&&typeof document<`u`?(0,Gi.createPortal)((0,M.jsx)(`div`,{role:`status`,"aria-live":`polite`,className:`fixed inset-0 z-[100] flex items-center justify-center bg-background/80 backdrop-blur-sm`,children:(0,M.jsxs)(`div`,{className:`flex flex-col items-center gap-3 text-sm text-muted-foreground`,children:[(0,M.jsx)(`div`,{className:`size-8 animate-spin rounded-full border-2 border-muted-foreground border-t-transparent`}),(0,M.jsx)(`span`,{children:n(`auth.social.redirectingTo`,{provider:c.name,defaultValue:`Redirecting to ${c.name}…`})})]})}),document.body):null]})}function XN(e,t){if(e.metaKey||e.ctrlKey||e.shiftKey||e.button===1)return;e.preventDefault();let n=Math.min(960,window.screen.availWidth-80),r=Math.min(720,window.screen.availHeight-80),i=Math.max(0,Math.round((window.screen.availWidth-n)/2)),a=Math.max(0,Math.round((window.screen.availHeight-r)/2)),o=[`popup=yes`,`width=${n}`,`height=${r}`,`left=${i}`,`top=${a}`,`resizable=yes`,`scrollbars=yes`,`noopener=yes`,`noreferrer=yes`].join(`,`);window.open(t,`objectstack-legal`,o)||window.open(t,`_blank`,`noopener,noreferrer`)}function ZN({termsUrl:e,privacyUrl:t}){let{t:n}=vt(`account`),r=typeof e==`string`&&e.length>0,i=typeof t==`string`&&t.length>0;return!r&&!i?null:(0,M.jsxs)(`p`,{className:`px-6 text-center text-xs text-muted-foreground [&_a]:underline [&_a]:underline-offset-4 [&_a]:hover:text-primary`,children:[n(`legal.agreementPrefix`),` `,r?(0,M.jsx)(`a`,{href:e,target:`objectstack-legal`,rel:`noreferrer noopener`,onClick:t=>XN(t,e),children:n(`legal.termsOfService`)}):null,r&&i?(0,M.jsxs)(M.Fragment,{children:[` `,n(`legal.and`),` `]}):null,i?(0,M.jsx)(`a`,{href:t,target:`objectstack-legal`,rel:`noreferrer noopener`,onClick:e=>XN(e,t),children:n(`legal.privacyPolicy`)}):null,`.`]})}var QN=la(`/register`)({validateSearch:e=>{let t=e.redirect;return typeof t==`string`?{redirect:t}:{}},component:tP});function $N(e){return!!e&&e.startsWith(`/`)&&!e.startsWith(`//`)}function eP(e){return e.startsWith(`/_`)?e:`/_account/`.replace(/\/$/,``)+e}function tP(){let{t:e}=vt(),t=Hi(),{redirect:n}=QN.useSearch(),r=n_(),{session:i,user:a,loading:o,refresh:s,organizations:c,organizationsLoading:l,organizationsFetched:u,setActiveOrganization:d,features:f}=iN();(0,j.useEffect)(()=>{f?.signUpDisabled===!0&&t({to:`/login`,search:n?{redirect:n}:{},replace:!0})},[f?.signUpDisabled,t,n]);let[p,m]=(0,j.useState)(``),[h,g]=(0,j.useState)(``),[_,v]=(0,j.useState)(``),[y,b]=(0,j.useState)(!1),[x,S]=(0,j.useState)(!1);return(0,j.useEffect)(()=>{if(a){if(typeof window<`u`){let e=new URLSearchParams(window.location.search);if(e.has(`client_id`)&&e.has(`redirect_uri`)){window.location.assign(`/api/v1/auth/oauth2/authorize${window.location.search}`);return}}if(!i?.activeOrganizationId){if(!u||l||x)return;if(c.length===1){S(!0),d(c[0].id).catch(()=>void 0).finally(()=>S(!1));return}if(!f)return;if(c.length>1){t({to:`/organizations`});return}if(f.multiOrgEnabled===!1){$N(n)?window.location.assign(eP(n)):window.location.assign(`/`);return}t({to:`/organizations/new`,search:n?{redirect:n}:{}});return}if(!x){if($N(n)){window.location.assign(eP(n));return}window.location.assign(`/`)}}},[a,i,t,n,c,l,u,x,d,f]),(0,M.jsx)(PN,{children:o||a?(0,M.jsxs)(`div`,{className:`flex flex-col items-center gap-3 py-10 text-sm text-muted-foreground`,children:[(0,M.jsx)(`div`,{className:`size-6 animate-spin rounded-full border-2 border-muted-foreground border-t-transparent`}),(0,M.jsx)(`span`,{children:a?e(`auth.register.signingIn`,{defaultValue:`Setting up your account…`}):e(`auth.login.redirecting`,{defaultValue:`Loading…`})})]}):(0,M.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,M.jsxs)($,{className:`border-border/60 shadow-sm shadow-primary/5 backdrop-blur supports-[backdrop-filter]:bg-card/95`,children:[(0,M.jsxs)(DN,{className:`text-center`,children:[(0,M.jsx)(ON,{className:`text-xl tracking-tight`,children:e(`auth.register.title`)}),(0,M.jsx)(kN,{children:e(`auth.register.description`)})]}),(0,M.jsx)(AN,{children:(0,M.jsx)(`form`,{onSubmit:async i=>{if(i.preventDefault(),r?.auth){b(!0);try{let i=await r.auth.register({name:p,email:h,password:_}),a=i?.data??i;if(a&&a.token===null&&a.user){t({to:`/verify-email-prompt`,search:{email:h,redirect:n}});return}try{await s()}catch(e){let r=e.message;if(r.includes(`email`)&&(r.toLowerCase().includes(`verif`)||r.toLowerCase().includes(`not verified`))){t({to:`/verify-email-prompt`,search:{email:h,redirect:n}});return}throw e}q({title:e(`auth.register.successToast`)})}catch(r){let i=r.message;if(i.includes(`email`)&&(i.toLowerCase().includes(`verif`)||i.toLowerCase().includes(`sent`))){t({to:`/verify-email-prompt`,search:{email:h,redirect:n}});return}q({title:e(`auth.register.failed`),description:i,variant:`destructive`})}finally{b(!1)}}},children:(0,M.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,M.jsx)(YN,{mode:`sign-up`,redirect:n}),(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsx)(UN,{htmlFor:`name`,children:e(`auth.nameLabel`)}),(0,M.jsx)(oS,{id:`name`,autoComplete:`name`,required:!0,value:p,onChange:e=>m(e.target.value)})]}),(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsx)(UN,{htmlFor:`email`,children:e(`auth.emailLabel`)}),(0,M.jsx)(oS,{id:`email`,type:`email`,placeholder:e(`auth.emailPlaceholder`),autoComplete:`email`,required:!0,value:h,onChange:e=>g(e.target.value)})]}),(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsx)(UN,{htmlFor:`password`,children:e(`auth.passwordLabel`)}),(0,M.jsx)(oS,{id:`password`,type:`password`,autoComplete:`new-password`,required:!0,minLength:8,value:_,onChange:e=>v(e.target.value)})]}),(0,M.jsx)(Q,{type:`submit`,className:`w-full`,disabled:y,children:e(y?`auth.register.submitting`:`auth.register.submit`)}),(0,M.jsxs)(`p`,{className:`text-center text-sm text-muted-foreground`,children:[e(`auth.register.haveAccount`),` `,(0,M.jsx)(ra,{to:`/login`,search:n?{redirect:n}:void 0,className:`font-medium text-primary underline-offset-4 hover:underline`,children:e(`auth.register.signIn`)})]})]})})})]}),(0,M.jsx)(ZN,{termsUrl:f?.termsUrl,privacyUrl:f?.privacyUrl})]})})}var nP=la(`/login`)({validateSearch:e=>{let t=e.redirect;return typeof t==`string`?{redirect:t}:{}},component:aP});function rP(e){return!!e&&e.startsWith(`/`)&&!e.startsWith(`//`)}function iP(e){return e.startsWith(`/_`)?e:`/_account/`.replace(/\/$/,``)+e}function aP(){let{t:e}=vt(),t=Hi(),{redirect:n}=nP.useSearch(),r=n_(),i=null;if(typeof window<`u`){let e=new URLSearchParams(window.location.search),t=e.get(`redirect_uri`);if(e.has(`client_id`)&&t)try{i=new URL(t).host}catch{i=null}}let{session:a,user:o,loading:s,refresh:c,organizations:l,organizationsLoading:u,organizationsFetched:d,setActiveOrganization:f,features:p}=iN(),m=p?.signUpDisabled===!0,[h,g]=(0,j.useState)(``),[_,v]=(0,j.useState)(``),[y,b]=(0,j.useState)(!1),[x,S]=(0,j.useState)(!1);return(0,j.useEffect)(()=>{if(o){if(typeof window<`u`){let e=new URLSearchParams(window.location.search);if(e.has(`client_id`)&&e.has(`redirect_uri`)){window.location.assign(`/api/v1/auth/oauth2/authorize${window.location.search}`);return}}if(!a?.activeOrganizationId){if(!d||u||x)return;if(l.length===1){S(!0),f(l[0].id).catch(()=>void 0).finally(()=>S(!1));return}if(!p)return;if(l.length===0){if(p.multiOrgEnabled===!1){rP(n)?window.location.assign(iP(n)):window.location.assign(`/`);return}t({to:`/organizations/new`});return}if(p.multiOrgEnabled===!1){S(!0),f(l[0].id).catch(()=>void 0).finally(()=>S(!1));return}t({to:`/organizations`});return}if(!x){if(rP(n)){window.location.assign(iP(n));return}window.location.assign(`/`)}}},[o,a,t,n,l,u,d,x,f,p]),s||o?(0,M.jsx)(PN,{children:(0,M.jsxs)(`div`,{className:`flex flex-col items-center gap-3 py-10 text-sm text-muted-foreground`,children:[(0,M.jsx)(`div`,{className:`size-6 animate-spin rounded-full border-2 border-muted-foreground border-t-transparent`}),(0,M.jsx)(`span`,{children:e(`auth.login.signingIn`,{defaultValue:`Signing you in…`})})]})}):(0,M.jsxs)(PN,{children:[y?(0,M.jsx)(lN,{message:e(`auth.login.signingIn`,{defaultValue:`Signing you in…`})}):null,(0,M.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[i?(0,M.jsxs)(`div`,{role:`status`,className:`flex items-start gap-3 rounded-md border border-primary/30 bg-primary/5 px-4 py-3 text-sm text-foreground`,children:[(0,M.jsx)(`span`,{className:`mt-0.5 inline-block size-2 shrink-0 rounded-full bg-primary`}),(0,M.jsx)(`span`,{children:e(`auth.login.ssoHandoff`,{target:i,defaultValue:`Continue to ${i}`})})]}):null,(0,M.jsxs)($,{className:`border-border/60 shadow-sm shadow-primary/5 backdrop-blur supports-[backdrop-filter]:bg-card/95`,children:[(0,M.jsxs)(DN,{className:`text-center`,children:[(0,M.jsx)(ON,{className:`text-xl tracking-tight`,children:e(`auth.login.title`)}),(0,M.jsx)(kN,{children:e(`auth.login.description`)})]}),(0,M.jsx)(AN,{children:(0,M.jsx)(`form`,{onSubmit:async i=>{if(i.preventDefault(),r?.auth){b(!0);try{await r.auth.login({type:`email`,email:h,password:_}),await c(),q({title:e(`auth.login.welcomeToast`)})}catch(r){let i=r.message,a=r.code,o=(i||``).toLowerCase();if(a===`EMAIL_NOT_VERIFIED`||o.includes(`email`)&&(o.includes(`verif`)||o.includes(`not verified`))){t({to:`/verify-email-prompt`,search:{email:h,redirect:n}});return}q({title:e(`auth.login.failed`),description:i,variant:`destructive`})}finally{b(!1)}}},children:(0,M.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,M.jsx)(YN,{mode:`sign-in`,redirect:n}),(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsx)(UN,{htmlFor:`email`,children:e(`auth.emailLabel`)}),(0,M.jsx)(oS,{id:`email`,type:`email`,placeholder:e(`auth.emailPlaceholder`),autoComplete:`email`,required:!0,value:h,onChange:e=>g(e.target.value)})]}),(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsxs)(`div`,{className:`flex items-center`,children:[(0,M.jsx)(UN,{htmlFor:`password`,children:e(`auth.passwordLabel`)}),(0,M.jsx)(ra,{to:`/forgot-password`,className:`ml-auto text-sm underline-offset-4 hover:underline`,children:e(`auth.login.forgotPassword`)})]}),(0,M.jsx)(oS,{id:`password`,type:`password`,autoComplete:`current-password`,required:!0,value:_,onChange:e=>v(e.target.value)})]}),(0,M.jsx)(Q,{type:`submit`,className:`w-full`,disabled:y,children:e(y?`auth.login.submitting`:`auth.login.submit`)}),m?null:(0,M.jsxs)(`p`,{className:`text-center text-sm text-muted-foreground`,children:[e(`auth.login.noAccount`),` `,(0,M.jsx)(ra,{to:`/register`,search:n?{redirect:n}:void 0,className:`font-medium text-primary underline-offset-4 hover:underline`,children:e(`auth.login.signUp`)})]})]})})})]}),(0,M.jsx)(ZN,{termsUrl:p?.termsUrl,privacyUrl:p?.privacyUrl})]})]})}var oP=la(`/forgot-password`)({component:sP});function sP(){let{t:e}=vt(),[t,n]=(0,j.useState)(``),[r,i]=(0,j.useState)(!1),[a,o]=(0,j.useState)(!1);return(0,M.jsx)(PN,{children:(0,M.jsx)($,{className:`border-border/60 shadow-sm shadow-primary/5 backdrop-blur supports-[backdrop-filter]:bg-card/95`,children:a?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(DN,{className:`text-center`,children:[(0,M.jsx)(ON,{className:`text-xl tracking-tight`,children:e(`auth.forgotPassword.checkEmailTitle`)}),(0,M.jsx)(kN,{children:e(`auth.forgotPassword.checkEmailDescription`,{email:t})})]}),(0,M.jsx)(AN,{className:`text-center`,children:(0,M.jsx)(ra,{to:`/login`,className:`text-sm font-medium text-primary underline-offset-4 hover:underline`,children:e(`auth.forgotPassword.backToSignIn`)})})]}):(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(DN,{className:`text-center`,children:[(0,M.jsx)(ON,{className:`text-xl tracking-tight`,children:e(`auth.forgotPassword.title`)}),(0,M.jsx)(kN,{children:e(`auth.forgotPassword.description`)})]}),(0,M.jsx)(AN,{children:(0,M.jsxs)(`form`,{onSubmit:async n=>{n.preventDefault(),i(!0);try{let e=window.location.origin+`/_account/`.replace(/\/$/,``)+`/reset-password`,n=await fetch(`/api/v1/auth/request-password-reset`,{method:`POST`,headers:{"Content-Type":`application/json`},credentials:`include`,body:JSON.stringify({email:t,redirectTo:e})});if(!n.ok){let e=await n.json().catch(()=>({}));throw Error(e?.message||`Request failed: ${n.status}`)}o(!0)}catch(t){q({title:e(`auth.forgotPassword.failed`),description:t.message,variant:`destructive`})}finally{i(!1)}},className:`flex flex-col gap-4`,children:[(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsx)(UN,{htmlFor:`email`,children:e(`auth.emailLabel`)}),(0,M.jsx)(oS,{id:`email`,type:`email`,placeholder:e(`auth.emailPlaceholder`),autoComplete:`email`,required:!0,value:t,onChange:e=>n(e.target.value)})]}),(0,M.jsx)(Q,{type:`submit`,className:`w-full bg-brand-gradient text-primary-foreground shadow-sm shadow-primary/20 transition-all hover:opacity-95 hover:shadow-md hover:shadow-primary/30`,disabled:r,children:e(r?`auth.forgotPassword.submitting`:`auth.forgotPassword.submit`)}),(0,M.jsxs)(`p`,{className:`text-center text-sm text-muted-foreground`,children:[e(`auth.forgotPassword.rememberPassword`),` `,(0,M.jsx)(ra,{to:`/login`,className:`font-medium text-primary underline-offset-4 hover:underline`,children:e(`auth.forgotPassword.signIn`)})]})]})})]})})})}var cP=la(`/account`)({component:lP});function lP(){return(0,M.jsx)(`div`,{className:`flex flex-1 flex-col overflow-hidden`,children:(0,M.jsx)(`div`,{className:`flex-1 overflow-auto px-4 py-6 sm:px-6 sm:py-8`,children:(0,M.jsx)(`div`,{className:`page-enter mx-auto flex max-w-4xl flex-col gap-6`,children:(0,M.jsx)(ya,{})})})})}var uP=la(`/`)({component:dP});function dP(){return(0,M.jsx)(Ui,{to:`/login`})}var fP=cy(`inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2`,{variants:{variant:{default:`border-transparent bg-primary text-primary-foreground hover:bg-primary/80`,secondary:`border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80`,destructive:`border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80`,outline:`text-foreground`}},defaultVariants:{variant:`default`}});function pP({className:e,variant:t,...n}){return(0,M.jsx)(`div`,{className:Z(fP({variant:t}),e),...n})}function mP({title:e,description:t,icon:n,actions:r,className:i,...a}){return(0,M.jsxs)(`div`,{className:Z(`relative overflow-hidden rounded-xl border bg-brand-gradient-subtle`,`px-5 py-5 sm:px-6 sm:py-6`,i),...a,children:[(0,M.jsx)(`div`,{className:`pointer-events-none absolute inset-0 opacity-60`,style:{backgroundImage:`radial-gradient(ellipse 60% 80% at 0% 0%, hsl(var(--brand-from) / 0.12), transparent 60%)`},"aria-hidden":!0}),(0,M.jsxs)(`div`,{className:`relative flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between sm:gap-6`,children:[(0,M.jsxs)(`div`,{className:`flex min-w-0 items-start gap-4`,children:[n?(0,M.jsx)(`div`,{className:`flex size-10 shrink-0 items-center justify-center rounded-lg bg-brand-gradient text-primary-foreground shadow-sm shadow-primary/30 ring-1 ring-white/15`,children:(0,M.jsx)(n,{className:`size-5`})}):null,(0,M.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,M.jsx)(`h1`,{className:`truncate text-xl font-semibold tracking-tight sm:text-2xl`,children:e}),t?(0,M.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t}):null]})]}),r?(0,M.jsx)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:r}):null]})]})}var hP=la(`/organizations/`)({component:gP});function gP(){let{t:e}=vt(),{organizations:t,loading:n}=aN(),{session:r,setActiveOrganization:i,features:a}=iN(),o=Hi(),s=r?.activeOrganizationId??void 0,c=a?.multiOrgEnabled!==!1,l=async t=>{try{t!==s&&await i(t),o({to:`/organizations/$orgId`,params:{orgId:t}})}catch(t){q({title:e(`organizations.switchFailed`),description:t.message,variant:`destructive`})}},u=e=>e.split(/\s+/).map(e=>e[0]).join(``).slice(0,2).toUpperCase();return(0,M.jsx)(`div`,{className:`flex flex-1 flex-col overflow-hidden`,children:(0,M.jsx)(`div`,{className:`flex-1 overflow-auto px-4 py-6 sm:px-6 sm:py-8`,children:(0,M.jsxs)(`div`,{className:`page-enter mx-auto flex max-w-3xl flex-col gap-6`,children:[(0,M.jsx)(mP,{icon:by,title:e(`organizations.title`),description:e(`organizations.description`),actions:c?(0,M.jsxs)(Q,{onClick:()=>o({to:`/organizations/new`}),className:`bg-brand-gradient text-primary-foreground shadow-sm shadow-primary/20 transition-all hover:opacity-95 hover:shadow-md hover:shadow-primary/30`,children:[(0,M.jsx)(qy,{className:`mr-2 h-4 w-4`}),e(`organizations.newOrganization`)]}):null}),n&&(0,M.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`organizations.loading`)}),!n&&t.length===0&&(0,M.jsxs)($,{className:`p-10 text-center`,children:[(0,M.jsx)(`div`,{className:`mx-auto mb-3 flex size-12 items-center justify-center rounded-lg bg-brand-gradient-subtle text-primary ring-1 ring-primary/15`,children:(0,M.jsx)(by,{className:`h-6 w-6`})}),(0,M.jsx)(`h3`,{className:`text-base font-medium`,children:e(`organizations.emptyTitle`)}),(0,M.jsx)(`p`,{className:`mb-4 text-sm text-muted-foreground`,children:e(`organizations.emptyDescription`)}),c&&(0,M.jsxs)(Q,{onClick:()=>o({to:`/organizations/new`}),className:`bg-brand-gradient text-primary-foreground shadow-sm shadow-primary/20`,children:[(0,M.jsx)(qy,{className:`mr-2 h-4 w-4`}),e(`organizations.createOrganization`)]})]}),(0,M.jsx)(`div`,{className:`grid gap-3`,children:t.map(t=>{let n=t.id===s;return(0,M.jsx)($,{role:`button`,tabIndex:0,onClick:()=>l(t.id),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),l(t.id))},className:`group cursor-pointer p-4 transition-all hover:-translate-y-0.5 hover:border-primary/30 hover:shadow-md hover:shadow-primary/5 focus:outline-none focus:ring-2 focus:ring-ring ${n?`border-primary/50 bg-brand-gradient-subtle ring-1 ring-primary/30`:``}`,children:(0,M.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,M.jsx)(`div`,{className:`flex size-12 shrink-0 items-center justify-center rounded-lg font-semibold `+(n?`bg-brand-gradient text-primary-foreground shadow-sm shadow-primary/30 ring-1 ring-white/15`:`bg-muted text-muted-foreground group-hover:bg-brand-gradient-subtle group-hover:text-primary`),children:u(t.name)||(0,M.jsx)(by,{className:`h-5 w-5`})}),(0,M.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,M.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,M.jsx)(`h3`,{className:`truncate text-base font-medium`,children:t.name}),n&&(0,M.jsxs)(pP,{className:`gap-1 border-transparent bg-emerald-500/15 text-[10px] font-medium text-emerald-600 dark:text-emerald-400`,children:[(0,M.jsx)(xy,{className:`h-3 w-3`}),e(`organizations.active`)]})]}),t.slug&&(0,M.jsx)(`code`,{className:`mt-0.5 block font-mono text-xs text-muted-foreground`,children:t.slug})]}),(0,M.jsx)(Cy,{className:`size-4 shrink-0 text-muted-foreground transition-transform group-hover:translate-x-0.5 group-hover:text-primary`})]})},t.id)})})]})})})}var _P=la(`/account/`)({component:vP});function vP(){let{t:e}=vt(),{user:t}=iN(),{organizations:n}=aN(),r=[!!t?.emailVerified,!!t?.twoFactorEnabled,!!t?.name,!!t?.image].filter(Boolean).length*25,i=r>=75?`success`:r>=50?`warn`:`danger`,a=(t?.name??t?.email??`?`).split(/\s+/).map(e=>e[0]).join(``).slice(0,2).toUpperCase(),o=[{to:`/account/profile`,label:e(`home.tiles.profile.title`,{defaultValue:`Profile`}),description:e(`home.tiles.profile.description`,{defaultValue:`Display name, avatar and contact info.`}),icon:sb},{to:`/account/security`,label:e(`home.tiles.security.title`,{defaultValue:`Security`}),description:e(`home.tiles.security.description`,{defaultValue:`Change your password and review activity.`}),icon:Qy},{to:`/account/two-factor`,label:e(`home.tiles.twoFactor.title`,{defaultValue:`Two-factor auth`}),description:e(`home.tiles.twoFactor.description`,{defaultValue:`Add an authenticator app for stronger sign-in.`}),icon:Zy},{to:`/account/sessions`,label:e(`home.tiles.sessions.title`,{defaultValue:`Active sessions`}),description:e(`home.tiles.sessions.description`,{defaultValue:`See and revoke devices that are signed in.`}),icon:Wy},{to:`/account/linked-accounts`,label:e(`home.tiles.linked.title`,{defaultValue:`Linked accounts`}),description:e(`home.tiles.linked.description`,{defaultValue:`Manage your social and SSO providers.`}),icon:By},{to:`/account/oauth-applications`,label:e(`home.tiles.oauth.title`,{defaultValue:`OAuth applications`}),description:e(`home.tiles.oauth.description`,{defaultValue:`Apps you have authorised to access your account.`}),icon:Ly}];return(0,M.jsxs)(`div`,{className:`space-y-6`,children:[(0,M.jsxs)(`div`,{className:`relative overflow-hidden rounded-xl border bg-card`,children:[(0,M.jsx)(`div`,{className:`absolute inset-0 bg-brand-gradient`,"aria-hidden":!0}),(0,M.jsx)(`div`,{className:`absolute inset-0 opacity-40 mix-blend-soft-light`,style:{backgroundImage:`radial-gradient(ellipse at 20% 0%, rgba(255,255,255,0.4), transparent 60%), radial-gradient(ellipse at 100% 100%, rgba(0,0,0,0.25), transparent 60%)`},"aria-hidden":!0}),(0,M.jsxs)(`div`,{className:`relative flex flex-col gap-4 p-6 text-white sm:flex-row sm:items-center sm:gap-6 sm:p-8`,children:[(0,M.jsxs)(YM,{className:`size-16 shrink-0 ring-4 ring-white/30 shadow-md sm:size-20`,children:[t?.image?(0,M.jsx)(XM,{src:t.image,alt:t?.name??``}):null,(0,M.jsx)(ZM,{className:`bg-white/20 text-base font-semibold text-white backdrop-blur`,children:a})]}),(0,M.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1`,children:[(0,M.jsx)(`p`,{className:`text-xs uppercase tracking-wider text-white/70`,children:e(`home.welcome`,{defaultValue:`Welcome back`})}),(0,M.jsx)(`h2`,{className:`truncate text-2xl font-semibold tracking-tight`,children:t?.name||t?.email||`ObjectStack user`}),(0,M.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-sm text-white/80`,children:[(0,M.jsx)(Uy,{className:`size-3.5`,"aria-hidden":!0}),(0,M.jsx)(`span`,{className:`truncate`,children:t?.email}),t?.emailVerified?(0,M.jsx)(pP,{className:`border-white/30 bg-white/15 text-[10px] font-medium text-white backdrop-blur hover:bg-white/20`,children:e(`home.verified`,{defaultValue:`Verified`})}):null]})]})]})]}),(0,M.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 sm:grid-cols-3`,children:[(0,M.jsx)(yP,{icon:Zy,label:e(`home.stats.score`,{defaultValue:`Security score`}),value:`${r}%`,tone:i,extra:(0,M.jsx)(`div`,{className:`mt-2 h-1.5 w-full overflow-hidden rounded-full bg-muted`,children:(0,M.jsx)(`div`,{className:`h-full bg-brand-gradient transition-[width] duration-500`,style:{width:`${r}%`}})})}),(0,M.jsx)(yP,{icon:by,label:e(`home.stats.orgs`,{defaultValue:`Organizations`}),value:String(n.length),extra:(0,M.jsxs)(ra,{to:`/organizations`,className:`mt-2 inline-flex items-center gap-1 text-xs font-medium text-primary hover:underline`,children:[e(`home.stats.manage`,{defaultValue:`Manage`}),(0,M.jsx)(yy,{className:`size-3`})]})}),(0,M.jsx)(yP,{icon:t?.twoFactorEnabled?Zy:Qy,label:e(`home.stats.twoFactor`,{defaultValue:`Two-factor auth`}),value:t?.twoFactorEnabled?e(`home.stats.enabled`,{defaultValue:`Enabled`}):e(`home.stats.disabled`,{defaultValue:`Disabled`}),tone:t?.twoFactorEnabled?`success`:`warn`,extra:(0,M.jsxs)(ra,{to:`/account/two-factor`,className:`mt-2 inline-flex items-center gap-1 text-xs font-medium text-primary hover:underline`,children:[t?.twoFactorEnabled?e(`home.stats.review`,{defaultValue:`Review`}):e(`home.stats.enable`,{defaultValue:`Enable now`}),(0,M.jsx)(yy,{className:`size-3`})]})})]}),(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`h3`,{className:`mb-3 text-sm font-medium text-muted-foreground`,children:e(`home.quickAccess`,{defaultValue:`Quick access`})}),(0,M.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:o.map(({to:e,label:t,description:n,icon:r})=>(0,M.jsxs)(ra,{to:e,className:`group relative flex items-start gap-3 rounded-lg border bg-card p-4 transition-all hover:-translate-y-0.5 hover:border-primary/30 hover:shadow-md hover:shadow-primary/5`,children:[(0,M.jsx)(`div`,{className:`flex size-9 shrink-0 items-center justify-center rounded-md bg-brand-gradient-subtle text-primary ring-1 ring-primary/10 transition-transform group-hover:scale-110`,children:(0,M.jsx)(r,{className:`size-4`})}),(0,M.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,M.jsx)(`span`,{className:`truncate font-medium`,children:t}),(0,M.jsx)(yy,{className:`size-4 shrink-0 text-muted-foreground transition-transform group-hover:translate-x-0.5 group-hover:text-primary`})]}),(0,M.jsx)(`p`,{className:`mt-0.5 line-clamp-2 text-xs text-muted-foreground`,children:n})]})]},e))})]})]})}function yP({icon:e,label:t,value:n,tone:r=`neutral`,extra:i}){let a=r===`success`?`text-emerald-600 dark:text-emerald-400`:r===`warn`?`text-amber-600 dark:text-amber-400`:r===`danger`?`text-destructive`:`text-foreground`;return(0,M.jsx)($,{className:`overflow-hidden`,children:(0,M.jsxs)(AN,{className:`p-5`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,M.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wider text-muted-foreground`,children:t}),(0,M.jsx)(e,{className:`size-4 ${a}`})]}),(0,M.jsx)(`p`,{className:`mt-1 text-2xl font-semibold tracking-tight ${a}`,children:n}),i]})})}var bP=la(`/organizations/new`)({validateSearch:e=>{let t=e.redirect;return typeof t==`string`?{redirect:t}:{}},component:wP});function xP(e){return e.toLowerCase().trim().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``).slice(0,48)}function SP(e){return!!e&&e.startsWith(`/`)&&!e.startsWith(`//`)}function CP(e){return e.startsWith(`/_`)?e:`/_account/`.replace(/\/$/,``)+e}function wP(){let{t:e}=vt(),t=Hi(),{redirect:n}=bP.useSearch(),{create:r,creating:i}=oN(),{setActiveOrganization:a,reloadOrganizations:o,features:s}=iN(),[c,l]=(0,j.useState)(``),[u,d]=(0,j.useState)(``),[f,p]=(0,j.useState)(!1);(0,j.useEffect)(()=>{s&&s.multiOrgEnabled===!1&&t({to:`/organizations`})},[s,t]);let m=e=>{l(e),f||d(xP(e))};return(0,M.jsx)(PN,{formWidth:`md`,children:(0,M.jsxs)($,{className:`border-border/60 shadow-sm shadow-primary/5 backdrop-blur supports-[backdrop-filter]:bg-card/95`,children:[(0,M.jsxs)(DN,{className:`text-center`,children:[(0,M.jsx)(ON,{className:`text-xl tracking-tight`,children:e(`organizations.new.title`)}),(0,M.jsx)(kN,{children:e(`organizations.new.description`)})]}),(0,M.jsx)(AN,{children:(0,M.jsxs)(`form`,{onSubmit:async t=>{t.preventDefault();try{let t=await r({name:c,slug:u||void 0}),i=t?.data??t,s=i?.id??i?.organization?.id;s&&await a(s).catch(()=>{}),await o().catch(()=>{}),q({title:e(`organizations.new.successToast`)}),SP(n)?window.location.assign(CP(n)):window.location.assign(`/`)}catch(t){q({title:e(`organizations.new.failed`),description:t.message,variant:`destructive`})}},className:`flex flex-col gap-4`,children:[(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsx)(UN,{htmlFor:`name`,children:e(`organizations.new.name`)}),(0,M.jsx)(oS,{id:`name`,required:!0,autoFocus:!0,value:c,onChange:e=>m(e.target.value),placeholder:e(`organizations.new.namePlaceholder`)})]}),(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsx)(UN,{htmlFor:`slug`,children:e(`organizations.new.slug`)}),(0,M.jsx)(oS,{id:`slug`,value:u,onChange:e=>{d(e.target.value),p(!0)},placeholder:e(`organizations.new.slugPlaceholder`),pattern:`[a-z0-9-]+`}),(0,M.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:e(`organizations.new.slugHint`)})]}),(0,M.jsx)(Q,{type:`submit`,className:`w-full`,disabled:i||!c,children:e(i?`organizations.new.submitting`:`organizations.new.submit`)}),(0,M.jsx)(`p`,{className:`text-center text-sm text-muted-foreground`,children:(0,M.jsx)(ra,{to:`/organizations`,className:`font-medium text-primary underline-offset-4 hover:underline`,children:e(`organizations.new.cancel`)})})]})})]})})}var TP=la(`/organizations/$orgId`)({component:EP});function EP(){let{t:e}=vt(),{orgId:t}=TP.useParams(),{organizations:n}=aN(),r=n.find(e=>e.id===t);return(0,M.jsx)(`div`,{className:`flex flex-1 flex-col overflow-hidden`,children:(0,M.jsx)(`div`,{className:`flex-1 overflow-auto px-6 py-8`,children:(0,M.jsxs)(`div`,{className:`mx-auto max-w-4xl space-y-6`,children:[(0,M.jsxs)(`header`,{children:[(0,M.jsx)(`h1`,{className:`text-2xl font-semibold`,children:r?.name??e(`organizations.title`)}),r?.slug&&(0,M.jsx)(`p`,{className:`text-sm text-muted-foreground font-mono`,children:r.slug})]}),(0,M.jsx)(ya,{})]})})})}function DP(){let e=n_(),[t,n]=(0,j.useState)([]),[r,i]=(0,j.useState)(!1),[a,o]=(0,j.useState)(null),s=(0,j.useCallback)(async()=>{if(e?.oauth?.applications){i(!0),o(null);try{n((await e.oauth.applications.list())?.applications??[])}catch(e){o(e),n([])}finally{i(!1)}}},[e]);return(0,j.useEffect)(()=>{s()},[s]),{applications:t,loading:r,error:a,reload:s}}function OP(){let e=n_(),[t,n]=(0,j.useState)(!1),[r,i]=(0,j.useState)(null),[a,o]=(0,j.useState)(null);return{register:(0,j.useCallback)(async t=>{if(!e?.oauth?.applications?.register)throw Error(`Client not ready`);n(!0),i(null);try{let n=await e.oauth.applications.register(t);return o(n),n}catch(e){throw i(e),e}finally{n(!1)}},[e]),registering:t,error:r,lastResult:a}}function kP(){let e=n_(),[t,n]=(0,j.useState)(!1),[r,i]=(0,j.useState)(null);return{remove:(0,j.useCallback)(async t=>{if(!e?.oauth?.applications?.delete)throw Error(`Client not ready`);n(!0),i(null);try{return await e.oauth.applications.delete(t)}catch(e){throw i(e),e}finally{n(!1)}},[e]),deleting:t,error:r}}function AP(){let e=n_(),[t,n]=(0,j.useState)(!1),[r,i]=(0,j.useState)(null);return{submit:(0,j.useCallback)(async t=>{if(!e?.oauth?.consent)throw Error(`Client not ready`);n(!0),i(null);try{return await e.oauth.consent(t)}catch(e){throw i(e),e}finally{n(!1)}},[e]),submitting:t,error:r}}var jP=la(`/oauth/consent`)({validateSearch:e=>e,component:MP});function MP(){let{t:e}=vt(),t=Hi(),n=n_(),{user:r,loading:i}=iN(),{submit:a,submitting:o}=AP(),[s,c]=(0,j.useState)(null),l=typeof window<`u`?window.location.search:``,u=l.startsWith(`?`)?l.slice(1):l,d=new URLSearchParams(u),f=d.get(`client_id`)??void 0,p=d.get(`scope`)??``;(0,j.useEffect)(()=>{i||r||t({to:`/login`,search:{redirect:window.location.pathname+window.location.search}})},[r,i,t]),(0,j.useEffect)(()=>{if(!f||!n?.oauth?.applications?.getPublic)return;let e=!1;return n.oauth.applications.getPublic(f).then(t=>{if(e)return;let n=t?.data??t;c({name:n?.name??n?.client_name,icon:n?.icon??n?.logo_uri})},()=>{}),()=>{e=!0}},[n,f]);let m=p.split(/\s+/).filter(Boolean),h=async t=>{try{let n=await a({accept:t,oauth_query:u}),r=n?.redirect_uri??n?.redirectURI??n?.url;if(r){window.location.href=r;return}q({title:e(t?`oauth.consent.granted`:`oauth.consent.denied`),description:e(`oauth.consent.noRedirect`),variant:t?void 0:`destructive`})}catch(t){q({title:e(`oauth.consent.failed`),description:t.message,variant:`destructive`})}},g=s?.name??f??e(`oauth.consent.unknownApp`);return(0,M.jsx)(`div`,{className:`flex min-h-svh w-full flex-1 items-center justify-center bg-background px-4`,children:(0,M.jsxs)($,{className:`w-full max-w-md`,children:[(0,M.jsxs)(DN,{className:`items-center text-center`,children:[(0,M.jsx)(`div`,{className:`mb-3 rounded-full border bg-muted p-3`,children:s?.icon?(0,M.jsx)(`img`,{src:s.icon,alt:``,className:`h-8 w-8 rounded`,onError:e=>e.currentTarget.style.display=`none`}):(0,M.jsx)(Ly,{className:`h-7 w-7 text-muted-foreground`})}),(0,M.jsx)(ON,{className:`text-xl`,children:e(`oauth.consent.title`,{appName:g})}),(0,M.jsx)(kN,{children:e(`oauth.consent.request`,{appName:g,suffix:r?.email?` (${r.email})`:``})})]}),(0,M.jsxs)(AN,{className:`space-y-4`,children:[m.length>0&&(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`p`,{className:`mb-2 text-sm font-medium`,children:e(`oauth.consent.willAllow`)}),(0,M.jsx)(`ul`,{className:`space-y-1.5 rounded-md border bg-muted/40 p-3 text-sm`,children:m.map(t=>(0,M.jsxs)(`li`,{className:`flex items-start gap-2`,children:[(0,M.jsx)(xy,{className:`mt-0.5 h-4 w-4 text-green-600 dark:text-green-400`}),(0,M.jsx)(`span`,{children:NP(t,e)})]},t))})]}),(0,M.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 pt-2`,children:[(0,M.jsxs)(Q,{variant:`outline`,onClick:()=>h(!1),disabled:o,children:[(0,M.jsx)(ub,{className:`mr-2 h-4 w-4`}),e(`oauth.consent.deny`)]}),(0,M.jsxs)(Q,{onClick:()=>h(!0),disabled:o,children:[(0,M.jsx)(xy,{className:`mr-2 h-4 w-4`}),e(o?`oauth.consent.submitting`:`oauth.consent.authorize`)]})]}),(0,M.jsx)(`p`,{className:`pt-2 text-center text-xs text-muted-foreground`,children:e(`oauth.consent.footer`)})]})]})})}function NP(e,t){switch(e){case`openid`:return t(`oauth.consent.scope.openid`);case`profile`:return t(`oauth.consent.scope.profile`);case`email`:return t(`oauth.consent.scope.email`);case`offline_access`:return t(`oauth.consent.scope.offlineAccess`);default:return e}}var PP=la(`/auth/device`)({validateSearch:e=>({user_code:e.user_code??e.code??``}),component:IP});function FP({children:e}){return(0,M.jsx)(`div`,{className:`flex min-h-svh w-full flex-col items-center justify-center gap-6 bg-muted p-6 md:p-10`,children:(0,M.jsxs)(`div`,{className:`flex w-full max-w-sm flex-col gap-6`,children:[(0,M.jsxs)(`a`,{href:`#`,className:`flex items-center gap-2 self-center font-medium`,children:[(0,M.jsx)(`div`,{className:`flex size-6 items-center justify-center rounded-md bg-primary text-primary-foreground`,children:(0,M.jsx)(Ny,{className:`size-4`})}),`ObjectStack`]}),(0,M.jsx)(`div`,{className:`flex flex-col gap-6`,children:e})]})})}function IP(){let{t:e}=vt(),{user_code:t}=PP.useSearch(),{user:n,loading:r}=iN(),i=Hi(),[a,o]=(0,j.useState)(!1),[s,c]=(0,j.useState)(!1),[l,u]=(0,j.useState)(!1),[d,f]=(0,j.useState)(!1),[p,m]=(0,j.useState)(``);return t?r?(0,M.jsx)(FP,{children:(0,M.jsx)($,{children:(0,M.jsx)(DN,{className:`text-center`,children:(0,M.jsx)(kN,{children:e(`auth.device.loading`)})})})}):n?l?(0,M.jsx)(FP,{children:(0,M.jsx)($,{children:(0,M.jsxs)(DN,{className:`text-center`,children:[(0,M.jsx)(Ey,{className:`h-10 w-10 text-green-500 mx-auto mb-2`}),(0,M.jsx)(ON,{children:e(`auth.device.approvedTitle`)}),(0,M.jsx)(kN,{children:e(`auth.device.approvedDescription`)})]})})}):d?(0,M.jsx)(FP,{children:(0,M.jsx)($,{children:(0,M.jsxs)(DN,{className:`text-center`,children:[(0,M.jsx)(ON,{children:e(`auth.device.deniedTitle`)}),(0,M.jsx)(kN,{children:e(`auth.device.deniedDescription`)})]})})}):(0,M.jsx)(FP,{children:(0,M.jsxs)($,{children:[(0,M.jsxs)(DN,{className:`text-center`,children:[(0,M.jsx)(ON,{children:e(`auth.device.title`)}),(0,M.jsx)(kN,{children:e(`auth.device.subtitle`,{email:n.email})})]}),(0,M.jsxs)(AN,{className:`space-y-4`,children:[(0,M.jsxs)(`div`,{className:`rounded-md border bg-background px-4 py-3 text-center`,children:[(0,M.jsx)(`p`,{className:`text-xs text-muted-foreground mb-1`,children:e(`auth.device.userCodeLabel`)}),(0,M.jsx)(`p`,{className:`font-mono font-semibold tracking-widest text-lg`,children:t})]}),(0,M.jsxs)(`div`,{className:`space-y-4`,children:[(0,M.jsx)(`p`,{className:`text-sm text-center text-muted-foreground`,children:e(`auth.device.loggedInAs`,{email:n.email})}),p&&(0,M.jsx)(`p`,{className:`text-sm text-destructive text-center`,children:p}),(0,M.jsx)(Q,{onClick:async()=>{m(``),o(!0);try{let n=await fetch(`/api/v1/auth/device/approve`,{method:`POST`,headers:{"Content-Type":`application/json`},credentials:`include`,body:JSON.stringify({userCode:t})});if(!n.ok){let t=await n.json().catch(()=>({}));throw Error(t?.message??t?.error?.message??e(`auth.device.approveFailed`))}u(!0),q({title:e(`auth.device.approveSuccess`),description:e(`auth.device.approveSuccessDescription`)})}catch(t){m(t?.message??e(`auth.device.approveFailed`))}finally{o(!1)}},className:`w-full`,disabled:a||s,children:e(a?`auth.device.approving`:`auth.device.approve`)}),(0,M.jsx)(Q,{onClick:async()=>{m(``),c(!0);try{await fetch(`/api/v1/auth/device/deny`,{method:`POST`,headers:{"Content-Type":`application/json`},credentials:`include`,body:JSON.stringify({userCode:t})}),f(!0)}catch(t){m(t?.message??e(`auth.device.denyFailed`))}finally{c(!1)}},variant:`outline`,className:`w-full`,disabled:a||s,children:e(s?`auth.device.denying`:`auth.device.deny`)}),(0,M.jsx)(`div`,{className:`text-center`,children:(0,M.jsx)(`button`,{type:`button`,className:`text-sm text-muted-foreground underline-offset-4 hover:underline`,onClick:()=>i({to:`/`}),children:e(`auth.device.cancel`)})})]})]})]})}):(0,M.jsx)(Ui,{to:`/login`,search:{redirect:`/auth/device?user_code=${encodeURIComponent(t)}`}}):(0,M.jsx)(FP,{children:(0,M.jsx)($,{children:(0,M.jsxs)(DN,{className:`text-center`,children:[(0,M.jsx)(ON,{children:e(`auth.device.invalidTitle`)}),(0,M.jsx)(kN,{children:e(`auth.device.invalidDescription`)})]})})})}var LP=la(`/account/two-factor`)({component:RP});function RP(){let{t:e}=vt(),t=n_(),{user:n,loading:r,refresh:i}=iN(),[a,o]=(0,j.useState)(null),[s,c]=(0,j.useState)(``),[l,u]=(0,j.useState)(!1),[d,f]=(0,j.useState)(null),[p,m]=(0,j.useState)(null),[h,g]=(0,j.useState)(!1),[_,v]=(0,j.useState)(``),[y,b]=(0,j.useState)(!1),[x,S]=(0,j.useState)(``),[C,w]=(0,j.useState)(!1),[T,E]=(0,j.useState)(``),[D,O]=(0,j.useState)(!1),[ee,te]=(0,j.useState)(null);(0,j.useEffect)(()=>{r||o(!!n?.twoFactorEnabled)},[r,n?.twoFactorEnabled]);let ne=async n=>{n.preventDefault(),u(!0);try{let e=await t.auth.twoFactor.enable({password:s});f(e?.totpURI??null),m(e?.backupCodes??null),c(``)}catch(t){q({title:e(`twoFactor.enableFailed`),description:t.message,variant:`destructive`})}finally{u(!1)}},re=async n=>{n.preventDefault(),b(!0);try{await t.auth.twoFactor.verifyTotp({code:_,trustDevice:h}),q({title:e(`twoFactor.enableSuccess`)}),o(!0),f(null),v(``),await i()}catch(t){q({title:e(`twoFactor.invalidCode`),description:t.message,variant:`destructive`})}finally{b(!1)}},ie=async n=>{n.preventDefault(),w(!0);try{await t.auth.twoFactor.disable({password:x}),q({title:e(`twoFactor.disableSuccess`)}),o(!1),S(``),te(null),await i()}catch(t){q({title:e(`twoFactor.disableFailed`),description:t.message,variant:`destructive`})}finally{w(!1)}},ae=async n=>{n.preventDefault(),O(!0);try{te((await t.auth.twoFactor.generateBackupCodes({password:T}))?.backupCodes??[]),E(``),q({title:e(`twoFactor.backupCodes.regenerated`)})}catch(t){q({title:e(`twoFactor.backupCodes.regenerateFailed`),description:t.message,variant:`destructive`})}finally{O(!1)}},oe=async t=>{try{await navigator.clipboard.writeText(t.join(`
|
|
148
|
-
`)),q({title:e(`twoFactor.backupCodes.copied`)})}catch{q({title:e(`twoFactor.backupCodes.copyFailed`),variant:`destructive`})}},k=(0,M.jsx)(mP,{icon:Zy,title:e(`twoFactor.title`),description:e(`twoFactor.notEnabledDescription`),actions:a===!0?(0,M.jsx)(pP,{className:`border-transparent bg-emerald-500/15 font-medium text-emerald-600 dark:text-emerald-400`,children:e(`twoFactor.enabled`)}):a===!1?(0,M.jsx)(pP,{variant:`outline`,className:`font-medium`,children:e(`twoFactor.notEnabled`)}):null});if(a===null)return(0,M.jsxs)(`div`,{className:`space-y-6`,children:[k,(0,M.jsxs)($,{children:[(0,M.jsx)(DN,{children:(0,M.jsx)(ON,{className:`text-base`,children:e(`twoFactor.loadingStatus`)})}),(0,M.jsxs)(AN,{className:`space-y-2`,children:[(0,M.jsx)(Zw,{className:`h-4 w-48`}),(0,M.jsx)(Zw,{className:`h-9 w-full`}),(0,M.jsx)(Zw,{className:`h-9 w-32`})]})]})]});if(d){let t=`https://api.qrserver.com/v1/create-qr-code/?size=200x200&data=${encodeURIComponent(d)}`;return(0,M.jsxs)(`div`,{className:`space-y-6`,children:[k,(0,M.jsxs)($,{children:[(0,M.jsxs)(DN,{children:[(0,M.jsx)(ON,{className:`text-base`,children:e(`twoFactor.setupTitle`)}),(0,M.jsx)(kN,{children:e(`twoFactor.setupDescription`)})]}),(0,M.jsxs)(AN,{className:`space-y-4`,children:[(0,M.jsxs)(`div`,{className:`flex flex-col items-center gap-3`,children:[(0,M.jsx)(`img`,{src:t,alt:e(`twoFactor.qrAlt`),width:200,height:200,className:`rounded border bg-white p-2`}),(0,M.jsx)(`div`,{className:`w-full rounded bg-muted p-3 font-mono text-xs break-all`,children:d}),(0,M.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`twoFactor.uriHint`)})]}),p&&p.length>0&&(0,M.jsxs)(`div`,{className:`rounded border bg-muted/40 p-3`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,M.jsx)(`p`,{className:`text-sm font-medium`,children:e(`twoFactor.backupCodes.savedTitle`)}),(0,M.jsxs)(Q,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>oe(p),children:[(0,M.jsx)(jy,{className:`mr-1 h-3 w-3`}),e(`twoFactor.backupCodes.copy`)]})]}),(0,M.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:e(`twoFactor.backupCodes.savedHint`)}),(0,M.jsx)(`div`,{className:`mt-2 grid grid-cols-2 gap-1 font-mono text-xs`,children:p.map(e=>(0,M.jsx)(`span`,{className:`rounded bg-background px-2 py-1`,children:e},e))})]}),(0,M.jsx)(mS,{}),(0,M.jsxs)(`form`,{onSubmit:re,className:`space-y-3`,children:[(0,M.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,M.jsx)(UN,{htmlFor:`totp-code`,children:e(`twoFactor.verificationCode`)}),(0,M.jsx)(oS,{id:`totp-code`,placeholder:`000000`,maxLength:6,inputMode:`numeric`,autoComplete:`one-time-code`,value:_,onChange:e=>v(e.target.value),required:!0})]}),(0,M.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,M.jsx)(`input`,{type:`checkbox`,checked:h,onChange:e=>g(e.target.checked)}),e(`twoFactor.trustDevice`)]}),(0,M.jsxs)(`div`,{className:`flex gap-2`,children:[(0,M.jsx)(Q,{type:`submit`,disabled:y||_.length<6,children:e(y?`twoFactor.verifying`:`twoFactor.verify`)}),(0,M.jsx)(Q,{type:`button`,variant:`outline`,onClick:()=>f(null),children:e(`twoFactor.cancel`)})]})]})]})]})]})}return a===!0?(0,M.jsxs)(`div`,{className:`space-y-6`,children:[k,(0,M.jsxs)($,{children:[(0,M.jsxs)(DN,{children:[(0,M.jsx)(ON,{className:`text-base`,children:e(`twoFactor.enabledTitle`,{defaultValue:`Authenticator app`})}),(0,M.jsx)(kN,{children:e(`twoFactor.enabledDescription`)})]}),(0,M.jsx)(AN,{children:(0,M.jsxs)(`form`,{onSubmit:ie,className:`space-y-4`,children:[(0,M.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,M.jsx)(UN,{htmlFor:`disable-password`,children:e(`twoFactor.password`)}),(0,M.jsx)(oS,{id:`disable-password`,type:`password`,autoComplete:`current-password`,required:!0,value:x,onChange:e=>S(e.target.value)})]}),(0,M.jsx)(Q,{variant:`destructive`,type:`submit`,disabled:C,children:e(C?`twoFactor.disabling`:`twoFactor.disable`)})]})})]}),(0,M.jsxs)($,{children:[(0,M.jsxs)(DN,{children:[(0,M.jsxs)(ON,{className:`text-base flex items-center gap-2`,children:[(0,M.jsx)(Ly,{className:`h-4 w-4`}),e(`twoFactor.backupCodes.title`)]}),(0,M.jsx)(kN,{children:e(`twoFactor.backupCodes.description`)})]}),(0,M.jsxs)(AN,{className:`space-y-4`,children:[(0,M.jsxs)(`form`,{onSubmit:ae,className:`space-y-3`,children:[(0,M.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,M.jsx)(UN,{htmlFor:`backup-password`,children:e(`twoFactor.password`)}),(0,M.jsx)(oS,{id:`backup-password`,type:`password`,autoComplete:`current-password`,required:!0,value:T,onChange:e=>E(e.target.value)})]}),(0,M.jsxs)(Q,{type:`submit`,variant:`outline`,disabled:D,children:[(0,M.jsx)(Jy,{className:`mr-2 h-4 w-4`}),e(D?`common.saving`:`twoFactor.backupCodes.regenerate`)]})]}),ee&&ee.length>0&&(0,M.jsxs)(`div`,{className:`rounded border bg-muted/40 p-3`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,M.jsx)(`p`,{className:`text-sm font-medium`,children:e(`twoFactor.backupCodes.newTitle`)}),(0,M.jsxs)(Q,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>oe(ee),children:[(0,M.jsx)(jy,{className:`mr-1 h-3 w-3`}),e(`twoFactor.backupCodes.copy`)]})]}),(0,M.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:e(`twoFactor.backupCodes.savedHint`)}),(0,M.jsx)(`div`,{className:`mt-2 grid grid-cols-2 gap-1 font-mono text-xs`,children:ee.map(e=>(0,M.jsx)(`span`,{className:`rounded bg-background px-2 py-1`,children:e},e))})]})]})]})]}):(0,M.jsxs)(`div`,{className:`space-y-6`,children:[k,(0,M.jsxs)($,{children:[(0,M.jsxs)(DN,{children:[(0,M.jsx)(ON,{className:`text-base`,children:e(`twoFactor.enable`)}),(0,M.jsx)(kN,{children:e(`twoFactor.notEnabledDescription`)})]}),(0,M.jsx)(AN,{children:(0,M.jsxs)(`form`,{onSubmit:ne,className:`space-y-4`,children:[(0,M.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,M.jsx)(UN,{htmlFor:`enable-password`,children:e(`twoFactor.password`)}),(0,M.jsx)(oS,{id:`enable-password`,type:`password`,autoComplete:`current-password`,required:!0,value:s,onChange:e=>c(e.target.value),placeholder:e(`twoFactor.passwordPlaceholder`)})]}),(0,M.jsx)(Q,{type:`submit`,disabled:l,className:`bg-brand-gradient text-primary-foreground shadow-sm shadow-primary/20 transition-all hover:opacity-95 hover:shadow-md hover:shadow-primary/30`,children:e(l?`twoFactor.loading`:`twoFactor.enable`)})]})})]})]})}var zP=[[/Edg\//i,`Edge`],[/OPR\//i,`Opera`],[/Chrome\//i,`Chrome`],[/Firefox\//i,`Firefox`],[/Safari\//i,`Safari`]],BP=[[/Windows NT 10/i,`Windows 10/11`],[/Windows/i,`Windows`],[/Mac OS X|Macintosh/i,`macOS`],[/iPhone|iOS/i,`iOS`],[/iPad/i,`iPadOS`],[/Android/i,`Android`],[/Linux/i,`Linux`]];function VP(e){if(!e)return{browser:`Unknown`,os:`Unknown`,device:`desktop`,label:`Unknown device`,icon:Py};let t=zP.find(([t])=>t.test(e))?.[1]??`Browser`,n=BP.find(([t])=>t.test(e))?.[1]??`Unknown OS`,r=/iPad|Tablet/i.test(e),i=!r&&/Mobile|Android|iPhone|iPod/i.test(e),a=r?`tablet`:i?`mobile`:`desktop`,o=Wy;return o=a===`mobile`?$y:a===`tablet`?tb:/Linux|Windows|Mac/i.test(e)?Wy:Py,{browser:t,os:n,device:a,label:`${t} · ${n}`,icon:o}}var HP=la(`/account/sessions`)({component:UP});function UP(){let{t:e}=vt(),t=n_(),{session:n}=iN(),[r,i]=(0,j.useState)([]),[a,o]=(0,j.useState)(!0),[s,c]=(0,j.useState)(null),[l,u]=(0,j.useState)(!1),d=async()=>{try{i((await t.auth.sessions.list())?.sessions??[])}catch(t){q({title:e(`sessions.loadFailed`),description:t.message,variant:`destructive`})}finally{o(!1)}};(0,j.useEffect)(()=>{d()},[]);let f=async n=>{c(n);try{await t.auth.sessions.revoke(n),q({title:e(`sessions.revoked`)}),await d()}catch(t){q({title:e(`sessions.revokeFailed`),description:t.message,variant:`destructive`})}finally{c(null)}},p=async()=>{u(!0);try{await t.auth.sessions.revokeOthers(),q({title:e(`sessions.othersRevoked`)}),await d()}catch(t){q({title:e(`sessions.revokeOthersFailed`),description:t.message,variant:`destructive`})}finally{u(!1)}},m=n?.token,h=r.find(e=>e.token===m),g=r.filter(e=>e.token!==m);return(0,M.jsxs)(`div`,{className:`space-y-6`,children:[(0,M.jsx)(mP,{icon:Wy,title:e(`sessions.title`),description:e(`sessions.description`),actions:r.length>1?(0,M.jsxs)(Q,{variant:`outline`,size:`sm`,onClick:p,disabled:l,children:[(0,M.jsx)(Vy,{className:`mr-2 h-4 w-4`}),e(l?`sessions.revokingOthers`:`sessions.revokeOthers`)]}):null}),a&&(0,M.jsx)(`div`,{className:`space-y-3`,children:[0,1,2].map(e=>(0,M.jsx)($,{className:`overflow-hidden`,children:(0,M.jsxs)(AN,{className:`flex items-center gap-3 p-4`,children:[(0,M.jsx)(Zw,{className:`size-10 rounded-lg`}),(0,M.jsxs)(`div`,{className:`flex-1 space-y-2`,children:[(0,M.jsx)(Zw,{className:`h-4 w-40`}),(0,M.jsx)(Zw,{className:`h-3 w-64`})]})]})},e))}),!a&&r.length===0&&(0,M.jsx)($,{children:(0,M.jsxs)(AN,{className:`flex flex-col items-center gap-3 p-10 text-center text-sm text-muted-foreground`,children:[(0,M.jsx)(Wy,{className:`size-10 text-muted-foreground/50`}),e(`sessions.empty`)]})}),!a&&h&&(0,M.jsx)(WP,{session:h,isCurrent:!0,revoking:!1,onRevoke:()=>void 0,t:e}),!a&&g.length>0&&(0,M.jsxs)(`div`,{className:`space-y-3`,children:[(0,M.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wider text-muted-foreground`,children:e(`sessions.otherDevices`,{defaultValue:`Other signed-in devices`})}),(0,M.jsx)(`div`,{className:`space-y-2`,children:g.map(t=>(0,M.jsx)(WP,{session:t,isCurrent:!1,revoking:s===t.token,onRevoke:()=>f(t.token),t:e},t.id))})]})]})}function WP({session:e,isCurrent:t,revoking:n,onRevoke:r,t:i}){let a=VP(e.userAgent),o=a.icon;return(0,M.jsx)($,{className:t?`border-primary/40 bg-brand-gradient-subtle shadow-sm shadow-primary/10`:`transition-colors hover:bg-accent/30`,children:(0,M.jsxs)(AN,{className:`flex items-center gap-3 p-4`,children:[(0,M.jsx)(`div`,{className:`flex size-10 shrink-0 items-center justify-center rounded-lg `+(t?`bg-brand-gradient text-primary-foreground shadow-sm shadow-primary/30`:`bg-muted text-muted-foreground`),children:(0,M.jsx)(o,{className:`size-5`})}),(0,M.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,M.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,M.jsx)(`span`,{className:`truncate text-sm font-medium`,children:a.label}),t&&(0,M.jsx)(pP,{className:`border-transparent bg-emerald-500/15 text-[10px] font-medium text-emerald-600 dark:text-emerald-400`,children:i(`sessions.current`)})]}),(0,M.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-muted-foreground`,children:[e.ipAddress&&(0,M.jsx)(`span`,{className:`font-mono`,children:e.ipAddress}),(0,M.jsx)(`span`,{children:i(`sessions.expires`,{date:new Date(e.expiresAt).toLocaleDateString()})})]})]}),!t&&(0,M.jsxs)(Q,{variant:`ghost`,size:`sm`,onClick:r,disabled:n,className:`ml-3 shrink-0 text-muted-foreground hover:text-destructive`,children:[(0,M.jsx)(Vy,{className:`mr-1.5 h-4 w-4`}),i(`sessions.revoke`,{defaultValue:`Revoke`})]})]})})}var GP=Fw,KP=Iw,qP=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(Lw,{ref:n,className:Z(`fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`,e),...t}));qP.displayName=Lw.displayName;var JP=j.forwardRef(({className:e,children:t,...n},r)=>(0,M.jsxs)(KP,{children:[(0,M.jsx)(qP,{}),(0,M.jsxs)(Rw,{ref:r,className:Z(`fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-1/2 data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-1/2 sm:rounded-lg`,e),...n,children:[t,(0,M.jsxs)(Vw,{className:`absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground`,children:[(0,M.jsx)(ub,{className:`h-4 w-4`}),(0,M.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]}));JP.displayName=Rw.displayName;var YP=({className:e,...t})=>(0,M.jsx)(`div`,{className:Z(`flex flex-col space-y-1.5 text-center sm:text-left`,e),...t});YP.displayName=`DialogHeader`;var XP=({className:e,...t})=>(0,M.jsx)(`div`,{className:Z(`flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2`,e),...t});XP.displayName=`DialogFooter`;var ZP=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(zw,{ref:n,className:Z(`text-lg font-semibold leading-none tracking-tight`,e),...t}));ZP.displayName=zw.displayName;var QP=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(Bw,{ref:n,className:Z(`text-sm text-muted-foreground`,e),...t}));QP.displayName=Bw.displayName;var $P=la(`/account/security`)({component:eF});function eF(){let{t:e}=vt(),t=n_(),n=Hi(),{user:r,logout:i}=iN(),[a,o]=(0,j.useState)(``),[s,c]=(0,j.useState)(``),[l,u]=(0,j.useState)(``),[d,f]=(0,j.useState)(!0),[p,m]=(0,j.useState)(!1),[h,g]=(0,j.useState)(``),[_,v]=(0,j.useState)(!1),[y,b]=(0,j.useState)(!1),[x,S]=(0,j.useState)(``),[C,w]=(0,j.useState)(``),[T,E]=(0,j.useState)(!1);return(0,M.jsxs)(`div`,{className:`space-y-6`,children:[(0,M.jsx)(mP,{icon:Qy,title:e(`security.title`),description:e(`security.description`)}),(0,M.jsxs)($,{children:[(0,M.jsxs)(DN,{children:[(0,M.jsxs)(ON,{className:`text-base flex items-center gap-2`,children:[(0,M.jsx)(Qy,{className:`h-4 w-4 text-primary`}),e(`security.changePasswordTitle`,{defaultValue:`Change password`})]}),(0,M.jsx)(kN,{children:e(`security.changePasswordDescription`,{defaultValue:`Use at least 8 characters. Mix letters, numbers and symbols for strength.`})})]}),(0,M.jsx)(AN,{children:(0,M.jsxs)(`form`,{onSubmit:async n=>{if(n.preventDefault(),s!==l){q({title:e(`security.passwordsMismatch`),variant:`destructive`});return}m(!0);try{await t.auth.changePassword({currentPassword:a,newPassword:s,revokeOtherSessions:d}),q({title:e(`security.changed`)}),o(``),c(``),u(``)}catch(t){q({title:e(`security.changeFailed`),description:t.message,variant:`destructive`})}finally{m(!1)}},className:`space-y-4`,children:[(0,M.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,M.jsx)(UN,{htmlFor:`current-password`,children:e(`security.currentPassword`)}),(0,M.jsx)(oS,{id:`current-password`,type:`password`,autoComplete:`current-password`,required:!0,value:a,onChange:e=>o(e.target.value)})]}),(0,M.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,M.jsx)(UN,{htmlFor:`new-password`,children:e(`security.newPassword`)}),(0,M.jsx)(oS,{id:`new-password`,type:`password`,autoComplete:`new-password`,required:!0,minLength:8,value:s,onChange:e=>c(e.target.value)})]}),(0,M.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,M.jsx)(UN,{htmlFor:`confirm-new-password`,children:e(`security.confirmPassword`)}),(0,M.jsx)(oS,{id:`confirm-new-password`,type:`password`,autoComplete:`new-password`,required:!0,minLength:8,value:l,onChange:e=>u(e.target.value)})]}),(0,M.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,M.jsx)(`input`,{type:`checkbox`,checked:d,onChange:e=>f(e.target.checked)}),e(`security.revokeOtherSessions`)]}),(0,M.jsx)(Q,{type:`submit`,disabled:p,children:e(p?`common.saving`:`security.submit`)})]})})]}),(0,M.jsxs)($,{children:[(0,M.jsxs)(DN,{children:[(0,M.jsxs)(ON,{className:`text-base flex items-center gap-2`,children:[(0,M.jsx)(Uy,{className:`h-4 w-4 text-primary`}),e(`security.email.title`)]}),(0,M.jsx)(kN,{children:e(`security.email.description`)})]}),(0,M.jsx)(AN,{children:(0,M.jsxs)(`form`,{onSubmit:async n=>{if(n.preventDefault(),!(!h||h===r?.email)){v(!0);try{await t.auth.changeEmail({newEmail:h,callbackURL:window.location.origin+`/login`}),q({title:e(`security.email.requested`),description:e(`security.email.checkInbox`,{email:h})}),g(``)}catch(t){q({title:e(`security.email.requestFailed`),description:t.message,variant:`destructive`})}finally{v(!1)}}},className:`space-y-4`,children:[(0,M.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,M.jsx)(UN,{htmlFor:`current-email`,children:e(`security.email.current`)}),(0,M.jsx)(oS,{id:`current-email`,value:r?.email??``,disabled:!0})]}),(0,M.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,M.jsx)(UN,{htmlFor:`new-email`,children:e(`security.email.new`)}),(0,M.jsx)(oS,{id:`new-email`,type:`email`,value:h,onChange:e=>g(e.target.value),placeholder:e(`security.email.placeholder`),required:!0})]}),(0,M.jsx)(Q,{type:`submit`,disabled:_||!h||h===r?.email,children:e(_?`common.saving`:`security.email.submit`)})]})})]}),(0,M.jsxs)($,{className:`border-destructive/40 bg-destructive/5`,children:[(0,M.jsxs)(DN,{children:[(0,M.jsxs)(ON,{className:`text-base flex items-center gap-2 text-destructive`,children:[(0,M.jsx)(rb,{className:`h-4 w-4`}),e(`security.delete.title`)]}),(0,M.jsx)(kN,{children:e(`security.delete.description`)})]}),(0,M.jsx)(AN,{children:(0,M.jsxs)(Q,{variant:`destructive`,onClick:()=>b(!0),children:[(0,M.jsx)(nb,{className:`mr-2 h-4 w-4`}),e(`security.delete.cta`)]})})]}),(0,M.jsx)(GP,{open:y,onOpenChange:b,children:(0,M.jsxs)(JP,{children:[(0,M.jsxs)(YP,{children:[(0,M.jsx)(ZP,{children:e(`security.delete.dialogTitle`)}),(0,M.jsx)(QP,{children:e(`security.delete.dialogDescription`,{email:r?.email??``})})]}),(0,M.jsxs)(`div`,{className:`space-y-4`,children:[(0,M.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,M.jsx)(UN,{htmlFor:`delete-password`,children:e(`security.delete.password`)}),(0,M.jsx)(oS,{id:`delete-password`,type:`password`,autoComplete:`current-password`,value:x,onChange:e=>S(e.target.value)})]}),(0,M.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,M.jsx)(UN,{htmlFor:`delete-confirm`,children:e(`security.delete.typeEmail`,{email:r?.email??``})}),(0,M.jsx)(oS,{id:`delete-confirm`,value:C,onChange:e=>w(e.target.value),placeholder:r?.email??``})]})]}),(0,M.jsxs)(XP,{children:[(0,M.jsx)(Q,{variant:`outline`,onClick:()=>b(!1),disabled:T,children:e(`common.cancel`)}),(0,M.jsx)(Q,{variant:`destructive`,onClick:async()=>{if(C!==r?.email){q({title:e(`security.delete.confirmationMismatch`),description:e(`security.delete.confirmationHint`,{email:r?.email??``}),variant:`destructive`});return}E(!0);try{await t.auth.deleteUser({password:x}),q({title:e(`security.delete.success`)});try{await i()}catch{}n({to:`/login`,replace:!0})}catch(t){q({title:e(`security.delete.failed`),description:t.message,variant:`destructive`})}finally{E(!1)}},disabled:T||C!==r?.email,children:e(T?`common.saving`:`security.delete.confirm`)})]})]})})]})}var tF=la(`/account/profile`)({component:nF});function nF(){let{t:e}=vt(),t=n_(),{user:n,refresh:r}=iN(),[i,a]=(0,j.useState)(n?.name??``),[o,s]=(0,j.useState)(n?.image??null),[c,l]=(0,j.useState)(!1),[u,d]=(0,j.useState)(!1),f=(0,j.useRef)(null);(0,j.useEffect)(()=>{a(n?.name??``),s(n?.image??null)},[n?.id,n?.name,n?.image]);let p=async n=>{n.preventDefault(),l(!0);try{await t.auth.updateUser({name:i,image:o}),await r(),q({title:e(`profile.updated`)})}catch(t){q({title:e(`profile.updateFailed`),description:t.message,variant:`destructive`})}finally{l(!1)}},m=()=>f.current?.click(),h=async n=>{let i=n.target.files?.[0];if(n.target.value=``,i){d(!0);try{if(!t?.storage?.upload)throw Error(e(`profile.avatarStorageUnavailable`));let n=await t.storage.upload(i,`user`),a=n?.data?.url??n?.url;if(!a)throw Error(`Upload returned no URL`);s(a),await t.auth.updateUser({image:a}),await r(),q({title:e(`profile.avatarUpdated`)})}catch(t){q({title:e(`profile.avatarUploadFailed`),description:t.message,variant:`destructive`})}finally{d(!1)}}},g=(n?.name??n?.email??`?`).split(/\s+/).map(e=>e[0]).join(``).slice(0,2).toUpperCase();return(0,M.jsxs)(`div`,{className:`space-y-6`,children:[(0,M.jsxs)(`div`,{className:`relative overflow-hidden rounded-xl border bg-card`,children:[(0,M.jsx)(`div`,{className:`absolute inset-x-0 top-0 h-24 bg-brand-gradient`,"aria-hidden":!0}),(0,M.jsx)(`div`,{className:`absolute inset-x-0 top-0 h-24 opacity-30`,style:{backgroundImage:`radial-gradient(ellipse at 20% 0%, rgba(255,255,255,0.4), transparent 60%)`},"aria-hidden":!0}),(0,M.jsx)(`div`,{className:`relative px-5 pb-5 pt-12 sm:px-6 sm:pb-6 sm:pt-16`,children:(0,M.jsxs)(`div`,{className:`flex flex-col gap-4 sm:flex-row sm:items-end sm:gap-5`,children:[(0,M.jsxs)(YM,{className:`size-20 shrink-0 ring-4 ring-card shadow-md`,children:[o?(0,M.jsx)(XM,{src:o,alt:n?.name??``}):null,(0,M.jsx)(ZM,{className:`bg-brand-gradient text-base font-semibold text-primary-foreground`,children:g})]}),(0,M.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1`,children:[(0,M.jsx)(`h2`,{className:`truncate text-xl font-semibold tracking-tight`,children:n?.name||e(`profile.namePlaceholder`)}),(0,M.jsx)(`p`,{className:`truncate text-sm text-muted-foreground`,children:n?.email})]}),(0,M.jsxs)(Q,{type:`button`,variant:`outline`,size:`sm`,onClick:m,disabled:u,className:`self-start sm:self-auto`,children:[(0,M.jsx)(ib,{className:`mr-2 h-4 w-4`}),e(u?`profile.avatarUploading`:`profile.changeAvatar`)]}),(0,M.jsx)(`input`,{ref:f,type:`file`,accept:`image/*`,className:`hidden`,onChange:h})]})})]}),(0,M.jsxs)($,{children:[(0,M.jsxs)(DN,{children:[(0,M.jsx)(ON,{className:`text-base`,children:e(`profile.title`)}),(0,M.jsx)(kN,{children:e(`profile.description`)})]}),(0,M.jsx)(AN,{children:(0,M.jsxs)(`form`,{onSubmit:p,className:`space-y-4`,children:[(0,M.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,M.jsx)(UN,{htmlFor:`profile-email`,children:e(`profile.email`)}),(0,M.jsx)(oS,{id:`profile-email`,value:n?.email??``,disabled:!0})]}),(0,M.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,M.jsx)(UN,{htmlFor:`profile-name`,children:e(`profile.name`)}),(0,M.jsx)(oS,{id:`profile-name`,value:i,onChange:e=>a(e.target.value),placeholder:e(`profile.namePlaceholder`)})]}),(0,M.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`profile.avatarHint`)}),(0,M.jsx)(Q,{type:`submit`,disabled:c,className:`bg-brand-gradient text-primary-foreground shadow-sm shadow-primary/20 transition-all hover:opacity-95 hover:shadow-md hover:shadow-primary/30`,children:e(c?`common.saving`:`profile.save`)})]})})]})]})}var rF=la(`/account/linked-accounts`)({component:aF}),iF={google:`Google`,github:`GitHub`,microsoft:`Microsoft`,apple:`Apple`,discord:`Discord`,gitlab:`GitLab`,twitter:`Twitter / X`,facebook:`Facebook`};function aF(){let{t:e}=vt(),t=n_(),[n,r]=(0,j.useState)([]),[i,a]=(0,j.useState)(!0),[o,s]=(0,j.useState)(null),c=(0,j.useCallback)(async()=>{if(t?.auth?.accounts){a(!0);try{let e=await t.auth.accounts.list();r(e?.accounts??e?.data??(Array.isArray(e)?e:[]))}catch{r([])}finally{a(!1)}}},[t]);(0,j.useEffect)(()=>{c()},[c]);let l=async n=>{if(confirm(e(`linkedAccounts.unlinkConfirm`,{provider:iF[n.providerId]??n.providerId}))){s(n.id);try{await t.auth.accounts.unlink({providerId:n.providerId,accountId:n.accountId}),q({title:e(`linkedAccounts.unlinked`)}),await c()}catch(t){q({title:e(`linkedAccounts.unlinkFailed`),description:t.message,variant:`destructive`})}finally{s(null)}}},u=async n=>{try{let r=await t.auth.accounts.linkSocial({provider:n,callbackURL:window.location.href}),i=r?.url??r?.data?.url;i?window.location.assign(i):q({title:e(`linkedAccounts.linkFailed`),variant:`destructive`})}catch(t){q({title:e(`linkedAccounts.linkFailed`),description:t.message,variant:`destructive`})}},d=new Set(n.map(e=>e.providerId)),f=Object.keys(iF).filter(e=>!d.has(e));return(0,M.jsxs)(`div`,{className:`space-y-6`,children:[(0,M.jsx)(mP,{icon:By,title:e(`linkedAccounts.title`),description:e(`linkedAccounts.description`)}),(0,M.jsxs)($,{children:[(0,M.jsxs)(DN,{children:[(0,M.jsx)(ON,{className:`text-base`,children:e(`linkedAccounts.connectedTitle`,{defaultValue:`Connected providers`})}),(0,M.jsx)(kN,{children:e(`linkedAccounts.connectedDescription`,{defaultValue:`Sign-in providers currently linked to this account.`})})]}),(0,M.jsxs)(AN,{children:[i&&(0,M.jsxs)(`div`,{className:`space-y-3`,children:[(0,M.jsx)(Zw,{className:`h-12 w-full`}),(0,M.jsx)(Zw,{className:`h-12 w-full`})]}),!i&&n.length===0&&(0,M.jsxs)(`div`,{className:`text-center py-8`,children:[(0,M.jsx)(By,{className:`mx-auto h-12 w-12 text-muted-foreground/50`}),(0,M.jsx)(`p`,{className:`mt-4 text-sm text-muted-foreground`,children:e(`linkedAccounts.empty`)})]}),!i&&n.length>0&&(0,M.jsx)(`div`,{className:`divide-y`,children:n.map(t=>(0,M.jsxs)(`div`,{className:`flex items-center justify-between py-3`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,M.jsx)(pP,{variant:`secondary`,children:iF[t.providerId]??t.providerId}),t.createdAt&&(0,M.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e(`linkedAccounts.linkedOn`,{date:new Date(t.createdAt).toLocaleDateString()})})]}),(0,M.jsxs)(Q,{variant:`ghost`,size:`sm`,disabled:o===t.id,onClick:()=>l(t),children:[(0,M.jsx)(zy,{className:`mr-1 h-4 w-4`}),e(`linkedAccounts.unlink`)]})]},t.id))})]})]}),f.length>0&&(0,M.jsxs)($,{children:[(0,M.jsxs)(DN,{children:[(0,M.jsx)(ON,{className:`text-base`,children:e(`linkedAccounts.addTitle`)}),(0,M.jsx)(kN,{children:e(`linkedAccounts.addDescription`)})]}),(0,M.jsx)(AN,{children:(0,M.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:f.map(e=>(0,M.jsxs)(Q,{variant:`outline`,size:`sm`,onClick:()=>u(e),children:[(0,M.jsx)(qy,{className:`mr-1 h-3 w-3`}),iF[e]]},e))})})]})]})}function oF(e){let t=n_(),[n,r]=(0,j.useState)([]),[i,a]=(0,j.useState)(!1),[o,s]=(0,j.useState)(null),c=(0,j.useCallback)(async()=>{if(!(!e||!t?.organizations)){a(!0),s(null);try{let n=await t.organizations.listMembers(e);r(n?.members??n?.data?.members??(Array.isArray(n)?n:[]))}catch(e){s(e),r([])}finally{a(!1)}}},[t,e]);return(0,j.useEffect)(()=>{c()},[c]),{members:n,loading:i,error:o,reload:c,inviteMember:(0,j.useCallback)(async(n,r=`member`)=>{if(!e||!t?.organizations)throw Error(`Organization ID or client not available`);let i=await t.organizations.invite({email:n,role:r,organizationId:e});return await c(),i},[t,e,c]),removeMember:(0,j.useCallback)(async n=>{if(!e||!t?.organizations?.removeMember)throw Error(`Organization ID or client not available`);let r=await t.organizations.removeMember(e,{memberIdOrEmail:n});return await c(),r},[t,e,c]),updateMemberRole:(0,j.useCallback)(async(n,r)=>{if(!e||!t?.organizations?.updateMemberRole)throw Error(`Organization ID or client not available`);let i=await t.organizations.updateMemberRole(e,{memberId:n,role:r});return await c(),i},[t,e,c])}}function sF(e){let t=n_(),[n,r]=(0,j.useState)([]),[i,a]=(0,j.useState)(!1),[o,s]=(0,j.useState)(null),c=(0,j.useCallback)(async()=>{if(!(!e||!t?.organizations?.invitations)){a(!0),s(null);try{let n=await t.organizations.invitations.list(e);r(n?.invitations??n?.data?.invitations??(Array.isArray(n)?n:[]))}catch(e){s(e),r([])}finally{a(!1)}}},[t,e]);return(0,j.useEffect)(()=>{c()},[c]),{invitations:n,loading:i,error:o,reload:c,cancelInvitation:(0,j.useCallback)(async e=>{if(!t?.organizations?.invitations?.cancel)throw Error(`Client not available`);let n=await t.organizations.invitations.cancel(e);return await c(),n},[t,c]),resendInvitation:(0,j.useCallback)(async e=>{if(!t?.organizations?.invitations?.resend)throw Error(`Client not available`);let n=await t.organizations.invitations.resend({id:e.id,email:e.email,role:e.role,organizationId:e.organizationId,teamId:e.teamId??null});return await c(),n},[t,c])}}function cF(){let e=n_(),[t,n]=(0,j.useState)([]),[r,i]=(0,j.useState)(!1),[a,o]=(0,j.useState)(null),s=(0,j.useCallback)(async()=>{if(e?.organizations?.invitations?.listMine){i(!0),o(null);try{let t=await e.organizations.invitations.listMine();n(t?.invitations??t?.data?.invitations??(Array.isArray(t)?t:[]))}catch(e){o(e),n([])}finally{i(!1)}}},[e]);return(0,j.useEffect)(()=>{s()},[s]),{invitations:t,loading:r,error:a,reload:s,accept:(0,j.useCallback)(async t=>{let n=await e.organizations.invitations.accept(t);return await s(),n},[e,s]),reject:(0,j.useCallback)(async t=>{let n=await e.organizations.invitations.reject(t);return await s(),n},[e,s])}}var lF=la(`/account/invitations`)({component:uF});function uF(){let{t:e}=vt(),{invitations:t,loading:n,accept:r,reject:i}=cF(),a=t.filter(e=>e.status===`pending`),o=async t=>{try{await r(t),q({title:e(`invitations.accepted`)})}catch(t){q({title:e(`invitations.acceptFailed`),description:t.message,variant:`destructive`})}},s=async t=>{try{await i(t),q({title:e(`invitations.rejected`)})}catch(t){q({title:e(`invitations.rejectFailed`),description:t.message,variant:`destructive`})}};return(0,M.jsxs)(`div`,{className:`space-y-6`,children:[(0,M.jsx)(mP,{icon:Iy,title:e(`invitations.title`),description:e(`invitations.description`),actions:a.length>0?(0,M.jsx)(pP,{variant:`outline`,className:`font-medium`,children:e(`invitations.pendingCount`,{count:a.length,defaultValue:`{{count}} pending`})}):null}),(0,M.jsxs)($,{children:[(0,M.jsxs)(DN,{children:[(0,M.jsx)(ON,{className:`text-base`,children:e(`invitations.pendingTitle`,{defaultValue:`Pending invitations`})}),(0,M.jsx)(kN,{children:e(`invitations.pendingDescription`,{defaultValue:`Accept to join an organization, or reject to remove it from your inbox.`})})]}),(0,M.jsxs)(AN,{children:[n&&(0,M.jsxs)(`div`,{className:`space-y-3`,children:[(0,M.jsx)(Zw,{className:`h-12 w-full`}),(0,M.jsx)(Zw,{className:`h-12 w-full`})]}),!n&&a.length===0&&(0,M.jsxs)(`div`,{className:`text-center py-8`,children:[(0,M.jsx)(Iy,{className:`mx-auto h-12 w-12 text-muted-foreground/50`}),(0,M.jsx)(`p`,{className:`mt-4 text-sm text-muted-foreground`,children:e(`invitations.empty`)})]}),!n&&a.length>0&&(0,M.jsx)(`div`,{className:`divide-y`,children:a.map(t=>(0,M.jsxs)(`div`,{className:`flex items-center justify-between py-3`,children:[(0,M.jsxs)(`div`,{className:`flex-1`,children:[(0,M.jsx)(`div`,{className:`text-sm font-medium`,children:t.organizationId}),(0,M.jsxs)(`div`,{className:`flex items-center gap-2 mt-1`,children:[(0,M.jsx)(pP,{variant:`outline`,className:`text-xs`,children:e(`common.roles.${t.role}`)}),(0,M.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e(`invitations.expires`,{date:new Date(t.expiresAt).toLocaleDateString()})})]})]}),(0,M.jsxs)(`div`,{className:`flex gap-2`,children:[(0,M.jsxs)(Q,{size:`sm`,onClick:()=>o(t.id),children:[(0,M.jsx)(xy,{className:`mr-1 h-4 w-4`}),e(`invitations.accept`)]}),(0,M.jsxs)(Q,{size:`sm`,variant:`outline`,onClick:()=>s(t.id),children:[(0,M.jsx)(ub,{className:`mr-1 h-4 w-4`}),e(`invitations.reject`)]})]})]},t.id))})]})]})]})}var dF=la(`/accept-invitation/$invitationId`)({component:fF});function fF(){let{t:e}=vt(),{invitationId:t}=dF.useParams(),n=Hi(),r=n_(),{user:i,loading:a,reloadOrganizations:o}=iN(),[s,c]=(0,j.useState)(!1),[l,u]=(0,j.useState)(!1);return(0,j.useEffect)(()=>{a||i||n({to:`/login`,search:{redirect:`/accept-invitation/${t}`},replace:!0})},[a,i,t,n]),(0,M.jsx)(`div`,{className:`flex min-h-svh w-full flex-col items-center justify-center gap-6 bg-muted p-6 md:p-10`,children:(0,M.jsx)(`div`,{className:`flex w-full max-w-sm flex-col gap-6`,children:(0,M.jsxs)($,{children:[(0,M.jsxs)(DN,{className:`text-center`,children:[(0,M.jsx)(ON,{className:`text-xl`,children:e(`acceptInvitation.title`)}),(0,M.jsx)(kN,{children:e(`acceptInvitation.description`)})]}),(0,M.jsxs)(AN,{className:`flex flex-col gap-3`,children:[(0,M.jsx)(Q,{className:`w-full`,onClick:async()=>{c(!0);try{await r.organizations.invitations.accept(t),await o().catch(()=>{}),q({title:e(`acceptInvitation.accepted`)}),n({to:`/organizations`})}catch(t){q({title:e(`acceptInvitation.acceptFailed`),description:t.message,variant:`destructive`})}finally{c(!1)}},disabled:s||l,children:e(s?`acceptInvitation.accepting`:`acceptInvitation.accept`)}),(0,M.jsx)(Q,{variant:`outline`,className:`w-full`,onClick:async()=>{u(!0);try{await r.organizations.invitations.reject(t),q({title:e(`acceptInvitation.declined`)}),n({to:`/organizations`})}catch(t){q({title:e(`acceptInvitation.declineFailed`),description:t.message,variant:`destructive`})}finally{u(!1)}},disabled:s||l,children:e(l?`acceptInvitation.declining`:`acceptInvitation.decline`)})]})]})})})}var pF=la(`/organizations/$orgId/`)({component:()=>{let{orgId:e}=pF.useParams();return(0,M.jsx)(Ui,{to:`/organizations/$orgId/general`,params:{orgId:e},replace:!0})}}),mF=la(`/account/oauth-applications/`)({component:hF});function hF(){let{t:e}=vt(),t=Hi(),{applications:n,loading:r,reload:i}=DP(),{remove:a,deleting:o}=kP(),[s,c]=(0,j.useState)(null);return(0,M.jsxs)(`div`,{className:`space-y-6`,children:[(0,M.jsx)(mP,{icon:Ly,title:e(`oauth.applications.title`),description:e(`oauth.applications.description`),actions:(0,M.jsxs)(Q,{onClick:()=>t({to:`/account/oauth-applications/new`}),className:`bg-brand-gradient text-primary-foreground shadow-sm shadow-primary/20 transition-all hover:opacity-95 hover:shadow-md hover:shadow-primary/30`,children:[(0,M.jsx)(qy,{className:`mr-2 h-4 w-4`}),e(`oauth.applications.new`)]})}),r?(0,M.jsx)(`div`,{className:`space-y-3`,children:[0,1,2].map(e=>(0,M.jsx)($,{children:(0,M.jsxs)(AN,{className:`flex items-center gap-3 p-4`,children:[(0,M.jsx)(Zw,{className:`size-10 rounded-md`}),(0,M.jsxs)(`div`,{className:`flex-1 space-y-2`,children:[(0,M.jsx)(Zw,{className:`h-4 w-40`}),(0,M.jsx)(Zw,{className:`h-3 w-64`})]})]})},e))}):n.length===0?(0,M.jsx)($,{children:(0,M.jsxs)(AN,{className:`flex flex-col items-center gap-3 p-12 text-center`,children:[(0,M.jsx)(`div`,{className:`flex size-12 items-center justify-center rounded-lg bg-brand-gradient-subtle text-primary ring-1 ring-primary/15`,children:(0,M.jsx)(Ly,{className:`h-6 w-6`})}),(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`p`,{className:`font-medium`,children:e(`oauth.applications.emptyTitle`)}),(0,M.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`oauth.applications.emptyDescription`)})]}),(0,M.jsxs)(Q,{onClick:()=>t({to:`/account/oauth-applications/new`}),className:`bg-brand-gradient text-primary-foreground shadow-sm shadow-primary/20`,children:[(0,M.jsx)(qy,{className:`mr-2 h-4 w-4`}),e(`oauth.applications.register`)]})]})}):(0,M.jsx)(`div`,{className:`grid gap-3`,children:n.map(t=>(0,M.jsx)($,{className:`group transition-all hover:-translate-y-0.5 hover:border-primary/30 hover:shadow-md hover:shadow-primary/5`,children:(0,M.jsx)(DN,{className:`pb-3`,children:(0,M.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,M.jsxs)(ra,{to:`/account/oauth-applications/$clientId`,params:{clientId:t.client_id},className:`flex flex-1 items-center gap-3`,children:[(0,M.jsx)(`div`,{className:`flex size-10 shrink-0 items-center justify-center rounded-md bg-brand-gradient-subtle text-primary ring-1 ring-primary/15 transition-transform group-hover:scale-105`,children:(0,M.jsx)(Ly,{className:`h-5 w-5`})}),(0,M.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,M.jsx)(ON,{className:`text-base`,children:t.name}),(0,M.jsx)(kN,{className:`font-mono text-xs`,children:t.client_id})]}),(0,M.jsx)(pP,{variant:`outline`,className:`capitalize`,children:t.type}),t.disabled&&(0,M.jsx)(pP,{variant:`destructive`,children:e(`oauth.applications.disabled`)})]}),(0,M.jsx)(Q,{variant:`ghost`,size:`icon`,className:`text-muted-foreground hover:text-destructive`,onClick:e=>{e.preventDefault(),e.stopPropagation(),c(t)},children:(0,M.jsx)(nb,{className:`h-4 w-4`})})]})})},t.id))}),(0,M.jsx)(GP,{open:!!s,onOpenChange:e=>!e&&c(null),children:(0,M.jsxs)(JP,{children:[(0,M.jsxs)(YP,{children:[(0,M.jsx)(ZP,{children:e(`oauth.applications.deleteDialogTitle`)}),(0,M.jsx)(QP,{children:e(`oauth.applications.deleteDialogDescription`,{name:s?.name??``})})]}),(0,M.jsxs)(XP,{children:[(0,M.jsx)(Q,{variant:`outline`,onClick:()=>c(null),disabled:o,children:e(`common.cancel`)}),(0,M.jsx)(Q,{variant:`destructive`,onClick:async()=>{if(s)try{await a(s.client_id),q({title:e(`oauth.applications.deleted`)}),c(null),await i()}catch(t){q({title:e(`oauth.applications.deleteFailed`),description:t.message,variant:`destructive`})}},disabled:o,children:e(o?`oauth.applications.deleting`:`common.delete`)})]})]})})]})}function gF(e,[t,n]){return Math.min(n,Math.max(t,e))}function _F(e){let t=j.useRef({value:e,previous:e});return j.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var vF=[` `,`Enter`,`ArrowUp`,`ArrowDown`],yF=[` `,`Enter`],bF=`Select`,[xF,SF,CF]=D_(bF),[wF,TF]=v_(bF,[CF,gD]),EF=gD(),[DF,OF]=wF(bF),[kF,AF]=wF(bF),jF=e=>{let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:c,dir:l,name:u,autoComplete:d,disabled:f,required:p,form:m}=e,h=EF(t),[g,_]=j.useState(null),[v,y]=j.useState(null),[b,x]=j.useState(!1),S=dk(l),[C,w]=nv({prop:r,defaultProp:i??!1,onChange:a,caller:bF}),[T,E]=nv({prop:o,defaultProp:s,onChange:c,caller:bF}),D=j.useRef(null),O=g?m||!!g.closest(`form`):!0,[ee,te]=j.useState(new Set),ne=Array.from(ee).map(e=>e.props.value).join(`;`);return(0,M.jsx)(MD,{...h,children:(0,M.jsxs)(DF,{required:p,scope:t,trigger:g,onTriggerChange:_,valueNode:v,onValueNodeChange:y,valueNodeHasChildren:b,onValueNodeHasChildrenChange:x,contentId:_S(),value:T,onValueChange:E,open:C,onOpenChange:w,dir:S,triggerPointerDownPosRef:D,disabled:f,children:[(0,M.jsx)(xF.Provider,{scope:t,children:(0,M.jsx)(kF,{scope:e.__scopeSelect,onNativeOptionAdd:j.useCallback(e=>{te(t=>new Set(t).add(e))},[]),onNativeOptionRemove:j.useCallback(e=>{te(t=>{let n=new Set(t);return n.delete(e),n})},[]),children:n})}),O?(0,M.jsxs)(EI,{"aria-hidden":!0,required:p,tabIndex:-1,name:u,autoComplete:d,value:T,onChange:e=>E(e.target.value),disabled:f,form:m,children:[T===void 0?(0,M.jsx)(`option`,{value:``}):null,Array.from(ee)]},ne):null]})})};jF.displayName=bF;var MF=`SelectTrigger`,NF=j.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...i}=e,a=EF(n),o=OF(MF,n),s=o.disabled||r,c=g_(t,o.onTriggerChange),l=SF(n),u=j.useRef(`touch`),[d,f,p]=OI(e=>{let t=l().filter(e=>!e.disabled),n=kI(t,e,t.find(e=>e.value===o.value));n!==void 0&&o.onValueChange(n.value)}),m=e=>{s||(o.onOpenChange(!0),p()),e&&(o.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,M.jsx)(ND,{asChild:!0,...a,children:(0,M.jsx)(O_.button,{type:`button`,role:`combobox`,"aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":`none`,dir:o.dir,"data-state":o.open?`open`:`closed`,disabled:s,"data-disabled":s?``:void 0,"data-placeholder":DI(o.value)?``:void 0,...i,ref:c,onClick:J(i.onClick,e=>{e.currentTarget.focus(),u.current!==`mouse`&&m(e)}),onPointerDown:J(i.onPointerDown,e=>{u.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(m(e),e.preventDefault())}),onKeyDown:J(i.onKeyDown,e=>{let t=d.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&f(e.key),!(t&&e.key===` `)&&vF.includes(e.key)&&(m(),e.preventDefault())})})})});NF.displayName=MF;var PF=`SelectValue`,FF=j.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,children:a,placeholder:o=``,...s}=e,c=OF(PF,n),{onValueNodeHasChildrenChange:l}=c,u=a!==void 0,d=g_(t,c.onValueNodeChange);return q_(()=>{l(u)},[l,u]),(0,M.jsx)(O_.span,{...s,ref:d,style:{pointerEvents:`none`},children:DI(c.value)?(0,M.jsx)(M.Fragment,{children:o}):a})});FF.displayName=PF;var IF=`SelectIcon`,LF=j.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,M.jsx)(O_.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})});LF.displayName=IF;var RF=`SelectPortal`,zF=e=>(0,M.jsx)(Y_,{asChild:!0,...e});zF.displayName=RF;var BF=`SelectContent`,VF=j.forwardRef((e,t)=>{let n=OF(BF,e.__scopeSelect),[r,i]=j.useState();if(q_(()=>{i(new DocumentFragment)},[]),!n.open){let t=r;return t?Gi.createPortal((0,M.jsx)(UF,{scope:e.__scopeSelect,children:(0,M.jsx)(xF.Slot,{scope:e.__scopeSelect,children:(0,M.jsx)(`div`,{children:e.children})})}),t):null}return(0,M.jsx)(qF,{...e,ref:t})});VF.displayName=BF;var HF=10,[UF,WF]=wF(BF),GF=`SelectContentImpl`,KF=b_(`SelectContent.RemoveScroll`),qF=j.forwardRef((e,t)=>{let{__scopeSelect:n,position:r=`item-aligned`,onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:o,side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g,..._}=e,v=OF(BF,n),[y,b]=j.useState(null),[x,S]=j.useState(null),C=g_(t,e=>b(e)),[w,T]=j.useState(null),[E,D]=j.useState(null),O=SF(n),[ee,te]=j.useState(!1),ne=j.useRef(!1);j.useEffect(()=>{if(y)return ew(y)},[y]),FS();let re=j.useCallback(e=>{let[t,...n]=O().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&x&&(x.scrollTop=0),n===r&&x&&(x.scrollTop=x.scrollHeight),n?.focus(),document.activeElement!==i))return},[O,x]),ie=j.useCallback(()=>re([w,y]),[re,w,y]);j.useEffect(()=>{ee&&ie()},[ee,ie]);let{onOpenChange:ae,triggerPointerDownPosRef:oe}=v;j.useEffect(()=>{if(y){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(oe.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(oe.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():y.contains(n.target)||ae(!1),document.removeEventListener(`pointermove`,t),oe.current=null};return oe.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[y,ae,oe]),j.useEffect(()=>{let e=()=>ae(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[ae]);let[k,se]=OI(e=>{let t=O().filter(e=>!e.disabled),n=kI(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current.focus())}),ce=j.useCallback((e,t,n)=>{let r=!ne.current&&!n;(v.value!==void 0&&v.value===t||r)&&(T(e),r&&(ne.current=!0))},[v.value]),le=j.useCallback(()=>y?.focus(),[y]),ue=j.useCallback((e,t,n)=>{let r=!ne.current&&!n;(v.value!==void 0&&v.value===t||r)&&D(e)},[v.value]),A=r===`popper`?ZF:YF,de=A===ZF?{side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g}:{};return(0,M.jsx)(UF,{scope:n,content:y,viewport:x,onViewportChange:S,itemRefCallback:ce,selectedItem:w,onItemLeave:le,itemTextRefCallback:ue,focusSelectedItem:ie,selectedItemText:E,position:r,isPositioned:ee,searchRef:k,children:(0,M.jsx)(GC,{as:KF,allowPinchZoom:!0,children:(0,M.jsx)(SS,{asChild:!0,trapped:v.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:J(i,e=>{v.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,M.jsx)(R_,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:(0,M.jsx)(A,{role:`listbox`,id:v.contentId,"data-state":v.open?`open`:`closed`,dir:v.dir,onContextMenu:e=>e.preventDefault(),..._,...de,onPlaced:()=>te(!0),ref:C,style:{display:`flex`,flexDirection:`column`,outline:`none`,..._.style},onKeyDown:J(_.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&se(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=O().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>re(t)),e.preventDefault()}})})})})})})});qF.displayName=GF;var JF=`SelectItemAlignedPosition`,YF=j.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:r,...i}=e,a=OF(BF,n),o=WF(BF,n),[s,c]=j.useState(null),[l,u]=j.useState(null),d=g_(t,e=>u(e)),f=SF(n),p=j.useRef(!1),m=j.useRef(!0),{viewport:h,selectedItem:g,selectedItemText:_,focusSelectedItem:v}=o,y=j.useCallback(()=>{if(a.trigger&&a.valueNode&&s&&l&&h&&g&&_){let e=a.trigger.getBoundingClientRect(),t=l.getBoundingClientRect(),n=a.valueNode.getBoundingClientRect(),i=_.getBoundingClientRect();if(a.dir!==`rtl`){let r=i.left-t.left,a=n.left-r,o=e.left-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-HF,d=gF(a,[HF,Math.max(HF,u-l)]);s.style.minWidth=c+`px`,s.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-HF,d=gF(a,[HF,Math.max(HF,u-l)]);s.style.minWidth=c+`px`,s.style.right=d+`px`}let o=f(),c=window.innerHeight-HF*2,u=h.scrollHeight,d=window.getComputedStyle(l),m=parseInt(d.borderTopWidth,10),v=parseInt(d.paddingTop,10),y=parseInt(d.borderBottomWidth,10),b=parseInt(d.paddingBottom,10),x=m+v+u+b+y,S=Math.min(g.offsetHeight*5,x),C=window.getComputedStyle(h),w=parseInt(C.paddingTop,10),T=parseInt(C.paddingBottom,10),E=e.top+e.height/2-HF,D=c-E,O=g.offsetHeight/2,ee=g.offsetTop+O,te=m+v+ee,ne=x-te;if(te<=E){let e=o.length>0&&g===o[o.length-1].ref.current;s.style.bottom=`0px`;let t=l.clientHeight-h.offsetTop-h.offsetHeight,n=te+Math.max(D,O+(e?T:0)+t+y);s.style.height=n+`px`}else{let e=o.length>0&&g===o[0].ref.current;s.style.top=`0px`;let t=Math.max(E,m+h.offsetTop+(e?w:0)+O)+ne;s.style.height=t+`px`,h.scrollTop=te-E+h.offsetTop}s.style.margin=`${HF}px 0`,s.style.minHeight=S+`px`,s.style.maxHeight=c+`px`,r?.(),requestAnimationFrame(()=>p.current=!0)}},[f,a.trigger,a.valueNode,s,l,h,g,_,a.dir,r]);q_(()=>y(),[y]);let[b,x]=j.useState();return q_(()=>{l&&x(window.getComputedStyle(l).zIndex)},[l]),(0,M.jsx)(QF,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:p,onScrollButtonChange:j.useCallback(e=>{e&&m.current===!0&&(y(),v?.(),m.current=!1)},[y,v]),children:(0,M.jsx)(`div`,{ref:c,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:b},children:(0,M.jsx)(O_.div,{...i,ref:d,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})});YF.displayName=JF;var XF=`SelectPopperPosition`,ZF=j.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=HF,...a}=e,o=EF(n);return(0,M.jsx)(PD,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.style,"--radix-select-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-select-content-available-width":`var(--radix-popper-available-width)`,"--radix-select-content-available-height":`var(--radix-popper-available-height)`,"--radix-select-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-select-trigger-height":`var(--radix-popper-anchor-height)`}})});ZF.displayName=XF;var[QF,$F]=wF(BF,{}),eI=`SelectViewport`,tI=j.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...i}=e,a=WF(eI,n),o=$F(eI,n),s=g_(t,a.onViewportChange),c=j.useRef(0);return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`},nonce:r}),(0,M.jsx)(xF.Slot,{scope:n,children:(0,M.jsx)(O_.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:s,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:J(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=o;if(r?.current&&n){let e=Math.abs(c.current-t.scrollTop);if(e>0){let r=window.innerHeight-HF*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}c.current=t.scrollTop})})})]})});tI.displayName=eI;var nI=`SelectGroup`,[rI,iI]=wF(nI),aI=j.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=_S();return(0,M.jsx)(rI,{scope:n,id:i,children:(0,M.jsx)(O_.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})});aI.displayName=nI;var oI=`SelectLabel`,sI=j.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=iI(oI,n);return(0,M.jsx)(O_.div,{id:i.id,...r,ref:t})});sI.displayName=oI;var cI=`SelectItem`,[lI,uI]=wF(cI),dI=j.forwardRef((e,t)=>{let{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...o}=e,s=OF(cI,n),c=WF(cI,n),l=s.value===r,[u,d]=j.useState(a??``),[f,p]=j.useState(!1),m=g_(t,e=>c.itemRefCallback?.(e,r,i)),h=_S(),g=j.useRef(`touch`),_=()=>{i||(s.onValueChange(r),s.onOpenChange(!1))};if(r===``)throw Error(`A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.`);return(0,M.jsx)(lI,{scope:n,value:r,disabled:i,textId:h,isSelected:l,onItemTextChange:j.useCallback(e=>{d(t=>t||(e?.textContent??``).trim())},[]),children:(0,M.jsx)(xF.ItemSlot,{scope:n,value:r,disabled:i,textValue:u,children:(0,M.jsx)(O_.div,{role:`option`,"aria-labelledby":h,"data-highlighted":f?``:void 0,"aria-selected":l&&f,"data-state":l?`checked`:`unchecked`,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,tabIndex:i?void 0:-1,...o,ref:m,onFocus:J(o.onFocus,()=>p(!0)),onBlur:J(o.onBlur,()=>p(!1)),onClick:J(o.onClick,()=>{g.current!==`mouse`&&_()}),onPointerUp:J(o.onPointerUp,()=>{g.current===`mouse`&&_()}),onPointerDown:J(o.onPointerDown,e=>{g.current=e.pointerType}),onPointerMove:J(o.onPointerMove,e=>{g.current=e.pointerType,i?c.onItemLeave?.():g.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:J(o.onPointerLeave,e=>{e.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:J(o.onKeyDown,e=>{c.searchRef?.current!==``&&e.key===` `||(yF.includes(e.key)&&_(),e.key===` `&&e.preventDefault())})})})})});dI.displayName=cI;var fI=`SelectItemText`,pI=j.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,...a}=e,o=OF(fI,n),s=WF(fI,n),c=uI(fI,n),l=AF(fI,n),[u,d]=j.useState(null),f=g_(t,e=>d(e),c.onItemTextChange,e=>s.itemTextRefCallback?.(e,c.value,c.disabled)),p=u?.textContent,m=j.useMemo(()=>(0,M.jsx)(`option`,{value:c.value,disabled:c.disabled,children:p},c.value),[c.disabled,c.value,p]),{onNativeOptionAdd:h,onNativeOptionRemove:g}=l;return q_(()=>(h(m),()=>g(m)),[h,g,m]),(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(O_.span,{id:c.textId,...a,ref:f}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren?Gi.createPortal(a.children,o.valueNode):null]})});pI.displayName=fI;var mI=`SelectItemIndicator`,hI=j.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return uI(mI,n).isSelected?(0,M.jsx)(O_.span,{"aria-hidden":!0,...r,ref:t}):null});hI.displayName=mI;var gI=`SelectScrollUpButton`,_I=j.forwardRef((e,t)=>{let n=WF(gI,e.__scopeSelect),r=$F(gI,e.__scopeSelect),[i,a]=j.useState(!1),o=g_(t,r.onScrollButtonChange);return q_(()=>{if(n.viewport&&n.isPositioned){let e=function(){a(t.scrollTop>0)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,M.jsx)(bI,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});_I.displayName=gI;var vI=`SelectScrollDownButton`,yI=j.forwardRef((e,t)=>{let n=WF(vI,e.__scopeSelect),r=$F(vI,e.__scopeSelect),[i,a]=j.useState(!1),o=g_(t,r.onScrollButtonChange);return q_(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight;a(Math.ceil(t.scrollTop)<e)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,M.jsx)(bI,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});yI.displayName=vI;var bI=j.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=WF(`SelectScrollButton`,n),o=j.useRef(null),s=SF(n),c=j.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return j.useEffect(()=>()=>c(),[c]),q_(()=>{s().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[s]),(0,M.jsx)(O_.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:J(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:J(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:J(i.onPointerLeave,()=>{c()})})}),xI=`SelectSeparator`,SI=j.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,M.jsx)(O_.div,{"aria-hidden":!0,...r,ref:t})});SI.displayName=xI;var CI=`SelectArrow`,wI=j.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=EF(n),a=OF(CI,n),o=WF(CI,n);return a.open&&o.position===`popper`?(0,M.jsx)(FD,{...i,...r,ref:t}):null});wI.displayName=CI;var TI=`SelectBubbleInput`,EI=j.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{let i=j.useRef(null),a=g_(r,i),o=_F(t);return j.useEffect(()=>{let e=i.current;if(!e)return;let n=window.HTMLSelectElement.prototype,r=Object.getOwnPropertyDescriptor(n,`value`).set;if(o!==t&&r){let n=new Event(`change`,{bubbles:!0});r.call(e,t),e.dispatchEvent(n)}},[o,t]),(0,M.jsx)(O_.select,{...n,style:{...av,...n.style},ref:a,defaultValue:t})});EI.displayName=TI;function DI(e){return e===``||e===void 0}function OI(e){let t=A_(e),n=j.useRef(``),r=j.useRef(0),i=j.useCallback(e=>{let i=n.current+e;t(i),(function e(t){n.current=t,window.clearTimeout(r.current),t!==``&&(r.current=window.setTimeout(()=>e(``),1e3))})(i)},[t]),a=j.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return j.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function kI(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=AI(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function AI(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var jI=jF,MI=NF,NI=FF,PI=LF,FI=zF,II=VF,LI=tI,RI=sI,zI=dI,BI=pI,VI=hI,HI=_I,UI=yI,WI=SI,GI=jI,KI=NI,qI=j.forwardRef(({className:e,children:t,...n},r)=>(0,M.jsxs)(MI,{ref:r,className:Z(`flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1`,e),...n,children:[t,(0,M.jsx)(PI,{asChild:!0,children:(0,M.jsx)(Sy,{className:`h-4 w-4 opacity-50`})})]}));qI.displayName=MI.displayName;var JI=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(HI,{ref:n,className:Z(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,M.jsx)(wy,{className:`h-4 w-4`})}));JI.displayName=HI.displayName;var YI=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(UI,{ref:n,className:Z(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,M.jsx)(Sy,{className:`h-4 w-4`})}));YI.displayName=UI.displayName;var XI=j.forwardRef(({className:e,children:t,position:n=`popper`,...r},i)=>(0,M.jsx)(FI,{children:(0,M.jsxs)(II,{ref:i,className:Z(`relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,n===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,e),position:n,...r,children:[(0,M.jsx)(JI,{}),(0,M.jsx)(LI,{className:Z(`p-1`,n===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]`),children:t}),(0,M.jsx)(YI,{})]})}));XI.displayName=II.displayName;var ZI=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(RI,{ref:n,className:Z(`px-2 py-1.5 text-sm font-semibold`,e),...t}));ZI.displayName=RI.displayName;var QI=j.forwardRef(({className:e,children:t,...n},r)=>(0,M.jsxs)(zI,{ref:r,className:Z(`relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,e),...n,children:[(0,M.jsx)(`span`,{className:`absolute right-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,M.jsx)(VI,{children:(0,M.jsx)(xy,{className:`h-4 w-4`})})}),(0,M.jsx)(BI,{children:t})]}));QI.displayName=zI.displayName;var $I=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(WI,{ref:n,className:Z(`-mx-1 my-1 h-px bg-muted`,e),...t}));$I.displayName=WI.displayName;var eL=la(`/organizations/$orgId/teams`)({component:tL});function tL(){let{t:e}=vt(),{orgId:t}=eL.useParams(),n=n_(),{members:r}=oF(t),[i,a]=(0,j.useState)([]),[o,s]=(0,j.useState)(!0),[c,l]=(0,j.useState)(!1),[u,d]=(0,j.useState)(``),[f,p]=(0,j.useState)(!1),[m,h]=(0,j.useState)(null),[g,_]=(0,j.useState)([]),[v,y]=(0,j.useState)(!1),[b,x]=(0,j.useState)(!1),[S,C]=(0,j.useState)(``),w=(0,j.useCallback)(async()=>{if(n?.organizations?.teams){s(!0);try{a((await n.organizations.teams.list(t))?.teams??[])}catch{a([])}finally{s(!1)}}},[n,t]);(0,j.useEffect)(()=>{w()},[w]);let T=(0,j.useCallback)(async e=>{if(n?.organizations?.teams){y(!0);try{_((await n.organizations.teams.listMembers(e))?.members??[])}catch{_([])}finally{y(!1)}}},[n]);(0,j.useEffect)(()=>{m&&T(m)},[m,T]);let E=async r=>{if(r.preventDefault(),u.trim()){p(!0);try{await n.organizations.teams.create({name:u.trim(),organizationId:t}),q({title:e(`teams.created`)}),l(!1),d(``),await w()}catch(t){q({title:e(`teams.createFailed`),description:t.message,variant:`destructive`})}finally{p(!1)}}},D=async r=>{if(confirm(e(`teams.deleteConfirm`,{name:r.name})))try{await n.organizations.teams.delete({teamId:r.id,organizationId:t}),q({title:e(`teams.deleted`)}),m===r.id&&h(null),await w()}catch(t){q({title:e(`teams.deleteFailed`),description:t.message,variant:`destructive`})}},O=async()=>{if(!(!m||!S))try{await n.organizations.teams.addMember({teamId:m,userId:S}),q({title:e(`teams.memberAdded`)}),x(!1),C(``),await T(m)}catch(t){q({title:e(`teams.addMemberFailed`),description:t.message,variant:`destructive`})}},ee=async(t,r)=>{try{await n.organizations.teams.removeMember({teamId:t,userId:r}),q({title:e(`teams.memberRemoved`)}),await T(t)}catch(t){q({title:e(`teams.removeMemberFailed`),description:t.message,variant:`destructive`})}},te=Object.fromEntries(r.map(e=>[e.userId,e])),ne=new Set(g.map(e=>e.userId)),re=r.filter(e=>!ne.has(e.userId));return(0,M.jsxs)(`div`,{className:`space-y-6`,children:[(0,M.jsxs)($,{children:[(0,M.jsx)(DN,{children:(0,M.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(ON,{className:`text-base`,children:e(`teams.title`,{count:i.length})}),(0,M.jsx)(kN,{children:e(`teams.description`)})]}),(0,M.jsxs)(Q,{size:`sm`,onClick:()=>l(!0),children:[(0,M.jsx)(qy,{className:`mr-2 h-4 w-4`}),e(`teams.create`)]})]})}),(0,M.jsxs)(AN,{children:[o&&(0,M.jsxs)(`div`,{className:`space-y-3`,children:[(0,M.jsx)(Zw,{className:`h-12 w-full`}),(0,M.jsx)(Zw,{className:`h-12 w-full`})]}),!o&&i.length===0&&(0,M.jsxs)(`div`,{className:`text-center py-8`,children:[(0,M.jsx)(cb,{className:`mx-auto h-12 w-12 text-muted-foreground/50`}),(0,M.jsx)(`p`,{className:`mt-4 text-sm text-muted-foreground`,children:e(`teams.empty`)})]}),!o&&i.length>0&&(0,M.jsx)(`div`,{className:`divide-y`,children:i.map(t=>(0,M.jsxs)(`div`,{children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between py-3`,children:[(0,M.jsxs)(`button`,{type:`button`,className:`flex-1 text-left`,onClick:()=>h(m===t.id?null:t.id),children:[(0,M.jsx)(`div`,{className:`font-medium text-sm`,children:t.name}),t.createdAt&&(0,M.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:new Date(t.createdAt).toLocaleDateString()})]}),(0,M.jsxs)(sM,{children:[(0,M.jsx)(cM,{asChild:!0,children:(0,M.jsx)(Q,{variant:`ghost`,size:`sm`,className:`h-8 w-8 p-0`,children:(0,M.jsx)(My,{className:`h-4 w-4`})})}),(0,M.jsx)(dM,{align:`end`,children:(0,M.jsxs)(fM,{className:`text-destructive`,onClick:()=>D(t),children:[(0,M.jsx)(nb,{className:`mr-2 h-4 w-4`}),e(`teams.delete`)]})})]})]}),m===t.id&&(0,M.jsxs)(`div`,{className:`pb-3 pl-4 border-l-2 ml-2 space-y-2`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,M.jsx)(`p`,{className:`text-xs font-medium text-muted-foreground`,children:e(`teams.members`,{count:g.length})}),(0,M.jsxs)(Q,{size:`sm`,variant:`outline`,onClick:()=>x(!0),children:[(0,M.jsx)(ob,{className:`mr-1 h-3 w-3`}),e(`teams.addMember`)]})]}),v&&(0,M.jsx)(Zw,{className:`h-8 w-full`}),!v&&g.length===0&&(0,M.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`teams.noMembers`)}),!v&&g.map(e=>{let n=te[e.userId];return(0,M.jsxs)(`div`,{className:`flex items-center justify-between py-1`,children:[(0,M.jsx)(`span`,{className:`text-sm`,children:n?.user?.name||n?.user?.email||e.userId}),(0,M.jsx)(Q,{variant:`ghost`,size:`sm`,className:`h-7 w-7 p-0`,onClick:()=>ee(t.id,e.userId),children:(0,M.jsx)(ab,{className:`h-3 w-3`})})]},e.id)})]})]},t.id))})]})]}),(0,M.jsx)(GP,{open:c,onOpenChange:l,children:(0,M.jsxs)(JP,{children:[(0,M.jsxs)(YP,{children:[(0,M.jsx)(ZP,{children:e(`teams.createTitle`)}),(0,M.jsx)(QP,{children:e(`teams.createDescription`)})]}),(0,M.jsxs)(`form`,{onSubmit:E,children:[(0,M.jsx)(`div`,{className:`space-y-4 py-4`,children:(0,M.jsxs)(`div`,{className:`space-y-2`,children:[(0,M.jsx)(UN,{htmlFor:`team-name`,children:e(`teams.nameLabel`)}),(0,M.jsx)(oS,{id:`team-name`,required:!0,placeholder:e(`teams.namePlaceholder`),value:u,onChange:e=>d(e.target.value)})]})}),(0,M.jsxs)(XP,{children:[(0,M.jsx)(Q,{variant:`outline`,type:`button`,onClick:()=>l(!1),children:e(`common.cancel`)}),(0,M.jsx)(Q,{type:`submit`,disabled:f,children:e(f?`common.saving`:`teams.create`)})]})]})]})}),(0,M.jsx)(GP,{open:b,onOpenChange:x,children:(0,M.jsxs)(JP,{children:[(0,M.jsxs)(YP,{children:[(0,M.jsx)(ZP,{children:e(`teams.addMemberTitle`)}),(0,M.jsx)(QP,{children:e(`teams.addMemberDescription`)})]}),(0,M.jsx)(`div`,{className:`space-y-4 py-4`,children:(0,M.jsxs)(`div`,{className:`space-y-2`,children:[(0,M.jsx)(UN,{children:e(`teams.selectMember`)}),(0,M.jsxs)(GI,{value:S,onValueChange:C,children:[(0,M.jsx)(qI,{children:(0,M.jsx)(KI,{placeholder:e(`teams.selectMemberPlaceholder`)})}),(0,M.jsx)(XI,{children:re.map(e=>(0,M.jsx)(QI,{value:e.userId,children:e.user?.name||e.user?.email||e.userId},e.userId))})]})]})}),(0,M.jsxs)(XP,{children:[(0,M.jsx)(Q,{variant:`outline`,onClick:()=>x(!1),children:e(`common.cancel`)}),(0,M.jsx)(Q,{onClick:O,disabled:!S,children:e(`teams.addMember`)})]})]})})]})}var nL=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`textarea`,{className:Z(`flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50`,e),ref:n,...t}));nL.displayName=`Textarea`;var rL=la(`/organizations/$orgId/members`)({component:iL});function iL(){let{t:e}=vt(),{orgId:t}=rL.useParams(),{organizations:n}=aN(),{user:r}=iN(),i=n_(),a=n.find(e=>e.id===t),{members:o,loading:s,inviteMember:c,removeMember:l,updateMemberRole:u}=oF(t),{invitations:d,loading:f,cancelInvitation:p,resendInvitation:m}=sF(t),[h,g]=(0,j.useState)(!1),[_,v]=(0,j.useState)(!1),[y,b]=(0,j.useState)(``),[x,S]=(0,j.useState)(``),[C,w]=(0,j.useState)(`member`),[T,E]=(0,j.useState)(!1),[D,O]=(0,j.useState)(!1),ee=d.filter(e=>e.status===`pending`),te=o.find(e=>e.userId===r?.id),ne=te?.role===`owner`||te?.role===`admin`,re=async()=>{let t=_?x.split(/[,;\n]+/).map(e=>e.trim()).filter(Boolean):[y.trim()].filter(Boolean);if(t.length===0){q({title:e(`organizations.members.emailRequired`),variant:`destructive`});return}E(!0);let n=0;try{for(let e of t)try{await c(e,C)}catch{n++}n>0&&n<t.length?q({title:e(`organizations.members.invitePartialSuccess`,{sent:t.length-n,failed:n}),variant:`destructive`}):n===t.length?q({title:e(`organizations.members.inviteFailed`),variant:`destructive`}):q({title:e(`organizations.members.invitationSent`)}),g(!1),b(``),S(``),w(`member`)}finally{E(!1)}},ie=async(t,n)=>{if(confirm(e(`organizations.members.removeConfirm`,{name:n})))try{await l(t),q({title:e(`organizations.members.memberRemoved`)})}catch(t){q({title:e(`organizations.members.removeFailed`),description:t.message,variant:`destructive`})}},ae=async(t,n)=>{try{await u(t,n),q({title:e(`organizations.members.roleUpdated`)})}catch(t){q({title:e(`organizations.members.roleUpdateFailed`),description:t.message,variant:`destructive`})}},oe=async()=>{if(confirm(e(`organizations.members.leaveConfirm`,{org:a?.name??t}))){O(!0);try{await i.organizations.leave(t),q({title:e(`organizations.members.leftOrg`)}),window.location.assign(`/`)}catch(t){q({title:e(`organizations.members.leaveFailed`),description:t.message,variant:`destructive`})}finally{O(!1)}}},k=async(t,n)=>{if(confirm(e(`organizations.members.cancelConfirm`,{email:n})))try{await p(t),q({title:e(`organizations.members.invitationCanceled`)})}catch(t){q({title:e(`organizations.members.cancelFailed`),description:t.message,variant:`destructive`})}},se=async t=>{try{await m(t),q({title:e(`organizations.members.invitationResent`)})}catch(t){q({title:e(`organizations.members.resendFailed`),description:t.message,variant:`destructive`})}},ce=async t=>{let n=`${window.location.origin}/accept-invitation/${t}`;try{await navigator.clipboard.writeText(n),q({title:e(`organizations.members.linkCopied`)})}catch{q({title:e(`organizations.members.linkCopyFailed`),variant:`destructive`})}};return(0,M.jsxs)(`div`,{className:`space-y-6`,children:[(0,M.jsxs)($,{children:[(0,M.jsx)(DN,{children:(0,M.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(ON,{className:`text-base`,children:e(`organizations.members.title`,{count:o.length})}),(0,M.jsx)(kN,{children:e(`organizations.members.description`)})]}),(0,M.jsxs)(`div`,{className:`flex gap-2`,children:[te&&te.role!==`owner`&&(0,M.jsxs)(Q,{size:`sm`,variant:`outline`,onClick:oe,disabled:D,children:[(0,M.jsx)(Vy,{className:`mr-2 h-4 w-4`}),e(`organizations.members.leave`)]}),ne&&(0,M.jsxs)(Q,{size:`sm`,onClick:()=>g(!0),children:[(0,M.jsx)(ob,{className:`mr-2 h-4 w-4`}),e(`organizations.members.invite`)]})]})]})}),(0,M.jsxs)(AN,{children:[s&&(0,M.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`organizations.members.loadingMembers`)}),!s&&o.length===0&&(0,M.jsxs)(`div`,{className:`text-center py-8`,children:[(0,M.jsx)(lb,{className:`mx-auto h-12 w-12 text-muted-foreground/50`}),(0,M.jsx)(`p`,{className:`mt-4 text-sm text-muted-foreground`,children:e(`organizations.members.empty`)})]}),!s&&o.length>0&&(0,M.jsx)(`div`,{className:`divide-y`,children:o.map(t=>(0,M.jsxs)(`div`,{className:`flex items-center justify-between py-3`,children:[(0,M.jsxs)(`div`,{className:`flex-1`,children:[(0,M.jsxs)(`div`,{className:`font-medium text-sm`,children:[t.user?.name||t.user?.email||t.userId,t.userId===r?.id&&(0,M.jsx)(pP,{variant:`secondary`,className:`ml-2 text-xs`,children:e(`organizations.members.you`)})]}),t.user?.email&&(0,M.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:t.user.email})]}),(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[ne&&t.role!==`owner`&&t.userId!==r?.id?(0,M.jsxs)(GI,{value:t.role,onValueChange:e=>ae(t.id,e),children:[(0,M.jsx)(qI,{className:`h-7 w-24 text-xs`,children:(0,M.jsx)(KI,{})}),(0,M.jsxs)(XI,{children:[(0,M.jsx)(QI,{value:`admin`,children:e(`common.roles.admin`)}),(0,M.jsx)(QI,{value:`member`,children:e(`common.roles.member`)})]})]}):(0,M.jsx)(pP,{variant:`secondary`,className:`text-xs`,children:e(`common.roles.${t.role??`member`}`)}),ne&&t.role!==`owner`&&t.userId!==r?.id&&(0,M.jsxs)(sM,{children:[(0,M.jsx)(cM,{asChild:!0,children:(0,M.jsx)(Q,{variant:`ghost`,size:`sm`,className:`h-8 w-8 p-0`,children:(0,M.jsx)(My,{className:`h-4 w-4`})})}),(0,M.jsx)(dM,{align:`end`,children:(0,M.jsxs)(fM,{className:`text-destructive`,onClick:()=>ie(t.id,t.user?.name||t.user?.email||t.userId),children:[(0,M.jsx)(nb,{className:`mr-2 h-4 w-4`}),e(`organizations.members.removeMember`)]})})]})]})]},t.id))})]})]}),(0,M.jsxs)($,{children:[(0,M.jsx)(DN,{children:(0,M.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(ON,{className:`text-base`,children:e(`organizations.members.pendingTitle`,{count:ee.length})}),(0,M.jsx)(kN,{children:e(`organizations.members.pendingDescription`)})]}),ne&&(0,M.jsxs)(Q,{size:`sm`,variant:`outline`,onClick:()=>g(!0),children:[(0,M.jsx)(ob,{className:`mr-2 h-4 w-4`}),e(`organizations.members.sendInvitation`)]})]})}),(0,M.jsxs)(AN,{children:[f&&(0,M.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`organizations.members.loadingInvitations`)}),!f&&ee.length===0&&(0,M.jsxs)(`div`,{className:`text-center py-8`,children:[(0,M.jsx)(Uy,{className:`mx-auto h-12 w-12 text-muted-foreground/50`}),(0,M.jsx)(`p`,{className:`mt-4 text-sm text-muted-foreground`,children:e(`organizations.members.noPending`)})]}),!f&&ee.length>0&&(0,M.jsx)(`div`,{className:`divide-y`,children:ee.map(t=>(0,M.jsxs)(`div`,{className:`flex items-center justify-between py-3`,children:[(0,M.jsxs)(`div`,{className:`flex-1`,children:[(0,M.jsx)(`div`,{className:`font-medium text-sm`,children:t.email}),(0,M.jsxs)(`div`,{className:`flex items-center gap-2 mt-1`,children:[(0,M.jsx)(pP,{variant:`outline`,className:`text-xs`,children:e(`common.roles.${t.role}`)}),(0,M.jsxs)(`span`,{className:`text-xs text-muted-foreground flex items-center gap-1`,children:[(0,M.jsx)(Ay,{className:`h-3 w-3`}),e(`organizations.members.expires`,{date:new Date(t.expiresAt).toLocaleDateString()})]})]})]}),(0,M.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,M.jsx)(Q,{variant:`ghost`,size:`sm`,className:`h-8 w-8 p-0`,title:e(`organizations.members.copyLink`),onClick:()=>ce(t.id),children:(0,M.jsx)(jy,{className:`h-4 w-4`})}),(0,M.jsx)(Q,{variant:`ghost`,size:`sm`,className:`h-8 w-8 p-0`,title:e(`organizations.members.resend`),onClick:()=>se(t),children:(0,M.jsx)(Jy,{className:`h-4 w-4`})}),(0,M.jsx)(Q,{variant:`ghost`,size:`sm`,className:`h-8 w-8 p-0`,title:e(`organizations.members.cancel`),onClick:()=>k(t.id,t.email),children:(0,M.jsx)(ub,{className:`h-4 w-4`})})]})]},t.id))})]})]}),(0,M.jsx)(GP,{open:h,onOpenChange:g,children:(0,M.jsxs)(JP,{children:[(0,M.jsxs)(YP,{children:[(0,M.jsx)(ZP,{children:e(`organizations.members.inviteDialogTitle`)}),(0,M.jsx)(QP,{children:e(`organizations.members.inviteDialogDescription`,{organization:a?.name??``})})]}),(0,M.jsxs)(`div`,{className:`space-y-4 py-4`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(Q,{type:`button`,variant:_?`outline`:`default`,size:`sm`,onClick:()=>v(!1),children:e(`organizations.members.singleInvite`)}),(0,M.jsx)(Q,{type:`button`,variant:_?`default`:`outline`,size:`sm`,onClick:()=>v(!0),children:e(`organizations.members.bulkInvite`)})]}),_?(0,M.jsxs)(`div`,{className:`space-y-2`,children:[(0,M.jsx)(UN,{children:e(`organizations.members.bulkEmails`)}),(0,M.jsx)(nL,{placeholder:e(`organizations.members.bulkEmailsPlaceholder`),rows:5,value:x,onChange:e=>S(e.target.value)}),(0,M.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`organizations.members.bulkEmailsHint`)})]}):(0,M.jsxs)(`div`,{className:`space-y-2`,children:[(0,M.jsx)(UN,{htmlFor:`invite-email`,children:e(`organizations.members.email`)}),(0,M.jsx)(oS,{id:`invite-email`,type:`email`,placeholder:e(`organizations.members.emailPlaceholder`),value:y,onChange:e=>b(e.target.value)})]}),(0,M.jsxs)(`div`,{className:`space-y-2`,children:[(0,M.jsx)(UN,{htmlFor:`role`,children:e(`organizations.members.role`)}),(0,M.jsxs)(GI,{value:C,onValueChange:w,children:[(0,M.jsx)(qI,{id:`role`,children:(0,M.jsx)(KI,{})}),(0,M.jsxs)(XI,{children:[(0,M.jsx)(QI,{value:`owner`,children:e(`common.roles.owner`)}),(0,M.jsx)(QI,{value:`admin`,children:e(`common.roles.admin`)}),(0,M.jsx)(QI,{value:`member`,children:e(`common.roles.member`)})]})]})]})]}),(0,M.jsxs)(XP,{children:[(0,M.jsx)(Q,{variant:`outline`,onClick:()=>g(!1),disabled:T,children:e(`common.cancel`)}),(0,M.jsx)(Q,{onClick:re,disabled:T,children:e(T?`organizations.members.sending`:`organizations.members.sendInvitation`)})]})]})})]})}var aL=la(`/organizations/$orgId/general`)({component:oL});function oL(){let{t:e}=vt(),{orgId:t}=aL.useParams(),n=Hi(),{organizations:r}=aN(),{session:i,user:a,setActiveOrganization:o}=iN(),s=r.find(e=>e.id===t),{members:c}=oF(t),{invitations:l}=sF(t),{remove:u,deleting:d}=cN(),{update:f,updating:p}=sN(),[m,h]=(0,j.useState)(``),[g,_]=(0,j.useState)(``),[v,y]=(0,j.useState)(``),[b,x]=(0,j.useState)(!1),[S,C]=(0,j.useState)(``);(0,j.useEffect)(()=>{h(s?.name??``),_(s?.slug??``),y(s?.logo??``)},[s?.id,s?.name,s?.slug,s?.logo]);let w=i?.activeOrganizationId===t,T=l.filter(e=>e.status===`pending`),E=(a?c.find(e=>e.userId===a.id):void 0)?.role??null,D=E===`owner`||E===`admin`,O=D&&s!=null&&(m.trim()!==(s.name??``)||g.trim()!==(s.slug??``)||v.trim()!==(s.logo??``));return(0,M.jsxs)(`div`,{className:`space-y-6`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[w&&(0,M.jsx)(pP,{variant:`outline`,children:e(`organizations.active`)}),E&&(0,M.jsx)(pP,{variant:`secondary`,className:`capitalize`,children:e(`common.roles.${E}`)})]}),!w&&(0,M.jsx)(Q,{size:`sm`,variant:`outline`,onClick:async()=>{try{await o(t),q({title:e(`organizations.general.switched`)})}catch(t){q({title:e(`organizations.general.switchFailed`),description:t.message,variant:`destructive`})}},children:e(`organizations.general.setActive`)})]}),(0,M.jsxs)($,{children:[(0,M.jsxs)(DN,{children:[(0,M.jsx)(ON,{children:e(`organizations.general.detailsTitle`)}),(0,M.jsx)(kN,{children:e(D?`organizations.general.detailsDescription`:`organizations.general.detailsReadOnly`)})]}),(0,M.jsxs)(AN,{className:`space-y-4`,children:[(0,M.jsxs)(`div`,{className:`space-y-2`,children:[(0,M.jsx)(UN,{htmlFor:`org-name`,children:e(`organizations.new.name`)}),(0,M.jsx)(oS,{id:`org-name`,value:m,onChange:e=>h(e.target.value),disabled:!D||p,placeholder:e(`organizations.general.namePlaceholder`)})]}),(0,M.jsxs)(`div`,{className:`space-y-2`,children:[(0,M.jsx)(UN,{htmlFor:`org-slug`,children:e(`organizations.new.slug`)}),(0,M.jsx)(oS,{id:`org-slug`,value:g,onChange:e=>_(e.target.value),disabled:!D||p,placeholder:e(`organizations.general.slugPlaceholder`),className:`font-mono text-sm`}),(0,M.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`organizations.general.slugHint`)})]}),(0,M.jsxs)(`div`,{className:`space-y-2`,children:[(0,M.jsx)(UN,{htmlFor:`org-logo`,children:e(`organizations.general.logo`)}),(0,M.jsx)(oS,{id:`org-logo`,value:v,onChange:e=>y(e.target.value),disabled:!D||p,placeholder:e(`organizations.general.logoPlaceholder`)})]}),(0,M.jsxs)(`div`,{className:`flex justify-between border-t pt-4 text-xs`,children:[(0,M.jsx)(`span`,{className:`text-muted-foreground`,children:e(`organizations.general.organizationId`)}),(0,M.jsx)(`code`,{className:`font-mono`,children:t})]})]}),D&&(0,M.jsxs)(AN,{className:`flex justify-end gap-2 border-t pt-4`,children:[(0,M.jsx)(Q,{variant:`ghost`,size:`sm`,onClick:()=>{h(s?.name??``),_(s?.slug??``),y(s?.logo??``)},disabled:!O||p,children:e(`organizations.general.reset`)}),(0,M.jsxs)(Q,{size:`sm`,onClick:async()=>{if(!s||!D||!O)return;let n=m.trim();if(!n){q({title:e(`organizations.general.nameRequired`),variant:`destructive`});return}try{await f(t,{name:n,slug:g.trim()||void 0,logo:v.trim()||void 0}),q({title:e(`organizations.general.updated`)})}catch(t){q({title:e(`organizations.general.updateFailed`),description:t.message,variant:`destructive`})}},disabled:!O||p,children:[(0,M.jsx)(Yy,{className:`mr-2 h-4 w-4`}),e(p?`common.saving`:`organizations.general.save`)]})]})]}),(0,M.jsxs)($,{children:[(0,M.jsx)(DN,{children:(0,M.jsx)(ON,{className:`text-base`,children:e(`organizations.general.overviewTitle`)})}),(0,M.jsxs)(AN,{className:`space-y-3 text-sm`,children:[(0,M.jsxs)(`div`,{className:`flex justify-between`,children:[(0,M.jsx)(`span`,{className:`text-muted-foreground`,children:e(`organizations.general.members`)}),(0,M.jsx)(`span`,{children:c.length})]}),(0,M.jsxs)(`div`,{className:`flex justify-between`,children:[(0,M.jsx)(`span`,{className:`text-muted-foreground`,children:e(`organizations.general.pendingInvitations`)}),(0,M.jsx)(`span`,{children:T.length})]})]})]}),D&&(0,M.jsxs)($,{className:`border-destructive/40`,children:[(0,M.jsxs)(DN,{children:[(0,M.jsx)(ON,{className:`text-base text-destructive`,children:e(`organizations.general.dangerTitle`)}),(0,M.jsx)(kN,{children:e(`organizations.general.dangerDescription`)})]}),(0,M.jsx)(AN,{children:(0,M.jsxs)(Q,{variant:`destructive`,size:`sm`,onClick:()=>x(!0),disabled:d,children:[(0,M.jsx)(nb,{className:`mr-2 h-4 w-4`}),e(`organizations.general.delete`)]})})]}),(0,M.jsx)(GP,{open:b,onOpenChange:e=>{x(e),e||C(``)},children:(0,M.jsxs)(JP,{children:[(0,M.jsxs)(YP,{children:[(0,M.jsx)(ZP,{className:`text-destructive`,children:e(`organizations.general.deleteDialogTitle`)}),(0,M.jsx)(QP,{children:e(`organizations.general.deleteDialogDescription`,{name:s?.name??``})})]}),(0,M.jsx)(`div`,{className:`space-y-4 py-2`,children:(0,M.jsxs)(`div`,{className:`space-y-2`,children:[(0,M.jsx)(UN,{htmlFor:`delete-confirm`,children:e(`organizations.general.deleteDialogLabel`,{name:s?.name??``})}),(0,M.jsx)(oS,{id:`delete-confirm`,value:S,onChange:e=>C(e.target.value),placeholder:s?.name??``,disabled:d})]})}),(0,M.jsxs)(XP,{children:[(0,M.jsx)(Q,{variant:`outline`,onClick:()=>x(!1),disabled:d,children:e(`common.cancel`)}),(0,M.jsx)(Q,{variant:`destructive`,onClick:async()=>{if(s){if(S!==s.name){q({title:e(`organizations.general.confirmationMismatch`),description:e(`organizations.general.confirmationHint`,{name:s.name}),variant:`destructive`});return}try{let r=await u(t),i=r?.warnings,a=r?.deletedProjects??0;q({title:e(`organizations.general.deleted`),description:i?.length?e(`organizations.general.deletedWithWarnings`,{deletedProjects:a,warning:i[0],extraCount:Math.max(i.length-1,0)}):e(`organizations.general.deletedDescription`,{name:s.name,deletedProjects:a}),variant:i?.length?`destructive`:void 0}),x(!1),C(``),n({to:`/organizations`})}catch(t){q({title:e(`organizations.general.deleteFailed`),description:t.message,variant:`destructive`})}}},disabled:d||!s||S!==s.name,children:e(d?`organizations.general.deleting`:`organizations.general.delete`)})]})]})})]})}var sL=la(`/account/oauth-applications/new`)({component:cL});function cL(){let{t:e}=vt(),t=Hi(),{register:n,registering:r}=OP(),[i,a]=(0,j.useState)(``),[o,s]=(0,j.useState)(``),[c,l]=(0,j.useState)(`client_secret_basic`),[u,d]=(0,j.useState)(``),[f,p]=(0,j.useState)(``),[m,h]=(0,j.useState)(null),g=async()=>{let t=i.trim(),r=o.split(/\r?\n|,/).map(e=>e.trim()).filter(Boolean);if(!t){q({title:e(`oauth.applications.form.nameRequired`),variant:`destructive`});return}if(r.length===0){q({title:e(`oauth.applications.form.redirectRequired`),variant:`destructive`});return}try{let i=await n({client_name:t,redirect_uris:r,token_endpoint_auth_method:c,...u.trim()?{client_uri:u.trim()}:{},...f.trim()?{logo_uri:f.trim()}:{}});h({client_id:i?.client_id??``,client_secret:i?.client_secret}),q({title:e(`oauth.applications.registered`)})}catch(t){q({title:e(`oauth.applications.registerFailed`),description:t.message,variant:`destructive`})}},_=(t,n)=>{navigator.clipboard.writeText(t).then(()=>q({title:e(`oauth.applications.copied`,{label:n})}),()=>q({title:e(`oauth.applications.copyFailed`,{label:n}),variant:`destructive`}))};return m?(0,M.jsxs)(`div`,{className:`space-y-6`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`h1`,{className:`text-2xl font-semibold`,children:e(`oauth.applications.registeredTitle`)}),(0,M.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`oauth.applications.registeredDescription`)})]}),(0,M.jsxs)($,{children:[(0,M.jsxs)(DN,{children:[(0,M.jsx)(ON,{children:e(`oauth.applications.credentials`)}),(0,M.jsx)(kN,{children:e(`oauth.applications.credentialsDescription`)})]}),(0,M.jsxs)(AN,{className:`space-y-4`,children:[(0,M.jsxs)(`div`,{className:`space-y-1`,children:[(0,M.jsx)(UN,{children:e(`oauth.applications.clientId`)}),(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(`code`,{className:`flex-1 rounded-md border bg-muted px-3 py-2 font-mono text-xs`,children:m.client_id}),(0,M.jsx)(Q,{size:`icon`,variant:`outline`,onClick:()=>_(m.client_id,e(`oauth.applications.clientId`)),children:(0,M.jsx)(jy,{className:`h-4 w-4`})})]})]}),m.client_secret&&(0,M.jsxs)(`div`,{className:`space-y-1`,children:[(0,M.jsx)(UN,{children:e(`oauth.applications.clientSecret`)}),(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(`code`,{className:`flex-1 break-all rounded-md border bg-muted px-3 py-2 font-mono text-xs`,children:m.client_secret}),(0,M.jsx)(Q,{size:`icon`,variant:`outline`,onClick:()=>_(m.client_secret,e(`oauth.applications.clientSecret`)),children:(0,M.jsx)(jy,{className:`h-4 w-4`})})]}),(0,M.jsx)(`p`,{className:`text-xs text-destructive`,children:e(`oauth.applications.clientSecretWarning`)})]})]})]}),(0,M.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,M.jsx)(Q,{variant:`outline`,onClick:()=>t({to:`/account/oauth-applications`}),children:e(`oauth.applications.backToList`)}),(0,M.jsx)(Q,{onClick:()=>t({to:`/account/oauth-applications/$clientId`,params:{clientId:m.client_id}}),children:e(`oauth.applications.viewApplication`)})]})]}):(0,M.jsxs)(`div`,{className:`space-y-6`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`h1`,{className:`text-2xl font-semibold`,children:e(`oauth.applications.form.title`)}),(0,M.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`oauth.applications.form.description`)})]}),(0,M.jsxs)($,{children:[(0,M.jsx)(DN,{children:(0,M.jsxs)(ON,{className:`flex items-center gap-2 text-base`,children:[(0,M.jsx)(Ly,{className:`h-4 w-4`}),e(`oauth.applications.form.details`)]})}),(0,M.jsxs)(AN,{className:`space-y-4`,children:[(0,M.jsxs)(`div`,{className:`space-y-2`,children:[(0,M.jsx)(UN,{htmlFor:`oauth-name`,children:e(`oauth.applications.form.name`)}),(0,M.jsx)(oS,{id:`oauth-name`,value:i,onChange:e=>a(e.target.value),placeholder:e(`oauth.applications.form.namePlaceholder`),disabled:r})]}),(0,M.jsxs)(`div`,{className:`space-y-2`,children:[(0,M.jsx)(UN,{htmlFor:`oauth-redirect`,children:e(`oauth.applications.form.redirectUris`)}),(0,M.jsx)(nL,{id:`oauth-redirect`,value:o,onChange:e=>s(e.target.value),placeholder:e(`oauth.applications.form.redirectPlaceholder`),rows:3,disabled:r}),(0,M.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`oauth.applications.form.redirectHint`)})]}),(0,M.jsxs)(`div`,{className:`space-y-2`,children:[(0,M.jsx)(UN,{children:e(`oauth.applications.form.authMethod`)}),(0,M.jsxs)(GI,{value:c,onValueChange:e=>l(e),disabled:r,children:[(0,M.jsx)(qI,{children:(0,M.jsx)(KI,{})}),(0,M.jsxs)(XI,{children:[(0,M.jsx)(QI,{value:`client_secret_basic`,children:e(`oauth.applications.form.authMethodBasic`)}),(0,M.jsx)(QI,{value:`client_secret_post`,children:e(`oauth.applications.form.authMethodPost`)}),(0,M.jsx)(QI,{value:`none`,children:e(`oauth.applications.form.authMethodNone`)})]})]})]}),(0,M.jsxs)(`div`,{className:`space-y-2`,children:[(0,M.jsx)(UN,{htmlFor:`oauth-client-uri`,children:e(`oauth.applications.form.clientUri`)}),(0,M.jsx)(oS,{id:`oauth-client-uri`,value:u,onChange:e=>d(e.target.value),placeholder:e(`oauth.applications.form.clientUriPlaceholder`),disabled:r})]}),(0,M.jsxs)(`div`,{className:`space-y-2`,children:[(0,M.jsx)(UN,{htmlFor:`oauth-logo`,children:e(`oauth.applications.form.logoUri`)}),(0,M.jsx)(oS,{id:`oauth-logo`,value:f,onChange:e=>p(e.target.value),placeholder:e(`oauth.applications.form.logoUriPlaceholder`),disabled:r}),(0,M.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`oauth.applications.form.logoHint`)})]})]})]}),(0,M.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,M.jsx)(Q,{variant:`ghost`,onClick:()=>t({to:`/account/oauth-applications`}),disabled:r,children:e(`common.cancel`)}),(0,M.jsx)(Q,{onClick:g,disabled:r,children:e(r?`oauth.applications.form.registering`:`oauth.applications.register`)})]})]})}var lL=la(`/account/oauth-applications/$clientId`)({component:uL});function uL(){let{t:e}=vt(),{clientId:t}=lL.useParams(),n=Hi(),{applications:r,loading:i,reload:a}=DP(),{remove:o,deleting:s}=kP(),c=n_(),l=r.find(e=>e.client_id===t),[u,d]=(0,j.useState)(null);(0,j.useEffect)(()=>{let e=!1;if(!l&&c?.oauth?.applications?.get)return c.oauth.applications.get(t).then(t=>{e||d(t?.data??t)},()=>{}),()=>{e=!0}},[c,t,l]);let f=l??u,[p,m]=(0,j.useState)(!1),h=(t,n)=>{navigator.clipboard.writeText(t).then(()=>q({title:e(`oauth.applications.copied`,{label:n})}),()=>q({title:e(`oauth.applications.copyFailed`,{label:n}),variant:`destructive`}))},g=async()=>{if(f)try{await o(f.client_id),q({title:e(`oauth.applications.deleted`)}),await a(),n({to:`/account/oauth-applications`})}catch(t){q({title:e(`oauth.applications.deleteFailed`),description:t.message,variant:`destructive`})}};if(i&&!f)return(0,M.jsx)(`div`,{className:`p-8 text-center text-sm text-muted-foreground`,children:e(`common.loading`)});if(!f)return(0,M.jsxs)(`div`,{className:`space-y-4`,children:[(0,M.jsx)(`h1`,{className:`text-2xl font-semibold`,children:e(`oauth.applications.notFoundTitle`)}),(0,M.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`oauth.applications.notFoundDescription`)}),(0,M.jsx)(Q,{onClick:()=>n({to:`/account/oauth-applications`}),children:e(`oauth.applications.backToList`)})]});let _=typeof f.redirect_urls==`string`?f.redirect_urls.split(/\r?\n|,/).map(e=>e.trim()).filter(Boolean):Array.isArray(f.redirect_urls)?f.redirect_urls:[];return(0,M.jsxs)(`div`,{className:`space-y-6`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`h1`,{className:`text-2xl font-semibold`,children:f.name}),(0,M.jsx)(`p`,{className:`font-mono text-xs text-muted-foreground`,children:f.client_id})]}),(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[f.type&&(0,M.jsx)(pP,{variant:`outline`,className:`capitalize`,children:f.type}),f.disabled&&(0,M.jsx)(pP,{variant:`destructive`,children:e(`oauth.applications.disabled`)})]})]}),(0,M.jsxs)($,{children:[(0,M.jsxs)(DN,{children:[(0,M.jsx)(ON,{children:e(`oauth.applications.credentials`)}),(0,M.jsx)(kN,{children:e(`oauth.applications.credentialsDescriptionDetail`)})]}),(0,M.jsxs)(AN,{className:`space-y-4`,children:[(0,M.jsxs)(`div`,{className:`space-y-1`,children:[(0,M.jsx)(UN,{children:e(`oauth.applications.clientId`)}),(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(`code`,{className:`flex-1 rounded-md border bg-muted px-3 py-2 font-mono text-xs`,children:f.client_id}),(0,M.jsx)(Q,{size:`icon`,variant:`outline`,onClick:()=>h(f.client_id,e(`oauth.applications.clientId`)),children:(0,M.jsx)(jy,{className:`h-4 w-4`})})]})]}),(0,M.jsxs)(`div`,{className:`space-y-1`,children:[(0,M.jsx)(UN,{children:e(`oauth.applications.redirectUris`)}),_.length===0?(0,M.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`oauth.applications.noRedirectUris`)}):(0,M.jsx)(`ul`,{className:`space-y-1`,children:_.map((e,t)=>(0,M.jsx)(`li`,{className:`rounded-md border bg-muted px-3 py-2 font-mono text-xs`,children:e},t))})]})]})]}),(0,M.jsxs)($,{className:`border-destructive/40`,children:[(0,M.jsxs)(DN,{children:[(0,M.jsx)(ON,{className:`text-base text-destructive`,children:e(`oauth.applications.dangerTitle`)}),(0,M.jsx)(kN,{children:e(`oauth.applications.dangerDescription`)})]}),(0,M.jsx)(AN,{children:(0,M.jsxs)(Q,{variant:`destructive`,size:`sm`,onClick:()=>m(!0),disabled:s,children:[(0,M.jsx)(nb,{className:`mr-2 h-4 w-4`}),e(`oauth.applications.delete`)]})})]}),(0,M.jsx)(GP,{open:p,onOpenChange:m,children:(0,M.jsxs)(JP,{children:[(0,M.jsxs)(YP,{children:[(0,M.jsx)(ZP,{className:`text-destructive`,children:e(`oauth.applications.deleteDialogTitle`)}),(0,M.jsx)(QP,{children:e(`oauth.applications.deleteDialogDescription`,{name:f.name})})]}),(0,M.jsxs)(XP,{children:[(0,M.jsx)(Q,{variant:`outline`,onClick:()=>m(!1),disabled:s,children:e(`common.cancel`)}),(0,M.jsx)(Q,{variant:`destructive`,onClick:g,disabled:s,children:e(s?`oauth.applications.deleting`:`common.delete`)})]})]})})]})}var dL=FN.update({id:`/verify-email-prompt`,path:`/verify-email-prompt`,getParentRoute:()=>EN}),fL=LN.update({id:`/verify-email`,path:`/verify-email`,getParentRoute:()=>EN}),pL=WN.update({id:`/setup`,path:`/setup`,getParentRoute:()=>EN}),mL=qN.update({id:`/reset-password`,path:`/reset-password`,getParentRoute:()=>EN}),hL=QN.update({id:`/register`,path:`/register`,getParentRoute:()=>EN}),gL=nP.update({id:`/login`,path:`/login`,getParentRoute:()=>EN}),_L=oP.update({id:`/forgot-password`,path:`/forgot-password`,getParentRoute:()=>EN}),vL=cP.update({id:`/account`,path:`/account`,getParentRoute:()=>EN}),yL=uP.update({id:`/`,path:`/`,getParentRoute:()=>EN}),bL=hP.update({id:`/organizations/`,path:`/organizations/`,getParentRoute:()=>EN}),xL=_P.update({id:`/`,path:`/`,getParentRoute:()=>vL}),SL=bP.update({id:`/organizations/new`,path:`/organizations/new`,getParentRoute:()=>EN}),CL=TP.update({id:`/organizations/$orgId`,path:`/organizations/$orgId`,getParentRoute:()=>EN}),wL=jP.update({id:`/oauth/consent`,path:`/oauth/consent`,getParentRoute:()=>EN}),TL=PP.update({id:`/auth/device`,path:`/auth/device`,getParentRoute:()=>EN}),EL=LP.update({id:`/two-factor`,path:`/two-factor`,getParentRoute:()=>vL}),DL=HP.update({id:`/sessions`,path:`/sessions`,getParentRoute:()=>vL}),OL=$P.update({id:`/security`,path:`/security`,getParentRoute:()=>vL}),kL=tF.update({id:`/profile`,path:`/profile`,getParentRoute:()=>vL}),AL=rF.update({id:`/linked-accounts`,path:`/linked-accounts`,getParentRoute:()=>vL}),jL=lF.update({id:`/invitations`,path:`/invitations`,getParentRoute:()=>vL}),ML=dF.update({id:`/accept-invitation/$invitationId`,path:`/accept-invitation/$invitationId`,getParentRoute:()=>EN}),NL=pF.update({id:`/`,path:`/`,getParentRoute:()=>CL}),PL=mF.update({id:`/oauth-applications/`,path:`/oauth-applications/`,getParentRoute:()=>vL}),FL=eL.update({id:`/teams`,path:`/teams`,getParentRoute:()=>CL}),IL=rL.update({id:`/members`,path:`/members`,getParentRoute:()=>CL}),LL=aL.update({id:`/general`,path:`/general`,getParentRoute:()=>CL}),RL=sL.update({id:`/oauth-applications/new`,path:`/oauth-applications/new`,getParentRoute:()=>vL}),zL={AccountInvitationsRoute:jL,AccountLinkedAccountsRoute:AL,AccountProfileRoute:kL,AccountSecurityRoute:OL,AccountSessionsRoute:DL,AccountTwoFactorRoute:EL,AccountIndexRoute:xL,AccountOauthApplicationsClientIdRoute:lL.update({id:`/oauth-applications/$clientId`,path:`/oauth-applications/$clientId`,getParentRoute:()=>vL}),AccountOauthApplicationsNewRoute:RL,AccountOauthApplicationsIndexRoute:PL},BL=vL._addFileChildren(zL),VL={OrganizationsOrgIdGeneralRoute:LL,OrganizationsOrgIdMembersRoute:IL,OrganizationsOrgIdTeamsRoute:FL,OrganizationsOrgIdIndexRoute:NL},HL={IndexRoute:yL,AccountRoute:BL,ForgotPasswordRoute:_L,LoginRoute:gL,RegisterRoute:hL,ResetPasswordRoute:mL,SetupRoute:pL,VerifyEmailRoute:fL,VerifyEmailPromptRoute:dL,AcceptInvitationInvitationIdRoute:ML,AuthDeviceRoute:TL,OauthConsentRoute:wL,OrganizationsOrgIdRoute:CL._addFileChildren(VL),OrganizationsNewRoute:SL,OrganizationsIndexRoute:bL},UL=EN._addFileChildren(HL)._addFileTypes();function WL(){let e=`/_account/`;return e.endsWith(`/`)?e.slice(0,-1):e}var GL=wa({routeTree:UL,basepath:WL()});function KL(){return(0,M.jsx)(Da,{router:GL})}var qL=typeof localStorage<`u`&&localStorage.getItem(`account.lang`)||typeof navigator<`u`&&navigator.language||`en`;function JL({children:e}){let{i18n:t,language:n}=yt(),[r,i]=j.useReducer(e=>e+1,0),[a,o]=j.useState(!1);return j.useEffect(()=>{let e=()=>i();t.on(`loaded`,e),t.on(`languageChanged`,e);let n=window.setTimeout(()=>o(!0),1500);return()=>{t.off(`loaded`,e),t.off(`languageChanged`,e),window.clearTimeout(n)}},[t]),a||t.isInitialized&&t.hasResourceBundle?.(n,`translation`)?(0,M.jsx)(M.Fragment,{children:e}):null}qf.createRoot(document.getElementById(`root`)).render((0,M.jsx)(j.StrictMode,{children:(0,M.jsx)(_t,{config:{defaultLanguage:qL,fallbackLanguage:`en`},loadLanguage:TM,children:(0,M.jsx)(JL,{children:(0,M.jsx)(KL,{})})})}));
|
|
147
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return j.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},Nw=`DialogDescriptionWarning`,Pw=({contentRef:e,descriptionId:t})=>{let n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${jw(Nw).contentName}}.`;return j.useEffect(()=>{let r=e.current?.getAttribute(`aria-describedby`);t&&r&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},Fw=ow,Iw=fw,Lw=mw,Rw=vw,zw=Cw,Bw=Tw,Vw=Dw,Hw=Fw,Uw=Iw,Ww=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(Lw,{className:Z(`fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`,e),...t,ref:n}));Ww.displayName=Lw.displayName;var Gw=cy(`fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500`,{variants:{side:{top:`inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top`,bottom:`inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom`,left:`inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm`,right:`inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm`}},defaultVariants:{side:`right`}}),Kw=j.forwardRef(({side:e=`right`,className:t,children:n,...r},i)=>(0,M.jsxs)(Uw,{children:[(0,M.jsx)(Ww,{}),(0,M.jsxs)(Rw,{ref:i,className:Z(Gw({side:e}),t),...r,children:[n,(0,M.jsxs)(Vw,{className:`absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary`,children:[(0,M.jsx)(ub,{className:`h-4 w-4`}),(0,M.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]}));Kw.displayName=Rw.displayName;var qw=({className:e,...t})=>(0,M.jsx)(`div`,{className:Z(`flex flex-col space-y-2 text-center sm:text-left`,e),...t});qw.displayName=`SheetHeader`;var Jw=({className:e,...t})=>(0,M.jsx)(`div`,{className:Z(`flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2`,e),...t});Jw.displayName=`SheetFooter`;var Yw=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(zw,{ref:n,className:Z(`text-lg font-semibold text-foreground`,e),...t}));Yw.displayName=zw.displayName;var Xw=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(Bw,{ref:n,className:Z(`text-sm text-muted-foreground`,e),...t}));Xw.displayName=Bw.displayName;function Zw({className:e,...t}){return(0,M.jsx)(`div`,{className:Z(`bg-muted animate-pulse rounded-md`,e),...t})}var Qw=[`top`,`right`,`bottom`,`left`],$w=Math.min,eT=Math.max,tT=Math.round,nT=Math.floor,rT=e=>({x:e,y:e}),iT={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function aT(e,t,n){return eT(e,$w(t,n))}function oT(e,t){return typeof e==`function`?e(t):e}function sT(e){return e.split(`-`)[0]}function cT(e){return e.split(`-`)[1]}function lT(e){return e===`x`?`y`:`x`}function uT(e){return e===`y`?`height`:`width`}function dT(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function fT(e){return lT(dT(e))}function pT(e,t,n){n===void 0&&(n=!1);let r=cT(e),i=fT(e),a=uT(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=ST(o)),[o,ST(o)]}function mT(e){let t=ST(e);return[hT(e),t,hT(t)]}function hT(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var gT=[`left`,`right`],_T=[`right`,`left`],vT=[`top`,`bottom`],yT=[`bottom`,`top`];function bT(e,t,n){switch(e){case`top`:case`bottom`:return n?t?_T:gT:t?gT:_T;case`left`:case`right`:return t?vT:yT;default:return[]}}function xT(e,t,n,r){let i=cT(e),a=bT(sT(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(hT)))),a}function ST(e){let t=sT(e);return iT[t]+e.slice(t.length)}function CT(e){return{top:0,right:0,bottom:0,left:0,...e}}function wT(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:CT(e)}function TT(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function ET(e,t,n){let{reference:r,floating:i}=e,a=dT(t),o=fT(t),s=uT(o),c=sT(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(cT(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}async function DT(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=oT(t,e),p=wT(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=TT(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=TT(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var OT=50,kT=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:DT},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=ET(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<OT&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=ET(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},AT=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=oT(e,t)||{};if(l==null)return{};let d=wT(u),f={x:n,y:r},p=fT(i),m=uT(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=$w(d[_],T),D=$w(d[v],T),O=E,ee=C-h[m]-D,te=C/2-h[m]/2+w,ne=aT(O,te,ee),re=!c.arrow&&cT(i)!=null&&te!==ne&&a.reference[m]/2-(te<O?E:D)-h[m]/2<0,ie=re?te<O?te-O:te-ee:0;return{[p]:f[p]+ie,data:{[p]:ne,centerOffset:te-ne-ie,...re&&{alignmentOffset:ie}},reset:re}}}),jT=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=oT(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=sT(r),_=dT(o),v=sT(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[ST(o)]:mT(o)),x=p!==`none`;!d&&x&&b.push(...xT(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=pT(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==dT(t))||T.every(e=>dT(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=dT(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function MT(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function NT(e){return Qw.some(t=>e[t]>=0)}var PT=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=oT(e,t);switch(i){case`referenceHidden`:{let e=MT(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:NT(e)}}}case`escaped`:{let e=MT(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:NT(e)}}}default:return{}}}}},FT=new Set([`left`,`top`]);async function IT(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=sT(n),s=cT(n),c=dT(n)===`y`,l=FT.has(o)?-1:1,u=a&&c?-1:1,d=oT(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var LT=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await IT(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},RT=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=oT(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=dT(sT(i)),p=lT(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=aT(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=aT(n,h,r)}let g=c.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}}}}},zT=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=oT(e,t),u={x:n,y:r},d=dT(i),f=lT(d),p=u[f],m=u[d],h=oT(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=FT.has(sT(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},BT=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=oT(e,t),u=await o.detectOverflow(t,l),d=sT(i),f=cT(i),p=dT(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=$w(h-u[g],v),x=$w(m-u[_],y),S=!t.middlewareData.shift,C=b,w=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(w=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=v),S&&!f){let e=eT(u.left,0),t=eT(u.right,0),n=eT(u.top,0),r=eT(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:eT(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:eT(u.top,u.bottom))}await c({...t,availableWidth:w,availableHeight:C});let T=await o.getDimensions(s.floating);return m!==T.width||h!==T.height?{reset:{rects:!0}}:{}}}};function VT(){return typeof window<`u`}function HT(e){return GT(e)?(e.nodeName||``).toLowerCase():`#document`}function UT(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function WT(e){return((GT(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function GT(e){return VT()?e instanceof Node||e instanceof UT(e).Node:!1}function KT(e){return VT()?e instanceof Element||e instanceof UT(e).Element:!1}function qT(e){return VT()?e instanceof HTMLElement||e instanceof UT(e).HTMLElement:!1}function JT(e){return!VT()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof UT(e).ShadowRoot}function YT(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=oE(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function XT(e){return/^(table|td|th)$/.test(HT(e))}function ZT(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var QT=/transform|translate|scale|rotate|perspective|filter/,$T=/paint|layout|strict|content/,eE=e=>!!e&&e!==`none`,tE;function nE(e){let t=KT(e)?oE(e):e;return eE(t.transform)||eE(t.translate)||eE(t.scale)||eE(t.rotate)||eE(t.perspective)||!iE()&&(eE(t.backdropFilter)||eE(t.filter))||QT.test(t.willChange||``)||$T.test(t.contain||``)}function rE(e){let t=cE(e);for(;qT(t)&&!aE(t);){if(nE(t))return t;if(ZT(t))return null;t=cE(t)}return null}function iE(){return tE??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),tE}function aE(e){return/^(html|body|#document)$/.test(HT(e))}function oE(e){return UT(e).getComputedStyle(e)}function sE(e){return KT(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function cE(e){if(HT(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||JT(e)&&e.host||WT(e);return JT(t)?t.host:t}function lE(e){let t=cE(e);return aE(t)?e.ownerDocument?e.ownerDocument.body:e.body:qT(t)&&YT(t)?t:lE(t)}function uE(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=lE(e),i=r===e.ownerDocument?.body,a=UT(r);if(i){let e=dE(a);return t.concat(a,a.visualViewport||[],YT(r)?r:[],e&&n?uE(e):[])}else return t.concat(r,uE(r,[],n))}function dE(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function fE(e){let t=oE(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=qT(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=tT(n)!==a||tT(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function pE(e){return KT(e)?e:e.contextElement}function mE(e){let t=pE(e);if(!qT(t))return rT(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=fE(t),o=(a?tT(n.width):n.width)/r,s=(a?tT(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var hE=rT(0);function gE(e){let t=UT(e);return!iE()||!t.visualViewport?hE:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function _E(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==UT(e)?!1:t}function vE(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=pE(e),o=rT(1);t&&(r?KT(r)&&(o=mE(r)):o=mE(e));let s=_E(a,n,r)?gE(a):rT(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=UT(a),t=r&&KT(r)?UT(r):r,n=e,i=dE(n);for(;i&&r&&t!==n;){let e=mE(i),t=i.getBoundingClientRect(),r=oE(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=UT(i),i=dE(n)}}return TT({width:u,height:d,x:c,y:l})}function yE(e,t){let n=sE(e).scrollLeft;return t?t.left+n:vE(WT(e)).left+n}function bE(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-yE(e,n),y:n.top+t.scrollTop}}function xE(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=WT(r),s=t?ZT(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=rT(1),u=rT(0),d=qT(r);if((d||!d&&!a)&&((HT(r)!==`body`||YT(o))&&(c=sE(r)),d)){let e=vE(r);l=mE(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?bE(o,c):rT(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function SE(e){return Array.from(e.getClientRects())}function CE(e){let t=WT(e),n=sE(e),r=e.ownerDocument.body,i=eT(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=eT(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+yE(e),s=-n.scrollTop;return oE(r).direction===`rtl`&&(o+=eT(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var wE=25;function TE(e,t){let n=UT(e),r=WT(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=iE();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=yE(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=wE&&(a-=o)}else l<=wE&&(a+=l);return{width:a,height:o,x:s,y:c}}function EE(e,t){let n=vE(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=qT(e)?mE(e):rT(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function DE(e,t,n){let r;if(t===`viewport`)r=TE(e,n);else if(t===`document`)r=CE(WT(e));else if(KT(t))r=EE(t,n);else{let n=gE(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return TT(r)}function OE(e,t){let n=cE(e);return n===t||!KT(n)||aE(n)?!1:oE(n).position===`fixed`||OE(n,t)}function kE(e,t){let n=t.get(e);if(n)return n;let r=uE(e,[],!1).filter(e=>KT(e)&&HT(e)!==`body`),i=null,a=oE(e).position===`fixed`,o=a?cE(e):e;for(;KT(o)&&!aE(o);){let t=oE(o),n=nE(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||YT(o)&&!n&&OE(e,o))?r=r.filter(e=>e!==o):i=t,o=cE(o)}return t.set(e,r),r}function AE(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?ZT(t)?[]:kE(t,this._c):[].concat(n),r],o=DE(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=DE(t,a[e],i);s=eT(n.top,s),c=$w(n.right,c),l=$w(n.bottom,l),u=eT(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function jE(e){let{width:t,height:n}=fE(e);return{width:t,height:n}}function ME(e,t,n){let r=qT(t),i=WT(t),a=n===`fixed`,o=vE(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=rT(0);function l(){c.x=yE(i)}if(r||!r&&!a)if((HT(t)!==`body`||YT(i))&&(s=sE(t)),r){let e=vE(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l();a&&!r&&i&&l();let u=i&&!r&&!a?bE(i,s):rT(0);return{x:o.left+s.scrollLeft-c.x-u.x,y:o.top+s.scrollTop-c.y-u.y,width:o.width,height:o.height}}function NE(e){return oE(e).position===`static`}function PE(e,t){if(!qT(e)||oE(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return WT(e)===n&&(n=n.ownerDocument.body),n}function FE(e,t){let n=UT(e);if(ZT(e))return n;if(!qT(e)){let t=cE(e);for(;t&&!aE(t);){if(KT(t)&&!NE(t))return t;t=cE(t)}return n}let r=PE(e,t);for(;r&&XT(r)&&NE(r);)r=PE(r,t);return r&&aE(r)&&NE(r)&&!nE(r)?n:r||rE(e)||n}var IE=async function(e){let t=this.getOffsetParent||FE,n=this.getDimensions,r=await n(e.floating);return{reference:ME(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function LE(e){return oE(e).direction===`rtl`}var RE={convertOffsetParentRelativeRectToViewportRelativeRect:xE,getDocumentElement:WT,getClippingRect:AE,getOffsetParent:FE,getElementRects:IE,getClientRects:SE,getDimensions:jE,getScale:mE,isElement:KT,isRTL:LE};function zE(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function BE(e,t){let n=null,r,i=WT(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=nT(d),h=nT(i.clientWidth-(u+f)),g=nT(i.clientHeight-(d+p)),_=nT(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:eT(0,$w(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(n!==c){if(!y)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!zE(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function VE(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=pE(e),u=i||a?[...l?uE(l):[],...t?uE(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?BE(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?vE(e):null;c&&g();function g(){let t=vE(e);h&&!zE(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var HE=LT,UE=RT,WE=jT,GE=BT,KE=PT,qE=AT,JE=zT,YE=(e,t,n)=>{let r=new Map,i={platform:RE,...n},a={...i.platform,_c:r};return kT(e,t,{...i,platform:a})},XE=typeof document<`u`?j.useLayoutEffect:function(){};function ZE(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!ZE(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!ZE(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function QE(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function $E(e,t){let n=QE(e);return Math.round(t*n)/n}function eD(e){let t=j.useRef(e);return XE(()=>{t.current=e}),t}function tD(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=j.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=j.useState(r);ZE(f,r)||p(r);let[m,h]=j.useState(null),[g,_]=j.useState(null),v=j.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=j.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=j.useRef(null),C=j.useRef(null),w=j.useRef(u),T=c!=null,E=eD(c),D=eD(i),O=eD(l),ee=j.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),YE(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};te.current&&!ZE(w.current,t)&&(w.current=t,Gi.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);XE(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let te=j.useRef(!1);XE(()=>(te.current=!0,()=>{te.current=!1}),[]),XE(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(E.current)return E.current(b,x,ee);ee()}},[b,x,ee,E,T]);let ne=j.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),re=j.useMemo(()=>({reference:b,floating:x}),[b,x]),ie=j.useMemo(()=>{let e={position:n,left:0,top:0};if(!re.floating)return e;let t=$E(re.floating,u.x),r=$E(re.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...QE(re.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,re.floating,u.x,u.y]);return j.useMemo(()=>({...u,update:ee,refs:ne,elements:re,floatingStyles:ie}),[u,ee,ne,re,ie])}var nD=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:qE({element:r.current,padding:i}).fn(n):r?qE({element:r,padding:i}).fn(n):{}}}},rD=(e,t)=>{let n=HE(e);return{name:n.name,fn:n.fn,options:[e,t]}},iD=(e,t)=>{let n=UE(e);return{name:n.name,fn:n.fn,options:[e,t]}},aD=(e,t)=>({fn:JE(e).fn,options:[e,t]}),oD=(e,t)=>{let n=WE(e);return{name:n.name,fn:n.fn,options:[e,t]}},sD=(e,t)=>{let n=GE(e);return{name:n.name,fn:n.fn,options:[e,t]}},cD=(e,t)=>{let n=KE(e);return{name:n.name,fn:n.fn,options:[e,t]}},lD=(e,t)=>{let n=nD(e);return{name:n.name,fn:n.fn,options:[e,t]}},uD=`Arrow`,dD=j.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,M.jsx)(O_.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,M.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});dD.displayName=uD;var fD=dD;function pD(e){let[t,n]=j.useState(void 0);return q_(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}else n(void 0)},[e]),t}var mD=`Popper`,[hD,gD]=v_(mD),[_D,vD]=hD(mD),yD=e=>{let{__scopePopper:t,children:n}=e,[r,i]=j.useState(null);return(0,M.jsx)(_D,{scope:t,anchor:r,onAnchorChange:i,children:n})};yD.displayName=mD;var bD=`PopperAnchor`,xD=j.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,a=vD(bD,n),o=j.useRef(null),s=g_(t,o),c=j.useRef(null);return j.useEffect(()=>{let e=c.current;c.current=r?.current||o.current,e!==c.current&&a.onAnchorChange(c.current)}),r?null:(0,M.jsx)(O_.div,{...i,ref:s})});xD.displayName=bD;var SD=`PopperContent`,[CD,wD]=hD(SD),TD=j.forwardRef((e,t)=>{let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:u=0,sticky:d=`partial`,hideWhenDetached:f=!1,updatePositionStrategy:p=`optimized`,onPlaced:m,...h}=e,g=vD(SD,n),[_,v]=j.useState(null),y=g_(t,e=>v(e)),[b,x]=j.useState(null),S=pD(b),C=S?.width??0,w=S?.height??0,T=r+(a===`center`?``:`-`+a),E=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},D=Array.isArray(l)?l:[l],O=D.length>0,ee={padding:E,boundary:D.filter(kD),altBoundary:O},{refs:te,floatingStyles:ne,placement:re,isPositioned:ie,middlewareData:ae}=tD({strategy:`fixed`,placement:T,whileElementsMounted:(...e)=>VE(...e,{animationFrame:p===`always`}),elements:{reference:g.anchor},middleware:[rD({mainAxis:i+w,alignmentAxis:o}),c&&iD({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?aD():void 0,...ee}),c&&oD({...ee}),sD({...ee,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)}}),b&&lD({element:b,padding:s}),AD({arrowWidth:C,arrowHeight:w}),f&&cD({strategy:`referenceHidden`,...ee})]}),[oe,k]=jD(re),se=A_(m);q_(()=>{ie&&se?.()},[ie,se]);let ce=ae.arrow?.x,le=ae.arrow?.y,ue=ae.arrow?.centerOffset!==0,[A,de]=j.useState();return q_(()=>{_&&de(window.getComputedStyle(_).zIndex)},[_]),(0,M.jsx)(`div`,{ref:te.setFloating,"data-radix-popper-content-wrapper":``,style:{...ne,transform:ie?ne.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:A,"--radix-popper-transform-origin":[ae.transformOrigin?.x,ae.transformOrigin?.y].join(` `),...ae.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,M.jsx)(CD,{scope:n,placedSide:oe,onArrowChange:x,arrowX:ce,arrowY:le,shouldHideArrow:ue,children:(0,M.jsx)(O_.div,{"data-side":oe,"data-align":k,...h,ref:y,style:{...h.style,animation:ie?void 0:`none`}})})})});TD.displayName=SD;var ED=`PopperArrow`,DD={top:`bottom`,right:`left`,bottom:`top`,left:`right`},OD=j.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=wD(ED,n),a=DD[i.placedSide];return(0,M.jsx)(`span`,{ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:(0,M.jsx)(fD,{...r,ref:t,style:{...r.style,display:`block`}})})});OD.displayName=ED;function kD(e){return e!==null}var AD=e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=jD(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}});function jD(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var MD=yD,ND=xD,PD=TD,FD=OD,[ID,LD]=v_(`Tooltip`,[gD]),RD=gD(),zD=`TooltipProvider`,BD=700,VD=`tooltip.open`,[HD,UD]=ID(zD),WD=e=>{let{__scopeTooltip:t,delayDuration:n=BD,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=j.useRef(!0),s=j.useRef(!1),c=j.useRef(0);return j.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,M.jsx)(HD,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:j.useCallback(()=>{window.clearTimeout(c.current),o.current=!1},[]),onClose:j.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:s,onPointerInTransitChange:j.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};WD.displayName=zD;var GD=`Tooltip`,[KD,qD]=ID(GD),JD=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=UD(GD,e.__scopeTooltip),l=RD(t),[u,d]=j.useState(null),f=_S(),p=j.useRef(0),m=o??c.disableHoverableContent,h=s??c.delayDuration,g=j.useRef(!1),[_,v]=nv({prop:r,defaultProp:i??!1,onChange:e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(VD))):c.onClose(),a?.(e)},caller:GD}),y=j.useMemo(()=>_?g.current?`delayed-open`:`instant-open`:`closed`,[_]),b=j.useCallback(()=>{window.clearTimeout(p.current),p.current=0,g.current=!1,v(!0)},[v]),x=j.useCallback(()=>{window.clearTimeout(p.current),p.current=0,v(!1)},[v]),S=j.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{g.current=!0,v(!0),p.current=0},h)},[h,v]);return j.useEffect(()=>()=>{p.current&&=(window.clearTimeout(p.current),0)},[]),(0,M.jsx)(MD,{...l,children:(0,M.jsx)(KD,{scope:t,contentId:f,open:_,stateAttribute:y,trigger:u,onTriggerChange:d,onTriggerEnter:j.useCallback(()=>{c.isOpenDelayedRef.current?S():b()},[c.isOpenDelayedRef,S,b]),onTriggerLeave:j.useCallback(()=>{m?x():(window.clearTimeout(p.current),p.current=0)},[x,m]),onOpen:b,onClose:x,disableHoverableContent:m,children:n})})};JD.displayName=GD;var YD=`TooltipTrigger`,XD=j.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=qD(YD,n),a=UD(YD,n),o=RD(n),s=g_(t,j.useRef(null),i.onTriggerChange),c=j.useRef(!1),l=j.useRef(!1),u=j.useCallback(()=>c.current=!1,[]);return j.useEffect(()=>()=>document.removeEventListener(`pointerup`,u),[u]),(0,M.jsx)(ND,{asChild:!0,...o,children:(0,M.jsx)(O_.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:s,onPointerMove:J(e.onPointerMove,e=>{e.pointerType!==`touch`&&!l.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),l.current=!0)}),onPointerLeave:J(e.onPointerLeave,()=>{i.onTriggerLeave(),l.current=!1}),onPointerDown:J(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener(`pointerup`,u,{once:!0})}),onFocus:J(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:J(e.onBlur,i.onClose),onClick:J(e.onClick,i.onClose)})})});XD.displayName=YD;var ZD=`TooltipPortal`,[QD,$D]=ID(ZD,{forceMount:void 0}),eO=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=qD(ZD,t);return(0,M.jsx)(QD,{scope:t,forceMount:n,children:(0,M.jsx)(Z_,{present:n||a.open,children:(0,M.jsx)(Y_,{asChild:!0,container:i,children:r})})})};eO.displayName=ZD;var tO=`TooltipContent`,nO=j.forwardRef((e,t)=>{let n=$D(tO,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=qD(tO,e.__scopeTooltip);return(0,M.jsx)(Z_,{present:r||o.open,children:o.disableHoverableContent?(0,M.jsx)(sO,{side:i,...a,ref:t}):(0,M.jsx)(rO,{side:i,...a,ref:t})})}),rO=j.forwardRef((e,t)=>{let n=qD(tO,e.__scopeTooltip),r=UD(tO,e.__scopeTooltip),i=j.useRef(null),a=g_(t,i),[o,s]=j.useState(null),{trigger:c,onClose:l}=n,u=i.current,{onPointerInTransitChange:d}=r,f=j.useCallback(()=>{s(null),d(!1)},[d]),p=j.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=dO(r,uO(r,n.getBoundingClientRect())),a=fO(t.getBoundingClientRect());s(mO([...i,...a])),d(!0)},[d]);return j.useEffect(()=>()=>f(),[f]),j.useEffect(()=>{if(c&&u){let e=e=>p(e,u),t=e=>p(e,c);return c.addEventListener(`pointerleave`,e),u.addEventListener(`pointerleave`,t),()=>{c.removeEventListener(`pointerleave`,e),u.removeEventListener(`pointerleave`,t)}}},[c,u,p,f]),j.useEffect(()=>{if(o){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||u?.contains(t),i=!pO(n,o);r?f():i&&(f(),l())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,f]),(0,M.jsx)(sO,{...e,ref:a})}),[iO,aO]=ID(GD,{isInside:!1}),oO=C_(`TooltipContent`),sO=j.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,c=qD(tO,n),l=RD(n),{onClose:u}=c;return j.useEffect(()=>(document.addEventListener(VD,u),()=>document.removeEventListener(VD,u)),[u]),j.useEffect(()=>{if(c.trigger){let e=e=>{e.target?.contains(c.trigger)&&u()};return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[c.trigger,u]),(0,M.jsx)(R_,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:u,children:(0,M.jsxs)(PD,{"data-state":c.stateAttribute,...l,...s,ref:t,style:{...s.style,"--radix-tooltip-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-tooltip-content-available-width":`var(--radix-popper-available-width)`,"--radix-tooltip-content-available-height":`var(--radix-popper-available-height)`,"--radix-tooltip-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-tooltip-trigger-height":`var(--radix-popper-anchor-height)`},children:[(0,M.jsx)(oO,{children:r}),(0,M.jsx)(iO,{scope:n,isInside:!0,children:(0,M.jsx)(cv,{id:c.contentId,role:`tooltip`,children:i||r})})]})})});nO.displayName=tO;var cO=`TooltipArrow`,lO=j.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=RD(n);return aO(cO,n).isInside?null:(0,M.jsx)(FD,{...i,...r,ref:t})});lO.displayName=cO;function uO(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}function dO(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function fO(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function pO(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function mO(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:+(e.y>t.y)),hO(t)}function hO(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var gO=WD,_O=JD,vO=XD,yO=nO,bO=gO,xO=_O,SO=vO,CO=j.forwardRef(({className:e,sideOffset:t=4,...n},r)=>(0,M.jsx)(yO,{ref:r,sideOffset:t,className:Z(`z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,e),...n}));CO.displayName=yO.displayName;var wO=`sidebar_state`,TO=3600*24*7,EO=`16rem`,DO=`18rem`,OO=`3rem`,kO=`b`,AO=j.createContext(null);function jO(){let e=j.useContext(AO);if(!e)throw Error(`useSidebar must be used within a SidebarProvider`);return e}var MO=j.forwardRef(({defaultOpen:e=!0,open:t,onOpenChange:n,className:r,style:i,children:a,...o},s)=>{let c=iS(),[l,u]=j.useState(!1),[d,f]=j.useState(e),p=t??d,m=j.useCallback(e=>{let t=typeof e==`function`?e(p):e;n?n(t):f(t),document.cookie=`${wO}=${t}; path=/; max-age=${TO}`},[n,p]),h=j.useCallback(()=>c?u(e=>!e):m(e=>!e),[c,m,u]);j.useEffect(()=>{let e=e=>{e.key===kO&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),h())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[h]);let g=p?`expanded`:`collapsed`,_=j.useMemo(()=>({state:g,open:p,setOpen:m,isMobile:c,openMobile:l,setOpenMobile:u,toggleSidebar:h}),[g,p,m,c,l,u,h]);return(0,M.jsx)(AO.Provider,{value:_,children:(0,M.jsx)(bO,{delayDuration:0,children:(0,M.jsx)(`div`,{style:{"--sidebar-width":EO,"--sidebar-width-icon":OO,...i},className:Z(`group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex min-h-0 w-full`,r),ref:s,...o,children:a})})})});MO.displayName=`SidebarProvider`;var NO=j.forwardRef(({side:e=`left`,variant:t=`sidebar`,collapsible:n=`offcanvas`,className:r,children:i,...a},o)=>{let{isMobile:s,state:c,openMobile:l,setOpenMobile:u}=jO();return n===`none`?(0,M.jsx)(`div`,{className:Z(`bg-sidebar text-sidebar-foreground flex h-full w-[var(--sidebar-width)] flex-col`,r),ref:o,...a,children:i}):s?(0,M.jsx)(Hw,{open:l,onOpenChange:u,...a,children:(0,M.jsx)(Kw,{"data-sidebar":`sidebar`,"data-mobile":`true`,className:`bg-sidebar text-sidebar-foreground w-[var(--sidebar-width)] p-0 [&>button]:hidden`,style:{"--sidebar-width":DO},side:e,children:(0,M.jsx)(`div`,{className:`flex h-full w-full flex-col`,children:i})})}):(0,M.jsx)(`div`,{ref:o,className:Z(`bg-sidebar text-sidebar-foreground hidden md:flex h-svh w-[var(--sidebar-width)] shrink-0 flex-col border-r transition-[width] duration-200 ease-linear overflow-hidden`,c===`collapsed`&&n===`offcanvas`&&`w-0 border-0`,c===`collapsed`&&n===`icon`&&`w-[var(--sidebar-width-icon)]`,r),"data-state":c,"data-collapsible":c===`collapsed`?n:``,"data-variant":t,"data-side":e,...a,children:i})});NO.displayName=`Sidebar`;var PO=j.forwardRef(({className:e,onClick:t,...n},r)=>{let{toggleSidebar:i}=jO();return(0,M.jsxs)(Q,{ref:r,"data-sidebar":`trigger`,variant:`ghost`,size:`icon`,className:Z(`h-7 w-7`,e),onClick:e=>{t?.(e),i()},...n,children:[(0,M.jsx)(Ky,{}),(0,M.jsx)(`span`,{className:`sr-only`,children:`Toggle Sidebar`})]})});PO.displayName=`SidebarTrigger`;var FO=j.forwardRef(({className:e,...t},n)=>{let{toggleSidebar:r}=jO();return(0,M.jsx)(`button`,{ref:n,"data-sidebar":`rail`,"aria-label":`Toggle Sidebar`,tabIndex:-1,onClick:r,title:`Toggle Sidebar`,className:Z(`hover:after:bg-sidebar-border absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] group-data-[side=left]:-right-4 group-data-[side=right]:left-0 sm:flex`,`[[data-side=left]_&]:cursor-w-resize [[data-side=right]_&]:cursor-e-resize`,`[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize`,`group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full group-data-[collapsible=offcanvas]:hover:bg-sidebar`,`[[data-side=left][data-collapsible=offcanvas]_&]:-right-2`,`[[data-side=right][data-collapsible=offcanvas]_&]:-left-2`,e),...t})});FO.displayName=`SidebarRail`;var IO=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`main`,{ref:n,className:Z(`relative flex min-h-svh flex-1 flex-col bg-background`,`peer-data-[variant=inset]:min-h-[calc(100svh-theme(spacing.4))] md:peer-data-[variant=inset]:m-2 md:peer-data-[state=collapsed]:peer-data-[variant=inset]:ml-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow`,e),...t}));IO.displayName=`SidebarInset`;var LO=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(oS,{ref:n,"data-sidebar":`input`,className:Z(`h-8 w-full bg-background shadow-none focus-visible:ring-2 focus-visible:ring-sidebar-ring`,e),...t}));LO.displayName=`SidebarInput`;var RO=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`div`,{ref:n,"data-sidebar":`header`,className:Z(`flex flex-col gap-2 p-2`,e),...t}));RO.displayName=`SidebarHeader`;var zO=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`div`,{ref:n,"data-sidebar":`footer`,className:Z(`flex flex-col gap-2 p-2`,e),...t}));zO.displayName=`SidebarFooter`;var BO=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(mS,{ref:n,"data-sidebar":`separator`,className:Z(`mx-2 w-auto bg-sidebar-border`,e),...t}));BO.displayName=`SidebarSeparator`;var VO=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`div`,{ref:n,"data-sidebar":`content`,className:Z(`flex min-h-0 flex-1 flex-col gap-2 overflow-auto`,e),...t}));VO.displayName=`SidebarContent`;var HO=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`div`,{ref:n,"data-sidebar":`group`,className:Z(`relative flex w-full min-w-0 flex-col p-2`,e),...t}));HO.displayName=`SidebarGroup`;var UO=j.forwardRef(({className:e,asChild:t=!1,...n},r)=>(0,M.jsx)(t?Zx:`div`,{ref:r,"data-sidebar":`group-label`,className:Z(`text-xs/6 font-medium text-sidebar-foreground/70 ring-sidebar-ring flex h-8 shrink-0 items-center rounded-md px-2 outline-none transition-[margin,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0 [[data-collapsible=icon]_&]:-mt-8 [[data-collapsible=icon]_&]:opacity-0 [[data-collapsible=icon]_&]:overflow-hidden`,e),...n}));UO.displayName=`SidebarGroupLabel`;var WO=j.forwardRef(({className:e,asChild:t=!1,...n},r)=>(0,M.jsx)(t?Zx:`button`,{ref:r,"data-sidebar":`group-action`,className:Z(`absolute right-3 top-3.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0`,`after:absolute after:-inset-2 after:md:hidden`,`group-data-[collapsible=icon]:hidden`,e),...n}));WO.displayName=`SidebarGroupAction`;var GO=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`div`,{ref:n,"data-sidebar":`group-content`,className:Z(`w-full text-sm`,e),...t}));GO.displayName=`SidebarGroupContent`;var KO=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`ul`,{ref:n,"data-sidebar":`menu`,className:Z(`flex w-full min-w-0 flex-col gap-1`,e),...t}));KO.displayName=`SidebarMenu`;var qO=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`li`,{ref:n,"data-sidebar":`menu-item`,className:Z(`group/menu-item relative`,e),...t}));qO.displayName=`SidebarMenuItem`;var JO=j.forwardRef(({asChild:e=!1,isActive:t=!1,variant:n=`default`,size:r=`default`,tooltip:i,className:a,...o},s)=>{let c=e?Zx:`button`,{isMobile:l,state:u}=jO(),d=(0,M.jsx)(c,{ref:s,"data-sidebar":`menu-button`,"data-size":r,"data-active":t,className:Z(YO({variant:n,size:r}),a),...o});return i?(typeof i==`string`&&(i={children:i}),(0,M.jsxs)(xO,{children:[(0,M.jsx)(SO,{asChild:!0,children:d}),(0,M.jsx)(CO,{side:`right`,align:`center`,hidden:u!==`collapsed`||l,...i})]})):d});JO.displayName=`SidebarMenuButton`;var YO=cy(`peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-none ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-[[data-sidebar=menu-action]]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:!size-8 group-data-[collapsible=icon]:!p-2 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0`,{variants:{variant:{default:`hover:bg-sidebar-accent hover:text-sidebar-accent-foreground`,outline:`bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]`},size:{default:`h-8 text-sm`,sm:`h-7 text-xs`,lg:`h-12 text-sm group-data-[collapsible=icon]:!p-0`}},defaultVariants:{variant:`default`,size:`default`}}),XO=j.forwardRef(({className:e,asChild:t=!1,showOnHover:n=!1,...r},i)=>(0,M.jsx)(t?Zx:`button`,{ref:i,"data-sidebar":`menu-action`,className:Z(`absolute right-1 top-1.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0`,`after:absolute after:-inset-2 after:md:hidden`,`peer-data-[size=sm]/menu-button:top-1`,`peer-data-[size=default]/menu-button:top-1.5`,`peer-data-[size=lg]/menu-button:top-2.5`,`group-data-[collapsible=icon]:hidden`,n&&`group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 peer-data-[active=true]/menu-button:text-sidebar-accent-foreground md:opacity-0`,e),...r}));XO.displayName=`SidebarMenuAction`;var ZO=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`div`,{ref:n,"data-sidebar":`menu-badge`,className:Z(`text-sidebar-foreground pointer-events-none absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums select-none`,`peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground`,`peer-data-[size=sm]/menu-button:top-1`,`peer-data-[size=default]/menu-button:top-1.5`,`peer-data-[size=lg]/menu-button:top-2.5`,`group-data-[collapsible=icon]:hidden`,e),...t}));ZO.displayName=`SidebarMenuBadge`;var QO=j.forwardRef(({className:e,showIcon:t=!1,...n},r)=>{let i=j.useMemo(()=>`${Math.floor(Math.random()*40)+50}%`,[]);return(0,M.jsxs)(`div`,{ref:r,"data-sidebar":`menu-skeleton`,className:Z(`rounded-md h-8 flex gap-2 px-2 items-center`,e),...n,children:[t&&(0,M.jsx)(Zw,{className:`size-4 rounded-md`,"data-sidebar":`menu-skeleton-icon`}),(0,M.jsx)(Zw,{className:`h-4 flex-1 max-w-[var(--skeleton-width)]`,"data-sidebar":`menu-skeleton-text`,style:{"--skeleton-width":i}})]})});QO.displayName=`SidebarMenuSkeleton`;var $O=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`ul`,{ref:n,"data-sidebar":`menu-sub`,className:Z(`mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5`,`group-data-[collapsible=icon]:hidden`,e),...t}));$O.displayName=`SidebarMenuSub`;var ek=j.forwardRef(({...e},t)=>(0,M.jsx)(`li`,{ref:t,...e}));ek.displayName=`SidebarMenuSubItem`;var tk=j.forwardRef(({asChild:e=!1,size:t=`md`,isActive:n,className:r,...i},a)=>(0,M.jsx)(e?Zx:`a`,{ref:a,"data-sidebar":`menu-sub-button`,"data-size":t,"data-active":n,className:Z(`flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground outline-none ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground`,`data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground`,t===`sm`&&`text-xs`,t===`md`&&`text-sm`,r),...i}));tk.displayName=`SidebarMenuSubButton`;var nk=cy(`text-muted-foreground flex flex-wrap items-center gap-1.5 break-words text-sm sm:gap-2.5`),rk=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`nav`,{ref:n,"aria-label":`breadcrumb`,className:Z(nk(),e),...t}));rk.displayName=`Breadcrumb`;var ik=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`ol`,{ref:n,className:Z(`text-muted-foreground flex flex-wrap items-center gap-1.5 break-words text-sm sm:gap-2.5`,e),...t}));ik.displayName=`BreadcrumbList`;var ak=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`li`,{ref:n,className:Z(`inline-flex items-center gap-1.5`,e),...t}));ak.displayName=`BreadcrumbItem`;var ok=j.forwardRef(({asChild:e,className:t,...n},r)=>(0,M.jsx)(e?Zx:`a`,{ref:r,className:Z(`hover:text-foreground transition-colors`,t),...n}));ok.displayName=`BreadcrumbLink`;var sk=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`span`,{ref:n,role:`link`,"aria-disabled":`true`,"aria-current":`page`,className:Z(`text-foreground font-normal`,e),...t}));sk.displayName=`BreadcrumbPage`;var ck=({children:e,className:t,...n})=>(0,M.jsx)(`li`,{role:`presentation`,"aria-hidden":`true`,className:Z(`[&>svg]:size-3.5`,t),...n,children:e??(0,M.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,className:`size-4`,children:(0,M.jsx)(`path`,{d:`m9 18 6-6-6-6`})})});ck.displayName=`BreadcrumbSeparator`;var lk=({className:e,...t})=>(0,M.jsxs)(`span`,{role:`presentation`,"aria-hidden":`true`,className:Z(`flex h-9 w-9 items-center justify-center`,e),...t,children:[(0,M.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,className:`size-4`,children:[(0,M.jsx)(`circle`,{cx:`12`,cy:`12`,r:`1`}),(0,M.jsx)(`circle`,{cx:`19`,cy:`12`,r:`1`}),(0,M.jsx)(`circle`,{cx:`5`,cy:`12`,r:`1`})]}),(0,M.jsx)(`span`,{className:`sr-only`,children:`More`})]});lk.displayName=`BreadcrumbElipssis`;var uk=j.createContext(void 0);function dk(e){let t=j.useContext(uk);return e||t||`ltr`}var fk=`rovingFocusGroup.onEntryFocus`,pk={bubbles:!1,cancelable:!0},mk=`RovingFocusGroup`,[hk,gk,_k]=D_(mk),[vk,yk]=v_(mk,[_k]),[bk,xk]=vk(mk),Sk=j.forwardRef((e,t)=>(0,M.jsx)(hk.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,M.jsx)(hk.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,M.jsx)(Ck,{...e,ref:t})})}));Sk.displayName=mk;var Ck=j.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:u=!1,...d}=e,f=j.useRef(null),p=g_(t,f),m=dk(a),[h,g]=nv({prop:o,defaultProp:s??null,onChange:c,caller:mk}),[_,v]=j.useState(!1),y=A_(l),b=gk(n),x=j.useRef(!1),[S,C]=j.useState(0);return j.useEffect(()=>{let e=f.current;if(e)return e.addEventListener(fk,y),()=>e.removeEventListener(fk,y)},[y]),(0,M.jsx)(bk,{scope:n,orientation:r,dir:m,loop:i,currentTabStopId:h,onItemFocus:j.useCallback(e=>g(e),[g]),onItemShiftTab:j.useCallback(()=>v(!0),[]),onFocusableItemAdd:j.useCallback(()=>C(e=>e+1),[]),onFocusableItemRemove:j.useCallback(()=>C(e=>e-1),[]),children:(0,M.jsx)(O_.div,{tabIndex:_||S===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:`none`,...e.style},onMouseDown:J(e.onMouseDown,()=>{x.current=!0}),onFocus:J(e.onFocus,e=>{let t=!x.current;if(e.target===e.currentTarget&&t&&!_){let t=new CustomEvent(fk,pk);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=b().filter(e=>e.focusable);kk([e.find(e=>e.active),e.find(e=>e.id===h),...e].filter(Boolean).map(e=>e.ref.current),u)}}x.current=!1}),onBlur:J(e.onBlur,()=>v(!1))})})}),wk=`RovingFocusGroupItem`,Tk=j.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=_S(),l=a||c,u=xk(wk,n),d=u.currentTabStopId===l,f=gk(n),{onFocusableItemAdd:p,onFocusableItemRemove:m,currentTabStopId:h}=u;return j.useEffect(()=>{if(r)return p(),()=>m()},[r,p,m]),(0,M.jsx)(hk.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,M.jsx)(O_.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:J(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:J(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:J(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=Ok(e,u.orientation,u.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=f().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=u.loop?Ak(n,r+1):n.slice(r+1)}setTimeout(()=>kk(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:h!=null}):o})})});Tk.displayName=wk;var Ek={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function Dk(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}function Ok(e,t,n){let r=Dk(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return Ek[r]}function kk(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function Ak(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var jk=Sk,Mk=Tk,Nk=[`Enter`,` `],Pk=[`ArrowDown`,`PageUp`,`Home`],Fk=[`ArrowUp`,`PageDown`,`End`],Ik=[...Pk,...Fk],Lk={ltr:[...Nk,`ArrowRight`],rtl:[...Nk,`ArrowLeft`]},Rk={ltr:[`ArrowLeft`],rtl:[`ArrowRight`]},zk=`Menu`,[Bk,Vk,Hk]=D_(zk),[Uk,Wk]=v_(zk,[Hk,gD,yk]),Gk=gD(),Kk=yk(),[qk,Jk]=Uk(zk),[Yk,Xk]=Uk(zk),Zk=e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=Gk(t),[c,l]=j.useState(null),u=j.useRef(!1),d=A_(a),f=dk(i);return j.useEffect(()=>{let e=()=>{u.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},t=()=>u.current=!1;return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),(0,M.jsx)(MD,{...s,children:(0,M.jsx)(qk,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,M.jsx)(Yk,{scope:t,onClose:j.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})};Zk.displayName=zk;var Qk=`MenuAnchor`,$k=j.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=Gk(n);return(0,M.jsx)(ND,{...i,...r,ref:t})});$k.displayName=Qk;var eA=`MenuPortal`,[tA,nA]=Uk(eA,{forceMount:void 0}),rA=e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=Jk(eA,t);return(0,M.jsx)(tA,{scope:t,forceMount:n,children:(0,M.jsx)(Z_,{present:n||a.open,children:(0,M.jsx)(Y_,{asChild:!0,container:i,children:r})})})};rA.displayName=eA;var iA=`MenuContent`,[aA,oA]=Uk(iA),sA=j.forwardRef((e,t)=>{let n=nA(iA,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=Jk(iA,e.__scopeMenu),o=Xk(iA,e.__scopeMenu);return(0,M.jsx)(Bk.Provider,{scope:e.__scopeMenu,children:(0,M.jsx)(Z_,{present:r||a.open,children:(0,M.jsx)(Bk.Slot,{scope:e.__scopeMenu,children:o.modal?(0,M.jsx)(cA,{...i,ref:t}):(0,M.jsx)(lA,{...i,ref:t})})})})}),cA=j.forwardRef((e,t)=>{let n=Jk(iA,e.__scopeMenu),r=j.useRef(null),i=g_(t,r);return j.useEffect(()=>{let e=r.current;if(e)return ew(e)},[]),(0,M.jsx)(dA,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:J(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),lA=j.forwardRef((e,t)=>{let n=Jk(iA,e.__scopeMenu);return(0,M.jsx)(dA,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),uA=b_(`MenuContent.ScrollLock`),dA=j.forwardRef((e,t)=>{let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEntryFocus:c,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,disableOutsideScroll:m,...h}=e,g=Jk(iA,n),_=Xk(iA,n),v=Gk(n),y=Kk(n),b=Vk(n),[x,S]=j.useState(null),C=j.useRef(null),w=g_(t,C,g.onContentChange),T=j.useRef(0),E=j.useRef(``),D=j.useRef(0),O=j.useRef(null),ee=j.useRef(`right`),te=j.useRef(0),ne=m?GC:j.Fragment,re=m?{as:uA,allowPinchZoom:!0}:void 0,ie=e=>{let t=E.current+e,n=b().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=YA(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;(function e(t){E.current=t,window.clearTimeout(T.current),t!==``&&(T.current=window.setTimeout(()=>e(``),1e3))})(t),o&&setTimeout(()=>o.focus())};j.useEffect(()=>()=>window.clearTimeout(T.current),[]),FS();let ae=j.useCallback(e=>ee.current===O.current?.side&&ZA(e,O.current?.area),[]);return(0,M.jsx)(aA,{scope:n,searchRef:E,onItemEnter:j.useCallback(e=>{ae(e)&&e.preventDefault()},[ae]),onItemLeave:j.useCallback(e=>{ae(e)||(C.current?.focus(),S(null))},[ae]),onTriggerLeave:j.useCallback(e=>{ae(e)&&e.preventDefault()},[ae]),pointerGraceTimerRef:D,onPointerGraceIntentChange:j.useCallback(e=>{O.current=e},[]),children:(0,M.jsx)(ne,{...re,children:(0,M.jsx)(SS,{asChild:!0,trapped:i,onMountAutoFocus:J(a,e=>{e.preventDefault(),C.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,M.jsx)(R_,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:(0,M.jsx)(jk,{asChild:!0,...y,dir:_.dir,orientation:`vertical`,loop:r,currentTabStopId:x,onCurrentTabStopIdChange:S,onEntryFocus:J(c,e=>{_.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,M.jsx)(PD,{role:`menu`,"aria-orientation":`vertical`,"data-state":WA(g.open),"data-radix-menu-content":``,dir:_.dir,...v,...h,ref:w,style:{outline:`none`,...h.style},onKeyDown:J(h.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&ie(e.key));let i=C.current;if(e.target!==i||!Ik.includes(e.key))return;e.preventDefault();let a=b().filter(e=>!e.disabled).map(e=>e.ref.current);Fk.includes(e.key)&&a.reverse(),qA(a)}),onBlur:J(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(T.current),E.current=``)}),onPointerMove:J(e.onPointerMove,QA(e=>{let t=e.target,n=te.current!==e.clientX;e.currentTarget.contains(t)&&n&&(ee.current=e.clientX>te.current?`right`:`left`,te.current=e.clientX)}))})})})})})})});sA.displayName=iA;var fA=`MenuGroup`,pA=j.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,M.jsx)(O_.div,{role:`group`,...r,ref:t})});pA.displayName=fA;var mA=`MenuLabel`,hA=j.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,M.jsx)(O_.div,{...r,ref:t})});hA.displayName=mA;var gA=`MenuItem`,_A=`menu.itemSelect`,vA=j.forwardRef((e,t)=>{let{disabled:n=!1,onSelect:r,...i}=e,a=j.useRef(null),o=Xk(gA,e.__scopeMenu),s=oA(gA,e.__scopeMenu),c=g_(t,a),l=j.useRef(!1),u=()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(_A,{bubbles:!0,cancelable:!0});e.addEventListener(_A,e=>r?.(e),{once:!0}),k_(e,t),t.defaultPrevented?l.current=!1:o.onClose()}};return(0,M.jsx)(yA,{...i,ref:c,disabled:n,onClick:J(e.onClick,u),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:J(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:J(e.onKeyDown,e=>{let t=s.searchRef.current!==``;n||t&&e.key===` `||Nk.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});vA.displayName=gA;var yA=j.forwardRef((e,t)=>{let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=oA(gA,n),s=Kk(n),c=j.useRef(null),l=g_(t,c),[u,d]=j.useState(!1),[f,p]=j.useState(``);return j.useEffect(()=>{let e=c.current;e&&p((e.textContent??``).trim())},[a.children]),(0,M.jsx)(Bk.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:(0,M.jsx)(Mk,{asChild:!0,...s,focusable:!r,children:(0,M.jsx)(O_.div,{role:`menuitem`,"data-highlighted":u?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:l,onPointerMove:J(e.onPointerMove,QA(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:J(e.onPointerLeave,QA(e=>o.onItemLeave(e))),onFocus:J(e.onFocus,()=>d(!0)),onBlur:J(e.onBlur,()=>d(!1))})})})}),bA=`MenuCheckboxItem`,xA=j.forwardRef((e,t)=>{let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,M.jsx)(kA,{scope:e.__scopeMenu,checked:n,children:(0,M.jsx)(vA,{role:`menuitemcheckbox`,"aria-checked":GA(n)?`mixed`:n,...i,ref:t,"data-state":KA(n),onSelect:J(i.onSelect,()=>r?.(GA(n)?!0:!n),{checkForDefaultPrevented:!1})})})});xA.displayName=bA;var SA=`MenuRadioGroup`,[CA,wA]=Uk(SA,{value:void 0,onValueChange:()=>{}}),TA=j.forwardRef((e,t)=>{let{value:n,onValueChange:r,...i}=e,a=A_(r);return(0,M.jsx)(CA,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,M.jsx)(pA,{...i,ref:t})})});TA.displayName=SA;var EA=`MenuRadioItem`,DA=j.forwardRef((e,t)=>{let{value:n,...r}=e,i=wA(EA,e.__scopeMenu),a=n===i.value;return(0,M.jsx)(kA,{scope:e.__scopeMenu,checked:a,children:(0,M.jsx)(vA,{role:`menuitemradio`,"aria-checked":a,...r,ref:t,"data-state":KA(a),onSelect:J(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});DA.displayName=EA;var OA=`MenuItemIndicator`,[kA,AA]=Uk(OA,{checked:!1}),jA=j.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:r,...i}=e,a=AA(OA,n);return(0,M.jsx)(Z_,{present:r||GA(a.checked)||a.checked===!0,children:(0,M.jsx)(O_.span,{...i,ref:t,"data-state":KA(a.checked)})})});jA.displayName=OA;var MA=`MenuSeparator`,NA=j.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,M.jsx)(O_.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})});NA.displayName=MA;var PA=`MenuArrow`,FA=j.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=Gk(n);return(0,M.jsx)(FD,{...i,...r,ref:t})});FA.displayName=PA;var IA=`MenuSub`,[LA,RA]=Uk(IA),zA=e=>{let{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,a=Jk(IA,t),o=Gk(t),[s,c]=j.useState(null),[l,u]=j.useState(null),d=A_(i);return j.useEffect(()=>(a.open===!1&&d(!1),()=>d(!1)),[a.open,d]),(0,M.jsx)(MD,{...o,children:(0,M.jsx)(qk,{scope:t,open:r,onOpenChange:d,content:l,onContentChange:u,children:(0,M.jsx)(LA,{scope:t,contentId:_S(),triggerId:_S(),trigger:s,onTriggerChange:c,children:n})})})};zA.displayName=IA;var BA=`MenuSubTrigger`,VA=j.forwardRef((e,t)=>{let n=Jk(BA,e.__scopeMenu),r=Xk(BA,e.__scopeMenu),i=RA(BA,e.__scopeMenu),a=oA(BA,e.__scopeMenu),o=j.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:c}=a,l={__scopeMenu:e.__scopeMenu},u=j.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return j.useEffect(()=>u,[u]),j.useEffect(()=>{let e=s.current;return()=>{window.clearTimeout(e),c(null)}},[s,c]),(0,M.jsx)($k,{asChild:!0,...l,children:(0,M.jsx)(yA,{id:i.triggerId,"aria-haspopup":`menu`,"aria-expanded":n.open,"aria-controls":i.contentId,"data-state":WA(n.open),...e,ref:h_(t,i.onTriggerChange),onClick:t=>{e.onClick?.(t),!(e.disabled||t.defaultPrevented)&&(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:J(e.onPointerMove,QA(t=>{a.onItemEnter(t),!t.defaultPrevented&&!e.disabled&&!n.open&&!o.current&&(a.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:J(e.onPointerLeave,QA(e=>{u();let t=n.content?.getBoundingClientRect();if(t){let r=n.content?.dataset.side,i=r===`right`,o=i?-5:5,c=t[i?`left`:`right`],l=t[i?`right`:`left`];a.onPointerGraceIntentChange({area:[{x:e.clientX+o,y:e.clientY},{x:c,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:c,y:t.bottom}],side:r}),window.clearTimeout(s.current),s.current=window.setTimeout(()=>a.onPointerGraceIntentChange(null),300)}else{if(a.onTriggerLeave(e),e.defaultPrevented)return;a.onPointerGraceIntentChange(null)}})),onKeyDown:J(e.onKeyDown,t=>{let i=a.searchRef.current!==``;e.disabled||i&&t.key===` `||Lk[r.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})});VA.displayName=BA;var HA=`MenuSubContent`,UA=j.forwardRef((e,t)=>{let n=nA(iA,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=Jk(iA,e.__scopeMenu),o=Xk(iA,e.__scopeMenu),s=RA(HA,e.__scopeMenu),c=j.useRef(null),l=g_(t,c);return(0,M.jsx)(Bk.Provider,{scope:e.__scopeMenu,children:(0,M.jsx)(Z_,{present:r||a.open,children:(0,M.jsx)(Bk.Slot,{scope:e.__scopeMenu,children:(0,M.jsx)(dA,{id:s.contentId,"aria-labelledby":s.triggerId,...i,ref:l,align:`start`,side:o.dir===`rtl`?`left`:`right`,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{o.isUsingKeyboardRef.current&&c.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:J(e.onFocusOutside,e=>{e.target!==s.trigger&&a.onOpenChange(!1)}),onEscapeKeyDown:J(e.onEscapeKeyDown,e=>{o.onClose(),e.preventDefault()}),onKeyDown:J(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=Rk[o.dir].includes(e.key);t&&n&&(a.onOpenChange(!1),s.trigger?.focus(),e.preventDefault())})})})})})});UA.displayName=HA;function WA(e){return e?`open`:`closed`}function GA(e){return e===`indeterminate`}function KA(e){return GA(e)?`indeterminate`:e?`checked`:`unchecked`}function qA(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function JA(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function YA(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=JA(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function XA(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function ZA(e,t){return t?XA({x:e.clientX,y:e.clientY},t):!1}function QA(e){return t=>t.pointerType===`mouse`?e(t):void 0}var $A=Zk,ej=$k,tj=rA,nj=sA,rj=pA,ij=hA,aj=vA,oj=xA,sj=TA,cj=DA,lj=jA,uj=NA,dj=FA,fj=VA,pj=UA,mj=`DropdownMenu`,[hj,gj]=v_(mj,[Wk]),_j=Wk(),[vj,yj]=hj(mj),bj=e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=_j(t),l=j.useRef(null),[u,d]=nv({prop:i,defaultProp:a??!1,onChange:o,caller:mj});return(0,M.jsx)(vj,{scope:t,triggerId:_S(),triggerRef:l,contentId:_S(),open:u,onOpenChange:d,onOpenToggle:j.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,M.jsx)($A,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})};bj.displayName=mj;var xj=`DropdownMenuTrigger`,Sj=j.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=yj(xj,n),o=_j(n);return(0,M.jsx)(ej,{asChild:!0,...o,children:(0,M.jsx)(O_.button,{type:`button`,id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,disabled:r,...i,ref:h_(t,a.triggerRef),onPointerDown:J(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:J(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})});Sj.displayName=xj;var Cj=`DropdownMenuPortal`,wj=e=>{let{__scopeDropdownMenu:t,...n}=e,r=_j(t);return(0,M.jsx)(tj,{...r,...n})};wj.displayName=Cj;var Tj=`DropdownMenuContent`,Ej=j.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=yj(Tj,n),a=_j(n),o=j.useRef(!1);return(0,M.jsx)(nj,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:J(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:J(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});Ej.displayName=Tj;var Dj=`DropdownMenuGroup`,Oj=j.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=_j(n);return(0,M.jsx)(rj,{...i,...r,ref:t})});Oj.displayName=Dj;var kj=`DropdownMenuLabel`,Aj=j.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=_j(n);return(0,M.jsx)(ij,{...i,...r,ref:t})});Aj.displayName=kj;var jj=`DropdownMenuItem`,Mj=j.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=_j(n);return(0,M.jsx)(aj,{...i,...r,ref:t})});Mj.displayName=jj;var Nj=`DropdownMenuCheckboxItem`,Pj=j.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=_j(n);return(0,M.jsx)(oj,{...i,...r,ref:t})});Pj.displayName=Nj;var Fj=`DropdownMenuRadioGroup`,Ij=j.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=_j(n);return(0,M.jsx)(sj,{...i,...r,ref:t})});Ij.displayName=Fj;var Lj=`DropdownMenuRadioItem`,Rj=j.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=_j(n);return(0,M.jsx)(cj,{...i,...r,ref:t})});Rj.displayName=Lj;var zj=`DropdownMenuItemIndicator`,Bj=j.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=_j(n);return(0,M.jsx)(lj,{...i,...r,ref:t})});Bj.displayName=zj;var Vj=`DropdownMenuSeparator`,Hj=j.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=_j(n);return(0,M.jsx)(uj,{...i,...r,ref:t})});Hj.displayName=Vj;var Uj=`DropdownMenuArrow`,Wj=j.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=_j(n);return(0,M.jsx)(dj,{...i,...r,ref:t})});Wj.displayName=Uj;var Gj=`DropdownMenuSubTrigger`,Kj=j.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=_j(n);return(0,M.jsx)(fj,{...i,...r,ref:t})});Kj.displayName=Gj;var qj=`DropdownMenuSubContent`,Jj=j.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=_j(n);return(0,M.jsx)(pj,{...i,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});Jj.displayName=qj;var Yj=bj,Xj=Sj,Zj=wj,Qj=Ej,$j=Aj,eM=Mj,tM=Pj,nM=Rj,rM=Bj,iM=Hj,aM=Kj,oM=Jj,sM=Yj,cM=Xj,lM=j.forwardRef(({className:e,inset:t,children:n,...r},i)=>(0,M.jsxs)(aM,{ref:i,className:Z(`flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0`,t&&`pl-8`,e),...r,children:[n,(0,M.jsx)(Cy,{className:`ml-auto`})]}));lM.displayName=aM.displayName;var uM=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(oM,{ref:n,className:Z(`z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,e),...t}));uM.displayName=oM.displayName;var dM=j.forwardRef(({className:e,sideOffset:t=4,...n},r)=>(0,M.jsx)(Zj,{children:(0,M.jsx)(Qj,{ref:r,sideOffset:t,className:Z(`z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,e),...n})}));dM.displayName=Qj.displayName;var fM=j.forwardRef(({className:e,inset:t,...n},r)=>(0,M.jsx)(eM,{ref:r,className:Z(`relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0`,t&&`pl-8`,e),...n}));fM.displayName=eM.displayName;var pM=j.forwardRef(({className:e,children:t,checked:n,...r},i)=>(0,M.jsxs)(tM,{ref:i,className:Z(`relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,e),checked:n,...r,children:[(0,M.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,M.jsx)(rM,{children:(0,M.jsx)(xy,{className:`h-4 w-4`})})}),t]}));pM.displayName=tM.displayName;var mM=j.forwardRef(({className:e,children:t,...n},r)=>(0,M.jsxs)(nM,{ref:r,className:Z(`relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,e),...n,children:[(0,M.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,M.jsx)(rM,{children:(0,M.jsx)(ky,{className:`h-2 w-2 fill-current`})})}),t]}));mM.displayName=nM.displayName;var hM=j.forwardRef(({className:e,inset:t,...n},r)=>(0,M.jsx)($j,{ref:r,className:Z(`px-2 py-1.5 text-sm font-semibold`,t&&`pl-8`,e),...n}));hM.displayName=$j.displayName;var gM=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(iM,{ref:n,className:Z(`-mx-1 my-1 h-px bg-muted`,e),...t}));gM.displayName=iM.displayName;var _M=({className:e,...t})=>(0,M.jsx)(`span`,{className:Z(`ml-auto text-xs tracking-widest opacity-60`,e),...t});_M.displayName=`DropdownMenuShortcut`;var vM=`modulepreload`,yM=function(e){return`/_account/`+e},bM={},xM=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}r=o(t.map(t=>{if(t=yM(t,n),t in bM)return;bM[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:vM,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},SM=[`en`,`zh-CN`],CM={en:()=>xM(()=>import(`./en-QM3gmMOi.js`),[]),"zh-CN":()=>xM(()=>import(`./zh-CN-B0Jn4kQl.js`),[])};function wM(e){return SM.includes(e)?e:e.toLowerCase().startsWith(`zh`)?`zh-CN`:`en`}async function TM(e){let t=wM(e);try{return(await CM[t]()).default}catch(t){return console.warn(`[account/i18n] Failed to load language pack '${e}':`,t),{}}}var EM={en:`English`,"zh-CN":`中文`};function DM(){let{t:e,language:t,changeLanguage:n}=vt();async function r(e){await n(e);try{localStorage.setItem(`account.lang`,e)}catch{}}return(0,M.jsxs)(sM,{children:[(0,M.jsx)(cM,{asChild:!0,children:(0,M.jsxs)(Q,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,"aria-label":e(`common.language`),children:[(0,M.jsx)(Ry,{className:`h-4 w-4`}),(0,M.jsx)(`span`,{className:`sr-only`,children:e(`common.language`)})]})}),(0,M.jsx)(dM,{align:`end`,children:SM.map(e=>(0,M.jsx)(fM,{onSelect:()=>void r(e),className:e===t?`font-medium`:void 0,children:EM[e]},e))})]})}function OM(e){let t=document.documentElement;e===`dark`?t.classList.add(`dark`):t.classList.remove(`dark`)}function kM(){let{t:e}=vt(),[,t]=(0,j.useState)(`light`);(0,j.useEffect)(()=>{let e=localStorage.getItem(`theme`);e?(t(e),OM(e===`system`?window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:e)):(t(`system`),OM(window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`))},[]);function n(e){t(e),localStorage.setItem(`theme`,e),OM(e===`system`?window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:e)}return(0,M.jsxs)(sM,{children:[(0,M.jsx)(cM,{asChild:!0,children:(0,M.jsxs)(Q,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,children:[(0,M.jsx)(eb,{className:`h-4 w-4 rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0`}),(0,M.jsx)(Gy,{className:`absolute h-4 w-4 rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100`}),(0,M.jsx)(`span`,{className:`sr-only`,children:e(`common.toggleTheme`)})]})}),(0,M.jsxs)(dM,{align:`end`,children:[(0,M.jsxs)(fM,{onClick:()=>n(`light`),children:[(0,M.jsx)(eb,{className:`mr-2 h-4 w-4`}),e(`common.light`)]}),(0,M.jsxs)(fM,{onClick:()=>n(`dark`),children:[(0,M.jsx)(Gy,{className:`mr-2 h-4 w-4`}),e(`common.dark`)]}),(0,M.jsx)(fM,{onClick:()=>n(`system`),children:e(`common.system`)})]})]})}function AM(e,t=[]){let n=[];function r(t,r){let i=j.createContext(r);i.displayName=t+`Context`;let a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=j.useMemo(()=>o,Object.values(o));return(0,M.jsx)(s.Provider,{value:c,children:r})};o.displayName=t+`Provider`;function s(n,o){let s=o?.[e]?.[a]||i,c=j.useContext(s);if(c)return c;if(r!==void 0)return r;throw Error(`\`${n}\` must be used within \`${t}\``)}return[o,s]}let i=()=>{let t=n.map(e=>j.createContext(e));return function(n){let r=n?.[e]||t;return j.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,jM(i,...t)]}function jM(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return j.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}function MM(){return(0,ot.useSyncExternalStore)(NM,()=>!0,()=>!1)}function NM(){return()=>{}}var PM=`Avatar`,[FM,IM]=AM(PM),[LM,RM]=FM(PM),zM=j.forwardRef((e,t)=>{let{__scopeAvatar:n,...r}=e,[i,a]=j.useState(`idle`);return(0,M.jsx)(LM,{scope:n,imageLoadingStatus:i,onImageLoadingStatusChange:a,children:(0,M.jsx)(sS.span,{...r,ref:t})})});zM.displayName=PM;var BM=`AvatarImage`,VM=j.forwardRef((e,t)=>{let{__scopeAvatar:n,src:r,onLoadingStatusChange:i=()=>{},...a}=e,o=RM(BM,n),s=GM(r,a),c=A_(e=>{i(e),o.onImageLoadingStatusChange(e)});return q_(()=>{s!==`idle`&&c(s)},[s,c]),s===`loaded`?(0,M.jsx)(sS.img,{...a,ref:t,src:r}):null});VM.displayName=BM;var HM=`AvatarFallback`,UM=j.forwardRef((e,t)=>{let{__scopeAvatar:n,delayMs:r,...i}=e,a=RM(HM,n),[o,s]=j.useState(r===void 0);return j.useEffect(()=>{if(r!==void 0){let e=window.setTimeout(()=>s(!0),r);return()=>window.clearTimeout(e)}},[r]),o&&a.imageLoadingStatus!==`loaded`?(0,M.jsx)(sS.span,{...i,ref:t}):null});UM.displayName=HM;function WM(e,t){return e?t?(e.src!==t&&(e.src=t),e.complete&&e.naturalWidth>0?`loaded`:`loading`):`error`:`idle`}function GM(e,{referrerPolicy:t,crossOrigin:n}){let r=MM(),i=j.useRef(null),a=r?(i.current||=new window.Image,i.current):null,[o,s]=j.useState(()=>WM(a,e));return q_(()=>{s(WM(a,e))},[a,e]),q_(()=>{let e=e=>()=>{s(e)};if(!a)return;let r=e(`loaded`),i=e(`error`);return a.addEventListener(`load`,r),a.addEventListener(`error`,i),t&&(a.referrerPolicy=t),typeof n==`string`&&(a.crossOrigin=n),()=>{a.removeEventListener(`load`,r),a.removeEventListener(`error`,i)}},[a,n,t]),o}var KM=zM,qM=VM,JM=UM,YM=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(KM,{ref:n,className:Z(`relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full`,e),...t}));YM.displayName=KM.displayName;var XM=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(qM,{ref:n,className:Z(`aspect-square h-full w-full`,e),...t}));XM.displayName=qM.displayName;var ZM=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(JM,{ref:n,className:Z(`flex h-full w-full items-center justify-center rounded-full bg-muted`,e),...t}));ZM.displayName=JM.displayName;var QM=(0,j.createContext)(null),$M=`auth-session-token`,eN=`auth-active-organization-id`;function tN(e){if(!(typeof window>`u`))try{e?.token?localStorage.setItem($M,e.token):localStorage.removeItem($M),e?.activeOrganizationId?localStorage.setItem(eN,e.activeOrganizationId):localStorage.removeItem(eN)}catch{}}function nN(e){if(!e)return{user:null,session:null};let t=e.data===void 0?e:e.data;return t?{user:t.user??null,session:t.session??null}:{user:null,session:null}}function rN({children:e}){let t=n_(),[n,r]=(0,j.useState)(null),[i,a]=(0,j.useState)(null),[o,s]=(0,j.useState)(!0),[c,l]=(0,j.useState)(null),[u,d]=(0,j.useState)([]),[f,p]=(0,j.useState)(!1),[m,h]=(0,j.useState)(!1),[g,_]=(0,j.useState)(null);(0,j.useEffect)(()=>{if(!t?.auth?.getConfig)return;let e=!1;return t.auth.getConfig().then(t=>{if(e)return;let n=t?.data??t??{},r={...n.features??{}};n.emailPassword?.disableSignUp===!0&&(r.signUpDisabled=!0),_(r)}).catch(()=>{e||_(null)}),()=>{e=!0}},[t]);let v=(0,j.useCallback)(async()=>{if(t?.organizations){p(!0);try{d((await t.organizations.list())?.organizations??[])}catch{d([])}finally{p(!1),h(!0)}}},[t]),y=(0,j.useCallback)(async()=>{if(t?.auth){s(!0),l(null);try{let{user:e,session:n}=nN(await t.auth.me());r(e),a(n),tN(e?n:null)}catch(e){l(e),r(null),a(null),tN(null)}finally{s(!1)}}},[t]);(0,j.useEffect)(()=>{y()},[y]),(0,j.useEffect)(()=>{n?v():(d([]),h(!1))},[n,v]);let b=(0,j.useCallback)(async()=>{if(t?.auth)try{await t.auth.logout()}finally{r(null),a(null),d([]),h(!1),tN(null)}},[t]),x=(0,j.useCallback)(async e=>{if(t?.organizations){await t.organizations.setActive(e),await y();try{localStorage.setItem(eN,e)}catch{}}},[t,y]),S=(0,j.useMemo)(()=>({user:n,session:i,loading:o,error:c,refresh:y,logout:b,setActiveOrganization:x,organizations:u,organizationsLoading:f,organizationsFetched:m,reloadOrganizations:v,features:g}),[n,i,o,c,y,b,x,u,f,m,v,g]);return(0,j.createElement)(QM.Provider,{value:S},e)}function iN(){let e=(0,j.useContext)(QM);if(!e)throw Error(`useSession must be used inside <SessionProvider>.`);return e}function aN(){let{organizations:e,organizationsLoading:t,reloadOrganizations:n}=iN();return{organizations:e,loading:t,error:null,reload:n}}function oN(){let e=n_(),[t,n]=(0,j.useState)(!1),[r,i]=(0,j.useState)(null);return{create:(0,j.useCallback)(async t=>{if(!e?.organizations)throw Error(`Client not ready`);n(!0),i(null);try{return await e.organizations.create(t)}catch(e){throw i(e),e}finally{n(!1)}},[e]),creating:t,error:r}}function sN(){let e=n_(),{reloadOrganizations:t,refresh:n}=iN(),[r,i]=(0,j.useState)(!1),[a,o]=(0,j.useState)(null);return{update:(0,j.useCallback)(async(r,a)=>{if(!e?.organizations?.update)throw Error(`Client not ready`);i(!0),o(null);try{let i=await e.organizations.update(r,a);return await t(),await n(),i}catch(e){throw o(e),e}finally{i(!1)}},[e,t,n]),updating:r,error:a}}function cN(){let e=n_(),{reloadOrganizations:t,refresh:n}=iN(),[r,i]=(0,j.useState)(!1),[a,o]=(0,j.useState)(null);return{remove:(0,j.useCallback)(async r=>{if(!e?.organizations?.delete)throw Error(`Client not ready`);i(!0),o(null);try{let i=await e.organizations.delete(r);return await t(),await n(),i}catch(e){throw o(e),e}finally{i(!1)}},[e,t,n]),deleting:r,error:a}}function lN({message:e}){return typeof document>`u`?null:(0,Gi.createPortal)((0,M.jsx)(`div`,{role:`status`,"aria-live":`polite`,className:`fixed inset-0 z-[100] flex items-center justify-center bg-background/80 backdrop-blur-sm`,children:(0,M.jsxs)(`div`,{className:`flex flex-col items-center gap-3 text-sm text-muted-foreground`,children:[(0,M.jsx)(`div`,{className:`size-8 animate-spin rounded-full border-2 border-muted-foreground border-t-transparent`}),(0,M.jsx)(`span`,{children:e})]})}),document.body)}function uN(e,t){let n=(e||t||`?`).trim(),r=n.split(/\s+/);return r.length>=2?(r[0][0]+r[1][0]).toUpperCase():n.slice(0,2).toUpperCase()}function dN(){let{t:e}=vt(),t=Hi(),{user:n,loading:r,logout:i}=iN(),[a,o]=(0,j.useState)(!1);return r&&!n?(0,M.jsx)(`div`,{className:`h-8 w-8 animate-pulse rounded-full bg-muted`,"aria-hidden":!0}):n?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(sM,{children:[(0,M.jsx)(cM,{asChild:!0,children:(0,M.jsx)(Q,{variant:`ghost`,size:`icon`,className:`h-8 w-8 rounded-full`,children:(0,M.jsxs)(YM,{className:`h-7 w-7`,children:[n.image?(0,M.jsx)(XM,{src:n.image,alt:n.name??n.email??e(`userMenu.user`)}):null,(0,M.jsx)(ZM,{className:`text-[11px]`,children:uN(n.name,n.email)})]})})}),(0,M.jsxs)(dM,{align:`end`,className:`w-64`,children:[(0,M.jsx)(hM,{children:(0,M.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,M.jsx)(`span`,{className:`truncate text-sm font-medium`,children:n.name||n.email}),n.email&&(0,M.jsx)(`span`,{className:`truncate text-[11px] text-muted-foreground`,children:n.email})]})}),(0,M.jsx)(gM,{}),(0,M.jsxs)(fM,{onSelect:()=>t({to:`/account`}),children:[(0,M.jsx)(cb,{className:`mr-2 h-3.5 w-3.5`}),e(`userMenu.account`)]}),(0,M.jsxs)(fM,{onSelect:()=>t({to:`/organizations`}),children:[(0,M.jsx)(by,{className:`mr-2 h-3.5 w-3.5`}),e(`userMenu.organizations`)]}),(0,M.jsx)(gM,{}),(0,M.jsxs)(fM,{onSelect:async()=>{o(!0);try{await i()}finally{window.location.assign(`/_account/login`)}},disabled:a,children:[(0,M.jsx)(Vy,{className:`mr-2 h-3.5 w-3.5`}),e(`userMenu.signOut`)]})]})]}),a?(0,M.jsx)(lN,{message:e(`auth.userMenu.signingOut`,{defaultValue:`Signing you out…`})}):null]}):(0,M.jsx)(Q,{variant:`outline`,size:`sm`,className:`h-8`,onClick:()=>t({to:`/login`}),children:e(`userMenu.signIn`)})}function fN(){let{t:e}=vt(),t=Hi(),n=Oa(),{organizations:r,loading:i,reload:a}=aN(),{session:o,setActiveOrganization:s}=iN(),[c,l]=(0,j.useState)(!1),[u,d]=(0,j.useState)(!1),f=o?.activeOrganizationId??void 0,p=(0,j.useMemo)(()=>r.find(e=>e.id===f)??null,[r,f]),m=async r=>{if(l(!1),r===f){t({to:`/organizations/$orgId/general`,params:{orgId:r}});return}d(!0);try{await s(r),await a(),q({title:e(`organizations.general.switched`)});let i=n.pathname.match(/^\/organizations\/[^/]+\/(general|members)\/?$/);t({to:(i?i[1]:`general`)===`members`?`/organizations/$orgId/members`:`/organizations/$orgId/general`,params:{orgId:r}})}catch(t){q({title:e(`organizations.switchFailed`),description:t.message,variant:`destructive`})}finally{d(!1)}};return(0,M.jsxs)(sM,{open:c,onOpenChange:l,children:[(0,M.jsx)(cM,{asChild:!0,children:(0,M.jsxs)(Q,{variant:`ghost`,size:`sm`,className:`h-8 gap-2 px-2 text-sm font-medium`,disabled:u,children:[p?(0,M.jsx)(`span`,{className:`max-w-[160px] truncate`,children:p.name}):(0,M.jsx)(`span`,{className:`text-muted-foreground`,children:e(i?`organizations.loading`:`organizationSwitcher.select`)}),(0,M.jsx)(Ty,{className:`h-3 w-3 opacity-50`})]})}),(0,M.jsxs)(dM,{align:`start`,className:`w-[280px]`,sideOffset:4,children:[(0,M.jsx)(hM,{className:`text-[10px] uppercase tracking-wider text-muted-foreground`,children:e(`organizations.title`)}),r.length===0&&!i&&(0,M.jsx)(`div`,{className:`px-3 py-4 text-center text-xs text-muted-foreground`,children:e(`organizations.emptyTitle`)}),r.map(e=>(0,M.jsxs)(fM,{onSelect:t=>{t.preventDefault(),m(e.id)},className:`flex items-center gap-2`,children:[(0,M.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,M.jsx)(`div`,{className:`truncate font-medium`,children:e.name}),e.slug&&(0,M.jsx)(`code`,{className:`text-[11px] text-muted-foreground font-mono`,children:e.slug})]}),e.id===f&&(0,M.jsx)(xy,{className:`h-3.5 w-3.5 text-primary`})]},e.id)),(0,M.jsx)(gM,{}),(0,M.jsxs)(fM,{onSelect:e=>{e.preventDefault(),l(!1),t({to:`/organizations/new`})},className:`gap-2 text-sm`,children:[(0,M.jsx)(qy,{className:`h-3.5 w-3.5`}),e(`organizationSwitcher.new`)]}),(0,M.jsx)(fM,{onSelect:e=>{e.preventDefault(),l(!1),t({to:`/organizations`})},className:`gap-2 text-sm text-muted-foreground`,children:e(`organizationSwitcher.manage`)})]})]})}function pN({label:e}){return(0,M.jsx)(`a`,{href:`/`,className:`flex h-8 w-8 items-center justify-center rounded-md bg-brand-gradient text-primary-foreground shadow-sm shadow-primary/30 ring-1 ring-white/15 transition-transform hover:scale-105`,"aria-label":e,children:(0,M.jsx)(Dy,{className:`h-4 w-4`})})}function mN(){return(0,M.jsx)(Cy,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-muted-foreground/50`})}function hN(){let{t:e}=vt(),t=Oa(),n=Bi({strict:!1}),r=(0,j.useMemo)(()=>{let r=t.pathname,i=t=>e(`topBar.breadcrumb.${t}`);if(r.startsWith(`/account`)){let e=[{label:i(`account`)}];return r===`/account/profile`?e.push({label:i(`profile`)}):r===`/account/security`?e.push({label:i(`security`)}):r===`/account/sessions`?e.push({label:i(`sessions`)}):r===`/account/two-factor`?e.push({label:i(`twoFactor`)}):r===`/account/oauth-applications`?e.push({label:i(`oauthApps`)}):r===`/account/oauth-applications/new`?e.push({label:i(`oauthApps`)},{label:i(`new`)}):r.startsWith(`/account/oauth-applications/`)&&e.push({label:i(`oauthApps`)}),e}if(r===`/organizations/new`)return[{label:i(`organizations`)},{label:i(`new`)}];if(n.orgId){let e=r.endsWith(`/general`)?i(`general`):r.endsWith(`/members`)?i(`members`):i(`settings`);return[{label:i(`organizations`)},{label:e}]}return r===`/organizations`||r.startsWith(`/organizations/`)?[{label:i(`organizations`)}]:r.startsWith(`/accept-invitation/`)?[{label:i(`acceptInvitation`)}]:r.startsWith(`/auth/device`)?[{label:i(`deviceAuthorization`)}]:[{label:i(`account`)}]},[t.pathname,n.orgId,e]);return(0,M.jsxs)(`header`,{className:`sticky top-0 z-30 flex h-14 shrink-0 items-center justify-between gap-2 border-b bg-background/80 px-2 backdrop-blur supports-[backdrop-filter]:bg-background/70 sm:px-4`,children:[(0,M.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 sm:gap-2.5`,children:[(0,M.jsx)(`div`,{className:`sm:hidden`,children:(0,M.jsx)(PO,{className:`h-9 w-9`})}),(0,M.jsx)(pN,{label:e(`topBar.accountHome`)}),(0,M.jsx)(`span`,{className:`hidden text-sm font-semibold tracking-tight sm:inline`,children:e(`topBar.brand`)}),(0,M.jsxs)(`div`,{className:`hidden items-center gap-1.5 sm:flex`,children:[(0,M.jsx)(mS,{orientation:`vertical`,className:`mx-1 h-4`}),(0,M.jsx)(fN,{}),(0,M.jsx)(mN,{}),(0,M.jsx)(rk,{children:(0,M.jsx)(ik,{children:r.map((e,t)=>(0,M.jsxs)(`div`,{className:`flex items-center`,children:[t>0&&(0,M.jsx)(ck,{}),(0,M.jsx)(ak,{children:(0,M.jsx)(sk,{className:`font-medium`,children:e.label})})]},t))})})]}),(0,M.jsx)(`div`,{className:`min-w-0 flex-1 sm:hidden`,children:r.length>0&&(0,M.jsx)(`span`,{className:`truncate text-sm font-medium`,children:r[r.length-1].label})})]}),(0,M.jsxs)(`div`,{className:`flex items-center gap-1 sm:gap-2`,children:[(0,M.jsx)(`div`,{className:`hidden sm:block`,children:(0,M.jsx)(DM,{})}),(0,M.jsx)(`div`,{className:`hidden sm:block`,children:(0,M.jsx)(kM,{})}),(0,M.jsx)(dN,{})]})]})}var gN=[{to:`/account`,label:`home`,icon:Fy,exact:!0},{to:`/account/profile`,label:`profile`,icon:cb},{to:`/account/security`,label:`security`,icon:Qy},{to:`/account/sessions`,label:`sessions`,icon:Wy},{to:`/account/two-factor`,label:`twoFactor`,icon:Zy},{to:`/account/invitations`,label:`invitations`,icon:Iy},{to:`/account/linked-accounts`,label:`linkedAccounts`,icon:By}],_N=[`group/nav relative transition-all duration-150`,`before:absolute before:left-0 before:top-1/2 before:h-5 before:w-[3px] before:-translate-y-1/2 before:rounded-r-full before:bg-brand-gradient before:opacity-0 before:transition-opacity`,`data-[active=true]:before:opacity-100`,`data-[active=true]:bg-sidebar-accent/80 data-[active=true]:text-sidebar-accent-foreground`,`[&>svg]:transition-transform [&>svg]:duration-150 hover:[&>svg]:scale-110`,`data-[active=true]:[&>svg]:text-primary`].join(` `);function vN(){let{t:e}=vt(),{pathname:t}=Oa(),{organizations:n}=aN(),r=t,i=t.match(/^\/organizations\/([^/]+)(?:\/.*)?$/),a=i&&n.some(e=>e.id===i[1])?i[1]:null;return(0,M.jsxs)(NO,{collapsible:`icon`,className:`h-full`,children:[(0,M.jsxs)(VO,{children:[(0,M.jsxs)(HO,{children:[(0,M.jsx)(UO,{children:e(`sidebar.groups.account`)}),(0,M.jsx)(GO,{children:(0,M.jsx)(KO,{children:gN.map(t=>{let n=t.icon;return(0,M.jsx)(qO,{children:(0,M.jsx)(JO,{asChild:!0,isActive:t.exact?r===t.to||r===`${t.to}/`:r===t.to||r.startsWith(`${t.to}/`),tooltip:e(`sidebar.items.${t.label}`),className:_N,children:(0,M.jsxs)(ra,{to:t.to,children:[(0,M.jsx)(n,{className:`size-4`}),(0,M.jsx)(`span`,{children:e(`sidebar.items.${t.label}`)})]})})},t.to)})})})]}),(0,M.jsx)(BO,{}),(0,M.jsxs)(HO,{children:[(0,M.jsx)(UO,{children:e(`sidebar.groups.organization`)}),(0,M.jsx)(GO,{children:(0,M.jsxs)(KO,{children:[(0,M.jsx)(qO,{children:(0,M.jsx)(JO,{asChild:!0,isActive:t===`/organizations`,tooltip:e(`sidebar.items.overview`),className:_N,children:(0,M.jsxs)(ra,{to:`/organizations`,children:[(0,M.jsx)(by,{className:`size-4`}),(0,M.jsx)(`span`,{children:e(`sidebar.items.overview`)})]})})}),a&&(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(qO,{children:(0,M.jsx)(JO,{asChild:!0,isActive:t===`/organizations/${a}/general`,tooltip:e(`sidebar.items.general`),className:_N,children:(0,M.jsxs)(ra,{to:`/organizations/$orgId/general`,params:{orgId:a},children:[(0,M.jsx)(Xy,{className:`size-4`}),(0,M.jsx)(`span`,{children:e(`sidebar.items.general`)})]})})}),(0,M.jsx)(qO,{children:(0,M.jsx)(JO,{asChild:!0,isActive:t===`/organizations/${a}/members`,tooltip:e(`sidebar.items.members`),className:_N,children:(0,M.jsxs)(ra,{to:`/organizations/$orgId/members`,params:{orgId:a},children:[(0,M.jsx)(lb,{className:`size-4`}),(0,M.jsx)(`span`,{children:e(`sidebar.items.members`)})]})})}),(0,M.jsx)(qO,{children:(0,M.jsx)(JO,{asChild:!0,isActive:t===`/organizations/${a}/teams`,tooltip:e(`sidebar.items.teams`),className:_N,children:(0,M.jsxs)(ra,{to:`/organizations/$orgId/teams`,params:{orgId:a},children:[(0,M.jsx)(sb,{className:`size-4`}),(0,M.jsx)(`span`,{children:e(`sidebar.items.teams`)})]})})})]})]})})]}),(0,M.jsx)(BO,{}),(0,M.jsxs)(HO,{children:[(0,M.jsx)(UO,{children:e(`sidebar.groups.developer`)}),(0,M.jsx)(GO,{children:(0,M.jsx)(KO,{children:(0,M.jsx)(qO,{children:(0,M.jsx)(JO,{asChild:!0,isActive:t.startsWith(`/account/oauth-applications`),tooltip:e(`sidebar.items.oauthApps`),className:_N,children:(0,M.jsxs)(ra,{to:`/account/oauth-applications`,children:[(0,M.jsx)(Ly,{className:`size-4`}),(0,M.jsx)(`span`,{children:e(`sidebar.items.oauthApps`)})]})})})})})]})]}),(0,M.jsx)(zO,{children:(0,M.jsx)(KO,{children:(0,M.jsx)(qO,{children:(0,M.jsx)(yN,{})})})})]})}function yN(){let{t:e}=vt(),{state:t,toggleSidebar:n}=jO(),r=e(t===`collapsed`?`sidebar.expand`:`sidebar.collapse`);return(0,M.jsx)(JO,{onClick:n,tooltip:r,"aria-label":r,children:(0,M.jsx)(Ky,{className:`size-4`})})}function bN(){return typeof window<`u`&&window.location.pathname.startsWith(`/_account`)?window.location.origin:`http://localhost:3000`}var xN=new Set([`/login`,`/register`,`/forgot-password`,`/reset-password`,`/verify-email`,`/verify-email-prompt`,`/auth/device`,`/setup`]);function SN(e){return xN.has(e)||e.startsWith(`/accept-invitation/`)}function CN(){let[e,t]=(0,j.useState)(null);return(0,j.useEffect)(()=>{let e=!1;return(async()=>{try{let n=await fetch(`/api/v1/auth/bootstrap-status`);if(!n.ok){e||t(!0);return}let r=await n.json();e||t(r.hasOwner!==!1)}catch{e||t(!0)}})(),()=>{e=!0}},[]),e}function wN({children:e}){let{user:t,loading:n}=iN(),r=Hi(),i=Oa(),a=SN(i.pathname),o=i.pathname.startsWith(`/oauth/`)||i.pathname===`/organizations/new`,s=CN(),c=i.pathname===`/setup`;return(0,j.useEffect)(()=>{s===!1&&!c&&!t&&r({to:`/setup`,replace:!0})},[s,c,t,r]),(0,j.useEffect)(()=>{n||s!==!1&&!t&&!a&&r({to:`/login`,search:{redirect:i.pathname+i.searchStr},replace:!0})},[t,n,a,r,i.pathname,i.searchStr,s]),s===null||n&&!t?(0,M.jsx)(`div`,{className:`flex min-h-screen w-full flex-1 items-center justify-center bg-background`,children:(0,M.jsx)(`div`,{className:`h-8 w-8 animate-spin rounded-full border-4 border-muted border-t-primary`})}):s===!1&&!c||!t&&!a?null:a||o?(0,M.jsx)(`div`,{className:`flex min-h-screen w-full`,children:e}):(0,M.jsxs)(MO,{className:`flex h-svh w-full flex-col`,children:[(0,M.jsx)(hN,{}),(0,M.jsxs)(`div`,{className:`flex min-h-0 flex-1 w-full`,children:[(0,M.jsx)(vN,{}),(0,M.jsx)(IO,{className:`flex min-w-0 flex-1 flex-col overflow-hidden`,children:(0,M.jsx)(`main`,{className:`flex min-h-0 flex-1 flex-col overflow-auto bg-background`,children:e})})]})]})}function TN(){let e=bN(),t=(0,j.useMemo)(()=>new Zg({baseUrl:e}),[e]),{language:n}=vt();return(0,M.jsx)(t_,{client:t,locale:n,children:(0,M.jsxs)(rN,{children:[(0,M.jsx)(wN,{children:(0,M.jsx)(ya,{})}),(0,M.jsx)(Gx,{})]})})}var EN=ca({component:TN}),$=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`div`,{ref:n,className:Z(`rounded-lg border bg-card text-card-foreground shadow-sm`,e),...t}));$.displayName=`Card`;var DN=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`div`,{ref:n,className:Z(`flex flex-col space-y-1.5 p-6`,e),...t}));DN.displayName=`CardHeader`;var ON=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`h3`,{ref:n,className:Z(`text-2xl font-semibold leading-none tracking-tight`,e),...t}));ON.displayName=`CardTitle`;var kN=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`p`,{ref:n,className:Z(`text-sm text-muted-foreground`,e),...t}));kN.displayName=`CardDescription`;var AN=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`div`,{ref:n,className:Z(`p-6 pt-0`,e),...t}));AN.displayName=`CardContent`;var jN=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`div`,{ref:n,className:Z(`flex items-center p-6 pt-0`,e),...t}));jN.displayName=`CardFooter`;function MN(e){let t=e.split(`:`)[0].toLowerCase();return/^cloud\./.test(t)}function NN(){return typeof window>`u`?null:window.location.host||null}function PN({children:e,formWidth:t=`sm`}){let{t:n}=vt(),r=t===`md`?`max-w-md`:`max-w-sm`,i=NN(),a=!!i&&!MN(i);return j.useEffect(()=>{if(typeof document>`u`||!i)return;let e=document.title;return a&&(document.title=i),()=>{document.title=e}},[i,a]),(0,M.jsx)(`div`,{className:`flex min-h-svh w-full items-center justify-center bg-muted p-6`,children:(0,M.jsxs)(`div`,{className:Z(`flex w-full flex-col gap-4`,r),children:[a?(0,M.jsx)(`div`,{className:`flex justify-center`,children:(0,M.jsx)(`span`,{className:`rounded-full border border-border/60 bg-background/60 px-2 py-0.5 font-mono text-[10px] uppercase tracking-wide text-muted-foreground`,title:n(`auth.shell.tenantHostHint`,{defaultValue:`You are signing in to this workspace`}),children:i})}):null,e]})})}var FN=la(`/verify-email-prompt`)({validateSearch:e=>({email:typeof e.email==`string`?e.email:void 0,redirect:typeof e.redirect==`string`?e.redirect:void 0}),component:IN});function IN(){let{t:e}=vt(),t=Hi(),{email:n,redirect:r}=FN.useSearch(),i=n_(),[a,o]=(0,j.useState)(!1),[s,c]=(0,j.useState)(!1);return(0,M.jsx)(PN,{children:(0,M.jsx)(`div`,{className:`flex flex-col gap-6`,children:(0,M.jsxs)($,{className:`border-border/60 shadow-sm shadow-primary/5 backdrop-blur supports-[backdrop-filter]:bg-card/95`,children:[(0,M.jsxs)(DN,{className:`text-center`,children:[(0,M.jsx)(`div`,{className:`mx-auto mb-4 flex size-16 items-center justify-center rounded-full bg-primary/10`,children:(0,M.jsx)(Hy,{className:`size-8 text-primary`})}),(0,M.jsx)(ON,{className:`text-xl tracking-tight`,children:e(`auth.verifyEmail.title`,{defaultValue:`Verify your email address`})}),(0,M.jsx)(kN,{children:e(`auth.verifyEmail.description`,{defaultValue:`We sent a verification link to your email address. Please click the link to verify your account.`})})]}),(0,M.jsx)(AN,{children:(0,M.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[n?(0,M.jsxs)(`p`,{className:`text-center text-sm text-muted-foreground`,children:[e(`auth.verifyEmail.sentTo`,{defaultValue:`Sent to:`}),` `,(0,M.jsx)(`span`,{className:`font-medium text-foreground`,children:n})]}):null,(0,M.jsx)(Q,{onClick:async()=>{if(!n||!i?.auth){q({title:e(`auth.verifyEmail.resendFailed`,{defaultValue:`Cannot resend verification email`}),description:e(`auth.verifyEmail.emailMissing`,{defaultValue:`Email address is missing`}),variant:`destructive`});return}o(!0);try{let t=await fetch(`/api/v1/auth/send-verification-email`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({email:n,callbackURL:r||`/`})});if(!t.ok){let e=await t.json().catch(()=>({message:`Unknown error`}));throw Error(e.message||`Failed to send verification email`)}c(!0),q({title:e(`auth.verifyEmail.resentSuccess`,{defaultValue:`Verification email sent!`}),description:e(`auth.verifyEmail.resentDescription`,{defaultValue:`Please check your inbox and click the verification link.`})})}catch(t){q({title:e(`auth.verifyEmail.resendFailed`,{defaultValue:`Failed to resend verification email`}),description:t.message,variant:`destructive`})}finally{o(!1)}},disabled:a||s,className:`w-full`,variant:s?`outline`:`default`,children:a?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(Jy,{className:`mr-2 size-4 animate-spin`}),e(`auth.verifyEmail.resending`,{defaultValue:`Sending...`})]}):s?e(`auth.verifyEmail.resent`,{defaultValue:`Email sent! Check your inbox`}):(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(Jy,{className:`mr-2 size-4`}),e(`auth.verifyEmail.resendButton`,{defaultValue:`Resend verification email`})]})}),(0,M.jsxs)(`div`,{className:`relative`,children:[(0,M.jsx)(`div`,{className:`absolute inset-0 flex items-center`,children:(0,M.jsx)(`span`,{className:`w-full border-t`})}),(0,M.jsx)(`div`,{className:`relative flex justify-center text-xs uppercase`,children:(0,M.jsx)(`span`,{className:`bg-card px-2 text-muted-foreground`,children:e(`auth.verifyEmail.or`,{defaultValue:`Or`})})})]}),(0,M.jsx)(Q,{onClick:()=>{t({to:`/login`,search:r?{redirect:r}:void 0})},variant:`ghost`,className:`w-full`,children:e(`auth.verifyEmail.backToLogin`,{defaultValue:`Back to login`})}),(0,M.jsx)(`p`,{className:`text-center text-xs text-muted-foreground`,children:e(`auth.verifyEmail.checkSpam`,{defaultValue:`Didn't receive the email? Check your spam folder or contact support.`})})]})})]})})})}var LN=la(`/verify-email`)({validateSearch:e=>{let t=e.token;return typeof t==`string`?{token:t}:{}},component:RN});function RN(){let{t:e}=vt(),{token:t}=LN.useSearch(),n=n_(),[r,i]=(0,j.useState)(`loading`),[a,o]=(0,j.useState)(``);return(0,j.useEffect)(()=>{if(!t){i(`error`),o(e(`auth.verifyEmail.missingToken`));return}let r=!1;return(async()=>{try{await n.auth.verifyEmail({token:t}),r||i(`success`)}catch(t){r||(i(`error`),o(t.message||e(`auth.verifyEmail.errorDescription`)))}})(),()=>{r=!0}},[t,e,n]),(0,M.jsx)(PN,{children:(0,M.jsxs)($,{className:`border-border/60 shadow-sm shadow-primary/5 backdrop-blur supports-[backdrop-filter]:bg-card/95`,children:[r===`loading`&&(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(DN,{className:`text-center`,children:[(0,M.jsx)(ON,{className:`text-xl tracking-tight`,children:e(`auth.verifyEmail.verifyingTitle`)}),(0,M.jsx)(kN,{children:e(`auth.verifyEmail.verifyingDescription`)})]}),(0,M.jsx)(AN,{className:`flex justify-center py-6`,children:(0,M.jsx)(`div`,{className:`h-10 w-10 animate-spin rounded-full border-4 border-muted border-t-primary`})})]}),r===`success`&&(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(DN,{className:`text-center`,children:[(0,M.jsx)(`div`,{className:`mx-auto mb-2 flex size-12 items-center justify-center rounded-full bg-emerald-500/10 text-emerald-500 ring-1 ring-emerald-500/30`,children:(0,M.jsx)(Ey,{className:`size-6`})}),(0,M.jsx)(ON,{className:`text-xl tracking-tight`,children:e(`auth.verifyEmail.successTitle`)}),(0,M.jsx)(kN,{children:e(`auth.verifyEmail.successDescription`)})]}),(0,M.jsx)(AN,{className:`text-center`,children:(0,M.jsx)(ra,{to:`/login`,className:`text-sm font-medium text-primary underline-offset-4 hover:underline`,children:e(`auth.verifyEmail.signInLink`)})})]}),r===`error`&&(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(DN,{className:`text-center`,children:[(0,M.jsx)(`div`,{className:`mx-auto mb-2 flex size-12 items-center justify-center rounded-full bg-destructive/10 text-destructive ring-1 ring-destructive/30`,children:(0,M.jsx)(Oy,{className:`size-6`})}),(0,M.jsx)(ON,{className:`text-xl tracking-tight`,children:e(`auth.verifyEmail.errorTitle`)}),(0,M.jsx)(kN,{children:a||e(`auth.verifyEmail.errorDescription`)})]}),(0,M.jsx)(AN,{className:`text-center`,children:(0,M.jsx)(ra,{to:`/login`,className:`text-sm font-medium text-primary underline-offset-4 hover:underline`,children:e(`auth.verifyEmail.backToSignIn`)})})]})]})})}var zN=`Label`,BN=j.forwardRef((e,t)=>(0,M.jsx)(sS.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));BN.displayName=zN;var VN=BN,HN=cy(`text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70`),UN=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(VN,{ref:n,className:Z(HN(),e),...t}));UN.displayName=VN.displayName;var WN=la(`/setup`)({component:KN});function GN(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)}function KN(){let{t:e}=vt(),t=Hi(),n=n_(),{user:r,refresh:i}=iN(),[a,o]=(0,j.useState)(``),[s,c]=(0,j.useState)(``),[l,u]=(0,j.useState)(``),[d,f]=(0,j.useState)(``),[p,m]=(0,j.useState)(!1),[h,g]=(0,j.useState)(null);return(0,j.useEffect)(()=>{let e=!1;return(async()=>{try{let{hasOwner:t}=await n.auth.bootstrapStatus();e||g(t)}catch{e||g(!1)}})(),()=>{e=!0}},[n]),(0,j.useEffect)(()=>{h===!0&&!r&&t({to:`/login`,replace:!0})},[h,r,t]),(0,j.useEffect)(()=>{r&&window.location.assign(`/`)},[r]),h===null?(0,M.jsx)(`div`,{className:`flex min-h-svh w-full items-center justify-center bg-muted`,children:(0,M.jsx)(`div`,{className:`h-8 w-8 animate-spin rounded-full border-4 border-muted-foreground/20 border-t-primary`})}):(0,M.jsx)(`div`,{className:`flex min-h-svh w-full items-center justify-center bg-muted p-6`,children:(0,M.jsx)(`div`,{className:`flex w-full max-w-md flex-col gap-6`,children:(0,M.jsxs)($,{children:[(0,M.jsxs)(DN,{className:`text-center`,children:[(0,M.jsx)(ON,{children:e(`auth.setup.welcomeTitle`)}),(0,M.jsx)(kN,{children:e(`auth.setup.description`)})]}),(0,M.jsx)(AN,{children:(0,M.jsxs)(`form`,{onSubmit:async t=>{if(t.preventDefault(),n?.auth){m(!0);try{await n.auth.register({name:a,email:s,password:l}),await i();let e=d.trim();if(e)try{let{organizations:t}=await n.organizations.list(),r=t?.[0],i;if(r?.id)await n.organizations.update(r.id,{name:e,slug:GN(e)}),i=r.id;else{let t=await n.organizations.create({name:e,slug:GN(e)});i=t?.id??t?.data?.id}i&&await n.organizations.setActive(i).catch(()=>{})}catch(e){console.warn(`[setup] organization rename/create failed`,e)}window.location.assign(`/`)}catch(t){q({title:e(`auth.setup.failed`),description:t.message,variant:`destructive`})}finally{m(!1)}}},className:`flex flex-col gap-4`,children:[(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsx)(UN,{htmlFor:`name`,children:e(`auth.setup.yourName`)}),(0,M.jsx)(oS,{id:`name`,autoComplete:`name`,required:!0,value:a,onChange:e=>o(e.target.value)})]}),(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsx)(UN,{htmlFor:`orgName`,children:e(`auth.setup.orgName`)}),(0,M.jsx)(oS,{id:`orgName`,required:!0,placeholder:e(`auth.setup.orgNamePlaceholder`),value:d,onChange:e=>f(e.target.value)})]}),(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsx)(UN,{htmlFor:`email`,children:e(`auth.emailLabel`)}),(0,M.jsx)(oS,{id:`email`,type:`email`,placeholder:e(`auth.emailPlaceholder`),autoComplete:`email`,required:!0,value:s,onChange:e=>c(e.target.value)})]}),(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsx)(UN,{htmlFor:`password`,children:e(`auth.passwordLabel`)}),(0,M.jsx)(oS,{id:`password`,type:`password`,autoComplete:`new-password`,required:!0,minLength:8,placeholder:e(`auth.setup.passwordHint`),value:l,onChange:e=>u(e.target.value)})]}),(0,M.jsx)(Q,{type:`submit`,className:`mt-2 w-full`,disabled:p,children:e(p?`auth.setup.submitting`:`auth.setup.submit`)})]})})]})})})}var qN=la(`/reset-password`)({validateSearch:e=>{let t=e.token;return typeof t==`string`?{token:t}:{}},component:JN});function JN(){let{t:e}=vt(),t=Hi(),{token:n}=qN.useSearch(),[r,i]=(0,j.useState)(``),[a,o]=(0,j.useState)(``),[s,c]=(0,j.useState)(!1);return(0,M.jsx)(PN,{children:(0,M.jsxs)($,{className:`border-border/60 shadow-sm shadow-primary/5 backdrop-blur supports-[backdrop-filter]:bg-card/95`,children:[(0,M.jsxs)(DN,{className:`text-center`,children:[(0,M.jsx)(ON,{className:`text-xl tracking-tight`,children:e(`auth.resetPassword.title`)}),(0,M.jsx)(kN,{children:e(`auth.resetPassword.description`)})]}),(0,M.jsx)(AN,{children:n?(0,M.jsxs)(`form`,{onSubmit:async i=>{if(i.preventDefault(),r!==a){q({title:e(`auth.resetPassword.passwordsMismatch`),variant:`destructive`});return}if(!n){q({title:e(`auth.resetPassword.missingToken`),variant:`destructive`});return}c(!0);try{let i=await fetch(`/api/v1/auth/reset-password`,{method:`POST`,headers:{"Content-Type":`application/json`},credentials:`include`,body:JSON.stringify({token:n,newPassword:r})});if(!i.ok){let e=await i.json().catch(()=>({}));throw Error(e?.message||`Request failed: ${i.status}`)}q({title:e(`auth.resetPassword.success`)}),t({to:`/login`})}catch(t){q({title:e(`auth.resetPassword.failed`),description:t.message,variant:`destructive`})}finally{c(!1)}},className:`flex flex-col gap-4`,children:[(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsx)(UN,{htmlFor:`new-password`,children:e(`auth.resetPassword.newPassword`)}),(0,M.jsx)(oS,{id:`new-password`,type:`password`,autoComplete:`new-password`,required:!0,minLength:8,value:r,onChange:e=>i(e.target.value)})]}),(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsx)(UN,{htmlFor:`confirm-password`,children:e(`auth.resetPassword.confirmPassword`)}),(0,M.jsx)(oS,{id:`confirm-password`,type:`password`,autoComplete:`new-password`,required:!0,minLength:8,value:a,onChange:e=>o(e.target.value)})]}),(0,M.jsx)(Q,{type:`submit`,className:`w-full bg-brand-gradient text-primary-foreground shadow-sm shadow-primary/20 transition-all hover:opacity-95 hover:shadow-md hover:shadow-primary/30`,disabled:s,children:e(s?`auth.resetPassword.submitting`:`auth.resetPassword.submit`)})]}):(0,M.jsxs)(`p`,{className:`text-sm text-muted-foreground text-center`,children:[e(`auth.resetPassword.invalidToken`),` `,(0,M.jsx)(ra,{to:`/forgot-password`,className:`font-medium text-primary underline-offset-4 hover:underline`,children:e(`auth.resetPassword.requestNewLink`)})]})})]})})}function YN({mode:e,redirect:t}){let{t:n}=vt(),r=n_(),[i,a]=(0,j.useState)([]),[o,s]=(0,j.useState)(!0),[c,l]=(0,j.useState)(null);if((0,j.useEffect)(()=>{r?.auth?.getConfig&&r.auth.getConfig().then(e=>{a((e?.socialProviders??e?.data?.socialProviders??[]).filter(e=>e.enabled))}).catch(e=>{console.warn(`[SocialSignInButtons] failed to load auth config`,e)}).finally(()=>s(!1))},[r]),o||i.length===0)return null;let u=n(e===`sign-in`?`auth.social.continueWith`:`auth.social.signUpWith`),d=window.location.origin+`/_account/login`+(t?`?redirect=${encodeURIComponent(t)}`:``),f=e=>{c||(l(e),Promise.resolve(r.auth.signInWithProvider(e.id,{callbackURL:d,errorCallbackURL:d,type:e.type??`social`})).catch(e=>{console.warn(`[SocialSignInButtons] signInWithProvider failed`,e),l(null)}))};return(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[i.map(e=>{let t=c?.id===e.id;return(0,M.jsxs)(Q,{type:`button`,variant:`outline`,className:`w-full`,disabled:!!c,onClick:()=>f(e),children:[t?(0,M.jsx)(`span`,{className:`mr-2 inline-block size-4 animate-spin rounded-full border-2 border-muted-foreground border-t-transparent`}):(0,M.jsx)(`span`,{className:`mr-2 flex h-4 w-4 items-center justify-center rounded-sm bg-muted text-[10px] font-bold uppercase`,children:e.id[0]}),t?n(`auth.social.redirectingTo`,{provider:e.name,defaultValue:`Redirecting to ${e.name}…`}):`${u} ${e.name}`]},e.id)}),(0,M.jsxs)(`div`,{className:`relative my-1`,children:[(0,M.jsx)(`div`,{className:`absolute inset-0 flex items-center`,children:(0,M.jsx)(`span`,{className:`w-full border-t`})}),(0,M.jsx)(`div`,{className:`relative flex justify-center text-xs uppercase`,children:(0,M.jsx)(`span`,{className:`bg-card px-2 text-muted-foreground`,children:n(`auth.social.orContinueEmail`)})})]}),c&&typeof document<`u`?(0,Gi.createPortal)((0,M.jsx)(`div`,{role:`status`,"aria-live":`polite`,className:`fixed inset-0 z-[100] flex items-center justify-center bg-background/80 backdrop-blur-sm`,children:(0,M.jsxs)(`div`,{className:`flex flex-col items-center gap-3 text-sm text-muted-foreground`,children:[(0,M.jsx)(`div`,{className:`size-8 animate-spin rounded-full border-2 border-muted-foreground border-t-transparent`}),(0,M.jsx)(`span`,{children:n(`auth.social.redirectingTo`,{provider:c.name,defaultValue:`Redirecting to ${c.name}…`})})]})}),document.body):null]})}function XN(e,t){if(e.metaKey||e.ctrlKey||e.shiftKey||e.button===1)return;e.preventDefault();let n=Math.min(960,window.screen.availWidth-80),r=Math.min(720,window.screen.availHeight-80),i=Math.max(0,Math.round((window.screen.availWidth-n)/2)),a=Math.max(0,Math.round((window.screen.availHeight-r)/2)),o=[`popup=yes`,`width=${n}`,`height=${r}`,`left=${i}`,`top=${a}`,`resizable=yes`,`scrollbars=yes`,`noopener=yes`,`noreferrer=yes`].join(`,`);window.open(t,`objectstack-legal`,o)||window.open(t,`_blank`,`noopener,noreferrer`)}function ZN({termsUrl:e,privacyUrl:t}){let{t:n}=vt(`account`),r=typeof e==`string`&&e.length>0,i=typeof t==`string`&&t.length>0;return!r&&!i?null:(0,M.jsxs)(`p`,{className:`px-6 text-center text-xs text-muted-foreground [&_a]:underline [&_a]:underline-offset-4 [&_a]:hover:text-primary`,children:[n(`legal.agreementPrefix`),` `,r?(0,M.jsx)(`a`,{href:e,target:`objectstack-legal`,rel:`noreferrer noopener`,onClick:t=>XN(t,e),children:n(`legal.termsOfService`)}):null,r&&i?(0,M.jsxs)(M.Fragment,{children:[` `,n(`legal.and`),` `]}):null,i?(0,M.jsx)(`a`,{href:t,target:`objectstack-legal`,rel:`noreferrer noopener`,onClick:e=>XN(e,t),children:n(`legal.privacyPolicy`)}):null,`.`]})}var QN=la(`/register`)({validateSearch:e=>{let t=e.redirect;return typeof t==`string`?{redirect:t}:{}},component:tP});function $N(e){return!!e&&e.startsWith(`/`)&&!e.startsWith(`//`)}function eP(e){return e.startsWith(`/_`)?e:`/_account/`.replace(/\/$/,``)+e}function tP(){let{t:e}=vt(),t=Hi(),{redirect:n}=QN.useSearch(),r=n_(),{session:i,user:a,loading:o,refresh:s,organizations:c,organizationsLoading:l,organizationsFetched:u,setActiveOrganization:d,features:f}=iN();(0,j.useEffect)(()=>{f?.signUpDisabled===!0&&t({to:`/login`,search:n?{redirect:n}:{},replace:!0})},[f?.signUpDisabled,t,n]);let[p,m]=(0,j.useState)(``),[h,g]=(0,j.useState)(``),[_,v]=(0,j.useState)(``),[y,b]=(0,j.useState)(!1),[x,S]=(0,j.useState)(!1);return(0,j.useEffect)(()=>{if(a){if(typeof window<`u`){let e=new URLSearchParams(window.location.search);if(e.has(`client_id`)&&e.has(`redirect_uri`)){window.location.assign(`/api/v1/auth/oauth2/authorize${window.location.search}`);return}}if(!i?.activeOrganizationId){if(!u||l||x)return;if(c.length===1){S(!0),d(c[0].id).catch(()=>void 0).finally(()=>S(!1));return}if(!f)return;if(c.length>1){t({to:`/organizations`});return}if(f.multiOrgEnabled===!1){$N(n)?window.location.assign(eP(n)):window.location.assign(`/`);return}t({to:`/organizations/new`,search:n?{redirect:n}:{}});return}if(!x){if($N(n)){window.location.assign(eP(n));return}window.location.assign(`/`)}}},[a,i,t,n,c,l,u,x,d,f]),(0,M.jsx)(PN,{children:o||a?(0,M.jsxs)(`div`,{className:`flex flex-col items-center gap-3 py-10 text-sm text-muted-foreground`,children:[(0,M.jsx)(`div`,{className:`size-6 animate-spin rounded-full border-2 border-muted-foreground border-t-transparent`}),(0,M.jsx)(`span`,{children:a?e(`auth.register.signingIn`,{defaultValue:`Setting up your account…`}):e(`auth.login.redirecting`,{defaultValue:`Loading…`})})]}):(0,M.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,M.jsxs)($,{className:`border-border/60 shadow-sm shadow-primary/5 backdrop-blur supports-[backdrop-filter]:bg-card/95`,children:[(0,M.jsxs)(DN,{className:`text-center`,children:[(0,M.jsx)(ON,{className:`text-xl tracking-tight`,children:e(`auth.register.title`)}),(0,M.jsx)(kN,{children:e(`auth.register.description`)})]}),(0,M.jsx)(AN,{children:(0,M.jsx)(`form`,{onSubmit:async i=>{if(i.preventDefault(),r?.auth){b(!0);try{let i=await r.auth.register({name:p,email:h,password:_}),a=i?.data??i;if(a&&a.token===null&&a.user){t({to:`/verify-email-prompt`,search:{email:h,redirect:n}});return}try{await s()}catch(e){let r=e.message;if(r.includes(`email`)&&(r.toLowerCase().includes(`verif`)||r.toLowerCase().includes(`not verified`))){t({to:`/verify-email-prompt`,search:{email:h,redirect:n}});return}throw e}q({title:e(`auth.register.successToast`)})}catch(r){let i=r.message;if(i.includes(`email`)&&(i.toLowerCase().includes(`verif`)||i.toLowerCase().includes(`sent`))){t({to:`/verify-email-prompt`,search:{email:h,redirect:n}});return}q({title:e(`auth.register.failed`),description:i,variant:`destructive`})}finally{b(!1)}}},children:(0,M.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,M.jsx)(YN,{mode:`sign-up`,redirect:n}),(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsx)(UN,{htmlFor:`name`,children:e(`auth.nameLabel`)}),(0,M.jsx)(oS,{id:`name`,autoComplete:`name`,required:!0,value:p,onChange:e=>m(e.target.value)})]}),(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsx)(UN,{htmlFor:`email`,children:e(`auth.emailLabel`)}),(0,M.jsx)(oS,{id:`email`,type:`email`,placeholder:e(`auth.emailPlaceholder`),autoComplete:`email`,required:!0,value:h,onChange:e=>g(e.target.value)})]}),(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsx)(UN,{htmlFor:`password`,children:e(`auth.passwordLabel`)}),(0,M.jsx)(oS,{id:`password`,type:`password`,autoComplete:`new-password`,required:!0,minLength:8,value:_,onChange:e=>v(e.target.value)})]}),(0,M.jsx)(Q,{type:`submit`,className:`w-full`,disabled:y,children:e(y?`auth.register.submitting`:`auth.register.submit`)}),(0,M.jsxs)(`p`,{className:`text-center text-sm text-muted-foreground`,children:[e(`auth.register.haveAccount`),` `,(0,M.jsx)(ra,{to:`/login`,search:n?{redirect:n}:void 0,className:`font-medium text-primary underline-offset-4 hover:underline`,children:e(`auth.register.signIn`)})]})]})})})]}),(0,M.jsx)(ZN,{termsUrl:f?.termsUrl,privacyUrl:f?.privacyUrl})]})})}var nP=la(`/login`)({validateSearch:e=>{let t=e.redirect;return typeof t==`string`?{redirect:t}:{}},component:aP});function rP(e){return!!e&&e.startsWith(`/`)&&!e.startsWith(`//`)}function iP(e){return e.startsWith(`/_`)?e:`/_account/`.replace(/\/$/,``)+e}function aP(){let{t:e}=vt(),t=Hi(),{redirect:n}=nP.useSearch(),r=n_(),i=null;if(typeof window<`u`){let e=new URLSearchParams(window.location.search),t=e.get(`redirect_uri`);if(e.has(`client_id`)&&t)try{i=new URL(t).host}catch{i=null}}let{session:a,user:o,loading:s,refresh:c,organizations:l,organizationsLoading:u,organizationsFetched:d,setActiveOrganization:f,features:p}=iN(),m=p?.signUpDisabled===!0,[h,g]=(0,j.useState)(``),[_,v]=(0,j.useState)(``),[y,b]=(0,j.useState)(!1),[x,S]=(0,j.useState)(!1);return(0,j.useEffect)(()=>{if(o){if(typeof window<`u`){let e=new URLSearchParams(window.location.search);if(e.has(`client_id`)&&e.has(`redirect_uri`)){window.location.assign(`/api/v1/auth/oauth2/authorize${window.location.search}`);return}}if(!a?.activeOrganizationId){if(!d||u||x)return;if(l.length===1){S(!0),f(l[0].id).catch(()=>void 0).finally(()=>S(!1));return}if(!p)return;if(l.length===0){if(p.multiOrgEnabled===!1){rP(n)?window.location.assign(iP(n)):window.location.assign(`/`);return}t({to:`/organizations/new`});return}if(p.multiOrgEnabled===!1){S(!0),f(l[0].id).catch(()=>void 0).finally(()=>S(!1));return}t({to:`/organizations`});return}if(!x){if(rP(n)){window.location.assign(iP(n));return}window.location.assign(`/`)}}},[o,a,t,n,l,u,d,x,f,p]),s||o?(0,M.jsx)(PN,{children:(0,M.jsxs)(`div`,{className:`flex flex-col items-center gap-3 py-10 text-sm text-muted-foreground`,children:[(0,M.jsx)(`div`,{className:`size-6 animate-spin rounded-full border-2 border-muted-foreground border-t-transparent`}),(0,M.jsx)(`span`,{children:e(`auth.login.signingIn`,{defaultValue:`Signing you in…`})})]})}):(0,M.jsxs)(PN,{children:[y?(0,M.jsx)(lN,{message:e(`auth.login.signingIn`,{defaultValue:`Signing you in…`})}):null,(0,M.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[i?(0,M.jsxs)(`div`,{role:`status`,className:`flex items-start gap-3 rounded-md border border-primary/30 bg-primary/5 px-4 py-3 text-sm text-foreground`,children:[(0,M.jsx)(`span`,{className:`mt-0.5 inline-block size-2 shrink-0 rounded-full bg-primary`}),(0,M.jsx)(`span`,{children:e(`auth.login.ssoHandoff`,{target:i,defaultValue:`Continue to ${i}`})})]}):null,(0,M.jsxs)($,{className:`border-border/60 shadow-sm shadow-primary/5 backdrop-blur supports-[backdrop-filter]:bg-card/95`,children:[(0,M.jsxs)(DN,{className:`text-center`,children:[(0,M.jsx)(ON,{className:`text-xl tracking-tight`,children:e(`auth.login.title`)}),(0,M.jsx)(kN,{children:e(`auth.login.description`)})]}),(0,M.jsx)(AN,{children:(0,M.jsx)(`form`,{onSubmit:async i=>{if(i.preventDefault(),r?.auth){b(!0);try{await r.auth.login({type:`email`,email:h,password:_}),await c(),q({title:e(`auth.login.welcomeToast`)})}catch(r){let i=r.message,a=r.code,o=(i||``).toLowerCase();if(a===`EMAIL_NOT_VERIFIED`||o.includes(`email`)&&(o.includes(`verif`)||o.includes(`not verified`))){t({to:`/verify-email-prompt`,search:{email:h,redirect:n}});return}q({title:e(`auth.login.failed`),description:i,variant:`destructive`})}finally{b(!1)}}},children:(0,M.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,M.jsx)(YN,{mode:`sign-in`,redirect:n}),(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsx)(UN,{htmlFor:`email`,children:e(`auth.emailLabel`)}),(0,M.jsx)(oS,{id:`email`,type:`email`,placeholder:e(`auth.emailPlaceholder`),autoComplete:`email`,required:!0,value:h,onChange:e=>g(e.target.value)})]}),(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsxs)(`div`,{className:`flex items-center`,children:[(0,M.jsx)(UN,{htmlFor:`password`,children:e(`auth.passwordLabel`)}),(0,M.jsx)(ra,{to:`/forgot-password`,className:`ml-auto text-sm underline-offset-4 hover:underline`,children:e(`auth.login.forgotPassword`)})]}),(0,M.jsx)(oS,{id:`password`,type:`password`,autoComplete:`current-password`,required:!0,value:_,onChange:e=>v(e.target.value)})]}),(0,M.jsx)(Q,{type:`submit`,className:`w-full`,disabled:y,children:e(y?`auth.login.submitting`:`auth.login.submit`)}),m?null:(0,M.jsxs)(`p`,{className:`text-center text-sm text-muted-foreground`,children:[e(`auth.login.noAccount`),` `,(0,M.jsx)(ra,{to:`/register`,search:n?{redirect:n}:void 0,className:`font-medium text-primary underline-offset-4 hover:underline`,children:e(`auth.login.signUp`)})]})]})})})]}),(0,M.jsx)(ZN,{termsUrl:p?.termsUrl,privacyUrl:p?.privacyUrl})]})]})}var oP=la(`/forgot-password`)({component:sP});function sP(){let{t:e}=vt(),[t,n]=(0,j.useState)(``),[r,i]=(0,j.useState)(!1),[a,o]=(0,j.useState)(!1);return(0,M.jsx)(PN,{children:(0,M.jsx)($,{className:`border-border/60 shadow-sm shadow-primary/5 backdrop-blur supports-[backdrop-filter]:bg-card/95`,children:a?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(DN,{className:`text-center`,children:[(0,M.jsx)(ON,{className:`text-xl tracking-tight`,children:e(`auth.forgotPassword.checkEmailTitle`)}),(0,M.jsx)(kN,{children:e(`auth.forgotPassword.checkEmailDescription`,{email:t})})]}),(0,M.jsx)(AN,{className:`text-center`,children:(0,M.jsx)(ra,{to:`/login`,className:`text-sm font-medium text-primary underline-offset-4 hover:underline`,children:e(`auth.forgotPassword.backToSignIn`)})})]}):(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(DN,{className:`text-center`,children:[(0,M.jsx)(ON,{className:`text-xl tracking-tight`,children:e(`auth.forgotPassword.title`)}),(0,M.jsx)(kN,{children:e(`auth.forgotPassword.description`)})]}),(0,M.jsx)(AN,{children:(0,M.jsxs)(`form`,{onSubmit:async n=>{n.preventDefault(),i(!0);try{let e=window.location.origin+`/_account/`.replace(/\/$/,``)+`/reset-password`,n=await fetch(`/api/v1/auth/request-password-reset`,{method:`POST`,headers:{"Content-Type":`application/json`},credentials:`include`,body:JSON.stringify({email:t,redirectTo:e})});if(!n.ok){let e=await n.json().catch(()=>({}));throw Error(e?.message||`Request failed: ${n.status}`)}o(!0)}catch(t){q({title:e(`auth.forgotPassword.failed`),description:t.message,variant:`destructive`})}finally{i(!1)}},className:`flex flex-col gap-4`,children:[(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsx)(UN,{htmlFor:`email`,children:e(`auth.emailLabel`)}),(0,M.jsx)(oS,{id:`email`,type:`email`,placeholder:e(`auth.emailPlaceholder`),autoComplete:`email`,required:!0,value:t,onChange:e=>n(e.target.value)})]}),(0,M.jsx)(Q,{type:`submit`,className:`w-full bg-brand-gradient text-primary-foreground shadow-sm shadow-primary/20 transition-all hover:opacity-95 hover:shadow-md hover:shadow-primary/30`,disabled:r,children:e(r?`auth.forgotPassword.submitting`:`auth.forgotPassword.submit`)}),(0,M.jsxs)(`p`,{className:`text-center text-sm text-muted-foreground`,children:[e(`auth.forgotPassword.rememberPassword`),` `,(0,M.jsx)(ra,{to:`/login`,className:`font-medium text-primary underline-offset-4 hover:underline`,children:e(`auth.forgotPassword.signIn`)})]})]})})]})})})}var cP=la(`/account`)({component:lP});function lP(){return(0,M.jsx)(`div`,{className:`flex flex-1 flex-col overflow-hidden`,children:(0,M.jsx)(`div`,{className:`flex-1 overflow-auto px-4 py-6 sm:px-6 sm:py-8`,children:(0,M.jsx)(`div`,{className:`page-enter mx-auto flex max-w-4xl flex-col gap-6`,children:(0,M.jsx)(ya,{})})})})}var uP=la(`/`)({component:dP});function dP(){return(0,M.jsx)(Ui,{to:`/login`})}var fP=cy(`inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2`,{variants:{variant:{default:`border-transparent bg-primary text-primary-foreground hover:bg-primary/80`,secondary:`border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80`,destructive:`border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80`,outline:`text-foreground`}},defaultVariants:{variant:`default`}});function pP({className:e,variant:t,...n}){return(0,M.jsx)(`div`,{className:Z(fP({variant:t}),e),...n})}function mP({title:e,description:t,icon:n,actions:r,className:i,...a}){return(0,M.jsxs)(`div`,{className:Z(`relative overflow-hidden rounded-xl border bg-brand-gradient-subtle`,`px-5 py-5 sm:px-6 sm:py-6`,i),...a,children:[(0,M.jsx)(`div`,{className:`pointer-events-none absolute inset-0 opacity-60`,style:{backgroundImage:`radial-gradient(ellipse 60% 80% at 0% 0%, hsl(var(--brand-from) / 0.12), transparent 60%)`},"aria-hidden":!0}),(0,M.jsxs)(`div`,{className:`relative flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between sm:gap-6`,children:[(0,M.jsxs)(`div`,{className:`flex min-w-0 items-start gap-4`,children:[n?(0,M.jsx)(`div`,{className:`flex size-10 shrink-0 items-center justify-center rounded-lg bg-brand-gradient text-primary-foreground shadow-sm shadow-primary/30 ring-1 ring-white/15`,children:(0,M.jsx)(n,{className:`size-5`})}):null,(0,M.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,M.jsx)(`h1`,{className:`truncate text-xl font-semibold tracking-tight sm:text-2xl`,children:e}),t?(0,M.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t}):null]})]}),r?(0,M.jsx)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:r}):null]})]})}var hP=la(`/organizations/`)({component:gP});function gP(){let{t:e}=vt(),{organizations:t,loading:n}=aN(),{session:r,setActiveOrganization:i,features:a}=iN(),o=Hi(),s=r?.activeOrganizationId??void 0,c=a?.multiOrgEnabled!==!1,l=async t=>{try{t!==s&&await i(t),o({to:`/organizations/$orgId`,params:{orgId:t}})}catch(t){q({title:e(`organizations.switchFailed`),description:t.message,variant:`destructive`})}},u=e=>e.split(/\s+/).map(e=>e[0]).join(``).slice(0,2).toUpperCase();return(0,M.jsx)(`div`,{className:`flex flex-1 flex-col overflow-hidden`,children:(0,M.jsx)(`div`,{className:`flex-1 overflow-auto px-4 py-6 sm:px-6 sm:py-8`,children:(0,M.jsxs)(`div`,{className:`page-enter mx-auto flex max-w-3xl flex-col gap-6`,children:[(0,M.jsx)(mP,{icon:by,title:e(`organizations.title`),description:e(`organizations.description`),actions:c?(0,M.jsxs)(Q,{onClick:()=>o({to:`/organizations/new`}),className:`bg-brand-gradient text-primary-foreground shadow-sm shadow-primary/20 transition-all hover:opacity-95 hover:shadow-md hover:shadow-primary/30`,children:[(0,M.jsx)(qy,{className:`mr-2 h-4 w-4`}),e(`organizations.newOrganization`)]}):null}),n&&(0,M.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`organizations.loading`)}),!n&&t.length===0&&(0,M.jsxs)($,{className:`p-10 text-center`,children:[(0,M.jsx)(`div`,{className:`mx-auto mb-3 flex size-12 items-center justify-center rounded-lg bg-brand-gradient-subtle text-primary ring-1 ring-primary/15`,children:(0,M.jsx)(by,{className:`h-6 w-6`})}),(0,M.jsx)(`h3`,{className:`text-base font-medium`,children:e(`organizations.emptyTitle`)}),(0,M.jsx)(`p`,{className:`mb-4 text-sm text-muted-foreground`,children:e(`organizations.emptyDescription`)}),c&&(0,M.jsxs)(Q,{onClick:()=>o({to:`/organizations/new`}),className:`bg-brand-gradient text-primary-foreground shadow-sm shadow-primary/20`,children:[(0,M.jsx)(qy,{className:`mr-2 h-4 w-4`}),e(`organizations.createOrganization`)]})]}),(0,M.jsx)(`div`,{className:`grid gap-3`,children:t.map(t=>{let n=t.id===s;return(0,M.jsx)($,{role:`button`,tabIndex:0,onClick:()=>l(t.id),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),l(t.id))},className:`group cursor-pointer p-4 transition-all hover:-translate-y-0.5 hover:border-primary/30 hover:shadow-md hover:shadow-primary/5 focus:outline-none focus:ring-2 focus:ring-ring ${n?`border-primary/50 bg-brand-gradient-subtle ring-1 ring-primary/30`:``}`,children:(0,M.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,M.jsx)(`div`,{className:`flex size-12 shrink-0 items-center justify-center rounded-lg font-semibold `+(n?`bg-brand-gradient text-primary-foreground shadow-sm shadow-primary/30 ring-1 ring-white/15`:`bg-muted text-muted-foreground group-hover:bg-brand-gradient-subtle group-hover:text-primary`),children:u(t.name)||(0,M.jsx)(by,{className:`h-5 w-5`})}),(0,M.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,M.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,M.jsx)(`h3`,{className:`truncate text-base font-medium`,children:t.name}),n&&(0,M.jsxs)(pP,{className:`gap-1 border-transparent bg-emerald-500/15 text-[10px] font-medium text-emerald-600 dark:text-emerald-400`,children:[(0,M.jsx)(xy,{className:`h-3 w-3`}),e(`organizations.active`)]})]}),t.slug&&(0,M.jsx)(`code`,{className:`mt-0.5 block font-mono text-xs text-muted-foreground`,children:t.slug})]}),(0,M.jsx)(Cy,{className:`size-4 shrink-0 text-muted-foreground transition-transform group-hover:translate-x-0.5 group-hover:text-primary`})]})},t.id)})})]})})})}var _P=la(`/account/`)({component:vP});function vP(){let{t:e}=vt(),{user:t}=iN(),{organizations:n}=aN(),r=[!!t?.emailVerified,!!t?.twoFactorEnabled,!!t?.name,!!t?.image].filter(Boolean).length*25,i=r>=75?`success`:r>=50?`warn`:`danger`,a=(t?.name??t?.email??`?`).split(/\s+/).map(e=>e[0]).join(``).slice(0,2).toUpperCase(),o=[{to:`/account/profile`,label:e(`home.tiles.profile.title`,{defaultValue:`Profile`}),description:e(`home.tiles.profile.description`,{defaultValue:`Display name, avatar and contact info.`}),icon:cb},{to:`/account/security`,label:e(`home.tiles.security.title`,{defaultValue:`Security`}),description:e(`home.tiles.security.description`,{defaultValue:`Change your password and review activity.`}),icon:Qy},{to:`/account/two-factor`,label:e(`home.tiles.twoFactor.title`,{defaultValue:`Two-factor auth`}),description:e(`home.tiles.twoFactor.description`,{defaultValue:`Add an authenticator app for stronger sign-in.`}),icon:Zy},{to:`/account/sessions`,label:e(`home.tiles.sessions.title`,{defaultValue:`Active sessions`}),description:e(`home.tiles.sessions.description`,{defaultValue:`See and revoke devices that are signed in.`}),icon:Wy},{to:`/account/linked-accounts`,label:e(`home.tiles.linked.title`,{defaultValue:`Linked accounts`}),description:e(`home.tiles.linked.description`,{defaultValue:`Manage your social and SSO providers.`}),icon:By},{to:`/account/oauth-applications`,label:e(`home.tiles.oauth.title`,{defaultValue:`OAuth applications`}),description:e(`home.tiles.oauth.description`,{defaultValue:`Apps you have authorised to access your account.`}),icon:Ly}];return(0,M.jsxs)(`div`,{className:`space-y-6`,children:[(0,M.jsxs)(`div`,{className:`relative overflow-hidden rounded-xl border bg-card`,children:[(0,M.jsx)(`div`,{className:`absolute inset-0 bg-brand-gradient`,"aria-hidden":!0}),(0,M.jsx)(`div`,{className:`absolute inset-0 opacity-40 mix-blend-soft-light`,style:{backgroundImage:`radial-gradient(ellipse at 20% 0%, rgba(255,255,255,0.4), transparent 60%), radial-gradient(ellipse at 100% 100%, rgba(0,0,0,0.25), transparent 60%)`},"aria-hidden":!0}),(0,M.jsxs)(`div`,{className:`relative flex flex-col gap-4 p-6 text-white sm:flex-row sm:items-center sm:gap-6 sm:p-8`,children:[(0,M.jsxs)(YM,{className:`size-16 shrink-0 ring-4 ring-white/30 shadow-md sm:size-20`,children:[t?.image?(0,M.jsx)(XM,{src:t.image,alt:t?.name??``}):null,(0,M.jsx)(ZM,{className:`bg-white/20 text-base font-semibold text-white backdrop-blur`,children:a})]}),(0,M.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1`,children:[(0,M.jsx)(`p`,{className:`text-xs uppercase tracking-wider text-white/70`,children:e(`home.welcome`,{defaultValue:`Welcome back`})}),(0,M.jsx)(`h2`,{className:`truncate text-2xl font-semibold tracking-tight`,children:t?.name||t?.email||`ObjectStack user`}),(0,M.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-sm text-white/80`,children:[(0,M.jsx)(Uy,{className:`size-3.5`,"aria-hidden":!0}),(0,M.jsx)(`span`,{className:`truncate`,children:t?.email}),t?.emailVerified?(0,M.jsx)(pP,{className:`border-white/30 bg-white/15 text-[10px] font-medium text-white backdrop-blur hover:bg-white/20`,children:e(`home.verified`,{defaultValue:`Verified`})}):null]})]})]})]}),(0,M.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 sm:grid-cols-3`,children:[(0,M.jsx)(yP,{icon:Zy,label:e(`home.stats.score`,{defaultValue:`Security score`}),value:`${r}%`,tone:i,extra:(0,M.jsx)(`div`,{className:`mt-2 h-1.5 w-full overflow-hidden rounded-full bg-muted`,children:(0,M.jsx)(`div`,{className:`h-full bg-brand-gradient transition-[width] duration-500`,style:{width:`${r}%`}})})}),(0,M.jsx)(yP,{icon:by,label:e(`home.stats.orgs`,{defaultValue:`Organizations`}),value:String(n.length),extra:(0,M.jsxs)(ra,{to:`/organizations`,className:`mt-2 inline-flex items-center gap-1 text-xs font-medium text-primary hover:underline`,children:[e(`home.stats.manage`,{defaultValue:`Manage`}),(0,M.jsx)(yy,{className:`size-3`})]})}),(0,M.jsx)(yP,{icon:t?.twoFactorEnabled?Zy:Qy,label:e(`home.stats.twoFactor`,{defaultValue:`Two-factor auth`}),value:t?.twoFactorEnabled?e(`home.stats.enabled`,{defaultValue:`Enabled`}):e(`home.stats.disabled`,{defaultValue:`Disabled`}),tone:t?.twoFactorEnabled?`success`:`warn`,extra:(0,M.jsxs)(ra,{to:`/account/two-factor`,className:`mt-2 inline-flex items-center gap-1 text-xs font-medium text-primary hover:underline`,children:[t?.twoFactorEnabled?e(`home.stats.review`,{defaultValue:`Review`}):e(`home.stats.enable`,{defaultValue:`Enable now`}),(0,M.jsx)(yy,{className:`size-3`})]})})]}),(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`h3`,{className:`mb-3 text-sm font-medium text-muted-foreground`,children:e(`home.quickAccess`,{defaultValue:`Quick access`})}),(0,M.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:o.map(({to:e,label:t,description:n,icon:r})=>(0,M.jsxs)(ra,{to:e,className:`group relative flex items-start gap-3 rounded-lg border bg-card p-4 transition-all hover:-translate-y-0.5 hover:border-primary/30 hover:shadow-md hover:shadow-primary/5`,children:[(0,M.jsx)(`div`,{className:`flex size-9 shrink-0 items-center justify-center rounded-md bg-brand-gradient-subtle text-primary ring-1 ring-primary/10 transition-transform group-hover:scale-110`,children:(0,M.jsx)(r,{className:`size-4`})}),(0,M.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,M.jsx)(`span`,{className:`truncate font-medium`,children:t}),(0,M.jsx)(yy,{className:`size-4 shrink-0 text-muted-foreground transition-transform group-hover:translate-x-0.5 group-hover:text-primary`})]}),(0,M.jsx)(`p`,{className:`mt-0.5 line-clamp-2 text-xs text-muted-foreground`,children:n})]})]},e))})]})]})}function yP({icon:e,label:t,value:n,tone:r=`neutral`,extra:i}){let a=r===`success`?`text-emerald-600 dark:text-emerald-400`:r===`warn`?`text-amber-600 dark:text-amber-400`:r===`danger`?`text-destructive`:`text-foreground`;return(0,M.jsx)($,{className:`overflow-hidden`,children:(0,M.jsxs)(AN,{className:`p-5`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,M.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wider text-muted-foreground`,children:t}),(0,M.jsx)(e,{className:`size-4 ${a}`})]}),(0,M.jsx)(`p`,{className:`mt-1 text-2xl font-semibold tracking-tight ${a}`,children:n}),i]})})}var bP=la(`/organizations/new`)({validateSearch:e=>{let t=e.redirect;return typeof t==`string`?{redirect:t}:{}},component:wP});function xP(e){return e.toLowerCase().trim().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``).slice(0,48)}function SP(e){return!!e&&e.startsWith(`/`)&&!e.startsWith(`//`)}function CP(e){return e.startsWith(`/_`)?e:`/_account/`.replace(/\/$/,``)+e}function wP(){let{t:e}=vt(),t=Hi(),{redirect:n}=bP.useSearch(),{create:r,creating:i}=oN(),{setActiveOrganization:a,reloadOrganizations:o,features:s}=iN(),[c,l]=(0,j.useState)(``),[u,d]=(0,j.useState)(``),[f,p]=(0,j.useState)(!1);(0,j.useEffect)(()=>{s&&s.multiOrgEnabled===!1&&t({to:`/organizations`})},[s,t]);let m=e=>{l(e),f||d(xP(e))};return(0,M.jsx)(PN,{formWidth:`md`,children:(0,M.jsxs)($,{className:`border-border/60 shadow-sm shadow-primary/5 backdrop-blur supports-[backdrop-filter]:bg-card/95`,children:[(0,M.jsxs)(DN,{className:`text-center`,children:[(0,M.jsx)(ON,{className:`text-xl tracking-tight`,children:e(`organizations.new.title`)}),(0,M.jsx)(kN,{children:e(`organizations.new.description`)})]}),(0,M.jsx)(AN,{children:(0,M.jsxs)(`form`,{onSubmit:async t=>{t.preventDefault();try{let t=await r({name:c,slug:u||void 0}),i=t?.data??t,s=i?.id??i?.organization?.id;s&&await a(s).catch(()=>{}),await o().catch(()=>{}),q({title:e(`organizations.new.successToast`)}),SP(n)?window.location.assign(CP(n)):window.location.assign(`/`)}catch(t){q({title:e(`organizations.new.failed`),description:t.message,variant:`destructive`})}},className:`flex flex-col gap-4`,children:[(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsx)(UN,{htmlFor:`name`,children:e(`organizations.new.name`)}),(0,M.jsx)(oS,{id:`name`,required:!0,autoFocus:!0,value:c,onChange:e=>m(e.target.value),placeholder:e(`organizations.new.namePlaceholder`)})]}),(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsx)(UN,{htmlFor:`slug`,children:e(`organizations.new.slug`)}),(0,M.jsx)(oS,{id:`slug`,value:u,onChange:e=>{d(e.target.value),p(!0)},placeholder:e(`organizations.new.slugPlaceholder`),pattern:`[a-z0-9-]+`}),(0,M.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:e(`organizations.new.slugHint`)})]}),(0,M.jsx)(Q,{type:`submit`,className:`w-full`,disabled:i||!c,children:e(i?`organizations.new.submitting`:`organizations.new.submit`)}),(0,M.jsx)(`p`,{className:`text-center text-sm text-muted-foreground`,children:(0,M.jsx)(ra,{to:`/organizations`,className:`font-medium text-primary underline-offset-4 hover:underline`,children:e(`organizations.new.cancel`)})})]})})]})})}var TP=la(`/organizations/$orgId`)({component:EP});function EP(){let{t:e}=vt(),{orgId:t}=TP.useParams(),{organizations:n}=aN(),r=n.find(e=>e.id===t);return(0,M.jsx)(`div`,{className:`flex flex-1 flex-col overflow-hidden`,children:(0,M.jsx)(`div`,{className:`flex-1 overflow-auto px-6 py-8`,children:(0,M.jsxs)(`div`,{className:`mx-auto max-w-4xl space-y-6`,children:[(0,M.jsxs)(`header`,{children:[(0,M.jsx)(`h1`,{className:`text-2xl font-semibold`,children:r?.name??e(`organizations.title`)}),r?.slug&&(0,M.jsx)(`p`,{className:`text-sm text-muted-foreground font-mono`,children:r.slug})]}),(0,M.jsx)(ya,{})]})})})}function DP(){let e=n_(),[t,n]=(0,j.useState)([]),[r,i]=(0,j.useState)(!1),[a,o]=(0,j.useState)(null),s=(0,j.useCallback)(async()=>{if(e?.oauth?.applications){i(!0),o(null);try{n((await e.oauth.applications.list())?.applications??[])}catch(e){o(e),n([])}finally{i(!1)}}},[e]);return(0,j.useEffect)(()=>{s()},[s]),{applications:t,loading:r,error:a,reload:s}}function OP(){let e=n_(),[t,n]=(0,j.useState)(!1),[r,i]=(0,j.useState)(null),[a,o]=(0,j.useState)(null);return{register:(0,j.useCallback)(async t=>{if(!e?.oauth?.applications?.register)throw Error(`Client not ready`);n(!0),i(null);try{let n=await e.oauth.applications.register(t);return o(n),n}catch(e){throw i(e),e}finally{n(!1)}},[e]),registering:t,error:r,lastResult:a}}function kP(){let e=n_(),[t,n]=(0,j.useState)(!1),[r,i]=(0,j.useState)(null);return{remove:(0,j.useCallback)(async t=>{if(!e?.oauth?.applications?.delete)throw Error(`Client not ready`);n(!0),i(null);try{return await e.oauth.applications.delete(t)}catch(e){throw i(e),e}finally{n(!1)}},[e]),deleting:t,error:r}}function AP(){let e=n_(),[t,n]=(0,j.useState)(!1),[r,i]=(0,j.useState)(null);return{submit:(0,j.useCallback)(async t=>{if(!e?.oauth?.consent)throw Error(`Client not ready`);n(!0),i(null);try{return await e.oauth.consent(t)}catch(e){throw i(e),e}finally{n(!1)}},[e]),submitting:t,error:r}}var jP=la(`/oauth/consent`)({validateSearch:e=>e,component:MP});function MP(){let{t:e}=vt(),t=Hi(),n=n_(),{user:r,loading:i}=iN(),{submit:a,submitting:o}=AP(),[s,c]=(0,j.useState)(null),l=typeof window<`u`?window.location.search:``,u=l.startsWith(`?`)?l.slice(1):l,d=new URLSearchParams(u),f=d.get(`client_id`)??void 0,p=d.get(`scope`)??``;(0,j.useEffect)(()=>{i||r||t({to:`/login`,search:{redirect:window.location.pathname+window.location.search}})},[r,i,t]),(0,j.useEffect)(()=>{if(!f||!n?.oauth?.applications?.getPublic)return;let e=!1;return n.oauth.applications.getPublic(f).then(t=>{if(e)return;let n=t?.data??t;c({name:n?.name??n?.client_name,icon:n?.icon??n?.logo_uri})},()=>{}),()=>{e=!0}},[n,f]);let m=p.split(/\s+/).filter(Boolean),h=async t=>{try{let n=await a({accept:t,oauth_query:u}),r=n?.redirect_uri??n?.redirectURI??n?.url;if(r){window.location.href=r;return}q({title:e(t?`oauth.consent.granted`:`oauth.consent.denied`),description:e(`oauth.consent.noRedirect`),variant:t?void 0:`destructive`})}catch(t){q({title:e(`oauth.consent.failed`),description:t.message,variant:`destructive`})}},g=s?.name??f??e(`oauth.consent.unknownApp`);return(0,M.jsx)(`div`,{className:`flex min-h-svh w-full flex-1 items-center justify-center bg-background px-4`,children:(0,M.jsxs)($,{className:`w-full max-w-md`,children:[(0,M.jsxs)(DN,{className:`items-center text-center`,children:[(0,M.jsx)(`div`,{className:`mb-3 rounded-full border bg-muted p-3`,children:s?.icon?(0,M.jsx)(`img`,{src:s.icon,alt:``,className:`h-8 w-8 rounded`,onError:e=>e.currentTarget.style.display=`none`}):(0,M.jsx)(Ly,{className:`h-7 w-7 text-muted-foreground`})}),(0,M.jsx)(ON,{className:`text-xl`,children:e(`oauth.consent.title`,{appName:g})}),(0,M.jsx)(kN,{children:e(`oauth.consent.request`,{appName:g,suffix:r?.email?` (${r.email})`:``})})]}),(0,M.jsxs)(AN,{className:`space-y-4`,children:[m.length>0&&(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`p`,{className:`mb-2 text-sm font-medium`,children:e(`oauth.consent.willAllow`)}),(0,M.jsx)(`ul`,{className:`space-y-1.5 rounded-md border bg-muted/40 p-3 text-sm`,children:m.map(t=>(0,M.jsxs)(`li`,{className:`flex items-start gap-2`,children:[(0,M.jsx)(xy,{className:`mt-0.5 h-4 w-4 text-green-600 dark:text-green-400`}),(0,M.jsx)(`span`,{children:NP(t,e)})]},t))})]}),(0,M.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 pt-2`,children:[(0,M.jsxs)(Q,{variant:`outline`,onClick:()=>h(!1),disabled:o,children:[(0,M.jsx)(ub,{className:`mr-2 h-4 w-4`}),e(`oauth.consent.deny`)]}),(0,M.jsxs)(Q,{onClick:()=>h(!0),disabled:o,children:[(0,M.jsx)(xy,{className:`mr-2 h-4 w-4`}),e(o?`oauth.consent.submitting`:`oauth.consent.authorize`)]})]}),(0,M.jsx)(`p`,{className:`pt-2 text-center text-xs text-muted-foreground`,children:e(`oauth.consent.footer`)})]})]})})}function NP(e,t){switch(e){case`openid`:return t(`oauth.consent.scope.openid`);case`profile`:return t(`oauth.consent.scope.profile`);case`email`:return t(`oauth.consent.scope.email`);case`offline_access`:return t(`oauth.consent.scope.offlineAccess`);default:return e}}var PP=la(`/auth/device`)({validateSearch:e=>({user_code:e.user_code??e.code??``}),component:IP});function FP({children:e}){return(0,M.jsx)(`div`,{className:`flex min-h-svh w-full flex-col items-center justify-center gap-6 bg-muted p-6 md:p-10`,children:(0,M.jsxs)(`div`,{className:`flex w-full max-w-sm flex-col gap-6`,children:[(0,M.jsxs)(`a`,{href:`#`,className:`flex items-center gap-2 self-center font-medium`,children:[(0,M.jsx)(`div`,{className:`flex size-6 items-center justify-center rounded-md bg-primary text-primary-foreground`,children:(0,M.jsx)(Ny,{className:`size-4`})}),`ObjectStack`]}),(0,M.jsx)(`div`,{className:`flex flex-col gap-6`,children:e})]})})}function IP(){let{t:e}=vt(),{user_code:t}=PP.useSearch(),{user:n,loading:r}=iN(),i=Hi(),[a,o]=(0,j.useState)(!1),[s,c]=(0,j.useState)(!1),[l,u]=(0,j.useState)(!1),[d,f]=(0,j.useState)(!1),[p,m]=(0,j.useState)(``);return t?r?(0,M.jsx)(FP,{children:(0,M.jsx)($,{children:(0,M.jsx)(DN,{className:`text-center`,children:(0,M.jsx)(kN,{children:e(`auth.device.loading`)})})})}):n?l?(0,M.jsx)(FP,{children:(0,M.jsx)($,{children:(0,M.jsxs)(DN,{className:`text-center`,children:[(0,M.jsx)(Ey,{className:`h-10 w-10 text-green-500 mx-auto mb-2`}),(0,M.jsx)(ON,{children:e(`auth.device.approvedTitle`)}),(0,M.jsx)(kN,{children:e(`auth.device.approvedDescription`)})]})})}):d?(0,M.jsx)(FP,{children:(0,M.jsx)($,{children:(0,M.jsxs)(DN,{className:`text-center`,children:[(0,M.jsx)(ON,{children:e(`auth.device.deniedTitle`)}),(0,M.jsx)(kN,{children:e(`auth.device.deniedDescription`)})]})})}):(0,M.jsx)(FP,{children:(0,M.jsxs)($,{children:[(0,M.jsxs)(DN,{className:`text-center`,children:[(0,M.jsx)(ON,{children:e(`auth.device.title`)}),(0,M.jsx)(kN,{children:e(`auth.device.subtitle`,{email:n.email})})]}),(0,M.jsxs)(AN,{className:`space-y-4`,children:[(0,M.jsxs)(`div`,{className:`rounded-md border bg-background px-4 py-3 text-center`,children:[(0,M.jsx)(`p`,{className:`text-xs text-muted-foreground mb-1`,children:e(`auth.device.userCodeLabel`)}),(0,M.jsx)(`p`,{className:`font-mono font-semibold tracking-widest text-lg`,children:t})]}),(0,M.jsxs)(`div`,{className:`space-y-4`,children:[(0,M.jsx)(`p`,{className:`text-sm text-center text-muted-foreground`,children:e(`auth.device.loggedInAs`,{email:n.email})}),p&&(0,M.jsx)(`p`,{className:`text-sm text-destructive text-center`,children:p}),(0,M.jsx)(Q,{onClick:async()=>{m(``),o(!0);try{let n=await fetch(`/api/v1/auth/device/approve`,{method:`POST`,headers:{"Content-Type":`application/json`},credentials:`include`,body:JSON.stringify({userCode:t})});if(!n.ok){let t=await n.json().catch(()=>({}));throw Error(t?.message??t?.error?.message??e(`auth.device.approveFailed`))}u(!0),q({title:e(`auth.device.approveSuccess`),description:e(`auth.device.approveSuccessDescription`)})}catch(t){m(t?.message??e(`auth.device.approveFailed`))}finally{o(!1)}},className:`w-full`,disabled:a||s,children:e(a?`auth.device.approving`:`auth.device.approve`)}),(0,M.jsx)(Q,{onClick:async()=>{m(``),c(!0);try{await fetch(`/api/v1/auth/device/deny`,{method:`POST`,headers:{"Content-Type":`application/json`},credentials:`include`,body:JSON.stringify({userCode:t})}),f(!0)}catch(t){m(t?.message??e(`auth.device.denyFailed`))}finally{c(!1)}},variant:`outline`,className:`w-full`,disabled:a||s,children:e(s?`auth.device.denying`:`auth.device.deny`)}),(0,M.jsx)(`div`,{className:`text-center`,children:(0,M.jsx)(`button`,{type:`button`,className:`text-sm text-muted-foreground underline-offset-4 hover:underline`,onClick:()=>i({to:`/`}),children:e(`auth.device.cancel`)})})]})]})]})}):(0,M.jsx)(Ui,{to:`/login`,search:{redirect:`/auth/device?user_code=${encodeURIComponent(t)}`}}):(0,M.jsx)(FP,{children:(0,M.jsx)($,{children:(0,M.jsxs)(DN,{className:`text-center`,children:[(0,M.jsx)(ON,{children:e(`auth.device.invalidTitle`)}),(0,M.jsx)(kN,{children:e(`auth.device.invalidDescription`)})]})})})}var LP=la(`/account/two-factor`)({component:RP});function RP(){let{t:e}=vt(),t=n_(),{user:n,loading:r,refresh:i}=iN(),[a,o]=(0,j.useState)(null),[s,c]=(0,j.useState)(``),[l,u]=(0,j.useState)(!1),[d,f]=(0,j.useState)(null),[p,m]=(0,j.useState)(null),[h,g]=(0,j.useState)(!1),[_,v]=(0,j.useState)(``),[y,b]=(0,j.useState)(!1),[x,S]=(0,j.useState)(``),[C,w]=(0,j.useState)(!1),[T,E]=(0,j.useState)(``),[D,O]=(0,j.useState)(!1),[ee,te]=(0,j.useState)(null);(0,j.useEffect)(()=>{r||o(!!n?.twoFactorEnabled)},[r,n?.twoFactorEnabled]);let ne=async n=>{n.preventDefault(),u(!0);try{let e=await t.auth.twoFactor.enable({password:s});f(e?.totpURI??null),m(e?.backupCodes??null),c(``)}catch(t){q({title:e(`twoFactor.enableFailed`),description:t.message,variant:`destructive`})}finally{u(!1)}},re=async n=>{n.preventDefault(),b(!0);try{await t.auth.twoFactor.verifyTotp({code:_,trustDevice:h}),q({title:e(`twoFactor.enableSuccess`)}),o(!0),f(null),v(``),await i()}catch(t){q({title:e(`twoFactor.invalidCode`),description:t.message,variant:`destructive`})}finally{b(!1)}},ie=async n=>{n.preventDefault(),w(!0);try{await t.auth.twoFactor.disable({password:x}),q({title:e(`twoFactor.disableSuccess`)}),o(!1),S(``),te(null),await i()}catch(t){q({title:e(`twoFactor.disableFailed`),description:t.message,variant:`destructive`})}finally{w(!1)}},ae=async n=>{n.preventDefault(),O(!0);try{te((await t.auth.twoFactor.generateBackupCodes({password:T}))?.backupCodes??[]),E(``),q({title:e(`twoFactor.backupCodes.regenerated`)})}catch(t){q({title:e(`twoFactor.backupCodes.regenerateFailed`),description:t.message,variant:`destructive`})}finally{O(!1)}},oe=async t=>{try{await navigator.clipboard.writeText(t.join(`
|
|
148
|
+
`)),q({title:e(`twoFactor.backupCodes.copied`)})}catch{q({title:e(`twoFactor.backupCodes.copyFailed`),variant:`destructive`})}},k=(0,M.jsx)(mP,{icon:Zy,title:e(`twoFactor.title`),description:e(`twoFactor.notEnabledDescription`),actions:a===!0?(0,M.jsx)(pP,{className:`border-transparent bg-emerald-500/15 font-medium text-emerald-600 dark:text-emerald-400`,children:e(`twoFactor.enabled`)}):a===!1?(0,M.jsx)(pP,{variant:`outline`,className:`font-medium`,children:e(`twoFactor.notEnabled`)}):null});if(a===null)return(0,M.jsxs)(`div`,{className:`space-y-6`,children:[k,(0,M.jsxs)($,{children:[(0,M.jsx)(DN,{children:(0,M.jsx)(ON,{className:`text-base`,children:e(`twoFactor.loadingStatus`)})}),(0,M.jsxs)(AN,{className:`space-y-2`,children:[(0,M.jsx)(Zw,{className:`h-4 w-48`}),(0,M.jsx)(Zw,{className:`h-9 w-full`}),(0,M.jsx)(Zw,{className:`h-9 w-32`})]})]})]});if(d){let t=`https://api.qrserver.com/v1/create-qr-code/?size=200x200&data=${encodeURIComponent(d)}`;return(0,M.jsxs)(`div`,{className:`space-y-6`,children:[k,(0,M.jsxs)($,{children:[(0,M.jsxs)(DN,{children:[(0,M.jsx)(ON,{className:`text-base`,children:e(`twoFactor.setupTitle`)}),(0,M.jsx)(kN,{children:e(`twoFactor.setupDescription`)})]}),(0,M.jsxs)(AN,{className:`space-y-4`,children:[(0,M.jsxs)(`div`,{className:`flex flex-col items-center gap-3`,children:[(0,M.jsx)(`img`,{src:t,alt:e(`twoFactor.qrAlt`),width:200,height:200,className:`rounded border bg-white p-2`}),(0,M.jsx)(`div`,{className:`w-full rounded bg-muted p-3 font-mono text-xs break-all`,children:d}),(0,M.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`twoFactor.uriHint`)})]}),p&&p.length>0&&(0,M.jsxs)(`div`,{className:`rounded border bg-muted/40 p-3`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,M.jsx)(`p`,{className:`text-sm font-medium`,children:e(`twoFactor.backupCodes.savedTitle`)}),(0,M.jsxs)(Q,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>oe(p),children:[(0,M.jsx)(jy,{className:`mr-1 h-3 w-3`}),e(`twoFactor.backupCodes.copy`)]})]}),(0,M.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:e(`twoFactor.backupCodes.savedHint`)}),(0,M.jsx)(`div`,{className:`mt-2 grid grid-cols-2 gap-1 font-mono text-xs`,children:p.map(e=>(0,M.jsx)(`span`,{className:`rounded bg-background px-2 py-1`,children:e},e))})]}),(0,M.jsx)(mS,{}),(0,M.jsxs)(`form`,{onSubmit:re,className:`space-y-3`,children:[(0,M.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,M.jsx)(UN,{htmlFor:`totp-code`,children:e(`twoFactor.verificationCode`)}),(0,M.jsx)(oS,{id:`totp-code`,placeholder:`000000`,maxLength:6,inputMode:`numeric`,autoComplete:`one-time-code`,value:_,onChange:e=>v(e.target.value),required:!0})]}),(0,M.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,M.jsx)(`input`,{type:`checkbox`,checked:h,onChange:e=>g(e.target.checked)}),e(`twoFactor.trustDevice`)]}),(0,M.jsxs)(`div`,{className:`flex gap-2`,children:[(0,M.jsx)(Q,{type:`submit`,disabled:y||_.length<6,children:e(y?`twoFactor.verifying`:`twoFactor.verify`)}),(0,M.jsx)(Q,{type:`button`,variant:`outline`,onClick:()=>f(null),children:e(`twoFactor.cancel`)})]})]})]})]})]})}return a===!0?(0,M.jsxs)(`div`,{className:`space-y-6`,children:[k,(0,M.jsxs)($,{children:[(0,M.jsxs)(DN,{children:[(0,M.jsx)(ON,{className:`text-base`,children:e(`twoFactor.enabledTitle`,{defaultValue:`Authenticator app`})}),(0,M.jsx)(kN,{children:e(`twoFactor.enabledDescription`)})]}),(0,M.jsx)(AN,{children:(0,M.jsxs)(`form`,{onSubmit:ie,className:`space-y-4`,children:[(0,M.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,M.jsx)(UN,{htmlFor:`disable-password`,children:e(`twoFactor.password`)}),(0,M.jsx)(oS,{id:`disable-password`,type:`password`,autoComplete:`current-password`,required:!0,value:x,onChange:e=>S(e.target.value)})]}),(0,M.jsx)(Q,{variant:`destructive`,type:`submit`,disabled:C,children:e(C?`twoFactor.disabling`:`twoFactor.disable`)})]})})]}),(0,M.jsxs)($,{children:[(0,M.jsxs)(DN,{children:[(0,M.jsxs)(ON,{className:`text-base flex items-center gap-2`,children:[(0,M.jsx)(Ly,{className:`h-4 w-4`}),e(`twoFactor.backupCodes.title`)]}),(0,M.jsx)(kN,{children:e(`twoFactor.backupCodes.description`)})]}),(0,M.jsxs)(AN,{className:`space-y-4`,children:[(0,M.jsxs)(`form`,{onSubmit:ae,className:`space-y-3`,children:[(0,M.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,M.jsx)(UN,{htmlFor:`backup-password`,children:e(`twoFactor.password`)}),(0,M.jsx)(oS,{id:`backup-password`,type:`password`,autoComplete:`current-password`,required:!0,value:T,onChange:e=>E(e.target.value)})]}),(0,M.jsxs)(Q,{type:`submit`,variant:`outline`,disabled:D,children:[(0,M.jsx)(Jy,{className:`mr-2 h-4 w-4`}),e(D?`common.saving`:`twoFactor.backupCodes.regenerate`)]})]}),ee&&ee.length>0&&(0,M.jsxs)(`div`,{className:`rounded border bg-muted/40 p-3`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,M.jsx)(`p`,{className:`text-sm font-medium`,children:e(`twoFactor.backupCodes.newTitle`)}),(0,M.jsxs)(Q,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>oe(ee),children:[(0,M.jsx)(jy,{className:`mr-1 h-3 w-3`}),e(`twoFactor.backupCodes.copy`)]})]}),(0,M.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:e(`twoFactor.backupCodes.savedHint`)}),(0,M.jsx)(`div`,{className:`mt-2 grid grid-cols-2 gap-1 font-mono text-xs`,children:ee.map(e=>(0,M.jsx)(`span`,{className:`rounded bg-background px-2 py-1`,children:e},e))})]})]})]})]}):(0,M.jsxs)(`div`,{className:`space-y-6`,children:[k,(0,M.jsxs)($,{children:[(0,M.jsxs)(DN,{children:[(0,M.jsx)(ON,{className:`text-base`,children:e(`twoFactor.enable`)}),(0,M.jsx)(kN,{children:e(`twoFactor.notEnabledDescription`)})]}),(0,M.jsx)(AN,{children:(0,M.jsxs)(`form`,{onSubmit:ne,className:`space-y-4`,children:[(0,M.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,M.jsx)(UN,{htmlFor:`enable-password`,children:e(`twoFactor.password`)}),(0,M.jsx)(oS,{id:`enable-password`,type:`password`,autoComplete:`current-password`,required:!0,value:s,onChange:e=>c(e.target.value),placeholder:e(`twoFactor.passwordPlaceholder`)})]}),(0,M.jsx)(Q,{type:`submit`,disabled:l,className:`bg-brand-gradient text-primary-foreground shadow-sm shadow-primary/20 transition-all hover:opacity-95 hover:shadow-md hover:shadow-primary/30`,children:e(l?`twoFactor.loading`:`twoFactor.enable`)})]})})]})]})}var zP=[[/Edg\//i,`Edge`],[/OPR\//i,`Opera`],[/Chrome\//i,`Chrome`],[/Firefox\//i,`Firefox`],[/Safari\//i,`Safari`]],BP=[[/Windows NT 10/i,`Windows 10/11`],[/Windows/i,`Windows`],[/Mac OS X|Macintosh/i,`macOS`],[/iPhone|iOS/i,`iOS`],[/iPad/i,`iPadOS`],[/Android/i,`Android`],[/Linux/i,`Linux`]];function VP(e){if(!e)return{browser:`Unknown`,os:`Unknown`,device:`desktop`,label:`Unknown device`,icon:Py};let t=zP.find(([t])=>t.test(e))?.[1]??`Browser`,n=BP.find(([t])=>t.test(e))?.[1]??`Unknown OS`,r=/iPad|Tablet/i.test(e),i=!r&&/Mobile|Android|iPhone|iPod/i.test(e),a=r?`tablet`:i?`mobile`:`desktop`,o=Wy;return o=a===`mobile`?$y:a===`tablet`?tb:/Linux|Windows|Mac/i.test(e)?Wy:Py,{browser:t,os:n,device:a,label:`${t} · ${n}`,icon:o}}var HP=la(`/account/sessions`)({component:UP});function UP(){let{t:e}=vt(),t=n_(),{session:n}=iN(),[r,i]=(0,j.useState)([]),[a,o]=(0,j.useState)(!0),[s,c]=(0,j.useState)(null),[l,u]=(0,j.useState)(!1),d=async()=>{try{i((await t.auth.sessions.list())?.sessions??[])}catch(t){q({title:e(`sessions.loadFailed`),description:t.message,variant:`destructive`})}finally{o(!1)}};(0,j.useEffect)(()=>{d()},[]);let f=async n=>{c(n);try{await t.auth.sessions.revoke(n),q({title:e(`sessions.revoked`)}),await d()}catch(t){q({title:e(`sessions.revokeFailed`),description:t.message,variant:`destructive`})}finally{c(null)}},p=async()=>{u(!0);try{await t.auth.sessions.revokeOthers(),q({title:e(`sessions.othersRevoked`)}),await d()}catch(t){q({title:e(`sessions.revokeOthersFailed`),description:t.message,variant:`destructive`})}finally{u(!1)}},m=n?.token,h=r.find(e=>e.token===m),g=r.filter(e=>e.token!==m);return(0,M.jsxs)(`div`,{className:`space-y-6`,children:[(0,M.jsx)(mP,{icon:Wy,title:e(`sessions.title`),description:e(`sessions.description`),actions:r.length>1?(0,M.jsxs)(Q,{variant:`outline`,size:`sm`,onClick:p,disabled:l,children:[(0,M.jsx)(Vy,{className:`mr-2 h-4 w-4`}),e(l?`sessions.revokingOthers`:`sessions.revokeOthers`)]}):null}),a&&(0,M.jsx)(`div`,{className:`space-y-3`,children:[0,1,2].map(e=>(0,M.jsx)($,{className:`overflow-hidden`,children:(0,M.jsxs)(AN,{className:`flex items-center gap-3 p-4`,children:[(0,M.jsx)(Zw,{className:`size-10 rounded-lg`}),(0,M.jsxs)(`div`,{className:`flex-1 space-y-2`,children:[(0,M.jsx)(Zw,{className:`h-4 w-40`}),(0,M.jsx)(Zw,{className:`h-3 w-64`})]})]})},e))}),!a&&r.length===0&&(0,M.jsx)($,{children:(0,M.jsxs)(AN,{className:`flex flex-col items-center gap-3 p-10 text-center text-sm text-muted-foreground`,children:[(0,M.jsx)(Wy,{className:`size-10 text-muted-foreground/50`}),e(`sessions.empty`)]})}),!a&&h&&(0,M.jsx)(WP,{session:h,isCurrent:!0,revoking:!1,onRevoke:()=>void 0,t:e}),!a&&g.length>0&&(0,M.jsxs)(`div`,{className:`space-y-3`,children:[(0,M.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wider text-muted-foreground`,children:e(`sessions.otherDevices`,{defaultValue:`Other signed-in devices`})}),(0,M.jsx)(`div`,{className:`space-y-2`,children:g.map(t=>(0,M.jsx)(WP,{session:t,isCurrent:!1,revoking:s===t.token,onRevoke:()=>f(t.token),t:e},t.id))})]})]})}function WP({session:e,isCurrent:t,revoking:n,onRevoke:r,t:i}){let a=VP(e.userAgent),o=a.icon;return(0,M.jsx)($,{className:t?`border-primary/40 bg-brand-gradient-subtle shadow-sm shadow-primary/10`:`transition-colors hover:bg-accent/30`,children:(0,M.jsxs)(AN,{className:`flex items-center gap-3 p-4`,children:[(0,M.jsx)(`div`,{className:`flex size-10 shrink-0 items-center justify-center rounded-lg `+(t?`bg-brand-gradient text-primary-foreground shadow-sm shadow-primary/30`:`bg-muted text-muted-foreground`),children:(0,M.jsx)(o,{className:`size-5`})}),(0,M.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,M.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,M.jsx)(`span`,{className:`truncate text-sm font-medium`,children:a.label}),t&&(0,M.jsx)(pP,{className:`border-transparent bg-emerald-500/15 text-[10px] font-medium text-emerald-600 dark:text-emerald-400`,children:i(`sessions.current`)})]}),(0,M.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-muted-foreground`,children:[e.ipAddress&&(0,M.jsx)(`span`,{className:`font-mono`,children:e.ipAddress}),(0,M.jsx)(`span`,{children:i(`sessions.expires`,{date:new Date(e.expiresAt).toLocaleDateString()})})]})]}),!t&&(0,M.jsxs)(Q,{variant:`ghost`,size:`sm`,onClick:r,disabled:n,className:`ml-3 shrink-0 text-muted-foreground hover:text-destructive`,children:[(0,M.jsx)(Vy,{className:`mr-1.5 h-4 w-4`}),i(`sessions.revoke`,{defaultValue:`Revoke`})]})]})})}var GP=Fw,KP=Iw,qP=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(Lw,{ref:n,className:Z(`fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`,e),...t}));qP.displayName=Lw.displayName;var JP=j.forwardRef(({className:e,children:t,...n},r)=>(0,M.jsxs)(KP,{children:[(0,M.jsx)(qP,{}),(0,M.jsxs)(Rw,{ref:r,className:Z(`fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-1/2 data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-1/2 sm:rounded-lg`,e),...n,children:[t,(0,M.jsxs)(Vw,{className:`absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground`,children:[(0,M.jsx)(ub,{className:`h-4 w-4`}),(0,M.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]}));JP.displayName=Rw.displayName;var YP=({className:e,...t})=>(0,M.jsx)(`div`,{className:Z(`flex flex-col space-y-1.5 text-center sm:text-left`,e),...t});YP.displayName=`DialogHeader`;var XP=({className:e,...t})=>(0,M.jsx)(`div`,{className:Z(`flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2`,e),...t});XP.displayName=`DialogFooter`;var ZP=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(zw,{ref:n,className:Z(`text-lg font-semibold leading-none tracking-tight`,e),...t}));ZP.displayName=zw.displayName;var QP=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(Bw,{ref:n,className:Z(`text-sm text-muted-foreground`,e),...t}));QP.displayName=Bw.displayName;var $P=la(`/account/security`)({component:eF});function eF(){let{t:e}=vt(),t=n_(),n=Hi(),{user:r,logout:i}=iN(),[a,o]=(0,j.useState)(``),[s,c]=(0,j.useState)(``),[l,u]=(0,j.useState)(``),[d,f]=(0,j.useState)(!0),[p,m]=(0,j.useState)(!1),[h,g]=(0,j.useState)(``),[_,v]=(0,j.useState)(!1),[y,b]=(0,j.useState)(!1),[x,S]=(0,j.useState)(``),[C,w]=(0,j.useState)(``),[T,E]=(0,j.useState)(!1);return(0,M.jsxs)(`div`,{className:`space-y-6`,children:[(0,M.jsx)(mP,{icon:Qy,title:e(`security.title`),description:e(`security.description`)}),(0,M.jsxs)($,{children:[(0,M.jsxs)(DN,{children:[(0,M.jsxs)(ON,{className:`text-base flex items-center gap-2`,children:[(0,M.jsx)(Qy,{className:`h-4 w-4 text-primary`}),e(`security.changePasswordTitle`,{defaultValue:`Change password`})]}),(0,M.jsx)(kN,{children:e(`security.changePasswordDescription`,{defaultValue:`Use at least 8 characters. Mix letters, numbers and symbols for strength.`})})]}),(0,M.jsx)(AN,{children:(0,M.jsxs)(`form`,{onSubmit:async n=>{if(n.preventDefault(),s!==l){q({title:e(`security.passwordsMismatch`),variant:`destructive`});return}m(!0);try{await t.auth.changePassword({currentPassword:a,newPassword:s,revokeOtherSessions:d}),q({title:e(`security.changed`)}),o(``),c(``),u(``)}catch(t){q({title:e(`security.changeFailed`),description:t.message,variant:`destructive`})}finally{m(!1)}},className:`space-y-4`,children:[(0,M.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,M.jsx)(UN,{htmlFor:`current-password`,children:e(`security.currentPassword`)}),(0,M.jsx)(oS,{id:`current-password`,type:`password`,autoComplete:`current-password`,required:!0,value:a,onChange:e=>o(e.target.value)})]}),(0,M.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,M.jsx)(UN,{htmlFor:`new-password`,children:e(`security.newPassword`)}),(0,M.jsx)(oS,{id:`new-password`,type:`password`,autoComplete:`new-password`,required:!0,minLength:8,value:s,onChange:e=>c(e.target.value)})]}),(0,M.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,M.jsx)(UN,{htmlFor:`confirm-new-password`,children:e(`security.confirmPassword`)}),(0,M.jsx)(oS,{id:`confirm-new-password`,type:`password`,autoComplete:`new-password`,required:!0,minLength:8,value:l,onChange:e=>u(e.target.value)})]}),(0,M.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,M.jsx)(`input`,{type:`checkbox`,checked:d,onChange:e=>f(e.target.checked)}),e(`security.revokeOtherSessions`)]}),(0,M.jsx)(Q,{type:`submit`,disabled:p,children:e(p?`common.saving`:`security.submit`)})]})})]}),(0,M.jsxs)($,{children:[(0,M.jsxs)(DN,{children:[(0,M.jsxs)(ON,{className:`text-base flex items-center gap-2`,children:[(0,M.jsx)(Uy,{className:`h-4 w-4 text-primary`}),e(`security.email.title`)]}),(0,M.jsx)(kN,{children:e(`security.email.description`)})]}),(0,M.jsx)(AN,{children:(0,M.jsxs)(`form`,{onSubmit:async n=>{if(n.preventDefault(),!(!h||h===r?.email)){v(!0);try{await t.auth.changeEmail({newEmail:h,callbackURL:window.location.origin+`/login`}),q({title:e(`security.email.requested`),description:e(`security.email.checkInbox`,{email:h})}),g(``)}catch(t){q({title:e(`security.email.requestFailed`),description:t.message,variant:`destructive`})}finally{v(!1)}}},className:`space-y-4`,children:[(0,M.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,M.jsx)(UN,{htmlFor:`current-email`,children:e(`security.email.current`)}),(0,M.jsx)(oS,{id:`current-email`,value:r?.email??``,disabled:!0})]}),(0,M.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,M.jsx)(UN,{htmlFor:`new-email`,children:e(`security.email.new`)}),(0,M.jsx)(oS,{id:`new-email`,type:`email`,value:h,onChange:e=>g(e.target.value),placeholder:e(`security.email.placeholder`),required:!0})]}),(0,M.jsx)(Q,{type:`submit`,disabled:_||!h||h===r?.email,children:e(_?`common.saving`:`security.email.submit`)})]})})]}),(0,M.jsxs)($,{className:`border-destructive/40 bg-destructive/5`,children:[(0,M.jsxs)(DN,{children:[(0,M.jsxs)(ON,{className:`text-base flex items-center gap-2 text-destructive`,children:[(0,M.jsx)(rb,{className:`h-4 w-4`}),e(`security.delete.title`)]}),(0,M.jsx)(kN,{children:e(`security.delete.description`)})]}),(0,M.jsx)(AN,{children:(0,M.jsxs)(Q,{variant:`destructive`,onClick:()=>b(!0),children:[(0,M.jsx)(nb,{className:`mr-2 h-4 w-4`}),e(`security.delete.cta`)]})})]}),(0,M.jsx)(GP,{open:y,onOpenChange:b,children:(0,M.jsxs)(JP,{children:[(0,M.jsxs)(YP,{children:[(0,M.jsx)(ZP,{children:e(`security.delete.dialogTitle`)}),(0,M.jsx)(QP,{children:e(`security.delete.dialogDescription`,{email:r?.email??``})})]}),(0,M.jsxs)(`div`,{className:`space-y-4`,children:[(0,M.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,M.jsx)(UN,{htmlFor:`delete-password`,children:e(`security.delete.password`)}),(0,M.jsx)(oS,{id:`delete-password`,type:`password`,autoComplete:`current-password`,value:x,onChange:e=>S(e.target.value)})]}),(0,M.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,M.jsx)(UN,{htmlFor:`delete-confirm`,children:e(`security.delete.typeEmail`,{email:r?.email??``})}),(0,M.jsx)(oS,{id:`delete-confirm`,value:C,onChange:e=>w(e.target.value),placeholder:r?.email??``})]})]}),(0,M.jsxs)(XP,{children:[(0,M.jsx)(Q,{variant:`outline`,onClick:()=>b(!1),disabled:T,children:e(`common.cancel`)}),(0,M.jsx)(Q,{variant:`destructive`,onClick:async()=>{if(C!==r?.email){q({title:e(`security.delete.confirmationMismatch`),description:e(`security.delete.confirmationHint`,{email:r?.email??``}),variant:`destructive`});return}E(!0);try{await t.auth.deleteUser({password:x}),q({title:e(`security.delete.success`)});try{await i()}catch{}n({to:`/login`,replace:!0})}catch(t){q({title:e(`security.delete.failed`),description:t.message,variant:`destructive`})}finally{E(!1)}},disabled:T||C!==r?.email,children:e(T?`common.saving`:`security.delete.confirm`)})]})]})})]})}var tF=la(`/account/profile`)({component:nF});function nF(){let{t:e}=vt(),t=n_(),{user:n,refresh:r}=iN(),[i,a]=(0,j.useState)(n?.name??``),[o,s]=(0,j.useState)(n?.image??null),[c,l]=(0,j.useState)(!1),[u,d]=(0,j.useState)(!1),f=(0,j.useRef)(null);(0,j.useEffect)(()=>{a(n?.name??``),s(n?.image??null)},[n?.id,n?.name,n?.image]);let p=async n=>{n.preventDefault(),l(!0);try{await t.auth.updateUser({name:i,image:o}),await r(),q({title:e(`profile.updated`)})}catch(t){q({title:e(`profile.updateFailed`),description:t.message,variant:`destructive`})}finally{l(!1)}},m=()=>f.current?.click(),h=async n=>{let i=n.target.files?.[0];if(n.target.value=``,i){d(!0);try{if(!t?.storage?.upload)throw Error(e(`profile.avatarStorageUnavailable`));let n=await t.storage.upload(i,`user`),a=n?.data?.url??n?.url;if(!a)throw Error(`Upload returned no URL`);s(a),await t.auth.updateUser({image:a}),await r(),q({title:e(`profile.avatarUpdated`)})}catch(t){q({title:e(`profile.avatarUploadFailed`),description:t.message,variant:`destructive`})}finally{d(!1)}}},g=(n?.name??n?.email??`?`).split(/\s+/).map(e=>e[0]).join(``).slice(0,2).toUpperCase();return(0,M.jsxs)(`div`,{className:`space-y-6`,children:[(0,M.jsxs)(`div`,{className:`relative overflow-hidden rounded-xl border bg-card`,children:[(0,M.jsx)(`div`,{className:`absolute inset-x-0 top-0 h-24 bg-brand-gradient`,"aria-hidden":!0}),(0,M.jsx)(`div`,{className:`absolute inset-x-0 top-0 h-24 opacity-30`,style:{backgroundImage:`radial-gradient(ellipse at 20% 0%, rgba(255,255,255,0.4), transparent 60%)`},"aria-hidden":!0}),(0,M.jsx)(`div`,{className:`relative px-5 pb-5 pt-12 sm:px-6 sm:pb-6 sm:pt-16`,children:(0,M.jsxs)(`div`,{className:`flex flex-col gap-4 sm:flex-row sm:items-end sm:gap-5`,children:[(0,M.jsxs)(YM,{className:`size-20 shrink-0 ring-4 ring-card shadow-md`,children:[o?(0,M.jsx)(XM,{src:o,alt:n?.name??``}):null,(0,M.jsx)(ZM,{className:`bg-brand-gradient text-base font-semibold text-primary-foreground`,children:g})]}),(0,M.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1`,children:[(0,M.jsx)(`h2`,{className:`truncate text-xl font-semibold tracking-tight`,children:n?.name||e(`profile.namePlaceholder`)}),(0,M.jsx)(`p`,{className:`truncate text-sm text-muted-foreground`,children:n?.email})]}),(0,M.jsxs)(Q,{type:`button`,variant:`outline`,size:`sm`,onClick:m,disabled:u,className:`self-start sm:self-auto`,children:[(0,M.jsx)(ib,{className:`mr-2 h-4 w-4`}),e(u?`profile.avatarUploading`:`profile.changeAvatar`)]}),(0,M.jsx)(`input`,{ref:f,type:`file`,accept:`image/*`,className:`hidden`,onChange:h})]})})]}),(0,M.jsxs)($,{children:[(0,M.jsxs)(DN,{children:[(0,M.jsx)(ON,{className:`text-base`,children:e(`profile.title`)}),(0,M.jsx)(kN,{children:e(`profile.description`)})]}),(0,M.jsx)(AN,{children:(0,M.jsxs)(`form`,{onSubmit:p,className:`space-y-4`,children:[(0,M.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,M.jsx)(UN,{htmlFor:`profile-email`,children:e(`profile.email`)}),(0,M.jsx)(oS,{id:`profile-email`,value:n?.email??``,disabled:!0})]}),(0,M.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,M.jsx)(UN,{htmlFor:`profile-name`,children:e(`profile.name`)}),(0,M.jsx)(oS,{id:`profile-name`,value:i,onChange:e=>a(e.target.value),placeholder:e(`profile.namePlaceholder`)})]}),(0,M.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`profile.avatarHint`)}),(0,M.jsx)(Q,{type:`submit`,disabled:c,className:`bg-brand-gradient text-primary-foreground shadow-sm shadow-primary/20 transition-all hover:opacity-95 hover:shadow-md hover:shadow-primary/30`,children:e(c?`common.saving`:`profile.save`)})]})})]})]})}var rF=la(`/account/linked-accounts`)({component:aF}),iF={google:`Google`,github:`GitHub`,microsoft:`Microsoft`,apple:`Apple`,discord:`Discord`,gitlab:`GitLab`,twitter:`Twitter / X`,facebook:`Facebook`};function aF(){let{t:e}=vt(),t=n_(),[n,r]=(0,j.useState)([]),[i,a]=(0,j.useState)(!0),[o,s]=(0,j.useState)(null),c=(0,j.useCallback)(async()=>{if(t?.auth?.accounts){a(!0);try{let e=await t.auth.accounts.list();r(e?.accounts??e?.data??(Array.isArray(e)?e:[]))}catch{r([])}finally{a(!1)}}},[t]);(0,j.useEffect)(()=>{c()},[c]);let l=async n=>{if(confirm(e(`linkedAccounts.unlinkConfirm`,{provider:iF[n.providerId]??n.providerId}))){s(n.id);try{await t.auth.accounts.unlink({providerId:n.providerId,accountId:n.accountId}),q({title:e(`linkedAccounts.unlinked`)}),await c()}catch(t){q({title:e(`linkedAccounts.unlinkFailed`),description:t.message,variant:`destructive`})}finally{s(null)}}},u=async n=>{try{let r=await t.auth.accounts.linkSocial({provider:n,callbackURL:window.location.href}),i=r?.url??r?.data?.url;i?window.location.assign(i):q({title:e(`linkedAccounts.linkFailed`),variant:`destructive`})}catch(t){q({title:e(`linkedAccounts.linkFailed`),description:t.message,variant:`destructive`})}},d=new Set(n.map(e=>e.providerId)),f=Object.keys(iF).filter(e=>!d.has(e));return(0,M.jsxs)(`div`,{className:`space-y-6`,children:[(0,M.jsx)(mP,{icon:By,title:e(`linkedAccounts.title`),description:e(`linkedAccounts.description`)}),(0,M.jsxs)($,{children:[(0,M.jsxs)(DN,{children:[(0,M.jsx)(ON,{className:`text-base`,children:e(`linkedAccounts.connectedTitle`,{defaultValue:`Connected providers`})}),(0,M.jsx)(kN,{children:e(`linkedAccounts.connectedDescription`,{defaultValue:`Sign-in providers currently linked to this account.`})})]}),(0,M.jsxs)(AN,{children:[i&&(0,M.jsxs)(`div`,{className:`space-y-3`,children:[(0,M.jsx)(Zw,{className:`h-12 w-full`}),(0,M.jsx)(Zw,{className:`h-12 w-full`})]}),!i&&n.length===0&&(0,M.jsxs)(`div`,{className:`text-center py-8`,children:[(0,M.jsx)(By,{className:`mx-auto h-12 w-12 text-muted-foreground/50`}),(0,M.jsx)(`p`,{className:`mt-4 text-sm text-muted-foreground`,children:e(`linkedAccounts.empty`)})]}),!i&&n.length>0&&(0,M.jsx)(`div`,{className:`divide-y`,children:n.map(t=>(0,M.jsxs)(`div`,{className:`flex items-center justify-between py-3`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,M.jsx)(pP,{variant:`secondary`,children:iF[t.providerId]??t.providerId}),t.createdAt&&(0,M.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e(`linkedAccounts.linkedOn`,{date:new Date(t.createdAt).toLocaleDateString()})})]}),(0,M.jsxs)(Q,{variant:`ghost`,size:`sm`,disabled:o===t.id,onClick:()=>l(t),children:[(0,M.jsx)(zy,{className:`mr-1 h-4 w-4`}),e(`linkedAccounts.unlink`)]})]},t.id))})]})]}),f.length>0&&(0,M.jsxs)($,{children:[(0,M.jsxs)(DN,{children:[(0,M.jsx)(ON,{className:`text-base`,children:e(`linkedAccounts.addTitle`)}),(0,M.jsx)(kN,{children:e(`linkedAccounts.addDescription`)})]}),(0,M.jsx)(AN,{children:(0,M.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:f.map(e=>(0,M.jsxs)(Q,{variant:`outline`,size:`sm`,onClick:()=>u(e),children:[(0,M.jsx)(qy,{className:`mr-1 h-3 w-3`}),iF[e]]},e))})})]})]})}function oF(e){let t=n_(),[n,r]=(0,j.useState)([]),[i,a]=(0,j.useState)(!1),[o,s]=(0,j.useState)(null),c=(0,j.useCallback)(async()=>{if(!(!e||!t?.organizations)){a(!0),s(null);try{let n=await t.organizations.listMembers(e);r(n?.members??n?.data?.members??(Array.isArray(n)?n:[]))}catch(e){s(e),r([])}finally{a(!1)}}},[t,e]);return(0,j.useEffect)(()=>{c()},[c]),{members:n,loading:i,error:o,reload:c,inviteMember:(0,j.useCallback)(async(n,r=`member`)=>{if(!e||!t?.organizations)throw Error(`Organization ID or client not available`);let i=await t.organizations.invite({email:n,role:r,organizationId:e});return await c(),i},[t,e,c]),removeMember:(0,j.useCallback)(async n=>{if(!e||!t?.organizations?.removeMember)throw Error(`Organization ID or client not available`);let r=await t.organizations.removeMember(e,{memberIdOrEmail:n});return await c(),r},[t,e,c]),updateMemberRole:(0,j.useCallback)(async(n,r)=>{if(!e||!t?.organizations?.updateMemberRole)throw Error(`Organization ID or client not available`);let i=await t.organizations.updateMemberRole(e,{memberId:n,role:r});return await c(),i},[t,e,c])}}function sF(e){let t=n_(),[n,r]=(0,j.useState)([]),[i,a]=(0,j.useState)(!1),[o,s]=(0,j.useState)(null),c=(0,j.useCallback)(async()=>{if(!(!e||!t?.organizations?.invitations)){a(!0),s(null);try{let n=await t.organizations.invitations.list(e);r(n?.invitations??n?.data?.invitations??(Array.isArray(n)?n:[]))}catch(e){s(e),r([])}finally{a(!1)}}},[t,e]);return(0,j.useEffect)(()=>{c()},[c]),{invitations:n,loading:i,error:o,reload:c,cancelInvitation:(0,j.useCallback)(async e=>{if(!t?.organizations?.invitations?.cancel)throw Error(`Client not available`);let n=await t.organizations.invitations.cancel(e);return await c(),n},[t,c]),resendInvitation:(0,j.useCallback)(async e=>{if(!t?.organizations?.invitations?.resend)throw Error(`Client not available`);let n=await t.organizations.invitations.resend({id:e.id,email:e.email,role:e.role,organizationId:e.organizationId,teamId:e.teamId??null});return await c(),n},[t,c])}}function cF(){let e=n_(),[t,n]=(0,j.useState)([]),[r,i]=(0,j.useState)(!1),[a,o]=(0,j.useState)(null),s=(0,j.useCallback)(async()=>{if(e?.organizations?.invitations?.listMine){i(!0),o(null);try{let t=await e.organizations.invitations.listMine();n(t?.invitations??t?.data?.invitations??(Array.isArray(t)?t:[]))}catch(e){o(e),n([])}finally{i(!1)}}},[e]);return(0,j.useEffect)(()=>{s()},[s]),{invitations:t,loading:r,error:a,reload:s,accept:(0,j.useCallback)(async t=>{let n=await e.organizations.invitations.accept(t);return await s(),n},[e,s]),reject:(0,j.useCallback)(async t=>{let n=await e.organizations.invitations.reject(t);return await s(),n},[e,s])}}var lF=la(`/account/invitations`)({component:uF});function uF(){let{t:e}=vt(),{invitations:t,loading:n,accept:r,reject:i}=cF(),a=t.filter(e=>e.status===`pending`),o=async t=>{try{await r(t),q({title:e(`invitations.accepted`)})}catch(t){q({title:e(`invitations.acceptFailed`),description:t.message,variant:`destructive`})}},s=async t=>{try{await i(t),q({title:e(`invitations.rejected`)})}catch(t){q({title:e(`invitations.rejectFailed`),description:t.message,variant:`destructive`})}};return(0,M.jsxs)(`div`,{className:`space-y-6`,children:[(0,M.jsx)(mP,{icon:Iy,title:e(`invitations.title`),description:e(`invitations.description`),actions:a.length>0?(0,M.jsx)(pP,{variant:`outline`,className:`font-medium`,children:e(`invitations.pendingCount`,{count:a.length,defaultValue:`{{count}} pending`})}):null}),(0,M.jsxs)($,{children:[(0,M.jsxs)(DN,{children:[(0,M.jsx)(ON,{className:`text-base`,children:e(`invitations.pendingTitle`,{defaultValue:`Pending invitations`})}),(0,M.jsx)(kN,{children:e(`invitations.pendingDescription`,{defaultValue:`Accept to join an organization, or reject to remove it from your inbox.`})})]}),(0,M.jsxs)(AN,{children:[n&&(0,M.jsxs)(`div`,{className:`space-y-3`,children:[(0,M.jsx)(Zw,{className:`h-12 w-full`}),(0,M.jsx)(Zw,{className:`h-12 w-full`})]}),!n&&a.length===0&&(0,M.jsxs)(`div`,{className:`text-center py-8`,children:[(0,M.jsx)(Iy,{className:`mx-auto h-12 w-12 text-muted-foreground/50`}),(0,M.jsx)(`p`,{className:`mt-4 text-sm text-muted-foreground`,children:e(`invitations.empty`)})]}),!n&&a.length>0&&(0,M.jsx)(`div`,{className:`divide-y`,children:a.map(t=>(0,M.jsxs)(`div`,{className:`flex items-center justify-between py-3`,children:[(0,M.jsxs)(`div`,{className:`flex-1`,children:[(0,M.jsx)(`div`,{className:`text-sm font-medium`,children:t.organizationId}),(0,M.jsxs)(`div`,{className:`flex items-center gap-2 mt-1`,children:[(0,M.jsx)(pP,{variant:`outline`,className:`text-xs`,children:e(`common.roles.${t.role}`)}),(0,M.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e(`invitations.expires`,{date:new Date(t.expiresAt).toLocaleDateString()})})]})]}),(0,M.jsxs)(`div`,{className:`flex gap-2`,children:[(0,M.jsxs)(Q,{size:`sm`,onClick:()=>o(t.id),children:[(0,M.jsx)(xy,{className:`mr-1 h-4 w-4`}),e(`invitations.accept`)]}),(0,M.jsxs)(Q,{size:`sm`,variant:`outline`,onClick:()=>s(t.id),children:[(0,M.jsx)(ub,{className:`mr-1 h-4 w-4`}),e(`invitations.reject`)]})]})]},t.id))})]})]})]})}var dF=la(`/accept-invitation/$invitationId`)({component:fF});function fF(){let{t:e}=vt(),{invitationId:t}=dF.useParams(),n=Hi(),r=n_(),{user:i,loading:a,reloadOrganizations:o}=iN(),[s,c]=(0,j.useState)(!1),[l,u]=(0,j.useState)(!1);return(0,j.useEffect)(()=>{a||i||n({to:`/login`,search:{redirect:`/accept-invitation/${t}`},replace:!0})},[a,i,t,n]),(0,M.jsx)(`div`,{className:`flex min-h-svh w-full flex-col items-center justify-center gap-6 bg-muted p-6 md:p-10`,children:(0,M.jsx)(`div`,{className:`flex w-full max-w-sm flex-col gap-6`,children:(0,M.jsxs)($,{children:[(0,M.jsxs)(DN,{className:`text-center`,children:[(0,M.jsx)(ON,{className:`text-xl`,children:e(`acceptInvitation.title`)}),(0,M.jsx)(kN,{children:e(`acceptInvitation.description`)})]}),(0,M.jsxs)(AN,{className:`flex flex-col gap-3`,children:[(0,M.jsx)(Q,{className:`w-full`,onClick:async()=>{c(!0);try{await r.organizations.invitations.accept(t),await o().catch(()=>{}),q({title:e(`acceptInvitation.accepted`)}),n({to:`/organizations`})}catch(t){q({title:e(`acceptInvitation.acceptFailed`),description:t.message,variant:`destructive`})}finally{c(!1)}},disabled:s||l,children:e(s?`acceptInvitation.accepting`:`acceptInvitation.accept`)}),(0,M.jsx)(Q,{variant:`outline`,className:`w-full`,onClick:async()=>{u(!0);try{await r.organizations.invitations.reject(t),q({title:e(`acceptInvitation.declined`)}),n({to:`/organizations`})}catch(t){q({title:e(`acceptInvitation.declineFailed`),description:t.message,variant:`destructive`})}finally{u(!1)}},disabled:s||l,children:e(l?`acceptInvitation.declining`:`acceptInvitation.decline`)})]})]})})})}var pF=la(`/organizations/$orgId/`)({component:()=>{let{orgId:e}=pF.useParams();return(0,M.jsx)(Ui,{to:`/organizations/$orgId/general`,params:{orgId:e},replace:!0})}}),mF=la(`/account/oauth-applications/`)({component:hF});function hF(){let{t:e}=vt(),t=Hi(),{applications:n,loading:r,reload:i}=DP(),{remove:a,deleting:o}=kP(),[s,c]=(0,j.useState)(null);return(0,M.jsxs)(`div`,{className:`space-y-6`,children:[(0,M.jsx)(mP,{icon:Ly,title:e(`oauth.applications.title`),description:e(`oauth.applications.description`),actions:(0,M.jsxs)(Q,{onClick:()=>t({to:`/account/oauth-applications/new`}),className:`bg-brand-gradient text-primary-foreground shadow-sm shadow-primary/20 transition-all hover:opacity-95 hover:shadow-md hover:shadow-primary/30`,children:[(0,M.jsx)(qy,{className:`mr-2 h-4 w-4`}),e(`oauth.applications.new`)]})}),r?(0,M.jsx)(`div`,{className:`space-y-3`,children:[0,1,2].map(e=>(0,M.jsx)($,{children:(0,M.jsxs)(AN,{className:`flex items-center gap-3 p-4`,children:[(0,M.jsx)(Zw,{className:`size-10 rounded-md`}),(0,M.jsxs)(`div`,{className:`flex-1 space-y-2`,children:[(0,M.jsx)(Zw,{className:`h-4 w-40`}),(0,M.jsx)(Zw,{className:`h-3 w-64`})]})]})},e))}):n.length===0?(0,M.jsx)($,{children:(0,M.jsxs)(AN,{className:`flex flex-col items-center gap-3 p-12 text-center`,children:[(0,M.jsx)(`div`,{className:`flex size-12 items-center justify-center rounded-lg bg-brand-gradient-subtle text-primary ring-1 ring-primary/15`,children:(0,M.jsx)(Ly,{className:`h-6 w-6`})}),(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`p`,{className:`font-medium`,children:e(`oauth.applications.emptyTitle`)}),(0,M.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`oauth.applications.emptyDescription`)})]}),(0,M.jsxs)(Q,{onClick:()=>t({to:`/account/oauth-applications/new`}),className:`bg-brand-gradient text-primary-foreground shadow-sm shadow-primary/20`,children:[(0,M.jsx)(qy,{className:`mr-2 h-4 w-4`}),e(`oauth.applications.register`)]})]})}):(0,M.jsx)(`div`,{className:`grid gap-3`,children:n.map(t=>(0,M.jsx)($,{className:`group transition-all hover:-translate-y-0.5 hover:border-primary/30 hover:shadow-md hover:shadow-primary/5`,children:(0,M.jsx)(DN,{className:`pb-3`,children:(0,M.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,M.jsxs)(ra,{to:`/account/oauth-applications/$clientId`,params:{clientId:t.client_id},className:`flex flex-1 items-center gap-3`,children:[(0,M.jsx)(`div`,{className:`flex size-10 shrink-0 items-center justify-center rounded-md bg-brand-gradient-subtle text-primary ring-1 ring-primary/15 transition-transform group-hover:scale-105`,children:(0,M.jsx)(Ly,{className:`h-5 w-5`})}),(0,M.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,M.jsx)(ON,{className:`text-base`,children:t.name}),(0,M.jsx)(kN,{className:`font-mono text-xs`,children:t.client_id})]}),(0,M.jsx)(pP,{variant:`outline`,className:`capitalize`,children:t.type}),t.disabled&&(0,M.jsx)(pP,{variant:`destructive`,children:e(`oauth.applications.disabled`)})]}),(0,M.jsx)(Q,{variant:`ghost`,size:`icon`,className:`text-muted-foreground hover:text-destructive`,onClick:e=>{e.preventDefault(),e.stopPropagation(),c(t)},children:(0,M.jsx)(nb,{className:`h-4 w-4`})})]})})},t.id))}),(0,M.jsx)(GP,{open:!!s,onOpenChange:e=>!e&&c(null),children:(0,M.jsxs)(JP,{children:[(0,M.jsxs)(YP,{children:[(0,M.jsx)(ZP,{children:e(`oauth.applications.deleteDialogTitle`)}),(0,M.jsx)(QP,{children:e(`oauth.applications.deleteDialogDescription`,{name:s?.name??``})})]}),(0,M.jsxs)(XP,{children:[(0,M.jsx)(Q,{variant:`outline`,onClick:()=>c(null),disabled:o,children:e(`common.cancel`)}),(0,M.jsx)(Q,{variant:`destructive`,onClick:async()=>{if(s)try{await a(s.client_id),q({title:e(`oauth.applications.deleted`)}),c(null),await i()}catch(t){q({title:e(`oauth.applications.deleteFailed`),description:t.message,variant:`destructive`})}},disabled:o,children:e(o?`oauth.applications.deleting`:`common.delete`)})]})]})})]})}function gF(e,[t,n]){return Math.min(n,Math.max(t,e))}function _F(e){let t=j.useRef({value:e,previous:e});return j.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var vF=[` `,`Enter`,`ArrowUp`,`ArrowDown`],yF=[` `,`Enter`],bF=`Select`,[xF,SF,CF]=D_(bF),[wF,TF]=v_(bF,[CF,gD]),EF=gD(),[DF,OF]=wF(bF),[kF,AF]=wF(bF),jF=e=>{let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:c,dir:l,name:u,autoComplete:d,disabled:f,required:p,form:m}=e,h=EF(t),[g,_]=j.useState(null),[v,y]=j.useState(null),[b,x]=j.useState(!1),S=dk(l),[C,w]=nv({prop:r,defaultProp:i??!1,onChange:a,caller:bF}),[T,E]=nv({prop:o,defaultProp:s,onChange:c,caller:bF}),D=j.useRef(null),O=g?m||!!g.closest(`form`):!0,[ee,te]=j.useState(new Set),ne=Array.from(ee).map(e=>e.props.value).join(`;`);return(0,M.jsx)(MD,{...h,children:(0,M.jsxs)(DF,{required:p,scope:t,trigger:g,onTriggerChange:_,valueNode:v,onValueNodeChange:y,valueNodeHasChildren:b,onValueNodeHasChildrenChange:x,contentId:_S(),value:T,onValueChange:E,open:C,onOpenChange:w,dir:S,triggerPointerDownPosRef:D,disabled:f,children:[(0,M.jsx)(xF.Provider,{scope:t,children:(0,M.jsx)(kF,{scope:e.__scopeSelect,onNativeOptionAdd:j.useCallback(e=>{te(t=>new Set(t).add(e))},[]),onNativeOptionRemove:j.useCallback(e=>{te(t=>{let n=new Set(t);return n.delete(e),n})},[]),children:n})}),O?(0,M.jsxs)(EI,{"aria-hidden":!0,required:p,tabIndex:-1,name:u,autoComplete:d,value:T,onChange:e=>E(e.target.value),disabled:f,form:m,children:[T===void 0?(0,M.jsx)(`option`,{value:``}):null,Array.from(ee)]},ne):null]})})};jF.displayName=bF;var MF=`SelectTrigger`,NF=j.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...i}=e,a=EF(n),o=OF(MF,n),s=o.disabled||r,c=g_(t,o.onTriggerChange),l=SF(n),u=j.useRef(`touch`),[d,f,p]=OI(e=>{let t=l().filter(e=>!e.disabled),n=kI(t,e,t.find(e=>e.value===o.value));n!==void 0&&o.onValueChange(n.value)}),m=e=>{s||(o.onOpenChange(!0),p()),e&&(o.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,M.jsx)(ND,{asChild:!0,...a,children:(0,M.jsx)(O_.button,{type:`button`,role:`combobox`,"aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":`none`,dir:o.dir,"data-state":o.open?`open`:`closed`,disabled:s,"data-disabled":s?``:void 0,"data-placeholder":DI(o.value)?``:void 0,...i,ref:c,onClick:J(i.onClick,e=>{e.currentTarget.focus(),u.current!==`mouse`&&m(e)}),onPointerDown:J(i.onPointerDown,e=>{u.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(m(e),e.preventDefault())}),onKeyDown:J(i.onKeyDown,e=>{let t=d.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&f(e.key),!(t&&e.key===` `)&&vF.includes(e.key)&&(m(),e.preventDefault())})})})});NF.displayName=MF;var PF=`SelectValue`,FF=j.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,children:a,placeholder:o=``,...s}=e,c=OF(PF,n),{onValueNodeHasChildrenChange:l}=c,u=a!==void 0,d=g_(t,c.onValueNodeChange);return q_(()=>{l(u)},[l,u]),(0,M.jsx)(O_.span,{...s,ref:d,style:{pointerEvents:`none`},children:DI(c.value)?(0,M.jsx)(M.Fragment,{children:o}):a})});FF.displayName=PF;var IF=`SelectIcon`,LF=j.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,M.jsx)(O_.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})});LF.displayName=IF;var RF=`SelectPortal`,zF=e=>(0,M.jsx)(Y_,{asChild:!0,...e});zF.displayName=RF;var BF=`SelectContent`,VF=j.forwardRef((e,t)=>{let n=OF(BF,e.__scopeSelect),[r,i]=j.useState();if(q_(()=>{i(new DocumentFragment)},[]),!n.open){let t=r;return t?Gi.createPortal((0,M.jsx)(UF,{scope:e.__scopeSelect,children:(0,M.jsx)(xF.Slot,{scope:e.__scopeSelect,children:(0,M.jsx)(`div`,{children:e.children})})}),t):null}return(0,M.jsx)(qF,{...e,ref:t})});VF.displayName=BF;var HF=10,[UF,WF]=wF(BF),GF=`SelectContentImpl`,KF=b_(`SelectContent.RemoveScroll`),qF=j.forwardRef((e,t)=>{let{__scopeSelect:n,position:r=`item-aligned`,onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:o,side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g,..._}=e,v=OF(BF,n),[y,b]=j.useState(null),[x,S]=j.useState(null),C=g_(t,e=>b(e)),[w,T]=j.useState(null),[E,D]=j.useState(null),O=SF(n),[ee,te]=j.useState(!1),ne=j.useRef(!1);j.useEffect(()=>{if(y)return ew(y)},[y]),FS();let re=j.useCallback(e=>{let[t,...n]=O().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&x&&(x.scrollTop=0),n===r&&x&&(x.scrollTop=x.scrollHeight),n?.focus(),document.activeElement!==i))return},[O,x]),ie=j.useCallback(()=>re([w,y]),[re,w,y]);j.useEffect(()=>{ee&&ie()},[ee,ie]);let{onOpenChange:ae,triggerPointerDownPosRef:oe}=v;j.useEffect(()=>{if(y){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(oe.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(oe.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():y.contains(n.target)||ae(!1),document.removeEventListener(`pointermove`,t),oe.current=null};return oe.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[y,ae,oe]),j.useEffect(()=>{let e=()=>ae(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[ae]);let[k,se]=OI(e=>{let t=O().filter(e=>!e.disabled),n=kI(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current.focus())}),ce=j.useCallback((e,t,n)=>{let r=!ne.current&&!n;(v.value!==void 0&&v.value===t||r)&&(T(e),r&&(ne.current=!0))},[v.value]),le=j.useCallback(()=>y?.focus(),[y]),ue=j.useCallback((e,t,n)=>{let r=!ne.current&&!n;(v.value!==void 0&&v.value===t||r)&&D(e)},[v.value]),A=r===`popper`?ZF:YF,de=A===ZF?{side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g}:{};return(0,M.jsx)(UF,{scope:n,content:y,viewport:x,onViewportChange:S,itemRefCallback:ce,selectedItem:w,onItemLeave:le,itemTextRefCallback:ue,focusSelectedItem:ie,selectedItemText:E,position:r,isPositioned:ee,searchRef:k,children:(0,M.jsx)(GC,{as:KF,allowPinchZoom:!0,children:(0,M.jsx)(SS,{asChild:!0,trapped:v.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:J(i,e=>{v.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,M.jsx)(R_,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:(0,M.jsx)(A,{role:`listbox`,id:v.contentId,"data-state":v.open?`open`:`closed`,dir:v.dir,onContextMenu:e=>e.preventDefault(),..._,...de,onPlaced:()=>te(!0),ref:C,style:{display:`flex`,flexDirection:`column`,outline:`none`,..._.style},onKeyDown:J(_.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&se(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=O().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>re(t)),e.preventDefault()}})})})})})})});qF.displayName=GF;var JF=`SelectItemAlignedPosition`,YF=j.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:r,...i}=e,a=OF(BF,n),o=WF(BF,n),[s,c]=j.useState(null),[l,u]=j.useState(null),d=g_(t,e=>u(e)),f=SF(n),p=j.useRef(!1),m=j.useRef(!0),{viewport:h,selectedItem:g,selectedItemText:_,focusSelectedItem:v}=o,y=j.useCallback(()=>{if(a.trigger&&a.valueNode&&s&&l&&h&&g&&_){let e=a.trigger.getBoundingClientRect(),t=l.getBoundingClientRect(),n=a.valueNode.getBoundingClientRect(),i=_.getBoundingClientRect();if(a.dir!==`rtl`){let r=i.left-t.left,a=n.left-r,o=e.left-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-HF,d=gF(a,[HF,Math.max(HF,u-l)]);s.style.minWidth=c+`px`,s.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-HF,d=gF(a,[HF,Math.max(HF,u-l)]);s.style.minWidth=c+`px`,s.style.right=d+`px`}let o=f(),c=window.innerHeight-HF*2,u=h.scrollHeight,d=window.getComputedStyle(l),m=parseInt(d.borderTopWidth,10),v=parseInt(d.paddingTop,10),y=parseInt(d.borderBottomWidth,10),b=parseInt(d.paddingBottom,10),x=m+v+u+b+y,S=Math.min(g.offsetHeight*5,x),C=window.getComputedStyle(h),w=parseInt(C.paddingTop,10),T=parseInt(C.paddingBottom,10),E=e.top+e.height/2-HF,D=c-E,O=g.offsetHeight/2,ee=g.offsetTop+O,te=m+v+ee,ne=x-te;if(te<=E){let e=o.length>0&&g===o[o.length-1].ref.current;s.style.bottom=`0px`;let t=l.clientHeight-h.offsetTop-h.offsetHeight,n=te+Math.max(D,O+(e?T:0)+t+y);s.style.height=n+`px`}else{let e=o.length>0&&g===o[0].ref.current;s.style.top=`0px`;let t=Math.max(E,m+h.offsetTop+(e?w:0)+O)+ne;s.style.height=t+`px`,h.scrollTop=te-E+h.offsetTop}s.style.margin=`${HF}px 0`,s.style.minHeight=S+`px`,s.style.maxHeight=c+`px`,r?.(),requestAnimationFrame(()=>p.current=!0)}},[f,a.trigger,a.valueNode,s,l,h,g,_,a.dir,r]);q_(()=>y(),[y]);let[b,x]=j.useState();return q_(()=>{l&&x(window.getComputedStyle(l).zIndex)},[l]),(0,M.jsx)(QF,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:p,onScrollButtonChange:j.useCallback(e=>{e&&m.current===!0&&(y(),v?.(),m.current=!1)},[y,v]),children:(0,M.jsx)(`div`,{ref:c,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:b},children:(0,M.jsx)(O_.div,{...i,ref:d,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})});YF.displayName=JF;var XF=`SelectPopperPosition`,ZF=j.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=HF,...a}=e,o=EF(n);return(0,M.jsx)(PD,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.style,"--radix-select-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-select-content-available-width":`var(--radix-popper-available-width)`,"--radix-select-content-available-height":`var(--radix-popper-available-height)`,"--radix-select-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-select-trigger-height":`var(--radix-popper-anchor-height)`}})});ZF.displayName=XF;var[QF,$F]=wF(BF,{}),eI=`SelectViewport`,tI=j.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...i}=e,a=WF(eI,n),o=$F(eI,n),s=g_(t,a.onViewportChange),c=j.useRef(0);return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`},nonce:r}),(0,M.jsx)(xF.Slot,{scope:n,children:(0,M.jsx)(O_.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:s,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:J(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=o;if(r?.current&&n){let e=Math.abs(c.current-t.scrollTop);if(e>0){let r=window.innerHeight-HF*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}c.current=t.scrollTop})})})]})});tI.displayName=eI;var nI=`SelectGroup`,[rI,iI]=wF(nI),aI=j.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=_S();return(0,M.jsx)(rI,{scope:n,id:i,children:(0,M.jsx)(O_.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})});aI.displayName=nI;var oI=`SelectLabel`,sI=j.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=iI(oI,n);return(0,M.jsx)(O_.div,{id:i.id,...r,ref:t})});sI.displayName=oI;var cI=`SelectItem`,[lI,uI]=wF(cI),dI=j.forwardRef((e,t)=>{let{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...o}=e,s=OF(cI,n),c=WF(cI,n),l=s.value===r,[u,d]=j.useState(a??``),[f,p]=j.useState(!1),m=g_(t,e=>c.itemRefCallback?.(e,r,i)),h=_S(),g=j.useRef(`touch`),_=()=>{i||(s.onValueChange(r),s.onOpenChange(!1))};if(r===``)throw Error(`A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.`);return(0,M.jsx)(lI,{scope:n,value:r,disabled:i,textId:h,isSelected:l,onItemTextChange:j.useCallback(e=>{d(t=>t||(e?.textContent??``).trim())},[]),children:(0,M.jsx)(xF.ItemSlot,{scope:n,value:r,disabled:i,textValue:u,children:(0,M.jsx)(O_.div,{role:`option`,"aria-labelledby":h,"data-highlighted":f?``:void 0,"aria-selected":l&&f,"data-state":l?`checked`:`unchecked`,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,tabIndex:i?void 0:-1,...o,ref:m,onFocus:J(o.onFocus,()=>p(!0)),onBlur:J(o.onBlur,()=>p(!1)),onClick:J(o.onClick,()=>{g.current!==`mouse`&&_()}),onPointerUp:J(o.onPointerUp,()=>{g.current===`mouse`&&_()}),onPointerDown:J(o.onPointerDown,e=>{g.current=e.pointerType}),onPointerMove:J(o.onPointerMove,e=>{g.current=e.pointerType,i?c.onItemLeave?.():g.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:J(o.onPointerLeave,e=>{e.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:J(o.onKeyDown,e=>{c.searchRef?.current!==``&&e.key===` `||(yF.includes(e.key)&&_(),e.key===` `&&e.preventDefault())})})})})});dI.displayName=cI;var fI=`SelectItemText`,pI=j.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,...a}=e,o=OF(fI,n),s=WF(fI,n),c=uI(fI,n),l=AF(fI,n),[u,d]=j.useState(null),f=g_(t,e=>d(e),c.onItemTextChange,e=>s.itemTextRefCallback?.(e,c.value,c.disabled)),p=u?.textContent,m=j.useMemo(()=>(0,M.jsx)(`option`,{value:c.value,disabled:c.disabled,children:p},c.value),[c.disabled,c.value,p]),{onNativeOptionAdd:h,onNativeOptionRemove:g}=l;return q_(()=>(h(m),()=>g(m)),[h,g,m]),(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(O_.span,{id:c.textId,...a,ref:f}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren?Gi.createPortal(a.children,o.valueNode):null]})});pI.displayName=fI;var mI=`SelectItemIndicator`,hI=j.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return uI(mI,n).isSelected?(0,M.jsx)(O_.span,{"aria-hidden":!0,...r,ref:t}):null});hI.displayName=mI;var gI=`SelectScrollUpButton`,_I=j.forwardRef((e,t)=>{let n=WF(gI,e.__scopeSelect),r=$F(gI,e.__scopeSelect),[i,a]=j.useState(!1),o=g_(t,r.onScrollButtonChange);return q_(()=>{if(n.viewport&&n.isPositioned){let e=function(){a(t.scrollTop>0)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,M.jsx)(bI,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});_I.displayName=gI;var vI=`SelectScrollDownButton`,yI=j.forwardRef((e,t)=>{let n=WF(vI,e.__scopeSelect),r=$F(vI,e.__scopeSelect),[i,a]=j.useState(!1),o=g_(t,r.onScrollButtonChange);return q_(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight;a(Math.ceil(t.scrollTop)<e)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,M.jsx)(bI,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});yI.displayName=vI;var bI=j.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=WF(`SelectScrollButton`,n),o=j.useRef(null),s=SF(n),c=j.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return j.useEffect(()=>()=>c(),[c]),q_(()=>{s().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[s]),(0,M.jsx)(O_.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:J(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:J(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:J(i.onPointerLeave,()=>{c()})})}),xI=`SelectSeparator`,SI=j.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,M.jsx)(O_.div,{"aria-hidden":!0,...r,ref:t})});SI.displayName=xI;var CI=`SelectArrow`,wI=j.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=EF(n),a=OF(CI,n),o=WF(CI,n);return a.open&&o.position===`popper`?(0,M.jsx)(FD,{...i,...r,ref:t}):null});wI.displayName=CI;var TI=`SelectBubbleInput`,EI=j.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{let i=j.useRef(null),a=g_(r,i),o=_F(t);return j.useEffect(()=>{let e=i.current;if(!e)return;let n=window.HTMLSelectElement.prototype,r=Object.getOwnPropertyDescriptor(n,`value`).set;if(o!==t&&r){let n=new Event(`change`,{bubbles:!0});r.call(e,t),e.dispatchEvent(n)}},[o,t]),(0,M.jsx)(O_.select,{...n,style:{...av,...n.style},ref:a,defaultValue:t})});EI.displayName=TI;function DI(e){return e===``||e===void 0}function OI(e){let t=A_(e),n=j.useRef(``),r=j.useRef(0),i=j.useCallback(e=>{let i=n.current+e;t(i),(function e(t){n.current=t,window.clearTimeout(r.current),t!==``&&(r.current=window.setTimeout(()=>e(``),1e3))})(i)},[t]),a=j.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return j.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function kI(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=AI(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function AI(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var jI=jF,MI=NF,NI=FF,PI=LF,FI=zF,II=VF,LI=tI,RI=sI,zI=dI,BI=pI,VI=hI,HI=_I,UI=yI,WI=SI,GI=jI,KI=NI,qI=j.forwardRef(({className:e,children:t,...n},r)=>(0,M.jsxs)(MI,{ref:r,className:Z(`flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1`,e),...n,children:[t,(0,M.jsx)(PI,{asChild:!0,children:(0,M.jsx)(Sy,{className:`h-4 w-4 opacity-50`})})]}));qI.displayName=MI.displayName;var JI=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(HI,{ref:n,className:Z(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,M.jsx)(wy,{className:`h-4 w-4`})}));JI.displayName=HI.displayName;var YI=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(UI,{ref:n,className:Z(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,M.jsx)(Sy,{className:`h-4 w-4`})}));YI.displayName=UI.displayName;var XI=j.forwardRef(({className:e,children:t,position:n=`popper`,...r},i)=>(0,M.jsx)(FI,{children:(0,M.jsxs)(II,{ref:i,className:Z(`relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,n===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,e),position:n,...r,children:[(0,M.jsx)(JI,{}),(0,M.jsx)(LI,{className:Z(`p-1`,n===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]`),children:t}),(0,M.jsx)(YI,{})]})}));XI.displayName=II.displayName;var ZI=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(RI,{ref:n,className:Z(`px-2 py-1.5 text-sm font-semibold`,e),...t}));ZI.displayName=RI.displayName;var QI=j.forwardRef(({className:e,children:t,...n},r)=>(0,M.jsxs)(zI,{ref:r,className:Z(`relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,e),...n,children:[(0,M.jsx)(`span`,{className:`absolute right-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,M.jsx)(VI,{children:(0,M.jsx)(xy,{className:`h-4 w-4`})})}),(0,M.jsx)(BI,{children:t})]}));QI.displayName=zI.displayName;var $I=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(WI,{ref:n,className:Z(`-mx-1 my-1 h-px bg-muted`,e),...t}));$I.displayName=WI.displayName;var eL=la(`/organizations/$orgId/teams`)({component:tL});function tL(){let{t:e}=vt(),{orgId:t}=eL.useParams(),n=n_(),{members:r}=oF(t),[i,a]=(0,j.useState)([]),[o,s]=(0,j.useState)(!0),[c,l]=(0,j.useState)(!1),[u,d]=(0,j.useState)(``),[f,p]=(0,j.useState)(!1),[m,h]=(0,j.useState)(null),[g,_]=(0,j.useState)([]),[v,y]=(0,j.useState)(!1),[b,x]=(0,j.useState)(!1),[S,C]=(0,j.useState)(``),w=(0,j.useCallback)(async()=>{if(n?.organizations?.teams){s(!0);try{a((await n.organizations.teams.list(t))?.teams??[])}catch{a([])}finally{s(!1)}}},[n,t]);(0,j.useEffect)(()=>{w()},[w]);let T=(0,j.useCallback)(async e=>{if(n?.organizations?.teams){y(!0);try{_((await n.organizations.teams.listMembers(e))?.members??[])}catch{_([])}finally{y(!1)}}},[n]);(0,j.useEffect)(()=>{m&&T(m)},[m,T]);let E=async r=>{if(r.preventDefault(),u.trim()){p(!0);try{await n.organizations.teams.create({name:u.trim(),organizationId:t}),q({title:e(`teams.created`)}),l(!1),d(``),await w()}catch(t){q({title:e(`teams.createFailed`),description:t.message,variant:`destructive`})}finally{p(!1)}}},D=async r=>{if(confirm(e(`teams.deleteConfirm`,{name:r.name})))try{await n.organizations.teams.delete({teamId:r.id,organizationId:t}),q({title:e(`teams.deleted`)}),m===r.id&&h(null),await w()}catch(t){q({title:e(`teams.deleteFailed`),description:t.message,variant:`destructive`})}},O=async()=>{if(!(!m||!S))try{await n.organizations.teams.addMember({teamId:m,userId:S}),q({title:e(`teams.memberAdded`)}),x(!1),C(``),await T(m)}catch(t){q({title:e(`teams.addMemberFailed`),description:t.message,variant:`destructive`})}},ee=async(t,r)=>{try{await n.organizations.teams.removeMember({teamId:t,userId:r}),q({title:e(`teams.memberRemoved`)}),await T(t)}catch(t){q({title:e(`teams.removeMemberFailed`),description:t.message,variant:`destructive`})}},te=Object.fromEntries(r.map(e=>[e.userId,e])),ne=new Set(g.map(e=>e.userId)),re=r.filter(e=>!ne.has(e.userId));return(0,M.jsxs)(`div`,{className:`space-y-6`,children:[(0,M.jsxs)($,{children:[(0,M.jsx)(DN,{children:(0,M.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(ON,{className:`text-base`,children:e(`teams.title`,{count:i.length})}),(0,M.jsx)(kN,{children:e(`teams.description`)})]}),(0,M.jsxs)(Q,{size:`sm`,onClick:()=>l(!0),children:[(0,M.jsx)(qy,{className:`mr-2 h-4 w-4`}),e(`teams.create`)]})]})}),(0,M.jsxs)(AN,{children:[o&&(0,M.jsxs)(`div`,{className:`space-y-3`,children:[(0,M.jsx)(Zw,{className:`h-12 w-full`}),(0,M.jsx)(Zw,{className:`h-12 w-full`})]}),!o&&i.length===0&&(0,M.jsxs)(`div`,{className:`text-center py-8`,children:[(0,M.jsx)(sb,{className:`mx-auto h-12 w-12 text-muted-foreground/50`}),(0,M.jsx)(`p`,{className:`mt-4 text-sm text-muted-foreground`,children:e(`teams.empty`)})]}),!o&&i.length>0&&(0,M.jsx)(`div`,{className:`divide-y`,children:i.map(t=>(0,M.jsxs)(`div`,{children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between py-3`,children:[(0,M.jsxs)(`button`,{type:`button`,className:`flex-1 text-left`,onClick:()=>h(m===t.id?null:t.id),children:[(0,M.jsx)(`div`,{className:`font-medium text-sm`,children:t.name}),t.createdAt&&(0,M.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:new Date(t.createdAt).toLocaleDateString()})]}),(0,M.jsxs)(sM,{children:[(0,M.jsx)(cM,{asChild:!0,children:(0,M.jsx)(Q,{variant:`ghost`,size:`sm`,className:`h-8 w-8 p-0`,children:(0,M.jsx)(My,{className:`h-4 w-4`})})}),(0,M.jsx)(dM,{align:`end`,children:(0,M.jsxs)(fM,{className:`text-destructive`,onClick:()=>D(t),children:[(0,M.jsx)(nb,{className:`mr-2 h-4 w-4`}),e(`teams.delete`)]})})]})]}),m===t.id&&(0,M.jsxs)(`div`,{className:`pb-3 pl-4 border-l-2 ml-2 space-y-2`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,M.jsx)(`p`,{className:`text-xs font-medium text-muted-foreground`,children:e(`teams.members`,{count:g.length})}),(0,M.jsxs)(Q,{size:`sm`,variant:`outline`,onClick:()=>x(!0),children:[(0,M.jsx)(ob,{className:`mr-1 h-3 w-3`}),e(`teams.addMember`)]})]}),v&&(0,M.jsx)(Zw,{className:`h-8 w-full`}),!v&&g.length===0&&(0,M.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`teams.noMembers`)}),!v&&g.map(e=>{let n=te[e.userId];return(0,M.jsxs)(`div`,{className:`flex items-center justify-between py-1`,children:[(0,M.jsx)(`span`,{className:`text-sm`,children:n?.user?.name||n?.user?.email||e.userId}),(0,M.jsx)(Q,{variant:`ghost`,size:`sm`,className:`h-7 w-7 p-0`,onClick:()=>ee(t.id,e.userId),children:(0,M.jsx)(ab,{className:`h-3 w-3`})})]},e.id)})]})]},t.id))})]})]}),(0,M.jsx)(GP,{open:c,onOpenChange:l,children:(0,M.jsxs)(JP,{children:[(0,M.jsxs)(YP,{children:[(0,M.jsx)(ZP,{children:e(`teams.createTitle`)}),(0,M.jsx)(QP,{children:e(`teams.createDescription`)})]}),(0,M.jsxs)(`form`,{onSubmit:E,children:[(0,M.jsx)(`div`,{className:`space-y-4 py-4`,children:(0,M.jsxs)(`div`,{className:`space-y-2`,children:[(0,M.jsx)(UN,{htmlFor:`team-name`,children:e(`teams.nameLabel`)}),(0,M.jsx)(oS,{id:`team-name`,required:!0,placeholder:e(`teams.namePlaceholder`),value:u,onChange:e=>d(e.target.value)})]})}),(0,M.jsxs)(XP,{children:[(0,M.jsx)(Q,{variant:`outline`,type:`button`,onClick:()=>l(!1),children:e(`common.cancel`)}),(0,M.jsx)(Q,{type:`submit`,disabled:f,children:e(f?`common.saving`:`teams.create`)})]})]})]})}),(0,M.jsx)(GP,{open:b,onOpenChange:x,children:(0,M.jsxs)(JP,{children:[(0,M.jsxs)(YP,{children:[(0,M.jsx)(ZP,{children:e(`teams.addMemberTitle`)}),(0,M.jsx)(QP,{children:e(`teams.addMemberDescription`)})]}),(0,M.jsx)(`div`,{className:`space-y-4 py-4`,children:(0,M.jsxs)(`div`,{className:`space-y-2`,children:[(0,M.jsx)(UN,{children:e(`teams.selectMember`)}),(0,M.jsxs)(GI,{value:S,onValueChange:C,children:[(0,M.jsx)(qI,{children:(0,M.jsx)(KI,{placeholder:e(`teams.selectMemberPlaceholder`)})}),(0,M.jsx)(XI,{children:re.map(e=>(0,M.jsx)(QI,{value:e.userId,children:e.user?.name||e.user?.email||e.userId},e.userId))})]})]})}),(0,M.jsxs)(XP,{children:[(0,M.jsx)(Q,{variant:`outline`,onClick:()=>x(!1),children:e(`common.cancel`)}),(0,M.jsx)(Q,{onClick:O,disabled:!S,children:e(`teams.addMember`)})]})]})})]})}var nL=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`textarea`,{className:Z(`flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50`,e),ref:n,...t}));nL.displayName=`Textarea`;var rL=la(`/organizations/$orgId/members`)({component:iL});function iL(){let{t:e}=vt(),{orgId:t}=rL.useParams(),{organizations:n}=aN(),{user:r}=iN(),i=n_(),a=n.find(e=>e.id===t),{members:o,loading:s,inviteMember:c,removeMember:l,updateMemberRole:u}=oF(t),{invitations:d,loading:f,cancelInvitation:p,resendInvitation:m}=sF(t),[h,g]=(0,j.useState)(!1),[_,v]=(0,j.useState)(!1),[y,b]=(0,j.useState)(``),[x,S]=(0,j.useState)(``),[C,w]=(0,j.useState)(`member`),[T,E]=(0,j.useState)(!1),[D,O]=(0,j.useState)(!1),ee=d.filter(e=>e.status===`pending`),te=o.find(e=>e.userId===r?.id),ne=te?.role===`owner`||te?.role===`admin`,re=async()=>{let t=_?x.split(/[,;\n]+/).map(e=>e.trim()).filter(Boolean):[y.trim()].filter(Boolean);if(t.length===0){q({title:e(`organizations.members.emailRequired`),variant:`destructive`});return}E(!0);let n=0;try{for(let e of t)try{await c(e,C)}catch{n++}n>0&&n<t.length?q({title:e(`organizations.members.invitePartialSuccess`,{sent:t.length-n,failed:n}),variant:`destructive`}):n===t.length?q({title:e(`organizations.members.inviteFailed`),variant:`destructive`}):q({title:e(`organizations.members.invitationSent`)}),g(!1),b(``),S(``),w(`member`)}finally{E(!1)}},ie=async(t,n)=>{if(confirm(e(`organizations.members.removeConfirm`,{name:n})))try{await l(t),q({title:e(`organizations.members.memberRemoved`)})}catch(t){q({title:e(`organizations.members.removeFailed`),description:t.message,variant:`destructive`})}},ae=async(t,n)=>{try{await u(t,n),q({title:e(`organizations.members.roleUpdated`)})}catch(t){q({title:e(`organizations.members.roleUpdateFailed`),description:t.message,variant:`destructive`})}},oe=async()=>{if(confirm(e(`organizations.members.leaveConfirm`,{org:a?.name??t}))){O(!0);try{await i.organizations.leave(t),q({title:e(`organizations.members.leftOrg`)}),window.location.assign(`/`)}catch(t){q({title:e(`organizations.members.leaveFailed`),description:t.message,variant:`destructive`})}finally{O(!1)}}},k=async(t,n)=>{if(confirm(e(`organizations.members.cancelConfirm`,{email:n})))try{await p(t),q({title:e(`organizations.members.invitationCanceled`)})}catch(t){q({title:e(`organizations.members.cancelFailed`),description:t.message,variant:`destructive`})}},se=async t=>{try{await m(t),q({title:e(`organizations.members.invitationResent`)})}catch(t){q({title:e(`organizations.members.resendFailed`),description:t.message,variant:`destructive`})}},ce=async t=>{let n=`${window.location.origin}/accept-invitation/${t}`;try{await navigator.clipboard.writeText(n),q({title:e(`organizations.members.linkCopied`)})}catch{q({title:e(`organizations.members.linkCopyFailed`),variant:`destructive`})}};return(0,M.jsxs)(`div`,{className:`space-y-6`,children:[(0,M.jsxs)($,{children:[(0,M.jsx)(DN,{children:(0,M.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(ON,{className:`text-base`,children:e(`organizations.members.title`,{count:o.length})}),(0,M.jsx)(kN,{children:e(`organizations.members.description`)})]}),(0,M.jsxs)(`div`,{className:`flex gap-2`,children:[te&&te.role!==`owner`&&(0,M.jsxs)(Q,{size:`sm`,variant:`outline`,onClick:oe,disabled:D,children:[(0,M.jsx)(Vy,{className:`mr-2 h-4 w-4`}),e(`organizations.members.leave`)]}),ne&&(0,M.jsxs)(Q,{size:`sm`,onClick:()=>g(!0),children:[(0,M.jsx)(ob,{className:`mr-2 h-4 w-4`}),e(`organizations.members.invite`)]})]})]})}),(0,M.jsxs)(AN,{children:[s&&(0,M.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`organizations.members.loadingMembers`)}),!s&&o.length===0&&(0,M.jsxs)(`div`,{className:`text-center py-8`,children:[(0,M.jsx)(lb,{className:`mx-auto h-12 w-12 text-muted-foreground/50`}),(0,M.jsx)(`p`,{className:`mt-4 text-sm text-muted-foreground`,children:e(`organizations.members.empty`)})]}),!s&&o.length>0&&(0,M.jsx)(`div`,{className:`divide-y`,children:o.map(t=>(0,M.jsxs)(`div`,{className:`flex items-center justify-between py-3`,children:[(0,M.jsxs)(`div`,{className:`flex-1`,children:[(0,M.jsxs)(`div`,{className:`font-medium text-sm`,children:[t.user?.name||t.user?.email||t.userId,t.userId===r?.id&&(0,M.jsx)(pP,{variant:`secondary`,className:`ml-2 text-xs`,children:e(`organizations.members.you`)})]}),t.user?.email&&(0,M.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:t.user.email})]}),(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[ne&&t.role!==`owner`&&t.userId!==r?.id?(0,M.jsxs)(GI,{value:t.role,onValueChange:e=>ae(t.id,e),children:[(0,M.jsx)(qI,{className:`h-7 w-24 text-xs`,children:(0,M.jsx)(KI,{})}),(0,M.jsxs)(XI,{children:[(0,M.jsx)(QI,{value:`admin`,children:e(`common.roles.admin`)}),(0,M.jsx)(QI,{value:`member`,children:e(`common.roles.member`)})]})]}):(0,M.jsx)(pP,{variant:`secondary`,className:`text-xs`,children:e(`common.roles.${t.role??`member`}`)}),ne&&t.role!==`owner`&&t.userId!==r?.id&&(0,M.jsxs)(sM,{children:[(0,M.jsx)(cM,{asChild:!0,children:(0,M.jsx)(Q,{variant:`ghost`,size:`sm`,className:`h-8 w-8 p-0`,children:(0,M.jsx)(My,{className:`h-4 w-4`})})}),(0,M.jsx)(dM,{align:`end`,children:(0,M.jsxs)(fM,{className:`text-destructive`,onClick:()=>ie(t.id,t.user?.name||t.user?.email||t.userId),children:[(0,M.jsx)(nb,{className:`mr-2 h-4 w-4`}),e(`organizations.members.removeMember`)]})})]})]})]},t.id))})]})]}),(0,M.jsxs)($,{children:[(0,M.jsx)(DN,{children:(0,M.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(ON,{className:`text-base`,children:e(`organizations.members.pendingTitle`,{count:ee.length})}),(0,M.jsx)(kN,{children:e(`organizations.members.pendingDescription`)})]}),ne&&(0,M.jsxs)(Q,{size:`sm`,variant:`outline`,onClick:()=>g(!0),children:[(0,M.jsx)(ob,{className:`mr-2 h-4 w-4`}),e(`organizations.members.sendInvitation`)]})]})}),(0,M.jsxs)(AN,{children:[f&&(0,M.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`organizations.members.loadingInvitations`)}),!f&&ee.length===0&&(0,M.jsxs)(`div`,{className:`text-center py-8`,children:[(0,M.jsx)(Uy,{className:`mx-auto h-12 w-12 text-muted-foreground/50`}),(0,M.jsx)(`p`,{className:`mt-4 text-sm text-muted-foreground`,children:e(`organizations.members.noPending`)})]}),!f&&ee.length>0&&(0,M.jsx)(`div`,{className:`divide-y`,children:ee.map(t=>(0,M.jsxs)(`div`,{className:`flex items-center justify-between py-3`,children:[(0,M.jsxs)(`div`,{className:`flex-1`,children:[(0,M.jsx)(`div`,{className:`font-medium text-sm`,children:t.email}),(0,M.jsxs)(`div`,{className:`flex items-center gap-2 mt-1`,children:[(0,M.jsx)(pP,{variant:`outline`,className:`text-xs`,children:e(`common.roles.${t.role}`)}),(0,M.jsxs)(`span`,{className:`text-xs text-muted-foreground flex items-center gap-1`,children:[(0,M.jsx)(Ay,{className:`h-3 w-3`}),e(`organizations.members.expires`,{date:new Date(t.expiresAt).toLocaleDateString()})]})]})]}),(0,M.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,M.jsx)(Q,{variant:`ghost`,size:`sm`,className:`h-8 w-8 p-0`,title:e(`organizations.members.copyLink`),onClick:()=>ce(t.id),children:(0,M.jsx)(jy,{className:`h-4 w-4`})}),(0,M.jsx)(Q,{variant:`ghost`,size:`sm`,className:`h-8 w-8 p-0`,title:e(`organizations.members.resend`),onClick:()=>se(t),children:(0,M.jsx)(Jy,{className:`h-4 w-4`})}),(0,M.jsx)(Q,{variant:`ghost`,size:`sm`,className:`h-8 w-8 p-0`,title:e(`organizations.members.cancel`),onClick:()=>k(t.id,t.email),children:(0,M.jsx)(ub,{className:`h-4 w-4`})})]})]},t.id))})]})]}),(0,M.jsx)(GP,{open:h,onOpenChange:g,children:(0,M.jsxs)(JP,{children:[(0,M.jsxs)(YP,{children:[(0,M.jsx)(ZP,{children:e(`organizations.members.inviteDialogTitle`)}),(0,M.jsx)(QP,{children:e(`organizations.members.inviteDialogDescription`,{organization:a?.name??``})})]}),(0,M.jsxs)(`div`,{className:`space-y-4 py-4`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(Q,{type:`button`,variant:_?`outline`:`default`,size:`sm`,onClick:()=>v(!1),children:e(`organizations.members.singleInvite`)}),(0,M.jsx)(Q,{type:`button`,variant:_?`default`:`outline`,size:`sm`,onClick:()=>v(!0),children:e(`organizations.members.bulkInvite`)})]}),_?(0,M.jsxs)(`div`,{className:`space-y-2`,children:[(0,M.jsx)(UN,{children:e(`organizations.members.bulkEmails`)}),(0,M.jsx)(nL,{placeholder:e(`organizations.members.bulkEmailsPlaceholder`),rows:5,value:x,onChange:e=>S(e.target.value)}),(0,M.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`organizations.members.bulkEmailsHint`)})]}):(0,M.jsxs)(`div`,{className:`space-y-2`,children:[(0,M.jsx)(UN,{htmlFor:`invite-email`,children:e(`organizations.members.email`)}),(0,M.jsx)(oS,{id:`invite-email`,type:`email`,placeholder:e(`organizations.members.emailPlaceholder`),value:y,onChange:e=>b(e.target.value)})]}),(0,M.jsxs)(`div`,{className:`space-y-2`,children:[(0,M.jsx)(UN,{htmlFor:`role`,children:e(`organizations.members.role`)}),(0,M.jsxs)(GI,{value:C,onValueChange:w,children:[(0,M.jsx)(qI,{id:`role`,children:(0,M.jsx)(KI,{})}),(0,M.jsxs)(XI,{children:[(0,M.jsx)(QI,{value:`owner`,children:e(`common.roles.owner`)}),(0,M.jsx)(QI,{value:`admin`,children:e(`common.roles.admin`)}),(0,M.jsx)(QI,{value:`member`,children:e(`common.roles.member`)})]})]})]})]}),(0,M.jsxs)(XP,{children:[(0,M.jsx)(Q,{variant:`outline`,onClick:()=>g(!1),disabled:T,children:e(`common.cancel`)}),(0,M.jsx)(Q,{onClick:re,disabled:T,children:e(T?`organizations.members.sending`:`organizations.members.sendInvitation`)})]})]})})]})}var aL=la(`/organizations/$orgId/general`)({component:oL});function oL(){let{t:e}=vt(),{orgId:t}=aL.useParams(),n=Hi(),{organizations:r}=aN(),{session:i,user:a,setActiveOrganization:o}=iN(),s=r.find(e=>e.id===t),{members:c}=oF(t),{invitations:l}=sF(t),{remove:u,deleting:d}=cN(),{update:f,updating:p}=sN(),[m,h]=(0,j.useState)(``),[g,_]=(0,j.useState)(``),[v,y]=(0,j.useState)(``),[b,x]=(0,j.useState)(!1),[S,C]=(0,j.useState)(``);(0,j.useEffect)(()=>{h(s?.name??``),_(s?.slug??``),y(s?.logo??``)},[s?.id,s?.name,s?.slug,s?.logo]);let w=i?.activeOrganizationId===t,T=l.filter(e=>e.status===`pending`),E=(a?c.find(e=>e.userId===a.id):void 0)?.role??null,D=E===`owner`||E===`admin`,O=D&&s!=null&&(m.trim()!==(s.name??``)||g.trim()!==(s.slug??``)||v.trim()!==(s.logo??``));return(0,M.jsxs)(`div`,{className:`space-y-6`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[w&&(0,M.jsx)(pP,{variant:`outline`,children:e(`organizations.active`)}),E&&(0,M.jsx)(pP,{variant:`secondary`,className:`capitalize`,children:e(`common.roles.${E}`)})]}),!w&&(0,M.jsx)(Q,{size:`sm`,variant:`outline`,onClick:async()=>{try{await o(t),q({title:e(`organizations.general.switched`)})}catch(t){q({title:e(`organizations.general.switchFailed`),description:t.message,variant:`destructive`})}},children:e(`organizations.general.setActive`)})]}),(0,M.jsxs)($,{children:[(0,M.jsxs)(DN,{children:[(0,M.jsx)(ON,{children:e(`organizations.general.detailsTitle`)}),(0,M.jsx)(kN,{children:e(D?`organizations.general.detailsDescription`:`organizations.general.detailsReadOnly`)})]}),(0,M.jsxs)(AN,{className:`space-y-4`,children:[(0,M.jsxs)(`div`,{className:`space-y-2`,children:[(0,M.jsx)(UN,{htmlFor:`org-name`,children:e(`organizations.new.name`)}),(0,M.jsx)(oS,{id:`org-name`,value:m,onChange:e=>h(e.target.value),disabled:!D||p,placeholder:e(`organizations.general.namePlaceholder`)})]}),(0,M.jsxs)(`div`,{className:`space-y-2`,children:[(0,M.jsx)(UN,{htmlFor:`org-slug`,children:e(`organizations.new.slug`)}),(0,M.jsx)(oS,{id:`org-slug`,value:g,onChange:e=>_(e.target.value),disabled:!D||p,placeholder:e(`organizations.general.slugPlaceholder`),className:`font-mono text-sm`}),(0,M.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`organizations.general.slugHint`)})]}),(0,M.jsxs)(`div`,{className:`space-y-2`,children:[(0,M.jsx)(UN,{htmlFor:`org-logo`,children:e(`organizations.general.logo`)}),(0,M.jsx)(oS,{id:`org-logo`,value:v,onChange:e=>y(e.target.value),disabled:!D||p,placeholder:e(`organizations.general.logoPlaceholder`)})]}),(0,M.jsxs)(`div`,{className:`flex justify-between border-t pt-4 text-xs`,children:[(0,M.jsx)(`span`,{className:`text-muted-foreground`,children:e(`organizations.general.organizationId`)}),(0,M.jsx)(`code`,{className:`font-mono`,children:t})]})]}),D&&(0,M.jsxs)(AN,{className:`flex justify-end gap-2 border-t pt-4`,children:[(0,M.jsx)(Q,{variant:`ghost`,size:`sm`,onClick:()=>{h(s?.name??``),_(s?.slug??``),y(s?.logo??``)},disabled:!O||p,children:e(`organizations.general.reset`)}),(0,M.jsxs)(Q,{size:`sm`,onClick:async()=>{if(!s||!D||!O)return;let n=m.trim();if(!n){q({title:e(`organizations.general.nameRequired`),variant:`destructive`});return}try{await f(t,{name:n,slug:g.trim()||void 0,logo:v.trim()||void 0}),q({title:e(`organizations.general.updated`)})}catch(t){q({title:e(`organizations.general.updateFailed`),description:t.message,variant:`destructive`})}},disabled:!O||p,children:[(0,M.jsx)(Yy,{className:`mr-2 h-4 w-4`}),e(p?`common.saving`:`organizations.general.save`)]})]})]}),(0,M.jsxs)($,{children:[(0,M.jsx)(DN,{children:(0,M.jsx)(ON,{className:`text-base`,children:e(`organizations.general.overviewTitle`)})}),(0,M.jsxs)(AN,{className:`space-y-3 text-sm`,children:[(0,M.jsxs)(`div`,{className:`flex justify-between`,children:[(0,M.jsx)(`span`,{className:`text-muted-foreground`,children:e(`organizations.general.members`)}),(0,M.jsx)(`span`,{children:c.length})]}),(0,M.jsxs)(`div`,{className:`flex justify-between`,children:[(0,M.jsx)(`span`,{className:`text-muted-foreground`,children:e(`organizations.general.pendingInvitations`)}),(0,M.jsx)(`span`,{children:T.length})]})]})]}),D&&(0,M.jsxs)($,{className:`border-destructive/40`,children:[(0,M.jsxs)(DN,{children:[(0,M.jsx)(ON,{className:`text-base text-destructive`,children:e(`organizations.general.dangerTitle`)}),(0,M.jsx)(kN,{children:e(`organizations.general.dangerDescription`)})]}),(0,M.jsx)(AN,{children:(0,M.jsxs)(Q,{variant:`destructive`,size:`sm`,onClick:()=>x(!0),disabled:d,children:[(0,M.jsx)(nb,{className:`mr-2 h-4 w-4`}),e(`organizations.general.delete`)]})})]}),(0,M.jsx)(GP,{open:b,onOpenChange:e=>{x(e),e||C(``)},children:(0,M.jsxs)(JP,{children:[(0,M.jsxs)(YP,{children:[(0,M.jsx)(ZP,{className:`text-destructive`,children:e(`organizations.general.deleteDialogTitle`)}),(0,M.jsx)(QP,{children:e(`organizations.general.deleteDialogDescription`,{name:s?.name??``})})]}),(0,M.jsx)(`div`,{className:`space-y-4 py-2`,children:(0,M.jsxs)(`div`,{className:`space-y-2`,children:[(0,M.jsx)(UN,{htmlFor:`delete-confirm`,children:e(`organizations.general.deleteDialogLabel`,{name:s?.name??``})}),(0,M.jsx)(oS,{id:`delete-confirm`,value:S,onChange:e=>C(e.target.value),placeholder:s?.name??``,disabled:d})]})}),(0,M.jsxs)(XP,{children:[(0,M.jsx)(Q,{variant:`outline`,onClick:()=>x(!1),disabled:d,children:e(`common.cancel`)}),(0,M.jsx)(Q,{variant:`destructive`,onClick:async()=>{if(s){if(S!==s.name){q({title:e(`organizations.general.confirmationMismatch`),description:e(`organizations.general.confirmationHint`,{name:s.name}),variant:`destructive`});return}try{let r=await u(t),i=r?.warnings,a=r?.deletedProjects??0;q({title:e(`organizations.general.deleted`),description:i?.length?e(`organizations.general.deletedWithWarnings`,{deletedProjects:a,warning:i[0],extraCount:Math.max(i.length-1,0)}):e(`organizations.general.deletedDescription`,{name:s.name,deletedProjects:a}),variant:i?.length?`destructive`:void 0}),x(!1),C(``),n({to:`/organizations`})}catch(t){q({title:e(`organizations.general.deleteFailed`),description:t.message,variant:`destructive`})}}},disabled:d||!s||S!==s.name,children:e(d?`organizations.general.deleting`:`organizations.general.delete`)})]})]})})]})}var sL=la(`/account/oauth-applications/new`)({component:cL});function cL(){let{t:e}=vt(),t=Hi(),{register:n,registering:r}=OP(),[i,a]=(0,j.useState)(``),[o,s]=(0,j.useState)(``),[c,l]=(0,j.useState)(`client_secret_basic`),[u,d]=(0,j.useState)(``),[f,p]=(0,j.useState)(``),[m,h]=(0,j.useState)(null),g=async()=>{let t=i.trim(),r=o.split(/\r?\n|,/).map(e=>e.trim()).filter(Boolean);if(!t){q({title:e(`oauth.applications.form.nameRequired`),variant:`destructive`});return}if(r.length===0){q({title:e(`oauth.applications.form.redirectRequired`),variant:`destructive`});return}try{let i=await n({client_name:t,redirect_uris:r,token_endpoint_auth_method:c,...u.trim()?{client_uri:u.trim()}:{},...f.trim()?{logo_uri:f.trim()}:{}});h({client_id:i?.client_id??``,client_secret:i?.client_secret}),q({title:e(`oauth.applications.registered`)})}catch(t){q({title:e(`oauth.applications.registerFailed`),description:t.message,variant:`destructive`})}},_=(t,n)=>{navigator.clipboard.writeText(t).then(()=>q({title:e(`oauth.applications.copied`,{label:n})}),()=>q({title:e(`oauth.applications.copyFailed`,{label:n}),variant:`destructive`}))};return m?(0,M.jsxs)(`div`,{className:`space-y-6`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`h1`,{className:`text-2xl font-semibold`,children:e(`oauth.applications.registeredTitle`)}),(0,M.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`oauth.applications.registeredDescription`)})]}),(0,M.jsxs)($,{children:[(0,M.jsxs)(DN,{children:[(0,M.jsx)(ON,{children:e(`oauth.applications.credentials`)}),(0,M.jsx)(kN,{children:e(`oauth.applications.credentialsDescription`)})]}),(0,M.jsxs)(AN,{className:`space-y-4`,children:[(0,M.jsxs)(`div`,{className:`space-y-1`,children:[(0,M.jsx)(UN,{children:e(`oauth.applications.clientId`)}),(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(`code`,{className:`flex-1 rounded-md border bg-muted px-3 py-2 font-mono text-xs`,children:m.client_id}),(0,M.jsx)(Q,{size:`icon`,variant:`outline`,onClick:()=>_(m.client_id,e(`oauth.applications.clientId`)),children:(0,M.jsx)(jy,{className:`h-4 w-4`})})]})]}),m.client_secret&&(0,M.jsxs)(`div`,{className:`space-y-1`,children:[(0,M.jsx)(UN,{children:e(`oauth.applications.clientSecret`)}),(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(`code`,{className:`flex-1 break-all rounded-md border bg-muted px-3 py-2 font-mono text-xs`,children:m.client_secret}),(0,M.jsx)(Q,{size:`icon`,variant:`outline`,onClick:()=>_(m.client_secret,e(`oauth.applications.clientSecret`)),children:(0,M.jsx)(jy,{className:`h-4 w-4`})})]}),(0,M.jsx)(`p`,{className:`text-xs text-destructive`,children:e(`oauth.applications.clientSecretWarning`)})]})]})]}),(0,M.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,M.jsx)(Q,{variant:`outline`,onClick:()=>t({to:`/account/oauth-applications`}),children:e(`oauth.applications.backToList`)}),(0,M.jsx)(Q,{onClick:()=>t({to:`/account/oauth-applications/$clientId`,params:{clientId:m.client_id}}),children:e(`oauth.applications.viewApplication`)})]})]}):(0,M.jsxs)(`div`,{className:`space-y-6`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`h1`,{className:`text-2xl font-semibold`,children:e(`oauth.applications.form.title`)}),(0,M.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`oauth.applications.form.description`)})]}),(0,M.jsxs)($,{children:[(0,M.jsx)(DN,{children:(0,M.jsxs)(ON,{className:`flex items-center gap-2 text-base`,children:[(0,M.jsx)(Ly,{className:`h-4 w-4`}),e(`oauth.applications.form.details`)]})}),(0,M.jsxs)(AN,{className:`space-y-4`,children:[(0,M.jsxs)(`div`,{className:`space-y-2`,children:[(0,M.jsx)(UN,{htmlFor:`oauth-name`,children:e(`oauth.applications.form.name`)}),(0,M.jsx)(oS,{id:`oauth-name`,value:i,onChange:e=>a(e.target.value),placeholder:e(`oauth.applications.form.namePlaceholder`),disabled:r})]}),(0,M.jsxs)(`div`,{className:`space-y-2`,children:[(0,M.jsx)(UN,{htmlFor:`oauth-redirect`,children:e(`oauth.applications.form.redirectUris`)}),(0,M.jsx)(nL,{id:`oauth-redirect`,value:o,onChange:e=>s(e.target.value),placeholder:e(`oauth.applications.form.redirectPlaceholder`),rows:3,disabled:r}),(0,M.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`oauth.applications.form.redirectHint`)})]}),(0,M.jsxs)(`div`,{className:`space-y-2`,children:[(0,M.jsx)(UN,{children:e(`oauth.applications.form.authMethod`)}),(0,M.jsxs)(GI,{value:c,onValueChange:e=>l(e),disabled:r,children:[(0,M.jsx)(qI,{children:(0,M.jsx)(KI,{})}),(0,M.jsxs)(XI,{children:[(0,M.jsx)(QI,{value:`client_secret_basic`,children:e(`oauth.applications.form.authMethodBasic`)}),(0,M.jsx)(QI,{value:`client_secret_post`,children:e(`oauth.applications.form.authMethodPost`)}),(0,M.jsx)(QI,{value:`none`,children:e(`oauth.applications.form.authMethodNone`)})]})]})]}),(0,M.jsxs)(`div`,{className:`space-y-2`,children:[(0,M.jsx)(UN,{htmlFor:`oauth-client-uri`,children:e(`oauth.applications.form.clientUri`)}),(0,M.jsx)(oS,{id:`oauth-client-uri`,value:u,onChange:e=>d(e.target.value),placeholder:e(`oauth.applications.form.clientUriPlaceholder`),disabled:r})]}),(0,M.jsxs)(`div`,{className:`space-y-2`,children:[(0,M.jsx)(UN,{htmlFor:`oauth-logo`,children:e(`oauth.applications.form.logoUri`)}),(0,M.jsx)(oS,{id:`oauth-logo`,value:f,onChange:e=>p(e.target.value),placeholder:e(`oauth.applications.form.logoUriPlaceholder`),disabled:r}),(0,M.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`oauth.applications.form.logoHint`)})]})]})]}),(0,M.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,M.jsx)(Q,{variant:`ghost`,onClick:()=>t({to:`/account/oauth-applications`}),disabled:r,children:e(`common.cancel`)}),(0,M.jsx)(Q,{onClick:g,disabled:r,children:e(r?`oauth.applications.form.registering`:`oauth.applications.register`)})]})]})}var lL=la(`/account/oauth-applications/$clientId`)({component:uL});function uL(){let{t:e}=vt(),{clientId:t}=lL.useParams(),n=Hi(),{applications:r,loading:i,reload:a}=DP(),{remove:o,deleting:s}=kP(),c=n_(),l=r.find(e=>e.client_id===t),[u,d]=(0,j.useState)(null);(0,j.useEffect)(()=>{let e=!1;if(!l&&c?.oauth?.applications?.get)return c.oauth.applications.get(t).then(t=>{e||d(t?.data??t)},()=>{}),()=>{e=!0}},[c,t,l]);let f=l??u,[p,m]=(0,j.useState)(!1),h=(t,n)=>{navigator.clipboard.writeText(t).then(()=>q({title:e(`oauth.applications.copied`,{label:n})}),()=>q({title:e(`oauth.applications.copyFailed`,{label:n}),variant:`destructive`}))},g=async()=>{if(f)try{await o(f.client_id),q({title:e(`oauth.applications.deleted`)}),await a(),n({to:`/account/oauth-applications`})}catch(t){q({title:e(`oauth.applications.deleteFailed`),description:t.message,variant:`destructive`})}};if(i&&!f)return(0,M.jsx)(`div`,{className:`p-8 text-center text-sm text-muted-foreground`,children:e(`common.loading`)});if(!f)return(0,M.jsxs)(`div`,{className:`space-y-4`,children:[(0,M.jsx)(`h1`,{className:`text-2xl font-semibold`,children:e(`oauth.applications.notFoundTitle`)}),(0,M.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`oauth.applications.notFoundDescription`)}),(0,M.jsx)(Q,{onClick:()=>n({to:`/account/oauth-applications`}),children:e(`oauth.applications.backToList`)})]});let _=typeof f.redirect_urls==`string`?f.redirect_urls.split(/\r?\n|,/).map(e=>e.trim()).filter(Boolean):Array.isArray(f.redirect_urls)?f.redirect_urls:[];return(0,M.jsxs)(`div`,{className:`space-y-6`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`h1`,{className:`text-2xl font-semibold`,children:f.name}),(0,M.jsx)(`p`,{className:`font-mono text-xs text-muted-foreground`,children:f.client_id})]}),(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[f.type&&(0,M.jsx)(pP,{variant:`outline`,className:`capitalize`,children:f.type}),f.disabled&&(0,M.jsx)(pP,{variant:`destructive`,children:e(`oauth.applications.disabled`)})]})]}),(0,M.jsxs)($,{children:[(0,M.jsxs)(DN,{children:[(0,M.jsx)(ON,{children:e(`oauth.applications.credentials`)}),(0,M.jsx)(kN,{children:e(`oauth.applications.credentialsDescriptionDetail`)})]}),(0,M.jsxs)(AN,{className:`space-y-4`,children:[(0,M.jsxs)(`div`,{className:`space-y-1`,children:[(0,M.jsx)(UN,{children:e(`oauth.applications.clientId`)}),(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(`code`,{className:`flex-1 rounded-md border bg-muted px-3 py-2 font-mono text-xs`,children:f.client_id}),(0,M.jsx)(Q,{size:`icon`,variant:`outline`,onClick:()=>h(f.client_id,e(`oauth.applications.clientId`)),children:(0,M.jsx)(jy,{className:`h-4 w-4`})})]})]}),(0,M.jsxs)(`div`,{className:`space-y-1`,children:[(0,M.jsx)(UN,{children:e(`oauth.applications.redirectUris`)}),_.length===0?(0,M.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`oauth.applications.noRedirectUris`)}):(0,M.jsx)(`ul`,{className:`space-y-1`,children:_.map((e,t)=>(0,M.jsx)(`li`,{className:`rounded-md border bg-muted px-3 py-2 font-mono text-xs`,children:e},t))})]})]})]}),(0,M.jsxs)($,{className:`border-destructive/40`,children:[(0,M.jsxs)(DN,{children:[(0,M.jsx)(ON,{className:`text-base text-destructive`,children:e(`oauth.applications.dangerTitle`)}),(0,M.jsx)(kN,{children:e(`oauth.applications.dangerDescription`)})]}),(0,M.jsx)(AN,{children:(0,M.jsxs)(Q,{variant:`destructive`,size:`sm`,onClick:()=>m(!0),disabled:s,children:[(0,M.jsx)(nb,{className:`mr-2 h-4 w-4`}),e(`oauth.applications.delete`)]})})]}),(0,M.jsx)(GP,{open:p,onOpenChange:m,children:(0,M.jsxs)(JP,{children:[(0,M.jsxs)(YP,{children:[(0,M.jsx)(ZP,{className:`text-destructive`,children:e(`oauth.applications.deleteDialogTitle`)}),(0,M.jsx)(QP,{children:e(`oauth.applications.deleteDialogDescription`,{name:f.name})})]}),(0,M.jsxs)(XP,{children:[(0,M.jsx)(Q,{variant:`outline`,onClick:()=>m(!1),disabled:s,children:e(`common.cancel`)}),(0,M.jsx)(Q,{variant:`destructive`,onClick:g,disabled:s,children:e(s?`oauth.applications.deleting`:`common.delete`)})]})]})})]})}var dL=FN.update({id:`/verify-email-prompt`,path:`/verify-email-prompt`,getParentRoute:()=>EN}),fL=LN.update({id:`/verify-email`,path:`/verify-email`,getParentRoute:()=>EN}),pL=WN.update({id:`/setup`,path:`/setup`,getParentRoute:()=>EN}),mL=qN.update({id:`/reset-password`,path:`/reset-password`,getParentRoute:()=>EN}),hL=QN.update({id:`/register`,path:`/register`,getParentRoute:()=>EN}),gL=nP.update({id:`/login`,path:`/login`,getParentRoute:()=>EN}),_L=oP.update({id:`/forgot-password`,path:`/forgot-password`,getParentRoute:()=>EN}),vL=cP.update({id:`/account`,path:`/account`,getParentRoute:()=>EN}),yL=uP.update({id:`/`,path:`/`,getParentRoute:()=>EN}),bL=hP.update({id:`/organizations/`,path:`/organizations/`,getParentRoute:()=>EN}),xL=_P.update({id:`/`,path:`/`,getParentRoute:()=>vL}),SL=bP.update({id:`/organizations/new`,path:`/organizations/new`,getParentRoute:()=>EN}),CL=TP.update({id:`/organizations/$orgId`,path:`/organizations/$orgId`,getParentRoute:()=>EN}),wL=jP.update({id:`/oauth/consent`,path:`/oauth/consent`,getParentRoute:()=>EN}),TL=PP.update({id:`/auth/device`,path:`/auth/device`,getParentRoute:()=>EN}),EL=LP.update({id:`/two-factor`,path:`/two-factor`,getParentRoute:()=>vL}),DL=HP.update({id:`/sessions`,path:`/sessions`,getParentRoute:()=>vL}),OL=$P.update({id:`/security`,path:`/security`,getParentRoute:()=>vL}),kL=tF.update({id:`/profile`,path:`/profile`,getParentRoute:()=>vL}),AL=rF.update({id:`/linked-accounts`,path:`/linked-accounts`,getParentRoute:()=>vL}),jL=lF.update({id:`/invitations`,path:`/invitations`,getParentRoute:()=>vL}),ML=dF.update({id:`/accept-invitation/$invitationId`,path:`/accept-invitation/$invitationId`,getParentRoute:()=>EN}),NL=pF.update({id:`/`,path:`/`,getParentRoute:()=>CL}),PL=mF.update({id:`/oauth-applications/`,path:`/oauth-applications/`,getParentRoute:()=>vL}),FL=eL.update({id:`/teams`,path:`/teams`,getParentRoute:()=>CL}),IL=rL.update({id:`/members`,path:`/members`,getParentRoute:()=>CL}),LL=aL.update({id:`/general`,path:`/general`,getParentRoute:()=>CL}),RL=sL.update({id:`/oauth-applications/new`,path:`/oauth-applications/new`,getParentRoute:()=>vL}),zL={AccountInvitationsRoute:jL,AccountLinkedAccountsRoute:AL,AccountProfileRoute:kL,AccountSecurityRoute:OL,AccountSessionsRoute:DL,AccountTwoFactorRoute:EL,AccountIndexRoute:xL,AccountOauthApplicationsClientIdRoute:lL.update({id:`/oauth-applications/$clientId`,path:`/oauth-applications/$clientId`,getParentRoute:()=>vL}),AccountOauthApplicationsNewRoute:RL,AccountOauthApplicationsIndexRoute:PL},BL=vL._addFileChildren(zL),VL={OrganizationsOrgIdGeneralRoute:LL,OrganizationsOrgIdMembersRoute:IL,OrganizationsOrgIdTeamsRoute:FL,OrganizationsOrgIdIndexRoute:NL},HL={IndexRoute:yL,AccountRoute:BL,ForgotPasswordRoute:_L,LoginRoute:gL,RegisterRoute:hL,ResetPasswordRoute:mL,SetupRoute:pL,VerifyEmailRoute:fL,VerifyEmailPromptRoute:dL,AcceptInvitationInvitationIdRoute:ML,AuthDeviceRoute:TL,OauthConsentRoute:wL,OrganizationsOrgIdRoute:CL._addFileChildren(VL),OrganizationsNewRoute:SL,OrganizationsIndexRoute:bL},UL=EN._addFileChildren(HL)._addFileTypes();function WL(){let e=`/_account/`;return e.endsWith(`/`)?e.slice(0,-1):e}var GL=wa({routeTree:UL,basepath:WL()});function KL(){return(0,M.jsx)(Da,{router:GL})}var qL=typeof localStorage<`u`&&localStorage.getItem(`account.lang`)||typeof navigator<`u`&&navigator.language||`en`;function JL({children:e}){let{i18n:t,language:n}=yt(),[r,i]=j.useReducer(e=>e+1,0),[a,o]=j.useState(!1);return j.useEffect(()=>{let e=()=>i();t.on(`loaded`,e),t.on(`languageChanged`,e);let n=window.setTimeout(()=>o(!0),1500);return()=>{t.off(`loaded`,e),t.off(`languageChanged`,e),window.clearTimeout(n)}},[t]),a||t.isInitialized&&t.hasResourceBundle?.(n,`translation`)?(0,M.jsx)(M.Fragment,{children:e}):null}qf.createRoot(document.getElementById(`root`)).render((0,M.jsx)(j.StrictMode,{children:(0,M.jsx)(_t,{config:{defaultLanguage:qL,fallbackLanguage:`en`},loadLanguage:TM,children:(0,M.jsx)(JL,{children:(0,M.jsx)(KL,{})})})}));
|