diff --git a/AGENTS.md b/AGENTS.md index e22f63ac..a61be1bd 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -416,6 +416,25 @@ Icon 은 `` 글리프라 박스 크기가 곧 `font-size` 다. `w-N h-N` 은 > 상세: [validation.md](docs/backend/validation.md), [service-repository.md](docs/backend/service-repository.md), [frontend/security.md](docs/frontend/security.md) +### 제3자 라이브러리는 쓰기 경로를 지정받는다 + +제3자 라이브러리는 캐시·임시파일 경로를 설정하지 않으면 **자기 설치 폴더**(vendor 안)나 시스템 temp 에 쓴다. 표준 Laravel 배포는 웹서버에 `storage/` 와 `bootstrap/cache` 만 쓰기 권한을 주므로 그 쓰기는 실패하는데, 실패가 예외가 아니라 PHP 경고라 Laravel `HandleExceptions` 가 `ErrorException` 으로 승격시켜 요청이 500 이 된다. 해시당 1회만 기록하는 라이브러리라면 캐시가 영영 생기지 않아 **매 요청이 같은 실패를 반복**한다 — 개발 머신에서는 vendor 가 쓰기 가능해 한 번 성공하고 끝나므로 재현되지 않는다 (공개 #125). + +| ❌ 금지 | ✅ 올바른 사용 | +|--------|---------------| +| 제3자 라이브러리를 기본 설정 그대로 인스턴스화 | 캐시·임시파일 경로를 `ExtensionStoragePath::module($id, 'cache/…')` 로 명시 — 기본값은 **라이브러리 자기 설치 폴더**다 | +| 쓰기 경로만 지정하고 디렉토리 생성은 라이브러리에 맡김 | `FilePermissionHelper::ensureWritableDirectory()` 로 **먼저 확보한다** — 라이브러리는 대개 하위 디렉토리만 만들고, base 가 없으면 경고만 내고 끝난다 | +| 확보 절차(억제 생성·chmod·setgid·소유권·쓰기 판정)를 호출부가 자기 안에 복사 | 코어 프리미티브 한 곳에서 수행 — 사본은 서로 다른 하드닝을 갖고 갈라진다(실제로 억제 mkdir·setgid·`clearstatcache` 가 사본마다 한쪽씩 빠져 있었다) | +| 확장 저장 경로를 `storage_path('app/modules/…')` 로 직접 조립 | `ExtensionStoragePath::{module,plugin}()` — 디스크 root 가 단일 출처이고 테스트 환경을 인지하므로, 확장이 `runningUnitTests()` 분기를 복사하지 않는다. 복사본은 한 곳만 빠뜨려도 그 확장의 테스트가 **운영 설정 파일을 덮어쓴다** | +| 캐시 쓰기 실패를 그대로 500 으로 흘림 | 캐시는 성능 장치다 — 확보 실패 시 캐시만 끄고 본래 기능은 계속한다. **정화·검증 자체를 건너뛰는 폴백은 금지** | +| 폴백 통지를 `Log::warning` 으로 남김 | `Log::error` — 출하 기본 로그 수준(`config/settings/defaults.json` 의 `log_level`)이 `error` 라 `warning` 은 기본 설치 상태에서 파일에 기록되지 않는다. 기능은 성공하므로 그 통지가 유일한 흔적이다 | + +확보 프리미티브는 **예외도 PHP 경고도 내지 않는다** — `File::ensureDirectoryExists()` 는 `mkdir()` 을 억제 없이 부르므로 생성 실패가 `E_WARNING` → `ErrorException` 으로 승격되어, 막으려던 500 이 다른 줄에서 그대로 난다. 실패는 `bool` 과 사유(`occupied_by_file` / `ancestor_not_writable` / `create_failed` / `not_writable`)로 올라오고, 그 사유를 통지에 실어 운영자가 고칠 대상을 지목한다. + +경로는 `ExtensionStoragePath` 가 해석한다. `getBasePath('cache')` 는 `Storage::disk()->path()` 위임이라 비로컬 디스크(S3 등)에서 파일시스템 경로가 아니게 되는데, 그러면 라이브러리가 상대경로를 CWD 기준으로 해석해 **조용히 엉뚱한 곳에 쓴다** — 지금 결함보다 나쁘다. 대부분의 정의 캐시는 `file_put_contents` 로 쓰는 로컬 전용 장치다. + +> 상세: [storage-driver.md](docs/extension/storage-driver.md) "제3자 라이브러리에 절대 경로를 넘길 때", [service-repository.md](docs/backend/service-repository.md) "서비스가 제3자 라이브러리를 붙일 때" + ### 확장·템플릿 구동 에셋은 자체 제공한다 브라우저가 화면을 그리기 위해 제3자 CDN 에 도달해야 하면, 그 도달 실패는 **예외도 로그도 남기지 않고 화면 기능만 조용히 사라진다.** 폐쇄망·방화벽·광고차단기에서 재현되며 자체 서버 로그에 흔적이 없어 운영자가 원인을 특정할 수 없다. diff --git a/CHANGELOG.md b/CHANGELOG.md index 7967164f..fcd5bad9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,7 @@ ### Fixed +- 초기 화면 파일을 명령줄과 웹이 번갈아 만들 때, 나중에 생기는 하위 폴더가 한쪽 계정 전용으로 남아 다른 쪽이 쓰지 못하던 문제를 수정했습니다. 게시 폴더가 그룹 권한을 하위 폴더에 물려주도록 정리합니다(Linux·macOS). - 확장 설치가 의존성·버전 검사에서 실패해도 복사된 파일이 남아, 목록에도 보이지 않는 디렉토리가 쌓이던 문제를 수정했습니다. 실패한 설치는 이번에 만든 파일을 되돌립니다(이미 설치돼 있던 확장을 다시 설치하다 실패한 경우에는 기존 파일을 건드리지 않습니다). - 사이트 첫 접속 시 확장 캐시 버전이 어긋나 있으면 라우트·다국어 데이터를 두 번 내려받던 문제를 수정했습니다. (#122 @glitter-gim 님께서 건의해주셨습니다.) - 레이아웃 props 의 `$switch` 조건 분기 값이 검색엔진(봇) 화면에서는 해석되지 않아 해당 속성이 표시되지 않던 문제를 수정했습니다. 이제 일반 화면과 봇 화면이 동일하게 분기 값을 렌더링합니다. diff --git a/INSTALL.md b/INSTALL.md index 46f2ef5c..6f0df40b 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -379,6 +379,23 @@ http://도메인/install > 사용자 페이지는 사용자 템플릿이 설치되어 있어야 접근할 수 있습니다. 인스톨러에서 사용자 템플릿을 함께 설치하거나, 관리자 페이지에서 템플릿을 먼저 설치해 주세요. +### 파일 권한 (설치 후 확인) + +POSIX 권한 모델 (Linux/macOS/BSD) 환경에서 웹 서버 실행 계정이 쓸 수 있어야 하는 위치는 다음과 같습니다. Windows 환경에서는 해당하지 않습니다. + +| 위치 | 필요한 이유 | +|------|------------| +| `storage/` · `bootstrap/cache` | 애플리케이션 동작에 항상 필요 (로그·캐시·세션·업로드·런타임 캐시) | +| `modules/` · `plugins/` · `templates/` · `public/build` | 관리자 화면에서 확장(모듈/플러그인/템플릿)을 설치·업데이트·삭제할 때 필요 | + +```bash +sudo chown -R www-data:www-data storage bootstrap/cache modules plugins templates public/build +``` + +**`vendor/` 에는 쓰기 권한이 필요하지 않습니다.** 확장의 `vendor/` 는 설치·업데이트 시점에만 기록되며, 애플리케이션이 동작하면서 만드는 런타임 캐시는 모두 `storage/` 아래에 기록됩니다. 명령줄로 설치·업데이트를 수행한다면 그 계정만 쓸 수 있으면 됩니다. + +전체 권한 모델(그룹 공유 방식 A / 소유자 통일 방식 B / ACL 방식 C 와 umask 운영)은 [docs/requirements.md](docs/requirements.md) "파일 권한 및 umask 운영 방식" 절을 참고하세요. + --- ## 업그레이드 diff --git a/README.ko.md b/README.ko.md index fd9e9b0c..ee23d363 100644 --- a/README.ko.md +++ b/README.ko.md @@ -519,8 +519,8 @@ cp .env.example .env glitter-gim Tuwasduliebst jordy-bitree - laelbe lyg-kaban + laelbe bigmsg abc101 hwaryeon1234 diff --git a/README.md b/README.md index 4ad934a7..86ccd657 100644 --- a/README.md +++ b/README.md @@ -533,8 +533,8 @@ Thanks to everyone who reported an issue or suggested a feature that shipped — glitter-gim Tuwasduliebst jordy-bitree - laelbe lyg-kaban + laelbe bigmsg abc101 hwaryeon1234 diff --git a/app/Extension/Helpers/FilePermissionHelper.php b/app/Extension/Helpers/FilePermissionHelper.php index b6881b3a..4d036a3d 100644 --- a/app/Extension/Helpers/FilePermissionHelper.php +++ b/app/Extension/Helpers/FilePermissionHelper.php @@ -387,6 +387,122 @@ class FilePermissionHelper static::applyOwnership($path, fileowner($parentDir), filegroup($parentDir)); } + /** + * 이미 존재하는 디렉토리의 퍼미션·소유권을 umask 와 무관하게 정합화합니다. + * + * `File::ensureDirectoryExists($dir, 0775)` 등 생성 API 의 mode 인자는 **umask 로 깎인다** — + * umask 022 환경에서는 0775 요청이 0755 로 만들어져 그룹 공유(웹 계정)가 쓸 수 없다. + * 명시 `chmod` 로 umask 를 무력화하고, POSIX 에서는 setgid 를 세워 그 아래에 만들어지는 + * 하위 디렉토리가 그룹을 상속하게 한다. setgid 가 없으면 CLI(스케줄러/큐)가 먼저 만든 + * 하위 디렉토리를 웹 프로세스가 쓰지 못한다. Windows 에는 setgid 개념이 없어 제외한다. + * + * 마지막으로 부모 소유권을 상속시켜 sudo/CLI 계정 고정을 막는다. + * + * @param string $path 대상 디렉토리 절대 경로 + * @param int $mode 적용할 퍼미션 (예: 0775) + */ + public static function hardenDirectory(string $path, int $mode = 0775): void + { + @chmod($path, $mode); + + if (PHP_OS_FAMILY !== 'Windows') { + @chmod($path, $mode | 02000); + } + + static::inheritOwnershipFromParent($path); + } + + /** + * 쓰기 가능한 디렉토리를 확보합니다 — 없으면 만들고, 권한을 정합화한 뒤 실제 쓰기 가능 여부를 판정합니다. + * + * 제3자 라이브러리에 넘길 캐시·임시 디렉토리처럼 "확보하지 못하면 그 기능만 끄면 되는" + * 자리를 위한 프리미티브다. **예외도 PHP 경고도 내지 않는다** — `File::ensureDirectoryExists()` + * 는 `mkdir()` 을 억제 없이 호출하므로 생성 실패가 `E_WARNING` 으로 나오고 Laravel + * `HandleExceptions` 가 이를 `ErrorException` 으로 승격시켜 요청이 500 이 된다. 쓰기 경로를 + * 지정하는 목적 자체가 그 500 을 막는 것이므로, 확보 실패가 다시 500 을 내면 무의미하다. + * + * 실패 정책은 호출부가 정한다 — 조용히 성능 저하로 이어갈지(정의 캐시), 시끄럽게 실패로 + * 처리할지(정적 게시)가 자리마다 다르기 때문이다. 사유는 `$failure` out 파라미터로 올린다. + * + * @param string $path 확보할 디렉토리 절대 경로 + * @param int $mode 생성 시 적용할 퍼미션 + * @param array{reason: string, path: string}|null $failure out — 실패 사유와 그 대상 경로. + * reason 은 `occupied_by_file`(경로가 파일로 점유) / + * `ancestor_not_writable`(실재하는 최근접 상위가 쓰기 불가) / + * `create_failed`(생성 실패) / `not_writable`(존재하나 쓰기 불가) + * @return bool 확보 성공 여부 + */ + public static function ensureWritableDirectory(string $path, int $mode = 0775, ?array &$failure = null): bool + { + $failure = null; + + if (! is_dir($path)) { + // 같은 이름의 파일이 자리를 차지하면 mkdir 이 경고를 낸다 — 먼저 걸러낸다. + if (file_exists($path)) { + $failure = ['reason' => 'occupied_by_file', 'path' => $path]; + + return false; + } + + // 상위가 쓰기 불가라면 생성 자체가 불가능하다. 여기서 끊어야 호출부가 "무엇을 + // 고쳐야 하는지"(대상 디렉토리가 아니라 그 상위)를 운영자에게 지목할 수 있다. + $ancestor = static::nearestExistingAncestor($path); + + if ($ancestor === null || ! is_writable($ancestor)) { + $failure = ['reason' => 'ancestor_not_writable', 'path' => $ancestor ?? dirname($path)]; + + return false; + } + + // force 인자로 경고를 억제한다. 실패는 아래 판정이 흡수한다. + File::makeDirectory($path, $mode, true, true); + + if (is_dir($path)) { + static::hardenDirectory($path, $mode); + } + } + + // 방금 만든 경로의 stat 은 캐시돼 있을 수 있다 — 판정 전에 비운다. + clearstatcache(true, $path); + + if (! is_dir($path)) { + $failure = ['reason' => 'create_failed', 'path' => $path]; + + return false; + } + + if (! is_writable($path)) { + $failure = ['reason' => 'not_writable', 'path' => $path]; + + return false; + } + + return true; + } + + /** + * 경로에서 위로 올라가며 실재하는 첫 디렉토리를 찾습니다. + * + * @param string $path 기준 경로 + * @return string|null 실재하는 최근접 상위 (루트까지 없으면 null) + */ + public static function nearestExistingAncestor(string $path): ?string + { + $current = dirname($path); + + while (! File::isDirectory($current)) { + $parent = dirname($current); + + if ($parent === $current) { + return null; + } + + $current = $parent; + } + + return $current; + } + /** * 소유자·그룹을 적용합니다. sudo 없이 실행 시 silent fail 로 현행 동작 유지. * diff --git a/app/Extension/Helpers/SettingsMigrator.php b/app/Extension/Helpers/SettingsMigrator.php index 0b5e94bc..75b566e9 100644 --- a/app/Extension/Helpers/SettingsMigrator.php +++ b/app/Extension/Helpers/SettingsMigrator.php @@ -2,6 +2,7 @@ namespace App\Extension\Helpers; +use App\Support\ExtensionStoragePath; use Illuminate\Support\Arr; use Illuminate\Support\Facades\File; use Illuminate\Support\Facades\Log; @@ -406,10 +407,10 @@ class SettingsMigrator private function getSettingsDir(): string { if ($this->type === 'module') { - return storage_path('app/modules/'.$this->identifier.'/settings'); + return ExtensionStoragePath::module($this->identifier, 'settings'); } - return storage_path('app/plugins/'.$this->identifier.'/settings'); + return ExtensionStoragePath::plugin($this->identifier, 'settings'); } /** diff --git a/app/Extension/ModuleManager.php b/app/Extension/ModuleManager.php index 85cd9617..4a0bbaa6 100644 --- a/app/Extension/ModuleManager.php +++ b/app/Extension/ModuleManager.php @@ -44,6 +44,7 @@ use App\Models\Template; use App\Providers\CoreServiceProvider; use App\Services\LayoutExtensionService; use App\Support\AssetUrl; +use App\Support\ExtensionStoragePath; use App\Support\RouteCacheHelper; use Illuminate\Support\Collection; use Illuminate\Support\Facades\Artisan; @@ -1791,7 +1792,7 @@ class ModuleManager implements ModuleManagerInterface } $identifier = $module->getIdentifier(); - $settingsDir = storage_path('app/modules/'.$identifier.'/settings'); + $settingsDir = ExtensionStoragePath::module($identifier, 'settings'); // 이미 환경설정 디렉토리가 있고 파일이 있으면 스킵 (재설치 시 덮어쓰기 방지) if (File::isDirectory($settingsDir) && count(File::files($settingsDir)) > 0) { @@ -1915,7 +1916,7 @@ class ModuleManager implements ModuleManagerInterface */ protected function deleteModuleStorage(ModuleInterface $module): void { - $moduleStoragePath = storage_path('app/modules/'.$module->getIdentifier()); + $moduleStoragePath = ExtensionStoragePath::module($module->getIdentifier()); if (! File::isDirectory($moduleStoragePath)) { Log::info('삭제할 모듈 스토리지 디렉토리가 없습니다.', [ @@ -2000,7 +2001,7 @@ class ModuleManager implements ModuleManagerInterface // 5. 스토리지 디렉토리 1-depth 용량 조회 $storageInfo = $this->getStorageDirectoriesInfo( - storage_path('app/modules/'.$identifier) + ExtensionStoragePath::module($identifier) ); // 6. Composer vendor 디렉토리 정보 조회 diff --git a/app/Extension/PluginManager.php b/app/Extension/PluginManager.php index c354712e..62978a0a 100644 --- a/app/Extension/PluginManager.php +++ b/app/Extension/PluginManager.php @@ -45,6 +45,7 @@ use App\Providers\CoreServiceProvider; use App\Services\DriverRegistryService; use App\Services\LayoutExtensionService; use App\Support\AssetUrl; +use App\Support\ExtensionStoragePath; use App\Support\RouteCacheHelper; use Illuminate\Support\Collection; use Illuminate\Support\Facades\Artisan; @@ -2610,7 +2611,7 @@ class PluginManager implements PluginManagerInterface protected function initializePluginSettings(PluginInterface $plugin): void { $identifier = $plugin->getIdentifier(); - $settingsDir = storage_path("app/plugins/{$identifier}/settings"); + $settingsDir = ExtensionStoragePath::plugin($identifier, 'settings'); $settingsPath = $settingsDir.'/setting.json'; // 이미 설정 파일이 존재하면 스킵 (재설치 시 기존 설정 유지) @@ -2691,7 +2692,7 @@ class PluginManager implements PluginManagerInterface protected function deletePluginSettingsDirectory(PluginInterface $plugin): void { $identifier = $plugin->getIdentifier(); - $pluginStorageDir = storage_path("app/plugins/{$identifier}"); + $pluginStorageDir = ExtensionStoragePath::plugin($identifier); if (File::isDirectory($pluginStorageDir)) { File::deleteDirectory($pluginStorageDir); @@ -2761,7 +2762,7 @@ class PluginManager implements PluginManagerInterface // 5. 스토리지 디렉토리 1-depth 용량 조회 $storageInfo = $this->getStorageDirectoriesInfo( - storage_path('app/plugins/'.$identifier) + ExtensionStoragePath::plugin($identifier) ); // 6. Composer vendor 디렉토리 정보 조회 diff --git a/app/Services/ExtensionStaticCacheService.php b/app/Services/ExtensionStaticCacheService.php index 8e61826e..3b15cbd8 100644 --- a/app/Services/ExtensionStaticCacheService.php +++ b/app/Services/ExtensionStaticCacheService.php @@ -60,6 +60,22 @@ class ExtensionStaticCacheService /** 게시 트리 디렉토리 권한 — umask 무력화 대상 */ private const PUBLISH_DIR_MODE = 0775; + /** + * 게시 루트 확보 실패 사유 → 운영자가 읽는 요약. + * + * 키는 `FilePermissionHelper::ensureWritableDirectory()` 가 돌려주는 사유다. 사유마다 + * 고쳐야 할 대상이 다르므로(상위 디렉토리 / 그 자리의 파일 / 대상 자신) 한 문장으로 + * 뭉뚱그리지 않는다 — 뭉뚱그리면 실패 마커만 보고는 무엇을 고쳐야 할지 알 수 없다. + * + * @var array + */ + private const PREFLIGHT_FAILURE_SUMMARIES = [ + 'ancestor_not_writable' => '게시 루트를 만들 상위 디렉토리에 쓸 수 없습니다', + 'occupied_by_file' => '게시 루트 자리를 같은 이름의 파일이 차지하고 있습니다', + 'create_failed' => '게시 루트를 만들지 못했습니다', + 'not_writable' => '게시 루트에 쓸 수 없습니다', + ]; + /** 게시 트리 디렉토리 rename 시도 횟수 (일시 거부 흡수) */ private const RENAME_ATTEMPTS = 3; @@ -650,70 +666,17 @@ class ExtensionStaticCacheService */ private function ensurePublishRootWritable(int $version): bool { - $base = $this->baseDir(); - - if (! File::isDirectory($base)) { - // 게시 루트가 아직 없으면 만든다. 검사 대상은 `public/build` 고정이 아니라 - // **실재하는 최근접 조상**이다 — `public/build` 자체가 없는 환경(신규 설치, - // 테스트 격리 public 경로)에서 부모 존재를 요구하면 정상 상황을 실패로 만든다. - $ancestor = $this->nearestExistingAncestor($base); - - if ($ancestor === null || ! is_writable($ancestor)) { - $this->failPreflight( - $version, - $ancestor ?? dirname($base), - '게시 루트를 만들 상위 디렉토리에 쓸 수 없습니다' - ); - - return false; - } - - // 조상이 쓰기 가능해도 mkdir 은 실패할 수 있다 — 경로 중간이 **파일**이거나 - // 경합으로 사라지는 경우다. `ensureDirectoryExists` 는 그 실패를 예외로 - // 던지는데, 이 프리플라이트는 `publishVersion` 의 try 블록 **밖**에서 돌므로 - // 잡지 않으면 예외가 호출자에게 그대로 새어 나간다 — 게시 실패는 사이트를 - // 멈추지 않는다는 계약이 그 지점에서 깨진다. - try { - $this->makeDirectory($base); - } catch (\Throwable $e) { - $this->failPreflight($version, $base, '게시 루트를 만들지 못했습니다: '.$e->getMessage()); - - return false; - } + // 확보는 코어 공통 프리미티브가 맡는다 — 검사 대상은 `public/build` 고정이 아니라 + // **실재하는 최근접 상위**이고(`public/build` 자체가 없는 신규 설치·테스트 격리 public + // 경로에서 부모 존재를 요구하면 정상 상황을 실패로 만든다), 생성 실패는 예외가 아니라 + // 사유로 올라온다. 실패 정책(프리플라이트 실패 마커 + API 폴백)은 이 자리가 정한다. + if (FilePermissionHelper::ensureWritableDirectory($this->baseDir(), self::PUBLISH_DIR_MODE, $failure)) { + return true; } - clearstatcache(true, $base); + $this->failPreflight($version, $failure['path'], self::PREFLIGHT_FAILURE_SUMMARIES[$failure['reason']]); - if (! File::isDirectory($base) || ! is_writable($base)) { - $this->failPreflight($version, $base, '게시 루트에 쓸 수 없습니다'); - - return false; - } - - return true; - } - - /** - * 경로에서 위로 올라가며 실재하는 첫 디렉토리를 찾습니다. - * - * @param string $path 기준 경로 - * @return string|null 실재하는 최근접 조상 (루트까지 없으면 null) - */ - private function nearestExistingAncestor(string $path): ?string - { - $current = dirname($path); - - while (! File::isDirectory($current)) { - $parent = dirname($current); - - if ($parent === $current) { - return null; - } - - $current = $parent; - } - - return $current; + return false; } /** @@ -771,10 +734,12 @@ class ExtensionStaticCacheService /** * 게시 트리 디렉토리를 만들고 umask 와 무관하게 권한·소유권을 정합화합니다. * - * `File::ensureDirectoryExists($dir, 0775)` 의 mode 인자는 **umask 로 깎인다** — - * umask 022 환경에서는 0755 가 되어 웹 계정(그룹 공유)이 쓸 수 없다. 명시 `chmod` 로 - * umask 를 무력화하고, 부모 소유권을 상속시켜 CLI 계정 고정을 막는다. - * (선례: `CoreUpdateService::ensureWritableDirectories`) + * 게시 파일마다 호출되는 뜨거운 경로라 쓰기 가능 여부를 매번 재판정하지 않는다 — 그 판정은 + * 게시 시작 전 `ensurePublishRootWritable()` 이 루트에서 한 번 수행한다. 여기서는 생성만 + * 하고, 실패는 **예외로 남긴다**: 호출부(`writeJson`/`copyFile`)가 게시 전체를 중단시키는 + * 계약이 그 예외에 걸려 있다. + * + * 권한 정합화는 코어 공통 프리미티브에 위임한다 (umask 무력화 + POSIX setgid + 소유권 상속). * * @param string $dir 생성할 디렉토리 절대 경로 */ @@ -782,10 +747,7 @@ class ExtensionStaticCacheService { File::ensureDirectoryExists($dir, self::PUBLISH_DIR_MODE); - // ensureDirectoryExists 의 mode 는 umask 로 깎이므로 명시 chmod 로 확정한다. - @chmod($dir, self::PUBLISH_DIR_MODE); - - FilePermissionHelper::inheritOwnershipFromParent($dir); + FilePermissionHelper::hardenDirectory($dir, self::PUBLISH_DIR_MODE); } /** diff --git a/app/Support/ExtensionStoragePath.php b/app/Support/ExtensionStoragePath.php new file mode 100644 index 00000000..4eb6d445 --- /dev/null +++ b/app/Support/ExtensionStoragePath.php @@ -0,0 +1,76 @@ +path()` 위임이라, 확장이 카테고리 디스크를 비로컬(S3 등)로 오버라이드하면 + * 파일시스템 경로가 아니게 되기 때문이다. 그러면 라이브러리가 그 값을 상대경로로 보고 현재 + * 작업 디렉토리 기준으로 해석해 **조용히 엉뚱한 곳에 쓴다.** + * + * 경로 레이아웃은 `modules`/`plugins` 디스크의 root(`config/filesystems.php`)를 단일 출처로 + * 삼는다. 그 root 가 테스트 환경을 인지하므로, 각 확장이 `app()->runningUnitTests()` 분기를 + * 자기 안에 복사할 필요가 없다 — 복사본은 한 곳만 빠뜨려도 그 확장의 테스트가 조용히 운영 + * 설정 파일을 덮어쓴다. + */ +class ExtensionStoragePath +{ + /** + * 모듈 저장 경로의 절대 경로를 반환합니다. + * + * @param string $identifier 모듈 식별자 (예: sirsoft-ecommerce) + * @param string $category 카테고리 (예: settings, cache/htmlpurifier). 빈 문자열이면 모듈 루트 + * @return string 절대 경로 (존재 여부와 무관한 순수 계산) + */ + public static function module(string $identifier, string $category = ''): string + { + return static::resolve('modules', $identifier, $category); + } + + /** + * 플러그인 저장 경로의 절대 경로를 반환합니다. + * + * @param string $identifier 플러그인 식별자 (예: sirsoft-pay_kginicis) + * @param string $category 카테고리 (예: settings). 빈 문자열이면 플러그인 루트 + * @return string 절대 경로 (존재 여부와 무관한 순수 계산) + */ + public static function plugin(string $identifier, string $category = ''): string + { + return static::resolve('plugins', $identifier, $category); + } + + /** + * 디스크 root 를 기준으로 `{root}/{identifier}[/{category}]` 를 조립합니다. + * + * root 는 `config/filesystems.php` 가 단일 출처다. 설정이 비어 있는 비정상 상황에서만 + * 운영 기본 레이아웃으로 되돌아간다 — 여기서 예외를 던지면 설정 파일 하나 때문에 + * 확장 기능 전체가 멈춘다. + * + * @param string $disk 디스크 이름 (modules | plugins) + * @param string $identifier 확장 식별자 + * @param string $category 카테고리 + * @return string 절대 경로 + */ + protected static function resolve(string $disk, string $identifier, string $category): string + { + $root = config("filesystems.disks.{$disk}.root"); + + if (! is_string($root) || $root === '') { + $root = storage_path('app/'.$disk); + } + + $path = rtrim($root, '/\\').'/'.trim($identifier, '/\\'); + + $category = trim($category, '/\\'); + + return $category === '' ? $path : $path.'/'.$category; + } +} diff --git a/config/filesystems.php b/config/filesystems.php index 43181493..4b085788 100644 --- a/config/filesystems.php +++ b/config/filesystems.php @@ -1,5 +1,20 @@ runningUnitTests()` 로 +| 같은 분기를 자기 안에 복사해 두면 한 곳만 빠뜨려도 그 확장의 테스트가 조용히 +| 운영 파일을 건드린다 — 분기는 여기 한 곳에만 둔다. +| +*/ +$extensionStorageRoot = env('APP_ENV') === 'testing' ? 'framework/testing' : 'app'; + return [ /* @@ -44,7 +59,7 @@ return [ 'modules' => [ 'driver' => 'local', - 'root' => storage_path('app/modules'), + 'root' => storage_path($extensionStorageRoot.'/modules'), 'serve' => false, 'throw' => true, 'report' => false, @@ -52,7 +67,7 @@ return [ 'plugins' => [ 'driver' => 'local', - 'root' => storage_path('app/plugins'), + 'root' => storage_path($extensionStorageRoot.'/plugins'), 'serve' => false, 'throw' => true, 'report' => false, diff --git a/docs/backend/service-repository.md b/docs/backend/service-repository.md index d617e64b..f0ebd7d1 100644 --- a/docs/backend/service-repository.md +++ b/docs/backend/service-repository.md @@ -501,6 +501,26 @@ public function updateUser(User $user, array $data): User > 상세: [validation.md](validation.md) "계층 리소스"·"보안 게이트 대칭성" +### 서비스가 제3자 라이브러리를 붙일 때 + +그 라이브러리가 디스크에 무엇을 어디에 쓰는지는 **서비스가 책임진다.** 제3자 라이브러리는 캐시·임시파일 경로를 설정하지 않으면 자기 설치 폴더(vendor 안)나 현재 작업 디렉토리에 쓰는데, 배포본의 vendor 를 읽기 전용으로 두는 서버에서는 그 쓰기가 PHP 경고를 내고 Laravel 이 이를 `ErrorException` 으로 승격시켜 요청이 500 으로 끝난다. + +``` +필수: 경로는 `ExtensionStoragePath::module($identifier, 'cache/…')` 로 얻는다 + (디스크 root 단일 출처 — 테스트 분기를 서비스가 들고 있지 않는다) +필수: 확보는 `FilePermissionHelper::ensureWritableDirectory($path, $mode, $failure)` 에 맡긴다 + (억제된 생성 + umask 무력화 chmod + POSIX setgid + 소유권 상속 + 쓰기 판정을 한 번에) +필수: 확보 실패 시 캐시만 끄고 본래 기능은 계속 수행 + `error` 수준 통지 1회 기록 + (출하 기본 로그 수준이 `error` 라 `warning` 은 기본 설치 상태에서 기록되지 않는다) +필수: 통지에 `$failure['reason']` 을 함께 싣는다 (사유마다 운영자가 고칠 대상이 다르다) +금지: 경로를 `storage_path('app/modules/…')` 로 직접 조립하는 것 +금지: 확보 절차(생성·chmod·setgid·판정)를 서비스가 자기 안에 복사하는 것 +금지: 캐시 확보 실패를 그대로 500 으로 흘리는 것 +금지: 폴백에서 정화·검증 자체를 건너뛰는 것 (캐시는 성능 장치, 정화는 보안 장치) +``` + +> 상세: [storage-driver.md](../extension/storage-driver.md) "제3자 라이브러리에 절대 경로를 넘길 때" + --- ## 트랜잭션 및 관계 삭제 패턴 diff --git a/docs/extension/storage-driver.md b/docs/extension/storage-driver.md index ec8a2f9e..8e4ef2d8 100644 --- a/docs/extension/storage-driver.md +++ b/docs/extension/storage-driver.md @@ -968,6 +968,36 @@ $basePath = $this->storage->getBasePath('images'); // → /path/to/g7/storage/app/modules/sirsoft-ecommerce/images ``` +#### 제3자 라이브러리에 절대 경로를 넘길 때 + +제3자 라이브러리(HTML 정화기, PDF 생성기, 이미지 처리기 등)는 캐시·임시파일 경로를 설정하지 않으면 **자기 설치 폴더**(vendor 안)나 현재 작업 디렉토리에 쓴다. 표준 Laravel 배포는 웹서버에 `storage/` 와 `bootstrap/cache` 만 쓰기 권한을 주므로 그 쓰기는 실패하는데, 실패가 예외가 아니라 PHP 경고라 Laravel `HandleExceptions` 가 `ErrorException` 으로 승격시켜 **요청이 500 으로 끝난다**. 설정 해시당 1회만 기록하는 라이브러리라면 캐시가 영영 생기지 않아 매 요청이 같은 실패를 반복한다. 개발 머신에서는 vendor 가 쓰기 가능해 한 번 성공하고 끝나므로 재현되지 않는다. + +`cache` 카테고리의 절대 경로를 명시적으로 넘긴다. + +```php +$cacheDir = ExtensionStoragePath::module('sirsoft-ecommerce', 'cache/htmlpurifier'); + +if (! FilePermissionHelper::ensureWritableDirectory($cacheDir, 0775, $failure)) { + // 캐시만 끄고 정화는 그대로 수행한다 (아래 (c)) +} + +$config = \HTMLPurifier_Config::createDefault(); +$config->set('Cache.SerializerPath', $cacheDir); +$config->set('Cache.SerializerPermissions', 0775); +``` + +세 가지 규율을 함께 지킨다. + +**(a) 디렉토리를 먼저 만든다.** 경로 해석기는 경로를 계산할 뿐 만들지 않고, 라이브러리도 대개 지정한 base 아래의 **하위** 디렉토리만 만든다. base 가 없으면 경고 한 줄을 내고 끝나므로, 경로만 지정하면 실패 지점이 "vendor 쓰기 실패" 에서 "base 없음 실패" 로 옮겨갈 뿐이다. + +확보는 코어 프리미티브 `FilePermissionHelper::ensureWritableDirectory($path, $mode, $failure)` 가 맡는다. 이 프리미티브는 **예외도 PHP 경고도 내지 않고** `bool` 을 돌려준다 — `File::ensureDirectoryExists()` 는 `mkdir()` 을 억제 없이 부르므로 생성 실패가 `E_WARNING` 으로 나오고 Laravel 이 `ErrorException` 으로 승격시켜, 막으려던 500 이 다른 줄에서 그대로 난다. 직접 조립하지 않는다. + +**(b) 권한 정합화는 프리미티브가 함께 수행한다.** 생성 API 의 mode 인자는 umask 로 깎이므로 명시 `chmod` 를 재적용하고, POSIX 에서는 setgid 도 함께 세운다 — 새 디렉토리의 그룹은 생성 프로세스의 egid 이므로, setgid 가 없으면 스케줄러(CLI)가 먼저 만든 하위 디렉토리를 웹 프로세스가 쓰지 못한다. 부모 소유권 상속까지 한 곳에 있으므로 호출부가 이 셋을 각자 복사하지 않는다. 이미 존재하는 디렉토리만 정합화하려면 `FilePermissionHelper::hardenDirectory($path, $mode)` 를 쓴다. + +**(c) 확보 실패는 기능 실패가 아니다.** 프리미티브가 `false` 와 함께 사유(`occupied_by_file` / `ancestor_not_writable` / `create_failed` / `not_writable`)를 돌려주므로 통지에 그 사유를 싣는다 — 사유마다 운영자가 고쳐야 할 대상이 다르다. 디렉토리가 이미 있는데 쓰기 불가라면 요청 경로에서 권한과 싸우지 않는다. 캐시만 끄고(`Cache.DefinitionImpl = null` 같은 라이브러리별 비활성 스위치) 본래 기능은 계속 수행하며, 통지는 프로세스당 1회만 남긴다. 그 통지는 `error` 수준으로 남긴다 — 출하 기본 로그 수준이 `error` 라 `warning` 으로 남기면 기본 설치 상태에서 파일에 기록되지 않고, 기능은 성공하므로 운영자에게 도달하는 흔적이 그 통지 하나뿐이다. **정화·검증 자체를 건너뛰는 폴백은 금지한다** — 캐시는 성능 장치이고 정화는 보안 장치라, 캐시 실패가 보안 장치를 건너뛰게 만들어서는 안 된다. + +**디스크 주의**: 경로를 `getBasePath('cache')` 로 얻지 말고 `App\Support\ExtensionStoragePath::module($identifier, 'cache/…')` 로 얻는다. 이 해석기는 `modules`/`plugins` 디스크의 root(`config/filesystems.php`)를 단일 출처로 삼아 로컬 절대 경로를 조립하며, 그 root 가 테스트 환경을 인지하므로 확장이 `app()->runningUnitTests()` 분기를 자기 안에 복사할 필요가 없다. `getBasePath()` 는 `Storage::disk()->path()` 위임이라 카테고리 디스크가 비로컬(S3 등)로 오버라이드되면 파일시스템 경로가 아니게 되고, 그러면 라이브러리가 그 값을 상대경로로 보고 현재 작업 디렉토리 기준으로 해석해 **조용히 엉뚱한 곳에 쓴다**. 대부분의 정의 캐시는 `file_put_contents` 로 쓰는 로컬 전용 장치다. 두 경로는 기본 설정에서 바이트 단위로 동일하므로 `cache` 카테고리 규약은 레이아웃 차원에서 그대로 지켜진다. + --- ### getDisk() diff --git a/docs/testing-guide.md b/docs/testing-guide.md index 6720b766..aeacf06d 100644 --- a/docs/testing-guide.md +++ b/docs/testing-guide.md @@ -73,6 +73,31 @@ powershell -Command "npm run test:run" 2. `_bundled` src/ → PSR-4 prepend 등록 (활성 디렉토리보다 우선 검색) 3. `autoload-extensions.php` → 이미 로드된 _bundled 항목은 스킵 4. Manager/RouteServiceProvider → `class_exists` 가드로 중복 선언 방지 +5. 확장 `vendor/` → 제3자 composer 패키지만 골라 별도 로더로 등록 + +### 확장의 제3자 composer 패키지 + +확장이 자기 `composer.json` 으로 들여온 제3자 패키지(예: HTML 정화 라이브러리)는 `tests/bootstrap.php` +가 등록합니다. 확장별 테스트 베이스 클래스에서 같은 일을 다시 하지 않습니다 — 규칙이 두 곳으로 +갈라지면 한쪽만 고쳐져 조용히 어긋납니다. + +``` +금지: 확장 vendor 의 autoload.php 를 그대로 require +필수: 생성된 맵에서 제3자 항목만 골라 vendorDir 없는 로더로 등록 +``` + +그 오토로더를 그대로 쓰면 두 가지가 오류 없이 깨집니다. + +1. 확장 **자신의** PSR-4 와 files 를 활성 디렉토리로 매핑하고 자신을 prepend 로 걸어, 위 2번의 + `_bundled` 등록을 이깁니다. 테스트가 `_bundled` 가 아니라 활성 디렉토리 사본을 검증하게 되어 + "`_bundled` 에서만 작업한다" 는 규율이 조용히 깨집니다. +2. Composer 로더는 `vendorDir` 를 가지면 등록 로더 목록의 맨 앞에 자신을 넣는데, 테스트용 앱 + 생성이 그 첫 항목에서 base path 를 유추합니다. 이후 테스트의 앱 부팅이 확장 디렉토리에서 + `bootstrap/app.php` 를 찾다 실패합니다. (운영 진입점은 base path 를 명시 전달하므로 영향이 없습니다.) + +이 결손은 그 패키지를 쓰는 코드 경로를 아무도 테스트하지 않는 동안 드러나지 않습니다. 확장에 +제3자 패키지를 추가하면 그 패키지를 실제로 로드하는 테스트를 함께 두고, 로드 실패를 skip 이 아니라 +단언 실패로 드러냅니다. ### 주의사항 diff --git a/modules/_bundled/sirsoft-board/CHANGELOG.md b/modules/_bundled/sirsoft-board/CHANGELOG.md index 06a07438..4f3bcb54 100644 --- a/modules/_bundled/sirsoft-board/CHANGELOG.md +++ b/modules/_bundled/sirsoft-board/CHANGELOG.md @@ -12,6 +12,7 @@ - 글 상세를 공유할 때의 미리보기 이미지(og:image)에도 같은 기준이 적용됩니다. ### Changed +- 코어 최소 요구 버전을 7.0.10 으로 상향 - 알림 설정의 채널 서브탭이 확장 채널의 통합 탭 선언을 지원합니다. 묶인 채널 중 하나라도 켜져 있으면 통합 탭이 노출됩니다. - 게시판 알림 템플릿 편집 창이 확장 채널 전용 편집 영역을 제공합니다. 채널을 제공하는 확장이 그 채널의 템플릿 편집기와 저장 버튼을 같은 창 안에 넣을 수 있으며, 이때 코어의 제목/본문 입력과 미리보기·저장은 숨겨지고 수신자 규칙은 그대로 편집할 수 있습니다. diff --git a/modules/_bundled/sirsoft-board/module.json b/modules/_bundled/sirsoft-board/module.json index e2fa63ac..a894148e 100644 --- a/modules/_bundled/sirsoft-board/module.json +++ b/modules/_bundled/sirsoft-board/module.json @@ -11,7 +11,7 @@ "ko": "게시판 관리를 위한 모듈", "en": "Module for board management" }, - "g7_version": ">=7.0.9", + "g7_version": ">=7.0.10", "dependencies": { "modules": {}, "plugins": {} diff --git a/modules/_bundled/sirsoft-board/src/Services/BoardSettingsService.php b/modules/_bundled/sirsoft-board/src/Services/BoardSettingsService.php index 78d4d47b..cdc6663b 100644 --- a/modules/_bundled/sirsoft-board/src/Services/BoardSettingsService.php +++ b/modules/_bundled/sirsoft-board/src/Services/BoardSettingsService.php @@ -5,6 +5,7 @@ namespace Modules\Sirsoft\Board\Services; use App\Contracts\Extension\ModuleSettingsInterface; use App\Contracts\Repositories\NotificationDefinitionRepositoryInterface; use App\Services\NotificationDefinitionService; +use App\Support\ExtensionStoragePath; use App\Traits\NormalizesSettingsData; use Illuminate\Support\Arr; use Illuminate\Support\Facades\File; @@ -453,18 +454,15 @@ class BoardSettingsService implements ModuleSettingsInterface /** * 설정 저장 경로 반환 * - * testing 환경에서는 운영 설정(storage/app/modules/.../settings)을 보호하기 위해 - * 격리된 임시 경로를 사용합니다. 설정 저장을 수행하는 테스트가 운영 basic_defaults.json - * 등을 덮어쓰거나 지우는 것을 차단합니다(운영 설정 영구 보존). + * 경로는 `modules` 디스크 root(`config/filesystems.php`)를 단일 출처로 삼는다. 그 root 가 + * 테스트 환경에서 운영 데이터와 격리된 경로를 가리키므로, 운영 설정(storage/app/modules/ + * .../settings)을 덮어쓰지 않기 위한 분기를 이 서비스가 따로 들고 있지 않는다 — 분기를 + * 확장마다 복사하면 한 곳만 빠뜨려도 그 확장의 테스트가 조용히 운영 파일을 건드린다. * * @return string 설정 파일 저장 디렉토리 경로 */ private function getStoragePath(): string { - if (app()->runningUnitTests()) { - return storage_path('framework/testing/modules/'.self::MODULE_IDENTIFIER.'/settings'); - } - - return storage_path('app/modules/'.self::MODULE_IDENTIFIER.'/settings'); + return ExtensionStoragePath::module(self::MODULE_IDENTIFIER, 'settings'); } } diff --git a/modules/_bundled/sirsoft-board/tests/Feature/Admin/BoardSettingsControllerTest.php b/modules/_bundled/sirsoft-board/tests/Feature/Admin/BoardSettingsControllerTest.php index 2c2f331f..876a0030 100644 --- a/modules/_bundled/sirsoft-board/tests/Feature/Admin/BoardSettingsControllerTest.php +++ b/modules/_bundled/sirsoft-board/tests/Feature/Admin/BoardSettingsControllerTest.php @@ -6,6 +6,7 @@ namespace Modules\Sirsoft\Board\Tests\Feature\Admin; require_once __DIR__.'/../../ModuleTestCase.php'; use App\Models\User; +use App\Support\ExtensionStoragePath; use Illuminate\Support\Facades\Config; use Illuminate\Support\Facades\File; use Modules\Sirsoft\Board\Models\Board; @@ -42,7 +43,7 @@ class BoardSettingsControllerTest extends ModuleTestCase // 일반 사용자 생성 (권한 없음) $this->normalUser = $this->createUser(); - $this->settingsStoragePath = storage_path('app/modules/sirsoft-board/settings'); + $this->settingsStoragePath = ExtensionStoragePath::module('sirsoft-board', 'settings'); // 테스트 전 저장소 정리 if (File::isDirectory($this->settingsStoragePath)) { diff --git a/modules/_bundled/sirsoft-board/tests/Unit/BoardSetSettingPipelineTest.php b/modules/_bundled/sirsoft-board/tests/Unit/BoardSetSettingPipelineTest.php index 8a917200..f2d7887b 100644 --- a/modules/_bundled/sirsoft-board/tests/Unit/BoardSetSettingPipelineTest.php +++ b/modules/_bundled/sirsoft-board/tests/Unit/BoardSetSettingPipelineTest.php @@ -236,6 +236,8 @@ class BoardSetSettingPipelineTest extends ModuleTestCase */ public function test_storage_path_is_isolated_during_tests(): void { + // audit:allow extension-storage-path-hand-assembled 운영 경로를 **의도적으로** 가리킨다 — + // 이 단언의 대상은 "테스트가 운영 파일을 건드리지 않았는가" 이므로 해석기를 쓰면 검사가 성립하지 않는다. $productionPath = storage_path('app/modules/sirsoft-board/settings/basic_defaults.json'); // 운영 파일의 존재 여부·내용을 그대로 스냅샷 (환경마다 상태가 다르므로 변화 없음만 단언) $before = File::exists($productionPath) ? File::get($productionPath) : null; diff --git a/modules/_bundled/sirsoft-ecommerce/CHANGELOG.md b/modules/_bundled/sirsoft-ecommerce/CHANGELOG.md index 68641e77..f8e77e81 100644 --- a/modules/_bundled/sirsoft-ecommerce/CHANGELOG.md +++ b/modules/_bundled/sirsoft-ecommerce/CHANGELOG.md @@ -4,6 +4,16 @@ 형식은 [Keep a Changelog](https://keepachangelog.com/ko/1.1.0/)를 따르며, [Semantic Versioning](https://semver.org/lang/ko/)을 준수합니다. +## [1.2.1] - 2026-08-28 + +### Fixed + +- 상세설명을 편집기(HTML)로 작성한 상품을 등록하거나 수정할 때 저장이 실패하던 문제를 수정했습니다. 상품 설명의 보안 정화에 쓰는 구성요소가 모듈 설치 폴더 안에 자기 캐시 파일을 만들려 했기 때문에, 보안상 모듈 폴더에 쓰기를 막아 둔 서버에서는 저장이 항상 오류로 끝났고 다시 시도해도 같은 결과였습니다. 이제 이 캐시는 `storage` 폴더 아래에 만들어지며, 그 위치마저 쓸 수 없는 경우에는 캐시 없이 정화만 수행해 저장이 실패하지 않습니다(설명은 종전과 똑같이 정화됩니다). (#125 @lyg-kaban 님께서 제보해주셨습니다.) + +### Changed + +- 코어 최소 요구 버전을 7.0.10 으로 상향 + ## [1.2.0] - 2026-08-24 ### Added diff --git a/modules/_bundled/sirsoft-ecommerce/composer.json b/modules/_bundled/sirsoft-ecommerce/composer.json index c1ca57bd..e531cc70 100644 --- a/modules/_bundled/sirsoft-ecommerce/composer.json +++ b/modules/_bundled/sirsoft-ecommerce/composer.json @@ -2,7 +2,7 @@ "name": "modules/sirsoft-ecommerce", "description": "Ecommerce module for Gnuboard7", "type": "library", - "version": "1.2.0", + "version": "1.2.1", "license": "MIT", "autoload": { "psr-4": { diff --git a/modules/_bundled/sirsoft-ecommerce/module.json b/modules/_bundled/sirsoft-ecommerce/module.json index 4d8c80fe..9881d403 100644 --- a/modules/_bundled/sirsoft-ecommerce/module.json +++ b/modules/_bundled/sirsoft-ecommerce/module.json @@ -5,13 +5,13 @@ "ko": "이커머스", "en": "Ecommerce" }, - "version": "1.2.0", + "version": "1.2.1", "license": "MIT", "description": { "ko": "그누보드7 이커머스 모듈 - 상품, 주문, 결제 관리", "en": "Gnuboard7 Ecommerce Module - Product, Order, Payment Management" }, - "g7_version": ">=7.0.9", + "g7_version": ">=7.0.10", "dependencies": { "modules": {}, "plugins": {} diff --git a/modules/_bundled/sirsoft-ecommerce/package-lock.json b/modules/_bundled/sirsoft-ecommerce/package-lock.json index 7ca37fa7..a4883fb4 100644 --- a/modules/_bundled/sirsoft-ecommerce/package-lock.json +++ b/modules/_bundled/sirsoft-ecommerce/package-lock.json @@ -1,12 +1,12 @@ { "name": "@g7/sirsoft-ecommerce", - "version": "1.2.0", + "version": "1.2.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@g7/sirsoft-ecommerce", - "version": "1.2.0", + "version": "1.2.1", "devDependencies": { "jsdom": "^27.4.0", "typescript": "^5.3.3", diff --git a/modules/_bundled/sirsoft-ecommerce/package.json b/modules/_bundled/sirsoft-ecommerce/package.json index 3ae99e0a..d17f8d28 100644 --- a/modules/_bundled/sirsoft-ecommerce/package.json +++ b/modules/_bundled/sirsoft-ecommerce/package.json @@ -1,6 +1,6 @@ { "name": "@g7/sirsoft-ecommerce", - "version": "1.2.0", + "version": "1.2.1", "description": "그누보드7 이커머스 모듈 프론트엔드 에셋", "private": true, "type": "module", diff --git a/modules/_bundled/sirsoft-ecommerce/src/Services/EcommerceSettingsService.php b/modules/_bundled/sirsoft-ecommerce/src/Services/EcommerceSettingsService.php index 03990113..d073940e 100644 --- a/modules/_bundled/sirsoft-ecommerce/src/Services/EcommerceSettingsService.php +++ b/modules/_bundled/sirsoft-ecommerce/src/Services/EcommerceSettingsService.php @@ -4,6 +4,7 @@ namespace Modules\Sirsoft\Ecommerce\Services; use App\Contracts\Extension\ModuleSettingsInterface; use App\Extension\HookManager; +use App\Support\ExtensionStoragePath; use App\Traits\NormalizesSettingsData; use Illuminate\Support\Arr; use Illuminate\Support\Facades\File; @@ -610,19 +611,16 @@ class EcommerceSettingsService implements ModuleSettingsInterface /** * 설정 저장 경로 반환 * - * testing 환경에서는 운영 설정(storage/app/modules/.../settings)을 보호하기 위해 - * 격리된 임시 경로를 사용합니다. 설정 저장 API를 호출하는 Feature 테스트가 - * 운영 mileage.json 등을 덮어쓰는 것을 차단합니다(운영 설정 영구 보존). + * 경로는 `modules` 디스크 root(`config/filesystems.php`)를 단일 출처로 삼는다. 그 root 가 + * 테스트 환경에서 운영 데이터와 격리된 경로를 가리키므로, 운영 설정(storage/app/modules/ + * .../settings)을 덮어쓰지 않기 위한 분기를 이 서비스가 따로 들고 있지 않는다 — 분기를 + * 확장마다 복사하면 한 곳만 빠뜨려도 그 확장의 테스트가 조용히 운영 파일을 건드린다. * * @return string 설정 파일 저장 디렉토리 경로 */ private function getStoragePath(): string { - if (app()->runningUnitTests()) { - return storage_path('framework/testing/modules/'.self::MODULE_IDENTIFIER.'/settings'); - } - - return storage_path('app/modules/'.self::MODULE_IDENTIFIER.'/settings'); + return ExtensionStoragePath::module(self::MODULE_IDENTIFIER, 'settings'); } /** diff --git a/modules/_bundled/sirsoft-ecommerce/src/Services/ProductService.php b/modules/_bundled/sirsoft-ecommerce/src/Services/ProductService.php index 981b9ba1..7c927d5e 100644 --- a/modules/_bundled/sirsoft-ecommerce/src/Services/ProductService.php +++ b/modules/_bundled/sirsoft-ecommerce/src/Services/ProductService.php @@ -2,8 +2,10 @@ namespace Modules\Sirsoft\Ecommerce\Services; +use App\Extension\Helpers\FilePermissionHelper; use App\Extension\HookManager; use App\Search\SearchPagePolicy; +use App\Support\ExtensionStoragePath; use App\Support\Query\BoundedCount; use App\Support\Query\BoundedPage; use Illuminate\Contracts\Pagination\LengthAwarePaginator; @@ -11,6 +13,7 @@ use Illuminate\Database\Eloquent\Collection; use Illuminate\Pagination\CursorPaginator; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\DB; +use Illuminate\Support\Facades\Log; use Modules\Sirsoft\Ecommerce\Enums\SequenceType; use Modules\Sirsoft\Ecommerce\Exceptions\OptionHasOrderHistoryException; use Modules\Sirsoft\Ecommerce\Exceptions\ProductHasOrderHistoryException; @@ -54,6 +57,25 @@ class ProductService */ protected ?\HTMLPurifier $purifier = null; + /** + * 이 모듈의 식별자 + */ + private const MODULE_IDENTIFIER = 'sirsoft-ecommerce'; + + /** + * HTMLPurifier 정의 캐시 디렉토리 권한 + * + * 0775 인 이유: CLI(스케줄러/큐)와 웹(php-fpm)이 같은 캐시를 공유해야 한다. 그룹 쓰기가 + * 없으면 먼저 만든 프로세스가 상대를 잠근다. `Cache.SerializerPermissions` 로 HTMLPurifier 가 + * 만드는 하위 디렉토리에도 전파되며, `.ser` 파일에는 `$chmod & 0666` 이 적용되어 0664 가 된다. + */ + private const PURIFIER_CACHE_DIR_MODE = 0775; + + /** + * 정의 캐시 비활성 통지를 프로세스당 1회만 남기기 위한 플래그 + */ + private static bool $purifierCacheWarned = false; + /** * 시스템 기본통화 코드 조회 * @@ -1330,12 +1352,7 @@ class ProductService } if ($this->purifier === null) { - $config = \HTMLPurifier_Config::createDefault(); - $config->set('HTML.Allowed', 'p,br,strong,em,b,i,u,s,ul,ol,li,a[href|target],img[src|alt|width|height],h1,h2,h3,h4,h5,h6,table,tr,td,th,thead,tbody,tfoot,caption,colgroup,col,blockquote,pre,code,div,span[style],hr'); - $config->set('CSS.AllowedProperties', 'color,background-color,font-size,font-weight,text-align,text-decoration,margin,padding,border,width,height'); - $config->set('Attr.AllowedFrameTargets', ['_blank']); - $config->set('URI.AllowedSchemes', ['http' => true, 'https' => true, 'mailto' => true]); - $this->purifier = new \HTMLPurifier($config); + $this->purifier = $this->createPurifier(); } foreach ($data['description'] as $locale => $content) { @@ -1347,6 +1364,113 @@ class ProductService return $data; } + /** + * HTMLPurifier 인스턴스를 생성합니다. + * + * 정의 캐시 경로를 `storage/` 아래로 강제합니다. 지정하지 않으면 HTMLPurifier 는 자기 설치 + * 폴더(`{module}/vendor/ezyang/htmlpurifier/library/.../DefinitionCache/Serializer/`)에 캐시를 + * 쓰는데, 배포본의 vendor 를 읽기 전용으로 두는 서버에서는 그 쓰기가 `E_USER_WARNING` 을 내고 + * Laravel 이 이를 `ErrorException` 으로 승격시켜 상품 등록/수정이 매번 500 이 됩니다 (공개 #125). + * 캐시는 설정 해시당 1회만 기록되므로 쓰기 불가 환경에서는 캐시가 영영 생기지 않아 모든 요청이 + * 실패합니다. + * + * 캐시 디렉토리를 확보하지 못하면 정의 캐시만 끄고(`Cache.DefinitionImpl = null`) 정화는 그대로 + * 수행합니다 — 캐시는 성능 장치이고 정화는 보안 장치라, 캐시 실패가 보안 장치를 건너뛰게 + * 만들어서는 안 됩니다. + * + * @return \HTMLPurifier 설정이 적용된 인스턴스 + */ + protected function createPurifier(): \HTMLPurifier + { + $cachePath = $this->resolvePurifierCachePath($failure); + + if ($cachePath === null && ! self::$purifierCacheWarned) { + self::$purifierCacheWarned = true; + + // `error` 로 남기는 이유: G7 출하 기본값(config/settings/defaults.json)의 `log_level` 이 + // `error` 라, `warning` 으로 남기면 기본 설치 상태에서는 이 통지가 로그 파일에 아예 + // 기록되지 않는다. 저장은 성공하므로 사용자 피해는 없지만, 캐시를 못 쓰는 상태가 + // 흔적 없이 영구히 유지되어 운영자가 조치할 근거를 얻지 못한다. + Log::error('HTMLPurifier 정의 캐시 디렉토리를 사용할 수 없어 캐시 없이 동작합니다', [ + 'module' => self::MODULE_IDENTIFIER, + 'expected_path' => $this->purifierCacheDirectory(), + // 사유마다 고쳐야 할 대상이 다르다 — 상위 디렉토리 권한 / 그 자리를 차지한 파일 / + // 대상 자신의 권한. 사유 없이 경로만 남기면 운영자가 어디를 볼지 알 수 없다. + 'reason' => $failure['reason'] ?? 'unknown', + 'blocking_path' => $failure['path'] ?? $this->purifierCacheDirectory(), + 'impact' => '상품 설명(HTML) 정화가 요청마다 정의를 다시 계산합니다. 해당 디렉토리의 쓰기 권한을 확인하세요.', + ]); + } + + return new \HTMLPurifier($this->buildPurifierConfig($cachePath)); + } + + /** + * HTMLPurifier 설정을 조립합니다. + * + * @param string|null $cachePath 정의 캐시 디렉토리 절대 경로 (null 이면 캐시 비활성) + * @return \HTMLPurifier_Config 조립된 설정 + */ + protected function buildPurifierConfig(?string $cachePath): \HTMLPurifier_Config + { + $config = \HTMLPurifier_Config::createDefault(); + $config->set('HTML.Allowed', 'p,br,strong,em,b,i,u,s,ul,ol,li,a[href|target],img[src|alt|width|height],h1,h2,h3,h4,h5,h6,table,tr,td,th,thead,tbody,tfoot,caption,colgroup,col,blockquote,pre,code,div,span[style],hr'); + $config->set('CSS.AllowedProperties', 'color,background-color,font-size,font-weight,text-align,text-decoration,margin,padding,border,width,height'); + $config->set('Attr.AllowedFrameTargets', ['_blank']); + $config->set('URI.AllowedSchemes', ['http' => true, 'https' => true, 'mailto' => true]); + + if ($cachePath === null) { + $config->set('Cache.DefinitionImpl', null); + + return $config; + } + + $config->set('Cache.SerializerPath', $cachePath); + // HTMLPurifier 가 `{경로}/HTML` 하위 디렉토리와 `.ser` 파일을 만들 때 쓰는 권한. + // 기본값 0755 는 CLI 가 먼저 만들면 웹 계정이 못 쓴다. + $config->set('Cache.SerializerPermissions', self::PURIFIER_CACHE_DIR_MODE); + + return $config; + } + + /** + * 정의 캐시 디렉토리를 확보하고 절대 경로를 반환합니다. + * + * 디렉토리가 이미 있는데 쓰기 불가라면 요청 경로에서 권한을 고치려 들지 않고 null 을 + * 돌려줍니다 — 호출측이 캐시를 끄고 정화는 그대로 수행합니다. + * + * 확보 자체(경고를 내지 않는 생성 · umask 무력화 · POSIX setgid · 소유권 상속 · 쓰기 판정)는 + * 코어 공통 프리미티브가 맡습니다. 그 프리미티브는 예외도 PHP 경고도 내지 않으므로, 이 수정이 + * 막으려던 500 이 확보 실패 지점에서 다시 나는 일이 없습니다. + * + * @param array{reason: string, path: string}|null $failure out — 확보 실패 사유와 그 대상 경로 + * @return string|null 사용 가능한 절대 경로. 확보 실패 시 null + */ + protected function resolvePurifierCachePath(?array &$failure = null): ?string + { + $dir = $this->purifierCacheDirectory(); + + return FilePermissionHelper::ensureWritableDirectory($dir, self::PURIFIER_CACHE_DIR_MODE, $failure) + ? $dir + : null; + } + + /** + * 정의 캐시 디렉토리의 절대 경로 (존재 여부와 무관한 순수 계산). + * + * 경로는 코어 해석기가 `modules` 디스크 root 를 단일 출처로 삼아 조립합니다. + * `getStorageBasePath('cache')` 를 경유하지 않는 이유는 그 반환값이 `Storage::disk()->path()` + * 위임이라, 확장이 카테고리 디스크를 비로컬(S3 등)로 오버라이드하면 파일시스템 경로가 아니게 + * 되기 때문입니다 — HTMLPurifier 는 `file_put_contents` 로 쓰므로 반드시 로컬 절대 경로여야 + * 합니다. + * + * @return string 절대 경로 + */ + protected function purifierCacheDirectory(): string + { + return ExtensionStoragePath::module(self::MODULE_IDENTIFIER, 'cache/htmlpurifier'); + } + /** * SEO 동기화 플래그를 적용합니다 (서버 SSoT). * diff --git a/modules/_bundled/sirsoft-ecommerce/tests/Concerns/InspectsHtmlPurifierCache.php b/modules/_bundled/sirsoft-ecommerce/tests/Concerns/InspectsHtmlPurifierCache.php new file mode 100644 index 00000000..00f2975a --- /dev/null +++ b/modules/_bundled/sirsoft-ecommerce/tests/Concerns/InspectsHtmlPurifierCache.php @@ -0,0 +1,66 @@ + mtime:size" 스냅샷을 만듭니다. + * + * @param string|null $base 검사할 디렉토리 절대 경로 (null 이거나 미존재면 빈 배열) + * @return array 경로를 키로 정렬된 스냅샷 + */ + protected function serSnapshot(?string $base): array + { + if ($base === null || ! is_dir($base)) { + return []; + } + + $snapshot = []; + $it = new \RecursiveIteratorIterator( + new \RecursiveDirectoryIterator($base, \FilesystemIterator::SKIP_DOTS) + ); + + foreach ($it as $file) { + if ($file->isFile() && str_ends_with($file->getFilename(), '.ser')) { + $snapshot[$file->getPathname()] = $file->getMTime().':'.$file->getSize(); + } + } + + ksort($snapshot); + + return $snapshot; + } +} diff --git a/modules/_bundled/sirsoft-ecommerce/tests/Feature/Http/Controllers/Admin/ProductStoreHtmlDescriptionCacheTest.php b/modules/_bundled/sirsoft-ecommerce/tests/Feature/Http/Controllers/Admin/ProductStoreHtmlDescriptionCacheTest.php new file mode 100644 index 00000000..e83618aa --- /dev/null +++ b/modules/_bundled/sirsoft-ecommerce/tests/Feature/Http/Controllers/Admin/ProductStoreHtmlDescriptionCacheTest.php @@ -0,0 +1,179 @@ +assertTrue( + class_exists(\HTMLPurifier::class), + 'HTMLPurifier 가 로드되지 않았습니다. 모듈 vendor 가 설치되어 있고 ' + .'tests/bootstrap.php 의 확장 vendor 오토로드 등록이 동작하는지 확인하세요.' + ); + + $defaultConfig = SequenceType::PRODUCT->getDefaultConfig(); + Sequence::firstOrCreate( + ['type' => SequenceType::PRODUCT->value], + [ + 'algorithm' => $defaultConfig['algorithm']->value, + 'prefix' => $defaultConfig['prefix'], + 'current_value' => 0, + 'increment' => 1, + 'min_value' => 1, + 'max_value' => $defaultConfig['max_value'], + 'cycle' => false, + 'pad_length' => $defaultConfig['pad_length'], + 'max_history_count' => $defaultConfig['max_history_count'], + ] + ); + + $this->user = $this->createAdminUser([ + 'sirsoft-ecommerce.products.read', + 'sirsoft-ecommerce.products.create', + 'sirsoft-ecommerce.products.update', + ]); + + $this->category = new Category([ + 'name' => ['ko' => '테스트 카테고리', 'en' => 'Test Category'], + 'slug' => 'issue125-category', + 'is_active' => true, + 'depth' => 0, + ]); + $this->category->path = 'temp'; + $this->category->save(); + $this->category->generatePath(); + $this->category->save(); + + File::deleteDirectory($this->purifierStorageBase()); + } + + protected function tearDown(): void + { + File::deleteDirectory($this->purifierStorageBase()); + + parent::tearDown(); + } + + /** + * HTML 상세설명 상품 등록 payload. + * + * @param string $productCode 상품코드 + * @return array 등록 요청 body + */ + private function htmlProductData(string $productCode): array + { + return [ + 'name' => ['ko' => 'ISSUE125 상품', 'en' => 'ISSUE125 Product'], + 'product_code' => $productCode, + 'category_ids' => [$this->category->id], + 'list_price' => 10000, + 'selling_price' => 9000, + 'stock_quantity' => 10, + 'sales_status' => 'on_sale', + 'display_status' => 'visible', + 'tax_status' => 'taxable', + 'description_mode' => 'html', + 'description' => ['ko' => '

설명

'], + 'options' => [ + [ + 'option_code' => $productCode.'-O1', + 'option_name' => ['ko' => '기본옵션', 'en' => 'Default Option'], + 'option_values' => [ + ['key' => ['ko' => '색상'], 'value' => ['ko' => '빨강']], + ], + 'list_price' => 10000, + 'selling_price' => 9000, + 'stock_quantity' => 10, + ], + ], + ]; + } + + /** + * HTML 상세설명 상품을 등록하면 정의 캐시가 storage 아래에 기록됩니다. + * + * 거짓 green 경고: 개발 머신 vendor 에는 이미 같은 이름의 `.ser` 가 있어 "vendor 스냅샷 + * 불변" 단언은 수정 전에도 통과할 수 있다. 결함을 증명하는 것은 storage 스냅샷 단언이다. + * + * @scenario description_mode=html, cache_dir=writable + * + * @effects definition_cache_written_under_storage, vendor_install_directory_never_written + */ + public function test_store_with_html_description_writes_cache_under_storage(): void + { + $vendorBefore = $this->serSnapshot($this->vendorSerializerBase()); + + $response = $this->actingAs($this->user) + ->postJson('/api/modules/sirsoft-ecommerce/admin/products', $this->htmlProductData('ISSUE125-001')); + + $response->assertCreated(); + + $this->assertNotEmpty( + $this->serSnapshot($this->purifierStorageBase()), + 'storage 아래에 정의 캐시가 기록되지 않았습니다.' + ); + $this->assertSame( + $vendorBefore, + $this->serSnapshot($this->vendorSerializerBase()), + 'HTMLPurifier 설치 폴더에 정의 캐시가 기록되었습니다.' + ); + + $description = $response->json('data.description'); + $this->assertStringNotContainsString('actingAs($this->user) + ->postJson('/api/modules/sirsoft-ecommerce/admin/products', $this->htmlProductData('ISSUE125-002')) + ->assertCreated(); + + $snapshot = $this->serSnapshot($this->purifierStorageBase()); + $this->assertNotEmpty($snapshot); + + // mtime 해상도가 1초라 같은 초 안의 재기록이 감지되지 않는다 — 과거로 밀어 baseline 확보. + foreach (array_keys($snapshot) as $path) { + touch($path, time() - 3600); + } + $baseline = $this->serSnapshot($this->purifierStorageBase()); + + $this->actingAs($this->user) + ->postJson('/api/modules/sirsoft-ecommerce/admin/products', $this->htmlProductData('ISSUE125-003')) + ->assertCreated(); + + $this->assertSame( + $baseline, + $this->serSnapshot($this->purifierStorageBase()), + '두 번째 저장이 정의 캐시를 다시 기록했습니다 (재사용되지 않음).' + ); + } +} diff --git a/modules/_bundled/sirsoft-ecommerce/tests/Unit/Services/EcommerceSettingsOrderSettingsTest.php b/modules/_bundled/sirsoft-ecommerce/tests/Unit/Services/EcommerceSettingsOrderSettingsTest.php index a202e0bb..f78ef1dd 100644 --- a/modules/_bundled/sirsoft-ecommerce/tests/Unit/Services/EcommerceSettingsOrderSettingsTest.php +++ b/modules/_bundled/sirsoft-ecommerce/tests/Unit/Services/EcommerceSettingsOrderSettingsTest.php @@ -117,6 +117,8 @@ class EcommerceSettingsOrderSettingsTest extends ModuleTestCase */ public function test_saving_settings_does_not_touch_production_path(): void { + // audit:allow extension-storage-path-hand-assembled 운영 경로를 **의도적으로** 가리킨다 — + // 이 단언의 대상은 "테스트가 운영 파일을 건드리지 않았는가" 이므로 해석기를 쓰면 검사가 성립하지 않는다. $productionFile = storage_path('app/modules/sirsoft-ecommerce/settings/order_settings.json'); $existedBefore = File::exists($productionFile); $contentBefore = $existedBefore ? File::get($productionFile) : null; diff --git a/modules/_bundled/sirsoft-ecommerce/tests/Unit/Services/ProductDescriptionPurifierCacheTest.php b/modules/_bundled/sirsoft-ecommerce/tests/Unit/Services/ProductDescriptionPurifierCacheTest.php new file mode 100644 index 00000000..e98d3932 --- /dev/null +++ b/modules/_bundled/sirsoft-ecommerce/tests/Unit/Services/ProductDescriptionPurifierCacheTest.php @@ -0,0 +1,299 @@ +assertTrue( + class_exists(\HTMLPurifier::class), + 'HTMLPurifier 가 로드되지 않았습니다. 모듈 vendor 가 설치되어 있고 ' + .'tests/bootstrap.php 의 확장 vendor 오토로드 등록이 동작하는지 확인하세요.' + ); + + // 검증 대상이 이 테스트와 같은 트리(_bundled)의 사본인지 확인한다. + // 모듈 vendor 의 composer 오토로더는 자기 PSR-4 를 **활성** 디렉토리로 매핑하고 자신을 + // prepend 로 등록하므로, 그것을 그대로 로드하면 테스트가 활성 사본을 검증하게 되어 + // `_bundled` 의 수정이 반영되지 않은 채로도 통과하거나 실패한다 (조용한 오판). + $this->assertStringStartsWith( + dirname(__DIR__, 3).DIRECTORY_SEPARATOR, + (new \ReflectionClass(ProductService::class))->getFileName(), + 'ProductService 가 이 테스트와 다른 트리에서 로드되었습니다 — 모듈 vendor 오토로더가 ' + .'자기 PSR-4 를 등록해 활성 디렉토리 사본을 검증하고 있습니다.' + ); + + $this->purgePurifierCacheBase(); + $this->resetPurifierCacheNoticeFlag(); + } + + protected function tearDown(): void + { + $this->purgePurifierCacheBase(); + + parent::tearDown(); + } + + /** + * 테스트 캐시 디렉토리를 정리합니다 (파일이 자리를 차지한 경우 포함). + */ + private function purgePurifierCacheBase(): void + { + $base = $this->purifierStorageBase(); + + foreach ([$base, dirname($base)] as $path) { + if (is_file($path)) { + @unlink($path); + + continue; + } + + File::deleteDirectory($path); + } + } + + /** + * Log 파사드를 기록용 로거로 교체하고 그 기록기를 돌려줍니다. + * + * `Log::spy()` 는 쓰지 않는다 — `LogManager` 가 `__call` 로 임의 메서드를 받아 넘기므로 + * Mockery 스파이가 `shouldHaveReceived('error')` 를 `warning` 호출에도 통과시킨다(무효 단언). + * + * @return object `calls` 배열(level/message)을 보유한 기록기 + */ + private function swapLogRecorder(): object + { + $recorder = new class extends AbstractLogger + { + /** @var array */ + public array $calls = []; + + public function log($level, string|\Stringable $message, array $context = []): void + { + $this->calls[] = ['level' => (string) $level, 'message' => (string) $message]; + } + }; + + Log::swap($recorder); + + return $recorder; + } + + /** + * 캐시 비활성 통지의 "프로세스당 1회" 플래그를 되돌립니다. + * + * 정적 플래그라 같은 프로세스의 앞선 테스트가 이미 세워 두면 통지가 발화하지 않아, + * 통지 단언이 테스트 순서에 따라 조용히 통과/실패한다. + */ + private function resetPurifierCacheNoticeFlag(): void + { + $property = new \ReflectionProperty(ProductService::class, 'purifierCacheWarned'); + $property->setAccessible(true); + $property->setValue(null, false); + } + + /** + * `sanitizeDescription()` 을 호출하고 사용된 서비스 인스턴스를 돌려줍니다. + * + * @param array $data 상품 데이터 + * @return array{0: ProductService, 1: array} 서비스 인스턴스와 정화 결과 + */ + private function sanitize(array $data): array + { + // 생성자 의존성이 7개라 수동 new 가 성립하지 않는다. + $service = app(ProductService::class); + + $method = new \ReflectionMethod($service, 'sanitizeDescription'); + $method->setAccessible(true); + + return [$service, $method->invoke($service, $data)]; + } + + /** + * 서비스가 보유한 HTMLPurifier 인스턴스를 꺼냅니다. + * + * @param ProductService $service 대상 서비스 + * @return \HTMLPurifier|null 인스턴스 (미생성이면 null) + */ + private function purifierOf(ProductService $service): ?\HTMLPurifier + { + $property = new \ReflectionProperty($service, 'purifier'); + $property->setAccessible(true); + + return $property->getValue($service); + } + + /** + * HTML 모드 정화 시 정의 캐시가 vendor 가 아니라 storage 아래에 기록됩니다. + * + * 거짓 green 경고: 개발 머신 vendor 에는 이미 `.ser` 가 있고 설정 해시가 같아 파일명이 + * 동일하므로 "vendor 스냅샷 불변" 단언은 수정 전에도 통과할 수 있다. 결함을 증명하는 것은 + * storage 쪽 단언(`Cache.SerializerPath` / `generateFilePath` / `assertFileExists`)이다. + * + * @scenario description_mode=html, cache_dir=writable + * + * @effects definition_cache_written_under_storage, vendor_install_directory_never_written + */ + public function test_definition_cache_is_written_under_storage_not_vendor(): void + { + $storageBase = $this->purifierStorageBase(); + $vendorBefore = $this->serSnapshot($this->vendorSerializerBase()); + + [$service, $result] = $this->sanitize([ + 'description_mode' => 'html', + 'description' => ['ko' => '

본문

'], + ]); + + $this->assertStringContainsString('

본문

', $result['description']['ko']); + $this->assertStringNotContainsString('purifierOf($service); + $this->assertNotNull($purifier); + + $config = $purifier->config; + $this->assertSame($storageBase, $config->get('Cache.SerializerPath')); + + $cacheFile = (new \HTMLPurifier_DefinitionCache_Serializer('HTML'))->generateFilePath($config); + $this->assertStringStartsWith($storageBase, $cacheFile); + $this->assertFileExists($cacheFile); + + $this->assertSame( + $vendorBefore, + $this->serSnapshot($this->vendorSerializerBase()), + 'HTMLPurifier 설치 폴더에 정의 캐시가 기록되었습니다.' + ); + } + + /** + * text 모드는 HTMLPurifier 를 인스턴스화하지 않습니다. + * + * @scenario description_mode=text, cache_dir=writable + * + * @effects text_mode_skips_purifier_entirely + */ + public function test_text_mode_never_touches_purifier(): void + { + [$service, $result] = $this->sanitize([ + 'description_mode' => 'text', + 'description' => ['ko' => '

본문

'], + ]); + + $this->assertSame('

본문

', $result['description']['ko']); + $this->assertNull($this->purifierOf($service)); + $this->assertDirectoryDoesNotExist($this->purifierStorageBase()); + } + + /** + * 캐시 디렉토리를 확보하지 못하면 캐시만 끄고 정화는 그대로 수행합니다. + * + * 목적지에 같은 이름의 **파일**을 놓아 재현한다 — ACL/chmod 없이 Windows·POSIX 양쪽에서 + * 결정적이다. + * + * 거짓 green 경고: vendor 스냅샷 불변 단언은 수정 전에도 통과할 수 있다(위 참조). + * 이 테스트의 판정은 `Cache.DefinitionImpl === null` 이다. + * + * 통지 수준을 함께 잠근다 — 이 폴백은 저장을 성공시키므로 운영자에게 도달하는 흔적이 + * 그 통지 하나뿐인데, G7 출하 기본 로그 수준(`config/settings/defaults.json` 의 `log_level`)이 + * `error` 라 `warning` 으로 남기면 기본 설치 상태에서 파일에 기록되지 않는다. + * + * @scenario description_mode=html, cache_dir=occupied_by_file + * + * @effects purify_still_strips_script_when_cache_disabled, vendor_install_directory_never_written, cache_disabled_notice_reaches_default_log_level + */ + public function test_falls_back_to_disabled_definition_cache_when_directory_unusable(): void + { + $base = $this->purifierStorageBase(); + File::ensureDirectoryExists(dirname($base)); + file_put_contents($base, 'occupied'); + + $vendorBefore = $this->serSnapshot($this->vendorSerializerBase()); + + $recorder = $this->swapLogRecorder(); + + [$service, $result] = $this->sanitize([ + 'description_mode' => 'html', + 'description' => ['ko' => '

본문

'], + ]); + + $notices = array_values(array_filter( + $recorder->calls, + fn (array $call): bool => str_contains($call['message'], 'HTMLPurifier 정의 캐시 디렉토리를 사용할 수 없어') + )); + + $this->assertCount(1, $notices, '캐시 비활성 통지가 프로세스당 1회 발화해야 합니다.'); + $this->assertSame( + 'error', + $notices[0]['level'], + '캐시 비활성 통지는 error 수준이어야 합니다 — 출하 기본 로그 수준이 error 라 ' + .'warning 으로 남기면 기본 설치 상태에서 로그 파일에 기록되지 않고, 이 폴백은 저장을 ' + .'성공시키므로 운영자에게 도달하는 흔적이 이 통지 하나뿐입니다.' + ); + + $this->assertStringContainsString('

본문

', $result['description']['ko']); + $this->assertStringNotContainsString('purifierOf($service); + $this->assertNotNull($purifier); + $this->assertNull($purifier->config->get('Cache.DefinitionImpl')); + + $this->assertSame( + $vendorBefore, + $this->serSnapshot($this->vendorSerializerBase()), + 'HTMLPurifier 설치 폴더에 정의 캐시가 기록되었습니다.' + ); + } + + /** + * 캐시 디렉토리 생성 실패가 예외로 승격되지 않습니다. + * + * `File::ensureDirectoryExists()` 는 `mkdir()` 을 억제 없이 호출하므로, 생성이 실패하면 + * `E_WARNING` 이 나오고 Laravel `HandleExceptions` 가 이를 `ErrorException` 으로 승격시켜 + * 요청이 500 이 된다 — 이 이슈가 막으려던 실패가 다른 줄에서 그대로 재현되는 형태다. + * 부모 자리에 파일을 놓아 재현한다(ACL/chmod 없이 Windows·POSIX 양쪽에서 결정적). + * + * @scenario description_mode=html, cache_dir=parent_unusable + * + * @effects cache_dir_creation_failure_does_not_escalate, purify_still_strips_script_when_cache_disabled + */ + public function test_directory_creation_failure_does_not_escalate_to_exception(): void + { + $base = $this->purifierStorageBase(); + $parent = dirname($base); + + File::deleteDirectory($parent); + File::ensureDirectoryExists(dirname($parent)); + file_put_contents($parent, 'occupied'); + + $this->assertFalse(is_dir($base)); + $this->assertFalse(file_exists($base), '부모가 파일이면 자식 경로는 존재하지 않아야 한다 (전제 확인).'); + + [$service, $result] = $this->sanitize([ + 'description_mode' => 'html', + 'description' => ['ko' => '

본문

'], + ]); + + $this->assertStringContainsString('

본문

', $result['description']['ko']); + $this->assertStringNotContainsString('assertNull($this->purifierOf($service)->config->get('Cache.DefinitionImpl')); + } +} diff --git a/modules/_bundled/sirsoft-ecommerce/tests/scenarios/issue125-htmlpurifier-cache-path.yaml b/modules/_bundled/sirsoft-ecommerce/tests/scenarios/issue125-htmlpurifier-cache-path.yaml new file mode 100644 index 00000000..7d555e5e --- /dev/null +++ b/modules/_bundled/sirsoft-ecommerce/tests/scenarios/issue125-htmlpurifier-cache-path.yaml @@ -0,0 +1,56 @@ +feature: HTMLPurifier 정의 캐시 경로 재지정 (공개 #125) + +description: | + 상품 상세설명을 편집기(HTML)로 작성해 저장하면 정화 구성요소(HTMLPurifier)가 정의 캐시를 + 자기 설치 폴더(`{module}/vendor/ezyang/htmlpurifier/library/.../DefinitionCache/Serializer/`)에 + 기록했다. 배포본의 vendor 를 읽기 전용으로 두는 표준 서버에서는 그 쓰기가 예외가 아니라 + PHP 경고로 나오고 Laravel 이 이를 ErrorException 으로 승격시켜 상품 등록/수정이 500 으로 + 끝났다. 캐시는 설정 해시당 1회만 기록되므로 쓰기 불가 환경에서는 캐시가 영영 생기지 않아 + 매 요청이 같은 실패를 반복했다 (공개 이슈 #125, @lyg-kaban 제보). + + 정정은 세 갈래다 — ① 정의 캐시 경로를 `storage/app/modules/{identifier}/cache/htmlpurifier` + 로 명시 지정하고, ② 그 디렉토리를 우리가 먼저 만든다(HTMLPurifier 는 base 디렉토리가 없으면 + 경고만 내고 만들지 않는다), ③ 그 경로마저 확보하지 못하면 정의 캐시만 끄고 정화는 그대로 + 수행한다. 캐시는 성능 장치이고 정화는 보안 장치라, 캐시 실패가 보안 장치를 건너뛰게 + 만들어서는 안 된다. + + ③ 의 폴백은 저장을 성공시키므로 운영자에게 도달하는 흔적이 로그 통지 하나뿐이다. 그 통지는 + `error` 수준으로 남긴다 — G7 출하 기본 로그 수준(`config/settings/defaults.json` 의 + `log_level`)이 `error` 라, `warning` 으로 남기면 기본 설치 상태에서 파일에 기록되지 않아 + 캐시를 못 쓰는 상태가 흔적 없이 영구히 유지된다. + +axes: + description_mode: [text, html] + cache_dir: [writable, occupied_by_file, parent_unusable, already_populated] + +exclusions: + - { description_mode: text, cache_dir: occupied_by_file, reason: "text 모드는 HTMLPurifier 를 인스턴스화하지 않아 캐시 상태와 직교" } + - { description_mode: text, cache_dir: parent_unusable, reason: "동일 — text 모드는 purifier 경로에 진입하지 않는다" } + - { description_mode: text, cache_dir: already_populated, reason: "동일 — text 모드는 purifier 경로에 진입하지 않는다" } + +effects: + - definition_cache_written_under_storage + - vendor_install_directory_never_written + - text_mode_skips_purifier_entirely + - purify_still_strips_script_when_cache_disabled + - cache_dir_creation_failure_does_not_escalate + - cache_disabled_notice_reaches_default_log_level + - second_save_reuses_cached_definition + +test_files: + - modules/_bundled/sirsoft-ecommerce/tests/Unit/Services/ProductDescriptionPurifierCacheTest.php + - modules/_bundled/sirsoft-ecommerce/tests/Feature/Http/Controllers/Admin/ProductStoreHtmlDescriptionCacheTest.php + +validation: + note: | + 거짓 green 경고: 개발 머신의 vendor 에는 이미 `.ser` 가 있고 설정 해시가 같아 파일명이 + 동일하므로, "vendor 설치 폴더가 쓰이지 않았다" 는 단언만으로는 수정 전에도 통과한다. + 결함을 실제로 증명하는 것은 storage 쪽 단언이다 — `Cache.SerializerPath` 값, + `generateFilePath()` 가 가리키는 경로의 실재, 그리고 폴백 경로에서의 + `Cache.DefinitionImpl === null`. + + 이 테스트들은 모듈 전용 composer 패키지(`\HTMLPurifier`)를 실제로 로드해야 성립한다. + PHPUnit 진입점(`autoload-extensions.php`)은 확장 vendor 를 오토로드하지 않으므로 코어 + `tests/bootstrap.php` 가 확장 vendor 의 생성된 맵에서 제3자 패키지만 골라 등록하며(확장 + 자신의 PSR-4 는 제외 — 활성 디렉토리 사본을 검증하게 되는 것을 막는다), + 각 테스트는 로드 실패를 조용한 skip 이 아니라 setUp 단언 실패로 드러낸다. diff --git a/modules/_bundled/sirsoft-ecommerce/upgrades/data/1.0.0/migrations/AbsorbLegacyDueDaysIntoAutoCancelDays.php b/modules/_bundled/sirsoft-ecommerce/upgrades/data/1.0.0/migrations/AbsorbLegacyDueDaysIntoAutoCancelDays.php index b7487f8d..cea98520 100644 --- a/modules/_bundled/sirsoft-ecommerce/upgrades/data/1.0.0/migrations/AbsorbLegacyDueDaysIntoAutoCancelDays.php +++ b/modules/_bundled/sirsoft-ecommerce/upgrades/data/1.0.0/migrations/AbsorbLegacyDueDaysIntoAutoCancelDays.php @@ -4,6 +4,7 @@ namespace App\Upgrades\Data\Ext\Modules\SirsoftEcommerce\V1_0_0\Migrations; use App\Extension\Upgrade\DataMigration; use App\Extension\UpgradeContext; +use App\Support\ExtensionStoragePath; use Illuminate\Support\Facades\File; /** @@ -79,6 +80,6 @@ class AbsorbLegacyDueDaysIntoAutoCancelDays implements DataMigration */ private function settingsFilePath(): string { - return storage_path('app/modules/'.self::MODULE_IDENTIFIER.'/settings/order_settings.json'); + return ExtensionStoragePath::module(self::MODULE_IDENTIFIER, 'settings').'/order_settings.json'; } } diff --git a/modules/_bundled/sirsoft-ecommerce/upgrades/data/1.0.0/migrations/BackfillShippingPolicyCurrency.php b/modules/_bundled/sirsoft-ecommerce/upgrades/data/1.0.0/migrations/BackfillShippingPolicyCurrency.php index 73b0160f..0e901383 100644 --- a/modules/_bundled/sirsoft-ecommerce/upgrades/data/1.0.0/migrations/BackfillShippingPolicyCurrency.php +++ b/modules/_bundled/sirsoft-ecommerce/upgrades/data/1.0.0/migrations/BackfillShippingPolicyCurrency.php @@ -4,6 +4,7 @@ namespace App\Upgrades\Data\Ext\Modules\SirsoftEcommerce\V1_0_0\Migrations; use App\Extension\Upgrade\DataMigration; use App\Extension\UpgradeContext; +use App\Support\ExtensionStoragePath; use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\File; use Illuminate\Support\Facades\Schema; @@ -81,10 +82,6 @@ class BackfillShippingPolicyCurrency implements DataMigration */ private function settingsFilePath(): string { - $base = app()->runningUnitTests() - ? 'framework/testing/modules/' - : 'app/modules/'; - - return storage_path($base.self::MODULE_IDENTIFIER.'/settings/language_currency.json'); + return ExtensionStoragePath::module(self::MODULE_IDENTIFIER, 'settings').'/language_currency.json'; } } diff --git a/modules/_bundled/sirsoft-ecommerce/upgrades/data/1.0.0/migrations/NormalizeCurrencyBaseUnit.php b/modules/_bundled/sirsoft-ecommerce/upgrades/data/1.0.0/migrations/NormalizeCurrencyBaseUnit.php index aef6e796..773bb2fa 100644 --- a/modules/_bundled/sirsoft-ecommerce/upgrades/data/1.0.0/migrations/NormalizeCurrencyBaseUnit.php +++ b/modules/_bundled/sirsoft-ecommerce/upgrades/data/1.0.0/migrations/NormalizeCurrencyBaseUnit.php @@ -4,6 +4,7 @@ namespace App\Upgrades\Data\Ext\Modules\SirsoftEcommerce\V1_0_0\Migrations; use App\Extension\Upgrade\DataMigration; use App\Extension\UpgradeContext; +use App\Support\ExtensionStoragePath; use Illuminate\Support\Facades\File; /** @@ -153,10 +154,6 @@ class NormalizeCurrencyBaseUnit implements DataMigration */ private function settingsFilePath(): string { - $base = app()->runningUnitTests() - ? 'framework/testing/modules/' - : 'app/modules/'; - - return storage_path($base.self::MODULE_IDENTIFIER.'/settings/language_currency.json'); + return ExtensionStoragePath::module(self::MODULE_IDENTIFIER, 'settings').'/language_currency.json'; } } diff --git a/modules/_bundled/sirsoft-ecommerce/upgrades/data/1.0.0/migrations/NormalizeCurrencyLocales.php b/modules/_bundled/sirsoft-ecommerce/upgrades/data/1.0.0/migrations/NormalizeCurrencyLocales.php index e97378e0..41ae3edc 100644 --- a/modules/_bundled/sirsoft-ecommerce/upgrades/data/1.0.0/migrations/NormalizeCurrencyLocales.php +++ b/modules/_bundled/sirsoft-ecommerce/upgrades/data/1.0.0/migrations/NormalizeCurrencyLocales.php @@ -4,6 +4,7 @@ namespace App\Upgrades\Data\Ext\Modules\SirsoftEcommerce\V1_0_0\Migrations; use App\Extension\Upgrade\DataMigration; use App\Extension\UpgradeContext; +use App\Support\ExtensionStoragePath; use Illuminate\Support\Facades\File; /** @@ -137,10 +138,6 @@ class NormalizeCurrencyLocales implements DataMigration */ private function settingsFilePath(): string { - $base = app()->runningUnitTests() - ? 'framework/testing/modules/' - : 'app/modules/'; - - return storage_path($base.self::MODULE_IDENTIFIER.'/settings/language_currency.json'); + return ExtensionStoragePath::module(self::MODULE_IDENTIFIER, 'settings').'/language_currency.json'; } } diff --git a/modules/_bundled/sirsoft-ecommerce/upgrades/data/1.0.0/migrations/RemoveLegacyDefaultLanguage.php b/modules/_bundled/sirsoft-ecommerce/upgrades/data/1.0.0/migrations/RemoveLegacyDefaultLanguage.php index d3df3611..9ef1a3e5 100644 --- a/modules/_bundled/sirsoft-ecommerce/upgrades/data/1.0.0/migrations/RemoveLegacyDefaultLanguage.php +++ b/modules/_bundled/sirsoft-ecommerce/upgrades/data/1.0.0/migrations/RemoveLegacyDefaultLanguage.php @@ -4,6 +4,7 @@ namespace App\Upgrades\Data\Ext\Modules\SirsoftEcommerce\V1_0_0\Migrations; use App\Extension\Upgrade\DataMigration; use App\Extension\UpgradeContext; +use App\Support\ExtensionStoragePath; use Illuminate\Support\Facades\File; /** @@ -60,6 +61,6 @@ class RemoveLegacyDefaultLanguage implements DataMigration */ private function settingsFilePath(): string { - return storage_path('app/modules/'.self::MODULE_IDENTIFIER.'/settings/language_currency.json'); + return ExtensionStoragePath::module(self::MODULE_IDENTIFIER, 'settings').'/language_currency.json'; } } diff --git a/modules/_bundled/sirsoft-ecommerce/upgrades/data/1.0.2/migrations/PruneEmptyShippingCountryNameLocales.php b/modules/_bundled/sirsoft-ecommerce/upgrades/data/1.0.2/migrations/PruneEmptyShippingCountryNameLocales.php index ba3c303d..264528d8 100644 --- a/modules/_bundled/sirsoft-ecommerce/upgrades/data/1.0.2/migrations/PruneEmptyShippingCountryNameLocales.php +++ b/modules/_bundled/sirsoft-ecommerce/upgrades/data/1.0.2/migrations/PruneEmptyShippingCountryNameLocales.php @@ -4,6 +4,7 @@ namespace App\Upgrades\Data\Ext\Modules\SirsoftEcommerce\V1_0_2\Migrations; use App\Extension\Upgrade\DataMigration; use App\Extension\UpgradeContext; +use App\Support\ExtensionStoragePath; use Illuminate\Support\Facades\File; /** @@ -130,10 +131,6 @@ class PruneEmptyShippingCountryNameLocales implements DataMigration */ private function settingsFilePath(): string { - $base = app()->runningUnitTests() - ? 'framework/testing/modules/' - : 'app/modules/'; - - return storage_path($base.self::MODULE_IDENTIFIER.'/settings/shipping.json'); + return ExtensionStoragePath::module(self::MODULE_IDENTIFIER, 'settings').'/shipping.json'; } } diff --git a/modules/_bundled/sirsoft-ecommerce/upgrades/data/1.0.5/migrations/07_BackfillMileageEarnRounding.php b/modules/_bundled/sirsoft-ecommerce/upgrades/data/1.0.5/migrations/07_BackfillMileageEarnRounding.php index dd21bb3d..8a7e143f 100644 --- a/modules/_bundled/sirsoft-ecommerce/upgrades/data/1.0.5/migrations/07_BackfillMileageEarnRounding.php +++ b/modules/_bundled/sirsoft-ecommerce/upgrades/data/1.0.5/migrations/07_BackfillMileageEarnRounding.php @@ -4,6 +4,7 @@ namespace App\Upgrades\Data\Ext\Modules\SirsoftEcommerce\V1_0_5\Migrations; use App\Extension\Upgrade\DataMigration; use App\Extension\UpgradeContext; +use App\Support\ExtensionStoragePath; use Illuminate\Support\Facades\File; /** @@ -122,10 +123,6 @@ class BackfillMileageEarnRounding implements DataMigration */ private function settingsFilePath(): string { - $base = app()->runningUnitTests() - ? 'framework/testing/modules/' - : 'app/modules/'; - - return storage_path($base.self::MODULE_IDENTIFIER.'/settings/mileage.json'); + return ExtensionStoragePath::module(self::MODULE_IDENTIFIER, 'settings').'/mileage.json'; } } diff --git a/modules/_bundled/sirsoft-ecommerce/upgrades/data/1.1.1/migrations/04_SoftDeleteOrphanInquiryReplyPosts.php b/modules/_bundled/sirsoft-ecommerce/upgrades/data/1.1.1/migrations/04_SoftDeleteOrphanInquiryReplyPosts.php index 0e559f0b..f8719c5c 100644 --- a/modules/_bundled/sirsoft-ecommerce/upgrades/data/1.1.1/migrations/04_SoftDeleteOrphanInquiryReplyPosts.php +++ b/modules/_bundled/sirsoft-ecommerce/upgrades/data/1.1.1/migrations/04_SoftDeleteOrphanInquiryReplyPosts.php @@ -4,6 +4,7 @@ namespace App\Upgrades\Data\Ext\Modules\SirsoftEcommerce\V1_1_1\Migrations; use App\Extension\Upgrade\DataMigration; use App\Extension\UpgradeContext; +use App\Support\ExtensionStoragePath; use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\File; use Illuminate\Support\Facades\Schema; @@ -102,7 +103,7 @@ class SoftDeleteOrphanInquiryReplyPosts implements DataMigration $boardIds = []; // ① 설정 파일의 board_slug → boards.id 해석 - $settingsPath = storage_path('app/modules/sirsoft-ecommerce/settings/inquiry.json'); + $settingsPath = ExtensionStoragePath::module('sirsoft-ecommerce', 'settings').'/inquiry.json'; if (File::exists($settingsPath) && Schema::hasTable(self::BOARDS_TABLE)) { $settings = json_decode(File::get($settingsPath), true); diff --git a/modules/_bundled/sirsoft-ecommerce/vendor-bundle.json b/modules/_bundled/sirsoft-ecommerce/vendor-bundle.json index 3fce4c60..711fcd44 100644 --- a/modules/_bundled/sirsoft-ecommerce/vendor-bundle.json +++ b/modules/_bundled/sirsoft-ecommerce/vendor-bundle.json @@ -1,15 +1,15 @@ { "schema_version": "1.0", - "generated_at": "2026-08-22T12:22:17+00:00", + "generated_at": "2026-08-28T01:27:59+00:00", "generator": "g7 vendor-bundle:build", "target": "module:sirsoft-ecommerce", - "composer_json_sha256": "0556835aa543c462efe9132123b57234fddb66e482898144e7930f6cbedb1a9d", + "composer_json_sha256": "4f224863e21777f5ef474a7fcfb7d5f66132551b4c58220a660bd3acb573dfdb", "composer_lock_sha256": "876ca9c2273a33baff878d25050a567018a946412db053930a7f548c4add595d", - "zip_sha256": "3127bf97f4342c91cffc0d729eaa70f2a1f74a4a4015288081a082e665ccb9c0", - "zip_size": 435548, + "zip_sha256": "5f954f1597fc2a39bb601af441e3af3768e303b835c9047f0ade71cb56aec66c", + "zip_size": 435549, "package_count": 1, "php_requirement": "^8.2", - "g7_version": "7.0.9", + "g7_version": "7.0.10", "packages": [ { "name": "ezyang/htmlpurifier", diff --git a/modules/_bundled/sirsoft-ecommerce/vendor-bundle.zip b/modules/_bundled/sirsoft-ecommerce/vendor-bundle.zip index 0a403434..a933076c 100644 Binary files a/modules/_bundled/sirsoft-ecommerce/vendor-bundle.zip and b/modules/_bundled/sirsoft-ecommerce/vendor-bundle.zip differ diff --git a/modules/_bundled/sirsoft-page/CHANGELOG.md b/modules/_bundled/sirsoft-page/CHANGELOG.md index 5f6a6480..6c2f3b9c 100644 --- a/modules/_bundled/sirsoft-page/CHANGELOG.md +++ b/modules/_bundled/sirsoft-page/CHANGELOG.md @@ -14,6 +14,10 @@ - 페이지 공유 미리보기의 설명(og:description)이 항상 비어 있던 문제를 수정했습니다. 이제 페이지 SEO 설정의 설명이 사용됩니다. +### Changed + +- 코어 최소 요구 버전을 7.0.10 으로 상향 + ## [1.0.3] - 2026-08-19 ### Security diff --git a/modules/_bundled/sirsoft-page/module.json b/modules/_bundled/sirsoft-page/module.json index ad059bb5..49d69062 100644 --- a/modules/_bundled/sirsoft-page/module.json +++ b/modules/_bundled/sirsoft-page/module.json @@ -11,7 +11,7 @@ "ko": "정적 페이지(정보/정책/안내) 관리 모듈", "en": "Static page (info/policy/guide) management module" }, - "g7_version": ">=7.0.9", + "g7_version": ">=7.0.10", "dependencies": { "modules": {}, "plugins": {} diff --git a/modules/_bundled/sirsoft-page/src/Services/PageSettingsService.php b/modules/_bundled/sirsoft-page/src/Services/PageSettingsService.php index a483ea83..b121fe15 100644 --- a/modules/_bundled/sirsoft-page/src/Services/PageSettingsService.php +++ b/modules/_bundled/sirsoft-page/src/Services/PageSettingsService.php @@ -3,6 +3,7 @@ namespace Modules\Sirsoft\Page\Services; use App\Contracts\Extension\ModuleSettingsInterface; +use App\Support\ExtensionStoragePath; use App\Traits\NormalizesSettingsData; use Illuminate\Support\Arr; use Illuminate\Support\Facades\File; @@ -253,17 +254,15 @@ class PageSettingsService implements ModuleSettingsInterface /** * 설정 저장 경로 반환 * - * testing 환경에서는 운영 설정(storage/app/modules/.../settings)을 보호하기 위해 - * 별도 경로를 사용합니다 — 테스트가 개발/운영 설정을 덮어쓰지 않게 합니다. + * 경로는 `modules` 디스크 root(`config/filesystems.php`)를 단일 출처로 삼는다. 그 root 가 + * 테스트 환경에서 운영 데이터와 격리된 경로를 가리키므로, 운영 설정(storage/app/modules/ + * .../settings)을 덮어쓰지 않기 위한 분기를 이 서비스가 따로 들고 있지 않는다 — 분기를 + * 확장마다 복사하면 한 곳만 빠뜨려도 그 확장의 테스트가 조용히 운영 파일을 건드린다. * * @return string 설정 파일 저장 디렉토리 경로 */ private function getStoragePath(): string { - if (app()->runningUnitTests()) { - return storage_path('framework/testing/modules/'.self::MODULE_IDENTIFIER.'/settings'); - } - - return storage_path('app/modules/'.self::MODULE_IDENTIFIER.'/settings'); + return ExtensionStoragePath::module(self::MODULE_IDENTIFIER, 'settings'); } } diff --git a/plugins/_bundled/sirsoft-ckeditor5/upgrades/data/1.0.2/migrations/01_SeedUnusedImageCleanupSettings.php b/plugins/_bundled/sirsoft-ckeditor5/upgrades/data/1.0.2/migrations/01_SeedUnusedImageCleanupSettings.php index 91227791..1aadd141 100644 --- a/plugins/_bundled/sirsoft-ckeditor5/upgrades/data/1.0.2/migrations/01_SeedUnusedImageCleanupSettings.php +++ b/plugins/_bundled/sirsoft-ckeditor5/upgrades/data/1.0.2/migrations/01_SeedUnusedImageCleanupSettings.php @@ -7,6 +7,7 @@ namespace App\Upgrades\Data\Ext\Plugins\SirsoftCkeditor5\V1_0_2\Migrations; use App\Extension\Helpers\FilePermissionHelper; use App\Extension\Upgrade\DataMigration; use App\Extension\UpgradeContext; +use App\Support\ExtensionStoragePath; use Illuminate\Support\Facades\File; /** @@ -30,11 +31,6 @@ use Illuminate\Support\Facades\File; */ final class SeedUnusedImageCleanupSettings implements DataMigration { - /** - * 플러그인 설정 저장 경로. - */ - private const SETTINGS_PATH = 'app/plugins/sirsoft-ckeditor5/settings/setting.json'; - /** * 백필할 기본값 (키 => 기본값). * @@ -62,7 +58,9 @@ final class SeedUnusedImageCleanupSettings implements DataMigration */ public function run(UpgradeContext $context): void { - $path = storage_path(self::SETTINGS_PATH); + // 플러그인 설정 저장 경로. 절대 경로는 코어 해석기가 디스크 root 를 기준으로 조립한다 — 확장마다 + // 경로를 직접 조립하면 테스트 환경에서 운영 설정 파일을 그대로 건드리게 된다. + $path = ExtensionStoragePath::plugin('sirsoft-ckeditor5', 'settings').'/setting.json'; if (! File::exists($path)) { $context->logger->info('[sirsoft-ckeditor5] 설정 파일 없음 — 설치 시 defaults.json 이 시드하므로 skip'); diff --git a/plugins/_bundled/sirsoft-message_bizppurio/tests/PluginTestCase.php b/plugins/_bundled/sirsoft-message_bizppurio/tests/PluginTestCase.php index e957d824..d5ca21f0 100644 --- a/plugins/_bundled/sirsoft-message_bizppurio/tests/PluginTestCase.php +++ b/plugins/_bundled/sirsoft-message_bizppurio/tests/PluginTestCase.php @@ -108,7 +108,7 @@ abstract class PluginTestCase extends TestCase * 플러그인 스토리지('plugins' 디스크)를 테스트 전용 임시 디렉토리로 격리한다. * * 설정 저장 테스트(PluginSettingsService::save)는 코어 'plugins' 디스크 - * (root = storage_path('app/plugins'))에 setting.json 을 쓴다. 격리하지 않으면 + * (root = `plugins` 디스크, config/filesystems.php)에 setting.json 을 쓴다. 격리하지 않으면 * 테스트가 실제 로컬 런타임 설정 파일을 덮어써 검수 모드/자격증명이 오염된다 * (RefreshDatabase 는 DB 만 롤백하고 파일시스템은 되돌리지 않음). 디스크 root 를 * 임시 경로로 바꾸고 resolved 인스턴스를 purge 하여 실제 파일을 원천적으로 못 diff --git a/plugins/_bundled/sirsoft-pay_kginicis/CHANGELOG.md b/plugins/_bundled/sirsoft-pay_kginicis/CHANGELOG.md index 98377c59..d416b9d6 100644 --- a/plugins/_bundled/sirsoft-pay_kginicis/CHANGELOG.md +++ b/plugins/_bundled/sirsoft-pay_kginicis/CHANGELOG.md @@ -7,6 +7,7 @@ ## [1.1.2] - 2026-08-22 ### Changed +- 코어 최소 요구 버전을 7.0.10 으로 상향 - 코어 최소 요구 버전을 7.0.8 로 상향했습니다. diff --git a/plugins/_bundled/sirsoft-pay_kginicis/plugin.json b/plugins/_bundled/sirsoft-pay_kginicis/plugin.json index 1a9c43db..c4301b92 100644 --- a/plugins/_bundled/sirsoft-pay_kginicis/plugin.json +++ b/plugins/_bundled/sirsoft-pay_kginicis/plugin.json @@ -13,7 +13,7 @@ "ko": "KG 이니시스 결제 게이트웨이 (표준결제창 연동, 일본결제 지원)", "en": "KG Inicis payment gateway (standard payment window, Japan payment support)" }, - "g7_version": ">=7.0.8", + "g7_version": ">=7.0.10", "dependencies": { "modules": { "sirsoft-ecommerce": ">=1.1.0" diff --git a/plugins/_bundled/sirsoft-pay_kginicis/tests/Unit/Upgrades/BackfillEasyPayPgProviderTest.php b/plugins/_bundled/sirsoft-pay_kginicis/tests/Unit/Upgrades/BackfillEasyPayPgProviderTest.php index c48471fa..f8e6e2a5 100644 --- a/plugins/_bundled/sirsoft-pay_kginicis/tests/Unit/Upgrades/BackfillEasyPayPgProviderTest.php +++ b/plugins/_bundled/sirsoft-pay_kginicis/tests/Unit/Upgrades/BackfillEasyPayPgProviderTest.php @@ -5,9 +5,10 @@ declare(strict_types=1); namespace Plugins\Sirsoft\PayKginicis\Tests\Unit\Upgrades; use App\Extension\UpgradeContext; +use App\Support\ExtensionStoragePath; use App\Upgrades\Data\Ext\Plugins\SirsoftPayKginicis\V1_0_1\Migrations\BackfillEasyPayPgProvider; use Illuminate\Support\Facades\File; -use Tests\TestCase; +use Plugins\Sirsoft\PayKginicis\Tests\PluginTestCase; require_once dirname(__DIR__, 3).'/upgrades/data/1.0.1/migrations/BackfillEasyPayPgProvider.php'; @@ -18,7 +19,7 @@ require_once dirname(__DIR__, 3).'/upgrades/data/1.0.1/migrations/BackfillEasyPa * 있다. 서버가 이 값을 보고 간편결제 주문을 "PG 결제가 아닌 주문" 으로 오인해 결제 실패 * 시 관리자 알림 오발송 + 임시주문 삭제(재결제 불가) 를 일으켰다. */ -class BackfillEasyPayPgProviderTest extends TestCase +class BackfillEasyPayPgProviderTest extends PluginTestCase { private string $settingsPath; @@ -30,7 +31,7 @@ class BackfillEasyPayPgProviderTest extends TestCase { parent::setUp(); - $this->settingsPath = storage_path('app/modules/sirsoft-ecommerce/settings/order_settings.json'); + $this->settingsPath = ExtensionStoragePath::module('sirsoft-ecommerce', 'settings').'/order_settings.json'; $this->hadOriginalSettings = File::exists($this->settingsPath); $this->originalSettings = $this->hadOriginalSettings ? File::get($this->settingsPath) : null; diff --git a/plugins/_bundled/sirsoft-pay_kginicis/tests/Unit/Upgrades/MigrateNaverpayBrandButtonKeyTest.php b/plugins/_bundled/sirsoft-pay_kginicis/tests/Unit/Upgrades/MigrateNaverpayBrandButtonKeyTest.php index 4fcbf819..c034d705 100644 --- a/plugins/_bundled/sirsoft-pay_kginicis/tests/Unit/Upgrades/MigrateNaverpayBrandButtonKeyTest.php +++ b/plugins/_bundled/sirsoft-pay_kginicis/tests/Unit/Upgrades/MigrateNaverpayBrandButtonKeyTest.php @@ -5,6 +5,7 @@ declare(strict_types=1); namespace Plugins\Sirsoft\PayKginicis\Tests\Unit\Upgrades; use App\Extension\UpgradeContext; +use App\Support\ExtensionStoragePath; use App\Upgrades\Data\Ext\Plugins\SirsoftPayKginicis\V1_0_0\Migrations\MigrateNaverpayBrandButtonKey; use Illuminate\Support\Facades\File; use Plugins\Sirsoft\PayKginicis\Tests\PluginTestCase; @@ -23,7 +24,7 @@ class MigrateNaverpayBrandButtonKeyTest extends PluginTestCase { parent::setUp(); - $this->settingsPath = storage_path('app/plugins/sirsoft-pay_kginicis/settings/setting.json'); + $this->settingsPath = ExtensionStoragePath::plugin('sirsoft-pay_kginicis', 'settings').'/setting.json'; $this->hadOriginalSettings = File::exists($this->settingsPath); $this->originalSettings = $this->hadOriginalSettings ? File::get($this->settingsPath) : null; diff --git a/plugins/_bundled/sirsoft-pay_kginicis/upgrades/Upgrade_1_0_0_beta_4.php b/plugins/_bundled/sirsoft-pay_kginicis/upgrades/Upgrade_1_0_0_beta_4.php index 3dd5e8f1..30f0e5b9 100644 --- a/plugins/_bundled/sirsoft-pay_kginicis/upgrades/Upgrade_1_0_0_beta_4.php +++ b/plugins/_bundled/sirsoft-pay_kginicis/upgrades/Upgrade_1_0_0_beta_4.php @@ -6,6 +6,7 @@ namespace Plugins\Sirsoft\PayKginicis\Upgrades; use App\Contracts\Extension\UpgradeStepInterface; use App\Extension\UpgradeContext; +use App\Support\ExtensionStoragePath; use Illuminate\Support\Facades\File; /** @@ -37,8 +38,6 @@ use Illuminate\Support\Facades\File; */ class Upgrade_1_0_0_beta_4 implements UpgradeStepInterface { - private const ECOMMERCE_SETTINGS_PATH = 'app/modules/sirsoft-ecommerce/settings/order_settings.json'; - private const EASY_PAY_IDS = [ 'kginicis_samsung_pay', 'kginicis_naverpay', @@ -48,7 +47,9 @@ class Upgrade_1_0_0_beta_4 implements UpgradeStepInterface public function run(UpgradeContext $context): void { - $path = storage_path(self::ECOMMERCE_SETTINGS_PATH); + // 이커머스 모듈의 주문설정 저장 경로. 절대 경로는 코어 해석기가 디스크 root 를 기준으로 + // 조립한다 — 확장마다 경로를 직접 조립하면 테스트 환경에서 운영 설정 파일을 건드린다. + $path = ExtensionStoragePath::module('sirsoft-ecommerce', 'settings').'/order_settings.json'; if (! File::exists($path)) { $context->logger->info('[v1.0.0-beta.4] 이커머스 order_settings.json 없음 — 첫 진입 시 자동 생성되므로 skip'); diff --git a/plugins/_bundled/sirsoft-pay_kginicis/upgrades/data/1.0.0/migrations/MigrateNaverpayBrandButtonKey.php b/plugins/_bundled/sirsoft-pay_kginicis/upgrades/data/1.0.0/migrations/MigrateNaverpayBrandButtonKey.php index d070f5f1..104a19e3 100644 --- a/plugins/_bundled/sirsoft-pay_kginicis/upgrades/data/1.0.0/migrations/MigrateNaverpayBrandButtonKey.php +++ b/plugins/_bundled/sirsoft-pay_kginicis/upgrades/data/1.0.0/migrations/MigrateNaverpayBrandButtonKey.php @@ -7,6 +7,7 @@ namespace App\Upgrades\Data\Ext\Plugins\SirsoftPayKginicis\V1_0_0\Migrations; use App\Extension\Helpers\FilePermissionHelper; use App\Extension\Upgrade\DataMigration; use App\Extension\UpgradeContext; +use App\Support\ExtensionStoragePath; use Illuminate\Support\Facades\File; /** @@ -20,8 +21,6 @@ use Illuminate\Support\Facades\File; */ final class MigrateNaverpayBrandButtonKey implements DataMigration { - private const SETTINGS_PATH = 'app/plugins/sirsoft-pay_kginicis/settings/setting.json'; - private const OLD_KEY = 'easy_pay_naverpay_brand_button'; private const NEW_KEY = 'easy_pay_show_brand_button'; @@ -43,7 +42,9 @@ final class MigrateNaverpayBrandButtonKey implements DataMigration */ public function run(UpgradeContext $context): void { - $path = storage_path(self::SETTINGS_PATH); + // 설정 파일 저장 경로. 절대 경로는 코어 해석기가 디스크 root 를 기준으로 조립한다 — 확장마다 + // 경로를 직접 조립하면 테스트 환경에서 운영 설정 파일을 그대로 건드리게 된다. + $path = ExtensionStoragePath::plugin('sirsoft-pay_kginicis', 'settings').'/setting.json'; if (! File::exists($path)) { $context->logger->info('[v1.0.0] KG 이니시스 설정 파일 없음 — 기본값으로 동작하므로 skip'); diff --git a/plugins/_bundled/sirsoft-pay_kginicis/upgrades/data/1.0.1/migrations/BackfillEasyPayPgProvider.php b/plugins/_bundled/sirsoft-pay_kginicis/upgrades/data/1.0.1/migrations/BackfillEasyPayPgProvider.php index 94a8e1fc..8aadda4f 100644 --- a/plugins/_bundled/sirsoft-pay_kginicis/upgrades/data/1.0.1/migrations/BackfillEasyPayPgProvider.php +++ b/plugins/_bundled/sirsoft-pay_kginicis/upgrades/data/1.0.1/migrations/BackfillEasyPayPgProvider.php @@ -7,6 +7,7 @@ namespace App\Upgrades\Data\Ext\Plugins\SirsoftPayKginicis\V1_0_1\Migrations; use App\Extension\Helpers\FilePermissionHelper; use App\Extension\Upgrade\DataMigration; use App\Extension\UpgradeContext; +use App\Support\ExtensionStoragePath; use Illuminate\Support\Facades\File; /** @@ -30,11 +31,6 @@ use Illuminate\Support\Facades\File; */ final class BackfillEasyPayPgProvider implements DataMigration { - /** - * 이커머스 모듈의 주문설정 저장 경로. - */ - private const SETTINGS_PATH = 'app/modules/sirsoft-ecommerce/settings/order_settings.json'; - /** * 이 플러그인이 등록하는 간편결제 수단의 ID 접두사. */ @@ -62,7 +58,9 @@ final class BackfillEasyPayPgProvider implements DataMigration */ public function run(UpgradeContext $context): void { - $path = storage_path(self::SETTINGS_PATH); + // 이커머스 모듈의 주문설정 저장 경로. 절대 경로는 코어 해석기가 디스크 root 를 기준으로 조립한다 — 확장마다 + // 경로를 직접 조립하면 테스트 환경에서 운영 설정 파일을 그대로 건드리게 된다. + $path = ExtensionStoragePath::module('sirsoft-ecommerce', 'settings').'/order_settings.json'; if (! File::exists($path)) { $context->logger->info('[kginicis] 이커머스 주문설정 파일 없음 — 기본값으로 동작하므로 skip'); diff --git a/plugins/_bundled/sirsoft-pay_kginicis/upgrades/data/1.1.0/migrations/BackfillShopBaseRedirectUrls.php b/plugins/_bundled/sirsoft-pay_kginicis/upgrades/data/1.1.0/migrations/BackfillShopBaseRedirectUrls.php index a4792995..7f742341 100644 --- a/plugins/_bundled/sirsoft-pay_kginicis/upgrades/data/1.1.0/migrations/BackfillShopBaseRedirectUrls.php +++ b/plugins/_bundled/sirsoft-pay_kginicis/upgrades/data/1.1.0/migrations/BackfillShopBaseRedirectUrls.php @@ -7,6 +7,7 @@ namespace App\Upgrades\Data\Ext\Plugins\SirsoftPayKginicis\V1_1_0\Migrations; use App\Extension\Helpers\FilePermissionHelper; use App\Extension\Upgrade\DataMigration; use App\Extension\UpgradeContext; +use App\Support\ExtensionStoragePath; use Illuminate\Support\Facades\File; /** @@ -34,11 +35,6 @@ use Illuminate\Support\Facades\File; */ final class BackfillShopBaseRedirectUrls implements DataMigration { - /** - * 이 플러그인의 설정 저장 경로. - */ - private const SETTINGS_PATH = 'app/plugins/sirsoft-pay_kginicis/settings/setting.json'; - /** * 예전 기본값 => 새 기본값. 저장값이 좌변과 정확히 같을 때만 우변으로 바꾼다. * @@ -66,7 +62,9 @@ final class BackfillShopBaseRedirectUrls implements DataMigration */ public function run(UpgradeContext $context): void { - $path = storage_path(self::SETTINGS_PATH); + // 이 플러그인의 설정 저장 경로. 절대 경로는 코어 해석기가 디스크 root 를 기준으로 조립한다 — 확장마다 + // 경로를 직접 조립하면 테스트 환경에서 운영 설정 파일을 그대로 건드리게 된다. + $path = ExtensionStoragePath::plugin('sirsoft-pay_kginicis', 'settings').'/setting.json'; if (! File::exists($path)) { $context->logger->info('[kginicis] 설정 파일 없음 — 새 기본값으로 동작하므로 skip'); diff --git a/plugins/_bundled/sirsoft-pay_nhnkcp/CHANGELOG.md b/plugins/_bundled/sirsoft-pay_nhnkcp/CHANGELOG.md index 071e7f59..d4b3c23d 100644 --- a/plugins/_bundled/sirsoft-pay_nhnkcp/CHANGELOG.md +++ b/plugins/_bundled/sirsoft-pay_nhnkcp/CHANGELOG.md @@ -11,6 +11,10 @@ - 관리자 주문 조회·에스크로 배송등록 API가 세부 권한을 검사하도록 수정했습니다. 이전에는 관리자 계정이면 주문 권한이 없어도 주문번호·결제정보·수령인 연락처와 주소를 조회하고 배송등록까지 할 수 있었습니다. 이제 조회는 주문 조회 권한, 배송등록은 주문 수정 권한이 필요하며, 다른 결제대행사 연동과 같은 기준이 적용됩니다. (KISA 측에서 제보해주셨습니다 — KVE-2026-1893) - 가상계좌 입금통보 주소 조회와 시스템 점검 API에도 설정 조회 권한 검사를 추가했습니다. +### Changed + +- 코어 최소 요구 버전을 7.0.10 으로 상향 + ## [1.0.2] - 2026-08-19 ### Security diff --git a/plugins/_bundled/sirsoft-pay_nhnkcp/plugin.json b/plugins/_bundled/sirsoft-pay_nhnkcp/plugin.json index 5d5688d1..2fe05e96 100644 --- a/plugins/_bundled/sirsoft-pay_nhnkcp/plugin.json +++ b/plugins/_bundled/sirsoft-pay_nhnkcp/plugin.json @@ -13,7 +13,7 @@ "ko": "NHN KCP 결제 게이트웨이 (Standard Pay 연동)", "en": "NHN KCP payment gateway (Standard Pay integration)" }, - "g7_version": ">=7.0.5", + "g7_version": ">=7.0.10", "dependencies": { "modules": { "sirsoft-ecommerce": ">=1.1.0" diff --git a/plugins/_bundled/sirsoft-pay_nhnkcp/src/Listeners/RegisterPgProviderListener.php b/plugins/_bundled/sirsoft-pay_nhnkcp/src/Listeners/RegisterPgProviderListener.php index a885c0e2..f072ffa8 100644 --- a/plugins/_bundled/sirsoft-pay_nhnkcp/src/Listeners/RegisterPgProviderListener.php +++ b/plugins/_bundled/sirsoft-pay_nhnkcp/src/Listeners/RegisterPgProviderListener.php @@ -5,6 +5,7 @@ declare(strict_types=1); namespace Plugins\Sirsoft\PayNhnkcp\Listeners; use App\Contracts\Extension\HookListenerInterface; +use App\Support\ExtensionStoragePath; class RegisterPgProviderListener implements HookListenerInterface { @@ -139,7 +140,7 @@ class RegisterPgProviderListener implements HookListenerInterface private function isNhnKcpDefaultPg(): bool { - $path = storage_path('app/modules/sirsoft-ecommerce/settings/order_settings.json'); + $path = ExtensionStoragePath::module('sirsoft-ecommerce', 'settings').'/order_settings.json'; if (! file_exists($path)) { return false; diff --git a/plugins/_bundled/sirsoft-pay_nhnkcp/tests/Unit/Upgrades/BackfillEasyPayPgProviderTest.php b/plugins/_bundled/sirsoft-pay_nhnkcp/tests/Unit/Upgrades/BackfillEasyPayPgProviderTest.php index 4f6887c4..05140708 100644 --- a/plugins/_bundled/sirsoft-pay_nhnkcp/tests/Unit/Upgrades/BackfillEasyPayPgProviderTest.php +++ b/plugins/_bundled/sirsoft-pay_nhnkcp/tests/Unit/Upgrades/BackfillEasyPayPgProviderTest.php @@ -5,9 +5,10 @@ declare(strict_types=1); namespace Plugins\Sirsoft\PayNhnkcp\Tests\Unit\Upgrades; use App\Extension\UpgradeContext; +use App\Support\ExtensionStoragePath; use App\Upgrades\Data\Ext\Plugins\SirsoftPayNhnkcp\V1_0_0_beta_4\Migrations\BackfillEasyPayPgProvider; use Illuminate\Support\Facades\File; -use Tests\TestCase; +use Plugins\Sirsoft\PayNhnkcp\Tests\PluginTestCase; require_once dirname(__DIR__, 3).'/upgrades/data/1.0.0-beta.4/migrations/BackfillEasyPayPgProvider.php'; @@ -18,7 +19,7 @@ require_once dirname(__DIR__, 3).'/upgrades/data/1.0.0-beta.4/migrations/Backfil * 있다. 서버가 이 값을 보고 간편결제 주문을 "PG 결제가 아닌 주문" 으로 오인해 결제 실패 * 시 관리자 알림 오발송 + 임시주문 삭제(재결제 불가) 를 일으켰다. */ -class BackfillEasyPayPgProviderTest extends TestCase +class BackfillEasyPayPgProviderTest extends PluginTestCase { private string $settingsPath; @@ -30,7 +31,7 @@ class BackfillEasyPayPgProviderTest extends TestCase { parent::setUp(); - $this->settingsPath = storage_path('app/modules/sirsoft-ecommerce/settings/order_settings.json'); + $this->settingsPath = ExtensionStoragePath::module('sirsoft-ecommerce', 'settings').'/order_settings.json'; $this->hadOriginalSettings = File::exists($this->settingsPath); $this->originalSettings = $this->hadOriginalSettings ? File::get($this->settingsPath) : null; diff --git a/plugins/_bundled/sirsoft-pay_nhnkcp/upgrades/data/1.0.0-beta.4/migrations/BackfillEasyPayPgProvider.php b/plugins/_bundled/sirsoft-pay_nhnkcp/upgrades/data/1.0.0-beta.4/migrations/BackfillEasyPayPgProvider.php index d53266ec..3f80c603 100644 --- a/plugins/_bundled/sirsoft-pay_nhnkcp/upgrades/data/1.0.0-beta.4/migrations/BackfillEasyPayPgProvider.php +++ b/plugins/_bundled/sirsoft-pay_nhnkcp/upgrades/data/1.0.0-beta.4/migrations/BackfillEasyPayPgProvider.php @@ -7,6 +7,7 @@ namespace App\Upgrades\Data\Ext\Plugins\SirsoftPayNhnkcp\V1_0_0_beta_4\Migration use App\Extension\Helpers\FilePermissionHelper; use App\Extension\Upgrade\DataMigration; use App\Extension\UpgradeContext; +use App\Support\ExtensionStoragePath; use Illuminate\Support\Facades\File; /** @@ -30,11 +31,6 @@ use Illuminate\Support\Facades\File; */ final class BackfillEasyPayPgProvider implements DataMigration { - /** - * 이커머스 모듈의 주문설정 저장 경로. - */ - private const SETTINGS_PATH = 'app/modules/sirsoft-ecommerce/settings/order_settings.json'; - /** * 이 플러그인이 등록하는 간편결제 수단의 ID 접두사. */ @@ -62,7 +58,9 @@ final class BackfillEasyPayPgProvider implements DataMigration */ public function run(UpgradeContext $context): void { - $path = storage_path(self::SETTINGS_PATH); + // 이커머스 모듈의 주문설정 저장 경로. 절대 경로는 코어 해석기가 디스크 root 를 기준으로 조립한다 — 확장마다 + // 경로를 직접 조립하면 테스트 환경에서 운영 설정 파일을 그대로 건드리게 된다. + $path = ExtensionStoragePath::module('sirsoft-ecommerce', 'settings').'/order_settings.json'; if (! File::exists($path)) { $context->logger->info('[nhnkcp] 이커머스 주문설정 파일 없음 — 기본값으로 동작하므로 skip'); diff --git a/plugins/_bundled/sirsoft-pay_nhnkcp/upgrades/data/1.0.1/migrations/BackfillShopBaseRedirectUrls.php b/plugins/_bundled/sirsoft-pay_nhnkcp/upgrades/data/1.0.1/migrations/BackfillShopBaseRedirectUrls.php index 5c9df543..853db118 100644 --- a/plugins/_bundled/sirsoft-pay_nhnkcp/upgrades/data/1.0.1/migrations/BackfillShopBaseRedirectUrls.php +++ b/plugins/_bundled/sirsoft-pay_nhnkcp/upgrades/data/1.0.1/migrations/BackfillShopBaseRedirectUrls.php @@ -7,6 +7,7 @@ namespace App\Upgrades\Data\Ext\Plugins\SirsoftPayNhnkcp\V1_0_1\Migrations; use App\Extension\Helpers\FilePermissionHelper; use App\Extension\Upgrade\DataMigration; use App\Extension\UpgradeContext; +use App\Support\ExtensionStoragePath; use Illuminate\Support\Facades\File; /** @@ -34,11 +35,6 @@ use Illuminate\Support\Facades\File; */ final class BackfillShopBaseRedirectUrls implements DataMigration { - /** - * 이 플러그인의 설정 저장 경로. - */ - private const SETTINGS_PATH = 'app/plugins/sirsoft-pay_nhnkcp/settings/setting.json'; - /** * 예전 기본값 => 새 기본값. 저장값이 좌변과 정확히 같을 때만 우변으로 바꾼다. * @@ -66,7 +62,9 @@ final class BackfillShopBaseRedirectUrls implements DataMigration */ public function run(UpgradeContext $context): void { - $path = storage_path(self::SETTINGS_PATH); + // 이 플러그인의 설정 저장 경로. 절대 경로는 코어 해석기가 디스크 root 를 기준으로 조립한다 — 확장마다 + // 경로를 직접 조립하면 테스트 환경에서 운영 설정 파일을 그대로 건드리게 된다. + $path = ExtensionStoragePath::plugin('sirsoft-pay_nhnkcp', 'settings').'/setting.json'; if (! File::exists($path)) { $context->logger->info('[nhnkcp] 설정 파일 없음 — 새 기본값으로 동작하므로 skip'); diff --git a/plugins/_bundled/sirsoft-pay_nicepayments/CHANGELOG.md b/plugins/_bundled/sirsoft-pay_nicepayments/CHANGELOG.md index 268d2890..1fce5f39 100644 --- a/plugins/_bundled/sirsoft-pay_nicepayments/CHANGELOG.md +++ b/plugins/_bundled/sirsoft-pay_nicepayments/CHANGELOG.md @@ -11,6 +11,7 @@ - 가상계좌 환불·에스크로 배송등록·결제 서명 요청의 입력값에 형식·길이 검증을 추가했습니다. 잘못된 형식의 환불 계좌 정보(계좌번호·은행코드·예금주)는 PG 호출 전에 차단됩니다. ### Changed +- 코어 최소 요구 버전을 7.0.10 으로 상향 - 결제 서명(SignData) 요청의 필수값 누락 응답이 표준 검증 응답(422)으로 통일되었습니다. - 주문·결제 정보 조회가 데이터베이스 표 이름을 직접 쓰지 않고 쇼핑몰 모듈의 정의를 따르도록 내부 정리했습니다. 표시되는 내용과 동작은 종전과 동일합니다. diff --git a/plugins/_bundled/sirsoft-pay_nicepayments/plugin.json b/plugins/_bundled/sirsoft-pay_nicepayments/plugin.json index e8ac9da2..7cac67bd 100644 --- a/plugins/_bundled/sirsoft-pay_nicepayments/plugin.json +++ b/plugins/_bundled/sirsoft-pay_nicepayments/plugin.json @@ -13,7 +13,7 @@ "ko": "나이스페이먼츠 결제 게이트웨이 (통합결제창 연동)", "en": "NicePayments gateway (integrated payment window)" }, - "g7_version": ">=7.0.5", + "g7_version": ">=7.0.10", "dependencies": { "modules": { "sirsoft-ecommerce": ">=1.1.0" diff --git a/plugins/_bundled/sirsoft-pay_nicepayments/src/Listeners/RegisterPgProviderListener.php b/plugins/_bundled/sirsoft-pay_nicepayments/src/Listeners/RegisterPgProviderListener.php index c0d236fd..6aaa56c2 100644 --- a/plugins/_bundled/sirsoft-pay_nicepayments/src/Listeners/RegisterPgProviderListener.php +++ b/plugins/_bundled/sirsoft-pay_nicepayments/src/Listeners/RegisterPgProviderListener.php @@ -5,6 +5,7 @@ declare(strict_types=1); namespace Plugins\Sirsoft\PayNicepayments\Listeners; use App\Contracts\Extension\HookListenerInterface; +use App\Support\ExtensionStoragePath; class RegisterPgProviderListener implements HookListenerInterface { @@ -109,7 +110,7 @@ class RegisterPgProviderListener implements HookListenerInterface private function isNicepayDefaultPg(): bool { - $path = storage_path('app/modules/sirsoft-ecommerce/settings/order_settings.json'); + $path = ExtensionStoragePath::module('sirsoft-ecommerce', 'settings').'/order_settings.json'; if (! file_exists($path)) { return false; diff --git a/plugins/_bundled/sirsoft-pay_nicepayments/tests/Unit/Upgrades/BackfillEasyPayPgProviderTest.php b/plugins/_bundled/sirsoft-pay_nicepayments/tests/Unit/Upgrades/BackfillEasyPayPgProviderTest.php index 92ec1ab8..2a9dac20 100644 --- a/plugins/_bundled/sirsoft-pay_nicepayments/tests/Unit/Upgrades/BackfillEasyPayPgProviderTest.php +++ b/plugins/_bundled/sirsoft-pay_nicepayments/tests/Unit/Upgrades/BackfillEasyPayPgProviderTest.php @@ -5,9 +5,10 @@ declare(strict_types=1); namespace Plugins\Sirsoft\PayNicepayments\Tests\Unit\Upgrades; use App\Extension\UpgradeContext; +use App\Support\ExtensionStoragePath; use App\Upgrades\Data\Ext\Plugins\SirsoftPayNicepayments\V1_0_0_beta_4\Migrations\BackfillEasyPayPgProvider; use Illuminate\Support\Facades\File; -use Tests\TestCase; +use Plugins\Sirsoft\PayNicepayments\Tests\PluginTestCase; require_once dirname(__DIR__, 3).'/upgrades/data/1.0.0-beta.4/migrations/BackfillEasyPayPgProvider.php'; @@ -18,7 +19,7 @@ require_once dirname(__DIR__, 3).'/upgrades/data/1.0.0-beta.4/migrations/Backfil * 있다. 서버가 이 값을 보고 간편결제 주문을 "PG 결제가 아닌 주문" 으로 오인해 결제 실패 * 시 관리자 알림 오발송 + 임시주문 삭제(재결제 불가) 를 일으켰다. */ -class BackfillEasyPayPgProviderTest extends TestCase +class BackfillEasyPayPgProviderTest extends PluginTestCase { private string $settingsPath; @@ -30,7 +31,7 @@ class BackfillEasyPayPgProviderTest extends TestCase { parent::setUp(); - $this->settingsPath = storage_path('app/modules/sirsoft-ecommerce/settings/order_settings.json'); + $this->settingsPath = ExtensionStoragePath::module('sirsoft-ecommerce', 'settings').'/order_settings.json'; $this->hadOriginalSettings = File::exists($this->settingsPath); $this->originalSettings = $this->hadOriginalSettings ? File::get($this->settingsPath) : null; diff --git a/plugins/_bundled/sirsoft-pay_nicepayments/upgrades/data/1.0.0-beta.4/migrations/BackfillEasyPayPgProvider.php b/plugins/_bundled/sirsoft-pay_nicepayments/upgrades/data/1.0.0-beta.4/migrations/BackfillEasyPayPgProvider.php index 9aec7309..64d59eea 100644 --- a/plugins/_bundled/sirsoft-pay_nicepayments/upgrades/data/1.0.0-beta.4/migrations/BackfillEasyPayPgProvider.php +++ b/plugins/_bundled/sirsoft-pay_nicepayments/upgrades/data/1.0.0-beta.4/migrations/BackfillEasyPayPgProvider.php @@ -7,6 +7,7 @@ namespace App\Upgrades\Data\Ext\Plugins\SirsoftPayNicepayments\V1_0_0_beta_4\Mig use App\Extension\Helpers\FilePermissionHelper; use App\Extension\Upgrade\DataMigration; use App\Extension\UpgradeContext; +use App\Support\ExtensionStoragePath; use Illuminate\Support\Facades\File; /** @@ -30,11 +31,6 @@ use Illuminate\Support\Facades\File; */ final class BackfillEasyPayPgProvider implements DataMigration { - /** - * 이커머스 모듈의 주문설정 저장 경로. - */ - private const SETTINGS_PATH = 'app/modules/sirsoft-ecommerce/settings/order_settings.json'; - /** * 이 플러그인이 등록하는 간편결제 수단의 ID 접두사. */ @@ -62,7 +58,9 @@ final class BackfillEasyPayPgProvider implements DataMigration */ public function run(UpgradeContext $context): void { - $path = storage_path(self::SETTINGS_PATH); + // 이커머스 모듈의 주문설정 저장 경로. 절대 경로는 코어 해석기가 디스크 root 를 기준으로 조립한다 — 확장마다 + // 경로를 직접 조립하면 테스트 환경에서 운영 설정 파일을 그대로 건드리게 된다. + $path = ExtensionStoragePath::module('sirsoft-ecommerce', 'settings').'/order_settings.json'; if (! File::exists($path)) { $context->logger->info('[nicepayments] 이커머스 주문설정 파일 없음 — 기본값으로 동작하므로 skip'); diff --git a/plugins/_bundled/sirsoft-pay_nicepayments/upgrades/data/1.0.1/migrations/BackfillShopBaseRedirectUrls.php b/plugins/_bundled/sirsoft-pay_nicepayments/upgrades/data/1.0.1/migrations/BackfillShopBaseRedirectUrls.php index cff488be..17851dcb 100644 --- a/plugins/_bundled/sirsoft-pay_nicepayments/upgrades/data/1.0.1/migrations/BackfillShopBaseRedirectUrls.php +++ b/plugins/_bundled/sirsoft-pay_nicepayments/upgrades/data/1.0.1/migrations/BackfillShopBaseRedirectUrls.php @@ -7,6 +7,7 @@ namespace App\Upgrades\Data\Ext\Plugins\SirsoftPayNicepayments\V1_0_1\Migrations use App\Extension\Helpers\FilePermissionHelper; use App\Extension\Upgrade\DataMigration; use App\Extension\UpgradeContext; +use App\Support\ExtensionStoragePath; use Illuminate\Support\Facades\File; /** @@ -34,11 +35,6 @@ use Illuminate\Support\Facades\File; */ final class BackfillShopBaseRedirectUrls implements DataMigration { - /** - * 이 플러그인의 설정 저장 경로. - */ - private const SETTINGS_PATH = 'app/plugins/sirsoft-pay_nicepayments/settings/setting.json'; - /** * 예전 기본값 => 새 기본값. 저장값이 좌변과 정확히 같을 때만 우변으로 바꾼다. * @@ -66,7 +62,9 @@ final class BackfillShopBaseRedirectUrls implements DataMigration */ public function run(UpgradeContext $context): void { - $path = storage_path(self::SETTINGS_PATH); + // 이 플러그인의 설정 저장 경로. 절대 경로는 코어 해석기가 디스크 root 를 기준으로 조립한다 — 확장마다 + // 경로를 직접 조립하면 테스트 환경에서 운영 설정 파일을 그대로 건드리게 된다. + $path = ExtensionStoragePath::plugin('sirsoft-pay_nicepayments', 'settings').'/setting.json'; if (! File::exists($path)) { $context->logger->info('[nicepayments] 설정 파일 없음 — 새 기본값으로 동작하므로 skip'); diff --git a/plugins/_bundled/sirsoft-tosspayments/CHANGELOG.md b/plugins/_bundled/sirsoft-tosspayments/CHANGELOG.md index 26893dcb..bd44dd40 100644 --- a/plugins/_bundled/sirsoft-tosspayments/CHANGELOG.md +++ b/plugins/_bundled/sirsoft-tosspayments/CHANGELOG.md @@ -12,6 +12,10 @@ - 결제 실패 시 이동하는 페이지 주소에 서버 내부 오류 원문이 그대로 실려 나가던 문제를 수정했습니다. 이제 안내 문구만 전달되며, 원인 파악에 필요한 원문은 서버 로그에만 기록됩니다. - 플러그인 설정 저장이 실패했을 때 실패 사유 대신 일반 안내 문구만 표시되던 문제를 수정했습니다. 이제 서버가 알려준 사유가 그대로 안내됩니다. +### Changed + +- 코어 최소 요구 버전을 7.0.10 으로 상향 + ## [1.0.1] - 2026-08-11 ### Fixed diff --git a/plugins/_bundled/sirsoft-tosspayments/plugin.json b/plugins/_bundled/sirsoft-tosspayments/plugin.json index 789e6b69..d3cd159b 100644 --- a/plugins/_bundled/sirsoft-tosspayments/plugin.json +++ b/plugins/_bundled/sirsoft-tosspayments/plugin.json @@ -11,7 +11,7 @@ "ko": "토스페이먼츠 결제 게이트웨이 (통합결제창 연동)", "en": "TossPayments gateway (integrated payment window)" }, - "g7_version": ">=7.0.0", + "g7_version": ">=7.0.10", "dependencies": { "modules": { "sirsoft-ecommerce": ">=1.1.0" diff --git a/plugins/_bundled/sirsoft-tosspayments/tests/Unit/Upgrade/BackfillTossPgProviderTest.php b/plugins/_bundled/sirsoft-tosspayments/tests/Unit/Upgrade/BackfillTossPgProviderTest.php index 535048dd..79755f8c 100644 --- a/plugins/_bundled/sirsoft-tosspayments/tests/Unit/Upgrade/BackfillTossPgProviderTest.php +++ b/plugins/_bundled/sirsoft-tosspayments/tests/Unit/Upgrade/BackfillTossPgProviderTest.php @@ -5,6 +5,7 @@ declare(strict_types=1); namespace Plugins\Sirsoft\Tosspayments\Tests\Unit\Upgrade; use App\Extension\UpgradeContext; +use App\Support\ExtensionStoragePath; use App\Upgrades\Data\Ext\Plugins\SirsoftTosspayments\V1_0_1\Migrations\BackfillTossPgProvider; use Illuminate\Support\Facades\File; use Plugins\Sirsoft\Tosspayments\Tests\PluginTestCase; @@ -37,7 +38,7 @@ class BackfillTossPgProviderTest extends PluginTestCase require_once base_path('plugins/_bundled/sirsoft-tosspayments/upgrades/data/1.0.1/migrations/BackfillTossPgProvider.php'); - $this->settingsPath = storage_path('app/modules/sirsoft-ecommerce/settings/order_settings.json'); + $this->settingsPath = ExtensionStoragePath::module('sirsoft-ecommerce', 'settings').'/order_settings.json'; $this->hadOriginalSettings = File::exists($this->settingsPath); $this->originalSettings = $this->hadOriginalSettings ? File::get($this->settingsPath) : null; diff --git a/plugins/_bundled/sirsoft-tosspayments/upgrades/data/1.0.0/migrations/BackfillShopBaseRedirectUrls.php b/plugins/_bundled/sirsoft-tosspayments/upgrades/data/1.0.0/migrations/BackfillShopBaseRedirectUrls.php index 39e1da3d..7a36544c 100644 --- a/plugins/_bundled/sirsoft-tosspayments/upgrades/data/1.0.0/migrations/BackfillShopBaseRedirectUrls.php +++ b/plugins/_bundled/sirsoft-tosspayments/upgrades/data/1.0.0/migrations/BackfillShopBaseRedirectUrls.php @@ -7,6 +7,7 @@ namespace App\Upgrades\Data\Ext\Plugins\SirsoftTosspayments\V1_0_0\Migrations; use App\Extension\Helpers\FilePermissionHelper; use App\Extension\Upgrade\DataMigration; use App\Extension\UpgradeContext; +use App\Support\ExtensionStoragePath; use Illuminate\Support\Facades\File; /** @@ -34,11 +35,6 @@ use Illuminate\Support\Facades\File; */ final class BackfillShopBaseRedirectUrls implements DataMigration { - /** - * 이 플러그인의 설정 저장 경로. - */ - private const SETTINGS_PATH = 'app/plugins/sirsoft-tosspayments/settings/setting.json'; - /** * 예전 기본값 => 새 기본값. 저장값이 좌변과 정확히 같을 때만 우변으로 바꾼다. * @@ -66,7 +62,9 @@ final class BackfillShopBaseRedirectUrls implements DataMigration */ public function run(UpgradeContext $context): void { - $path = storage_path(self::SETTINGS_PATH); + // 이 플러그인의 설정 저장 경로. 절대 경로는 코어 해석기가 디스크 root 를 기준으로 조립한다 — 확장마다 + // 경로를 직접 조립하면 테스트 환경에서 운영 설정 파일을 그대로 건드리게 된다. + $path = ExtensionStoragePath::plugin('sirsoft-tosspayments', 'settings').'/setting.json'; if (! File::exists($path)) { $context->logger->info('[tosspayments] 설정 파일 없음 — 새 기본값으로 동작하므로 skip'); diff --git a/plugins/_bundled/sirsoft-tosspayments/upgrades/data/1.0.1/migrations/BackfillTossPgProvider.php b/plugins/_bundled/sirsoft-tosspayments/upgrades/data/1.0.1/migrations/BackfillTossPgProvider.php index e3a2420c..26086825 100644 --- a/plugins/_bundled/sirsoft-tosspayments/upgrades/data/1.0.1/migrations/BackfillTossPgProvider.php +++ b/plugins/_bundled/sirsoft-tosspayments/upgrades/data/1.0.1/migrations/BackfillTossPgProvider.php @@ -7,6 +7,7 @@ namespace App\Upgrades\Data\Ext\Plugins\SirsoftTosspayments\V1_0_1\Migrations; use App\Extension\Helpers\FilePermissionHelper; use App\Extension\Upgrade\DataMigration; use App\Extension\UpgradeContext; +use App\Support\ExtensionStoragePath; use Illuminate\Support\Facades\File; /** @@ -29,11 +30,6 @@ use Illuminate\Support\Facades\File; */ final class BackfillTossPgProvider implements DataMigration { - /** - * 이커머스 모듈의 주문설정 저장 경로. - */ - private const SETTINGS_PATH = 'app/modules/sirsoft-ecommerce/settings/order_settings.json'; - /** * 이 플러그인이 등록하는 주문서형 결제수단의 ID 접두사. */ @@ -61,7 +57,9 @@ final class BackfillTossPgProvider implements DataMigration */ public function run(UpgradeContext $context): void { - $path = storage_path(self::SETTINGS_PATH); + // 이커머스 모듈의 주문설정 저장 경로. 절대 경로는 코어 해석기가 디스크 root 를 기준으로 조립한다 — 확장마다 + // 경로를 직접 조립하면 테스트 환경에서 운영 설정 파일을 그대로 건드리게 된다. + $path = ExtensionStoragePath::module('sirsoft-ecommerce', 'settings').'/order_settings.json'; if (! File::exists($path)) { $context->logger->info('[tosspayments] 이커머스 주문설정 파일 없음 — 기본값으로 동작하므로 skip'); diff --git a/plugins/_bundled/sirsoft-verification_kginicis/tests/PluginTestCase.php b/plugins/_bundled/sirsoft-verification_kginicis/tests/PluginTestCase.php index 1e56f27a..b88127e9 100644 --- a/plugins/_bundled/sirsoft-verification_kginicis/tests/PluginTestCase.php +++ b/plugins/_bundled/sirsoft-verification_kginicis/tests/PluginTestCase.php @@ -110,7 +110,7 @@ abstract class PluginTestCase extends TestCase * 플러그인 스토리지('plugins' 디스크)를 테스트 전용 임시 디렉토리로 격리한다. * * 설정 저장 테스트(PluginSettingsService::save)는 코어 'plugins' 디스크 - * (root = storage_path('app/plugins'))에 setting.json 을 쓴다. 격리하지 않으면 + * (root = `plugins` 디스크, config/filesystems.php)에 setting.json 을 쓴다. 격리하지 않으면 * 테스트가 실제 로컬 런타임 설정 파일을 덮어써 라이브 모드/자격증명이 오염된다 * (RefreshDatabase 는 DB 만 롤백하고 파일시스템은 되돌리지 않음). 디스크 root 를 * 임시 경로로 바꾸고 resolved 인스턴스를 purge 하여 실제 파일을 원천적으로 못 diff --git a/templates/_bundled/sirsoft-admin_basic/CHANGELOG.md b/templates/_bundled/sirsoft-admin_basic/CHANGELOG.md index e5696209..4d805338 100644 --- a/templates/_bundled/sirsoft-admin_basic/CHANGELOG.md +++ b/templates/_bundled/sirsoft-admin_basic/CHANGELOG.md @@ -13,6 +13,10 @@ - 코드 편집기를 불러오지 못하면 안내와 함께 일반 입력창으로 전환되어, 레이아웃을 계속 편집하고 저장할 수 있습니다. - 확장(템플릿·모듈·플러그인)을 제거할 때 `custom/` 에 넣어 둔 파일의 사본이 보관되며, 제거 창이 그 보관 경로를 보여 줍니다. 보관된 파일이 없으면 창은 종전대로 곧바로 닫힙니다. +### Changed + +- 관리자 화면에서 게시물·상품 등의 HTML 본문을 표시할 때 쓰는 정화 라이브러리를 최신 버전으로 고정했습니다. 종전에는 이 라이브러리를 직접 지정하지 않아 다른 구성요소가 딸려 들여온 구버전이 쓰였고, 사용자 템플릿보다 낮은 버전으로 동작했습니다. + ## [1.0.7] - 2026-08-24 ### Added diff --git a/templates/_bundled/sirsoft-admin_basic/dist/js/components.iife.js b/templates/_bundled/sirsoft-admin_basic/dist/js/components.iife.js index f66a3055..ad9a92d3 100644 --- a/templates/_bundled/sirsoft-admin_basic/dist/js/components.iife.js +++ b/templates/_bundled/sirsoft-admin_basic/dist/js/components.iife.js @@ -1,19 +1,20 @@ -var SirsoftAdminBasic=(function(R,h,v,Dn){"use strict";var GT=Object.defineProperty;var YT=(R,h,v)=>h in R?GT(R,h,{enumerable:!0,configurable:!0,writable:!0,value:v}):R[h]=v;var Pe=(R,h,v)=>YT(R,typeof h!="symbol"?h+"":h,v);var Ia,hr;function tb(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const $=tb(v),nb=()=>window.G7Core,oe=v.forwardRef(({children:e,variant:t="primary",size:n="md",className:r="",...s},o)=>{const i="button",a=nb()?.style?.mergeClasses?.(i,r)??`${i} ${r}`;return h.jsx("button",{ref:o,className:a,...s,children:e})});oe.displayName="Button";const Td=v.forwardRef(({accept:e,maxSize:t,onChange:n,onError:r,buttonText:s="Browse",placeholder:o="No file selected",className:i="",disabled:a,...l},c)=>{const d=v.useRef(null),u=c||d,[f,g]=v.useState(""),m={},p={};Object.entries(l).forEach(([x,E])=>{x.startsWith("data-editor-")||x==="id"||x==="onMouseMove"||x==="onMouseLeave"?m[x]=E:p[x]=E});const y=v.useCallback(()=>{!a&&u.current&&u.current.click()},[a,u]),b=v.useCallback(x=>{const E=x.target.files?.[0]||null;if(!E){g(""),n?.({target:{value:null,name:""}});return}if(t&&E.size>t*1024*1024){const S=`File size exceeds ${t}MB limit`;r?.(S),u.current&&(u.current.value=""),g("");return}g(E.name),n?.({target:{value:E,name:E.name}})},[t,n,r,u]),_=v.useCallback(x=>{x.stopPropagation(),u.current&&(u.current.value=""),g(""),n?.({target:{value:null,name:""}})},[n,u]);return h.jsxs("div",{className:`flex items-center gap-2 ${i}`,...m,children:[h.jsx("input",{ref:u,type:"file",accept:e,onChange:b,disabled:a,className:"hidden",...p}),h.jsx("button",{type:"button",onClick:y,disabled:a,className:"px-4 py-2 bg-gray-100 dark:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-md text-sm font-medium text-gray-700 dark:text-gray-200 hover:bg-gray-200 dark:hover:bg-gray-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:opacity-50 disabled:cursor-not-allowed",children:s}),h.jsx("span",{className:"flex-1 text-sm text-gray-600 dark:text-gray-400 truncate",children:f||o}),f&&!a&&h.jsx("button",{type:"button",onClick:_,className:"p-1 text-gray-400 hover:text-gray-600 dark:hover:text-gray-200","aria-label":"Clear file",children:h.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})});Td.displayName="FileInput";const rb=e=>e==="checkbox"?"checkbox":e==="radio"?"radio":"input",sb=(e,t)=>{const n=rb(e);return t?t.split(/\s+/).filter(Boolean).includes(n)?t:`${n} ${t}`:n},wt=v.forwardRef(({label:e,error:t,className:n="",onChange:r,onKeyPress:s,value:o,defaultValue:i,type:a="text",checked:l,defaultChecked:c,...d},u)=>{const f=a==="radio"||a==="checkbox",g=sb(a,n),m=v.useRef(!1),p=v.useRef(null);v.useImperativeHandle(u,()=>p.current);const[y,b]=v.useState(o??i??"");v.useEffect(()=>{if(!f&&!m.current&&o!==void 0){if(p.current&&document.activeElement===p.current)return;b(o)}},[o,f]);const _=v.useCallback(()=>{m.current=!0},[]),x=v.useCallback(M=>{if(m.current=!1,r){const T=M.target.value;b(T);const L=new Event("change",{bubbles:!0});Object.defineProperty(L,"target",{writable:!1,value:{value:T}}),Object.defineProperty(L,"currentTarget",{writable:!1,value:{value:T}}),r(L)}},[r]),E=v.useCallback(M=>{const T=M.target.value;b(T),!m.current&&r&&r(M)},[r]),S=v.useCallback(M=>{m.current||s&&s(M)},[s]),{loadingactions:w,formdata:N,...C}=d;if(f)return h.jsx("input",{ref:p,type:a,className:g,onChange:r,checked:l,defaultChecked:c,value:o,...C});const k=o!==void 0?{value:y}:{defaultValue:i};return h.jsx("input",{ref:p,type:a,className:g,onChange:E,onKeyPress:S,onCompositionStart:_,onCompositionEnd:x,...k,...C})});wt.displayName="Input";const Rn=({label:e,error:t,className:n="",onChange:r,value:s,defaultValue:o,...i})=>{const a=v.useRef(!1),l=v.useRef(null),[c,d]=v.useState(s??o??"");v.useEffect(()=>{!a.current&&s!==void 0&&d(s)},[s]);const u=v.useCallback(()=>{a.current=!0},[]),f=v.useCallback(E=>{if(a.current=!1,r){const S=E.target.value;d(S);const w=new Event("change",{bubbles:!0});Object.defineProperty(w,"target",{writable:!1,value:{value:S}}),Object.defineProperty(w,"currentTarget",{writable:!1,value:{value:S}}),r(w)}},[r]),g=v.useCallback(E=>{const S=E.target.value;d(S),!a.current&&r&&r(E)},[r]),{loadingactions:m,formdata:p,...y}=i,b=s!==void 0?{value:c}:{defaultValue:o},x=(n??"").split(/\s+/).filter(Boolean).includes("textarea")?n??"":["textarea",n].filter(Boolean).join(" ");return h.jsx("textarea",{ref:l,className:x,onChange:g,onCompositionStart:u,onCompositionEnd:f,...b,...y})},on=({children:e,className:t="",...n})=>h.jsx("label",{className:t,...n,children:e}),I=v.forwardRef(({children:e,className:t="",...n},r)=>h.jsx("div",{ref:r,className:t,...n,children:e})),Q=({children:e,className:t="",...n})=>h.jsx("span",{className:t,...n,children:e}),yt=({children:e,className:t="",...n})=>h.jsx("p",{className:t,...n,children:e}),kn=({className:e="",alt:t="",...n})=>h.jsx("img",{className:e,alt:t,...n}),Fa=({children:e,className:t="",...n})=>h.jsx("h1",{className:t,...n,children:e}),er=({children:e,className:t="",...n})=>h.jsx("h2",{className:t,...n,children:e}),$r=({children:e,className:t="",...n})=>h.jsx("h3",{className:t,...n,children:e}),Ad=({children:e,className:t="",...n})=>h.jsx("h4",{className:t,...n,children:e}),Va=({children:e,className:t="",...n})=>h.jsx("ul",{className:t,...n,children:e}),ob=({children:e,className:t="",...n})=>h.jsx("ol",{className:t,...n,children:e}),za=({children:e,className:t="",...n})=>h.jsx("li",{className:t,...n,children:e}),Fr=({children:e,className:t="",...n})=>h.jsx("a",{className:t,...n,children:e}),Ha=({children:e,className:t="",...n})=>h.jsx("form",{className:t,...n,children:e}),Wn=({children:e,className:t="",...n})=>h.jsx("svg",{className:t,...n,children:e}),ib=window.G7Core?.createLogger?.("Comp:Select")??{log:(...e)=>console.log("[Comp:Select]",...e),warn:(...e)=>console.warn("[Comp:Select]",...e),error:(...e)=>console.error("[Comp:Select]",...e)};function ab(e){const t=window.G7Core?.state?.get?.("_global.appConfig.localeNames")?.[e];return t||{ko:"한국어",en:"English",ja:"日本語",zh:"中文",es:"Español",fr:"Français",de:"Deutsch"}[e]||e}const Vr=({children:e,label:t,error:n,options:r,className:s="",value:o,onChange:i,disabled:a,searchable:l=!1,searchPlaceholder:c,editorAttrs:d,...u})=>{const[f,g]=v.useState(!1),[m,p]=v.useState(""),[y,b]=v.useState(null),_=v.useRef(null),x=v.useRef(null),E=v.useRef(null),S=v.useRef(null),w=v.useMemo(()=>r?Array.isArray(r)?r.length===0?[]:typeof r[0]=="string"?r.map(O=>({value:O,label:ab(O)})):r:(ib.warn("options prop is not an array:",r),null):null,[r]),N=v.useMemo(()=>w&&w.find(V=>String(V.value)===String(o))?.label||"",[w,o]),C=v.useMemo(()=>{if(!w)return null;if(!l||m.trim()==="")return w;const O=m.trim().toLowerCase();return w.filter(V=>V.label.toLowerCase().includes(O)||String(V.value).toLowerCase().includes(O))},[w,l,m]);v.useEffect(()=>{if(f&&l){p("");const O=setTimeout(()=>E.current?.focus(),0);return()=>clearTimeout(O)}f||p("")},[f,l]);const k=v.useCallback(()=>{if(!x.current)return;const O=x.current.getBoundingClientRect(),V=window.innerHeight-O.bottom,W=V<280&&O.top>V;b(W?{bottom:window.innerHeight-O.top+4,left:O.left,width:O.width}:{top:O.bottom+4,left:O.left,width:O.width})},[]);v.useEffect(()=>{if(!f){b(null);return}return k(),window.addEventListener("scroll",k,!0),window.addEventListener("resize",k),()=>{window.removeEventListener("scroll",k,!0),window.removeEventListener("resize",k)}},[f,k]),v.useEffect(()=>{const O=V=>{const H=V.target;_.current&&!_.current.contains(H)&&(!S.current||!S.current.contains(H))&&g(!1)};return f&&document.addEventListener("mousedown",O),()=>{document.removeEventListener("mousedown",O)}},[f]),v.useEffect(()=>{const O=V=>{V.key==="Escape"&&f&&(g(!1),x.current?.focus())};return document.addEventListener("keydown",O),()=>document.removeEventListener("keydown",O)},[f]);const M=()=>{a||g(!f)},T=O=>{i&&i({target:{value:O},preventDefault:()=>{},stopPropagation:()=>{},type:"change"}),g(!1),x.current?.focus()};if(!w){const V=(s??"").split(/\s+/).filter(Boolean).includes("select")?s??"":["select",s].filter(Boolean).join(" ");return h.jsx("select",{className:V,value:o,onChange:i,disabled:a,...d,...u,children:e})}const L=(s??"").split(/\s+/).filter(O=>O&&!O.includes(":")).join(" "),P=L.includes("bg-"),F=/text-(gray|red|blue|green|yellow|white|black|indigo|purple|pink|orange|amber|emerald|teal|cyan|slate)-\d+|text-white|text-black/.test(L),D=P?`${s}${F?"":" text-gray-700 dark:text-gray-200"}`:`w-full px-4 py-2.5 bg-gray-100 dark:bg-gray-700 border-0 rounded-xl text-sm text-gray-700 dark:text-gray-200 font-medium focus:ring-2 focus:ring-blue-500 focus:outline-none ${s}`,A={...d,...u};return h.jsxs(I,{ref:_,className:"relative",...A,children:[h.jsxs(oe,{ref:x,type:"button",onClick:M,disabled:a,className:`${D} flex items-center justify-between gap-2 text-left cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed`,"aria-haspopup":"listbox","aria-expanded":f,children:[h.jsx(Q,{className:"truncate",children:N||" "}),h.jsx(Wn,{className:`w-4 h-4 flex-shrink-0 transition-transform duration-200 ${f?"rotate-180":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),f&&y&&Dn.createPortal(h.jsxs(I,{ref:S,className:"fixed z-[9999] bg-white dark:bg-gray-800 rounded-2xl shadow-lg border border-gray-200 dark:border-gray-600 overflow-hidden",style:{top:y.top,bottom:y.bottom,left:y.left,width:y.width},role:"listbox",children:[l&&h.jsx(I,{className:"p-2 border-b border-gray-200 dark:border-gray-600",children:h.jsx(wt,{ref:E,type:"text",value:m,onChange:O=>p(O.target.value),placeholder:c??"Search...",className:"w-full px-3 py-2 bg-gray-100 dark:bg-gray-700 border-0 rounded-lg text-sm text-gray-700 dark:text-gray-200 placeholder-gray-400 dark:placeholder-gray-500 focus:ring-2 focus:ring-blue-500 focus:outline-none",role:"searchbox","aria-label":c??"Search"})}),h.jsxs(I,{className:"py-2 max-h-60 overflow-auto",children:[C&&C.length===0&&h.jsx(I,{className:"px-4 py-3 text-sm text-gray-500 dark:text-gray-400 text-center",children:m?"No results":""}),(C??[]).map(O=>{const V=String(O.value)===String(o);return h.jsxs(oe,{type:"button",onClick:()=>!O.disabled&&T(O.value),disabled:O.disabled,className:`w-full px-4 py-3 text-left text-sm flex items-center justify-between hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors ${V?"text-blue-600 dark:text-blue-400 font-medium":"text-gray-700 dark:text-gray-200"} ${O.disabled?"opacity-50 cursor-not-allowed":"cursor-pointer"}`,role:"option","aria-selected":V,children:[h.jsx(Q,{children:O.label}),V&&h.jsx(Wn,{className:"w-5 h-5 text-blue-600 dark:text-blue-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})]},O.value)})]})]}),document.body)]})},lb=({children:e,className:t="",...n})=>h.jsx("option",{className:t,...n,children:e}),cb=({children:e,className:t="",...n})=>h.jsx("optgroup",{className:t,...n,children:e}),Cn=v.forwardRef(({label:e,className:t="",indeterminate:n=!1,...r},s)=>{const o=v.useRef(null),i=a=>{o.current=a,typeof s=="function"?s(a):s&&(s.current=a)};return v.useEffect(()=>{o.current&&(o.current.indeterminate=n)},[n]),h.jsx("input",{ref:i,type:"checkbox",className:t,...r})});Cn.displayName="Checkbox";const Ua=({children:e,className:t="",...n})=>h.jsx("table",{className:t,...n,children:e}),Ba=({children:e,className:t="",...n})=>h.jsx("thead",{className:t,...n,children:e}),ja=({children:e,className:t="",...n})=>h.jsx("tbody",{className:t,...n,children:e}),Wa=({children:e,className:t="",...n})=>h.jsx("tfoot",{className:t,...n,children:e}),tr=({children:e,className:t="",...n})=>h.jsx("tr",{className:t,...n,children:e}),zr=({children:e,className:t="",...n})=>h.jsx("th",{className:t,...n,children:e}),Jt=({children:e,className:t="",...n})=>h.jsx("td",{className:t,...n,children:e}),Po=({children:e,className:t="",...n})=>h.jsx("nav",{className:t,...n,children:e}),Dd=({children:e,className:t="",...n})=>h.jsx("section",{className:t,...n,children:e}),re=({name:e,iconStyle:t="solid",size:n,color:r,spin:s=!1,pulse:o=!1,fixedWidth:i=!1,ariaLabel:a,className:l="",style:c,...d})=>{const u={solid:"fas",regular:"far",light:"fal",duotone:"fad",brands:"fab"},f={"fa-solid":"solid","fa-regular":"regular","fa-light":"light","fa-duotone":"duotone","fa-brands":"brands"},g=typeof e=="string"?e:String(e);let m=t,p=g;for(const[_,x]of Object.entries(f))if(g.startsWith(_+" ")){m=x,p=g.substring(_.length+1);break}p=p.replace(/^fa-/,"");const y=[u[m],`fa-${p}`,n&&`fa-${n}`,s&&"fa-spin",o&&"fa-pulse",i&&"fa-fw",r,l].filter(Boolean).join(" "),b=a||p.replace(/-/g," ");return h.jsx("i",{className:y,style:c,"aria-label":b,role:"img",...d})},db={xs:"w-3 h-3",sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6",xl:"w-8 h-8"},Id={xs:"xs",sm:"sm",md:void 0,lg:"lg",xl:"2x"},ub=({icon:e,size:t="md",className:n="",color:r,ariaLabel:s})=>{const o=e.indexOf(":"),i=e.startsWith("fa-")||e.startsWith("fas ")||e.startsWith("far ")||e.startsWith("fab ")||e.startsWith("fal ")||e.startsWith("fad ");let a,l;i?(a="fa",l=e):o>0?(a=e.substring(0,o),l=e.substring(o+1)):(a="fa",l=e);const c=db[t],d=r||"";switch(a){case"fa":return h.jsx(re,{name:l,size:Id[t],className:n,color:r,ariaLabel:s});case"svg":return h.jsx("img",{src:l,className:`${c} ${d} ${n}`.trim(),alt:s||"","aria-label":s,role:"img"});case"img":return h.jsx("img",{src:l,className:`${c} ${n}`.trim(),alt:s||"",role:"img"});default:return h.jsx(re,{name:e,size:Id[t],className:n,color:r,ariaLabel:s})}},fb=({children:e,className:t="",...n})=>h.jsx("code",{className:t,...n,children:e}),hb=({children:e,className:t="",...n})=>h.jsx("pre",{className:t,...n,children:e}),gb=({children:e})=>h.jsx(h.Fragment,{children:e}),pb=({className:e="",...t})=>h.jsx("hr",{className:e,...t}),gt=({className:e="",children:t,style:n,...r})=>h.jsx("i",{className:e,style:n,...r,children:t});var de=(e=>(e.User="fa-user",e.Users="fa-users",e.UserCircle="fa-user-circle",e.UserPlus="fa-user-plus",e.UserMinus="fa-user-minus",e.UserShield="fa-user-shield",e.Search="fa-search",e.Edit="fa-edit",e.Pencil="fa-pencil-alt",e.Trash="fa-trash",e.Save="fa-save",e.Plus="fa-plus",e.Minus="fa-minus",e.Check="fa-check",e.Times="fa-times",e.Download="fa-download",e.Upload="fa-upload",e.Copy="fa-copy",e.ExternalLink="fa-external-link-alt",e.Home="fa-home",e.CaretRight="fa-caret-right",e.CaretDown="fa-caret-down",e.ChevronLeft="fa-chevron-left",e.ChevronRight="fa-chevron-right",e.ChevronUp="fa-chevron-up",e.ChevronDown="fa-chevron-down",e.AngleLeft="fa-angle-left",e.AngleRight="fa-angle-right",e.AngleUp="fa-angle-up",e.AngleDown="fa-angle-down",e.ArrowUp="fa-arrow-up",e.ArrowDown="fa-arrow-down",e.ArrowLeft="fa-arrow-left",e.ArrowRight="fa-arrow-right",e.Bars="fa-bars",e.EllipsisVertical="fa-ellipsis-v",e.EllipsisHorizontal="fa-ellipsis-h",e.CheckCircle="fa-check-circle",e.TimesCircle="fa-times-circle",e.ExclamationCircle="fa-exclamation-circle",e.ExclamationTriangle="fa-exclamation-triangle",e.InfoCircle="fa-info-circle",e.QuestionCircle="fa-question-circle",e.XCircle="fa-times-circle",e.ShoppingCart="fa-shopping-cart",e.ShoppingBag="fa-shopping-bag",e.CreditCard="fa-credit-card",e.Tag="fa-tag",e.Tags="fa-tags",e.File="fa-file",e.FileAlt="fa-file-alt",e.Folder="fa-folder",e.FolderOpen="fa-folder-open",e.Envelope="fa-envelope",e.Phone="fa-phone",e.Comment="fa-comment",e.Comments="fa-comments",e.Cog="fa-cog",e.Cogs="fa-cogs",e.Settings="fa-cog",e.Wrench="fa-wrench",e.Sliders="fa-sliders-h",e.Image="fa-image",e.Images="fa-images",e.Video="fa-video",e.Camera="fa-camera",e.Heart="fa-heart",e.Star="fa-star",e.ThumbsUp="fa-thumbs-up",e.ThumbsDown="fa-thumbs-down",e.Share="fa-share",e.Clock="fa-clock",e.Calendar="fa-calendar",e.CalendarAlt="fa-calendar-alt",e.Lock="fa-lock",e.Unlock="fa-unlock",e.Eye="fa-eye",e.EyeSlash="fa-eye-slash",e.Bell="fa-bell",e.Flag="fa-flag",e.Map="fa-map",e.MapMarker="fa-map-marker-alt",e.Globe="fa-globe",e.Link="fa-link",e.Unlink="fa-unlink",e.Sun="fa-sun",e.Moon="fa-moon",e.ChartBar="fa-chart-bar",e.ChartLine="fa-chart-line",e.ChartPie="fa-chart-pie",e.ChartArea="fa-chart-area",e.Spinner="fa-spinner",e.CircleNotch="fa-circle-notch",e.CheckBadge="fa-badge-check",e.Cube="fa-cube",e.Cubes="fa-cubes",e.Plug="fa-plug",e.PuzzlePiece="fa-puzzle-piece",e.Palette="fa-palette",e))(de||{});const mb=({title:e,content:t,imageUrl:n,imageAlt:r="",className:s="",onClick:o,style:i,id:a,editorAttrs:l})=>h.jsxs(I,{className:`card-clickable ${s}`,onClick:o,style:i,id:a,...l,children:[n&&h.jsx(I,{className:"w-full",children:h.jsx(kn,{src:n,alt:r,className:"card-image"})}),h.jsxs(I,{className:"p-4",children:[e&&h.jsx(er,{className:"card-title",children:e}),t&&h.jsx(yt,{className:"card-content",children:t})]})]}),Cs=({items:e,triggerLabel:t="작업",triggerIconName:n=de.EllipsisVertical,position:r="right",className:s="",style:o,children:i,onItemClick:a,id:l,editorAttrs:c})=>{const[d,u]=v.useState(!1),[f,g]=v.useState({top:0,left:0}),m=v.useRef(null),p=v.useRef(null),y=v.useCallback(()=>{if(!m.current)return;const x=m.current.getBoundingClientRect(),E=224;let S=r==="right"?x.right-E:x.left;const w=x.bottom+8;S<8&&(S=8),S+E>window.innerWidth-8&&(S=window.innerWidth-E-8),g({top:w,left:S})},[r]);v.useEffect(()=>{d&&y()},[d,y]),v.useEffect(()=>{if(!d)return;const x=()=>{u(!1)};return window.addEventListener("scroll",x,!0),window.addEventListener("resize",x),()=>{window.removeEventListener("scroll",x,!0),window.removeEventListener("resize",x)}},[d]),v.useEffect(()=>{const x=E=>{const S=E.target,w=m.current?.contains(S),N=p.current?.contains(S);!w&&!N&&u(!1)};return d&&document.addEventListener("mousedown",x),()=>{document.removeEventListener("mousedown",x)}},[d]);const b=x=>{x.disabled||(x.onClick&&x.onClick(),a&&a(x.id,x),u(!1))},_=d?Dn.createPortal(h.jsx("div",{ref:p,className:"fixed z-[9999] w-56 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg overflow-hidden",style:{top:f.top,left:f.left},children:e.filter(x=>x.if!==!1).map(x=>{if(x.divider)return h.jsx("div",{className:"border-t border-gray-200 dark:border-gray-600 my-1"},x.id);const E=x.variant==="danger"?"text-red-600 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/20":"text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-700",S=x.disabled?"opacity-50 cursor-not-allowed":"cursor-pointer";return h.jsxs("div",{onClick:()=>b(x),className:`flex items-center gap-3 px-4 py-3 transition-colors ${E} ${S}`,children:[x.iconName&&h.jsx(re,{name:x.iconName,className:"w-4 h-4"}),h.jsx("span",{className:"text-sm font-medium",children:x.label})]},x.id)})}),document.body):null;return h.jsxs(I,{className:`relative inline-block ${s}`,style:o,id:l,...c,children:[i?h.jsx(I,{ref:m,onClick:()=>u(!d),className:"cursor-pointer",children:i}):h.jsxs(oe,{ref:m,onClick:()=>u(!d),className:"flex items-center gap-2 px-2 py-1 bg-transparent hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:[t&&h.jsx(Q,{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:t}),n&&h.jsx(re,{name:n,className:"w-4 h-4 text-gray-500 dark:text-gray-400"})]}),_]})},Hr=(e,t)=>window.G7Core?.t?.(e,t)??e,$o=({currentPage:e,totalPages:t,onPageChange:n,maxVisiblePages:r=5,showFirstLast:s=!0,showFirst:o,showLast:i,hasMorePages:a,className:l="",style:c,prevText:d,nextText:u,id:f,editorAttrs:g})=>{const m=t!=null,p=m?t:0,y=m?e{const N=[];if(!m)return N;if(p<=r+2)for(let C=1;C<=p;C++)N.push(C);else{const C=Math.floor(r/2);let k=Math.max(2,e-C),M=Math.min(p-1,e+C);e<=C+1?M=r:e>=p-C&&(k=p-r+1),N.push(1),k>2&&N.push("...");for(let T=k;T<=M;T++)N.push(T);M1&&N.push(p)}return N},[e,p,m,r]),E=N=>{N<1||N===e||m&&N>p||n(N)},S=()=>{e>1&&n(e-1)},w=()=>{y&&n(e+1)};return h.jsxs(I,{className:`pagination ${l}`,style:c,role:"navigation","aria-label":Hr("common.pagination"),id:f,...g,children:[b&&h.jsx(oe,{onClick:()=>E(1),disabled:e===1,className:"pagination-btn","aria-label":Hr("common.first_page"),children:"«"}),h.jsx(oe,{onClick:S,disabled:e===1,className:"pagination-btn","aria-label":Hr("common.prev_page"),children:d||h.jsx(h.Fragment,{children:"‹"})}),h.jsxs(I,{className:"pagination",children:[!m&&h.jsx(Q,{className:"px-3 py-1 text-sm text-gray-700 dark:text-gray-300",children:e}),x.map((N,C)=>{if(N==="...")return h.jsx(Q,{className:"pagination-ellipsis",children:"..."},`ellipsis-${C}`);const k=N,M=k===e;return h.jsx(oe,{onClick:()=>E(k),className:M?"pagination-btn-active":"pagination-btn","aria-label":Hr("common.page_n",{n:k}),"aria-current":M?"page":void 0,children:k},k)})]}),h.jsx(oe,{onClick:w,disabled:!y,className:"pagination-btn","aria-label":Hr("common.next_page"),children:u||h.jsx(h.Fragment,{children:"›"})}),_&&h.jsx(oe,{onClick:()=>E(p),disabled:e===p,className:"pagination-btn","aria-label":Hr("common.last_page"),children:"»"})]})},Ld=(e,t)=>window.G7Core?.t?.(e,t)??e,bb=()=>window.G7Core?.locale?.supported?.()??["ko","en"],yb=()=>window.G7Core?.locale?.current?.()??"ko",Pd=e=>{const t=Ld(`common.language_${e}`);return t===`common.language_${e}`?{ko:"한국어",en:"English",ja:"日本語",zh:"中文"}[e]||e.toUpperCase():t},vb=()=>bb().map(t=>({code:t,name:Pd(t),nativeName:Pd(t)})),Ga=({value:e={},onChange:t,inputType:n="text",layout:r="inline",availableLocales:s,defaultLocale:o,placeholder:i="",required:a=!1,disabled:l=!1,maxLength:c,rows:d=4,className:u="",name:f="multilingual_input",showCodeOnMobile:g=!1,error:m,id:p,editorAttrs:y})=>{const b=!!m,_=v.useMemo(()=>s??vb(),[s]),x=v.useMemo(()=>o??yb(),[o]),E=v.useRef(e),[S,w]=v.useState(e),N=v.useRef(JSON.stringify(e));v.useEffect(()=>{const Y=JSON.stringify(e);Y!==N.current&&(N.current=Y,E.current=e,w(e))},[e]);const C=v.useCallback((Y,Z)=>{const ee={target:{name:f,value:Y}};Z&&(ee._changedKeys=Z),t?.(ee)},[t,f]),[k,M]=v.useState(()=>{if(r==="tabs"||r==="compact"){const ee=_.map(ce=>ce.code);return[x,...ee.filter(ce=>ce!==x)]}const Y=Object.keys(e).filter(ee=>e[ee]!==void 0);if(Y.length===0)return[x];const Z=[];return Y.includes(x)&&Z.push(x),Y.forEach(ee=>{ee!==x&&Z.push(ee)}),Z}),[T,L]=v.useState(x),P=v.useMemo(()=>_.filter(Y=>!k.includes(Y.code)),[_,k]),[F,D]=v.useState(!1);v.useEffect(()=>{if(r==="tabs"||r==="compact"){const ce=_.map(ae=>ae.code),J=[x,...ce.filter(ae=>ae!==x)],he=k.join(","),le=J.join(",");he!==le&&M(J);return}const Y=Object.keys(e).filter(ce=>e[ce]!==void 0);if(Y.length===0){M([x]);return}const Z=[];Y.includes(x)&&Z.push(x),Y.forEach(ce=>{ce!==x&&Z.push(ce)});const ee=k.join(","),te=Z.join(",");ee!==te&&M(Z)},[e,x,r,_]);const A=v.useCallback((Y,Z)=>{const ee={...E.current,[Y]:Z};E.current=ee,w(ee),C(ee,[Y])},[C]),O=v.useCallback(Y=>{M(ee=>[...ee,Y]),L(Y),D(!1);const Z={...E.current,[Y]:""};E.current=Z,w(Z),C(Z)},[C]),V=v.useCallback(Y=>{if(Y===x)return;M(ee=>ee.filter(te=>te!==Y)),T===Y&&L(x);const Z={...E.current};delete Z[Y],E.current=Z,w(Z),C(Z)},[T,x,C]),H=v.useCallback(Y=>{const Z=_.find(ee=>ee.code===Y);return Z?.nativeName||Z?.name||Y.toUpperCase()},[_]),W=v.useCallback(Y=>!!S[Y]?.trim(),[S]),j=v.useCallback(()=>P.length===0?null:h.jsxs(I,{className:"relative",children:[h.jsxs(oe,{type:"button",className:"inline-flex items-center gap-1 px-3 py-1 text-xs font-medium text-blue-600 dark:text-blue-400 bg-blue-50 dark:bg-blue-900/30 hover:bg-blue-100 dark:hover:bg-blue-900/50 rounded-full border border-dashed border-blue-300 dark:border-blue-600 transition-colors",onClick:()=>D(!F),disabled:l,children:[h.jsx(re,{name:"plus",className:"w-3 h-3"}),h.jsx(Q,{children:Ld("common.add_language")})]}),F&&h.jsx(I,{className:"absolute top-full left-0 mt-1 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg z-10 min-w-[120px]",children:P.map(Y=>h.jsxs(oe,{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 first:rounded-t-lg last:rounded-b-lg transition-colors",onClick:()=>O(Y.code),children:[h.jsx(re,{name:"globe",className:"w-3.5 h-3.5 text-gray-400 dark:text-gray-500"}),h.jsx(Q,{children:Y.nativeName||Y.name})]},Y.code))})]}),[P,F,l,O]),U=v.useCallback((Y,Z=!1)=>{const ee=b?"input input-error":"input",te=b?"textarea input-error":"textarea",ce=Y===x,J=`${i}${i?" (":""}${H(Y)}${i?")":""}`;return h.jsxs(I,{className:"space-y-2",children:[h.jsxs(I,{className:"flex items-center gap-2",children:[h.jsxs(Q,{className:` +var SirsoftAdminBasic=(function(R,h,v,Vn){"use strict";var RA=Object.defineProperty;var eD=(R,h,v)=>h in R?RA(R,h,{enumerable:!0,configurable:!0,writable:!0,value:v}):R[h]=v;var $e=(R,h,v)=>eD(R,typeof h!="symbol"?h+"":h,v);var Xa,Cr;function jb(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const $=jb(v),Wb=()=>window.G7Core,le=v.forwardRef(({children:e,variant:t="primary",size:n="md",className:r="",...s},o)=>{const i="button",a=Wb()?.style?.mergeClasses?.(i,r)??`${i} ${r}`;return h.jsx("button",{ref:o,className:a,...s,children:e})});le.displayName="Button";const su=v.forwardRef(({accept:e,maxSize:t,onChange:n,onError:r,buttonText:s="Browse",placeholder:o="No file selected",className:i="",disabled:a,...l},c)=>{const d=v.useRef(null),u=c||d,[f,g]=v.useState(""),m={},p={};Object.entries(l).forEach(([x,M])=>{x.startsWith("data-editor-")||x==="id"||x==="onMouseMove"||x==="onMouseLeave"?m[x]=M:p[x]=M});const y=v.useCallback(()=>{!a&&u.current&&u.current.click()},[a,u]),b=v.useCallback(x=>{const M=x.target.files?.[0]||null;if(!M){g(""),n?.({target:{value:null,name:""}});return}if(t&&M.size>t*1024*1024){const S=`File size exceeds ${t}MB limit`;r?.(S),u.current&&(u.current.value=""),g("");return}g(M.name),n?.({target:{value:M,name:M.name}})},[t,n,r,u]),_=v.useCallback(x=>{x.stopPropagation(),u.current&&(u.current.value=""),g(""),n?.({target:{value:null,name:""}})},[n,u]);return h.jsxs("div",{className:`flex items-center gap-2 ${i}`,...m,children:[h.jsx("input",{ref:u,type:"file",accept:e,onChange:b,disabled:a,className:"hidden",...p}),h.jsx("button",{type:"button",onClick:y,disabled:a,className:"px-4 py-2 bg-gray-100 dark:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-md text-sm font-medium text-gray-700 dark:text-gray-200 hover:bg-gray-200 dark:hover:bg-gray-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:opacity-50 disabled:cursor-not-allowed",children:s}),h.jsx("span",{className:"flex-1 text-sm text-gray-600 dark:text-gray-400 truncate",children:f||o}),f&&!a&&h.jsx("button",{type:"button",onClick:_,className:"p-1 text-gray-400 hover:text-gray-600 dark:hover:text-gray-200","aria-label":"Clear file",children:h.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})});su.displayName="FileInput";const Gb=e=>e==="checkbox"?"checkbox":e==="radio"?"radio":"input",Yb=(e,t)=>{const n=Gb(e);return t?t.split(/\s+/).filter(Boolean).includes(n)?t:`${n} ${t}`:n},Et=v.forwardRef(({label:e,error:t,className:n="",onChange:r,onKeyPress:s,value:o,defaultValue:i,type:a="text",checked:l,defaultChecked:c,...d},u)=>{const f=a==="radio"||a==="checkbox",g=Yb(a,n),m=v.useRef(!1),p=v.useRef(null);v.useImperativeHandle(u,()=>p.current);const[y,b]=v.useState(o??i??"");v.useEffect(()=>{if(!f&&!m.current&&o!==void 0){if(p.current&&document.activeElement===p.current)return;b(o)}},[o,f]);const _=v.useCallback(()=>{m.current=!0},[]),x=v.useCallback(E=>{if(m.current=!1,r){const T=E.target.value;b(T);const P=new Event("change",{bubbles:!0});Object.defineProperty(P,"target",{writable:!1,value:{value:T}}),Object.defineProperty(P,"currentTarget",{writable:!1,value:{value:T}}),r(P)}},[r]),M=v.useCallback(E=>{const T=E.target.value;b(T),!m.current&&r&&r(E)},[r]),S=v.useCallback(E=>{m.current||s&&s(E)},[s]),{loadingactions:k,formdata:N,...C}=d;if(f)return h.jsx("input",{ref:p,type:a,className:g,onChange:r,checked:l,defaultChecked:c,value:o,...C});const w=o!==void 0?{value:y}:{defaultValue:i};return h.jsx("input",{ref:p,type:a,className:g,onChange:M,onKeyPress:S,onCompositionStart:_,onCompositionEnd:x,...w,...C})});Et.displayName="Input";const lr=({label:e,error:t,className:n="",onChange:r,value:s,defaultValue:o,...i})=>{const a=v.useRef(!1),l=v.useRef(null),[c,d]=v.useState(s??o??"");v.useEffect(()=>{!a.current&&s!==void 0&&d(s)},[s]);const u=v.useCallback(()=>{a.current=!0},[]),f=v.useCallback(M=>{if(a.current=!1,r){const S=M.target.value;d(S);const k=new Event("change",{bubbles:!0});Object.defineProperty(k,"target",{writable:!1,value:{value:S}}),Object.defineProperty(k,"currentTarget",{writable:!1,value:{value:S}}),r(k)}},[r]),g=v.useCallback(M=>{const S=M.target.value;d(S),!a.current&&r&&r(M)},[r]),{loadingactions:m,formdata:p,...y}=i,b=s!==void 0?{value:c}:{defaultValue:o},x=(n??"").split(/\s+/).filter(Boolean).includes("textarea")?n??"":["textarea",n].filter(Boolean).join(" ");return h.jsx("textarea",{ref:l,className:x,onChange:g,onCompositionStart:u,onCompositionEnd:f,...b,...y})},gn=({children:e,className:t="",...n})=>h.jsx("label",{className:t,...n,children:e}),I=v.forwardRef(({children:e,className:t="",...n},r)=>h.jsx("div",{ref:r,className:t,...n,children:e})),J=({children:e,className:t="",...n})=>h.jsx("span",{className:t,...n,children:e}),kt=({children:e,className:t="",...n})=>h.jsx("p",{className:t,...n,children:e}),Nn=({className:e="",alt:t="",...n})=>h.jsx("img",{className:e,alt:t,...n}),sl=({children:e,className:t="",...n})=>h.jsx("h1",{className:t,...n,children:e}),cr=({children:e,className:t="",...n})=>h.jsx("h2",{className:t,...n,children:e}),Xr=({children:e,className:t="",...n})=>h.jsx("h3",{className:t,...n,children:e}),ou=({children:e,className:t="",...n})=>h.jsx("h4",{className:t,...n,children:e}),ol=({children:e,className:t="",...n})=>h.jsx("ul",{className:t,...n,children:e}),Kb=({children:e,className:t="",...n})=>h.jsx("ol",{className:t,...n,children:e}),il=({children:e,className:t="",...n})=>h.jsx("li",{className:t,...n,children:e}),qr=({children:e,className:t="",...n})=>h.jsx("a",{className:t,...n,children:e}),al=({children:e,className:t="",...n})=>h.jsx("form",{className:t,...n,children:e}),Jn=({children:e,className:t="",...n})=>h.jsx("svg",{className:t,...n,children:e}),Xb=window.G7Core?.createLogger?.("Comp:Select")??{log:(...e)=>console.log("[Comp:Select]",...e),warn:(...e)=>console.warn("[Comp:Select]",...e),error:(...e)=>console.error("[Comp:Select]",...e)};function qb(e){const t=window.G7Core?.state?.get?.("_global.appConfig.localeNames")?.[e];return t||{ko:"한국어",en:"English",ja:"日本語",zh:"中文",es:"Español",fr:"Français",de:"Deutsch"}[e]||e}const Zr=({children:e,label:t,error:n,options:r,className:s="",value:o,onChange:i,disabled:a,searchable:l=!1,searchPlaceholder:c,editorAttrs:d,...u})=>{const[f,g]=v.useState(!1),[m,p]=v.useState(""),[y,b]=v.useState(null),_=v.useRef(null),x=v.useRef(null),M=v.useRef(null),S=v.useRef(null),k=v.useMemo(()=>r?Array.isArray(r)?r.length===0?[]:typeof r[0]=="string"?r.map(O=>({value:O,label:qb(O)})):r:(Xb.warn("options prop is not an array:",r),null):null,[r]),N=v.useMemo(()=>k&&k.find(z=>String(z.value)===String(o))?.label||"",[k,o]),C=v.useMemo(()=>{if(!k)return null;if(!l||m.trim()==="")return k;const O=m.trim().toLowerCase();return k.filter(z=>z.label.toLowerCase().includes(O)||String(z.value).toLowerCase().includes(O))},[k,l,m]);v.useEffect(()=>{if(f&&l){p("");const O=setTimeout(()=>M.current?.focus(),0);return()=>clearTimeout(O)}f||p("")},[f,l]);const w=v.useCallback(()=>{if(!x.current)return;const O=x.current.getBoundingClientRect(),z=window.innerHeight-O.bottom,j=z<280&&O.top>z;b(j?{bottom:window.innerHeight-O.top+4,left:O.left,width:O.width}:{top:O.bottom+4,left:O.left,width:O.width})},[]);v.useEffect(()=>{if(!f){b(null);return}return w(),window.addEventListener("scroll",w,!0),window.addEventListener("resize",w),()=>{window.removeEventListener("scroll",w,!0),window.removeEventListener("resize",w)}},[f,w]),v.useEffect(()=>{const O=z=>{const U=z.target;_.current&&!_.current.contains(U)&&(!S.current||!S.current.contains(U))&&g(!1)};return f&&document.addEventListener("mousedown",O),()=>{document.removeEventListener("mousedown",O)}},[f]),v.useEffect(()=>{const O=z=>{z.key==="Escape"&&f&&(g(!1),x.current?.focus())};return document.addEventListener("keydown",O),()=>document.removeEventListener("keydown",O)},[f]);const E=()=>{a||g(!f)},T=O=>{i&&i({target:{value:O},preventDefault:()=>{},stopPropagation:()=>{},type:"change"}),g(!1),x.current?.focus()};if(!k){const z=(s??"").split(/\s+/).filter(Boolean).includes("select")?s??"":["select",s].filter(Boolean).join(" ");return h.jsx("select",{className:z,value:o,onChange:i,disabled:a,...d,...u,children:e})}const P=(s??"").split(/\s+/).filter(O=>O&&!O.includes(":")).join(" "),L=P.includes("bg-"),F=/text-(gray|red|blue|green|yellow|white|black|indigo|purple|pink|orange|amber|emerald|teal|cyan|slate)-\d+|text-white|text-black/.test(P),A=L?`${s}${F?"":" text-gray-700 dark:text-gray-200"}`:`w-full px-4 py-2.5 bg-gray-100 dark:bg-gray-700 border-0 rounded-xl text-sm text-gray-700 dark:text-gray-200 font-medium focus:ring-2 focus:ring-blue-500 focus:outline-none ${s}`,D={...d,...u};return h.jsxs(I,{ref:_,className:"relative",...D,children:[h.jsxs(le,{ref:x,type:"button",onClick:E,disabled:a,className:`${A} flex items-center justify-between gap-2 text-left cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed`,"aria-haspopup":"listbox","aria-expanded":f,children:[h.jsx(J,{className:"truncate",children:N||" "}),h.jsx(Jn,{className:`w-4 h-4 flex-shrink-0 transition-transform duration-200 ${f?"rotate-180":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),f&&y&&Vn.createPortal(h.jsxs(I,{ref:S,className:"fixed z-[9999] bg-white dark:bg-gray-800 rounded-2xl shadow-lg border border-gray-200 dark:border-gray-600 overflow-hidden",style:{top:y.top,bottom:y.bottom,left:y.left,width:y.width},role:"listbox",children:[l&&h.jsx(I,{className:"p-2 border-b border-gray-200 dark:border-gray-600",children:h.jsx(Et,{ref:M,type:"text",value:m,onChange:O=>p(O.target.value),placeholder:c??"Search...",className:"w-full px-3 py-2 bg-gray-100 dark:bg-gray-700 border-0 rounded-lg text-sm text-gray-700 dark:text-gray-200 placeholder-gray-400 dark:placeholder-gray-500 focus:ring-2 focus:ring-blue-500 focus:outline-none",role:"searchbox","aria-label":c??"Search"})}),h.jsxs(I,{className:"py-2 max-h-60 overflow-auto",children:[C&&C.length===0&&h.jsx(I,{className:"px-4 py-3 text-sm text-gray-500 dark:text-gray-400 text-center",children:m?"No results":""}),(C??[]).map(O=>{const z=String(O.value)===String(o);return h.jsxs(le,{type:"button",onClick:()=>!O.disabled&&T(O.value),disabled:O.disabled,className:`w-full px-4 py-3 text-left text-sm flex items-center justify-between hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors ${z?"text-blue-600 dark:text-blue-400 font-medium":"text-gray-700 dark:text-gray-200"} ${O.disabled?"opacity-50 cursor-not-allowed":"cursor-pointer"}`,role:"option","aria-selected":z,children:[h.jsx(J,{children:O.label}),z&&h.jsx(Jn,{className:"w-5 h-5 text-blue-600 dark:text-blue-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})]},O.value)})]})]}),document.body)]})},Zb=({children:e,className:t="",...n})=>h.jsx("option",{className:t,...n,children:e}),Qb=({children:e,className:t="",...n})=>h.jsx("optgroup",{className:t,...n,children:e}),On=v.forwardRef(({label:e,className:t="",indeterminate:n=!1,...r},s)=>{const o=v.useRef(null),i=a=>{o.current=a,typeof s=="function"?s(a):s&&(s.current=a)};return v.useEffect(()=>{o.current&&(o.current.indeterminate=n)},[n]),h.jsx("input",{ref:i,type:"checkbox",className:t,...r})});On.displayName="Checkbox";const ll=({children:e,className:t="",...n})=>h.jsx("table",{className:t,...n,children:e}),cl=({children:e,className:t="",...n})=>h.jsx("thead",{className:t,...n,children:e}),dl=({children:e,className:t="",...n})=>h.jsx("tbody",{className:t,...n,children:e}),ul=({children:e,className:t="",...n})=>h.jsx("tfoot",{className:t,...n,children:e}),dr=({children:e,className:t="",...n})=>h.jsx("tr",{className:t,...n,children:e}),Qr=({children:e,className:t="",...n})=>h.jsx("th",{className:t,...n,children:e}),rn=({children:e,className:t="",...n})=>h.jsx("td",{className:t,...n,children:e}),Jo=({children:e,className:t="",...n})=>h.jsx("nav",{className:t,...n,children:e}),iu=({children:e,className:t="",...n})=>h.jsx("section",{className:t,...n,children:e}),ae=({name:e,iconStyle:t="solid",size:n,color:r,spin:s=!1,pulse:o=!1,fixedWidth:i=!1,ariaLabel:a,className:l="",style:c,...d})=>{const u={solid:"fas",regular:"far",light:"fal",duotone:"fad",brands:"fab"},f={"fa-solid":"solid","fa-regular":"regular","fa-light":"light","fa-duotone":"duotone","fa-brands":"brands"},g=typeof e=="string"?e:String(e);let m=t,p=g;for(const[_,x]of Object.entries(f))if(g.startsWith(_+" ")){m=x,p=g.substring(_.length+1);break}p=p.replace(/^fa-/,"");const y=[u[m],`fa-${p}`,n&&`fa-${n}`,s&&"fa-spin",o&&"fa-pulse",i&&"fa-fw",r,l].filter(Boolean).join(" "),b=a||p.replace(/-/g," ");return h.jsx("i",{className:y,style:c,"aria-label":b,role:"img",...d})},Jb={xs:"w-3 h-3",sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6",xl:"w-8 h-8"},au={xs:"xs",sm:"sm",md:void 0,lg:"lg",xl:"2x"},Rb=({icon:e,size:t="md",className:n="",color:r,ariaLabel:s})=>{const o=e.indexOf(":"),i=e.startsWith("fa-")||e.startsWith("fas ")||e.startsWith("far ")||e.startsWith("fab ")||e.startsWith("fal ")||e.startsWith("fad ");let a,l;i?(a="fa",l=e):o>0?(a=e.substring(0,o),l=e.substring(o+1)):(a="fa",l=e);const c=Jb[t],d=r||"";switch(a){case"fa":return h.jsx(ae,{name:l,size:au[t],className:n,color:r,ariaLabel:s});case"svg":return h.jsx("img",{src:l,className:`${c} ${d} ${n}`.trim(),alt:s||"","aria-label":s,role:"img"});case"img":return h.jsx("img",{src:l,className:`${c} ${n}`.trim(),alt:s||"",role:"img"});default:return h.jsx(ae,{name:e,size:au[t],className:n,color:r,ariaLabel:s})}},ey=({children:e,className:t="",...n})=>h.jsx("code",{className:t,...n,children:e}),ty=({children:e,className:t="",...n})=>h.jsx("pre",{className:t,...n,children:e}),ny=({children:e})=>h.jsx(h.Fragment,{children:e}),ry=({className:e="",...t})=>h.jsx("hr",{className:e,...t}),yt=({className:e="",children:t,style:n,...r})=>h.jsx("i",{className:e,style:n,...r,children:t});var he=(e=>(e.User="fa-user",e.Users="fa-users",e.UserCircle="fa-user-circle",e.UserPlus="fa-user-plus",e.UserMinus="fa-user-minus",e.UserShield="fa-user-shield",e.Search="fa-search",e.Edit="fa-edit",e.Pencil="fa-pencil-alt",e.Trash="fa-trash",e.Save="fa-save",e.Plus="fa-plus",e.Minus="fa-minus",e.Check="fa-check",e.Times="fa-times",e.Download="fa-download",e.Upload="fa-upload",e.Copy="fa-copy",e.ExternalLink="fa-external-link-alt",e.Home="fa-home",e.CaretRight="fa-caret-right",e.CaretDown="fa-caret-down",e.ChevronLeft="fa-chevron-left",e.ChevronRight="fa-chevron-right",e.ChevronUp="fa-chevron-up",e.ChevronDown="fa-chevron-down",e.AngleLeft="fa-angle-left",e.AngleRight="fa-angle-right",e.AngleUp="fa-angle-up",e.AngleDown="fa-angle-down",e.ArrowUp="fa-arrow-up",e.ArrowDown="fa-arrow-down",e.ArrowLeft="fa-arrow-left",e.ArrowRight="fa-arrow-right",e.Bars="fa-bars",e.EllipsisVertical="fa-ellipsis-v",e.EllipsisHorizontal="fa-ellipsis-h",e.CheckCircle="fa-check-circle",e.TimesCircle="fa-times-circle",e.ExclamationCircle="fa-exclamation-circle",e.ExclamationTriangle="fa-exclamation-triangle",e.InfoCircle="fa-info-circle",e.QuestionCircle="fa-question-circle",e.XCircle="fa-times-circle",e.ShoppingCart="fa-shopping-cart",e.ShoppingBag="fa-shopping-bag",e.CreditCard="fa-credit-card",e.Tag="fa-tag",e.Tags="fa-tags",e.File="fa-file",e.FileAlt="fa-file-alt",e.Folder="fa-folder",e.FolderOpen="fa-folder-open",e.Envelope="fa-envelope",e.Phone="fa-phone",e.Comment="fa-comment",e.Comments="fa-comments",e.Cog="fa-cog",e.Cogs="fa-cogs",e.Settings="fa-cog",e.Wrench="fa-wrench",e.Sliders="fa-sliders-h",e.Image="fa-image",e.Images="fa-images",e.Video="fa-video",e.Camera="fa-camera",e.Heart="fa-heart",e.Star="fa-star",e.ThumbsUp="fa-thumbs-up",e.ThumbsDown="fa-thumbs-down",e.Share="fa-share",e.Clock="fa-clock",e.Calendar="fa-calendar",e.CalendarAlt="fa-calendar-alt",e.Lock="fa-lock",e.Unlock="fa-unlock",e.Eye="fa-eye",e.EyeSlash="fa-eye-slash",e.Bell="fa-bell",e.Flag="fa-flag",e.Map="fa-map",e.MapMarker="fa-map-marker-alt",e.Globe="fa-globe",e.Link="fa-link",e.Unlink="fa-unlink",e.Sun="fa-sun",e.Moon="fa-moon",e.ChartBar="fa-chart-bar",e.ChartLine="fa-chart-line",e.ChartPie="fa-chart-pie",e.ChartArea="fa-chart-area",e.Spinner="fa-spinner",e.CircleNotch="fa-circle-notch",e.CheckBadge="fa-badge-check",e.Cube="fa-cube",e.Cubes="fa-cubes",e.Plug="fa-plug",e.PuzzlePiece="fa-puzzle-piece",e.Palette="fa-palette",e))(he||{});const sy=({title:e,content:t,imageUrl:n,imageAlt:r="",className:s="",onClick:o,style:i,id:a,editorAttrs:l})=>h.jsxs(I,{className:`card-clickable ${s}`,onClick:o,style:i,id:a,...l,children:[n&&h.jsx(I,{className:"w-full",children:h.jsx(Nn,{src:n,alt:r,className:"card-image"})}),h.jsxs(I,{className:"p-4",children:[e&&h.jsx(cr,{className:"card-title",children:e}),t&&h.jsx(kt,{className:"card-content",children:t})]})]}),Vs=({items:e,triggerLabel:t="작업",triggerIconName:n=he.EllipsisVertical,position:r="right",className:s="",style:o,children:i,onItemClick:a,id:l,editorAttrs:c})=>{const[d,u]=v.useState(!1),[f,g]=v.useState({top:0,left:0}),m=v.useRef(null),p=v.useRef(null),y=v.useCallback(()=>{if(!m.current)return;const x=m.current.getBoundingClientRect(),M=224;let S=r==="right"?x.right-M:x.left;const k=x.bottom+8;S<8&&(S=8),S+M>window.innerWidth-8&&(S=window.innerWidth-M-8),g({top:k,left:S})},[r]);v.useEffect(()=>{d&&y()},[d,y]),v.useEffect(()=>{if(!d)return;const x=()=>{u(!1)};return window.addEventListener("scroll",x,!0),window.addEventListener("resize",x),()=>{window.removeEventListener("scroll",x,!0),window.removeEventListener("resize",x)}},[d]),v.useEffect(()=>{const x=M=>{const S=M.target,k=m.current?.contains(S),N=p.current?.contains(S);!k&&!N&&u(!1)};return d&&document.addEventListener("mousedown",x),()=>{document.removeEventListener("mousedown",x)}},[d]);const b=x=>{x.disabled||(x.onClick&&x.onClick(),a&&a(x.id,x),u(!1))},_=d?Vn.createPortal(h.jsx("div",{ref:p,className:"fixed z-[9999] w-56 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg overflow-hidden",style:{top:f.top,left:f.left},children:e.filter(x=>x.if!==!1).map(x=>{if(x.divider)return h.jsx("div",{className:"border-t border-gray-200 dark:border-gray-600 my-1"},x.id);const M=x.variant==="danger"?"text-red-600 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/20":"text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-700",S=x.disabled?"opacity-50 cursor-not-allowed":"cursor-pointer";return h.jsxs("div",{onClick:()=>b(x),className:`flex items-center gap-3 px-4 py-3 transition-colors ${M} ${S}`,children:[x.iconName&&h.jsx(ae,{name:x.iconName,className:"w-4 h-4"}),h.jsx("span",{className:"text-sm font-medium",children:x.label})]},x.id)})}),document.body):null;return h.jsxs(I,{className:`relative inline-block ${s}`,style:o,id:l,...c,children:[i?h.jsx(I,{ref:m,onClick:()=>u(!d),className:"cursor-pointer",children:i}):h.jsxs(le,{ref:m,onClick:()=>u(!d),className:"flex items-center gap-2 px-2 py-1 bg-transparent hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:[t&&h.jsx(J,{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:t}),n&&h.jsx(ae,{name:n,className:"w-4 h-4 text-gray-500 dark:text-gray-400"})]}),_]})},Jr=(e,t)=>window.G7Core?.t?.(e,t)??e,Ro=({currentPage:e,totalPages:t,onPageChange:n,maxVisiblePages:r=5,showFirstLast:s=!0,showFirst:o,showLast:i,hasMorePages:a,className:l="",style:c,prevText:d,nextText:u,id:f,editorAttrs:g})=>{const m=t!=null,p=m?t:0,y=m?e{const N=[];if(!m)return N;if(p<=r+2)for(let C=1;C<=p;C++)N.push(C);else{const C=Math.floor(r/2);let w=Math.max(2,e-C),E=Math.min(p-1,e+C);e<=C+1?E=r:e>=p-C&&(w=p-r+1),N.push(1),w>2&&N.push("...");for(let T=w;T<=E;T++)N.push(T);E1&&N.push(p)}return N},[e,p,m,r]),M=N=>{N<1||N===e||m&&N>p||n(N)},S=()=>{e>1&&n(e-1)},k=()=>{y&&n(e+1)};return h.jsxs(I,{className:`pagination ${l}`,style:c,role:"navigation","aria-label":Jr("common.pagination"),id:f,...g,children:[b&&h.jsx(le,{onClick:()=>M(1),disabled:e===1,className:"pagination-btn","aria-label":Jr("common.first_page"),children:"«"}),h.jsx(le,{onClick:S,disabled:e===1,className:"pagination-btn","aria-label":Jr("common.prev_page"),children:d||h.jsx(h.Fragment,{children:"‹"})}),h.jsxs(I,{className:"pagination",children:[!m&&h.jsx(J,{className:"px-3 py-1 text-sm text-gray-700 dark:text-gray-300",children:e}),x.map((N,C)=>{if(N==="...")return h.jsx(J,{className:"pagination-ellipsis",children:"..."},`ellipsis-${C}`);const w=N,E=w===e;return h.jsx(le,{onClick:()=>M(w),className:E?"pagination-btn-active":"pagination-btn","aria-label":Jr("common.page_n",{n:w}),"aria-current":E?"page":void 0,children:w},w)})]}),h.jsx(le,{onClick:k,disabled:!y,className:"pagination-btn","aria-label":Jr("common.next_page"),children:u||h.jsx(h.Fragment,{children:"›"})}),_&&h.jsx(le,{onClick:()=>M(p),disabled:e===p,className:"pagination-btn","aria-label":Jr("common.last_page"),children:"»"})]})},lu=(e,t)=>window.G7Core?.t?.(e,t)??e,oy=()=>window.G7Core?.locale?.supported?.()??["ko","en"],iy=()=>window.G7Core?.locale?.current?.()??"ko",cu=e=>{const t=lu(`common.language_${e}`);return t===`common.language_${e}`?{ko:"한국어",en:"English",ja:"日本語",zh:"中文"}[e]||e.toUpperCase():t},ay=()=>oy().map(t=>({code:t,name:cu(t),nativeName:cu(t)})),fl=({value:e={},onChange:t,inputType:n="text",layout:r="inline",availableLocales:s,defaultLocale:o,placeholder:i="",required:a=!1,disabled:l=!1,maxLength:c,rows:d=4,className:u="",name:f="multilingual_input",showCodeOnMobile:g=!1,error:m,id:p,editorAttrs:y})=>{const b=!!m,_=v.useMemo(()=>s??ay(),[s]),x=v.useMemo(()=>o??iy(),[o]),M=v.useRef(e),[S,k]=v.useState(e),N=v.useRef(JSON.stringify(e));v.useEffect(()=>{const K=JSON.stringify(e);K!==N.current&&(N.current=K,M.current=e,k(e))},[e]);const C=v.useCallback((K,Q)=>{const ne={target:{name:f,value:K}};Q&&(ne._changedKeys=Q),t?.(ne)},[t,f]),[w,E]=v.useState(()=>{if(r==="tabs"||r==="compact"){const ne=_.map(ue=>ue.code);return[x,...ne.filter(ue=>ue!==x)]}const K=Object.keys(e).filter(ne=>e[ne]!==void 0);if(K.length===0)return[x];const Q=[];return K.includes(x)&&Q.push(x),K.forEach(ne=>{ne!==x&&Q.push(ne)}),Q}),[T,P]=v.useState(x),L=v.useMemo(()=>_.filter(K=>!w.includes(K.code)),[_,w]),[F,A]=v.useState(!1);v.useEffect(()=>{if(r==="tabs"||r==="compact"){const ue=_.map(de=>de.code),ee=[x,...ue.filter(de=>de!==x)],me=w.join(","),ie=ee.join(",");me!==ie&&E(ee);return}const K=Object.keys(e).filter(ue=>e[ue]!==void 0);if(K.length===0){E([x]);return}const Q=[];K.includes(x)&&Q.push(x),K.forEach(ue=>{ue!==x&&Q.push(ue)});const ne=w.join(","),se=Q.join(",");ne!==se&&E(Q)},[e,x,r,_]);const D=v.useCallback((K,Q)=>{const ne={...M.current,[K]:Q};M.current=ne,k(ne),C(ne,[K])},[C]),O=v.useCallback(K=>{E(ne=>[...ne,K]),P(K),A(!1);const Q={...M.current,[K]:""};M.current=Q,k(Q),C(Q)},[C]),z=v.useCallback(K=>{if(K===x)return;E(ne=>ne.filter(se=>se!==K)),T===K&&P(x);const Q={...M.current};delete Q[K],M.current=Q,k(Q),C(Q)},[T,x,C]),U=v.useCallback(K=>{const Q=_.find(ne=>ne.code===K);return Q?.nativeName||Q?.name||K.toUpperCase()},[_]),j=v.useCallback(K=>!!S[K]?.trim(),[S]),Y=v.useCallback(()=>L.length===0?null:h.jsxs(I,{className:"relative",children:[h.jsxs(le,{type:"button",className:"inline-flex items-center gap-1 px-3 py-1 text-xs font-medium text-blue-600 dark:text-blue-400 bg-blue-50 dark:bg-blue-900/30 hover:bg-blue-100 dark:hover:bg-blue-900/50 rounded-full border border-dashed border-blue-300 dark:border-blue-600 transition-colors",onClick:()=>A(!F),disabled:l,children:[h.jsx(ae,{name:"plus",className:"w-3 h-3"}),h.jsx(J,{children:lu("common.add_language")})]}),F&&h.jsx(I,{className:"absolute top-full left-0 mt-1 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg z-10 min-w-[120px]",children:L.map(K=>h.jsxs(le,{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 first:rounded-t-lg last:rounded-b-lg transition-colors",onClick:()=>O(K.code),children:[h.jsx(ae,{name:"globe",className:"w-3.5 h-3.5 text-gray-400 dark:text-gray-500"}),h.jsx(J,{children:K.nativeName||K.name})]},K.code))})]}),[L,F,l,O]),B=v.useCallback((K,Q=!1)=>{const ne=b?"input input-error":"input",se=b?"textarea input-error":"textarea",ue=K===x,ee=`${i}${i?" (":""}${U(K)}${i?")":""}`;return h.jsxs(I,{className:"space-y-2",children:[h.jsxs(I,{className:"flex items-center gap-2",children:[h.jsxs(J,{className:` inline-flex items-center gap-1.5 px-3 py-1 rounded-full text-xs font-medium - ${ce?"bg-blue-100 text-blue-700 dark:bg-blue-900/50 dark:text-blue-300":"bg-gray-100 text-gray-600 dark:bg-gray-700 dark:text-gray-300"} - `,children:[h.jsx(re,{name:"globe",className:"w-3 h-3"}),H(Y),ce&&h.jsx(Q,{className:"text-red-500 dark:text-red-400",children:"*"}),!ce&&h.jsx(oe,{type:"button",className:"ml-0.5 p-0.5 rounded-full hover:bg-gray-200 dark:hover:bg-gray-600 transition-colors",onClick:()=>V(Y),disabled:l,children:h.jsx(re,{name:"xmark",className:"w-3 h-3"})})]}),ce&&Z&&j()]}),n==="textarea"?h.jsx(Rn,{name:`${f}[${Y}]`,value:S[Y]||"",onChange:he=>A(Y,he.target.value),placeholder:J,required:a&&ce,disabled:l,maxLength:c,rows:d,className:`${te} resize-vertical`}):h.jsx(wt,{type:"text",name:`${f}[${Y}]`,value:S[Y]||"",onChange:he=>A(Y,he.target.value),placeholder:J,required:a&&ce,disabled:l,maxLength:c,className:ee})]},Y)},[f,S,A,i,a,l,c,d,n,H,x,V,j,b]),B=v.useCallback(Y=>{const Z=b?"input input-error":"input",ee=b?"textarea input-error":"textarea",te=`${i}${i?" (":""}${H(Y)}${i?")":""}`;return h.jsx(I,{children:n==="textarea"?h.jsx(Rn,{name:`${f}[${Y}]`,value:S[Y]||"",onChange:ce=>A(Y,ce.target.value),placeholder:te,required:a&&Y===x,disabled:l,maxLength:c,rows:d,className:`${ee} resize-vertical`}):h.jsx(wt,{type:"text",name:`${f}[${Y}]`,value:S[Y]||"",onChange:ce=>A(Y,ce.target.value),placeholder:te,required:a&&Y===x,disabled:l,maxLength:c,className:Z})},Y)},[f,S,A,i,a,l,c,d,n,x,H,b]),G=()=>h.jsx(I,{className:u,children:h.jsx(I,{className:"space-y-4",children:k.map((Y,Z)=>U(Y,Z===0))})}),z=()=>h.jsxs(I,{className:u,children:[h.jsxs(I,{className:"flex flex-wrap items-center gap-2 mb-3",children:[k.map(Y=>h.jsxs(oe,{type:"button",className:` + ${ue?"bg-blue-100 text-blue-700 dark:bg-blue-900/50 dark:text-blue-300":"bg-gray-100 text-gray-600 dark:bg-gray-700 dark:text-gray-300"} + `,children:[h.jsx(ae,{name:"globe",className:"w-3 h-3"}),U(K),ue&&h.jsx(J,{className:"text-red-500 dark:text-red-400",children:"*"}),!ue&&h.jsx(le,{type:"button",className:"ml-0.5 p-0.5 rounded-full hover:bg-gray-200 dark:hover:bg-gray-600 transition-colors",onClick:()=>z(K),disabled:l,children:h.jsx(ae,{name:"xmark",className:"w-3 h-3"})})]}),ue&&Q&&Y()]}),n==="textarea"?h.jsx(lr,{name:`${f}[${K}]`,value:S[K]||"",onChange:me=>D(K,me.target.value),placeholder:ee,required:a&&ue,disabled:l,maxLength:c,rows:d,className:`${se} resize-vertical`}):h.jsx(Et,{type:"text",name:`${f}[${K}]`,value:S[K]||"",onChange:me=>D(K,me.target.value),placeholder:ee,required:a&&ue,disabled:l,maxLength:c,className:ne})]},K)},[f,S,D,i,a,l,c,d,n,U,x,z,Y,b]),W=v.useCallback(K=>{const Q=b?"input input-error":"input",ne=b?"textarea input-error":"textarea",se=`${i}${i?" (":""}${U(K)}${i?")":""}`;return h.jsx(I,{children:n==="textarea"?h.jsx(lr,{name:`${f}[${K}]`,value:S[K]||"",onChange:ue=>D(K,ue.target.value),placeholder:se,required:a&&K===x,disabled:l,maxLength:c,rows:d,className:`${ne} resize-vertical`}):h.jsx(Et,{type:"text",name:`${f}[${K}]`,value:S[K]||"",onChange:ue=>D(K,ue.target.value),placeholder:se,required:a&&K===x,disabled:l,maxLength:c,className:Q})},K)},[f,S,D,i,a,l,c,d,n,x,U,b]),G=()=>h.jsx(I,{className:u,children:h.jsx(I,{className:"space-y-4",children:w.map((K,Q)=>B(K,Q===0))})}),V=()=>h.jsxs(I,{className:u,children:[h.jsxs(I,{className:"flex flex-wrap items-center gap-2 mb-3",children:[w.map(K=>h.jsxs(le,{type:"button",className:` inline-flex items-center gap-1.5 px-3 py-1.5 rounded-full text-xs font-semibold transition-all - ${T===Y?Y===x?"bg-blue-500 text-white dark:bg-blue-600 dark:text-white shadow-md scale-105":"bg-gray-500 text-white dark:bg-gray-600 dark:text-white shadow-md scale-105":Y===x?"bg-blue-50 text-blue-600 dark:bg-blue-900/30 dark:text-blue-400 hover:bg-blue-100 dark:hover:bg-blue-900/50":"bg-gray-100 text-gray-600 dark:bg-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-600"} - `,onClick:()=>L(Y),children:[h.jsx(re,{name:"globe",className:"w-3 h-3"}),g?h.jsxs(h.Fragment,{children:[h.jsx(Q,{className:"hidden md:inline",children:H(Y)}),h.jsx(Q,{className:"inline md:hidden",children:Y.toUpperCase()})]}):H(Y),Y===x&&h.jsx(Q,{className:"text-red-500 dark:text-red-400",children:"*"}),W(Y)&&T!==Y&&h.jsx(re,{name:"check",className:"w-3 h-3 text-green-500 dark:text-green-400"}),Y!==x&&h.jsx(oe,{type:"button",className:"ml-0.5 p-0.5 rounded-full hover:bg-gray-300 dark:hover:bg-gray-500 transition-colors",onClick:Z=>{Z.stopPropagation(),V(Y)},disabled:l,children:h.jsx(re,{name:"xmark",className:"w-3 h-3"})})]},Y)),j()]}),k.map(Y=>h.jsx(I,{className:T===Y?"block":"hidden",children:B(Y)},Y))]}),K=()=>{const Y=b?"input input-error":"input",Z=b?"textarea input-error":"textarea";return h.jsx(I,{className:u,children:h.jsxs(I,{className:"flex items-center gap-1",children:[h.jsx(I,{className:"flex items-center shrink-0",children:k.map(ee=>h.jsxs(oe,{type:"button",className:` + ${T===K?K===x?"bg-blue-500 text-white dark:bg-blue-600 dark:text-white shadow-md scale-105":"bg-gray-500 text-white dark:bg-gray-600 dark:text-white shadow-md scale-105":K===x?"bg-blue-50 text-blue-600 dark:bg-blue-900/30 dark:text-blue-400 hover:bg-blue-100 dark:hover:bg-blue-900/50":"bg-gray-100 text-gray-600 dark:bg-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-600"} + `,onClick:()=>P(K),children:[h.jsx(ae,{name:"globe",className:"w-3 h-3"}),g?h.jsxs(h.Fragment,{children:[h.jsx(J,{className:"hidden md:inline",children:U(K)}),h.jsx(J,{className:"inline md:hidden",children:K.toUpperCase()})]}):U(K),K===x&&h.jsx(J,{className:"text-red-500 dark:text-red-400",children:"*"}),j(K)&&T!==K&&h.jsx(ae,{name:"check",className:"w-3 h-3 text-green-500 dark:text-green-400"}),K!==x&&h.jsx(le,{type:"button",className:"ml-0.5 p-0.5 rounded-full hover:bg-gray-300 dark:hover:bg-gray-500 transition-colors",onClick:Q=>{Q.stopPropagation(),z(K)},disabled:l,children:h.jsx(ae,{name:"xmark",className:"w-3 h-3"})})]},K)),Y()]}),w.map(K=>h.jsx(I,{className:T===K?"block":"hidden",children:W(K)},K))]}),X=()=>{const K=b?"input input-error":"input",Q=b?"textarea input-error":"textarea";return h.jsx(I,{className:u,children:h.jsxs(I,{className:"flex items-center gap-1",children:[h.jsx(I,{className:"flex items-center shrink-0",children:w.map(ne=>h.jsxs(le,{type:"button",className:` px-2 py-1.5 text-xs font-medium border-y border-l first:rounded-l last:rounded-r last:border-r transition-colors - ${T===ee?"bg-blue-500 text-white border-blue-500 dark:bg-blue-600 dark:border-blue-600":"bg-white text-gray-600 border-gray-200 hover:bg-gray-50 dark:bg-gray-800 dark:text-gray-300 dark:border-gray-600 dark:hover:bg-gray-700"} - `,onClick:()=>L(ee),title:H(ee),children:[ee.toUpperCase(),ee===x&&h.jsx(Q,{className:"text-red-400 ml-0.5",children:"*"})]},ee))}),h.jsx(I,{className:"flex-1 min-w-0",children:n==="textarea"?h.jsx(Rn,{name:`${f}[${T}]`,value:S[T]||"",onChange:ee=>A(T,ee.target.value),placeholder:i,required:a&&T===x,disabled:l,maxLength:c,rows:d,className:Z}):h.jsx(wt,{type:"text",name:`${f}[${T}]`,value:S[T]||"",onChange:ee=>A(T,ee.target.value),placeholder:i,required:a&&T===x,disabled:l,maxLength:c,className:Y})})]})})};return h.jsxs(I,{className:l?"opacity-50 cursor-not-allowed":void 0,id:p,...y,children:[r==="compact"?K():r==="tabs"?z():G(),b&&m&&h.jsx(Q,{className:"text-xs text-red-500 dark:text-red-400 mt-1 block",children:m})]})};Ga.displayName="MultilingualInput";const xb=()=>window.G7Core,Ya=({checked:e,value:t,onChange:n,disabled:r=!1,label:s,description:o,size:i="md",className:a="",name:l,id:c,editorAttrs:d})=>{const[u,f]=v.useState(()=>e??t??!1);v.useEffect(()=>{f(e??t??!1)},[e,t]);const g=_=>{const x=_.target.checked;f(x),n&&!r&&n(_)},p={sm:{track:"w-9 h-5",thumb:"after:h-4 after:w-4"},md:{track:"w-11 h-6",thumb:"after:h-5 after:w-5"},lg:{track:"w-14 h-7",thumb:"after:h-6 after:w-6"}}[i],y=()=>{if(!r){const _=!u;if(f(_),n){const x=xb();x?.createChangeEvent&&n(x.createChangeEvent({checked:_,name:l}))}}},b=_=>{r||_.key!==" "&&_.key!=="Enter"&&_.key!=="Spacebar"||(_.preventDefault(),y())};return h.jsxs("div",{className:`toggle-container ${a}`,id:c,...d,children:[h.jsxs("div",{className:`toggle-switch-wrapper ${r?"cursor-not-allowed opacity-50":"cursor-pointer"}`,role:"switch","aria-checked":u,"aria-disabled":r||void 0,"aria-label":s??l,tabIndex:r?-1:0,onKeyDown:b,onClick:_=>{_.preventDefault(),_.stopPropagation(),y()},children:[h.jsx("input",{type:"checkbox",id:l,name:l,checked:u,onChange:g,disabled:r,className:"sr-only peer",tabIndex:-1}),h.jsx("div",{className:`toggle-switch-track ${p.track} ${p.thumb}`})]}),s&&h.jsx("span",{className:`toggle-label ${r?"opacity-50 cursor-not-allowed":"cursor-pointer"}`,onClick:y,children:s}),o&&h.jsx("p",{className:"toggle-description",children:o})]})},Fo=({status:e,label:t,showIcon:n=!0,iconName:r,className:s="",style:o,id:i,editorAttrs:a})=>{const l={success:"bg-green-50 dark:bg-green-900/20 text-green-700 dark:text-green-400 border-green-200 dark:border-green-800",warning:"bg-yellow-50 dark:bg-yellow-900/20 text-yellow-700 dark:text-yellow-400 border-yellow-200 dark:border-yellow-800",error:"bg-red-50 dark:bg-red-900/20 text-red-700 dark:text-red-400 border-red-200 dark:border-red-800",info:"bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-400 border-blue-200 dark:border-blue-800",pending:"bg-gray-50 dark:bg-gray-700 text-gray-700 dark:text-gray-300 border-gray-200 dark:border-gray-600",default:"bg-gray-50 dark:bg-gray-700 text-gray-600 dark:text-gray-400 border-gray-200 dark:border-gray-600"},c={success:de.CheckCircle,warning:de.ExclamationTriangle,error:de.XCircle,info:de.InfoCircle,pending:de.Clock,default:de.QuestionCircle},d={success:"성공",warning:"경고",error:"오류",info:"정보",pending:"대기 중",default:"기본"},u=r||c[e],f=t||d[e],g=l[e];return h.jsxs(Q,{className:`inline-flex items-center gap-1.5 px-3 py-1 rounded-full text-xs font-medium border ${g} ${s}`,style:o,id:i,...a,children:[n&&h.jsx(re,{name:u,className:"w-4 h-4"}),h.jsx(Q,{children:f})]})},$d={blue:"bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-300",green:"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-300",red:"bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-300",gray:"bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-300",yellow:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-300",purple:"bg-purple-100 text-purple-800 dark:bg-purple-900/30 dark:text-purple-300",orange:"bg-orange-100 text-orange-800 dark:bg-orange-900/30 dark:text-orange-300",teal:"bg-teal-100 text-teal-800 dark:bg-teal-900/30 dark:text-teal-300",cyan:"bg-cyan-100 text-cyan-800 dark:bg-cyan-900/30 dark:text-cyan-300"},wb={success:"green",warning:"yellow",danger:"red",error:"red",info:"blue",primary:"blue",secondary:"gray",text:"gray",default:"gray"},Fd={sm:"px-1.5 py-0.5 text-[10px]",md:"px-2 py-0.5 text-xs",lg:"px-2.5 py-1 text-sm"},Vd=({color:e,variant:t,text:n,size:r="md",className:s="",style:o,children:i,id:a,editorAttrs:l})=>{const c=e||(t?wb[t]:void 0)||"gray",d=$d[c]||$d.gray,u=Fd[r]||Fd.md;return h.jsxs(Q,{className:`inline-flex items-center rounded-full font-medium ${u} ${d} ${s}`,style:o,id:a,...l,children:[n,i]})};/*! @license DOMPurify 3.1.7 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.1.7/LICENSE */const{entries:zd,setPrototypeOf:Hd,isFrozen:kb,getPrototypeOf:Cb,getOwnPropertyDescriptor:Sb}=Object;let{freeze:Kt,seal:un,create:Ud}=Object,{apply:Ka,construct:Xa}=typeof Reflect<"u"&&Reflect;Kt||(Kt=function(t){return t}),un||(un=function(t){return t}),Ka||(Ka=function(t,n,r){return t.apply(n,r)}),Xa||(Xa=function(t,n){return new t(...n)});const Vo=an(Array.prototype.forEach),Bd=an(Array.prototype.pop),Ss=an(Array.prototype.push),zo=an(String.prototype.toLowerCase),qa=an(String.prototype.toString),jd=an(String.prototype.match),_s=an(String.prototype.replace),_b=an(String.prototype.indexOf),Eb=an(String.prototype.trim),Sn=an(Object.prototype.hasOwnProperty),Xt=an(RegExp.prototype.test),Es=Mb(TypeError);function an(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),s=1;s2&&arguments[2]!==void 0?arguments[2]:zo;Hd&&Hd(e,null);let r=t.length;for(;r--;){let s=t[r];if(typeof s=="string"){const o=n(s);o!==s&&(kb(t)||(t[r]=o),s=o)}e[s]=!0}return e}function Nb(e){for(let t=0;t/gm),Ib=un(/\${[\w\W]*}/gm),Lb=un(/^data-[\-\w.\u00B7-\uFFFF]/),Pb=un(/^aria-[\-\w]+$/),Xd=un(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),$b=un(/^(?:\w+script|data):/i),Fb=un(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),qd=un(/^html$/i),Vb=un(/^[a-z][.\w]*(-[.\w]+)+$/i);var Zd=Object.freeze({__proto__:null,MUSTACHE_EXPR:Ab,ERB_EXPR:Db,TMPLIT_EXPR:Ib,DATA_ATTR:Lb,ARIA_ATTR:Pb,IS_ALLOWED_URI:Xd,IS_SCRIPT_OR_DATA:$b,ATTR_WHITESPACE:Fb,DOCTYPE_NAME:qd,CUSTOM_ELEMENT:Vb});const Ns={element:1,text:3,progressingInstruction:7,comment:8,document:9},zb=function(){return typeof window>"u"?null:window},Hb=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let r=null;const s="data-tt-policy-suffix";n&&n.hasAttribute(s)&&(r=n.getAttribute(s));const o="dompurify"+(r?"#"+r:"");try{return t.createPolicy(o,{createHTML(i){return i},createScriptURL(i){return i}})}catch{return console.warn("TrustedTypes policy "+o+" could not be created."),null}};function Qd(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:zb();const t=ke=>Qd(ke);if(t.version="3.1.7",t.removed=[],!e||!e.document||e.document.nodeType!==Ns.document)return t.isSupported=!1,t;let{document:n}=e;const r=n,s=r.currentScript,{DocumentFragment:o,HTMLTemplateElement:i,Node:a,Element:l,NodeFilter:c,NamedNodeMap:d=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:u,DOMParser:f,trustedTypes:g}=e,m=l.prototype,p=Ms(m,"cloneNode"),y=Ms(m,"remove"),b=Ms(m,"nextSibling"),_=Ms(m,"childNodes"),x=Ms(m,"parentNode");if(typeof i=="function"){const ke=n.createElement("template");ke.content&&ke.content.ownerDocument&&(n=ke.content.ownerDocument)}let E,S="";const{implementation:w,createNodeIterator:N,createDocumentFragment:C,getElementsByTagName:k}=n,{importNode:M}=r;let T={};t.isSupported=typeof zd=="function"&&typeof x=="function"&&w&&w.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:L,ERB_EXPR:P,TMPLIT_EXPR:F,DATA_ATTR:D,ARIA_ATTR:A,IS_SCRIPT_OR_DATA:O,ATTR_WHITESPACE:V,CUSTOM_ELEMENT:H}=Zd;let{IS_ALLOWED_URI:W}=Zd,j=null;const U=je({},[...Wd,...Za,...Qa,...Ja,...Gd]);let B=null;const G=je({},[...Yd,...Ra,...Kd,...Ho]);let z=Object.seal(Ud(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),K=null,Y=null,Z=!0,ee=!0,te=!1,ce=!0,J=!1,he=!0,le=!1,ae=!1,Se=!1,ue=!1,pe=!1,we=!1,He=!0,se=!1;const Oe="user-content-";let Le=!0,Ie=!1,Ue={},et=null;const bt=je({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Ge=null;const ft=je({},["audio","video","img","source","image","track"]);let Be=null;const ne=je({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),fe="http://www.w3.org/1998/Math/MathML",xe="http://www.w3.org/2000/svg",ge="http://www.w3.org/1999/xhtml";let be=ge,Ve=!1,De=null;const $e=je({},[fe,xe,ge],qa);let Me=null;const qe=["application/xhtml+xml","text/html"],ot="text/html";let ye=null,Ce=null;const Fe=n.createElement("form"),nt=function(X){return X instanceof RegExp||X instanceof Function},pt=function(){let X=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Ce&&Ce===X)){if((!X||typeof X!="object")&&(X={}),X=gr(X),Me=qe.indexOf(X.PARSER_MEDIA_TYPE)===-1?ot:X.PARSER_MEDIA_TYPE,ye=Me==="application/xhtml+xml"?qa:zo,j=Sn(X,"ALLOWED_TAGS")?je({},X.ALLOWED_TAGS,ye):U,B=Sn(X,"ALLOWED_ATTR")?je({},X.ALLOWED_ATTR,ye):G,De=Sn(X,"ALLOWED_NAMESPACES")?je({},X.ALLOWED_NAMESPACES,qa):$e,Be=Sn(X,"ADD_URI_SAFE_ATTR")?je(gr(ne),X.ADD_URI_SAFE_ATTR,ye):ne,Ge=Sn(X,"ADD_DATA_URI_TAGS")?je(gr(ft),X.ADD_DATA_URI_TAGS,ye):ft,et=Sn(X,"FORBID_CONTENTS")?je({},X.FORBID_CONTENTS,ye):bt,K=Sn(X,"FORBID_TAGS")?je({},X.FORBID_TAGS,ye):{},Y=Sn(X,"FORBID_ATTR")?je({},X.FORBID_ATTR,ye):{},Ue=Sn(X,"USE_PROFILES")?X.USE_PROFILES:!1,Z=X.ALLOW_ARIA_ATTR!==!1,ee=X.ALLOW_DATA_ATTR!==!1,te=X.ALLOW_UNKNOWN_PROTOCOLS||!1,ce=X.ALLOW_SELF_CLOSE_IN_ATTR!==!1,J=X.SAFE_FOR_TEMPLATES||!1,he=X.SAFE_FOR_XML!==!1,le=X.WHOLE_DOCUMENT||!1,ue=X.RETURN_DOM||!1,pe=X.RETURN_DOM_FRAGMENT||!1,we=X.RETURN_TRUSTED_TYPE||!1,Se=X.FORCE_BODY||!1,He=X.SANITIZE_DOM!==!1,se=X.SANITIZE_NAMED_PROPS||!1,Le=X.KEEP_CONTENT!==!1,Ie=X.IN_PLACE||!1,W=X.ALLOWED_URI_REGEXP||Xd,be=X.NAMESPACE||ge,z=X.CUSTOM_ELEMENT_HANDLING||{},X.CUSTOM_ELEMENT_HANDLING&&nt(X.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(z.tagNameCheck=X.CUSTOM_ELEMENT_HANDLING.tagNameCheck),X.CUSTOM_ELEMENT_HANDLING&&nt(X.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(z.attributeNameCheck=X.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),X.CUSTOM_ELEMENT_HANDLING&&typeof X.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(z.allowCustomizedBuiltInElements=X.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),J&&(ee=!1),pe&&(ue=!0),Ue&&(j=je({},Gd),B=[],Ue.html===!0&&(je(j,Wd),je(B,Yd)),Ue.svg===!0&&(je(j,Za),je(B,Ra),je(B,Ho)),Ue.svgFilters===!0&&(je(j,Qa),je(B,Ra),je(B,Ho)),Ue.mathMl===!0&&(je(j,Ja),je(B,Kd),je(B,Ho))),X.ADD_TAGS&&(j===U&&(j=gr(j)),je(j,X.ADD_TAGS,ye)),X.ADD_ATTR&&(B===G&&(B=gr(B)),je(B,X.ADD_ATTR,ye)),X.ADD_URI_SAFE_ATTR&&je(Be,X.ADD_URI_SAFE_ATTR,ye),X.FORBID_CONTENTS&&(et===bt&&(et=gr(et)),je(et,X.FORBID_CONTENTS,ye)),Le&&(j["#text"]=!0),le&&je(j,["html","head","body"]),j.table&&(je(j,["tbody"]),delete K.tbody),X.TRUSTED_TYPES_POLICY){if(typeof X.TRUSTED_TYPES_POLICY.createHTML!="function")throw Es('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof X.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Es('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');E=X.TRUSTED_TYPES_POLICY,S=E.createHTML("")}else E===void 0&&(E=Hb(g,s)),E!==null&&typeof S=="string"&&(S=E.createHTML(""));Kt&&Kt(X),Ce=X}},it=je({},["mi","mo","mn","ms","mtext"]),rt=je({},["annotation-xml"]),Ot=je({},["title","style","font","a","script"]),ht=je({},[...Za,...Qa,...Ob]),Qt=je({},[...Ja,...Tb]),Gt=function(X){let ie=x(X);(!ie||!ie.tagName)&&(ie={namespaceURI:be,tagName:"template"});const ve=zo(X.tagName),st=zo(ie.tagName);return De[X.namespaceURI]?X.namespaceURI===xe?ie.namespaceURI===ge?ve==="svg":ie.namespaceURI===fe?ve==="svg"&&(st==="annotation-xml"||it[st]):!!ht[ve]:X.namespaceURI===fe?ie.namespaceURI===ge?ve==="math":ie.namespaceURI===xe?ve==="math"&&rt[st]:!!Qt[ve]:X.namespaceURI===ge?ie.namespaceURI===xe&&!rt[st]||ie.namespaceURI===fe&&!it[st]?!1:!Qt[ve]&&(Ot[ve]||!ht[ve]):!!(Me==="application/xhtml+xml"&&De[X.namespaceURI]):!1},mt=function(X){Ss(t.removed,{element:X});try{x(X).removeChild(X)}catch{y(X)}},St=function(X,ie){try{Ss(t.removed,{attribute:ie.getAttributeNode(X),from:ie})}catch{Ss(t.removed,{attribute:null,from:ie})}if(ie.removeAttribute(X),X==="is"&&!B[X])if(ue||pe)try{mt(ie)}catch{}else try{ie.setAttribute(X,"")}catch{}},xn=function(X){let ie=null,ve=null;if(Se)X=""+X;else{const _t=jd(X,/^[\r\n\t ]+/);ve=_t&&_t[0]}Me==="application/xhtml+xml"&&be===ge&&(X=''+X+"");const st=E?E.createHTML(X):X;if(be===ge)try{ie=new f().parseFromString(st,Me)}catch{}if(!ie||!ie.documentElement){ie=w.createDocument(be,"template",null);try{ie.documentElement.innerHTML=Ve?S:st}catch{}}const Tt=ie.body||ie.documentElement;return X&&ve&&Tt.insertBefore(n.createTextNode(ve),Tt.childNodes[0]||null),be===ge?k.call(ie,le?"html":"body")[0]:le?ie.documentElement:Tt},Vt=function(X){return N.call(X.ownerDocument||X,X,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},Ze=function(X){return X instanceof u&&(typeof X.nodeName!="string"||typeof X.textContent!="string"||typeof X.removeChild!="function"||!(X.attributes instanceof d)||typeof X.removeAttribute!="function"||typeof X.setAttribute!="function"||typeof X.namespaceURI!="string"||typeof X.insertBefore!="function"||typeof X.hasChildNodes!="function")},jn=function(X){return typeof a=="function"&&X instanceof a},dn=function(X,ie,ve){T[X]&&Vo(T[X],st=>{st.call(t,ie,ve,Ce)})},Io=function(X){let ie=null;if(dn("beforeSanitizeElements",X,null),Ze(X))return mt(X),!0;const ve=ye(X.nodeName);if(dn("uponSanitizeElement",X,{tagName:ve,allowedTags:j}),X.hasChildNodes()&&!jn(X.firstElementChild)&&Xt(/<[/\w]/g,X.innerHTML)&&Xt(/<[/\w]/g,X.textContent)||X.nodeType===Ns.progressingInstruction||he&&X.nodeType===Ns.comment&&Xt(/<[/\w]/g,X.data))return mt(X),!0;if(!j[ve]||K[ve]){if(!K[ve]&&La(ve)&&(z.tagNameCheck instanceof RegExp&&Xt(z.tagNameCheck,ve)||z.tagNameCheck instanceof Function&&z.tagNameCheck(ve)))return!1;if(Le&&!et[ve]){const st=x(X)||X.parentNode,Tt=_(X)||X.childNodes;if(Tt&&st){const _t=Tt.length;for(let Yt=_t-1;Yt>=0;--Yt){const wn=p(Tt[Yt],!0);wn.__removalCount=(X.__removalCount||0)+1,st.insertBefore(wn,b(X))}}}return mt(X),!0}return X instanceof l&&!Gt(X)||(ve==="noscript"||ve==="noembed"||ve==="noframes")&&Xt(/<\/no(script|embed|frames)/i,X.innerHTML)?(mt(X),!0):(J&&X.nodeType===Ns.text&&(ie=X.textContent,Vo([L,P,F],st=>{ie=_s(ie,st," ")}),X.textContent!==ie&&(Ss(t.removed,{element:X.cloneNode()}),X.textContent=ie)),dn("afterSanitizeElements",X,null),!1)},Lo=function(X,ie,ve){if(He&&(ie==="id"||ie==="name")&&(ve in n||ve in Fe))return!1;if(!(ee&&!Y[ie]&&Xt(D,ie))){if(!(Z&&Xt(A,ie))){if(!B[ie]||Y[ie]){if(!(La(X)&&(z.tagNameCheck instanceof RegExp&&Xt(z.tagNameCheck,X)||z.tagNameCheck instanceof Function&&z.tagNameCheck(X))&&(z.attributeNameCheck instanceof RegExp&&Xt(z.attributeNameCheck,ie)||z.attributeNameCheck instanceof Function&&z.attributeNameCheck(ie))||ie==="is"&&z.allowCustomizedBuiltInElements&&(z.tagNameCheck instanceof RegExp&&Xt(z.tagNameCheck,ve)||z.tagNameCheck instanceof Function&&z.tagNameCheck(ve))))return!1}else if(!Be[ie]){if(!Xt(W,_s(ve,V,""))){if(!((ie==="src"||ie==="xlink:href"||ie==="href")&&X!=="script"&&_b(ve,"data:")===0&&Ge[X])){if(!(te&&!Xt(O,_s(ve,V,"")))){if(ve)return!1}}}}}}return!0},La=function(X){return X!=="annotation-xml"&&jd(X,H)},Pa=function(X){dn("beforeSanitizeAttributes",X,null);const{attributes:ie}=X;if(!ie)return;const ve={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:B};let st=ie.length;for(;st--;){const Tt=ie[st],{name:_t,namespaceURI:Yt,value:wn}=Tt,Pr=ye(_t);let q=_t==="value"?wn:Eb(wn);if(ve.attrName=Pr,ve.attrValue=q,ve.keepAttr=!0,ve.forceKeepAttr=void 0,dn("uponSanitizeAttribute",X,ve),q=ve.attrValue,ve.forceKeepAttr||(St(_t,X),!ve.keepAttr))continue;if(!ce&&Xt(/\/>/i,q)){St(_t,X);continue}J&&Vo([L,P,F],Te=>{q=_s(q,Te," ")});const me=ye(X.nodeName);if(Lo(me,Pr,q)){if(se&&(Pr==="id"||Pr==="name")&&(St(_t,X),q=Oe+q),he&&Xt(/((--!?|])>)|<\/(style|title)/i,q)){St(_t,X);continue}if(E&&typeof g=="object"&&typeof g.getAttributeType=="function"&&!Yt)switch(g.getAttributeType(me,Pr)){case"TrustedHTML":{q=E.createHTML(q);break}case"TrustedScriptURL":{q=E.createScriptURL(q);break}}try{Yt?X.setAttributeNS(Yt,_t,q):X.setAttribute(_t,q),Ze(X)?mt(X):Bd(t.removed)}catch{}}}dn("afterSanitizeAttributes",X,null)},$a=function ke(X){let ie=null;const ve=Vt(X);for(dn("beforeSanitizeShadowDOM",X,null);ie=ve.nextNode();)dn("uponSanitizeShadowNode",ie,null),!Io(ie)&&(ie.content instanceof o&&ke(ie.content),Pa(ie));dn("afterSanitizeShadowDOM",X,null)};return t.sanitize=function(ke){let X=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},ie=null,ve=null,st=null,Tt=null;if(Ve=!ke,Ve&&(ke=""),typeof ke!="string"&&!jn(ke))if(typeof ke.toString=="function"){if(ke=ke.toString(),typeof ke!="string")throw Es("dirty is not a string, aborting")}else throw Es("toString is not a function");if(!t.isSupported)return ke;if(ae||pt(X),t.removed=[],typeof ke=="string"&&(Ie=!1),Ie){if(ke.nodeName){const wn=ye(ke.nodeName);if(!j[wn]||K[wn])throw Es("root node is forbidden and cannot be sanitized in-place")}}else if(ke instanceof a)ie=xn(""),ve=ie.ownerDocument.importNode(ke,!0),ve.nodeType===Ns.element&&ve.nodeName==="BODY"||ve.nodeName==="HTML"?ie=ve:ie.appendChild(ve);else{if(!ue&&!J&&!le&&ke.indexOf("<")===-1)return E&&we?E.createHTML(ke):ke;if(ie=xn(ke),!ie)return ue?null:we?S:""}ie&&Se&&mt(ie.firstChild);const _t=Vt(Ie?ke:ie);for(;st=_t.nextNode();)Io(st)||(st.content instanceof o&&$a(st.content),Pa(st));if(Ie)return ke;if(ue){if(pe)for(Tt=C.call(ie.ownerDocument);ie.firstChild;)Tt.appendChild(ie.firstChild);else Tt=ie;return(B.shadowroot||B.shadowrootmode)&&(Tt=M.call(r,Tt,!0)),Tt}let Yt=le?ie.outerHTML:ie.innerHTML;return le&&j["!doctype"]&&ie.ownerDocument&&ie.ownerDocument.doctype&&ie.ownerDocument.doctype.name&&Xt(qd,ie.ownerDocument.doctype.name)&&(Yt=" -`+Yt),J&&Vo([L,P,F],wn=>{Yt=_s(Yt,wn," ")}),E&&we?E.createHTML(Yt):Yt},t.setConfig=function(){let ke=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};pt(ke),ae=!0},t.clearConfig=function(){Ce=null,ae=!1},t.isValidAttribute=function(ke,X,ie){Ce||pt({});const ve=ye(ke),st=ye(X);return Lo(ve,st,ie)},t.addHook=function(ke,X){typeof X=="function"&&(T[ke]=T[ke]||[],Ss(T[ke],X))},t.removeHook=function(ke){if(T[ke])return Bd(T[ke])},t.removeHooks=function(ke){T[ke]&&(T[ke]=[])},t.removeAllHooks=function(){T={}},t}var Ub=Qd();const el=({content:e,text:t,isHtml:n=!0,className:r="",purifyConfig:s,id:o,editorAttrs:i})=>{const a=t??e??"";if(!a||a.trim()==="")return null;if(!n){const u=` + ${T===ne?"bg-blue-500 text-white border-blue-500 dark:bg-blue-600 dark:border-blue-600":"bg-white text-gray-600 border-gray-200 hover:bg-gray-50 dark:bg-gray-800 dark:text-gray-300 dark:border-gray-600 dark:hover:bg-gray-700"} + `,onClick:()=>P(ne),title:U(ne),children:[ne.toUpperCase(),ne===x&&h.jsx(J,{className:"text-red-400 ml-0.5",children:"*"})]},ne))}),h.jsx(I,{className:"flex-1 min-w-0",children:n==="textarea"?h.jsx(lr,{name:`${f}[${T}]`,value:S[T]||"",onChange:ne=>D(T,ne.target.value),placeholder:i,required:a&&T===x,disabled:l,maxLength:c,rows:d,className:Q}):h.jsx(Et,{type:"text",name:`${f}[${T}]`,value:S[T]||"",onChange:ne=>D(T,ne.target.value),placeholder:i,required:a&&T===x,disabled:l,maxLength:c,className:K})})]})})};return h.jsxs(I,{className:l?"opacity-50 cursor-not-allowed":void 0,id:p,...y,children:[r==="compact"?X():r==="tabs"?V():G(),b&&m&&h.jsx(J,{className:"text-xs text-red-500 dark:text-red-400 mt-1 block",children:m})]})};fl.displayName="MultilingualInput";const ly=()=>window.G7Core,hl=({checked:e,value:t,onChange:n,disabled:r=!1,label:s,description:o,size:i="md",className:a="",name:l,id:c,editorAttrs:d})=>{const[u,f]=v.useState(()=>e??t??!1);v.useEffect(()=>{f(e??t??!1)},[e,t]);const g=_=>{const x=_.target.checked;f(x),n&&!r&&n(_)},p={sm:{track:"w-9 h-5",thumb:"after:h-4 after:w-4"},md:{track:"w-11 h-6",thumb:"after:h-5 after:w-5"},lg:{track:"w-14 h-7",thumb:"after:h-6 after:w-6"}}[i],y=()=>{if(!r){const _=!u;if(f(_),n){const x=ly();x?.createChangeEvent&&n(x.createChangeEvent({checked:_,name:l}))}}},b=_=>{r||_.key!==" "&&_.key!=="Enter"&&_.key!=="Spacebar"||(_.preventDefault(),y())};return h.jsxs("div",{className:`toggle-container ${a}`,id:c,...d,children:[h.jsxs("div",{className:`toggle-switch-wrapper ${r?"cursor-not-allowed opacity-50":"cursor-pointer"}`,role:"switch","aria-checked":u,"aria-disabled":r||void 0,"aria-label":s??l,tabIndex:r?-1:0,onKeyDown:b,onClick:_=>{_.preventDefault(),_.stopPropagation(),y()},children:[h.jsx("input",{type:"checkbox",id:l,name:l,checked:u,onChange:g,disabled:r,className:"sr-only peer",tabIndex:-1}),h.jsx("div",{className:`toggle-switch-track ${p.track} ${p.thumb}`})]}),s&&h.jsx("span",{className:`toggle-label ${r?"opacity-50 cursor-not-allowed":"cursor-pointer"}`,onClick:y,children:s}),o&&h.jsx("p",{className:"toggle-description",children:o})]})},ei=({status:e,label:t,showIcon:n=!0,iconName:r,className:s="",style:o,id:i,editorAttrs:a})=>{const l={success:"bg-green-50 dark:bg-green-900/20 text-green-700 dark:text-green-400 border-green-200 dark:border-green-800",warning:"bg-yellow-50 dark:bg-yellow-900/20 text-yellow-700 dark:text-yellow-400 border-yellow-200 dark:border-yellow-800",error:"bg-red-50 dark:bg-red-900/20 text-red-700 dark:text-red-400 border-red-200 dark:border-red-800",info:"bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-400 border-blue-200 dark:border-blue-800",pending:"bg-gray-50 dark:bg-gray-700 text-gray-700 dark:text-gray-300 border-gray-200 dark:border-gray-600",default:"bg-gray-50 dark:bg-gray-700 text-gray-600 dark:text-gray-400 border-gray-200 dark:border-gray-600"},c={success:he.CheckCircle,warning:he.ExclamationTriangle,error:he.XCircle,info:he.InfoCircle,pending:he.Clock,default:he.QuestionCircle},d={success:"성공",warning:"경고",error:"오류",info:"정보",pending:"대기 중",default:"기본"},u=r||c[e],f=t||d[e],g=l[e];return h.jsxs(J,{className:`inline-flex items-center gap-1.5 px-3 py-1 rounded-full text-xs font-medium border ${g} ${s}`,style:o,id:i,...a,children:[n&&h.jsx(ae,{name:u,className:"w-4 h-4"}),h.jsx(J,{children:f})]})},du={blue:"bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-300",green:"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-300",red:"bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-300",gray:"bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-300",yellow:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-300",purple:"bg-purple-100 text-purple-800 dark:bg-purple-900/30 dark:text-purple-300",orange:"bg-orange-100 text-orange-800 dark:bg-orange-900/30 dark:text-orange-300",teal:"bg-teal-100 text-teal-800 dark:bg-teal-900/30 dark:text-teal-300",cyan:"bg-cyan-100 text-cyan-800 dark:bg-cyan-900/30 dark:text-cyan-300"},cy={success:"green",warning:"yellow",danger:"red",error:"red",info:"blue",primary:"blue",secondary:"gray",text:"gray",default:"gray"},uu={sm:"px-1.5 py-0.5 text-[10px]",md:"px-2 py-0.5 text-xs",lg:"px-2.5 py-1 text-sm"},fu=({color:e,variant:t,text:n,size:r="md",className:s="",style:o,children:i,id:a,editorAttrs:l})=>{const c=e||(t?cy[t]:void 0)||"gray",d=du[c]||du.gray,u=uu[r]||uu.md;return h.jsxs(J,{className:`inline-flex items-center rounded-full font-medium ${u} ${d} ${s}`,style:o,id:a,...l,children:[n,i]})};/*! @license DOMPurify 3.4.14 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.14/LICENSE */function hu(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n2?r-2:0),o=2;o1?n-1:0),s=1;s"u"?null:Mt(BigInt.prototype.toString),wu=typeof Symbol>"u"?null:Mt(Symbol.prototype.toString),sn=Mt(Object.prototype.hasOwnProperty),js=Mt(Object.prototype.toString),Kt=Mt(RegExp.prototype.test),Er=Cy(TypeError);function Mt(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,r=new Array(n>1?n-1:0),s=1;s2&&arguments[2]!==void 0?arguments[2]:Us;if(pu&&pu(e,null),!es(t))return e;let r=t.length;for(;r--;){let s=t[r];if(typeof s=="string"){const o=n(s);o!==s&&(py(t)||(t[r]=o),s=o)}e[s]=!0}return e}function Sy(e){for(let t=0;t/g),Ay=Pt(/\${[\w\W]*/g),Dy=Pt(/^data-[\-\w.\u00B7-\uFFFF]+$/),Iy=Pt(/^aria-[\-\w]+$/),Eu=Pt(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Ly=Pt(/^(?:\w+script|data):/i),Py=Pt(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),$y=Pt(/^html$/i),Fy=Pt(/^[a-z][.\w]*(-[.\w]+)+$/i),Mu=Pt(/<[/\w!]/g),Nu=Pt(/<[/\w]/g),zy=Pt(/<\/no(script|embed|frames)/i),Vy=Pt(/\/>/i),mn={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},Ou=["style","script","xmp","iframe","noembed","noframes","plaintext","noscript"],Hy=Tt(Ze({},Ou)),Uy=(function(){const e={};return _r(Ou,t=>{e[t]=Pt(new RegExp("])","i"))}),Tt(e)})(),By=function(){return typeof window>"u"?null:window},jy=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let r=null;const s="data-tt-policy-suffix";n&&n.hasAttribute(s)&&(r=n.getAttribute(s));const o="dompurify"+(r?"#"+r:"");try{return t.createPolicy(o,{createHTML(i){return i},createScriptURL(i){return i}})}catch{return console.warn("TrustedTypes policy "+o+" could not be created."),null}},Tu=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},ur=function(t,n,r,s){return sn(t,n)&&es(t[n])?Ze(s.base?pn(s.base):{},t[n],s.transform):r},wl=function(t,n,r){const s=sn(t,n)?t[n]:void 0;return s&&typeof s=="object"?pn(s):r()};function Au(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:By();const t=ce=>Au(ce);if(t.version="3.4.14",t.removed=[],!e||!e.document||e.document.nodeType!==mn.document||!e.Element)return t.isSupported=!1,t;let n=e.document;const r=n,s=r.currentScript;e.DocumentFragment;const o=e.HTMLTemplateElement,i=e.Node,a=e.Element,l=e.NodeFilter,c=e.NamedNodeMap;c===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;const d=e.DOMParser,u=e.trustedTypes,f=a.prototype,g=Tn(f,"cloneNode"),m=Tn(f,"remove"),p=Tn(f,"nextSibling"),y=Tn(f,"childNodes"),b=Tn(f,"parentNode"),_=Tn(f,"shadowRoot"),x=Tn(f,"attributes"),M=i&&i.prototype?Tn(i.prototype,"nodeType"):null,S=i&&i.prototype?Tn(i.prototype,"nodeName"):null,k=i&&i.prototype?Tn(i.prototype,"ownerDocument"):null,N=function(H){return M?M(H):H.nodeType},C=function(H){return S?S(H):H.nodeName};if(typeof o=="function"){const ce=n.createElement("template");ce.content&&ce.content.ownerDocument&&(n=ce.content.ownerDocument)}let w,E="",T,P=!1,L=0;const F=function(){if(L>0)throw Er('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},A=function(H){F(),L++;try{return w.createHTML(H)}finally{L--}},D=function(H){F(),L++;try{return w.createScriptURL(H)}finally{L--}},O=function(){return P||(T=jy(u,s),P=!0),T},z=n,U=z.implementation,j=z.createNodeIterator,Y=z.createDocumentFragment,B=z.getElementsByTagName,W=r.importNode;let G=Tu();t.isSupported=typeof gu=="function"&&typeof b=="function"&&U&&U.createHTMLDocument!==void 0;const V=Oy,X=Ty,K=Ay,Q=Dy,ne=Iy,se=Ly,ue=Py,ee=Fy;let me=Eu,ie=null;const de=Ze({},[...ku,...bl,...yl,...vl,...Cu]);let fe=null;const be=Ze({},[...Su,...xl,..._u,...ti]);let ge=Object.seal(Rr(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Ce=null,je=null;const oe=Object.seal(Rr(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Te=!0,Pe=!0,Fe=!1,Ke=!0,nt=!1,dt=!0,We=!1,pt=!1,Ge=null,te=null,pe=!1,we=!1,xe=!1,ke=!1,Be=!0,Le=!1;const ze="user-content-";let Ie=!0,qe=!1,Re={},Ne=null;const Oe=Ze({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let Ue=null;const lt=Ze({},["audio","video","img","source","image","track"]);let vt=null;const ut=Ze({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ot="http://www.w3.org/1998/Math/MathML",St="http://www.w3.org/2000/svg",et="http://www.w3.org/1999/xhtml";let Lt=et,Ut=!1,Gt=null;const Yt=Ze({},[ot,St,et],ml),Mn=Tt(["mi","mo","mn","ms","mtext"]);let Bt=Ze({},Mn);const tt=Tt(["annotation-xml"]);let zn=Ze({},tt);const Xo=Ze({},["title","style","font","a","script"]);let Sr=null;const qa=["application/xhtml+xml","text/html"],Jd="text/html";let xt=null,ar=null;const Za=n.createElement("form"),qo=function(H){return H instanceof RegExp||H instanceof Function},Fs=function(){let H=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(ar&&ar===H)return;(!H||typeof H!="object")&&(H={}),H=pn(H),Sr=qa.indexOf(H.PARSER_MEDIA_TYPE)===-1?Jd:H.PARSER_MEDIA_TYPE,xt=Sr==="application/xhtml+xml"?ml:Us,ie=ur(H,"ALLOWED_TAGS",de,{transform:xt}),fe=ur(H,"ALLOWED_ATTR",be,{transform:xt}),Gt=ur(H,"ALLOWED_NAMESPACES",Yt,{transform:ml}),vt=ur(H,"ADD_URI_SAFE_ATTR",ut,{transform:xt,base:ut}),Ue=ur(H,"ADD_DATA_URI_TAGS",lt,{transform:xt,base:lt}),Ne=ur(H,"FORBID_CONTENTS",Oe,{transform:xt}),Ce=ur(H,"FORBID_TAGS",pn({}),{transform:xt}),je=ur(H,"FORBID_ATTR",pn({}),{transform:xt}),Re=sn(H,"USE_PROFILES")?H.USE_PROFILES&&typeof H.USE_PROFILES=="object"?pn(H.USE_PROFILES):H.USE_PROFILES:!1,Te=H.ALLOW_ARIA_ATTR!==!1,Pe=H.ALLOW_DATA_ATTR!==!1,Fe=H.ALLOW_UNKNOWN_PROTOCOLS||!1,Ke=H.ALLOW_SELF_CLOSE_IN_ATTR!==!1,nt=H.SAFE_FOR_TEMPLATES||!1,dt=H.SAFE_FOR_XML!==!1,We=H.WHOLE_DOCUMENT||!1,we=H.RETURN_DOM||!1,xe=H.RETURN_DOM_FRAGMENT||!1,ke=H.RETURN_TRUSTED_TYPE||!1,pe=H.FORCE_BODY||!1,Be=H.SANITIZE_DOM!==!1,Le=H.SANITIZE_NAMED_PROPS||!1,Ie=H.KEEP_CONTENT!==!1,qe=H.IN_PLACE||!1,me=Ey(H.ALLOWED_URI_REGEXP)?H.ALLOWED_URI_REGEXP:Eu,Lt=typeof H.NAMESPACE=="string"?H.NAMESPACE:et,Bt=wl(H,"MATHML_TEXT_INTEGRATION_POINTS",()=>Ze({},Mn)),zn=wl(H,"HTML_INTEGRATION_POINTS",()=>Ze({},tt));const q=wl(H,"CUSTOM_ELEMENT_HANDLING",()=>Rr(null));if(ge=Rr(null),sn(q,"tagNameCheck")&&qo(q.tagNameCheck)&&(ge.tagNameCheck=q.tagNameCheck),sn(q,"attributeNameCheck")&&qo(q.attributeNameCheck)&&(ge.attributeNameCheck=q.attributeNameCheck),sn(q,"allowCustomizedBuiltInElements")&&typeof q.allowCustomizedBuiltInElements=="boolean"&&(ge.allowCustomizedBuiltInElements=q.allowCustomizedBuiltInElements),Pt(ge),nt&&(Pe=!1),xe&&(we=!0),Re&&(ie=Ze({},Cu),fe=Rr(null),Re.html===!0&&(Ze(ie,ku),Ze(fe,Su)),Re.svg===!0&&(Ze(ie,bl),Ze(fe,xl),Ze(fe,ti)),Re.svgFilters===!0&&(Ze(ie,yl),Ze(fe,xl),Ze(fe,ti)),Re.mathMl===!0&&(Ze(ie,vl),Ze(fe,_u),Ze(fe,ti))),oe.tagCheck=null,oe.attributeCheck=null,sn(H,"ADD_TAGS")&&(typeof H.ADD_TAGS=="function"?oe.tagCheck=H.ADD_TAGS:es(H.ADD_TAGS)&&(ie===de&&(ie=pn(ie)),Ze(ie,H.ADD_TAGS,xt))),sn(H,"ADD_ATTR")&&(typeof H.ADD_ATTR=="function"?oe.attributeCheck=H.ADD_ATTR:es(H.ADD_ATTR)&&(fe===be&&(fe=pn(fe)),Ze(fe,H.ADD_ATTR,xt))),sn(H,"ADD_FORBID_CONTENTS")&&es(H.ADD_FORBID_CONTENTS)&&(Ne===Oe&&(Ne=pn(Ne)),Ze(Ne,H.ADD_FORBID_CONTENTS,xt)),Ie&&(ie["#text"]=!0),We&&Ze(ie,["html","head","body"]),ie.table&&(Ze(ie,["tbody"]),delete Ce.tbody),H.TRUSTED_TYPES_POLICY){if(typeof H.TRUSTED_TYPES_POLICY.createHTML!="function")throw Er('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof H.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Er('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const re=w;w=H.TRUSTED_TYPES_POLICY;try{E=A("")}catch(ve){throw w=re,ve}}else H.TRUSTED_TYPES_POLICY===null?(w=void 0,E=""):(w===void 0&&(w=O()),w&&typeof E=="string"&&(E=A("")));Tt&&Tt(H),ar=H},Kr=Ze({},[...bl,...yl,...My]),Zo=Ze({},[...vl,...Ny]),Qa=function(H,q,re){return q.namespaceURI===et?H==="svg":q.namespaceURI===ot?H==="svg"&&(re==="annotation-xml"||Bt[re]):!!Kr[H]},Ja=function(H,q,re){return q.namespaceURI===et?H==="math":q.namespaceURI===St?H==="math"&&zn[re]:!!Zo[H]},Rd=function(H,q,re){return q.namespaceURI===St&&!zn[re]||q.namespaceURI===ot&&!Bt[re]?!1:!Zo[H]&&(Xo[H]||!Kr[H])},eu=function(H){let q=b(H);(!q||!q.tagName)&&(q={namespaceURI:Lt,tagName:"template"});const re=Us(H.tagName),ve=Us(q.tagName);return Gt[H.namespaceURI]?H.namespaceURI===St?Qa(re,q,ve):H.namespaceURI===ot?Ja(re,q,ve):H.namespaceURI===et?Rd(re,q,ve):!!(Sr==="application/xhtml+xml"&&Gt[H.namespaceURI]):!1},Zn=function(H){Hs(t.removed,{element:H});try{b(H).removeChild(H)}catch{if(m(H),!b(H))throw Er("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},Z=function(H,q,re){try{H.removeAttributeNode(q)}catch{try{H.removeAttribute(re)}catch{}}},ye=function(H){Ve(H);const q=y(H);if(q){const ve=[];_r(q,Se=>{Hs(ve,Se)}),_r(ve,Se=>{try{m(Se)}catch{}})}const re=x(H);if(re)for(let ve=re.length-1;ve>=0;--ve){const Se=re[ve],He=Se&&Se.name;typeof He=="string"&&Z(H,Se,He)}},_e=function(H,q,re){if(!re)try{re=q.getAttributeNode(H)}catch{re=null}Hs(t.removed,{attribute:re||null,from:q});try{re?q.removeAttributeNode(re):q.removeAttribute(H)}catch{try{q.removeAttribute(H)}catch{}}if(H==="is")if(we||xe)try{Zn(q)}catch{}else try{q.setAttribute(H,"")}catch{}},ct=function(H){const q=x(H);if(q)for(let re=q.length-1;re>=0;--re){const ve=q[re],Se=ve&&ve.name;typeof Se!="string"||fe[xt(Se)]||Z(H,ve,Se)}},Ve=function(H){const q=[H];for(;q.length>0;){const re=q.pop();N(re)===mn.element&&ct(re);const Se=y(re);if(Se)for(let He=Se.length-1;He>=0;--He)q.push(Se[He])}},Ra=function(H,q){return dt?H==="patchsrc"?!0:H==="for"&&q!=="label"&&q!=="output":!1},KA=function(H){if(!dt)return;const q=[H];for(;q.length>0;){const re=q.pop(),ve=N(re);if(ve===mn.processingInstruction||ve===mn.comment&&Kt(Nu,re.data)){try{m(re)}catch{}continue}if(ve===mn.element){const He=re,mt=xt(C(re));try{He.hasAttribute&&He.hasAttribute("patchsrc")&&He.removeAttribute("patchsrc"),He.hasAttribute&&He.hasAttribute("for")&&Ra("for",mt)&&He.removeAttribute("for")}catch{}}const Se=y(re);if(Se)for(let He=Se.length-1;He>=0;--He)q.push(Se[He])}},Pb=function(H){let q=null,re=null;if(pe)H=""+H;else{const He=yu(H,/^[\r\n\t ]+/);re=He&&He[0]}Sr==="application/xhtml+xml"&&Lt===et&&(H=''+H+"");const ve=w?A(H):H;if(Lt===et)try{q=new d().parseFromString(ve,Sr)}catch{}if(!q||!q.documentElement){q=U.createDocument(Lt,"template",null);try{q.documentElement.innerHTML=Ut?E:ve}catch{}}const Se=q.body||q.documentElement;return H&&re&&Se.insertBefore(n.createTextNode(re),Se.childNodes[0]||null),Lt===et?B.call(q,We?"html":"body")[0]:We?q.documentElement:Se},$b=function(H){const q=k?k(H):H.ownerDocument;return j.call(q||H,H,l.SHOW_ELEMENT|l.SHOW_COMMENT|l.SHOW_TEXT|l.SHOW_PROCESSING_INSTRUCTION|l.SHOW_CDATA_SECTION,null)},el=function(H){return H=Bs(H,V," "),H=Bs(H,X," "),H=Bs(H,K," "),H},tu=function(H){var q;H.normalize();const re=k?k(H):H.ownerDocument,ve=j.call(re||H,H,l.SHOW_TEXT|l.SHOW_COMMENT|l.SHOW_CDATA_SECTION|l.SHOW_PROCESSING_INSTRUCTION,null);let Se=ve.nextNode();for(;Se;)Se.data=el(Se.data),Se=ve.nextNode();const He=(q=H.querySelectorAll)===null||q===void 0?void 0:q.call(H,"template");He&&_r(He,mt=>{zs(mt.content)&&tu(mt.content)})},tl=function(H){const q=S?S(H):null;return typeof q!="string"||xt(q)!=="form"?!1:typeof H.nodeName!="string"||typeof H.textContent!="string"||typeof H.removeChild!="function"||H.attributes!==x(H)||typeof H.removeAttribute!="function"||typeof H.setAttribute!="function"||typeof H.namespaceURI!="string"||typeof H.insertBefore!="function"||typeof H.hasChildNodes!="function"||H.nodeType!==M(H)||H.childNodes!==y(H)},zs=function(H){if(!M||typeof H!="object"||H===null)return!1;try{return M(H)===mn.documentFragment}catch{return!1}},Qo=function(H){if(!M||typeof H!="object"||H===null)return!1;try{return typeof M(H)=="number"}catch{return!1}};function Qn(ce,H,q){ce.length!==0&&_r(ce,re=>{re.call(t,H,q,ar)})}const XA=function(H,q){return!!(dt&&H.hasChildNodes()&&!Qo(H.firstElementChild)&&Kt(Mu,H.textContent)&&Kt(Mu,H.innerHTML)||dt&&H.namespaceURI===et&&Hy[q]&&(Qo(H.firstElementChild)||typeof H.textContent=="string"&&Kt(Uy[q],H.textContent))||H.nodeType===mn.processingInstruction||dt&&H.nodeType===mn.comment&&Kt(Nu,H.data))},nl=function(H,q){if(H instanceof RegExp)return Kt(H,q);if(H instanceof Function){for(var re=arguments.length,ve=new Array(re>2?re-2:0),Se=2;Se=0;--mt){const wt=H===re?g(Se[mt],!0):Se[mt];ve.insertBefore(wt,p(H))}}}return Zn(H),!0},Fb=function(H,q,re,ve){return H.length===0?q:q===re||q===ve?pn(q):q},zb=function(H,q){return H===q||b(H)!==null?!1:(qe&&Ve(H),!0)},Vb=function(H,q){if(Qn(G.beforeSanitizeElements,H,null),zb(H,q))return!0;if(tl(H))return Zn(H),!0;const re=xt(C(H));if(ie=Fb(G.uponSanitizeElement,ie,de,Ge),Qn(G.uponSanitizeElement,H,{tagName:re,allowedTags:ie}),zb(H,q))return!0;if(XA(H,re))return Zn(H),!0;if(Ce[re]||!(oe.tagCheck instanceof Function&&oe.tagCheck(re))&&!ie[re]){const Se=qA(H,re,q);return Se===!1&&Qn(G.afterSanitizeElements,H,null),Se}if(N(H)===mn.element&&!eu(H)||(re==="noscript"||re==="noembed"||re==="noframes")&&Kt(zy,H.innerHTML))return Zn(H),!0;if(nt&&H.nodeType===mn.text){const Se=el(H.textContent);H.textContent!==Se&&(Hs(t.removed,{element:H.cloneNode()}),H.textContent=Se)}return Qn(G.afterSanitizeElements,H,null),!1},Hb=function(H,q,re){if(je[q]||Ra(q,H)||Be&&(q==="id"||q==="name")&&(re in n||re in Za))return!1;const ve=fe[q]||oe.attributeCheck instanceof Function&&oe.attributeCheck(q,H);return Pe&&Kt(Q,q)||Te&&Kt(ne,q)?!0:ve?vt[q]||Kt(me,Bs(re,ue,""))||(q==="src"||q==="xlink:href"||q==="href")&&H!=="script"&&vu(re,"data:")===0&&Ue[H]||Fe&&!Kt(se,Bs(re,ue,""))?!0:!re:Ub(H)&&nl(ge.tagNameCheck,H)&&nl(ge.attributeNameCheck,q,H)||q==="is"&&ge.allowCustomizedBuiltInElements&&nl(ge.tagNameCheck,re)},ZA=Ze({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Ub=function(H){return!ZA[Us(H)]&&Kt(ee,H)},QA=function(H,q,re,ve){if(w&&typeof u=="object"&&typeof u.getAttributeType=="function"&&!re)switch(u.getAttributeType(H,q)){case"TrustedHTML":return A(ve);case"TrustedScriptURL":return D(ve)}return ve},JA=function(H,q,re,ve){try{re?H.setAttributeNS(re,q,ve):H.setAttribute(q,ve),tl(H)?Zn(H):bu(t.removed)}catch{_e(q,H)}},Bb=function(H){Qn(G.beforeSanitizeAttributes,H,null);const q=H.attributes;if(!q||tl(H))return;fe=Fb(G.uponSanitizeAttribute,fe,be,te);const re={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:fe,forceKeepAttr:void 0};let ve=q.length;const Se=xt(H.nodeName);for(;ve--;){const He=q[ve],mt=He.name,wt=He.namespaceURI,fn=He.value,hn=xt(mt),ru=fn;let nn=mt==="value"?ru:xy(ru);if(re.attrName=hn,re.attrValue=nn,re.keepAttr=!0,re.forceKeepAttr=void 0,Qn(G.uponSanitizeAttribute,H,re),nn=re.attrValue,Le&&(hn==="id"||hn==="name")&&vu(nn,ze)!==0&&(_e(mt,H,He),nn=ze+nn),dt&&Kt(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,nn)){_e(mt,H,He);continue}if(hn==="attributename"&&yu(nn,"href")){_e(mt,H,He);continue}if(!re.forceKeepAttr){if(!re.keepAttr){_e(mt,H,He);continue}if(!Ke&&Kt(Vy,nn)){_e(mt,H,He);continue}if(nt&&(nn=el(nn)),!Hb(Se,hn,nn)){_e(mt,H,He);continue}nn=QA(Se,hn,wt,nn),nn!==ru&&JA(H,mt,wt,nn)}}Qn(G.afterSanitizeAttributes,H,null)},rl=function(H){let q=null;const re=$b(H);for(Qn(G.beforeSanitizeShadowDOM,H,null);q=re.nextNode();)if(Qn(G.uponSanitizeShadowNode,q,null),Vb(q,H),Bb(q),zs(q.content)&&rl(q.content),N(q)===mn.element){const ve=_(q);zs(ve)&&(nu(ve),rl(ve))}Qn(G.afterSanitizeShadowDOM,H,null)},nu=function(H){const q=[{node:H,shadow:null}];for(;q.length>0;){const re=q.pop();if(re.shadow){rl(re.shadow);continue}const ve=re.node,He=N(ve)===mn.element,mt=y(ve);if(mt)for(let wt=mt.length-1;wt>=0;--wt)q.push({node:mt[wt],shadow:null});if(He){const wt=S?S(ve):null;if(typeof wt=="string"&&xt(wt)==="template"){const fn=ve.content;zs(fn)&&q.push({node:fn,shadow:null})}}if(He){const wt=_(ve);zs(wt)&&q.push({node:null,shadow:wt},{node:wt,shadow:null})}}};return t.sanitize=function(ce){let H=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},q=null,re=null,ve=null,Se=null;if(Ut=!ce,Ut&&(ce=""),typeof ce!="string"&&!Qo(ce)&&(ce=_y(ce),typeof ce!="string"))throw Er("dirty is not a string, aborting");if(!t.isSupported)return ce;pt?(ie=Ge,fe=te):Fs(H),(G.uponSanitizeElement.length>0||G.uponSanitizeAttribute.length>0)&&(ie=pn(ie)),G.uponSanitizeAttribute.length>0&&(fe=pn(fe)),t.removed=[];const He=qe&&typeof ce!="string"&&Qo(ce);if(He){KA(ce);const fn=C(ce);if(typeof fn=="string"){const hn=xt(fn);if(!ie[hn]||Ce[hn])throw ye(ce),Er("root node is forbidden and cannot be sanitized in-place")}if(tl(ce))throw ye(ce),Er("root node is clobbered and cannot be sanitized in-place");try{nu(ce)}catch(hn){throw ye(ce),hn}}else if(Qo(ce))q=Pb(""),re=q.ownerDocument.importNode(ce,!0),re.nodeType===mn.element&&re.nodeName==="BODY"||re.nodeName==="HTML"?q=re:q.appendChild(re),nu(re);else{if(!we&&!nt&&!We&&ce.indexOf("<")===-1)return w&&ke?A(ce):ce;if(q=Pb(ce),!q)return we?null:ke?E:""}q&&pe&&Zn(q.firstChild);const mt=He?ce:q;try{const fn=$b(mt);for(;ve=fn.nextNode();)Vb(ve,mt),Bb(ve),zs(ve.content)&&rl(ve.content)}catch(fn){throw He&&(ye(ce),_r(t.removed,hn=>{hn.element&&Ve(hn.element)})),fn}if(He)return _r(t.removed,fn=>{fn.element&&Ve(fn.element)}),nt&&tu(ce),ce;if(we){if(nt&&tu(q),xe)for(Se=Y.call(q.ownerDocument);q.firstChild;)Se.appendChild(q.firstChild);else Se=q;return(fe.shadowroot||fe.shadowrootmode)&&(Se=W.call(r,Se,!0)),Se}let wt=We?q.outerHTML:q.innerHTML;return We&&ie["!doctype"]&&q.ownerDocument&&q.ownerDocument.doctype&&q.ownerDocument.doctype.name&&Kt($y,q.ownerDocument.doctype.name)&&(wt=" +`+wt),nt&&(wt=el(wt)),w&&ke?A(wt):wt},t.setConfig=function(){let ce=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Fs(ce),pt=!0,Ge=ie,te=fe},t.clearConfig=function(){ar=null,pt=!1,Ge=null,te=null,w=T,E=""},t.isValidAttribute=function(ce,H,q){ar||Fs({});const re=xt(ce),ve=xt(H);return Hb(re,ve,q)},t.addHook=function(ce,H){typeof H=="function"&&sn(G,ce)&&Hs(G[ce],H)},t.removeHook=function(ce,H){if(sn(G,ce)){if(H!==void 0){const q=yy(G[ce],H);return q===-1?void 0:vy(G[ce],q,1)[0]}return bu(G[ce])}},t.removeHooks=function(ce){sn(G,ce)&&(G[ce]=[])},t.removeAllHooks=function(){G=Tu()},t}var Wy=Au();const kl=({content:e,text:t,isHtml:n=!0,className:r="",purifyConfig:s,id:o,editorAttrs:i})=>{const a=t??e??"";if(!a||a.trim()==="")return null;if(!n){const u=` whitespace-pre-wrap text-gray-900 dark:text-gray-100 font-sans ${r} - `.trim().replace(/\s+/g," ");return h.jsx(I,{className:u,id:o,...i,children:a})}const l={FORBID_TAGS:["script","noscript","iframe","frame","frameset","object","embed","applet","portal","form","input","textarea","select","button","style","link","meta","base","body","head","html","title","svg","math","audio","video","source","track","canvas","details","dialog","plaintext","xmp","listing","marquee","noframes","noembed","template","slot"],FORBID_ATTR:["onerror","onload","onclick","onmouseover","onfocus","onblur","ontoggle","oncanplay","onloadstart","formaction","xlink:href","action"],ALLOW_DATA_ATTR:!0,ADD_ATTR:["target"]},c=v.useMemo(()=>{const u=s?{...l,...s,FORBID_TAGS:[...l.FORBID_TAGS,...s.FORBID_TAGS||[]],FORBID_ATTR:[...l.FORBID_ATTR,...s.FORBID_ATTR||[]]}:l;return Ub.sanitize(a,u).replace(/]*?)href=["']([^"']+)["']([^>]*?)>/gi,(g,m,p,y)=>(p.startsWith("http://")||p.startsWith("https://"))&&!g.includes("rel=")?``:g)},[a,s]),d=` + `.trim().replace(/\s+/g," ");return h.jsx(I,{className:u,id:o,...i,children:a})}const l={FORBID_TAGS:["script","noscript","iframe","frame","frameset","object","embed","applet","portal","form","input","textarea","select","button","style","link","meta","base","body","head","html","title","svg","math","audio","video","source","track","canvas","details","dialog","plaintext","xmp","listing","marquee","noframes","noembed","template","slot"],FORBID_ATTR:["onerror","onload","onclick","onmouseover","onfocus","onblur","ontoggle","oncanplay","onloadstart","formaction","xlink:href","action"],ALLOW_DATA_ATTR:!0,ADD_ATTR:["target"]},c=v.useMemo(()=>{const u=s?{...l,...s,FORBID_TAGS:[...l.FORBID_TAGS,...s.FORBID_TAGS||[]],FORBID_ATTR:[...l.FORBID_ATTR,...s.FORBID_ATTR||[]]}:l;return Wy.sanitize(a,u).replace(/]*?)href=["']([^"']+)["']([^>]*?)>/gi,(g,m,p,y)=>(p.startsWith("http://")||p.startsWith("https://"))&&!g.includes("rel=")?``:g)},[a,s]),d=` prose dark:prose-invert max-w-none prose-p:my-2 prose-headings:font-bold prose-headings:mt-6 prose-headings:mb-4 @@ -35,67 +36,67 @@ var SirsoftAdminBasic=(function(R,h,v,Dn){"use strict";var GT=Object.definePrope [&_tr:hover]:bg-gray-50 dark:[&_tr:hover]:bg-gray-700/50 after:content-[''] after:block after:clear-both ${r} - `.trim().replace(/\s+/g," ");return h.jsx(I,{className:d,dangerouslySetInnerHTML:{__html:c},id:o,...i})},Uo=window.G7Core?.createLogger?.("Comp:DataGrid")??{log:(...e)=>console.log("[Comp:DataGrid]",...e),warn:(...e)=>console.warn("[Comp:DataGrid]",...e),error:(...e)=>console.error("[Comp:DataGrid]",...e)},Ur=(e,t)=>window.G7Core?.t?.(e,t)??e,Bb={Div:I,Span:Q,Button:oe,Icon:re,Checkbox:Cn,P:yt,A:Fr,Label:on,Input:wt,H1:Fa,H2:er,H3:$r,H4:Ad,Img:kn,Select:Vr,Textarea:Rn,Table:Ua,Thead:Ba,Tbody:ja,Tfoot:Wa,Tr:tr,Th:zr,Td:Jt,MultilingualInput:Ga,Toggle:Ya,StatusBadge:Fo,Badge:Vd,HtmlContent:el,ActionMenu:Cs},tl=()=>{const e=window.G7Core?.getComponentMap?.();return e&&Object.keys(e).length>0?e:Bb},nl=e=>{if(e==null)return"";if(typeof e=="string"||typeof e=="number"||typeof e=="boolean")return String(e);if(Array.isArray(e))return e.map(t=>nl(t)).join(", ");if(typeof e=="object"){if(v.isValidElement(e))return e;if(Object.keys(e).length===0)return"";try{return JSON.stringify(e)}catch{return Uo.warn("객체를 문자열로 변환할 수 없습니다:",e),"[Object]"}}return String(e)},Jd=(e,t)=>{if(!e)return!0;const n=window.G7Core;return typeof n?.evaluateCondition=="function"?n.evaluateCondition(e,{row:t,item:t,$item:t}):(Uo.warn("G7Core.evaluateCondition 미노출 — subRow 조건을 평가할 수 없습니다:",e),!0)},Br=(e,t,n,r="",s)=>{const o=window.G7Core;if(o?.renderItemChildren){const i={row:t,value:n,$value:n};return o.renderItemChildren(e,i,tl(),r,s?{componentContext:s}:void 0)}return Uo.warn("G7Core.renderItemChildren을 사용할 수 없습니다."),null},Rd=(e,t,n)=>e?!e.includes("{{")&&!e.includes("$t:")?e:Br([{type:"basic",name:"Span",text:e}],{},null,t,n):"",rl=(e,t,n="",r)=>{const s=window.G7Core;if(s?.renderItemChildren){const o={row:t,$value:t};return s.renderItemChildren(e,o,tl(),n,r?{componentContext:r}:void 0)}return Uo.warn("G7Core.renderItemChildren을 사용할 수 없습니다."),null},jb=({id:e,columns:t,data:n,sortable:r=!0,pagination:s=!1,pageSize:o=10,onRowClick:i,className:a="",style:l,sortField:c,sortDirection:d,onSortChange:u,selectable:f=!1,selectedIds:g=[],onSelectionChange:m,idField:p="id",selectionScope:y="free",showColumnSelector:b=!1,visibleColumns:_,onColumnVisibilityChange:x,responsiveBreakpoint:E=768,cardRenderer:S,rowActions:w,onRowAction:N,alwaysShowPagination:C=!1,serverSidePagination:k=!1,serverCurrentPage:M,serverTotalPages:T,serverHasMorePages:L,onPageChange:P,prevText:F,nextText:D,columnSelectorText:A,emptyMessage:O,actionsColumnHeader:V,requiredText:H,selectedCountText:W,showFirstLast:j=!0,expandable:U=!1,expandedRowIds:B,onExpandChange:G,expandChildren:z,expandedRowRender:K,expandColumnWidth:Y="48px",expandIconExpanded:Z=de.ChevronDown,expandIconCollapsed:ee=de.ChevronRight,expandConditionField:te,dynamicColumns:ce,dynamicColumnsInsertAfter:J,expandContext:he,__componentContext:le,subRowChildren:ae,subRowCondition:Se,subRowClassName:ue="px-6 py-2 bg-gray-50 dark:bg-gray-900",subRowRender:pe,footerCells:we,footerClassName:He="bg-gray-50 dark:bg-gray-800/50 font-medium",footerCardChildren:se,editorAttrs:Oe})=>{const Le=F||void 0,Ie=D||void 0,Ue=A??Ur("common.column_selector"),et=O??Ur("common.no_data"),bt=V??Ur("common.actions"),Ge=H??Ur("common.required"),ft=W??Ur("common.selected_count"),Be=q=>W===void 0?Ur("common.selected_count",{count:q}):W.replace(/\{\{count\}\}/g,String(q)).replace(/\{count\}/g,String(q)),ne=window.G7Core,fe=ne?.useControllableState,xe=ne?.shallowArrayEqual,[ge,be]=fe?fe(c,null):[c??null,()=>{}],[Ve,De]=fe?fe(d,"asc"):[d??"asc",()=>{}],[$e,Me]=v.useState(1),[qe,ot]=fe?fe(B,[],G,{isEqual:xe}):[B??[],()=>{}],[ye,Ce]=v.useState(!1),Fe=v.useRef(null),nt=ne?.useResponsive,pt=nt?.(),it=pt?pt.width{if(!ce||!Array.isArray(ce)||ce.length===0)return t;if(J){const q=t.findIndex(me=>me.field===J);if(q!==-1)return[...t.slice(0,q+1),...ce,...t.slice(q+1)]}return[...t,...ce]},[t,ce,J]),[Ot,ht]=v.useState(()=>_&&_.length>0?_:t.filter(q=>!q.hidden).map(q=>q.field));v.useEffect(()=>{_&&_.length>0&&ht(_)},[_]);const Qt=v.useRef("");v.useEffect(()=>{const q=t.map(me=>me.field).join(",");Qt.current&&q!==Qt.current&&(!_||_.length===0)&&ht(t.filter(me=>!me.hidden).map(me=>me.field)),Qt.current=q},[t,_]);const Gt=v.useRef([]),mt=v.useRef(null);v.useEffect(()=>{if(ce&&ce.length>0){const q=ce.map(ct=>ct.field);if(mt.current===null&&(mt.current=_!==void 0&&_.length>0,mt.current)){Gt.current=q;return}const me=Gt.current,Te=q.filter(ct=>!me.includes(ct));if(Te.length>0){const ct=Te.filter(ze=>!Ot.includes(ze));if(ct.length>0){const ze=[...Ot,...ct];ht(ze),x?.(ze)}}Gt.current=q}},[ce]),v.useEffect(()=>{k||Me(1)},[n,k]),v.useEffect(()=>{const q=me=>{Fe.current&&!Fe.current.contains(me.target)&&Ce(!1)};return ye&&document.addEventListener("mousedown",q),()=>document.removeEventListener("mousedown",q)},[ye]);const St=v.useMemo(()=>!b&&(!_||_.length===0)?rt.filter(q=>!q.hidden):rt.filter(q=>Ot.includes(q.field)),[rt,Ot,b,_]),xn=r&&!(k&&!u),Vt=v.useMemo(()=>!ge||!r||!n?n||[]:u||k?n:[...n].sort((q,me)=>{const Te=q[ge],ct=me[ge];if(Te===ct)return 0;const ze=Te>ct?1:-1;return Ve==="asc"?ze:-ze}),[n,ge,Ve,r,u,k]),Ze=v.useMemo(()=>{if(k||!s)return Vt;const q=($e-1)*o,me=q+o;return Vt.slice(q,me)},[Vt,$e,o,s,k]),jn=k?M||1:$e,dn=k?T??null:Math.ceil((Vt?.length||0)/o),Io=C||(dn??0)>1||L===!0||jn>1,Lo=v.useCallback(q=>{k&&P?P(q):Me(q)},[k,P]),La=q=>{if(!xn||t.find(ct=>ct.field===q)?.sortable===!1)return;const Te=ge===q&&Ve==="asc"?"desc":"asc";be(q),De(Te),u?.(q,Te)},Pa=v.useCallback(()=>{if(!m||!Ze)return;const q=Ze.map(Te=>Te[p]);if(q.every(Te=>g.includes(Te)))m(g.filter(Te=>!q.includes(Te)));else{const Te=[...new Set([...g,...q])];m(Te)}},[Ze,g,m,p]),$a=v.useCallback(q=>{m&&(g.includes(q)?m(g.filter(me=>me!==q)):m([...g,q]))},[g,m]);v.useEffect(()=>{if(y!=="page"||!m||g.length===0)return;const q=new Set((Ze??[]).map(Te=>Te[p])),me=g.filter(Te=>q.has(Te));me.length!==g.length&&m(me)},[y,f,Ze,g,m,p]);const ke=v.useCallback(q=>{if(rt.find(ct=>ct.field===q)?.required)return;const Te=Ot.includes(q)?Ot.filter(ct=>ct!==q):[...Ot,q];ht(Te),x?.(Te)},[rt,Ot,x]),X=v.useCallback((q,me)=>{N?.(q,me)},[N]),ie=v.useCallback(q=>w?w.map(me=>{let Te=me.disabled??!1;if(me.disabledField&&!Te){const ct=me.disabledField.split(".");let ze=q;for(const WT of ct)ze=ze?.[WT];ze||(Te=!0)}return{...me,disabled:Te,onClick:()=>X(me.id,q)}}):[],[w,X]),ve=v.useCallback(q=>{if(!te)return!0;const me=q[te];return Array.isArray(me)?me.length>0:!!me},[te]),st=v.useCallback(q=>{const me=qe.includes(q)?qe.filter(Te=>Te!==q):[...qe,q];fe?ot(me):G&&G(me)},[qe,G,fe,ot]),Tt=v.useCallback(q=>qe.includes(q),[qe]),_t=v.useCallback(q=>K?K(q):z&&z.length>0&&ne?.renderExpandContent?ne.renderExpandContent({children:z,row:q,expandContext:he,componentContext:le,componentMap:tl(),keyPrefix:`expand-${q[p]}`}):null,[K,z,p,he,le,le?.state]),Yt=v.useMemo(()=>!Ze||Ze.length===0?!1:Ze.every(q=>g.includes(q[p])),[Ze,g,p]),wn=v.useMemo(()=>{if(!Ze||Ze.length===0)return!1;const q=Ze.filter(me=>g.includes(me[p])).length;return q>0&&q{const Te=q[p],ct=Tt(Te);return h.jsxs(I,{className:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg p-4 mb-4",children:[h.jsxs(I,{className:"flex items-start justify-between",children:[U&&ve(q)&&h.jsx(oe,{onClick:()=>st(Te),className:"p-1.5 rounded-md hover:bg-gray-100 dark:hover:bg-gray-600 transition-colors mr-2","aria-label":ct?"Collapse card":"Expand card",children:h.jsx(re,{name:ct?Z:ee,className:"w-4 h-4 text-gray-500 dark:text-gray-400"})}),f&&h.jsx(Cn,{checked:g.includes(q[p]),onChange:()=>$a(q[p]),className:"w-4 h-4 text-blue-600 border-gray-300 dark:border-gray-600 rounded mr-3 mt-1"}),h.jsx(I,{className:"flex-1",children:h.jsx(I,{className:"grid grid-cols-2 gap-x-4 gap-y-2",children:me.map(ze=>h.jsxs(I,{className:"min-w-0",children:[h.jsx(Q,{className:"text-xs font-medium text-gray-500 dark:text-gray-400 uppercase",children:ze.header}),h.jsx(I,{className:"text-sm text-gray-900 dark:text-gray-200 mt-0.5 break-words",children:ze.cellChildren&&ze.cellChildren.length>0?Br(ze.cellChildren,q,q[ze.field],`card-${q[p]}-${ze.field}`,le):ze.render?ze.render(q[ze.field],q):nl(q[ze.field])})]},ze.field))})}),w&&w.length>0&&h.jsx(I,{className:"ml-2",children:h.jsx(Cs,{items:ie(q),triggerLabel:"",triggerIconName:de.EllipsisHorizontal})})]}),U&&ct&&ve(q)&&h.jsx(I,{className:"mt-4 pt-4 border-t border-gray-200 dark:border-gray-700",children:_t(q)}),(ae&&ae.length>0||pe)&&Jd(Se,q)&&h.jsx(I,{className:ue?`mt-3 ${ue}`:"mt-3 pt-3 border-t border-gray-100 dark:border-gray-700",children:pe?pe(q):rl(ae,q,`card-subrow-${Te}`,le)})]})};return it?h.jsxs(I,{id:e,className:`w-full ${a}`,style:l,...Oe,children:[b&&h.jsx(I,{className:"mb-4 flex justify-end",children:h.jsxs(I,{ref:Fe,className:"relative",children:[h.jsxs(oe,{onClick:()=>Ce(!ye),className:"flex items-center gap-2 px-4 py-2 bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700",children:[h.jsx(re,{name:de.Cog,className:"w-4 h-4 text-gray-500 dark:text-gray-400"}),h.jsx(Q,{className:"text-sm text-gray-700 dark:text-gray-300",children:Ue})]}),ye&&h.jsx(I,{className:"absolute right-0 z-50 mt-2 w-64 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg",children:h.jsx(I,{className:"p-2 max-h-64 overflow-y-auto",children:rt.map(q=>h.jsxs(I,{className:`flex items-center gap-2 px-3 py-2 rounded hover:bg-gray-50 dark:hover:bg-gray-700 ${q.required?"opacity-50 cursor-not-allowed":"cursor-pointer"}`,onClick:()=>!q.required&&ke(q.field),children:[h.jsx(Cn,{checked:Ot.includes(q.field),disabled:q.required,onChange:()=>{},className:"w-4 h-4 text-blue-600 border-gray-300 dark:border-gray-600 rounded"}),h.jsxs(Q,{className:"text-sm text-gray-700 dark:text-gray-300",children:[q.header,q.required&&h.jsxs(Q,{className:"text-xs text-gray-500 dark:text-gray-400 ml-1",children:["(",Ge,")"]})]})]},q.field))})})]})}),f&&g.length>0&&ft&&h.jsx(I,{className:"mb-4 text-sm text-gray-600 dark:text-gray-400",children:Be(g.length)}),h.jsx(I,{id:e?`${e}__body`:void 0,children:Ze&&Ze.length>0?Ze.map((q,me)=>h.jsx(I,{children:S?S(q,St):Pr(q,St)},q[p]||me)):h.jsx(I,{className:"text-center py-8 text-gray-500 dark:text-gray-400",children:et})}),we&&we.length>0&&Ze&&Ze.length>0&&h.jsx(I,{className:`rounded-lg p-4 mt-2 ${He}`,children:se&&se.length>0?Br(se,{},null,"footer-card",le):h.jsx(I,{className:"space-y-1",children:we.filter(q=>q.text||q.children&&q.children.length>0).map((q,me)=>{const Te=St.find(ct=>ct.field===q.field);return h.jsxs(I,{className:"flex justify-between text-sm",children:[h.jsx(Q,{className:"text-gray-500 dark:text-gray-400",children:Te?.header||""}),h.jsx(Q,{className:q.className||"text-gray-900 dark:text-gray-100",children:q.children&&q.children.length>0?Br(q.children,{},null,`footer-mobile-${me}`,le):Rd(q.text,`footer-mobile-text-${me}`,le)})]},`footer-mobile-${me}`)})})}),s&&Io&&h.jsx(I,{className:"flex justify-center mt-4",children:h.jsx($o,{currentPage:jn,totalPages:dn,hasMorePages:k?L:void 0,onPageChange:Lo,showFirstLast:j,maxVisiblePages:5,prevText:Le,nextText:Ie})})]}):h.jsxs(I,{id:e,className:`w-full ${a}`,style:l,...Oe,children:[b&&h.jsx(I,{className:"mb-4 flex justify-end",children:h.jsxs(I,{ref:Fe,className:"relative",children:[h.jsxs(oe,{onClick:()=>Ce(!ye),className:"flex items-center gap-2 px-4 py-2 bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700",children:[h.jsx(re,{name:de.Cog,className:"w-4 h-4 text-gray-500 dark:text-gray-400"}),h.jsx(Q,{className:"text-sm text-gray-700 dark:text-gray-300",children:Ue})]}),ye&&h.jsx(I,{className:"absolute right-0 z-50 mt-2 w-64 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg",children:h.jsx(I,{className:"p-2 max-h-64 overflow-y-auto",children:rt.map(q=>h.jsxs(I,{className:`flex items-center gap-2 px-3 py-2 rounded hover:bg-gray-50 dark:hover:bg-gray-700 ${q.required?"opacity-50 cursor-not-allowed":"cursor-pointer"}`,onClick:()=>!q.required&&ke(q.field),children:[h.jsx(Cn,{checked:Ot.includes(q.field),disabled:q.required,onChange:()=>{},className:"w-4 h-4 text-blue-600 border-gray-300 dark:border-gray-600 rounded"}),h.jsxs(Q,{className:"text-sm text-gray-700 dark:text-gray-300",children:[q.header,q.required&&h.jsxs(Q,{className:"text-xs text-gray-500 dark:text-gray-400 ml-1",children:["(",Ge,")"]})]})]},q.field))})})]})}),f&&g.length>0&&ft&&h.jsx(I,{className:"mb-4 text-sm text-gray-600 dark:text-gray-400",children:Be(g.length)}),h.jsx(I,{id:e?`${e}__body`:void 0,className:"overflow-x-auto border border-gray-200 dark:border-gray-700 rounded-lg",children:h.jsxs(Ua,{className:"w-full",children:[h.jsx(Ba,{className:"bg-gray-50 dark:bg-gray-700",children:h.jsxs(tr,{children:[U&&h.jsx(zr,{className:"px-2 py-3",style:{width:Y}}),f&&h.jsx(zr,{className:"px-4 py-3 w-10",children:h.jsx(Cn,{checked:Yt,ref:q=>{q&&(q.indeterminate=wn)},onChange:Pa,className:"w-4 h-4 text-blue-600 border-gray-300 dark:border-gray-600 rounded"})}),St.map(q=>h.jsxs(zr,{className:`px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider ${xn&&q.sortable!==!1?"cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-600":""}`,style:{width:q.width,minWidth:q.width},onClick:xn?()=>La(q.field):void 0,children:[q.header,ge===q.field&&h.jsx(Q,{className:"ml-1",children:Ve==="asc"?"↑":"↓"})]},q.field)),w&&w.length>0&&h.jsx(zr,{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider w-24",children:bt})]})}),h.jsx(ja,{className:`bg-white dark:bg-gray-800 ${ue?"":"divide-y divide-gray-200 dark:divide-gray-700"}`,children:Ze&&Ze.length>0?Ze.map((q,me)=>{const Te=q[p]||me,ct=Tt(Te);return h.jsxs(v.Fragment,{children:[h.jsxs(tr,{className:`${i?"cursor-pointer":""} hover:bg-gray-50 dark:hover:bg-gray-700 ${g.includes(q[p])?"bg-blue-50 dark:bg-blue-900/20":""} ${ue&&me>0?"border-t border-gray-200 dark:border-gray-700":""}`,onClick:()=>i?.(q),children:[U&&h.jsx(Jt,{className:"px-2 py-4 text-center",onClick:ze=>ze.stopPropagation(),children:ve(q)?h.jsx(oe,{onClick:()=>st(Te),className:"p-1.5 rounded-md hover:bg-gray-100 dark:hover:bg-gray-600 transition-colors","aria-label":ct?"Collapse row":"Expand row",children:h.jsx(re,{name:ct?Z:ee,className:"w-4 h-4 text-gray-500 dark:text-gray-400"})}):null}),f&&h.jsx(Jt,{className:"px-4 py-4",onClick:ze=>ze.stopPropagation(),children:h.jsx(Cn,{checked:g.includes(q[p]),onChange:()=>$a(q[p]),className:"w-4 h-4 text-blue-600 border-gray-300 dark:border-gray-600 rounded"})}),St.map(ze=>h.jsx(Jt,{className:"px-6 py-4 align-top whitespace-nowrap text-sm text-gray-900 dark:text-gray-200",style:{width:ze.width,minWidth:ze.width},children:ze.cellChildren&&ze.cellChildren.length>0?Br(ze.cellChildren,q,q[ze.field],`${q[p]}-${ze.field}`,le):ze.render?ze.render(q[ze.field],q):nl(q[ze.field])},ze.field)),w&&w.length>0&&h.jsx(Jt,{className:"px-6 py-4 text-right",onClick:ze=>ze.stopPropagation(),children:h.jsx(Cs,{items:ie(q),triggerLabel:"",triggerIconName:de.EllipsisHorizontal,position:"right"})})]}),U&&ct&&ve(q)&&h.jsx(tr,{className:"bg-gray-50 dark:bg-gray-900",children:h.jsx(Jt,{colSpan:St.length+1+(f?1:0)+(w&&w.length>0?1:0),className:"px-6 py-4",children:_t(q)})}),(ae&&ae.length>0||pe)&&Jd(Se,q)&&h.jsx(tr,{className:ue?"!border-t-0":"",children:h.jsx(Jt,{colSpan:St.length+(U?1:0)+(f?1:0)+(w&&w.length>0?1:0),className:ue?"p-2":ue||"px-6 py-2 bg-gray-50 dark:bg-gray-900",children:ue?h.jsx(I,{className:ue,children:pe?pe(q):rl(ae,q,`subrow-${Te}`,le)}):pe?pe(q):rl(ae,q,`subrow-${Te}`,le)})})]},Te)}):h.jsx(tr,{children:h.jsx(Jt,{colSpan:St.length+(U?1:0)+(f?1:0)+(w&&w.length>0?1:0),className:"px-6 py-8 text-center text-gray-500 dark:text-gray-400",children:et})})}),we&&we.length>0&&Ze&&Ze.length>0&&h.jsx(Wa,{children:h.jsxs(tr,{className:He,children:[U&&h.jsx(Jt,{className:"px-2 py-4"}),f&&h.jsx(Jt,{className:"px-4 py-4"}),(()=>{const q=new Map(we.filter(me=>me.field).map(me=>[me.field,me]));return St.map(me=>{const Te=q.get(me.field);return Te?h.jsx(Jt,{className:`px-6 py-4 text-sm text-gray-900 dark:text-gray-200 ${Te.className||""}`,colSpan:Te.colSpan,style:{width:me.width,minWidth:me.width},children:Te.children&&Te.children.length>0?Br(Te.children,{},null,`footer-${me.field}`,le):Rd(Te.text,`footer-text-${me.field}`,le)},`footer-${me.field}`):h.jsx(Jt,{className:"px-6 py-4",style:{width:me.width,minWidth:me.width}},`footer-${me.field}`)})})(),w&&w.length>0&&h.jsx(Jt,{className:"px-6 py-4"})]})})]})}),s&&Io&&h.jsx(I,{className:"flex justify-center mt-4",children:h.jsx($o,{currentPage:jn,totalPages:dn,hasMorePages:k?L:void 0,onPageChange:Lo,showFirstLast:j,maxVisiblePages:5,prevText:Le,nextText:Ie})})]})},Wb=window.G7Core?.createLogger?.("Comp:CardGrid")??{log:(...e)=>console.log("[Comp:CardGrid]",...e),warn:(...e)=>console.warn("[Comp:CardGrid]",...e),error:(...e)=>console.error("[Comp:CardGrid]",...e)},Gb=(e,t)=>window.G7Core?.t?.(e,t)??e,Yb=()=>window.G7Core?.getComponentMap?.()||{},Kb=(e,t)=>{if(!e)return!0;const n=window.G7Core;return typeof n?.evaluateCondition=="function"?n.evaluateCondition(e,{row:t,item:t,$item:t}):(Wb.warn("G7Core.evaluateCondition 미노출 — 조건을 평가할 수 없습니다:",e),!0)},eu=(e,t,n,r,s)=>{const o=window.G7Core;if(e.name==="ActionMenu"){if(r&&r.length>0&&s)return{...e,props:{...e.props,items:r.map(i=>({...i,onClick:()=>s(i.id,t)}))}};if(e.actions&&Array.isArray(e.actions)){const i=e.props?.items||[],a=new Map(e.actions.map(c=>[c.id,c])),l=i.map(c=>{if(typeof c.onClick=="string"){const d=c.onClick,u=a.get(d);if(u&&o?.ActionDispatcher)return{...c,onClick:()=>{const f={...n};o.ActionDispatcher.dispatch(u,f)}}}return c});return{...e,props:{...e.props,items:l}}}}return e.children&&Array.isArray(e.children)?{...e,children:e.children.map(i=>eu(i,t,n,r,s))}:e},Xb=(e,t,n,r="",s,o)=>{const i=window.G7Core;if(i?.renderItemChildren){const a=e.filter(d=>{const u=d.condition||d.if;return u?Kb(u,t):!0}),l={row:t,$value:t,index:n},c=a.map(d=>eu(d,t,l,s,o));try{const d=Yb();return i.renderItemChildren(c,l,d,r)}catch{return h.jsxs(I,{className:"text-red-600 dark:text-red-400 p-4",children:[h.jsx(yt,{children:"컴포넌트 로드 실패"}),h.jsx(yt,{className:"text-sm",children:"[CardGrid] 데이터를 표시할 수 없습니다."})]})}}return null},sl=(e,t)=>{if(e.name==="Div"&&e.children&&e.children.length>0){const n=e.children.map((r,s)=>sl(r,`${t}-child-${s}`)).filter(Boolean);return h.jsx(I,{className:e.props?.className||"",children:n},t)}return h.jsx(I,{className:"h-4 bg-gray-200 dark:bg-gray-700 rounded w-full animate-pulse"},t)},tu=(e,t="skeleton")=>!e||e.length===0?null:e.map((n,r)=>{const s=`${t}-${n.id||n.name}-${r}`;return n.condition||n.if?null:(n.iteration,sl(n,s))}).filter(Boolean),qb=({data:e,cardColumns:t=[],gridColumns:n=3,gap:r=4,responsiveColumns:s,cardClassName:o="",idField:i="id",pagination:a=!0,pageSize:l=12,serverSidePagination:c=!1,serverCurrentPage:d,serverTotalPages:u,alwaysShowPagination:f=!1,onPageChange:g,paginationInfoText:m,rowActions:p,onRowAction:y,className:b="",style:_,emptyMessage:x,prevText:E,nextText:S,showSkeleton:w=!0,skeletonCount:N,skeletonCellChildren:C,id:k,editorAttrs:M})=>{const T=x??Gb("common.no_data"),L=t[0]?.cellChildren||[],[P,F]=v.useState(1);window.G7Core?.useResponsive?.();const A=c?d??1:P,O=c?u??1:Math.ceil((e?.length??0)/l),V=G=>{c?g?.(G):F(G)},H=v.useCallback((G,z)=>{y?.(G,z)},[y]),W=v.useMemo(()=>{if(!e)return[];if(!a||c)return e;const G=(P-1)*l,z=G+l;return e.slice(G,z)},[e,a,c,P,l]),j=v.useMemo(()=>{const G=[],z=s?.sm??1;G.push(`grid-cols-${z}`),s?.sm&&G.push(`sm:grid-cols-${s.sm}`);const K=s?.md??Math.min(n,2);G.push(`md:grid-cols-${K}`);const Y=s?.lg??n;return G.push(`lg:grid-cols-${Y}`),s?.xl&&G.push(`xl:grid-cols-${s.xl}`),G.join(" ")},[n,s]),U=v.useMemo(()=>w?C&&C.length>0?tu(C,"custom-skeleton"):L&&L.length>0?tu(L,"auto-skeleton"):null:null,[w,C,L]);if(!e){if(!w)return null;const G=N??n;return h.jsx(I,{className:`grid ${j} gap-${r} ${b}`,style:_,id:k,...M,children:Array.from({length:G}).map((z,K)=>h.jsx(I,{className:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg p-6 space-y-4",children:U},`skeleton-${K}`))})}if(W.length===0)return h.jsx(I,{className:b,style:_,id:k,...M,children:h.jsx(I,{className:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg p-12",children:h.jsx(yt,{className:"text-center text-gray-600 dark:text-gray-400",children:T})})});const B=a&&(f||O>1);return h.jsxs(I,{className:b,style:_,id:k,...M,children:[h.jsx(I,{className:`grid ${j} gap-${r}`,children:W.map((G,z)=>h.jsx(I,{className:o,children:Xb(L,G,z,`card-${z}`,p,H)},G[i]||z))}),B&&h.jsxs(I,{className:"mt-6 space-y-4 flex flex-col items-center",children:[h.jsx($o,{currentPage:A,totalPages:O,onPageChange:V,showFirstLast:!1,maxVisiblePages:5,prevText:E,nextText:S}),m&&h.jsx(I,{className:"text-sm text-gray-600 dark:text-gray-400 text-center",children:m})]})]})},Zb=(e,t)=>window.G7Core?.t?.(e,t)??e,Bo=({isOpen:e,onClose:t,title:n,titlePrefix:r,titleSuffix:s,closeOnBackdropClick:o=!0,closeOnOverlayClick:i,showCloseButton:a=!0,closeOnEscape:l=!0,children:c,width:d="500px",className:u="",style:f,__dataContext:g,__translationContext:m})=>{const p=i!==void 0?i:o,y=v.useRef(null),b=v.useRef(null);if(v.useEffect(()=>{const E=S=>{S.key==="Escape"&&e&&l&&t()};if(e&&l)return document.addEventListener("keydown",E),()=>document.removeEventListener("keydown",E)},[e,t,l]),v.useEffect(()=>{if(e&&y.current){b.current=document.activeElement;const E=y.current.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'),S=E[0],w=E[E.length-1];S?.focus();const N=C=>{C.key==="Tab"&&(C.shiftKey?document.activeElement===S&&(C.preventDefault(),w?.focus()):document.activeElement===w&&(C.preventDefault(),S?.focus()))};return document.addEventListener("keydown",N),()=>{document.removeEventListener("keydown",N),b.current?.focus()}}},[e]),v.useEffect(()=>{if(e)return document.body.style.overflow="hidden",()=>{document.body.style.overflow=""}},[e]),!e)return null;const _=f?.zIndex??50,x=(E,S)=>{if(!E||E.length===0)return null;const w=window.G7Core;if(!w)return null;const N=w.getDynamicRenderer?.();return N?E.map((C,k)=>h.jsx(N,{componentDef:C,dataContext:g||{},translationContext:m,registry:w.getComponentRegistry(),bindingEngine:w.getDataBindingEngine(),translationEngine:w.getTranslationEngine(),actionDispatcher:w.getActionDispatcher(),isRootRenderer:!1},`${S}-${k}`)):null};return h.jsxs(I,{className:"modal-wrapper",style:{zIndex:_},onClick:p?t:void 0,children:[h.jsx(I,{className:"modal-backdrop","aria-hidden":"true"}),h.jsxs(I,{ref:y,className:`modal-container ${u}`,style:{width:d,...f?{...f,zIndex:void 0}:{}},onClick:E=>E.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":n?"modal-title":void 0,children:[(n||r||s||a)&&h.jsxs(I,{className:"modal-header-row",children:[h.jsxs(I,{className:"flex-center gap-sm",children:[x(r,"title-prefix"),n&&h.jsx(I,{id:"modal-title",className:"modal-title",children:n}),x(s,"title-suffix")]}),a&&h.jsx(oe,{onClick:t,className:"modal-close-btn","aria-label":Zb("common.close_modal"),children:h.jsx("svg",{className:"icon-lg",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),h.jsx(I,{className:"modal-body-content",children:c})]})]})},Qb=({label:e,items:t,onItemClick:n,position:r="bottom-left",variant:s="default",className:o="",style:i,id:a,editorAttrs:l})=>{const[c,d]=v.useState(!1),[u,f]=v.useState(-1),g=v.useRef(null),m=v.useRef(null),[p,y]=v.useState(r);v.useEffect(()=>{const x=E=>{g.current&&!g.current.contains(E.target)&&(d(!1),f(-1))};if(c)return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[c]),v.useEffect(()=>{const x=E=>{if(!c)return;const S=t.map((w,N)=>w.disabled?-1:N).filter(w=>w!==-1);switch(E.key){case"ArrowDown":E.preventDefault(),f(w=>{const C=(S.indexOf(w)+1)%S.length;return S[C]});break;case"ArrowUp":E.preventDefault(),f(w=>{const N=S.indexOf(w),C=N<=0?S.length-1:N-1;return S[C]});break;case"Enter":E.preventDefault(),u>=0&&!t[u].disabled&&b(t[u]);break;case"Escape":E.preventDefault(),d(!1),f(-1);break}};if(c)return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[c,u,t]),v.useEffect(()=>{if(c&&m.current&&g.current){const x=m.current.getBoundingClientRect(),E=g.current.getBoundingClientRect(),S=window.innerWidth,w=window.innerHeight,N=x.width||224,C=x.height||200;let k=r;r.includes("left")?E.left+N>S&&(k=k.replace("left","right")):E.right-N<0&&(k=k.replace("right","left")),r.includes("top")?E.top-C<0&&(k=k.replace("top","bottom")):E.bottom+C>w&&(k=k.replace("bottom","top")),y(k)}},[c,r]);const b=x=>{x.disabled||(x.onClick?.(),n?.(x.value,x),d(!1),f(-1))},_={"bottom-left":"dropdown-menu-bottom-left","bottom-right":"dropdown-menu-bottom-right","top-left":"dropdown-menu-top-left","top-right":"dropdown-menu-top-right"};return h.jsxs(I,{ref:g,className:`dropdown ${o}`,style:i,id:a,...l,children:[h.jsxs(oe,{onClick:()=>d(!c),className:s==="text"?"dropdown-trigger-text":"dropdown-trigger","aria-haspopup":"true","aria-expanded":c,children:[e,s!=="text"&&h.jsx("svg",{className:`inline-block ml-2 w-4 h-4 transition-transform ${c?"rotate-180":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),c&&h.jsx(I,{ref:m,className:`dropdown-menu ${_[p]}`,role:"menu","aria-orientation":"vertical",children:h.jsx(I,{className:"py-1",children:t.map((x,E)=>h.jsx(I,{className:`${x.disabled?"dropdown-item-disabled":"dropdown-item"} ${u===E?"dropdown-item-focused":""}`,onClick:()=>b(x),onMouseEnter:()=>!x.disabled&&f(E),role:"menuitem","aria-disabled":x.disabled,tabIndex:x.disabled?-1:0,children:x.label},x.value))})})]})},Jb=({imageUrl:e,imageAlt:t="",title:n,subtitle:r,description:s,price:o,originalPrice:i,discountRate:a,currency:l="₩",buttonText:c="자세히 보기",onButtonClick:d,className:u="",style:f,id:g,editorAttrs:m})=>{const p=a&&a>0,y=(o??0).toLocaleString(),b=i?.toLocaleString();return h.jsxs(I,{className:`rounded-lg bg-white dark:bg-gray-800 shadow-md hover:shadow-xl transition-shadow border border-gray-200 dark:border-gray-700 overflow-hidden ${u}`,style:f,id:g,...m,children:[e&&h.jsxs(I,{className:"relative w-full",children:[h.jsx(kn,{src:e,alt:t||n,className:"w-full h-64 object-cover"}),p&&h.jsx(I,{className:"absolute top-2 right-2 bg-red-500 text-white px-2 py-1 rounded-md",children:h.jsxs(Q,{className:"text-sm font-bold",children:["-",a,"%"]})})]}),h.jsxs(I,{className:"p-4",children:[r&&h.jsx($r,{className:"text-xs font-medium text-blue-600 dark:text-blue-400 uppercase tracking-wider mb-2",children:r}),h.jsx(er,{className:"text-xl font-bold text-gray-900 dark:text-white mb-2 line-clamp-2",children:n}),s&&h.jsx(yt,{className:"text-sm text-gray-600 dark:text-gray-400 mb-4 line-clamp-3",children:s}),h.jsxs(I,{className:"flex items-center gap-2 mb-4",children:[h.jsxs(Q,{className:"text-2xl font-bold text-gray-900 dark:text-white",children:[l,y]}),i&&h.jsxs(Q,{className:"text-sm text-gray-400 dark:text-gray-500 line-through",children:[l,b]})]}),c&&h.jsx(oe,{onClick:d,className:"w-full bg-blue-600 hover:bg-blue-700 dark:bg-blue-500 dark:hover:bg-blue-600 text-white font-medium py-2 px-4 rounded-lg transition-colors",children:c})]})]})},Rb=({value:e,label:t,change:n,changeLabel:r="전월 대비",iconName:s,trend:o="neutral",className:i="",style:a,id:l,editorAttrs:c})=>{const d=o==="up",u=o==="down",f=n!==void 0?Math.abs(n):0,g=d?"stats-trend-up":u?"stats-trend-down":"stats-trend-neutral",m=d?de.ArrowUp:u?de.ArrowDown:void 0;return h.jsxs(I,{className:`stat-card ${i}`,style:a,id:l,...c,children:[h.jsxs(I,{className:"flex-between mb-md",children:[s&&h.jsx(I,{className:"stats-icon stats-icon-blue",children:h.jsx(re,{name:s,className:"icon-lg"})}),n!==void 0&&h.jsxs(I,{className:`stats-change ${g}`,children:[m&&h.jsx(re,{name:m,className:"icon-sm"}),h.jsxs(Q,{className:"text-sm font-semibold",children:[f,"%"]})]})]}),h.jsx($r,{className:"stats-value-lg",children:typeof e=="number"?e.toLocaleString():e}),h.jsx(yt,{className:"stats-label",children:t}),n!==void 0&&r&&h.jsx(I,{className:"stats-sublabel",children:h.jsx(Q,{children:r})})]})},nu=()=>window.G7Core,ru=(e,t)=>nu()?.t?.(e,t)??e,ey=({name:e="search",placeholder:t,value:n,onChange:r,onSubmit:s,showButton:o=!1,suggestions:i=[],onSuggestionClick:a,showSuggestions:l=!1,className:c="",style:d,id:u,editorAttrs:f})=>{const g=t??ru("common.search_placeholder"),[m,p]=v.useState(""),[y,b]=v.useState(!1),_=v.useRef(null),x=v.useRef(""),E=n!==void 0?n:m,S=l&&y&&i.length>0&&E.length>0,w="w-64 pl-10 pr-4 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white text-sm",N=nu()?.style?.mergeClasses?.(w,c)??`${w} ${c}`;v.useEffect(()=>{n!==void 0&&(x.current=n)},[n]);const C=T=>{const L=T.target.value;p(L),r?.(T),x.current!==""&&L===""&&!T.nativeEvent.inputType&&setTimeout(()=>{const P=_.current?.querySelector("form");P&&P.requestSubmit()},0),x.current=L},k=T=>{p(T.text);const L={target:{value:T.text,name:e}};r?.(L),a?.(T),b(!1)},M=T=>{T.preventDefault(),s?.(T)};return h.jsxs(I,{ref:_,className:"relative",style:d,id:u,...f,children:[h.jsx(Ha,{onSubmit:M,className:"relative",children:h.jsxs(I,{className:`relative flex items-center ${o?"gap-2":""}`,children:[h.jsxs(I,{className:"relative flex-1",children:[h.jsx(I,{className:"absolute left-3 top-1/2 -translate-y-1/2 pointer-events-none",children:h.jsx(re,{name:de.Search,className:"w-5 h-5 text-gray-400 dark:text-gray-500"})}),h.jsx(wt,{type:"search",name:e,value:E,onChange:C,onFocus:()=>b(!0),onBlur:()=>setTimeout(()=>b(!1),200),placeholder:g,className:N})]}),o&&h.jsx(oe,{type:"submit",className:"px-4 py-2 bg-gray-800 dark:bg-gray-600 text-white rounded-lg hover:bg-gray-900 dark:hover:bg-gray-500 transition-colors text-sm font-medium cursor-pointer h-[42px]",children:ru("common.search")})]})}),S&&h.jsx(I,{className:"absolute z-10 w-full mt-2 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg max-h-64 overflow-y-auto",children:i.map(T=>h.jsx(I,{className:"px-4 py-3 hover:bg-gray-50 dark:hover:bg-gray-700 cursor-pointer border-b border-gray-100 dark:border-gray-700 last:border-b-0 transition-colors",onClick:()=>k(T),children:h.jsxs(I,{className:"flex items-center gap-2",children:[h.jsx(re,{name:de.Search,className:"w-4 h-4 text-gray-400 dark:text-gray-500"}),h.jsx(Q,{className:"text-sm text-gray-700 dark:text-gray-300",children:T.text})]})},T.id))})]})},ol=(e,t)=>window.G7Core?.t?.(e,t)??e,ty=({title:e,filters:t,onChange:n,onReset:r,showResetButton:s=!0,className:o="",style:i,id:a,editorAttrs:l})=>{const c=e??ol("common.filter"),d=(f,g)=>{n?.(f,g)},u=(f,g,m)=>{const p=t.find(b=>b.id===f);if(!p)return;const y=Array.isArray(p.value)?p.value:[];if(typeof g=="string"){const b=y.filter(x=>typeof x=="string"),_=m?[...b,g]:b.filter(x=>x!==g);n?.(f,_)}else{const b=y.filter(x=>typeof x=="number"),_=m?[...b,g]:b.filter(x=>x!==g);n?.(f,_)}};return h.jsxs(I,{className:`rounded-lg bg-white dark:bg-gray-800 shadow-md border border-gray-200 dark:border-gray-700 p-4 ${o}`,style:i,id:a,...l,children:[h.jsxs(I,{className:"flex items-center justify-between mb-4 pb-3 border-b border-gray-200 dark:border-gray-700",children:[h.jsx(Q,{className:"text-lg font-semibold text-gray-900 dark:text-white",children:c}),s&&r&&h.jsx(oe,{onClick:r,className:"text-sm text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 font-medium",children:ol("common.reset")})]}),h.jsx(I,{className:"space-y-4",children:t.map(f=>h.jsxs(I,{className:"space-y-2",children:[h.jsx(on,{className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:f.label}),f.type==="select"&&h.jsxs(Vr,{value:f.value,onChange:g=>d(f.id,g.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:ring-2 focus:ring-blue-500 dark:focus:ring-blue-400 focus:border-blue-500 dark:focus:border-blue-400 bg-white dark:bg-gray-700 text-gray-900 dark:text-white",children:[h.jsx("option",{value:"",children:ol("common.select_placeholder")}),f.options.map(g=>h.jsx("option",{value:g.value,children:g.label},g.id))]}),f.type==="checkbox"&&h.jsx(I,{className:"space-y-2",children:f.options.map(g=>{const m=Array.isArray(f.value)?f.value.some(p=>p===g.value):!1;return h.jsxs(on,{className:"flex items-center gap-2 cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-700 p-2 rounded-md transition-colors",children:[h.jsx(Cn,{checked:m,onChange:p=>u(f.id,g.value,p.target.checked),className:"w-4 h-4 text-blue-600 border-gray-300 dark:border-gray-600 rounded focus:ring-blue-500"}),h.jsx(Q,{className:"text-sm text-gray-700 dark:text-gray-300",children:g.label})]},g.id)})})]},f.id))})]})},ny=({tabs:e,activeTabId:t,onTabChange:n,variant:r="default",className:s="",style:o,mobileBreakpoint:i=768,id:a,editorAttrs:l})=>{const d=window.G7Core?.useResponsive,u=d?.(),f=u?u.width{!w.disabled&&w.id!==t&&n?.(w.id)},p=(w,N)=>{const C=w.key==="ArrowRight"?1:w.key==="ArrowLeft"?-1:0;let k=null;if(C!==0)for(let M=1;M<=e.length;M+=1){const T=(N+C*M+e.length*M)%e.length;if(!e[T]?.disabled){k=T;break}}else if(w.key==="Home")k=e.findIndex(M=>!M.disabled);else if(w.key==="End"){for(let M=e.length-1;M>=0;M-=1)if(!e[M]?.disabled){k=M;break}}k===null||k<0||(w.preventDefault(),g.current[k]?.focus(),m(e[k]))},y=w=>{const N=w.target.value,C=Number(N),k=typeof N=="string"&&N!==""&&!Number.isNaN(C)?C:N,M=e.find(T=>String(T.id)===String(k));M&&m(M)};if(f)return h.jsx(I,{className:s,style:o,id:a,...l,children:h.jsx(Vr,{value:t!==void 0?String(t):"",onChange:y,options:e.map(w=>({value:String(w.id),label:w.badge!==void 0?`${w.label} (${w.badge})`:w.label,disabled:w.disabled})),className:"w-full"})});const b=w=>{const N=w.id===t;if(w.disabled)return"tab-btn-base tab-btn-disabled";switch(r){case"pills":return N?"tab-btn-base tab-btn-pills-active":"tab-btn-base tab-btn-pills";case"underline":return N?"tab-btn-base tab-btn-underline-active":"tab-btn-base tab-btn-underline";case"default":default:return N?"tab-btn-base tab-btn-default-active":"tab-btn-base tab-btn-default"}},_=r==="underline"?"tab-nav-underline":"tab-nav-default",x=l?.["data-editor-path"],E=e.findIndex(w=>w.id===t),S=E>=0?E:e.findIndex(w=>!w.disabled);return h.jsx(Po,{className:`${_} ${s}`,style:o,role:"tablist","aria-orientation":"horizontal",id:a,...l,children:e.map((w,N)=>h.jsxs(oe,{ref:C=>{g.current[N]=C},type:"button",role:"tab","aria-selected":w.id===t,tabIndex:N===S?0:-1,onClick:()=>m(w),onKeyDown:C=>p(C,N),disabled:w.disabled,className:b(w),...x?{"data-editor-item-path":`${x}.props.tabs.${N}`}:{},children:[w.iconName&&h.jsx(re,{name:w.iconName,className:"w-4 h-4"}),h.jsx(Q,{children:w.label}),w.badge!==void 0&&h.jsx(I,{className:"flex items-center justify-center min-w-[20px] h-5 px-1.5 bg-red-500 dark:bg-red-600 text-white dark:text-white text-xs font-bold rounded-full",children:h.jsx(Q,{children:w.badge})})]},w.id))})},il=window.G7Core?.createLogger?.("Handler:ScrollToSection")??{log:(...e)=>console.log("[Handler:ScrollToSection]",...e),warn:(...e)=>console.warn("[Handler:ScrollToSection]",...e),error:(...e)=>console.error("[Handler:ScrollToSection]",...e)};async function su(e,t){const n=e.params||{},{targetId:r,offset:s=120,delay:o=100,scrollContainerId:i}=n;if(!r){il.warn("targetId is required");return}const a=await ry(r,o);if(!a){il.warn(`Element not found: ${r}`);return}const l=sy(a,i),c=oy(a,l,s);iy(l,c)}async function ry(e,t){await new Promise(s=>setTimeout(s,t));const n=10,r=50;for(let s=0;ssetTimeout(i,50)),o;await new Promise(i=>setTimeout(i,r))}return null}function sy(e,t){if(t){const o=document.getElementById(t);if(o&&ou(o))return o;il.warn(`Container '${t}' ${o?"has no scroll":"not found"}, trying auto-detect`)}let n=e.parentElement,r=0;const s=10;for(;n&&n!==document.body&&re.clientHeight}function oy(e,t,n){if(t===window||!("getBoundingClientRect"in t))return e.getBoundingClientRect().top+window.pageYOffset-n;{const r=t.getBoundingClientRect(),s=e.getBoundingClientRect();return t.scrollTop+(s.top-r.top)-n}}function iy(e,t){e===window||!("scrollTo"in e)?window.scrollTo({top:t,behavior:"smooth"}):e.scrollTo({top:t,behavior:"smooth"})}window.G7Core?.createLogger?.("Comp:TabNavigation");const ay=({tabs:e,activeTabId:t,className:n="bg-white dark:bg-gray-800 flex gap-2 border-b border-gray-200 dark:border-gray-700 px-6",style:r,activeClassName:s="tab-btn-base tab-btn-default-active",inactiveClassName:o="tab-btn-base tab-btn-default",sectionIdPrefix:i="tab_content_",scrollOffset:a=120,scrollDelay:l=100,onTabChange:c,enableScrollSpy:d=!1,scrollSpyOffset:u=80,scrollContainerId:f,id:g,editorAttrs:m})=>{const[p,y]=v.useState(t??(e.length>0?e[0].id:"")),_=window.G7Core?.useResponsive,x=_?.(),E=x?x.width<768:typeof window<"u"&&window.innerWidth<768,S=v.useRef(!1),w=v.useRef(null),N=v.useRef([]),C=P=>{if(d&&(S.current=!0,w.current&&clearTimeout(w.current)),P.onClick){if(P.onClick(P.id),!d)return}else if(c){if(c(P.id),!d)return}else y(P.id);const F=P.scrollOffset??a,D=P.scrollDelay??l;su({params:{targetId:`${i}${P.id}`,offset:F,delay:D,scrollContainerId:f}}),d&&(w.current=setTimeout(()=>{S.current=!1},D+500))},k=(P,F)=>{const D=P.key==="ArrowRight"?1:P.key==="ArrowLeft"?-1:0;let A=null;if(D!==0)for(let O=1;O<=e.length;O+=1){const V=(F+D*O+e.length*O)%e.length;if(!e[V]?.disabled){A=V;break}}else if(P.key==="Home")A=e.findIndex(O=>!O.disabled);else if(P.key==="End"){for(let O=e.length-1;O>=0;O-=1)if(!e[O]?.disabled){A=O;break}}A===null||A<0||(P.preventDefault(),N.current[A]?.focus(),C(e[A]))};v.useEffect(()=>{if(!d)return;const P=f?document.getElementById(f):null,F={root:P??null,rootMargin:`-${u}px 0px -30% 0px`,threshold:[0,.1,.2,.3,.4,.5,.6,.7,.8,.9,1]},D=new Map,A=()=>{const W=P,j=W?W.scrollTop:window.pageYOffset||document.documentElement.scrollTop,U=W?W.scrollHeight:document.documentElement.scrollHeight,B=W?W.clientHeight:document.documentElement.clientHeight;return j+B>=U-10},O=W=>{if(S.current)return;W.forEach(K=>{const Y=K.target.id;K.isIntersecting?D.set(Y,K.intersectionRatio):D.delete(Y)});let j=0,U="";D.forEach((K,Y)=>{K>j&&(j=K,U=Y)});const B=e[e.length-1],G=`${i}${B?.id}`,z=D.has(G);if(A()&&z&&B){y(B.id);return}if(U){const K=U.replace(i,""),Y=Number(K),Z=isNaN(Y)?K:Y;e.some(te=>te.id===Z)&&y(Z)}},V=()=>{},H=new IntersectionObserver(O,F);return e.forEach(W=>{const j=document.getElementById(`${i}${W.id}`);j&&H.observe(j)}),window.addEventListener("scroll",V,{passive:!0}),()=>{H.disconnect(),window.removeEventListener("scroll",V),w.current&&clearTimeout(w.current)}},[d,e,i,u,f]);const M=P=>{const F=P.target.value,D=Number(F),A=isNaN(D)?F:D,O=e.find(V=>V.id===A);O&&C(O)};if(E)return h.jsx(I,{className:"bg-white dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700 px-4 py-3",id:g,...m,children:h.jsx(Vr,{value:String(p),onChange:M,options:e.map(P=>({value:String(P.id),label:P.label,disabled:P.disabled})),className:"w-full"})});const T=e.findIndex(P=>P.id===p),L=T>=0?T:e.findIndex(P=>!P.disabled);return h.jsx(I,{className:n,style:r,role:"tablist","aria-orientation":"horizontal",id:g,...m,children:e.map((P,F)=>h.jsxs(oe,{ref:D=>{N.current[F]=D},type:"button",role:"tab","aria-selected":p===P.id,tabIndex:F===L?0:-1,className:p===P.id?s:o,disabled:P.disabled,onClick:()=>C(P),onKeyDown:D=>k(D,F),children:[P.iconName&&h.jsx(re,{name:P.iconName,size:"sm"}),h.jsx(Q,{children:P.label})]},P.id))})},ly=()=>window.G7Core,cy=({iconName:e,label:t,onClick:n,variant:r="primary",size:s="md",disabled:o=!1,className:i="",style:a,id:l,editorAttrs:c})=>{const d={sm:t?"px-3 py-1.5 text-sm":"w-8 h-8",md:t?"px-4 py-2 text-base":"w-10 h-10",lg:t?"px-5 py-2.5 text-lg":"w-12 h-12"},u={sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"},f={primary:"bg-blue-600 hover:bg-blue-700 text-white border-transparent",secondary:"bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 text-gray-700 dark:text-gray-300 border-gray-300 dark:border-gray-600",danger:"bg-red-600 hover:bg-red-700 text-white border-transparent",ghost:"bg-transparent hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-700 dark:text-gray-300 border-transparent",outline:"bg-transparent hover:bg-gray-50 dark:hover:bg-gray-700 text-gray-700 dark:text-gray-300 border-gray-300 dark:border-gray-600"},g="inline-flex items-center justify-center gap-2 font-medium rounded-lg border transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 dark:focus:ring-blue-400",m=o?"opacity-50 cursor-not-allowed":"",p=`${g} ${d[s]} ${f[r]} ${m}`,y=ly()?.style?.mergeClasses?.(p,i)??`${p} ${i}`;return h.jsxs(oe,{onClick:n,disabled:o,className:y,style:a,id:l,...c,children:[h.jsx(re,{name:e,className:u[s]}),t]})},dy=(e,t)=>window.G7Core?.t?.(e,t)??e,iu=({isOpen:e,onClose:t,title:n,content:r,actions:s=[],width:o="500px",closeOnOverlay:i=!0,showCloseButton:a=!0,className:l="",style:c})=>{const d=()=>{i&&t()},u={primary:"dialog-btn-primary",secondary:"dialog-btn-secondary",danger:"dialog-btn-danger",ghost:"dialog-btn-ghost"};return h.jsxs(Bo,{isOpen:e,onClose:d,width:o,className:l,style:c,children:[h.jsxs(I,{className:"dialog-header",children:[h.jsx(er,{className:"dialog-title",children:n}),a&&h.jsx(oe,{onClick:t,className:"dialog-close","aria-label":dy("common.close_dialog"),children:h.jsx(re,{name:de.Times,className:"icon-md"})})]}),h.jsx(I,{className:"dialog-body",children:r}),s.length>0&&h.jsx(I,{className:"dialog-footer",children:s.map((f,g)=>h.jsxs(oe,{onClick:f.onClick,disabled:f.disabled,className:u[f.variant||"primary"],children:[f.iconName&&h.jsx(re,{name:f.iconName,className:"icon-sm mr-2 inline-block"}),f.label]},g))})]})},al=(e,t)=>window.G7Core?.t?.(e,t)??e,au=({isOpen:e,onClose:t,title:n,message:r,confirmText:s,cancelText:o,onConfirm:i,onCancel:a,confirmButtonVariant:l="primary",cancelButtonVariant:c="secondary",width:d="500px",closeOnOverlay:u=!0,isLoading:f=!1,loadingText:g})=>{const m=s??al("common.confirm"),p=o??al("common.cancel"),y=g??al("common.loading"),b=()=>{i()},_=()=>{f||(a?.(),t())},x=()=>{f||t()},E={primary:"bg-blue-600 text-white hover:bg-blue-700",secondary:"bg-gray-200 dark:bg-gray-700 text-gray-800 dark:text-gray-200 hover:bg-gray-300 dark:hover:bg-gray-600",danger:"bg-red-600 text-white hover:bg-red-700",ghost:"bg-transparent text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700"};return h.jsxs(Bo,{isOpen:e,onClose:x,title:n,width:d,children:[h.jsx(I,{className:"py-2",children:typeof r=="string"?h.jsx(yt,{className:"text-gray-700 dark:text-gray-300",children:r}):r}),h.jsxs(I,{className:"flex justify-end gap-3 mt-6",children:[h.jsx(oe,{onClick:_,disabled:f,className:"px-4 py-2 bg-white dark:bg-gray-800 text-gray-700 dark:text-gray-300 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700 disabled:opacity-50 disabled:cursor-not-allowed",children:h.jsx(Q,{children:p})}),h.jsxs(oe,{onClick:b,disabled:f,className:`flex items-center gap-2 px-4 py-2 rounded-lg disabled:opacity-50 disabled:cursor-not-allowed ${E[l]}`,children:[f&&h.jsx(re,{name:de.Spinner,className:"w-4 h-4 animate-spin"}),h.jsx(Q,{children:f?y:m})]})]})]})},uy=(e,t)=>window.G7Core?.t?.(e,t)??e,fy=({isOpen:e,onClose:t,title:n,message:r,confirmText:s,onConfirm:o,confirmButtonVariant:i="primary",width:a="500px",closeOnOverlay:l=!0})=>{const u=[{label:s??uy("common.confirm"),onClick:()=>{o?.(),t()},variant:i}],f=typeof r=="string"?h.jsx(yt,{className:"text-gray-700 dark:text-gray-300",children:r}):r;return h.jsx(iu,{isOpen:e,onClose:t,title:n,content:f,actions:u,width:a,closeOnOverlay:l})},hy=(e,t)=>window.G7Core?.t?.(e,t)??e,gy={success:de.CheckCircle,error:de.XCircle,warning:de.ExclamationTriangle,info:de.InfoCircle},lu={success:{bg:"bg-green-50 dark:bg-green-900/20 border-green-200 dark:border-green-800",text:"text-green-800 dark:text-green-300"},error:{bg:"bg-red-50 dark:bg-red-900/20 border-red-200 dark:border-red-800",text:"text-red-800 dark:text-red-300"},warning:{bg:"bg-yellow-50 dark:bg-yellow-900/20 border-yellow-200 dark:border-yellow-800",text:"text-yellow-800 dark:text-yellow-300"},info:{bg:"bg-blue-50 dark:bg-blue-900/20 border-blue-200 dark:border-blue-800",text:"text-blue-800 dark:text-blue-300"}},py={"top-left":"top-4 left-4","top-center":"top-4 left-1/2 -translate-x-1/2","top-right":"top-4 right-4","bottom-left":"bottom-4 left-4","bottom-center":"bottom-4 left-1/2 -translate-x-1/2","bottom-right":"bottom-4 right-4"},my=({toasts:e,position:t="bottom-center",duration:n=3e3,onRemove:r})=>{const[s,o]=v.useState(new Map),i=v.useCallback(a=>{o(l=>{const c=new Map(l);return c.set(a,!1),c}),setTimeout(()=>{if(r)r(a);else{const l=window.G7Core;l?.state?.update&&l.state.update(c=>({toasts:(Array.isArray(c.toasts)?c.toasts:[]).filter(u=>u.id!==a)}))}},300)},[r]);return v.useEffect(()=>{!e||e.length===0||e.forEach(a=>{if(s.has(a.id))return;o(c=>{const d=new Map(c);return d.set(a.id,!0),d});const l=a.duration||n;l>0&&setTimeout(()=>{i(a.id)},l)})},[e,n,i,s]),!e||e.length===0?null:h.jsx(I,{className:`fixed z-[9999] flex flex-col gap-2 ${py[t]}`,"aria-live":"polite","aria-atomic":"true",children:e.map(a=>h.jsx(by,{toast:a,position:t,isVisible:s.get(a.id)??!0,onClose:()=>i(a.id)},a.id))})},by=({toast:e,position:t,isVisible:n,onClose:r})=>{const s=lu[e.type]||lu.info,o=e.icon?e.icon:gy[e.type],i=t.startsWith("bottom")?"translate-y-2":"-translate-y-2";return h.jsxs(I,{className:` + `.trim().replace(/\s+/g," ");return h.jsx(I,{className:d,dangerouslySetInnerHTML:{__html:c},id:o,...i})},ni=window.G7Core?.createLogger?.("Comp:DataGrid")??{log:(...e)=>console.log("[Comp:DataGrid]",...e),warn:(...e)=>console.warn("[Comp:DataGrid]",...e),error:(...e)=>console.error("[Comp:DataGrid]",...e)},ts=(e,t)=>window.G7Core?.t?.(e,t)??e,Gy={Div:I,Span:J,Button:le,Icon:ae,Checkbox:On,P:kt,A:qr,Label:gn,Input:Et,H1:sl,H2:cr,H3:Xr,H4:ou,Img:Nn,Select:Zr,Textarea:lr,Table:ll,Thead:cl,Tbody:dl,Tfoot:ul,Tr:dr,Th:Qr,Td:rn,MultilingualInput:fl,Toggle:hl,StatusBadge:ei,Badge:fu,HtmlContent:kl,ActionMenu:Vs},Cl=()=>{const e=window.G7Core?.getComponentMap?.();return e&&Object.keys(e).length>0?e:Gy},Sl=e=>{if(e==null)return"";if(typeof e=="string"||typeof e=="number"||typeof e=="boolean")return String(e);if(Array.isArray(e))return e.map(t=>Sl(t)).join(", ");if(typeof e=="object"){if(v.isValidElement(e))return e;if(Object.keys(e).length===0)return"";try{return JSON.stringify(e)}catch{return ni.warn("객체를 문자열로 변환할 수 없습니다:",e),"[Object]"}}return String(e)},Du=(e,t)=>{if(!e)return!0;const n=window.G7Core;return typeof n?.evaluateCondition=="function"?n.evaluateCondition(e,{row:t,item:t,$item:t}):(ni.warn("G7Core.evaluateCondition 미노출 — subRow 조건을 평가할 수 없습니다:",e),!0)},ns=(e,t,n,r="",s)=>{const o=window.G7Core;if(o?.renderItemChildren){const i={row:t,value:n,$value:n};return o.renderItemChildren(e,i,Cl(),r,s?{componentContext:s}:void 0)}return ni.warn("G7Core.renderItemChildren을 사용할 수 없습니다."),null},Iu=(e,t,n)=>e?!e.includes("{{")&&!e.includes("$t:")?e:ns([{type:"basic",name:"Span",text:e}],{},null,t,n):"",_l=(e,t,n="",r)=>{const s=window.G7Core;if(s?.renderItemChildren){const o={row:t,$value:t};return s.renderItemChildren(e,o,Cl(),n,r?{componentContext:r}:void 0)}return ni.warn("G7Core.renderItemChildren을 사용할 수 없습니다."),null},Yy=({id:e,columns:t,data:n,sortable:r=!0,pagination:s=!1,pageSize:o=10,onRowClick:i,className:a="",style:l,sortField:c,sortDirection:d,onSortChange:u,selectable:f=!1,selectedIds:g=[],onSelectionChange:m,idField:p="id",selectionScope:y="free",showColumnSelector:b=!1,visibleColumns:_,onColumnVisibilityChange:x,responsiveBreakpoint:M=768,cardRenderer:S,rowActions:k,onRowAction:N,alwaysShowPagination:C=!1,serverSidePagination:w=!1,serverCurrentPage:E,serverTotalPages:T,serverHasMorePages:P,onPageChange:L,prevText:F,nextText:A,columnSelectorText:D,emptyMessage:O,actionsColumnHeader:z,requiredText:U,selectedCountText:j,showFirstLast:Y=!0,expandable:B=!1,expandedRowIds:W,onExpandChange:G,expandChildren:V,expandedRowRender:X,expandColumnWidth:K="48px",expandIconExpanded:Q=he.ChevronDown,expandIconCollapsed:ne=he.ChevronRight,expandConditionField:se,dynamicColumns:ue,dynamicColumnsInsertAfter:ee,expandContext:me,__componentContext:ie,subRowChildren:de,subRowCondition:fe,subRowClassName:be="px-6 py-2 bg-gray-50 dark:bg-gray-900",subRowRender:ge,footerCells:Ce,footerClassName:je="bg-gray-50 dark:bg-gray-800/50 font-medium",footerCardChildren:oe,editorAttrs:Te})=>{const Pe=F||void 0,Fe=A||void 0,Ke=D??ts("common.column_selector"),nt=O??ts("common.no_data"),dt=z??ts("common.actions"),We=U??ts("common.required"),pt=j??ts("common.selected_count"),Ge=Z=>j===void 0?ts("common.selected_count",{count:Z}):j.replace(/\{\{count\}\}/g,String(Z)).replace(/\{count\}/g,String(Z)),te=window.G7Core,pe=te?.useControllableState,we=te?.shallowArrayEqual,[xe,ke]=pe?pe(c,null):[c??null,()=>{}],[Be,Le]=pe?pe(d,"asc"):[d??"asc",()=>{}],[ze,Ie]=v.useState(1),[qe,Re]=pe?pe(W,[],G,{isEqual:we}):[W??[],()=>{}],[Ne,Oe]=v.useState(!1),Ue=v.useRef(null),lt=te?.useResponsive,vt=lt?.(),ut=vt?vt.width{if(!ue||!Array.isArray(ue)||ue.length===0)return t;if(ee){const Z=t.findIndex(ye=>ye.field===ee);if(Z!==-1)return[...t.slice(0,Z+1),...ue,...t.slice(Z+1)]}return[...t,...ue]},[t,ue,ee]),[St,et]=v.useState(()=>_&&_.length>0?_:t.filter(Z=>!Z.hidden).map(Z=>Z.field));v.useEffect(()=>{_&&_.length>0&&et(_)},[_]);const Lt=v.useRef("");v.useEffect(()=>{const Z=t.map(ye=>ye.field).join(",");Lt.current&&Z!==Lt.current&&(!_||_.length===0)&&et(t.filter(ye=>!ye.hidden).map(ye=>ye.field)),Lt.current=Z},[t,_]);const Ut=v.useRef([]),Gt=v.useRef(null);v.useEffect(()=>{if(ue&&ue.length>0){const Z=ue.map(ct=>ct.field);if(Gt.current===null&&(Gt.current=_!==void 0&&_.length>0,Gt.current)){Ut.current=Z;return}const ye=Ut.current,_e=Z.filter(ct=>!ye.includes(ct));if(_e.length>0){const ct=_e.filter(Ve=>!St.includes(Ve));if(ct.length>0){const Ve=[...St,...ct];et(Ve),x?.(Ve)}}Ut.current=Z}},[ue]),v.useEffect(()=>{w||Ie(1)},[n,w]),v.useEffect(()=>{const Z=ye=>{Ue.current&&!Ue.current.contains(ye.target)&&Oe(!1)};return Ne&&document.addEventListener("mousedown",Z),()=>document.removeEventListener("mousedown",Z)},[Ne]);const Yt=v.useMemo(()=>!b&&(!_||_.length===0)?ot.filter(Z=>!Z.hidden):ot.filter(Z=>St.includes(Z.field)),[ot,St,b,_]),Mn=r&&!(w&&!u),Bt=v.useMemo(()=>!xe||!r||!n?n||[]:u||w?n:[...n].sort((Z,ye)=>{const _e=Z[xe],ct=ye[xe];if(_e===ct)return 0;const Ve=_e>ct?1:-1;return Be==="asc"?Ve:-Ve}),[n,xe,Be,r,u,w]),tt=v.useMemo(()=>{if(w||!s)return Bt;const Z=(ze-1)*o,ye=Z+o;return Bt.slice(Z,ye)},[Bt,ze,o,s,w]),zn=w?E||1:ze,Xo=w?T??null:Math.ceil((Bt?.length||0)/o),Sr=C||(Xo??0)>1||P===!0||zn>1,qa=v.useCallback(Z=>{w&&L?L(Z):Ie(Z)},[w,L]),Jd=Z=>{if(!Mn||t.find(ct=>ct.field===Z)?.sortable===!1)return;const _e=xe===Z&&Be==="asc"?"desc":"asc";ke(Z),Le(_e),u?.(Z,_e)},xt=v.useCallback(()=>{if(!m||!tt)return;const Z=tt.map(_e=>_e[p]);if(Z.every(_e=>g.includes(_e)))m(g.filter(_e=>!Z.includes(_e)));else{const _e=[...new Set([...g,...Z])];m(_e)}},[tt,g,m,p]),ar=v.useCallback(Z=>{m&&(g.includes(Z)?m(g.filter(ye=>ye!==Z)):m([...g,Z]))},[g,m]);v.useEffect(()=>{if(y!=="page"||!m||g.length===0)return;const Z=new Set((tt??[]).map(_e=>_e[p])),ye=g.filter(_e=>Z.has(_e));ye.length!==g.length&&m(ye)},[y,f,tt,g,m,p]);const Za=v.useCallback(Z=>{if(ot.find(ct=>ct.field===Z)?.required)return;const _e=St.includes(Z)?St.filter(ct=>ct!==Z):[...St,Z];et(_e),x?.(_e)},[ot,St,x]),qo=v.useCallback((Z,ye)=>{N?.(Z,ye)},[N]),Fs=v.useCallback(Z=>k?k.map(ye=>{let _e=ye.disabled??!1;if(ye.disabledField&&!_e){const ct=ye.disabledField.split(".");let Ve=Z;for(const Ra of ct)Ve=Ve?.[Ra];Ve||(_e=!0)}return{...ye,disabled:_e,onClick:()=>qo(ye.id,Z)}}):[],[k,qo]),Kr=v.useCallback(Z=>{if(!se)return!0;const ye=Z[se];return Array.isArray(ye)?ye.length>0:!!ye},[se]),Zo=v.useCallback(Z=>{const ye=qe.includes(Z)?qe.filter(_e=>_e!==Z):[...qe,Z];pe?Re(ye):G&&G(ye)},[qe,G,pe,Re]),Qa=v.useCallback(Z=>qe.includes(Z),[qe]),Ja=v.useCallback(Z=>X?X(Z):V&&V.length>0&&te?.renderExpandContent?te.renderExpandContent({children:V,row:Z,expandContext:me,componentContext:ie,componentMap:Cl(),keyPrefix:`expand-${Z[p]}`}):null,[X,V,p,me,ie,ie?.state]),Rd=v.useMemo(()=>!tt||tt.length===0?!1:tt.every(Z=>g.includes(Z[p])),[tt,g,p]),eu=v.useMemo(()=>{if(!tt||tt.length===0)return!1;const Z=tt.filter(ye=>g.includes(ye[p])).length;return Z>0&&Z{const _e=Z[p],ct=Qa(_e);return h.jsxs(I,{className:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg p-4 mb-4",children:[h.jsxs(I,{className:"flex items-start justify-between",children:[B&&Kr(Z)&&h.jsx(le,{onClick:()=>Zo(_e),className:"p-1.5 rounded-md hover:bg-gray-100 dark:hover:bg-gray-600 transition-colors mr-2","aria-label":ct?"Collapse card":"Expand card",children:h.jsx(ae,{name:ct?Q:ne,className:"w-4 h-4 text-gray-500 dark:text-gray-400"})}),f&&h.jsx(On,{checked:g.includes(Z[p]),onChange:()=>ar(Z[p]),className:"w-4 h-4 text-blue-600 border-gray-300 dark:border-gray-600 rounded mr-3 mt-1"}),h.jsx(I,{className:"flex-1",children:h.jsx(I,{className:"grid grid-cols-2 gap-x-4 gap-y-2",children:ye.map(Ve=>h.jsxs(I,{className:"min-w-0",children:[h.jsx(J,{className:"text-xs font-medium text-gray-500 dark:text-gray-400 uppercase",children:Ve.header}),h.jsx(I,{className:"text-sm text-gray-900 dark:text-gray-200 mt-0.5 break-words",children:Ve.cellChildren&&Ve.cellChildren.length>0?ns(Ve.cellChildren,Z,Z[Ve.field],`card-${Z[p]}-${Ve.field}`,ie):Ve.render?Ve.render(Z[Ve.field],Z):Sl(Z[Ve.field])})]},Ve.field))})}),k&&k.length>0&&h.jsx(I,{className:"ml-2",children:h.jsx(Vs,{items:Fs(Z),triggerLabel:"",triggerIconName:he.EllipsisHorizontal})})]}),B&&ct&&Kr(Z)&&h.jsx(I,{className:"mt-4 pt-4 border-t border-gray-200 dark:border-gray-700",children:Ja(Z)}),(de&&de.length>0||ge)&&Du(fe,Z)&&h.jsx(I,{className:be?`mt-3 ${be}`:"mt-3 pt-3 border-t border-gray-100 dark:border-gray-700",children:ge?ge(Z):_l(de,Z,`card-subrow-${_e}`,ie)})]})};return ut?h.jsxs(I,{id:e,className:`w-full ${a}`,style:l,...Te,children:[b&&h.jsx(I,{className:"mb-4 flex justify-end",children:h.jsxs(I,{ref:Ue,className:"relative",children:[h.jsxs(le,{onClick:()=>Oe(!Ne),className:"flex items-center gap-2 px-4 py-2 bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700",children:[h.jsx(ae,{name:he.Cog,className:"w-4 h-4 text-gray-500 dark:text-gray-400"}),h.jsx(J,{className:"text-sm text-gray-700 dark:text-gray-300",children:Ke})]}),Ne&&h.jsx(I,{className:"absolute right-0 z-50 mt-2 w-64 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg",children:h.jsx(I,{className:"p-2 max-h-64 overflow-y-auto",children:ot.map(Z=>h.jsxs(I,{className:`flex items-center gap-2 px-3 py-2 rounded hover:bg-gray-50 dark:hover:bg-gray-700 ${Z.required?"opacity-50 cursor-not-allowed":"cursor-pointer"}`,onClick:()=>!Z.required&&Za(Z.field),children:[h.jsx(On,{checked:St.includes(Z.field),disabled:Z.required,onChange:()=>{},className:"w-4 h-4 text-blue-600 border-gray-300 dark:border-gray-600 rounded"}),h.jsxs(J,{className:"text-sm text-gray-700 dark:text-gray-300",children:[Z.header,Z.required&&h.jsxs(J,{className:"text-xs text-gray-500 dark:text-gray-400 ml-1",children:["(",We,")"]})]})]},Z.field))})})]})}),f&&g.length>0&&pt&&h.jsx(I,{className:"mb-4 text-sm text-gray-600 dark:text-gray-400",children:Ge(g.length)}),h.jsx(I,{id:e?`${e}__body`:void 0,children:tt&&tt.length>0?tt.map((Z,ye)=>h.jsx(I,{children:S?S(Z,Yt):Zn(Z,Yt)},Z[p]||ye)):h.jsx(I,{className:"text-center py-8 text-gray-500 dark:text-gray-400",children:nt})}),Ce&&Ce.length>0&&tt&&tt.length>0&&h.jsx(I,{className:`rounded-lg p-4 mt-2 ${je}`,children:oe&&oe.length>0?ns(oe,{},null,"footer-card",ie):h.jsx(I,{className:"space-y-1",children:Ce.filter(Z=>Z.text||Z.children&&Z.children.length>0).map((Z,ye)=>{const _e=Yt.find(ct=>ct.field===Z.field);return h.jsxs(I,{className:"flex justify-between text-sm",children:[h.jsx(J,{className:"text-gray-500 dark:text-gray-400",children:_e?.header||""}),h.jsx(J,{className:Z.className||"text-gray-900 dark:text-gray-100",children:Z.children&&Z.children.length>0?ns(Z.children,{},null,`footer-mobile-${ye}`,ie):Iu(Z.text,`footer-mobile-text-${ye}`,ie)})]},`footer-mobile-${ye}`)})})}),s&&Sr&&h.jsx(I,{className:"flex justify-center mt-4",children:h.jsx(Ro,{currentPage:zn,totalPages:Xo,hasMorePages:w?P:void 0,onPageChange:qa,showFirstLast:Y,maxVisiblePages:5,prevText:Pe,nextText:Fe})})]}):h.jsxs(I,{id:e,className:`w-full ${a}`,style:l,...Te,children:[b&&h.jsx(I,{className:"mb-4 flex justify-end",children:h.jsxs(I,{ref:Ue,className:"relative",children:[h.jsxs(le,{onClick:()=>Oe(!Ne),className:"flex items-center gap-2 px-4 py-2 bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700",children:[h.jsx(ae,{name:he.Cog,className:"w-4 h-4 text-gray-500 dark:text-gray-400"}),h.jsx(J,{className:"text-sm text-gray-700 dark:text-gray-300",children:Ke})]}),Ne&&h.jsx(I,{className:"absolute right-0 z-50 mt-2 w-64 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg",children:h.jsx(I,{className:"p-2 max-h-64 overflow-y-auto",children:ot.map(Z=>h.jsxs(I,{className:`flex items-center gap-2 px-3 py-2 rounded hover:bg-gray-50 dark:hover:bg-gray-700 ${Z.required?"opacity-50 cursor-not-allowed":"cursor-pointer"}`,onClick:()=>!Z.required&&Za(Z.field),children:[h.jsx(On,{checked:St.includes(Z.field),disabled:Z.required,onChange:()=>{},className:"w-4 h-4 text-blue-600 border-gray-300 dark:border-gray-600 rounded"}),h.jsxs(J,{className:"text-sm text-gray-700 dark:text-gray-300",children:[Z.header,Z.required&&h.jsxs(J,{className:"text-xs text-gray-500 dark:text-gray-400 ml-1",children:["(",We,")"]})]})]},Z.field))})})]})}),f&&g.length>0&&pt&&h.jsx(I,{className:"mb-4 text-sm text-gray-600 dark:text-gray-400",children:Ge(g.length)}),h.jsx(I,{id:e?`${e}__body`:void 0,className:"overflow-x-auto border border-gray-200 dark:border-gray-700 rounded-lg",children:h.jsxs(ll,{className:"w-full",children:[h.jsx(cl,{className:"bg-gray-50 dark:bg-gray-700",children:h.jsxs(dr,{children:[B&&h.jsx(Qr,{className:"px-2 py-3",style:{width:K}}),f&&h.jsx(Qr,{className:"px-4 py-3 w-10",children:h.jsx(On,{checked:Rd,ref:Z=>{Z&&(Z.indeterminate=eu)},onChange:xt,className:"w-4 h-4 text-blue-600 border-gray-300 dark:border-gray-600 rounded"})}),Yt.map(Z=>h.jsxs(Qr,{className:`px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider ${Mn&&Z.sortable!==!1?"cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-600":""}`,style:{width:Z.width,minWidth:Z.width},onClick:Mn?()=>Jd(Z.field):void 0,children:[Z.header,xe===Z.field&&h.jsx(J,{className:"ml-1",children:Be==="asc"?"↑":"↓"})]},Z.field)),k&&k.length>0&&h.jsx(Qr,{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider w-24",children:dt})]})}),h.jsx(dl,{className:`bg-white dark:bg-gray-800 ${be?"":"divide-y divide-gray-200 dark:divide-gray-700"}`,children:tt&&tt.length>0?tt.map((Z,ye)=>{const _e=Z[p]||ye,ct=Qa(_e);return h.jsxs(v.Fragment,{children:[h.jsxs(dr,{className:`${i?"cursor-pointer":""} hover:bg-gray-50 dark:hover:bg-gray-700 ${g.includes(Z[p])?"bg-blue-50 dark:bg-blue-900/20":""} ${be&&ye>0?"border-t border-gray-200 dark:border-gray-700":""}`,onClick:()=>i?.(Z),children:[B&&h.jsx(rn,{className:"px-2 py-4 text-center",onClick:Ve=>Ve.stopPropagation(),children:Kr(Z)?h.jsx(le,{onClick:()=>Zo(_e),className:"p-1.5 rounded-md hover:bg-gray-100 dark:hover:bg-gray-600 transition-colors","aria-label":ct?"Collapse row":"Expand row",children:h.jsx(ae,{name:ct?Q:ne,className:"w-4 h-4 text-gray-500 dark:text-gray-400"})}):null}),f&&h.jsx(rn,{className:"px-4 py-4",onClick:Ve=>Ve.stopPropagation(),children:h.jsx(On,{checked:g.includes(Z[p]),onChange:()=>ar(Z[p]),className:"w-4 h-4 text-blue-600 border-gray-300 dark:border-gray-600 rounded"})}),Yt.map(Ve=>h.jsx(rn,{className:"px-6 py-4 align-top whitespace-nowrap text-sm text-gray-900 dark:text-gray-200",style:{width:Ve.width,minWidth:Ve.width},children:Ve.cellChildren&&Ve.cellChildren.length>0?ns(Ve.cellChildren,Z,Z[Ve.field],`${Z[p]}-${Ve.field}`,ie):Ve.render?Ve.render(Z[Ve.field],Z):Sl(Z[Ve.field])},Ve.field)),k&&k.length>0&&h.jsx(rn,{className:"px-6 py-4 text-right",onClick:Ve=>Ve.stopPropagation(),children:h.jsx(Vs,{items:Fs(Z),triggerLabel:"",triggerIconName:he.EllipsisHorizontal,position:"right"})})]}),B&&ct&&Kr(Z)&&h.jsx(dr,{className:"bg-gray-50 dark:bg-gray-900",children:h.jsx(rn,{colSpan:Yt.length+1+(f?1:0)+(k&&k.length>0?1:0),className:"px-6 py-4",children:Ja(Z)})}),(de&&de.length>0||ge)&&Du(fe,Z)&&h.jsx(dr,{className:be?"!border-t-0":"",children:h.jsx(rn,{colSpan:Yt.length+(B?1:0)+(f?1:0)+(k&&k.length>0?1:0),className:be?"p-2":be||"px-6 py-2 bg-gray-50 dark:bg-gray-900",children:be?h.jsx(I,{className:be,children:ge?ge(Z):_l(de,Z,`subrow-${_e}`,ie)}):ge?ge(Z):_l(de,Z,`subrow-${_e}`,ie)})})]},_e)}):h.jsx(dr,{children:h.jsx(rn,{colSpan:Yt.length+(B?1:0)+(f?1:0)+(k&&k.length>0?1:0),className:"px-6 py-8 text-center text-gray-500 dark:text-gray-400",children:nt})})}),Ce&&Ce.length>0&&tt&&tt.length>0&&h.jsx(ul,{children:h.jsxs(dr,{className:je,children:[B&&h.jsx(rn,{className:"px-2 py-4"}),f&&h.jsx(rn,{className:"px-4 py-4"}),(()=>{const Z=new Map(Ce.filter(ye=>ye.field).map(ye=>[ye.field,ye]));return Yt.map(ye=>{const _e=Z.get(ye.field);return _e?h.jsx(rn,{className:`px-6 py-4 text-sm text-gray-900 dark:text-gray-200 ${_e.className||""}`,colSpan:_e.colSpan,style:{width:ye.width,minWidth:ye.width},children:_e.children&&_e.children.length>0?ns(_e.children,{},null,`footer-${ye.field}`,ie):Iu(_e.text,`footer-text-${ye.field}`,ie)},`footer-${ye.field}`):h.jsx(rn,{className:"px-6 py-4",style:{width:ye.width,minWidth:ye.width}},`footer-${ye.field}`)})})(),k&&k.length>0&&h.jsx(rn,{className:"px-6 py-4"})]})})]})}),s&&Sr&&h.jsx(I,{className:"flex justify-center mt-4",children:h.jsx(Ro,{currentPage:zn,totalPages:Xo,hasMorePages:w?P:void 0,onPageChange:qa,showFirstLast:Y,maxVisiblePages:5,prevText:Pe,nextText:Fe})})]})},Ky=window.G7Core?.createLogger?.("Comp:CardGrid")??{log:(...e)=>console.log("[Comp:CardGrid]",...e),warn:(...e)=>console.warn("[Comp:CardGrid]",...e),error:(...e)=>console.error("[Comp:CardGrid]",...e)},Xy=(e,t)=>window.G7Core?.t?.(e,t)??e,qy=()=>window.G7Core?.getComponentMap?.()||{},Zy=(e,t)=>{if(!e)return!0;const n=window.G7Core;return typeof n?.evaluateCondition=="function"?n.evaluateCondition(e,{row:t,item:t,$item:t}):(Ky.warn("G7Core.evaluateCondition 미노출 — 조건을 평가할 수 없습니다:",e),!0)},Lu=(e,t,n,r,s)=>{const o=window.G7Core;if(e.name==="ActionMenu"){if(r&&r.length>0&&s)return{...e,props:{...e.props,items:r.map(i=>({...i,onClick:()=>s(i.id,t)}))}};if(e.actions&&Array.isArray(e.actions)){const i=e.props?.items||[],a=new Map(e.actions.map(c=>[c.id,c])),l=i.map(c=>{if(typeof c.onClick=="string"){const d=c.onClick,u=a.get(d);if(u&&o?.ActionDispatcher)return{...c,onClick:()=>{const f={...n};o.ActionDispatcher.dispatch(u,f)}}}return c});return{...e,props:{...e.props,items:l}}}}return e.children&&Array.isArray(e.children)?{...e,children:e.children.map(i=>Lu(i,t,n,r,s))}:e},Qy=(e,t,n,r="",s,o)=>{const i=window.G7Core;if(i?.renderItemChildren){const a=e.filter(d=>{const u=d.condition||d.if;return u?Zy(u,t):!0}),l={row:t,$value:t,index:n},c=a.map(d=>Lu(d,t,l,s,o));try{const d=qy();return i.renderItemChildren(c,l,d,r)}catch{return h.jsxs(I,{className:"text-red-600 dark:text-red-400 p-4",children:[h.jsx(kt,{children:"컴포넌트 로드 실패"}),h.jsx(kt,{className:"text-sm",children:"[CardGrid] 데이터를 표시할 수 없습니다."})]})}}return null},El=(e,t)=>{if(e.name==="Div"&&e.children&&e.children.length>0){const n=e.children.map((r,s)=>El(r,`${t}-child-${s}`)).filter(Boolean);return h.jsx(I,{className:e.props?.className||"",children:n},t)}return h.jsx(I,{className:"h-4 bg-gray-200 dark:bg-gray-700 rounded w-full animate-pulse"},t)},Pu=(e,t="skeleton")=>!e||e.length===0?null:e.map((n,r)=>{const s=`${t}-${n.id||n.name}-${r}`;return n.condition||n.if?null:(n.iteration,El(n,s))}).filter(Boolean),Jy=({data:e,cardColumns:t=[],gridColumns:n=3,gap:r=4,responsiveColumns:s,cardClassName:o="",idField:i="id",pagination:a=!0,pageSize:l=12,serverSidePagination:c=!1,serverCurrentPage:d,serverTotalPages:u,alwaysShowPagination:f=!1,onPageChange:g,paginationInfoText:m,rowActions:p,onRowAction:y,className:b="",style:_,emptyMessage:x,prevText:M,nextText:S,showSkeleton:k=!0,skeletonCount:N,skeletonCellChildren:C,id:w,editorAttrs:E})=>{const T=x??Xy("common.no_data"),P=t[0]?.cellChildren||[],[L,F]=v.useState(1);window.G7Core?.useResponsive?.();const D=c?d??1:L,O=c?u??1:Math.ceil((e?.length??0)/l),z=G=>{c?g?.(G):F(G)},U=v.useCallback((G,V)=>{y?.(G,V)},[y]),j=v.useMemo(()=>{if(!e)return[];if(!a||c)return e;const G=(L-1)*l,V=G+l;return e.slice(G,V)},[e,a,c,L,l]),Y=v.useMemo(()=>{const G=[],V=s?.sm??1;G.push(`grid-cols-${V}`),s?.sm&&G.push(`sm:grid-cols-${s.sm}`);const X=s?.md??Math.min(n,2);G.push(`md:grid-cols-${X}`);const K=s?.lg??n;return G.push(`lg:grid-cols-${K}`),s?.xl&&G.push(`xl:grid-cols-${s.xl}`),G.join(" ")},[n,s]),B=v.useMemo(()=>k?C&&C.length>0?Pu(C,"custom-skeleton"):P&&P.length>0?Pu(P,"auto-skeleton"):null:null,[k,C,P]);if(!e){if(!k)return null;const G=N??n;return h.jsx(I,{className:`grid ${Y} gap-${r} ${b}`,style:_,id:w,...E,children:Array.from({length:G}).map((V,X)=>h.jsx(I,{className:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg p-6 space-y-4",children:B},`skeleton-${X}`))})}if(j.length===0)return h.jsx(I,{className:b,style:_,id:w,...E,children:h.jsx(I,{className:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg p-12",children:h.jsx(kt,{className:"text-center text-gray-600 dark:text-gray-400",children:T})})});const W=a&&(f||O>1);return h.jsxs(I,{className:b,style:_,id:w,...E,children:[h.jsx(I,{className:`grid ${Y} gap-${r}`,children:j.map((G,V)=>h.jsx(I,{className:o,children:Qy(P,G,V,`card-${V}`,p,U)},G[i]||V))}),W&&h.jsxs(I,{className:"mt-6 space-y-4 flex flex-col items-center",children:[h.jsx(Ro,{currentPage:D,totalPages:O,onPageChange:z,showFirstLast:!1,maxVisiblePages:5,prevText:M,nextText:S}),m&&h.jsx(I,{className:"text-sm text-gray-600 dark:text-gray-400 text-center",children:m})]})]})},Ry=(e,t)=>window.G7Core?.t?.(e,t)??e,ri=({isOpen:e,onClose:t,title:n,titlePrefix:r,titleSuffix:s,closeOnBackdropClick:o=!0,closeOnOverlayClick:i,showCloseButton:a=!0,closeOnEscape:l=!0,children:c,width:d="500px",className:u="",style:f,__dataContext:g,__translationContext:m})=>{const p=i!==void 0?i:o,y=v.useRef(null),b=v.useRef(null);if(v.useEffect(()=>{const M=S=>{S.key==="Escape"&&e&&l&&t()};if(e&&l)return document.addEventListener("keydown",M),()=>document.removeEventListener("keydown",M)},[e,t,l]),v.useEffect(()=>{if(e&&y.current){b.current=document.activeElement;const M=y.current.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'),S=M[0],k=M[M.length-1];S?.focus();const N=C=>{C.key==="Tab"&&(C.shiftKey?document.activeElement===S&&(C.preventDefault(),k?.focus()):document.activeElement===k&&(C.preventDefault(),S?.focus()))};return document.addEventListener("keydown",N),()=>{document.removeEventListener("keydown",N),b.current?.focus()}}},[e]),v.useEffect(()=>{if(e)return document.body.style.overflow="hidden",()=>{document.body.style.overflow=""}},[e]),!e)return null;const _=f?.zIndex??50,x=(M,S)=>{if(!M||M.length===0)return null;const k=window.G7Core;if(!k)return null;const N=k.getDynamicRenderer?.();return N?M.map((C,w)=>h.jsx(N,{componentDef:C,dataContext:g||{},translationContext:m,registry:k.getComponentRegistry(),bindingEngine:k.getDataBindingEngine(),translationEngine:k.getTranslationEngine(),actionDispatcher:k.getActionDispatcher(),isRootRenderer:!1},`${S}-${w}`)):null};return h.jsxs(I,{className:"modal-wrapper",style:{zIndex:_},onClick:p?t:void 0,children:[h.jsx(I,{className:"modal-backdrop","aria-hidden":"true"}),h.jsxs(I,{ref:y,className:`modal-container ${u}`,style:{width:d,...f?{...f,zIndex:void 0}:{}},onClick:M=>M.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":n?"modal-title":void 0,children:[(n||r||s||a)&&h.jsxs(I,{className:"modal-header-row",children:[h.jsxs(I,{className:"flex-center gap-sm",children:[x(r,"title-prefix"),n&&h.jsx(I,{id:"modal-title",className:"modal-title",children:n}),x(s,"title-suffix")]}),a&&h.jsx(le,{onClick:t,className:"modal-close-btn","aria-label":Ry("common.close_modal"),children:h.jsx("svg",{className:"icon-lg",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),h.jsx(I,{className:"modal-body-content",children:c})]})]})},ev=({label:e,items:t,onItemClick:n,position:r="bottom-left",variant:s="default",className:o="",style:i,id:a,editorAttrs:l})=>{const[c,d]=v.useState(!1),[u,f]=v.useState(-1),g=v.useRef(null),m=v.useRef(null),[p,y]=v.useState(r);v.useEffect(()=>{const x=M=>{g.current&&!g.current.contains(M.target)&&(d(!1),f(-1))};if(c)return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[c]),v.useEffect(()=>{const x=M=>{if(!c)return;const S=t.map((k,N)=>k.disabled?-1:N).filter(k=>k!==-1);switch(M.key){case"ArrowDown":M.preventDefault(),f(k=>{const C=(S.indexOf(k)+1)%S.length;return S[C]});break;case"ArrowUp":M.preventDefault(),f(k=>{const N=S.indexOf(k),C=N<=0?S.length-1:N-1;return S[C]});break;case"Enter":M.preventDefault(),u>=0&&!t[u].disabled&&b(t[u]);break;case"Escape":M.preventDefault(),d(!1),f(-1);break}};if(c)return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[c,u,t]),v.useEffect(()=>{if(c&&m.current&&g.current){const x=m.current.getBoundingClientRect(),M=g.current.getBoundingClientRect(),S=window.innerWidth,k=window.innerHeight,N=x.width||224,C=x.height||200;let w=r;r.includes("left")?M.left+N>S&&(w=w.replace("left","right")):M.right-N<0&&(w=w.replace("right","left")),r.includes("top")?M.top-C<0&&(w=w.replace("top","bottom")):M.bottom+C>k&&(w=w.replace("bottom","top")),y(w)}},[c,r]);const b=x=>{x.disabled||(x.onClick?.(),n?.(x.value,x),d(!1),f(-1))},_={"bottom-left":"dropdown-menu-bottom-left","bottom-right":"dropdown-menu-bottom-right","top-left":"dropdown-menu-top-left","top-right":"dropdown-menu-top-right"};return h.jsxs(I,{ref:g,className:`dropdown ${o}`,style:i,id:a,...l,children:[h.jsxs(le,{onClick:()=>d(!c),className:s==="text"?"dropdown-trigger-text":"dropdown-trigger","aria-haspopup":"true","aria-expanded":c,children:[e,s!=="text"&&h.jsx("svg",{className:`inline-block ml-2 w-4 h-4 transition-transform ${c?"rotate-180":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),c&&h.jsx(I,{ref:m,className:`dropdown-menu ${_[p]}`,role:"menu","aria-orientation":"vertical",children:h.jsx(I,{className:"py-1",children:t.map((x,M)=>h.jsx(I,{className:`${x.disabled?"dropdown-item-disabled":"dropdown-item"} ${u===M?"dropdown-item-focused":""}`,onClick:()=>b(x),onMouseEnter:()=>!x.disabled&&f(M),role:"menuitem","aria-disabled":x.disabled,tabIndex:x.disabled?-1:0,children:x.label},x.value))})})]})},tv=({imageUrl:e,imageAlt:t="",title:n,subtitle:r,description:s,price:o,originalPrice:i,discountRate:a,currency:l="₩",buttonText:c="자세히 보기",onButtonClick:d,className:u="",style:f,id:g,editorAttrs:m})=>{const p=a&&a>0,y=(o??0).toLocaleString(),b=i?.toLocaleString();return h.jsxs(I,{className:`rounded-lg bg-white dark:bg-gray-800 shadow-md hover:shadow-xl transition-shadow border border-gray-200 dark:border-gray-700 overflow-hidden ${u}`,style:f,id:g,...m,children:[e&&h.jsxs(I,{className:"relative w-full",children:[h.jsx(Nn,{src:e,alt:t||n,className:"w-full h-64 object-cover"}),p&&h.jsx(I,{className:"absolute top-2 right-2 bg-red-500 text-white px-2 py-1 rounded-md",children:h.jsxs(J,{className:"text-sm font-bold",children:["-",a,"%"]})})]}),h.jsxs(I,{className:"p-4",children:[r&&h.jsx(Xr,{className:"text-xs font-medium text-blue-600 dark:text-blue-400 uppercase tracking-wider mb-2",children:r}),h.jsx(cr,{className:"text-xl font-bold text-gray-900 dark:text-white mb-2 line-clamp-2",children:n}),s&&h.jsx(kt,{className:"text-sm text-gray-600 dark:text-gray-400 mb-4 line-clamp-3",children:s}),h.jsxs(I,{className:"flex items-center gap-2 mb-4",children:[h.jsxs(J,{className:"text-2xl font-bold text-gray-900 dark:text-white",children:[l,y]}),i&&h.jsxs(J,{className:"text-sm text-gray-400 dark:text-gray-500 line-through",children:[l,b]})]}),c&&h.jsx(le,{onClick:d,className:"w-full bg-blue-600 hover:bg-blue-700 dark:bg-blue-500 dark:hover:bg-blue-600 text-white font-medium py-2 px-4 rounded-lg transition-colors",children:c})]})]})},nv=({value:e,label:t,change:n,changeLabel:r="전월 대비",iconName:s,trend:o="neutral",className:i="",style:a,id:l,editorAttrs:c})=>{const d=o==="up",u=o==="down",f=n!==void 0?Math.abs(n):0,g=d?"stats-trend-up":u?"stats-trend-down":"stats-trend-neutral",m=d?he.ArrowUp:u?he.ArrowDown:void 0;return h.jsxs(I,{className:`stat-card ${i}`,style:a,id:l,...c,children:[h.jsxs(I,{className:"flex-between mb-md",children:[s&&h.jsx(I,{className:"stats-icon stats-icon-blue",children:h.jsx(ae,{name:s,className:"icon-lg"})}),n!==void 0&&h.jsxs(I,{className:`stats-change ${g}`,children:[m&&h.jsx(ae,{name:m,className:"icon-sm"}),h.jsxs(J,{className:"text-sm font-semibold",children:[f,"%"]})]})]}),h.jsx(Xr,{className:"stats-value-lg",children:typeof e=="number"?e.toLocaleString():e}),h.jsx(kt,{className:"stats-label",children:t}),n!==void 0&&r&&h.jsx(I,{className:"stats-sublabel",children:h.jsx(J,{children:r})})]})},$u=()=>window.G7Core,Fu=(e,t)=>$u()?.t?.(e,t)??e,rv=({name:e="search",placeholder:t,value:n,onChange:r,onSubmit:s,showButton:o=!1,suggestions:i=[],onSuggestionClick:a,showSuggestions:l=!1,className:c="",style:d,id:u,editorAttrs:f})=>{const g=t??Fu("common.search_placeholder"),[m,p]=v.useState(""),[y,b]=v.useState(!1),_=v.useRef(null),x=v.useRef(""),M=n!==void 0?n:m,S=l&&y&&i.length>0&&M.length>0,k="w-64 pl-10 pr-4 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white text-sm",N=$u()?.style?.mergeClasses?.(k,c)??`${k} ${c}`;v.useEffect(()=>{n!==void 0&&(x.current=n)},[n]);const C=T=>{const P=T.target.value;p(P),r?.(T),x.current!==""&&P===""&&!T.nativeEvent.inputType&&setTimeout(()=>{const L=_.current?.querySelector("form");L&&L.requestSubmit()},0),x.current=P},w=T=>{p(T.text);const P={target:{value:T.text,name:e}};r?.(P),a?.(T),b(!1)},E=T=>{T.preventDefault(),s?.(T)};return h.jsxs(I,{ref:_,className:"relative",style:d,id:u,...f,children:[h.jsx(al,{onSubmit:E,className:"relative",children:h.jsxs(I,{className:`relative flex items-center ${o?"gap-2":""}`,children:[h.jsxs(I,{className:"relative flex-1",children:[h.jsx(I,{className:"absolute left-3 top-1/2 -translate-y-1/2 pointer-events-none",children:h.jsx(ae,{name:he.Search,className:"w-5 h-5 text-gray-400 dark:text-gray-500"})}),h.jsx(Et,{type:"search",name:e,value:M,onChange:C,onFocus:()=>b(!0),onBlur:()=>setTimeout(()=>b(!1),200),placeholder:g,className:N})]}),o&&h.jsx(le,{type:"submit",className:"px-4 py-2 bg-gray-800 dark:bg-gray-600 text-white rounded-lg hover:bg-gray-900 dark:hover:bg-gray-500 transition-colors text-sm font-medium cursor-pointer h-[42px]",children:Fu("common.search")})]})}),S&&h.jsx(I,{className:"absolute z-10 w-full mt-2 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg max-h-64 overflow-y-auto",children:i.map(T=>h.jsx(I,{className:"px-4 py-3 hover:bg-gray-50 dark:hover:bg-gray-700 cursor-pointer border-b border-gray-100 dark:border-gray-700 last:border-b-0 transition-colors",onClick:()=>w(T),children:h.jsxs(I,{className:"flex items-center gap-2",children:[h.jsx(ae,{name:he.Search,className:"w-4 h-4 text-gray-400 dark:text-gray-500"}),h.jsx(J,{className:"text-sm text-gray-700 dark:text-gray-300",children:T.text})]})},T.id))})]})},Ml=(e,t)=>window.G7Core?.t?.(e,t)??e,sv=({title:e,filters:t,onChange:n,onReset:r,showResetButton:s=!0,className:o="",style:i,id:a,editorAttrs:l})=>{const c=e??Ml("common.filter"),d=(f,g)=>{n?.(f,g)},u=(f,g,m)=>{const p=t.find(b=>b.id===f);if(!p)return;const y=Array.isArray(p.value)?p.value:[];if(typeof g=="string"){const b=y.filter(x=>typeof x=="string"),_=m?[...b,g]:b.filter(x=>x!==g);n?.(f,_)}else{const b=y.filter(x=>typeof x=="number"),_=m?[...b,g]:b.filter(x=>x!==g);n?.(f,_)}};return h.jsxs(I,{className:`rounded-lg bg-white dark:bg-gray-800 shadow-md border border-gray-200 dark:border-gray-700 p-4 ${o}`,style:i,id:a,...l,children:[h.jsxs(I,{className:"flex items-center justify-between mb-4 pb-3 border-b border-gray-200 dark:border-gray-700",children:[h.jsx(J,{className:"text-lg font-semibold text-gray-900 dark:text-white",children:c}),s&&r&&h.jsx(le,{onClick:r,className:"text-sm text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 font-medium",children:Ml("common.reset")})]}),h.jsx(I,{className:"space-y-4",children:t.map(f=>h.jsxs(I,{className:"space-y-2",children:[h.jsx(gn,{className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:f.label}),f.type==="select"&&h.jsxs(Zr,{value:f.value,onChange:g=>d(f.id,g.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:ring-2 focus:ring-blue-500 dark:focus:ring-blue-400 focus:border-blue-500 dark:focus:border-blue-400 bg-white dark:bg-gray-700 text-gray-900 dark:text-white",children:[h.jsx("option",{value:"",children:Ml("common.select_placeholder")}),f.options.map(g=>h.jsx("option",{value:g.value,children:g.label},g.id))]}),f.type==="checkbox"&&h.jsx(I,{className:"space-y-2",children:f.options.map(g=>{const m=Array.isArray(f.value)?f.value.some(p=>p===g.value):!1;return h.jsxs(gn,{className:"flex items-center gap-2 cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-700 p-2 rounded-md transition-colors",children:[h.jsx(On,{checked:m,onChange:p=>u(f.id,g.value,p.target.checked),className:"w-4 h-4 text-blue-600 border-gray-300 dark:border-gray-600 rounded focus:ring-blue-500"}),h.jsx(J,{className:"text-sm text-gray-700 dark:text-gray-300",children:g.label})]},g.id)})})]},f.id))})]})},ov=({tabs:e,activeTabId:t,onTabChange:n,variant:r="default",className:s="",style:o,mobileBreakpoint:i=768,id:a,editorAttrs:l})=>{const d=window.G7Core?.useResponsive,u=d?.(),f=u?u.width{!k.disabled&&k.id!==t&&n?.(k.id)},p=(k,N)=>{const C=k.key==="ArrowRight"?1:k.key==="ArrowLeft"?-1:0;let w=null;if(C!==0)for(let E=1;E<=e.length;E+=1){const T=(N+C*E+e.length*E)%e.length;if(!e[T]?.disabled){w=T;break}}else if(k.key==="Home")w=e.findIndex(E=>!E.disabled);else if(k.key==="End"){for(let E=e.length-1;E>=0;E-=1)if(!e[E]?.disabled){w=E;break}}w===null||w<0||(k.preventDefault(),g.current[w]?.focus(),m(e[w]))},y=k=>{const N=k.target.value,C=Number(N),w=typeof N=="string"&&N!==""&&!Number.isNaN(C)?C:N,E=e.find(T=>String(T.id)===String(w));E&&m(E)};if(f)return h.jsx(I,{className:s,style:o,id:a,...l,children:h.jsx(Zr,{value:t!==void 0?String(t):"",onChange:y,options:e.map(k=>({value:String(k.id),label:k.badge!==void 0?`${k.label} (${k.badge})`:k.label,disabled:k.disabled})),className:"w-full"})});const b=k=>{const N=k.id===t;if(k.disabled)return"tab-btn-base tab-btn-disabled";switch(r){case"pills":return N?"tab-btn-base tab-btn-pills-active":"tab-btn-base tab-btn-pills";case"underline":return N?"tab-btn-base tab-btn-underline-active":"tab-btn-base tab-btn-underline";case"default":default:return N?"tab-btn-base tab-btn-default-active":"tab-btn-base tab-btn-default"}},_=r==="underline"?"tab-nav-underline":"tab-nav-default",x=l?.["data-editor-path"],M=e.findIndex(k=>k.id===t),S=M>=0?M:e.findIndex(k=>!k.disabled);return h.jsx(Jo,{className:`${_} ${s}`,style:o,role:"tablist","aria-orientation":"horizontal",id:a,...l,children:e.map((k,N)=>h.jsxs(le,{ref:C=>{g.current[N]=C},type:"button",role:"tab","aria-selected":k.id===t,tabIndex:N===S?0:-1,onClick:()=>m(k),onKeyDown:C=>p(C,N),disabled:k.disabled,className:b(k),...x?{"data-editor-item-path":`${x}.props.tabs.${N}`}:{},children:[k.iconName&&h.jsx(ae,{name:k.iconName,className:"w-4 h-4"}),h.jsx(J,{children:k.label}),k.badge!==void 0&&h.jsx(I,{className:"flex items-center justify-center min-w-[20px] h-5 px-1.5 bg-red-500 dark:bg-red-600 text-white dark:text-white text-xs font-bold rounded-full",children:h.jsx(J,{children:k.badge})})]},k.id))})},Nl=window.G7Core?.createLogger?.("Handler:ScrollToSection")??{log:(...e)=>console.log("[Handler:ScrollToSection]",...e),warn:(...e)=>console.warn("[Handler:ScrollToSection]",...e),error:(...e)=>console.error("[Handler:ScrollToSection]",...e)};async function zu(e,t){const n=e.params||{},{targetId:r,offset:s=120,delay:o=100,scrollContainerId:i}=n;if(!r){Nl.warn("targetId is required");return}const a=await iv(r,o);if(!a){Nl.warn(`Element not found: ${r}`);return}const l=av(a,i),c=lv(a,l,s);cv(l,c)}async function iv(e,t){await new Promise(s=>setTimeout(s,t));const n=10,r=50;for(let s=0;ssetTimeout(i,50)),o;await new Promise(i=>setTimeout(i,r))}return null}function av(e,t){if(t){const o=document.getElementById(t);if(o&&Vu(o))return o;Nl.warn(`Container '${t}' ${o?"has no scroll":"not found"}, trying auto-detect`)}let n=e.parentElement,r=0;const s=10;for(;n&&n!==document.body&&re.clientHeight}function lv(e,t,n){if(t===window||!("getBoundingClientRect"in t))return e.getBoundingClientRect().top+window.pageYOffset-n;{const r=t.getBoundingClientRect(),s=e.getBoundingClientRect();return t.scrollTop+(s.top-r.top)-n}}function cv(e,t){e===window||!("scrollTo"in e)?window.scrollTo({top:t,behavior:"smooth"}):e.scrollTo({top:t,behavior:"smooth"})}window.G7Core?.createLogger?.("Comp:TabNavigation");const dv=({tabs:e,activeTabId:t,className:n="bg-white dark:bg-gray-800 flex gap-2 border-b border-gray-200 dark:border-gray-700 px-6",style:r,activeClassName:s="tab-btn-base tab-btn-default-active",inactiveClassName:o="tab-btn-base tab-btn-default",sectionIdPrefix:i="tab_content_",scrollOffset:a=120,scrollDelay:l=100,onTabChange:c,enableScrollSpy:d=!1,scrollSpyOffset:u=80,scrollContainerId:f,id:g,editorAttrs:m})=>{const[p,y]=v.useState(t??(e.length>0?e[0].id:"")),_=window.G7Core?.useResponsive,x=_?.(),M=x?x.width<768:typeof window<"u"&&window.innerWidth<768,S=v.useRef(!1),k=v.useRef(null),N=v.useRef([]),C=L=>{if(d&&(S.current=!0,k.current&&clearTimeout(k.current)),L.onClick){if(L.onClick(L.id),!d)return}else if(c){if(c(L.id),!d)return}else y(L.id);const F=L.scrollOffset??a,A=L.scrollDelay??l;zu({params:{targetId:`${i}${L.id}`,offset:F,delay:A,scrollContainerId:f}}),d&&(k.current=setTimeout(()=>{S.current=!1},A+500))},w=(L,F)=>{const A=L.key==="ArrowRight"?1:L.key==="ArrowLeft"?-1:0;let D=null;if(A!==0)for(let O=1;O<=e.length;O+=1){const z=(F+A*O+e.length*O)%e.length;if(!e[z]?.disabled){D=z;break}}else if(L.key==="Home")D=e.findIndex(O=>!O.disabled);else if(L.key==="End"){for(let O=e.length-1;O>=0;O-=1)if(!e[O]?.disabled){D=O;break}}D===null||D<0||(L.preventDefault(),N.current[D]?.focus(),C(e[D]))};v.useEffect(()=>{if(!d)return;const L=f?document.getElementById(f):null,F={root:L??null,rootMargin:`-${u}px 0px -30% 0px`,threshold:[0,.1,.2,.3,.4,.5,.6,.7,.8,.9,1]},A=new Map,D=()=>{const j=L,Y=j?j.scrollTop:window.pageYOffset||document.documentElement.scrollTop,B=j?j.scrollHeight:document.documentElement.scrollHeight,W=j?j.clientHeight:document.documentElement.clientHeight;return Y+W>=B-10},O=j=>{if(S.current)return;j.forEach(X=>{const K=X.target.id;X.isIntersecting?A.set(K,X.intersectionRatio):A.delete(K)});let Y=0,B="";A.forEach((X,K)=>{X>Y&&(Y=X,B=K)});const W=e[e.length-1],G=`${i}${W?.id}`,V=A.has(G);if(D()&&V&&W){y(W.id);return}if(B){const X=B.replace(i,""),K=Number(X),Q=isNaN(K)?X:K;e.some(se=>se.id===Q)&&y(Q)}},z=()=>{},U=new IntersectionObserver(O,F);return e.forEach(j=>{const Y=document.getElementById(`${i}${j.id}`);Y&&U.observe(Y)}),window.addEventListener("scroll",z,{passive:!0}),()=>{U.disconnect(),window.removeEventListener("scroll",z),k.current&&clearTimeout(k.current)}},[d,e,i,u,f]);const E=L=>{const F=L.target.value,A=Number(F),D=isNaN(A)?F:A,O=e.find(z=>z.id===D);O&&C(O)};if(M)return h.jsx(I,{className:"bg-white dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700 px-4 py-3",id:g,...m,children:h.jsx(Zr,{value:String(p),onChange:E,options:e.map(L=>({value:String(L.id),label:L.label,disabled:L.disabled})),className:"w-full"})});const T=e.findIndex(L=>L.id===p),P=T>=0?T:e.findIndex(L=>!L.disabled);return h.jsx(I,{className:n,style:r,role:"tablist","aria-orientation":"horizontal",id:g,...m,children:e.map((L,F)=>h.jsxs(le,{ref:A=>{N.current[F]=A},type:"button",role:"tab","aria-selected":p===L.id,tabIndex:F===P?0:-1,className:p===L.id?s:o,disabled:L.disabled,onClick:()=>C(L),onKeyDown:A=>w(A,F),children:[L.iconName&&h.jsx(ae,{name:L.iconName,size:"sm"}),h.jsx(J,{children:L.label})]},L.id))})},uv=()=>window.G7Core,fv=({iconName:e,label:t,onClick:n,variant:r="primary",size:s="md",disabled:o=!1,className:i="",style:a,id:l,editorAttrs:c})=>{const d={sm:t?"px-3 py-1.5 text-sm":"w-8 h-8",md:t?"px-4 py-2 text-base":"w-10 h-10",lg:t?"px-5 py-2.5 text-lg":"w-12 h-12"},u={sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"},f={primary:"bg-blue-600 hover:bg-blue-700 text-white border-transparent",secondary:"bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 text-gray-700 dark:text-gray-300 border-gray-300 dark:border-gray-600",danger:"bg-red-600 hover:bg-red-700 text-white border-transparent",ghost:"bg-transparent hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-700 dark:text-gray-300 border-transparent",outline:"bg-transparent hover:bg-gray-50 dark:hover:bg-gray-700 text-gray-700 dark:text-gray-300 border-gray-300 dark:border-gray-600"},g="inline-flex items-center justify-center gap-2 font-medium rounded-lg border transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 dark:focus:ring-blue-400",m=o?"opacity-50 cursor-not-allowed":"",p=`${g} ${d[s]} ${f[r]} ${m}`,y=uv()?.style?.mergeClasses?.(p,i)??`${p} ${i}`;return h.jsxs(le,{onClick:n,disabled:o,className:y,style:a,id:l,...c,children:[h.jsx(ae,{name:e,className:u[s]}),t]})},hv=(e,t)=>window.G7Core?.t?.(e,t)??e,Hu=({isOpen:e,onClose:t,title:n,content:r,actions:s=[],width:o="500px",closeOnOverlay:i=!0,showCloseButton:a=!0,className:l="",style:c})=>{const d=()=>{i&&t()},u={primary:"dialog-btn-primary",secondary:"dialog-btn-secondary",danger:"dialog-btn-danger",ghost:"dialog-btn-ghost"};return h.jsxs(ri,{isOpen:e,onClose:d,width:o,className:l,style:c,children:[h.jsxs(I,{className:"dialog-header",children:[h.jsx(cr,{className:"dialog-title",children:n}),a&&h.jsx(le,{onClick:t,className:"dialog-close","aria-label":hv("common.close_dialog"),children:h.jsx(ae,{name:he.Times,className:"icon-md"})})]}),h.jsx(I,{className:"dialog-body",children:r}),s.length>0&&h.jsx(I,{className:"dialog-footer",children:s.map((f,g)=>h.jsxs(le,{onClick:f.onClick,disabled:f.disabled,className:u[f.variant||"primary"],children:[f.iconName&&h.jsx(ae,{name:f.iconName,className:"icon-sm mr-2 inline-block"}),f.label]},g))})]})},Ol=(e,t)=>window.G7Core?.t?.(e,t)??e,Uu=({isOpen:e,onClose:t,title:n,message:r,confirmText:s,cancelText:o,onConfirm:i,onCancel:a,confirmButtonVariant:l="primary",cancelButtonVariant:c="secondary",width:d="500px",closeOnOverlay:u=!0,isLoading:f=!1,loadingText:g})=>{const m=s??Ol("common.confirm"),p=o??Ol("common.cancel"),y=g??Ol("common.loading"),b=()=>{i()},_=()=>{f||(a?.(),t())},x=()=>{f||t()},M={primary:"bg-blue-600 text-white hover:bg-blue-700",secondary:"bg-gray-200 dark:bg-gray-700 text-gray-800 dark:text-gray-200 hover:bg-gray-300 dark:hover:bg-gray-600",danger:"bg-red-600 text-white hover:bg-red-700",ghost:"bg-transparent text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700"};return h.jsxs(ri,{isOpen:e,onClose:x,title:n,width:d,children:[h.jsx(I,{className:"py-2",children:typeof r=="string"?h.jsx(kt,{className:"text-gray-700 dark:text-gray-300",children:r}):r}),h.jsxs(I,{className:"flex justify-end gap-3 mt-6",children:[h.jsx(le,{onClick:_,disabled:f,className:"px-4 py-2 bg-white dark:bg-gray-800 text-gray-700 dark:text-gray-300 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700 disabled:opacity-50 disabled:cursor-not-allowed",children:h.jsx(J,{children:p})}),h.jsxs(le,{onClick:b,disabled:f,className:`flex items-center gap-2 px-4 py-2 rounded-lg disabled:opacity-50 disabled:cursor-not-allowed ${M[l]}`,children:[f&&h.jsx(ae,{name:he.Spinner,className:"w-4 h-4 animate-spin"}),h.jsx(J,{children:f?y:m})]})]})]})},gv=(e,t)=>window.G7Core?.t?.(e,t)??e,pv=({isOpen:e,onClose:t,title:n,message:r,confirmText:s,onConfirm:o,confirmButtonVariant:i="primary",width:a="500px",closeOnOverlay:l=!0})=>{const u=[{label:s??gv("common.confirm"),onClick:()=>{o?.(),t()},variant:i}],f=typeof r=="string"?h.jsx(kt,{className:"text-gray-700 dark:text-gray-300",children:r}):r;return h.jsx(Hu,{isOpen:e,onClose:t,title:n,content:f,actions:u,width:a,closeOnOverlay:l})},mv=(e,t)=>window.G7Core?.t?.(e,t)??e,bv={success:he.CheckCircle,error:he.XCircle,warning:he.ExclamationTriangle,info:he.InfoCircle},Bu={success:{bg:"bg-green-50 dark:bg-green-900/20 border-green-200 dark:border-green-800",text:"text-green-800 dark:text-green-300"},error:{bg:"bg-red-50 dark:bg-red-900/20 border-red-200 dark:border-red-800",text:"text-red-800 dark:text-red-300"},warning:{bg:"bg-yellow-50 dark:bg-yellow-900/20 border-yellow-200 dark:border-yellow-800",text:"text-yellow-800 dark:text-yellow-300"},info:{bg:"bg-blue-50 dark:bg-blue-900/20 border-blue-200 dark:border-blue-800",text:"text-blue-800 dark:text-blue-300"}},yv={"top-left":"top-4 left-4","top-center":"top-4 left-1/2 -translate-x-1/2","top-right":"top-4 right-4","bottom-left":"bottom-4 left-4","bottom-center":"bottom-4 left-1/2 -translate-x-1/2","bottom-right":"bottom-4 right-4"},vv=({toasts:e,position:t="bottom-center",duration:n=3e3,onRemove:r})=>{const[s,o]=v.useState(new Map),i=v.useCallback(a=>{o(l=>{const c=new Map(l);return c.set(a,!1),c}),setTimeout(()=>{if(r)r(a);else{const l=window.G7Core;l?.state?.update&&l.state.update(c=>({toasts:(Array.isArray(c.toasts)?c.toasts:[]).filter(u=>u.id!==a)}))}},300)},[r]);return v.useEffect(()=>{!e||e.length===0||e.forEach(a=>{if(s.has(a.id))return;o(c=>{const d=new Map(c);return d.set(a.id,!0),d});const l=a.duration||n;l>0&&setTimeout(()=>{i(a.id)},l)})},[e,n,i,s]),!e||e.length===0?null:h.jsx(I,{className:`fixed z-[9999] flex flex-col gap-2 ${yv[t]}`,"aria-live":"polite","aria-atomic":"true",children:e.map(a=>h.jsx(xv,{toast:a,position:t,isVisible:s.get(a.id)??!0,onClose:()=>i(a.id)},a.id))})},xv=({toast:e,position:t,isVisible:n,onClose:r})=>{const s=Bu[e.type]||Bu.info,o=e.icon?e.icon:bv[e.type],i=t.startsWith("bottom")?"translate-y-2":"-translate-y-2";return h.jsxs(I,{className:` flex items-center gap-3 p-4 rounded-lg border shadow-lg min-w-[300px] max-w-md transition-all duration-300 ${s.bg} ${n?"opacity-100 translate-y-0":`opacity-0 ${i}`} - `,role:"alert",children:[h.jsx(re,{name:o,className:`w-5 h-5 flex-shrink-0 ${s.text}`}),h.jsx(Q,{className:`flex-1 text-sm font-medium ${s.text}`,children:e.message}),h.jsx(oe,{onClick:r,className:`flex-shrink-0 p-1 rounded hover:bg-black/10 dark:hover:bg-white/10 ${s.text} focus:outline-none`,"aria-label":hy("common.close_notification"),children:h.jsx(re,{name:de.Times,className:"w-4 h-4"})})]})},cu=({items:e,separator:t=h.jsx(re,{name:de.ChevronRight,className:"w-4 h-4 text-gray-400 dark:text-gray-500"}),showHome:n=!1,homeHref:r="/",maxItems:s,className:o="",id:i,editorAttrs:a})=>{let c=n?[{label:"Home",href:r},...e]:e,d=c,u=!1;if(s&&c.length>s){u=!0;const f=c.slice(0,1),g=c.slice(-(s-2));d=[...f,...g]}return h.jsx(Po,{className:`flex items-center space-x-2 text-sm ${o}`,"aria-label":"Breadcrumb",id:i,...a,children:h.jsx(I,{className:"flex items-center space-x-2",children:d.map((f,g)=>{const m=g===d.length-1,p=g===0;return h.jsxs(v.Fragment,{children:[u&&p&&h.jsxs(h.Fragment,{children:[h.jsx(du,{item:f,isLast:!1}),h.jsx(Q,{className:"text-gray-400 dark:text-gray-500","aria-hidden":"true",children:t}),h.jsx(Q,{className:"text-gray-500 dark:text-gray-400",children:"..."}),d.length>1&&h.jsx(Q,{className:"text-gray-400 dark:text-gray-500","aria-hidden":"true",children:t})]}),(!u||!p)&&h.jsxs(h.Fragment,{children:[h.jsx(du,{item:f,isLast:m}),!m&&h.jsx(Q,{className:"text-gray-400 dark:text-gray-500","aria-hidden":"true",children:t})]})]},g)})})})},du=({item:e,isLast:t})=>t||!e.href&&!e.onClick?h.jsx(Q,{className:"font-medium text-gray-900 dark:text-white","aria-current":t?"page":void 0,children:e.label}):e.onClick?h.jsx(Fr,{href:"#",onClick:n=>{n.preventDefault(),e.onClick?.()},className:"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-200 transition-colors",children:e.label}):h.jsx(Fr,{href:e.href,className:"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-200 transition-colors",children:e.label}),yy=({title:e,description:t,iconName:n,illustrationSrc:r,illustrationAlt:s="Empty state illustration",actions:o=[],className:i="",id:a,editorAttrs:l})=>{const c={primary:"bg-blue-600 text-white hover:bg-blue-700 focus:ring-blue-500",secondary:"bg-gray-200 dark:bg-gray-700 text-gray-800 dark:text-gray-200 hover:bg-gray-300 dark:hover:bg-gray-600 focus:ring-gray-500",danger:"bg-red-600 text-white hover:bg-red-700 focus:ring-red-500",ghost:"bg-transparent text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 focus:ring-gray-500"};return h.jsxs(I,{className:`flex flex-col items-center justify-center p-8 text-center ${i}`,role:"status","aria-live":"polite",id:a,...l,children:[r?h.jsx(kn,{src:r,alt:s,className:"w-48 h-48 mb-6 object-contain"}):n?h.jsx(I,{className:"mb-6 p-4 rounded-full bg-gray-100 dark:bg-gray-700",children:h.jsx(re,{name:n,className:"w-12 h-12 text-gray-400 dark:text-gray-500"})}):null,h.jsx(er,{className:"text-xl font-semibold text-gray-900 dark:text-white mb-2",children:e}),t&&h.jsx(yt,{className:"text-gray-600 dark:text-gray-400 mb-6 max-w-md",children:t}),o.length>0&&h.jsx(I,{className:"flex flex-wrap gap-3 justify-center",children:o.map((d,u)=>h.jsxs(oe,{onClick:d.onClick,className:` + `,role:"alert",children:[h.jsx(ae,{name:o,className:`w-5 h-5 flex-shrink-0 ${s.text}`}),h.jsx(J,{className:`flex-1 text-sm font-medium ${s.text}`,children:e.message}),h.jsx(le,{onClick:r,className:`flex-shrink-0 p-1 rounded hover:bg-black/10 dark:hover:bg-white/10 ${s.text} focus:outline-none`,"aria-label":mv("common.close_notification"),children:h.jsx(ae,{name:he.Times,className:"w-4 h-4"})})]})},ju=({items:e,separator:t=h.jsx(ae,{name:he.ChevronRight,className:"w-4 h-4 text-gray-400 dark:text-gray-500"}),showHome:n=!1,homeHref:r="/",maxItems:s,className:o="",id:i,editorAttrs:a})=>{let c=n?[{label:"Home",href:r},...e]:e,d=c,u=!1;if(s&&c.length>s){u=!0;const f=c.slice(0,1),g=c.slice(-(s-2));d=[...f,...g]}return h.jsx(Jo,{className:`flex items-center space-x-2 text-sm ${o}`,"aria-label":"Breadcrumb",id:i,...a,children:h.jsx(I,{className:"flex items-center space-x-2",children:d.map((f,g)=>{const m=g===d.length-1,p=g===0;return h.jsxs(v.Fragment,{children:[u&&p&&h.jsxs(h.Fragment,{children:[h.jsx(Wu,{item:f,isLast:!1}),h.jsx(J,{className:"text-gray-400 dark:text-gray-500","aria-hidden":"true",children:t}),h.jsx(J,{className:"text-gray-500 dark:text-gray-400",children:"..."}),d.length>1&&h.jsx(J,{className:"text-gray-400 dark:text-gray-500","aria-hidden":"true",children:t})]}),(!u||!p)&&h.jsxs(h.Fragment,{children:[h.jsx(Wu,{item:f,isLast:m}),!m&&h.jsx(J,{className:"text-gray-400 dark:text-gray-500","aria-hidden":"true",children:t})]})]},g)})})})},Wu=({item:e,isLast:t})=>t||!e.href&&!e.onClick?h.jsx(J,{className:"font-medium text-gray-900 dark:text-white","aria-current":t?"page":void 0,children:e.label}):e.onClick?h.jsx(qr,{href:"#",onClick:n=>{n.preventDefault(),e.onClick?.()},className:"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-200 transition-colors",children:e.label}):h.jsx(qr,{href:e.href,className:"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-200 transition-colors",children:e.label}),wv=({title:e,description:t,iconName:n,illustrationSrc:r,illustrationAlt:s="Empty state illustration",actions:o=[],className:i="",id:a,editorAttrs:l})=>{const c={primary:"bg-blue-600 text-white hover:bg-blue-700 focus:ring-blue-500",secondary:"bg-gray-200 dark:bg-gray-700 text-gray-800 dark:text-gray-200 hover:bg-gray-300 dark:hover:bg-gray-600 focus:ring-gray-500",danger:"bg-red-600 text-white hover:bg-red-700 focus:ring-red-500",ghost:"bg-transparent text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 focus:ring-gray-500"};return h.jsxs(I,{className:`flex flex-col items-center justify-center p-8 text-center ${i}`,role:"status","aria-live":"polite",id:a,...l,children:[r?h.jsx(Nn,{src:r,alt:s,className:"w-48 h-48 mb-6 object-contain"}):n?h.jsx(I,{className:"mb-6 p-4 rounded-full bg-gray-100 dark:bg-gray-700",children:h.jsx(ae,{name:n,className:"w-12 h-12 text-gray-400 dark:text-gray-500"})}):null,h.jsx(cr,{className:"text-xl font-semibold text-gray-900 dark:text-white mb-2",children:e}),t&&h.jsx(kt,{className:"text-gray-600 dark:text-gray-400 mb-6 max-w-md",children:t}),o.length>0&&h.jsx(I,{className:"flex flex-wrap gap-3 justify-center",children:o.map((d,u)=>h.jsxs(le,{onClick:d.onClick,className:` px-4 py-2 rounded-md font-medium transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2 ${c[d.variant||"primary"]} - `,children:[d.iconName&&h.jsx(re,{name:d.iconName,className:"w-4 h-4 mr-2 inline-block"}),d.label]},u))})]})},vy=(e,t)=>window.G7Core?.t?.(e,t)??e,xy=({id:e,size:t="md",color:n="text-blue-600",fullscreen:r=!1,text:s,className:o="",editorAttrs:i})=>{const a={sm:"w-4 h-4 border-2",md:"w-8 h-8 border-2",lg:"w-12 h-12 border-3",xl:"w-16 h-16 border-4"},l={sm:"text-xs",md:"text-sm",lg:"text-base",xl:"text-lg"},c=h.jsxs(I,{className:`flex flex-col items-center justify-center gap-3 ${o}`,children:[h.jsx(I,{className:` + `,children:[d.iconName&&h.jsx(ae,{name:d.iconName,className:"w-4 h-4 mr-2 inline-block"}),d.label]},u))})]})},kv=(e,t)=>window.G7Core?.t?.(e,t)??e,Cv=({id:e,size:t="md",color:n="text-blue-600",fullscreen:r=!1,text:s,className:o="",editorAttrs:i})=>{const a={sm:"w-4 h-4 border-2",md:"w-8 h-8 border-2",lg:"w-12 h-12 border-3",xl:"w-16 h-16 border-4"},l={sm:"text-xs",md:"text-sm",lg:"text-base",xl:"text-lg"},c=h.jsxs(I,{className:`flex flex-col items-center justify-center gap-3 ${o}`,children:[h.jsx(I,{className:` ${a[t]} border-gray-200 dark:border-gray-700 border-t-current rounded-full animate-spin ${n} - `,role:"status","aria-label":vy("common.loading")}),s&&h.jsx(Q,{className:`${l[t]} ${n} font-medium`,children:s})]});return r?h.jsx(I,{id:e,className:"fixed inset-0 z-50 flex items-center justify-center bg-white dark:bg-gray-900 bg-opacity-90 dark:bg-opacity-90","aria-live":"polite","aria-busy":"true",...i,children:c}):h.jsx(I,{id:e,className:"flex items-center justify-center p-4","aria-live":"polite","aria-busy":"true",...i,children:c})},jr=()=>window.G7Core,ll=(e,t)=>window.G7Core?.t?.(e,t)??e,wy=({logo:e,logoAlt:t="Logo",menu:n=[],collapsed:r=!1,onToggleCollapse:s,className:o="",currentLocale:i,id:a,editorAttrs:l})=>{const[c,d]=v.useState(new Set),[u,f]=v.useState(i||jr()?.locale?.current?.()||"ko"),[g,m]=v.useState(window.location.pathname),p=v.useMemo(()=>{const k=[],M=T=>{for(const L of T)L.url&&k.push(L.url),L.children&&M(L.children)};return M(n),k},[n]),y=v.useCallback(k=>{let M=null;for(const T of p)(k===T||k.startsWith(T+"/"))&&(!M||T.length>M.length)&&(M=T);return M},[p]);v.useEffect(()=>{const k=jr();return k?.state?.subscribe?k.state.subscribe(T=>{const L=T?._global?.locale||k?.locale?.current?.()||"ko";f(L);const P=T?._global?.currentPath||window.location.pathname;m(P)}):void 0},[]),v.useEffect(()=>{const k=()=>{m(window.location.pathname)};return window.addEventListener("popstate",k),()=>window.removeEventListener("popstate",k)},[]),v.useEffect(()=>{i&&f(i)},[i]);const b=(k,M)=>!k||typeof M!="string"?!1:M===k?!0:M.startsWith(k+"/")?y(M)===k:!1,_=(k,M)=>{const T=new Set,L=P=>{for(const F of P)if(F.children&&F.children.length>0){if(L(F.children)||b(F.url,M))return T.add(F.id),!0}else if(b(F.url,M))return!0;return!1};return L(k),T};v.useEffect(()=>{if(n.length>0&&g){const k=_(n,g);k.size>0&&d(M=>new Set([...M,...k]))}},[g,n]);const x=k=>b(k,g),E=k=>k.children?k.children.some(M=>x(M.url)||E(M)):!1,S=k=>{d(M=>{const T=new Set(M);return T.has(k)?T.delete(k):T.add(k),T})},w=k=>typeof k=="string"?k:k[u]||k.en||Object.values(k)[0]||"",N=(k,M)=>{jr()?.dispatch?(k.preventDefault(),jr().navigation?.onComplete(()=>{jr().dispatch({handler:"setState",params:{target:"global",sidebarOpen:!1}})}),jr().dispatch({handler:"navigate",params:{path:M}})):window.location.href=M},C=(k,M=0,T=!1)=>{const L=k.children&&k.children.length>0,P=c.has(k.id),F=w(k.name),D=M>0,A=x(k.url),O=E(k),V=D?"admin-sidebar-subitem":"admin-sidebar-item",H="admin-sidebar-item-active",W="admin-sidebar-item-active-parent",j="admin-sidebar-item-default";return h.jsxs(I,{className:D?"relative group":"",children:[D&&h.jsxs(h.Fragment,{children:[!T&&h.jsx(I,{className:"admin-sidebar-tree-line-vertical"}),h.jsx(I,{className:"admin-sidebar-tree-line-curve"})]}),L&&k.url?h.jsxs(I,{className:` - ${V} - ${A?H:O?W:j} + `,role:"status","aria-label":kv("common.loading")}),s&&h.jsx(J,{className:`${l[t]} ${n} font-medium`,children:s})]});return r?h.jsx(I,{id:e,className:"fixed inset-0 z-50 flex items-center justify-center bg-white dark:bg-gray-900 bg-opacity-90 dark:bg-opacity-90","aria-live":"polite","aria-busy":"true",...i,children:c}):h.jsx(I,{id:e,className:"flex items-center justify-center p-4","aria-live":"polite","aria-busy":"true",...i,children:c})},rs=()=>window.G7Core,Tl=(e,t)=>window.G7Core?.t?.(e,t)??e,Sv=({logo:e,logoAlt:t="Logo",menu:n=[],collapsed:r=!1,onToggleCollapse:s,className:o="",currentLocale:i,id:a,editorAttrs:l})=>{const[c,d]=v.useState(new Set),[u,f]=v.useState(i||rs()?.locale?.current?.()||"ko"),[g,m]=v.useState(window.location.pathname),p=v.useMemo(()=>{const w=[],E=T=>{for(const P of T)P.url&&w.push(P.url),P.children&&E(P.children)};return E(n),w},[n]),y=v.useCallback(w=>{let E=null;for(const T of p)(w===T||w.startsWith(T+"/"))&&(!E||T.length>E.length)&&(E=T);return E},[p]);v.useEffect(()=>{const w=rs();return w?.state?.subscribe?w.state.subscribe(T=>{const P=T?._global?.locale||w?.locale?.current?.()||"ko";f(P);const L=T?._global?.currentPath||window.location.pathname;m(L)}):void 0},[]),v.useEffect(()=>{const w=()=>{m(window.location.pathname)};return window.addEventListener("popstate",w),()=>window.removeEventListener("popstate",w)},[]),v.useEffect(()=>{i&&f(i)},[i]);const b=(w,E)=>!w||typeof E!="string"?!1:E===w?!0:E.startsWith(w+"/")?y(E)===w:!1,_=(w,E)=>{const T=new Set,P=L=>{for(const F of L)if(F.children&&F.children.length>0){if(P(F.children)||b(F.url,E))return T.add(F.id),!0}else if(b(F.url,E))return!0;return!1};return P(w),T};v.useEffect(()=>{if(n.length>0&&g){const w=_(n,g);w.size>0&&d(E=>new Set([...E,...w]))}},[g,n]);const x=w=>b(w,g),M=w=>w.children?w.children.some(E=>x(E.url)||M(E)):!1,S=w=>{d(E=>{const T=new Set(E);return T.has(w)?T.delete(w):T.add(w),T})},k=w=>typeof w=="string"?w:w[u]||w.en||Object.values(w)[0]||"",N=(w,E)=>{rs()?.dispatch?(w.preventDefault(),rs().navigation?.onComplete(()=>{rs().dispatch({handler:"setState",params:{target:"global",sidebarOpen:!1}})}),rs().dispatch({handler:"navigate",params:{path:E}})):window.location.href=E},C=(w,E=0,T=!1)=>{const P=w.children&&w.children.length>0,L=c.has(w.id),F=k(w.name),A=E>0,D=x(w.url),O=M(w),z=A?"admin-sidebar-subitem":"admin-sidebar-item",U="admin-sidebar-item-active",j="admin-sidebar-item-active-parent",Y="admin-sidebar-item-default";return h.jsxs(I,{className:A?"relative group":"",children:[A&&h.jsxs(h.Fragment,{children:[!T&&h.jsx(I,{className:"admin-sidebar-tree-line-vertical"}),h.jsx(I,{className:"admin-sidebar-tree-line-curve"})]}),P&&w.url?h.jsxs(I,{className:` + ${z} + ${D?U:O?j:Y} ${r?"justify-center":""} - `,children:[h.jsxs(oe,{onClick:B=>N(B,k.url),className:"flex items-center justify-start flex-1 min-w-0",children:[k.icon&&h.jsx(gt,{className:`${k.icon} ${r?"":"mr-3"} w-5 h-5 flex items-center justify-center`}),!r&&h.jsx(Q,{className:"truncate",children:F})]}),!r&&h.jsxs(I,{className:"admin-sidebar-chevron-trail",children:[k.module_id&&h.jsx(gt,{className:"fas fa-cube admin-sidebar-module-icon",title:"모듈 메뉴"}),h.jsx(oe,{onClick:()=>S(k.id),className:"p-1 rounded hover:bg-gray-200 dark:hover:bg-gray-600","aria-label":ll(P?"common.collapse":"common.expand"),children:h.jsx(gt,{className:`fas fa-chevron-down w-4 h-4 transition-transform ${P?"rotate-180":""}`})})]})]}):L?h.jsxs(oe,{onClick:()=>S(k.id),className:` - ${V} - ${O?W:j} + `,children:[h.jsxs(le,{onClick:W=>N(W,w.url),className:"flex items-center justify-start flex-1 min-w-0",children:[w.icon&&h.jsx(yt,{className:`${w.icon} ${r?"":"mr-3"} w-5 h-5 flex items-center justify-center`}),!r&&h.jsx(J,{className:"truncate",children:F})]}),!r&&h.jsxs(I,{className:"admin-sidebar-chevron-trail",children:[w.module_id&&h.jsx(yt,{className:"fas fa-cube admin-sidebar-module-icon",title:"모듈 메뉴"}),h.jsx(le,{onClick:()=>S(w.id),className:"p-1 rounded hover:bg-gray-200 dark:hover:bg-gray-600","aria-label":Tl(L?"common.collapse":"common.expand"),children:h.jsx(yt,{className:`fas fa-chevron-down w-4 h-4 transition-transform ${L?"rotate-180":""}`})})]})]}):P?h.jsxs(le,{onClick:()=>S(w.id),className:` + ${z} + ${O?j:Y} ${r?"justify-center":""} - `,children:[h.jsxs(I,{className:"admin-sidebar-item-content",children:[k.icon&&h.jsx(I,{className:"admin-sidebar-icon-box",children:h.jsx(gt,{className:k.icon})}),!r&&h.jsx(Q,{children:F})]}),!r&&h.jsxs(I,{className:"admin-sidebar-chevron-trail",children:[k.module_id&&h.jsx(gt,{className:"fas fa-cube admin-sidebar-module-icon",title:"모듈 메뉴"}),h.jsx(gt,{className:`fas fa-chevron-right w-4 h-4 text-slate-400 transition-transform duration-200 ${P?"rotate-90":""}`})]})]}):k.url?h.jsxs(oe,{onClick:B=>N(B,k.url),className:` - ${V} - ${A?H:j} + `,children:[h.jsxs(I,{className:"admin-sidebar-item-content",children:[w.icon&&h.jsx(I,{className:"admin-sidebar-icon-box",children:h.jsx(yt,{className:w.icon})}),!r&&h.jsx(J,{children:F})]}),!r&&h.jsxs(I,{className:"admin-sidebar-chevron-trail",children:[w.module_id&&h.jsx(yt,{className:"fas fa-cube admin-sidebar-module-icon",title:"모듈 메뉴"}),h.jsx(yt,{className:`fas fa-chevron-right w-4 h-4 text-slate-400 transition-transform duration-200 ${L?"rotate-90":""}`})]})]}):w.url?h.jsxs(le,{onClick:W=>N(W,w.url),className:` + ${z} + ${D?U:Y} ${r?"justify-center":""} text-left - `,children:[h.jsxs(I,{className:"admin-sidebar-item-content",children:[k.icon&&h.jsx(I,{className:"admin-sidebar-icon-box",children:h.jsx(gt,{className:k.icon})}),!r&&h.jsx(Q,{children:F})]}),!r&&k.module_id&&h.jsx(gt,{className:"fas fa-cube admin-sidebar-module-icon",title:"모듈 메뉴"})]}):h.jsxs(oe,{className:` - ${V} + `,children:[h.jsxs(I,{className:"admin-sidebar-item-content",children:[w.icon&&h.jsx(I,{className:"admin-sidebar-icon-box",children:h.jsx(yt,{className:w.icon})}),!r&&h.jsx(J,{children:F})]}),!r&&w.module_id&&h.jsx(yt,{className:"fas fa-cube admin-sidebar-module-icon",title:"모듈 메뉴"})]}):h.jsxs(le,{className:` + ${z} admin-sidebar-item-disabled ${r?"justify-center":""} text-left - `,children:[h.jsxs(I,{className:"admin-sidebar-item-content",children:[k.icon&&h.jsx(I,{className:"admin-sidebar-icon-box",children:h.jsx(gt,{className:k.icon})}),!r&&h.jsx(Q,{children:F})]}),!r&&k.module_id&&h.jsx(gt,{className:"fas fa-cube admin-sidebar-module-icon",title:"모듈 메뉴"})]}),L&&!r&&P&&h.jsx(I,{className:"relative ml-2",children:k.children.map((B,G)=>C(B,M+1,G===k.children.length-1))})]},k.id)};return h.jsxs(I,{className:o,id:a,...l,children:[(e||s)&&h.jsxs(I,{className:"admin-sidebar-header",children:[e&&!r&&h.jsx(kn,{src:e,alt:t,className:"h-8"}),s&&h.jsx(oe,{onClick:s,className:"admin-sidebar-collapse-btn","aria-label":ll(r?"common.expand_sidebar":"common.collapse_sidebar"),children:h.jsx(gt,{className:`${r?"fas fa-chevron-right":"fas fa-chevron-left"} w-5 h-5 text-slate-600 dark:text-slate-400`})})]}),h.jsx(I,{className:"admin-sidebar-menu-list",children:n.map((k,M)=>C(k,0,M===n.length-1))})]})},Os=(e,t)=>window.G7Core?.t?.(e,t)??e,ky=({user:e={name:"",email:""},notifications:t=[],onNotificationClick:n,onProfileClick:r,onLogoutClick:s,className:o=""})=>{const[i,a]=v.useState(!1),[l,c]=v.useState(!1),d=v.useRef(null),u=v.useRef(null),f=t.filter(g=>!g.read).length;return v.useEffect(()=>{const g=m=>{d.current&&!d.current.contains(m.target)&&a(!1),u.current&&!u.current.contains(m.target)&&c(!1)};return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[]),h.jsxs(I,{className:` + `,children:[h.jsxs(I,{className:"admin-sidebar-item-content",children:[w.icon&&h.jsx(I,{className:"admin-sidebar-icon-box",children:h.jsx(yt,{className:w.icon})}),!r&&h.jsx(J,{children:F})]}),!r&&w.module_id&&h.jsx(yt,{className:"fas fa-cube admin-sidebar-module-icon",title:"모듈 메뉴"})]}),P&&!r&&L&&h.jsx(I,{className:"relative ml-2",children:w.children.map((W,G)=>C(W,E+1,G===w.children.length-1))})]},w.id)};return h.jsxs(I,{className:o,id:a,...l,children:[(e||s)&&h.jsxs(I,{className:"admin-sidebar-header",children:[e&&!r&&h.jsx(Nn,{src:e,alt:t,className:"h-8"}),s&&h.jsx(le,{onClick:s,className:"admin-sidebar-collapse-btn","aria-label":Tl(r?"common.expand_sidebar":"common.collapse_sidebar"),children:h.jsx(yt,{className:`${r?"fas fa-chevron-right":"fas fa-chevron-left"} w-5 h-5 text-slate-600 dark:text-slate-400`})})]}),h.jsx(I,{className:"admin-sidebar-menu-list",children:n.map((w,E)=>C(w,0,E===n.length-1))})]})},Ws=(e,t)=>window.G7Core?.t?.(e,t)??e,_v=({user:e={name:"",email:""},notifications:t=[],onNotificationClick:n,onProfileClick:r,onLogoutClick:s,className:o=""})=>{const[i,a]=v.useState(!1),[l,c]=v.useState(!1),d=v.useRef(null),u=v.useRef(null),f=t.filter(g=>!g.read).length;return v.useEffect(()=>{const g=m=>{d.current&&!d.current.contains(m.target)&&a(!1),u.current&&!u.current.contains(m.target)&&c(!1)};return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[]),h.jsxs(I,{className:` bg-white dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700 px-6 py-4 flex items-center justify-end gap-4 ${o} - `,children:[h.jsxs(I,{ref:d,className:"relative",children:[h.jsxs(oe,{onClick:()=>a(!i),className:"relative p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-full transition-colors","aria-label":Os("common.notifications"),children:[h.jsx(re,{name:de.Bell,className:"w-5 h-5 text-gray-600 dark:text-gray-400"}),f>0&&h.jsx(Q,{className:"absolute top-0 right-0 flex items-center justify-center w-5 h-5 text-xs font-bold text-white bg-red-500 rounded-full",children:f>9?"9+":f})]}),i&&h.jsxs(I,{className:"absolute right-0 mt-2 w-80 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg z-50",children:[h.jsx(I,{className:"px-4 py-3 border-b border-gray-200 dark:border-gray-700",children:h.jsx(Q,{className:"font-semibold text-gray-900 dark:text-white",children:Os("common.notifications")})}),h.jsx(I,{className:"max-h-96 overflow-y-auto",children:t.length===0?h.jsx(I,{className:"px-4 py-8 text-center text-gray-500 dark:text-gray-400",children:h.jsx(Q,{children:Os("common.no_notifications")})}):t.map(g=>h.jsx(oe,{onClick:()=>{g.onClick?.(),n?.(g.id),a(!1)},className:` + `,children:[h.jsxs(I,{ref:d,className:"relative",children:[h.jsxs(le,{onClick:()=>a(!i),className:"relative p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-full transition-colors","aria-label":Ws("common.notifications"),children:[h.jsx(ae,{name:he.Bell,className:"w-5 h-5 text-gray-600 dark:text-gray-400"}),f>0&&h.jsx(J,{className:"absolute top-0 right-0 flex items-center justify-center w-5 h-5 text-xs font-bold text-white bg-red-500 rounded-full",children:f>9?"9+":f})]}),i&&h.jsxs(I,{className:"absolute right-0 mt-2 w-80 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg z-50",children:[h.jsx(I,{className:"px-4 py-3 border-b border-gray-200 dark:border-gray-700",children:h.jsx(J,{className:"font-semibold text-gray-900 dark:text-white",children:Ws("common.notifications")})}),h.jsx(I,{className:"max-h-96 overflow-y-auto",children:t.length===0?h.jsx(I,{className:"px-4 py-8 text-center text-gray-500 dark:text-gray-400",children:h.jsx(J,{children:Ws("common.no_notifications")})}):t.map(g=>h.jsx(le,{onClick:()=>{g.onClick?.(),n?.(g.id),a(!1)},className:` w-full px-4 py-3 text-left hover:bg-gray-50 dark:hover:bg-gray-700 border-b border-gray-100 dark:border-gray-700 transition-colors ${g.read?"":"bg-blue-50 dark:bg-blue-900/20"} - `,children:h.jsxs(I,{className:"flex items-start gap-3",children:[g.iconName&&h.jsx(re,{name:g.iconName,className:"w-5 h-5 text-gray-600 dark:text-gray-400 mt-0.5"}),h.jsxs(I,{className:"flex-1",children:[h.jsx(I,{className:"font-semibold text-gray-900 dark:text-white text-sm",children:g.title}),h.jsx(I,{className:"text-gray-600 dark:text-gray-400 text-sm mt-1",children:g.message}),h.jsx(I,{className:"text-gray-400 dark:text-gray-500 text-xs mt-1",children:g.time})]}),!g.read&&h.jsx(Q,{className:"w-2 h-2 bg-blue-500 rounded-full mt-1.5"})]})},g.id))})]})]}),h.jsxs(I,{ref:u,className:"relative",children:[h.jsxs(oe,{onClick:()=>c(!l),className:"flex items-center gap-3 px-3 py-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:[e.avatar?h.jsx(kn,{src:e.avatar,alt:e.name,className:"w-8 h-8 rounded-full object-cover"}):h.jsx(I,{className:"w-8 h-8 rounded-full bg-gray-300 dark:bg-gray-600 flex items-center justify-center",children:h.jsx(re,{name:de.User,className:"w-5 h-5 text-gray-600 dark:text-gray-400"})}),h.jsxs(I,{className:"hidden md:block text-left",children:[h.jsx(I,{className:"font-semibold text-gray-900 dark:text-white text-sm",children:e.name}),e.role&&h.jsx(I,{className:"text-gray-500 dark:text-gray-400 text-xs",children:e.role})]}),h.jsx(re,{name:de.ChevronDown,className:"w-4 h-4 text-gray-600 dark:text-gray-400"})]}),l&&h.jsxs(I,{className:"absolute right-0 mt-2 w-56 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg z-50",children:[h.jsxs(I,{className:"px-4 py-3 border-b border-gray-200 dark:border-gray-700",children:[h.jsx(I,{className:"font-semibold text-gray-900 dark:text-white",children:e.name}),h.jsx(I,{className:"text-gray-500 dark:text-gray-400 text-sm",children:e.email})]}),h.jsxs(I,{className:"py-2",children:[h.jsxs(oe,{onClick:()=>{r?.(),c(!1)},className:"w-full px-4 py-2 text-left hover:bg-gray-50 dark:hover:bg-gray-700 flex items-center gap-3 transition-colors text-gray-900 dark:text-white",children:[h.jsx(re,{name:de.User,className:"w-5 h-5 text-gray-600 dark:text-gray-400"}),h.jsx(Q,{children:Os("common.profile_settings")})]}),h.jsxs(oe,{onClick:()=>{s?.(),c(!1)},className:"w-full px-4 py-2 text-left hover:bg-gray-50 dark:hover:bg-gray-700 flex items-center gap-3 text-red-600 dark:text-red-400 transition-colors",children:[h.jsx(re,{name:de.ArrowRight,className:"w-5 h-5"}),h.jsx(Q,{children:Os("common.logout")})]})]})]})]})]})},Cy=({notifications:e=[],unreadCount:t=0,hasMore:n=!1,loading:r=!1,titleText:s="Notifications",emptyText:o="No notifications",markAllReadText:i="Mark all as read",deleteAllText:a="Delete all",unreadOnlyText:l="Unread only",unreadOnly:c=!1,onNotificationClick:d,onClose:u,onLoadMore:f,onMarkAllRead:g,onDeleteAll:m,onDelete:p,onUnreadOnlyToggle:y,dropdownAlign:b="right",className:_="",id:x,editorAttrs:E})=>{const[S,w]=v.useState(!1),N=v.useRef(null),C=v.useRef(null),k=v.useRef(null),M=v.useRef(null),T=v.useRef(new Set),L=v.useRef(f),P=v.useRef(n),F=v.useRef(r),D=v.useRef(e.length),A=v.useRef(-1);v.useEffect(()=>{L.current=f,P.current=n,F.current=r,D.current=e.length}),v.useEffect(()=>{if(!M.current||!k.current||!S)return;A.current=-1;const W=new IntersectionObserver(([j])=>{j.isIntersecting&&(F.current||!P.current||A.current!==D.current&&(A.current=D.current,L.current?.()))},{root:k.current,threshold:.1});return W.observe(M.current),()=>W.disconnect()},[S]),v.useEffect(()=>{if(!k.current||!S)return;const W=new IntersectionObserver(U=>{U.forEach(B=>{const G=B.target.getAttribute("data-notification-id"),z=B.target.getAttribute("data-unread")==="true";G&&z&&B.isIntersecting&&T.current.add(G)})},{root:k.current,threshold:.5});return k.current.querySelectorAll("[data-notification-id]").forEach(U=>W.observe(U)),()=>W.disconnect()},[S,e]);const O=t>0?t:e.filter(W=>!W.read).length,V=v.useCallback(()=>{if(S){if(O>0){const W=Array.from(T.current).filter(j=>{const U=e.find(B=>String(B.id)===String(j));return U&&!U.read});W.length>0&&u?.(W)}T.current.clear(),w(!1)}},[S,u,O,e]);v.useEffect(()=>{if(!S)return;const W=j=>{N.current&&!N.current.contains(j.target)&&V()};return document.addEventListener("mousedown",W),()=>document.removeEventListener("mousedown",W)},[S,V]);const H=v.useCallback(()=>{S?V():w(!0)},[S,V]);return v.useLayoutEffect(()=>{const W=C.current;if(!S||!W)return;W.style.transform="";const j=W.getBoundingClientRect(),U=typeof window<"u"?window.innerWidth:0;if(j.width===0&&j.height===0)return;const B=8;let G=0;j.right>U-B?G=-(j.right-(U-B)):j.left0&&h.jsx(Q,{className:"absolute top-0 right-0 flex items-center justify-center w-5 h-5 text-xs font-bold text-white bg-red-500 dark:bg-red-600 rounded-full",children:O>99?"99+":O})]}),S&&h.jsxs(I,{ref:C,className:`absolute ${b==="left"?"left-0":"right-0"} mt-2 w-80 max-w-[calc(100vw-1rem)] bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg z-50`,children:[h.jsxs(I,{className:"px-4 py-3 border-b border-gray-200 dark:border-gray-700 flex items-center justify-between gap-2",children:[h.jsxs(I,{className:"flex items-center gap-3 min-w-0",children:[h.jsx(Q,{className:"font-semibold text-gray-900 dark:text-white",children:s}),y&&h.jsxs(I,{className:"flex items-center gap-1.5 cursor-pointer select-none",onClick:()=>y(!c),children:[h.jsx(wt,{type:"checkbox",checked:c,onChange:W=>{W.stopPropagation(),y(W.target.checked)},onClick:W=>W.stopPropagation(),className:"w-3.5 h-3.5 rounded border-gray-300 dark:border-gray-600 text-blue-600 dark:text-blue-400 focus:ring-blue-500 dark:focus:ring-blue-400 cursor-pointer"}),h.jsx(Q,{className:"text-xs text-gray-600 dark:text-gray-400",children:l})]})]}),h.jsxs(I,{className:"flex items-center gap-3 flex-shrink-0",children:[g&&O>0&&h.jsx(oe,{onClick:()=>{g(),T.current.clear()},className:"text-xs text-blue-600 dark:text-blue-400 hover:text-blue-800 dark:hover:text-blue-300 hover:underline cursor-pointer",children:i}),m&&e.length>0&&h.jsx(oe,{onClick:()=>{m()},className:"text-xs text-red-600 dark:text-red-400 hover:text-red-800 dark:hover:text-red-300 hover:underline cursor-pointer",children:a})]})]}),h.jsx(I,{ref:k,className:"max-h-96 overflow-y-auto",children:e.length===0&&!r?h.jsx(I,{className:"px-4 py-8 text-center text-gray-500 dark:text-gray-400",children:h.jsx(Q,{children:o})}):h.jsxs(h.Fragment,{children:[e.map(W=>{const j=!W.read;return h.jsxs(I,{"data-notification-id":W.id,"data-unread":j?"true":"false",onClick:()=>{W.onClick?.(),d?.(W),w(!1)},className:`group flex items-start gap-3 px-4 py-3 text-left border-b border-gray-100 dark:border-gray-700 transition-colors cursor-pointer ${j?"bg-blue-50/70 dark:bg-blue-900/20 hover:bg-blue-50 dark:hover:bg-blue-900/30":"bg-white dark:bg-gray-800 hover:bg-gray-50 dark:hover:bg-gray-700/50 opacity-70"}`,children:[W.iconName&&h.jsx(re,{name:W.iconName,className:`w-5 h-5 mt-0.5 flex-shrink-0 ${j?"text-blue-600 dark:text-blue-400":"text-gray-400 dark:text-gray-500"}`}),h.jsxs(I,{className:"flex-1 min-w-0",children:[h.jsx(I,{className:`text-sm truncate ${j?"font-semibold text-gray-900 dark:text-white":"font-normal text-gray-600 dark:text-gray-400"}`,children:W.title}),h.jsx(I,{className:`text-sm mt-1 line-clamp-2 ${j?"text-gray-700 dark:text-gray-300":"text-gray-500 dark:text-gray-500"}`,children:W.message}),h.jsx(I,{className:"text-gray-400 dark:text-gray-500 text-xs mt-1 font-mono",children:W.time})]}),h.jsxs(I,{className:"flex flex-col items-center gap-2 flex-shrink-0",children:[j&&h.jsx(Q,{className:"w-2 h-2 bg-blue-500 dark:bg-blue-400 rounded-full mt-1.5"}),p&&h.jsx(oe,{onClick:U=>{U.stopPropagation(),p(W)},className:"p-1 text-gray-400 dark:text-gray-500 hover:text-red-600 dark:hover:text-red-400 rounded hover:bg-red-50 dark:hover:bg-red-900/20 cursor-pointer opacity-0 group-hover:opacity-100 transition-opacity","aria-label":"Delete notification",children:h.jsx(re,{name:de.Trash,className:"w-4 h-4"})})]})]},W.id)}),n&&h.jsx(I,{ref:M,className:"px-4 py-3 text-center",children:r?h.jsx(Q,{className:"text-sm text-gray-400 dark:text-gray-500",children:"..."}):h.jsx(Q,{className:"text-sm text-gray-400 dark:text-gray-500"})}),r&&!n&&e.length>0&&h.jsx(I,{className:"px-4 py-2 text-center",children:h.jsx(Q,{className:"text-sm text-gray-400 dark:text-gray-500",children:"..."})})]})})]})]})},uu=window.G7Core?.createLogger?.("Comp:UserProfile")??{log:(...e)=>console.log("[Comp:UserProfile]",...e),warn:(...e)=>console.warn("[Comp:UserProfile]",...e),error:(...e)=>console.error("[Comp:UserProfile]",...e)},Sy=({user:e={name:"",email:""},profileText:t="Profile Settings",logoutText:n="Logout",onProfileClick:r,onLogoutClick:s,className:o="",logoutEndpoint:i="/api/admin/auth/logout",redirectPath:a="/admin/login",showChevron:l=!0,dropdownDirection:c="up",dropdownOnly:d=!1,id:u,editorAttrs:f})=>{const[g,m]=v.useState(!1),[p,y]=v.useState(!1),b=v.useRef(null);v.useEffect(()=>{const S=w=>{b.current&&!b.current.contains(w.target)&&m(!1)};return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[]);const _=()=>{const w=`; ${document.cookie}`.split("; XSRF-TOKEN=");return w.length===2?decodeURIComponent(w.pop()?.split(";").shift()||""):null},x=()=>localStorage.getItem("auth_token"),E=async()=>{if(!p)try{if(y(!0),m(!1),s){s();return}const S=_(),w=x(),N=await fetch(i,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json",...S&&{"X-XSRF-TOKEN":S},...w&&{Authorization:`Bearer ${w}`}},credentials:"include"});N.ok?(localStorage.removeItem("auth_token"),window.location.href=a):(uu.error("로그아웃 실패:",N.statusText),localStorage.removeItem("auth_token"),window.location.href=a)}catch(S){uu.error("로그아웃 오류:",S),localStorage.removeItem("auth_token"),window.location.href=a}finally{y(!1)}};return h.jsxs(I,{ref:b,className:d?`absolute inset-0 ${o}`:`relative ${o}`,id:u,...f,children:[h.jsx(oe,{onClick:()=>m(!g),className:d?"w-full h-full opacity-0 cursor-pointer":"flex items-center gap-2 px-3 py-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors w-full",children:!d&&h.jsxs(h.Fragment,{children:[e.avatar?h.jsx(kn,{src:e.avatar,alt:e.name,className:"w-8 h-8 rounded-full object-cover"}):h.jsx(I,{className:"w-8 h-8 rounded-full bg-gray-300 dark:bg-gray-600 flex items-center justify-center",children:h.jsx(re,{name:de.User,className:"w-5 h-5 text-gray-600 dark:text-gray-400"})}),h.jsxs(I,{className:"flex-1 text-left",children:[h.jsx(I,{className:"font-semibold text-gray-900 dark:text-white text-sm",children:e.name}),e.role&&h.jsx(I,{className:"text-gray-500 dark:text-gray-400 text-xs",children:e.role})]}),l&&h.jsx(re,{name:de.ChevronDown,className:"w-4 h-4 text-gray-600 dark:text-gray-400"})]})}),g&&h.jsxs(I,{className:`absolute ${c==="down"?"top-full mt-2":"bottom-full mb-2"} ${d?"right-0 w-72":"left-0 w-full"} bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg z-50`,children:[h.jsxs(I,{className:"px-4 py-3 border-b border-gray-200 dark:border-gray-700 cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors",onClick:()=>{m(!1),window.G7Core?.dispatch({handler:"navigate",params:{path:`/admin/users/${e.uuid}`}})},children:[h.jsx(I,{className:"font-semibold text-gray-900 dark:text-white",children:e.name}),h.jsx(I,{className:"text-gray-500 dark:text-gray-400 text-sm",children:e.email})]}),h.jsxs(I,{className:"py-2",children:[h.jsxs(oe,{onClick:()=>{m(!1),r?r():window.G7Core?.dispatch({handler:"navigate",params:{path:`/admin/users/${e.uuid}/edit`}})},className:"w-full px-4 py-2 text-left hover:bg-gray-50 dark:hover:bg-gray-700 flex items-center justify-start gap-3 transition-colors",children:[h.jsx(re,{name:de.User,className:"w-5 h-5 text-gray-600 dark:text-gray-400"}),h.jsx(Q,{className:"text-gray-900 dark:text-white",children:t})]}),h.jsxs(oe,{onClick:E,disabled:p,className:"w-full px-4 py-2 text-left hover:bg-gray-50 dark:hover:bg-gray-700 flex items-center justify-start gap-3 text-red-600 dark:text-red-400 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:[h.jsx(re,{name:de.ArrowRight,className:"w-5 h-5"}),h.jsx(Q,{children:p?"Logging out...":n})]})]})]})]})},jo=window.G7Core?.createLogger?.("Comp:LanguageSelector")??{log:(...e)=>console.log("[Comp:LanguageSelector]",...e),warn:(...e)=>console.warn("[Comp:LanguageSelector]",...e),error:(...e)=>console.error("[Comp:LanguageSelector]",...e)},fu=e=>{const t=window.G7Core?.state?.get?.("_global.appConfig.localeNames")?.[e];return t||{ko:"한국어",en:"English",ja:"日本語",zh:"中文",es:"Español",fr:"Français",de:"Deutsch"}[e]||e},_y=({availableLocales:e=["ko","en"],languageText:t="Language",apiEndpoint:n="/api/admin/users/me/language",onLanguageChange:r,className:s="",inline:o=!1,showCode:i=!1,id:a,editorAttrs:l})=>{const[c,d]=v.useState(!1),[u,f]=v.useState(!1),[g,m]=v.useState(()=>localStorage.getItem("g7_locale")||"ko"),p=v.useRef(null);v.useEffect(()=>{if(o)return;const x=E=>{p.current&&!p.current.contains(E.target)&&d(!1)};return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[o]);const y=()=>{const E=`; ${document.cookie}`.split("; XSRF-TOKEN=");return E.length===2?decodeURIComponent(E.pop()?.split(";").shift()||""):null},b=()=>localStorage.getItem("auth_token"),_=async x=>{if(!(u||x===g))try{f(!0);const E=y(),S=b();try{const w=await fetch(n,{method:"PATCH",headers:{"Content-Type":"application/json",Accept:"application/json",...E&&{"X-XSRF-TOKEN":E},...S&&{Authorization:`Bearer ${S}`}},credentials:"include",body:JSON.stringify({language:x})});w.ok||jo.warn("언어 설정 저장 실패 (UI는 변경됨):",w.statusText)}catch(w){jo.warn("언어 설정 API 호출 실패 (UI는 변경됨):",w)}m(x),d(!1),r?.(x),window.__templateApp?await window.__templateApp.changeLocale(x):(jo.warn("TemplateApp not found, reloading page"),window.location.reload())}catch(E){jo.error("언어 변경 오류:",E)}finally{f(!1)}};return o?h.jsxs(I,{className:`${s}`,id:a,...l,children:[h.jsxs(oe,{onClick:()=>d(!c),disabled:u,className:"w-full px-4 py-2 text-left hover:bg-gray-50 dark:hover:bg-gray-700 flex items-center gap-3 transition-colors",children:[h.jsx(re,{name:de.Globe,className:"w-5 h-5 text-gray-600 dark:text-gray-400"}),h.jsx(Q,{className:"text-gray-900 dark:text-white flex-1",children:t}),h.jsx(Q,{className:"px-2 py-0.5 text-xs font-medium bg-blue-100 dark:bg-blue-900 text-blue-700 dark:text-blue-300 rounded",children:g.toUpperCase()}),h.jsx(re,{name:de.ChevronDown,className:`w-4 h-4 text-gray-400 dark:text-gray-500 transition-transform ${c?"rotate-180":""}`})]}),c&&h.jsx(I,{className:"px-4 py-2 flex flex-wrap gap-2",children:e.map(x=>h.jsx(oe,{onClick:()=>_(x),disabled:u,className:` + `,children:h.jsxs(I,{className:"flex items-start gap-3",children:[g.iconName&&h.jsx(ae,{name:g.iconName,className:"w-5 h-5 text-gray-600 dark:text-gray-400 mt-0.5"}),h.jsxs(I,{className:"flex-1",children:[h.jsx(I,{className:"font-semibold text-gray-900 dark:text-white text-sm",children:g.title}),h.jsx(I,{className:"text-gray-600 dark:text-gray-400 text-sm mt-1",children:g.message}),h.jsx(I,{className:"text-gray-400 dark:text-gray-500 text-xs mt-1",children:g.time})]}),!g.read&&h.jsx(J,{className:"w-2 h-2 bg-blue-500 rounded-full mt-1.5"})]})},g.id))})]})]}),h.jsxs(I,{ref:u,className:"relative",children:[h.jsxs(le,{onClick:()=>c(!l),className:"flex items-center gap-3 px-3 py-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:[e.avatar?h.jsx(Nn,{src:e.avatar,alt:e.name,className:"w-8 h-8 rounded-full object-cover"}):h.jsx(I,{className:"w-8 h-8 rounded-full bg-gray-300 dark:bg-gray-600 flex items-center justify-center",children:h.jsx(ae,{name:he.User,className:"w-5 h-5 text-gray-600 dark:text-gray-400"})}),h.jsxs(I,{className:"hidden md:block text-left",children:[h.jsx(I,{className:"font-semibold text-gray-900 dark:text-white text-sm",children:e.name}),e.role&&h.jsx(I,{className:"text-gray-500 dark:text-gray-400 text-xs",children:e.role})]}),h.jsx(ae,{name:he.ChevronDown,className:"w-4 h-4 text-gray-600 dark:text-gray-400"})]}),l&&h.jsxs(I,{className:"absolute right-0 mt-2 w-56 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg z-50",children:[h.jsxs(I,{className:"px-4 py-3 border-b border-gray-200 dark:border-gray-700",children:[h.jsx(I,{className:"font-semibold text-gray-900 dark:text-white",children:e.name}),h.jsx(I,{className:"text-gray-500 dark:text-gray-400 text-sm",children:e.email})]}),h.jsxs(I,{className:"py-2",children:[h.jsxs(le,{onClick:()=>{r?.(),c(!1)},className:"w-full px-4 py-2 text-left hover:bg-gray-50 dark:hover:bg-gray-700 flex items-center gap-3 transition-colors text-gray-900 dark:text-white",children:[h.jsx(ae,{name:he.User,className:"w-5 h-5 text-gray-600 dark:text-gray-400"}),h.jsx(J,{children:Ws("common.profile_settings")})]}),h.jsxs(le,{onClick:()=>{s?.(),c(!1)},className:"w-full px-4 py-2 text-left hover:bg-gray-50 dark:hover:bg-gray-700 flex items-center gap-3 text-red-600 dark:text-red-400 transition-colors",children:[h.jsx(ae,{name:he.ArrowRight,className:"w-5 h-5"}),h.jsx(J,{children:Ws("common.logout")})]})]})]})]})]})},Ev=({notifications:e=[],unreadCount:t=0,hasMore:n=!1,loading:r=!1,titleText:s="Notifications",emptyText:o="No notifications",markAllReadText:i="Mark all as read",deleteAllText:a="Delete all",unreadOnlyText:l="Unread only",unreadOnly:c=!1,onNotificationClick:d,onClose:u,onLoadMore:f,onMarkAllRead:g,onDeleteAll:m,onDelete:p,onUnreadOnlyToggle:y,dropdownAlign:b="right",className:_="",id:x,editorAttrs:M})=>{const[S,k]=v.useState(!1),N=v.useRef(null),C=v.useRef(null),w=v.useRef(null),E=v.useRef(null),T=v.useRef(new Set),P=v.useRef(f),L=v.useRef(n),F=v.useRef(r),A=v.useRef(e.length),D=v.useRef(-1);v.useEffect(()=>{P.current=f,L.current=n,F.current=r,A.current=e.length}),v.useEffect(()=>{if(!E.current||!w.current||!S)return;D.current=-1;const j=new IntersectionObserver(([Y])=>{Y.isIntersecting&&(F.current||!L.current||D.current!==A.current&&(D.current=A.current,P.current?.()))},{root:w.current,threshold:.1});return j.observe(E.current),()=>j.disconnect()},[S]),v.useEffect(()=>{if(!w.current||!S)return;const j=new IntersectionObserver(B=>{B.forEach(W=>{const G=W.target.getAttribute("data-notification-id"),V=W.target.getAttribute("data-unread")==="true";G&&V&&W.isIntersecting&&T.current.add(G)})},{root:w.current,threshold:.5});return w.current.querySelectorAll("[data-notification-id]").forEach(B=>j.observe(B)),()=>j.disconnect()},[S,e]);const O=t>0?t:e.filter(j=>!j.read).length,z=v.useCallback(()=>{if(S){if(O>0){const j=Array.from(T.current).filter(Y=>{const B=e.find(W=>String(W.id)===String(Y));return B&&!B.read});j.length>0&&u?.(j)}T.current.clear(),k(!1)}},[S,u,O,e]);v.useEffect(()=>{if(!S)return;const j=Y=>{N.current&&!N.current.contains(Y.target)&&z()};return document.addEventListener("mousedown",j),()=>document.removeEventListener("mousedown",j)},[S,z]);const U=v.useCallback(()=>{S?z():k(!0)},[S,z]);return v.useLayoutEffect(()=>{const j=C.current;if(!S||!j)return;j.style.transform="";const Y=j.getBoundingClientRect(),B=typeof window<"u"?window.innerWidth:0;if(Y.width===0&&Y.height===0)return;const W=8;let G=0;Y.right>B-W?G=-(Y.right-(B-W)):Y.left0&&h.jsx(J,{className:"absolute top-0 right-0 flex items-center justify-center w-5 h-5 text-xs font-bold text-white bg-red-500 dark:bg-red-600 rounded-full",children:O>99?"99+":O})]}),S&&h.jsxs(I,{ref:C,className:`absolute ${b==="left"?"left-0":"right-0"} mt-2 w-80 max-w-[calc(100vw-1rem)] bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg z-50`,children:[h.jsxs(I,{className:"px-4 py-3 border-b border-gray-200 dark:border-gray-700 flex items-center justify-between gap-2",children:[h.jsxs(I,{className:"flex items-center gap-3 min-w-0",children:[h.jsx(J,{className:"font-semibold text-gray-900 dark:text-white",children:s}),y&&h.jsxs(I,{className:"flex items-center gap-1.5 cursor-pointer select-none",onClick:()=>y(!c),children:[h.jsx(Et,{type:"checkbox",checked:c,onChange:j=>{j.stopPropagation(),y(j.target.checked)},onClick:j=>j.stopPropagation(),className:"w-3.5 h-3.5 rounded border-gray-300 dark:border-gray-600 text-blue-600 dark:text-blue-400 focus:ring-blue-500 dark:focus:ring-blue-400 cursor-pointer"}),h.jsx(J,{className:"text-xs text-gray-600 dark:text-gray-400",children:l})]})]}),h.jsxs(I,{className:"flex items-center gap-3 flex-shrink-0",children:[g&&O>0&&h.jsx(le,{onClick:()=>{g(),T.current.clear()},className:"text-xs text-blue-600 dark:text-blue-400 hover:text-blue-800 dark:hover:text-blue-300 hover:underline cursor-pointer",children:i}),m&&e.length>0&&h.jsx(le,{onClick:()=>{m()},className:"text-xs text-red-600 dark:text-red-400 hover:text-red-800 dark:hover:text-red-300 hover:underline cursor-pointer",children:a})]})]}),h.jsx(I,{ref:w,className:"max-h-96 overflow-y-auto",children:e.length===0&&!r?h.jsx(I,{className:"px-4 py-8 text-center text-gray-500 dark:text-gray-400",children:h.jsx(J,{children:o})}):h.jsxs(h.Fragment,{children:[e.map(j=>{const Y=!j.read;return h.jsxs(I,{"data-notification-id":j.id,"data-unread":Y?"true":"false",onClick:()=>{j.onClick?.(),d?.(j),k(!1)},className:`group flex items-start gap-3 px-4 py-3 text-left border-b border-gray-100 dark:border-gray-700 transition-colors cursor-pointer ${Y?"bg-blue-50/70 dark:bg-blue-900/20 hover:bg-blue-50 dark:hover:bg-blue-900/30":"bg-white dark:bg-gray-800 hover:bg-gray-50 dark:hover:bg-gray-700/50 opacity-70"}`,children:[j.iconName&&h.jsx(ae,{name:j.iconName,className:`w-5 h-5 mt-0.5 flex-shrink-0 ${Y?"text-blue-600 dark:text-blue-400":"text-gray-400 dark:text-gray-500"}`}),h.jsxs(I,{className:"flex-1 min-w-0",children:[h.jsx(I,{className:`text-sm truncate ${Y?"font-semibold text-gray-900 dark:text-white":"font-normal text-gray-600 dark:text-gray-400"}`,children:j.title}),h.jsx(I,{className:`text-sm mt-1 line-clamp-2 ${Y?"text-gray-700 dark:text-gray-300":"text-gray-500 dark:text-gray-500"}`,children:j.message}),h.jsx(I,{className:"text-gray-400 dark:text-gray-500 text-xs mt-1 font-mono",children:j.time})]}),h.jsxs(I,{className:"flex flex-col items-center gap-2 flex-shrink-0",children:[Y&&h.jsx(J,{className:"w-2 h-2 bg-blue-500 dark:bg-blue-400 rounded-full mt-1.5"}),p&&h.jsx(le,{onClick:B=>{B.stopPropagation(),p(j)},className:"p-1 text-gray-400 dark:text-gray-500 hover:text-red-600 dark:hover:text-red-400 rounded hover:bg-red-50 dark:hover:bg-red-900/20 cursor-pointer opacity-0 group-hover:opacity-100 transition-opacity","aria-label":"Delete notification",children:h.jsx(ae,{name:he.Trash,className:"w-4 h-4"})})]})]},j.id)}),n&&h.jsx(I,{ref:E,className:"px-4 py-3 text-center",children:r?h.jsx(J,{className:"text-sm text-gray-400 dark:text-gray-500",children:"..."}):h.jsx(J,{className:"text-sm text-gray-400 dark:text-gray-500"})}),r&&!n&&e.length>0&&h.jsx(I,{className:"px-4 py-2 text-center",children:h.jsx(J,{className:"text-sm text-gray-400 dark:text-gray-500",children:"..."})})]})})]})]})},Gu=window.G7Core?.createLogger?.("Comp:UserProfile")??{log:(...e)=>console.log("[Comp:UserProfile]",...e),warn:(...e)=>console.warn("[Comp:UserProfile]",...e),error:(...e)=>console.error("[Comp:UserProfile]",...e)},Mv=({user:e={name:"",email:""},profileText:t="Profile Settings",logoutText:n="Logout",onProfileClick:r,onLogoutClick:s,className:o="",logoutEndpoint:i="/api/admin/auth/logout",redirectPath:a="/admin/login",showChevron:l=!0,dropdownDirection:c="up",dropdownOnly:d=!1,id:u,editorAttrs:f})=>{const[g,m]=v.useState(!1),[p,y]=v.useState(!1),b=v.useRef(null);v.useEffect(()=>{const S=k=>{b.current&&!b.current.contains(k.target)&&m(!1)};return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[]);const _=()=>{const k=`; ${document.cookie}`.split("; XSRF-TOKEN=");return k.length===2?decodeURIComponent(k.pop()?.split(";").shift()||""):null},x=()=>localStorage.getItem("auth_token"),M=async()=>{if(!p)try{if(y(!0),m(!1),s){s();return}const S=_(),k=x(),N=await fetch(i,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json",...S&&{"X-XSRF-TOKEN":S},...k&&{Authorization:`Bearer ${k}`}},credentials:"include"});N.ok?(localStorage.removeItem("auth_token"),window.location.href=a):(Gu.error("로그아웃 실패:",N.statusText),localStorage.removeItem("auth_token"),window.location.href=a)}catch(S){Gu.error("로그아웃 오류:",S),localStorage.removeItem("auth_token"),window.location.href=a}finally{y(!1)}};return h.jsxs(I,{ref:b,className:d?`absolute inset-0 ${o}`:`relative ${o}`,id:u,...f,children:[h.jsx(le,{onClick:()=>m(!g),className:d?"w-full h-full opacity-0 cursor-pointer":"flex items-center gap-2 px-3 py-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors w-full",children:!d&&h.jsxs(h.Fragment,{children:[e.avatar?h.jsx(Nn,{src:e.avatar,alt:e.name,className:"w-8 h-8 rounded-full object-cover"}):h.jsx(I,{className:"w-8 h-8 rounded-full bg-gray-300 dark:bg-gray-600 flex items-center justify-center",children:h.jsx(ae,{name:he.User,className:"w-5 h-5 text-gray-600 dark:text-gray-400"})}),h.jsxs(I,{className:"flex-1 text-left",children:[h.jsx(I,{className:"font-semibold text-gray-900 dark:text-white text-sm",children:e.name}),e.role&&h.jsx(I,{className:"text-gray-500 dark:text-gray-400 text-xs",children:e.role})]}),l&&h.jsx(ae,{name:he.ChevronDown,className:"w-4 h-4 text-gray-600 dark:text-gray-400"})]})}),g&&h.jsxs(I,{className:`absolute ${c==="down"?"top-full mt-2":"bottom-full mb-2"} ${d?"right-0 w-72":"left-0 w-full"} bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg z-50`,children:[h.jsxs(I,{className:"px-4 py-3 border-b border-gray-200 dark:border-gray-700 cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors",onClick:()=>{m(!1),window.G7Core?.dispatch({handler:"navigate",params:{path:`/admin/users/${e.uuid}`}})},children:[h.jsx(I,{className:"font-semibold text-gray-900 dark:text-white",children:e.name}),h.jsx(I,{className:"text-gray-500 dark:text-gray-400 text-sm",children:e.email})]}),h.jsxs(I,{className:"py-2",children:[h.jsxs(le,{onClick:()=>{m(!1),r?r():window.G7Core?.dispatch({handler:"navigate",params:{path:`/admin/users/${e.uuid}/edit`}})},className:"w-full px-4 py-2 text-left hover:bg-gray-50 dark:hover:bg-gray-700 flex items-center justify-start gap-3 transition-colors",children:[h.jsx(ae,{name:he.User,className:"w-5 h-5 text-gray-600 dark:text-gray-400"}),h.jsx(J,{className:"text-gray-900 dark:text-white",children:t})]}),h.jsxs(le,{onClick:M,disabled:p,className:"w-full px-4 py-2 text-left hover:bg-gray-50 dark:hover:bg-gray-700 flex items-center justify-start gap-3 text-red-600 dark:text-red-400 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:[h.jsx(ae,{name:he.ArrowRight,className:"w-5 h-5"}),h.jsx(J,{children:p?"Logging out...":n})]})]})]})]})},si=window.G7Core?.createLogger?.("Comp:LanguageSelector")??{log:(...e)=>console.log("[Comp:LanguageSelector]",...e),warn:(...e)=>console.warn("[Comp:LanguageSelector]",...e),error:(...e)=>console.error("[Comp:LanguageSelector]",...e)},Yu=e=>{const t=window.G7Core?.state?.get?.("_global.appConfig.localeNames")?.[e];return t||{ko:"한국어",en:"English",ja:"日本語",zh:"中文",es:"Español",fr:"Français",de:"Deutsch"}[e]||e},Nv=({availableLocales:e=["ko","en"],languageText:t="Language",apiEndpoint:n="/api/admin/users/me/language",onLanguageChange:r,className:s="",inline:o=!1,showCode:i=!1,id:a,editorAttrs:l})=>{const[c,d]=v.useState(!1),[u,f]=v.useState(!1),[g,m]=v.useState(()=>localStorage.getItem("g7_locale")||"ko"),p=v.useRef(null);v.useEffect(()=>{if(o)return;const x=M=>{p.current&&!p.current.contains(M.target)&&d(!1)};return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[o]);const y=()=>{const M=`; ${document.cookie}`.split("; XSRF-TOKEN=");return M.length===2?decodeURIComponent(M.pop()?.split(";").shift()||""):null},b=()=>localStorage.getItem("auth_token"),_=async x=>{if(!(u||x===g))try{f(!0);const M=y(),S=b();try{const k=await fetch(n,{method:"PATCH",headers:{"Content-Type":"application/json",Accept:"application/json",...M&&{"X-XSRF-TOKEN":M},...S&&{Authorization:`Bearer ${S}`}},credentials:"include",body:JSON.stringify({language:x})});k.ok||si.warn("언어 설정 저장 실패 (UI는 변경됨):",k.statusText)}catch(k){si.warn("언어 설정 API 호출 실패 (UI는 변경됨):",k)}m(x),d(!1),r?.(x),window.__templateApp?await window.__templateApp.changeLocale(x):(si.warn("TemplateApp not found, reloading page"),window.location.reload())}catch(M){si.error("언어 변경 오류:",M)}finally{f(!1)}};return o?h.jsxs(I,{className:`${s}`,id:a,...l,children:[h.jsxs(le,{onClick:()=>d(!c),disabled:u,className:"w-full px-4 py-2 text-left hover:bg-gray-50 dark:hover:bg-gray-700 flex items-center gap-3 transition-colors",children:[h.jsx(ae,{name:he.Globe,className:"w-5 h-5 text-gray-600 dark:text-gray-400"}),h.jsx(J,{className:"text-gray-900 dark:text-white flex-1",children:t}),h.jsx(J,{className:"px-2 py-0.5 text-xs font-medium bg-blue-100 dark:bg-blue-900 text-blue-700 dark:text-blue-300 rounded",children:g.toUpperCase()}),h.jsx(ae,{name:he.ChevronDown,className:`w-4 h-4 text-gray-400 dark:text-gray-500 transition-transform ${c?"rotate-180":""}`})]}),c&&h.jsx(I,{className:"px-4 py-2 flex flex-wrap gap-2",children:e.map(x=>h.jsx(le,{onClick:()=>_(x),disabled:u,className:` px-3 py-1.5 text-sm font-medium rounded-md transition-colors ${g===x?"bg-blue-600 text-white":"bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-600"} ${u?"opacity-50 cursor-not-allowed":""} - `,children:fu(x)},x))})]}):h.jsxs(I,{ref:p,className:`relative ${s}`,id:a,...l,children:[h.jsxs(oe,{onClick:()=>d(!c),className:i?"flex items-center gap-1.5 px-2.5 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors cursor-pointer":"p-2 hover:bg-gray-100 dark:hover:bg-gray-800 rounded-lg transition-colors","aria-haspopup":"listbox","aria-expanded":c,"aria-label":t,children:[h.jsx(re,{name:de.Globe,className:i?"w-4 h-4":"w-5 h-5 text-gray-600 dark:text-gray-400"}),i&&h.jsx(Q,{className:"font-medium uppercase",children:g}),i&&h.jsx(re,{name:de.ChevronDown,className:"w-3 h-3"})]}),c&&h.jsx(I,{className:"absolute right-0 mt-2 w-48 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg z-50",children:h.jsx(I,{className:"py-2",children:e.map(x=>h.jsxs(oe,{onClick:()=>_(x),disabled:u,className:` + `,children:Yu(x)},x))})]}):h.jsxs(I,{ref:p,className:`relative ${s}`,id:a,...l,children:[h.jsxs(le,{onClick:()=>d(!c),className:i?"flex items-center gap-1.5 px-2.5 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors cursor-pointer":"p-2 hover:bg-gray-100 dark:hover:bg-gray-800 rounded-lg transition-colors","aria-haspopup":"listbox","aria-expanded":c,"aria-label":t,children:[h.jsx(ae,{name:he.Globe,className:i?"w-4 h-4":"w-5 h-5 text-gray-600 dark:text-gray-400"}),i&&h.jsx(J,{className:"font-medium uppercase",children:g}),i&&h.jsx(ae,{name:he.ChevronDown,className:"w-3 h-3"})]}),c&&h.jsx(I,{className:"absolute right-0 mt-2 w-48 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg z-50",children:h.jsx(I,{className:"py-2",children:e.map(x=>h.jsxs(le,{onClick:()=>_(x),disabled:u,className:` w-full px-4 py-2 text-left hover:bg-gray-50 dark:hover:bg-gray-700 flex items-center gap-3 transition-colors ${g===x?"bg-gray-50 dark:bg-gray-700":""} ${u?"opacity-50 cursor-not-allowed":""} - `,children:[h.jsx(Q,{className:"text-gray-900 dark:text-white flex-1",children:fu(x)}),g===x&&h.jsx(re,{name:de.Check,className:"w-4 h-4 text-blue-600 dark:text-blue-400"})]},x))})})]})},Ey=({copyright:e="© 2026 G7",version:t,quickLinks:n=[],className:r="",changelogModalId:s,copyrightModalId:o,id:i,editorAttrs:a})=>{const l=v.useCallback(()=>{s&&window.G7Core?.dispatch?.({handler:"sequence",actions:[{handler:"apiCall",auth_required:!0,target:"/api/admin/changelog",params:{method:"GET"},onSuccess:[{handler:"setState",params:{target:"global",coreChangelogContent:"{{response.data.content}}"}},{handler:"openModal",target:s}],onError:[{handler:"openModal",target:s}]}]})},[s]),c=v.useCallback(()=>{o&&window.G7Core?.dispatch?.({handler:"sequence",actions:[{handler:"apiCall",auth_required:!0,target:"/api/admin/license",params:{method:"GET"},onSuccess:[{handler:"setState",params:{target:"global",coreLicenseContent:"{{response.data.content}}"}},{handler:"openModal",target:o}],onError:[{handler:"openModal",target:o}]}]})},[o]);return h.jsx(I,{className:`admin-footer ${r}`,id:i,...a,children:h.jsxs(I,{className:"admin-footer-row",children:[h.jsxs(I,{className:"admin-footer-group",children:[h.jsx(Q,{className:o?"admin-footer-link-hover":"",onClick:o?c:void 0,children:e}),t&&h.jsxs(h.Fragment,{children:[h.jsx(Q,{className:"hidden md:inline",children:"•"}),h.jsxs(Q,{className:`flex-center gap-2 ${s?"admin-footer-link-hover":""}`,onClick:s?l:void 0,children:[h.jsx(re,{name:de.Tag,className:"w-4 h-4"}),h.jsxs(Q,{children:["v",t]})]})]})]}),n.length>0&&h.jsx(I,{className:"flex-center gap-4",children:n.map(d=>h.jsxs(Fr,{href:d.url,className:"admin-footer-link",children:[d.iconName&&h.jsx(re,{name:d.iconName,className:"w-4 h-4"}),h.jsx(Q,{children:d.label})]},d.id))})]})})},My=({title:e,description:t,breadcrumbItems:n,tabs:r,onTabChange:s,actions:o,className:i="",children:a,id:l,editorAttrs:c})=>{const d=(u="secondary")=>({primary:"page-action-primary",secondary:"page-action-secondary",danger:"page-action-danger",ghost:"page-action-ghost"})[u];return h.jsxs(I,{className:i,id:l,...c,children:[n&&n.length>0&&h.jsx(I,{className:"mb-md",children:h.jsx(cu,{items:n})}),h.jsxs(I,{className:"flex-between mb-lg",children:[h.jsxs(I,{children:[h.jsx(Fa,{className:"page-title",children:e}),t&&h.jsx(yt,{className:"page-description",children:t})]}),a?h.jsx(I,{className:"flex-center page-actions",children:a}):o&&o.length>0?h.jsx(I,{className:"page-actions",children:o.map(u=>h.jsxs(oe,{onClick:u.onClick,disabled:u.disabled,className:d(u.variant),children:[u.iconName&&h.jsx(re,{name:u.iconName,className:"icon-md"}),u.variant!=="ghost"&&u.label&&h.jsx(I,{children:u.label})]},u.id))}):null]}),r&&r.length>0&&h.jsx(I,{className:"tab-container",children:r.map(u=>h.jsxs(oe,{onClick:()=>s?.(u.value),className:u.active?"tab-btn-active":"tab-btn",children:[h.jsx(I,{children:u.label}),u.badge!==void 0&&h.jsx(I,{className:u.active?"tab-badge-active":"tab-badge",children:u.badge})]},u.id))})]})},Ny=()=>window.G7Core,Oy=({title:e,description:t,className:n="",style:r,children:s,id:o,editorAttrs:i})=>{const a="flex items-center justify-between",l=Ny()?.style?.mergeClasses?.(a,n)??`${a} ${n}`;return h.jsxs(I,{className:l,style:r,id:o,...i,children:[h.jsxs(I,{children:[e&&h.jsx(er,{className:"text-base font-semibold text-gray-900 dark:text-white",children:e}),t&&h.jsx(yt,{className:"mt-1 text-sm text-gray-500 dark:text-gray-400",children:t})]}),s&&h.jsx(I,{className:"flex items-center gap-2",children:s})]})},nr=(e,t)=>window.G7Core?.t?.(e,t)??e,Ty=({image:e,imageAlt:t,vendor:n,name:r,version:s,status:o,updateAvailable:i=!1,latestVersion:a,dependencies:l=[],showLayoutEditButton:c=!1,actions:d=[],onLayoutEditClick:u,className:f="",id:g,editorAttrs:m})=>{const p=b=>({active:"success",inactive:"default",pending:"pending",error:"error"})[b],y=b=>({active:nr("common.status_active"),inactive:nr("common.status_inactive"),pending:nr("common.status_pending"),error:nr("common.status_error")})[b];return h.jsxs(I,{className:` + `,children:[h.jsx(J,{className:"text-gray-900 dark:text-white flex-1",children:Yu(x)}),g===x&&h.jsx(ae,{name:he.Check,className:"w-4 h-4 text-blue-600 dark:text-blue-400"})]},x))})})]})},Ov=({copyright:e="© 2026 G7",version:t,quickLinks:n=[],className:r="",changelogModalId:s,copyrightModalId:o,id:i,editorAttrs:a})=>{const l=v.useCallback(()=>{s&&window.G7Core?.dispatch?.({handler:"sequence",actions:[{handler:"apiCall",auth_required:!0,target:"/api/admin/changelog",params:{method:"GET"},onSuccess:[{handler:"setState",params:{target:"global",coreChangelogContent:"{{response.data.content}}"}},{handler:"openModal",target:s}],onError:[{handler:"openModal",target:s}]}]})},[s]),c=v.useCallback(()=>{o&&window.G7Core?.dispatch?.({handler:"sequence",actions:[{handler:"apiCall",auth_required:!0,target:"/api/admin/license",params:{method:"GET"},onSuccess:[{handler:"setState",params:{target:"global",coreLicenseContent:"{{response.data.content}}"}},{handler:"openModal",target:o}],onError:[{handler:"openModal",target:o}]}]})},[o]);return h.jsx(I,{className:`admin-footer ${r}`,id:i,...a,children:h.jsxs(I,{className:"admin-footer-row",children:[h.jsxs(I,{className:"admin-footer-group",children:[h.jsx(J,{className:o?"admin-footer-link-hover":"",onClick:o?c:void 0,children:e}),t&&h.jsxs(h.Fragment,{children:[h.jsx(J,{className:"hidden md:inline",children:"•"}),h.jsxs(J,{className:`flex-center gap-2 ${s?"admin-footer-link-hover":""}`,onClick:s?l:void 0,children:[h.jsx(ae,{name:he.Tag,className:"w-4 h-4"}),h.jsxs(J,{children:["v",t]})]})]})]}),n.length>0&&h.jsx(I,{className:"flex-center gap-4",children:n.map(d=>h.jsxs(qr,{href:d.url,className:"admin-footer-link",children:[d.iconName&&h.jsx(ae,{name:d.iconName,className:"w-4 h-4"}),h.jsx(J,{children:d.label})]},d.id))})]})})},Tv=({title:e,description:t,breadcrumbItems:n,tabs:r,onTabChange:s,actions:o,className:i="",children:a,id:l,editorAttrs:c})=>{const d=(u="secondary")=>({primary:"page-action-primary",secondary:"page-action-secondary",danger:"page-action-danger",ghost:"page-action-ghost"})[u];return h.jsxs(I,{className:i,id:l,...c,children:[n&&n.length>0&&h.jsx(I,{className:"mb-md",children:h.jsx(ju,{items:n})}),h.jsxs(I,{className:"flex-between mb-lg",children:[h.jsxs(I,{children:[h.jsx(sl,{className:"page-title",children:e}),t&&h.jsx(kt,{className:"page-description",children:t})]}),a?h.jsx(I,{className:"flex-center page-actions",children:a}):o&&o.length>0?h.jsx(I,{className:"page-actions",children:o.map(u=>h.jsxs(le,{onClick:u.onClick,disabled:u.disabled,className:d(u.variant),children:[u.iconName&&h.jsx(ae,{name:u.iconName,className:"icon-md"}),u.variant!=="ghost"&&u.label&&h.jsx(I,{children:u.label})]},u.id))}):null]}),r&&r.length>0&&h.jsx(I,{className:"tab-container",children:r.map(u=>h.jsxs(le,{onClick:()=>s?.(u.value),className:u.active?"tab-btn-active":"tab-btn",children:[h.jsx(I,{children:u.label}),u.badge!==void 0&&h.jsx(I,{className:u.active?"tab-badge-active":"tab-badge",children:u.badge})]},u.id))})]})},Av=()=>window.G7Core,Dv=({title:e,description:t,className:n="",style:r,children:s,id:o,editorAttrs:i})=>{const a="flex items-center justify-between",l=Av()?.style?.mergeClasses?.(a,n)??`${a} ${n}`;return h.jsxs(I,{className:l,style:r,id:o,...i,children:[h.jsxs(I,{children:[e&&h.jsx(cr,{className:"text-base font-semibold text-gray-900 dark:text-white",children:e}),t&&h.jsx(kt,{className:"mt-1 text-sm text-gray-500 dark:text-gray-400",children:t})]}),s&&h.jsx(I,{className:"flex items-center gap-2",children:s})]})},fr=(e,t)=>window.G7Core?.t?.(e,t)??e,Iv=({image:e,imageAlt:t,vendor:n,name:r,version:s,status:o,updateAvailable:i=!1,latestVersion:a,dependencies:l=[],showLayoutEditButton:c=!1,actions:d=[],onLayoutEditClick:u,className:f="",id:g,editorAttrs:m})=>{const p=b=>({active:"success",inactive:"default",pending:"pending",error:"error"})[b],y=b=>({active:fr("common.status_active"),inactive:fr("common.status_inactive"),pending:fr("common.status_pending"),error:fr("common.status_error")})[b];return h.jsxs(I,{className:` bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden hover:shadow-lg transition-shadow ${f} - `,id:g,...m,children:[e&&h.jsxs(I,{className:"relative",children:[h.jsx(kn,{src:e,alt:t||nr("common.template_preview",{vendor:n,name:r}),className:"w-full h-48 object-cover"}),h.jsx(I,{className:"absolute top-3 right-3",children:h.jsx(Fo,{status:p(o),label:y(o),showIcon:!0})}),i&&h.jsx(I,{className:"absolute top-3 left-3",children:h.jsxs(Q,{className:"flex items-center gap-1 px-2 py-1 bg-yellow-50 dark:bg-yellow-900/20 text-yellow-700 dark:text-yellow-400 border border-yellow-200 dark:border-yellow-800 rounded-md text-xs font-semibold",children:[h.jsx(re,{name:de.ExclamationTriangle,className:"w-3 h-3"}),h.jsx(Q,{children:nr("common.update_available")})]})})]}),h.jsxs(I,{className:"p-4",children:[h.jsxs(I,{className:"flex items-start justify-between mb-3",children:[h.jsxs(I,{className:"flex-1",children:[h.jsxs($r,{className:"text-lg font-bold text-gray-900 dark:text-white",children:[n,"/",r]}),h.jsxs(I,{className:"flex items-center gap-2 mt-1 text-sm text-gray-600 dark:text-gray-400",children:[h.jsxs(Q,{children:["v",s]}),i&&a&&h.jsxs(h.Fragment,{children:[h.jsx(Q,{children:"→"}),h.jsxs(Q,{className:"text-yellow-600 dark:text-yellow-400 font-semibold",children:["v",a]})]})]}),!e&&h.jsx(I,{className:"mt-2",children:h.jsx(Fo,{status:p(o),label:y(o),showIcon:!0})})]}),d.length>0&&h.jsx(Cs,{items:d,triggerIconName:de.EllipsisVertical,position:"left"})]}),l.length>0&&h.jsxs(I,{className:"mb-3",children:[h.jsxs(yt,{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:[nr("common.dependencies"),":"]}),h.jsx(I,{className:"flex flex-wrap gap-1",children:l.map((b,_)=>h.jsx(Q,{className:"px-2 py-0.5 bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 text-xs rounded",children:b},_))})]}),c&&u&&h.jsxs(oe,{onClick:u,className:"w-full px-4 py-2 bg-blue-600 dark:bg-blue-500 text-white rounded-md hover:bg-blue-700 dark:hover:bg-blue-600 transition-colors flex items-center justify-center gap-2 font-medium",children:[h.jsx(re,{name:de.Edit,className:"w-4 h-4"}),h.jsx(Q,{children:nr("common.edit_layout")})]})]})]})},hu=({type:e,message:t,dismissible:n=!1,onDismiss:r,className:s="",id:o,editorAttrs:i})=>{const a={info:{containerClass:"alert-info",iconClass:"alert-icon-info",textClass:"alert-text-info",icon:de.InfoCircle},success:{containerClass:"alert-success",iconClass:"alert-icon-success",textClass:"alert-text-success",icon:de.CheckCircle},warning:{containerClass:"alert-warning",iconClass:"alert-icon-warning",textClass:"alert-text-warning",icon:de.ExclamationTriangle},error:{containerClass:"alert-error",iconClass:"alert-icon-error",textClass:"alert-text-error",icon:de.TimesCircle}},l=a[e]??a.info;return h.jsxs(I,{className:`${l.containerClass} ${s}`,role:"alert","aria-live":"polite",id:o,...i,children:[h.jsx(re,{name:l.icon,className:l.iconClass,ariaLabel:`${e} icon`}),h.jsx(yt,{className:l.textClass,children:t}),n&&h.jsx(oe,{onClick:r,className:`alert-dismiss ${l.textClass}`,"aria-label":"Close alert",children:h.jsx(re,{name:de.Times,className:l.iconClass,ariaLabel:"Close"})})]})},Ay=({layoutName:e,onBack:t,onPreview:n,onSave:r,isSaving:s=!1,className:o=""})=>{const i=` + `,id:g,...m,children:[e&&h.jsxs(I,{className:"relative",children:[h.jsx(Nn,{src:e,alt:t||fr("common.template_preview",{vendor:n,name:r}),className:"w-full h-48 object-cover"}),h.jsx(I,{className:"absolute top-3 right-3",children:h.jsx(ei,{status:p(o),label:y(o),showIcon:!0})}),i&&h.jsx(I,{className:"absolute top-3 left-3",children:h.jsxs(J,{className:"flex items-center gap-1 px-2 py-1 bg-yellow-50 dark:bg-yellow-900/20 text-yellow-700 dark:text-yellow-400 border border-yellow-200 dark:border-yellow-800 rounded-md text-xs font-semibold",children:[h.jsx(ae,{name:he.ExclamationTriangle,className:"w-3 h-3"}),h.jsx(J,{children:fr("common.update_available")})]})})]}),h.jsxs(I,{className:"p-4",children:[h.jsxs(I,{className:"flex items-start justify-between mb-3",children:[h.jsxs(I,{className:"flex-1",children:[h.jsxs(Xr,{className:"text-lg font-bold text-gray-900 dark:text-white",children:[n,"/",r]}),h.jsxs(I,{className:"flex items-center gap-2 mt-1 text-sm text-gray-600 dark:text-gray-400",children:[h.jsxs(J,{children:["v",s]}),i&&a&&h.jsxs(h.Fragment,{children:[h.jsx(J,{children:"→"}),h.jsxs(J,{className:"text-yellow-600 dark:text-yellow-400 font-semibold",children:["v",a]})]})]}),!e&&h.jsx(I,{className:"mt-2",children:h.jsx(ei,{status:p(o),label:y(o),showIcon:!0})})]}),d.length>0&&h.jsx(Vs,{items:d,triggerIconName:he.EllipsisVertical,position:"left"})]}),l.length>0&&h.jsxs(I,{className:"mb-3",children:[h.jsxs(kt,{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:[fr("common.dependencies"),":"]}),h.jsx(I,{className:"flex flex-wrap gap-1",children:l.map((b,_)=>h.jsx(J,{className:"px-2 py-0.5 bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 text-xs rounded",children:b},_))})]}),c&&u&&h.jsxs(le,{onClick:u,className:"w-full px-4 py-2 bg-blue-600 dark:bg-blue-500 text-white rounded-md hover:bg-blue-700 dark:hover:bg-blue-600 transition-colors flex items-center justify-center gap-2 font-medium",children:[h.jsx(ae,{name:he.Edit,className:"w-4 h-4"}),h.jsx(J,{children:fr("common.edit_layout")})]})]})]})},Ku=({type:e,message:t,dismissible:n=!1,onDismiss:r,className:s="",id:o,editorAttrs:i})=>{const a={info:{containerClass:"alert-info",iconClass:"alert-icon-info",textClass:"alert-text-info",icon:he.InfoCircle},success:{containerClass:"alert-success",iconClass:"alert-icon-success",textClass:"alert-text-success",icon:he.CheckCircle},warning:{containerClass:"alert-warning",iconClass:"alert-icon-warning",textClass:"alert-text-warning",icon:he.ExclamationTriangle},error:{containerClass:"alert-error",iconClass:"alert-icon-error",textClass:"alert-text-error",icon:he.TimesCircle}},l=a[e]??a.info;return h.jsxs(I,{className:`${l.containerClass} ${s}`,role:"alert","aria-live":"polite",id:o,...i,children:[h.jsx(ae,{name:l.icon,className:l.iconClass,ariaLabel:`${e} icon`}),h.jsx(kt,{className:l.textClass,children:t}),n&&h.jsx(le,{onClick:r,className:`alert-dismiss ${l.textClass}`,"aria-label":"Close alert",children:h.jsx(ae,{name:he.Times,className:l.iconClass,ariaLabel:"Close"})})]})},Lv=({layoutName:e,onBack:t,onPreview:n,onSave:r,isSaving:s=!1,className:o=""})=>{const i=` flex items-center justify-between gap-4 p-4 bg-white dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700 ${o} - `.trim().replace(/\s+/g," ");return h.jsxs(I,{className:i,children:[h.jsxs(I,{className:"flex items-center gap-3",children:[h.jsx(oe,{onClick:t,className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors bg-transparent border-0 cursor-pointer","aria-label":"뒤로가기",children:h.jsx(re,{name:de.ArrowLeft,className:"text-gray-700 dark:text-gray-300",ariaLabel:"뒤로가기"})}),h.jsx(er,{className:"text-xl font-semibold text-gray-900 dark:text-gray-100",children:e})]}),h.jsxs(I,{className:"flex items-center gap-2",children:[h.jsx(oe,{onClick:n,className:"px-4 py-2 bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-600 rounded-lg transition-colors border-0 cursor-pointer","aria-label":"미리보기",children:h.jsxs(I,{className:"flex items-center gap-2",children:[h.jsx(re,{name:de.Eye,className:"text-gray-700 dark:text-gray-300",ariaLabel:"미리보기 아이콘"}),h.jsx("span",{children:"미리보기"})]})}),h.jsx(oe,{onClick:r,disabled:s,className:` + `.trim().replace(/\s+/g," ");return h.jsxs(I,{className:i,children:[h.jsxs(I,{className:"flex items-center gap-3",children:[h.jsx(le,{onClick:t,className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors bg-transparent border-0 cursor-pointer","aria-label":"뒤로가기",children:h.jsx(ae,{name:he.ArrowLeft,className:"text-gray-700 dark:text-gray-300",ariaLabel:"뒤로가기"})}),h.jsx(cr,{className:"text-xl font-semibold text-gray-900 dark:text-gray-100",children:e})]}),h.jsxs(I,{className:"flex items-center gap-2",children:[h.jsx(le,{onClick:n,className:"px-4 py-2 bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-600 rounded-lg transition-colors border-0 cursor-pointer","aria-label":"미리보기",children:h.jsxs(I,{className:"flex items-center gap-2",children:[h.jsx(ae,{name:he.Eye,className:"text-gray-700 dark:text-gray-300",ariaLabel:"미리보기 아이콘"}),h.jsx("span",{children:"미리보기"})]})}),h.jsx(le,{onClick:r,disabled:s,className:` px-4 py-2 rounded-lg transition-colors border-0 cursor-pointer ${s?"bg-blue-400 dark:bg-blue-600 cursor-not-allowed":"bg-blue-600 dark:bg-blue-500 hover:bg-blue-700 dark:hover:bg-blue-600"} text-white - `.trim().replace(/\s+/g," "),"aria-label":s?"저장 중...":"저장",children:h.jsxs(I,{className:"flex items-center gap-2",children:[h.jsx(re,{name:s?de.Spinner:de.Save,className:`text-white ${s?"animate-spin":""}`,ariaLabel:s?"저장 중 아이콘":"저장 아이콘"}),h.jsx("span",{children:s?"저장 중...":"저장"})]})})]})]})},Dy=({files:e,selectedId:t,onSelect:n,className:r=""})=>{const s=a=>{try{const l=new Date(a);if(isNaN(l.getTime()))return a;const c=l.getFullYear(),d=String(l.getMonth()+1).padStart(2,"0"),u=String(l.getDate()).padStart(2,"0"),f=String(l.getHours()).padStart(2,"0"),g=String(l.getMinutes()).padStart(2,"0");return`${c}-${d}-${u} ${f}:${g}`}catch{return a}},o=a=>{n(a)},i=` + `.trim().replace(/\s+/g," "),"aria-label":s?"저장 중...":"저장",children:h.jsxs(I,{className:"flex items-center gap-2",children:[h.jsx(ae,{name:s?he.Spinner:he.Save,className:`text-white ${s?"animate-spin":""}`,ariaLabel:s?"저장 중 아이콘":"저장 아이콘"}),h.jsx("span",{children:s?"저장 중...":"저장"})]})})]})]})},Pv=({files:e,selectedId:t,onSelect:n,className:r=""})=>{const s=a=>{try{const l=new Date(a);if(isNaN(l.getTime()))return a;const c=l.getFullYear(),d=String(l.getMonth()+1).padStart(2,"0"),u=String(l.getDate()).padStart(2,"0"),f=String(l.getHours()).padStart(2,"0"),g=String(l.getMinutes()).padStart(2,"0");return`${c}-${d}-${u} ${f}:${g}`}catch{return a}},o=a=>{n(a)},i=` w-full ${r} - `.trim().replace(/\s+/g," ");return h.jsx(I,{className:i,children:e.length===0?h.jsx(I,{className:"p-4 text-center text-gray-500 dark:text-gray-400",children:"파일이 없습니다."}):h.jsx(Va,{className:"divide-y divide-gray-200 dark:divide-gray-700",role:"listbox","aria-label":"레이아웃 파일 목록",children:e.map(a=>{const l=a.id===t,c=` + `.trim().replace(/\s+/g," ");return h.jsx(I,{className:i,children:e.length===0?h.jsx(I,{className:"p-4 text-center text-gray-500 dark:text-gray-400",children:"파일이 없습니다."}):h.jsx(ol,{className:"divide-y divide-gray-200 dark:divide-gray-700",role:"listbox","aria-label":"레이아웃 파일 목록",children:e.map(a=>{const l=a.id===t,c=` flex items-center justify-between p-4 cursor-pointer transition-colors duration-150 ${l?"bg-blue-100 dark:bg-blue-900 border-l-4 border-blue-500":"hover:bg-gray-100 dark:hover:bg-gray-800"} @@ -105,8 +106,8 @@ var SirsoftAdminBasic=(function(R,h,v,Dn){"use strict";var GT=Object.definePrope `.trim().replace(/\s+/g," "),u=` text-sm ${l?"text-blue-700 dark:text-blue-300":"text-gray-500 dark:text-gray-400"} - `.trim().replace(/\s+/g," ");return h.jsx(za,{className:c,onClick:()=>o(a.id),role:"option","aria-selected":l,tabIndex:0,onKeyDown:f=>{(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),o(a.id))},children:h.jsxs(I,{className:"flex flex-col gap-1",children:[h.jsx(Q,{className:d,children:a.name}),h.jsx(Q,{className:u,children:s(a.updated_at)})]})},a.id)})})})};function gu(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n=e.length?e.apply(this,s):function(){for(var i=arguments.length,a=new Array(i),l=0;l1&&arguments[1]!==void 0?arguments[1]:{};Go.initial(e),Go.handler(t);var n={current:e},r=Ts(nv)(n,t),s=Ts(tv)(n),o=Ts(Go.changes)(e),i=Ts(ev)(n);function a(){var c=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(d){return d};return Go.selector(c),c(n.current)}function l(c){Wy(r,s,o,i)(c)}return[a,l]}function ev(e,t){return As(t)?t(e.current):t}function tv(e,t){return e.current=yu(yu({},e.current),t),t}function nv(e,t,n){return As(t)?t(e.current):Object.keys(n).forEach(function(r){var s;return(s=t[r])===null||s===void 0?void 0:s.call(t,e.current[r])}),n}var rv={create:Ry},sv={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.54.0/min/vs"}};function ov(e){return function t(){for(var n=this,r=arguments.length,s=new Array(r),o=0;o=e.length?e.apply(this,s):function(){for(var i=arguments.length,a=new Array(i),l=0;lo(a.id),role:"option","aria-selected":l,tabIndex:0,onKeyDown:f=>{(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),o(a.id))},children:h.jsxs(I,{className:"flex flex-col gap-1",children:[h.jsx(J,{className:d,children:a.name}),h.jsx(J,{className:u,children:s(a.updated_at)})]})},a.id)})})})};function Xu(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n=e.length?e.apply(this,s):function(){for(var i=arguments.length,a=new Array(i),l=0;l1&&arguments[1]!==void 0?arguments[1]:{};ii.initial(e),ii.handler(t);var n={current:e},r=Gs(ox)(n,t),s=Gs(sx)(n),o=Gs(ii.changes)(e),i=Gs(rx)(n);function a(){var c=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(d){return d};return ii.selector(c),c(n.current)}function l(c){Kv(r,s,o,i)(c)}return[a,l]}function rx(e,t){return Ys(t)?t(e.current):t}function sx(e,t){return e.current=Ju(Ju({},e.current),t),t}function ox(e,t,n){return Ys(t)?t(e.current):Object.keys(n).forEach(function(r){var s;return(s=t[r])===null||s===void 0?void 0:s.call(t,e.current[r])}),n}var ix={create:nx},ax={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.54.0/min/vs"}};function lx(e){return function t(){for(var n=this,r=arguments.length,s=new Array(r),o=0;o=e.length?e.apply(this,s):function(){for(var i=arguments.length,a=new Array(i),l=0;l{r.current=!1}:e,t)}var ln=Av;function Is(){}function Wr(e,t,n,r){return Dv(e,r)||Iv(e,t,n,r)}function Dv(e,t){return e.editor.getModel(Eu(e,t))}function Iv(e,t,n,r){return e.editor.createModel(t,n,r?Eu(e,r):void 0)}function Eu(e,t){return e.Uri.parse(t)}function Lv({original:e,modified:t,language:n,originalLanguage:r,modifiedLanguage:s,originalModelPath:o,modifiedModelPath:i,keepCurrentOriginalModel:a=!1,keepCurrentModifiedModel:l=!1,theme:c="light",loading:d="Loading...",options:u={},height:f="100%",width:g="100%",className:m,wrapperProps:p={},beforeMount:y=Is,onMount:b=Is}){let[_,x]=v.useState(!1),[E,S]=v.useState(!0),w=v.useRef(null),N=v.useRef(null),C=v.useRef(null),k=v.useRef(b),M=v.useRef(y),T=v.useRef(!1);_u(()=>{let D=Ko.init();return D.then(A=>(N.current=A)&&S(!1)).catch(A=>A?.type!=="cancelation"&&console.error("Monaco initialization: error:",A)),()=>w.current?F():D.cancel()}),ln(()=>{if(w.current&&N.current){let D=w.current.getOriginalEditor(),A=Wr(N.current,e||"",r||n||"text",o||"");A!==D.getModel()&&D.setModel(A)}},[o],_),ln(()=>{if(w.current&&N.current){let D=w.current.getModifiedEditor(),A=Wr(N.current,t||"",s||n||"text",i||"");A!==D.getModel()&&D.setModel(A)}},[i],_),ln(()=>{let D=w.current.getModifiedEditor();D.getOption(N.current.editor.EditorOption.readOnly)?D.setValue(t||""):t!==D.getValue()&&(D.executeEdits("",[{range:D.getModel().getFullModelRange(),text:t||"",forceMoveMarkers:!0}]),D.pushUndoStop())},[t],_),ln(()=>{w.current?.getModel()?.original.setValue(e||"")},[e],_),ln(()=>{let{original:D,modified:A}=w.current.getModel();N.current.editor.setModelLanguage(D,r||n||"text"),N.current.editor.setModelLanguage(A,s||n||"text")},[n,r,s],_),ln(()=>{N.current?.editor.setTheme(c)},[c],_),ln(()=>{w.current?.updateOptions(u)},[u],_);let L=v.useCallback(()=>{if(!N.current)return;M.current(N.current);let D=Wr(N.current,e||"",r||n||"text",o||""),A=Wr(N.current,t||"",s||n||"text",i||"");w.current?.setModel({original:D,modified:A})},[n,t,s,e,r,o,i]),P=v.useCallback(()=>{!T.current&&C.current&&(w.current=N.current.editor.createDiffEditor(C.current,{automaticLayout:!0,...u}),L(),N.current?.editor.setTheme(c),x(!0),T.current=!0)},[u,c,L]);v.useEffect(()=>{_&&k.current(w.current,N.current)},[_]),v.useEffect(()=>{!E&&!_&&P()},[E,_,P]);function F(){let D=w.current?.getModel();a||D?.original?.dispose(),l||D?.modified?.dispose(),w.current?.dispose()}return v.createElement(Su,{width:g,height:f,isEditorReady:_,loading:d,_ref:C,className:m,wrapperProps:p})}var Pv=Lv;v.memo(Pv);function $v(e){let t=v.useRef();return v.useEffect(()=>{t.current=e},[e]),t.current}var Fv=$v,Xo=new Map;function Vv({defaultValue:e,defaultLanguage:t,defaultPath:n,value:r,language:s,path:o,theme:i="light",line:a,loading:l="Loading...",options:c={},overrideServices:d={},saveViewState:u=!0,keepCurrentModel:f=!1,width:g="100%",height:m="100%",className:p,wrapperProps:y={},beforeMount:b=Is,onMount:_=Is,onChange:x,onValidate:E=Is}){let[S,w]=v.useState(!1),[N,C]=v.useState(!0),k=v.useRef(null),M=v.useRef(null),T=v.useRef(null),L=v.useRef(_),P=v.useRef(b),F=v.useRef(),D=v.useRef(r),A=Fv(o),O=v.useRef(!1),V=v.useRef(!1);_u(()=>{let j=Ko.init();return j.then(U=>(k.current=U)&&C(!1)).catch(U=>U?.type!=="cancelation"&&console.error("Monaco initialization: error:",U)),()=>M.current?W():j.cancel()}),ln(()=>{let j=Wr(k.current,e||r||"",t||s||"",o||n||"");j!==M.current?.getModel()&&(u&&Xo.set(A,M.current?.saveViewState()),M.current?.setModel(j),u&&M.current?.restoreViewState(Xo.get(o)))},[o],S),ln(()=>{M.current?.updateOptions(c)},[c],S),ln(()=>{!M.current||r===void 0||(M.current.getOption(k.current.editor.EditorOption.readOnly)?M.current.setValue(r):r!==M.current.getValue()&&(V.current=!0,M.current.executeEdits("",[{range:M.current.getModel().getFullModelRange(),text:r,forceMoveMarkers:!0}]),M.current.pushUndoStop(),V.current=!1))},[r],S),ln(()=>{let j=M.current?.getModel();j&&s&&k.current?.editor.setModelLanguage(j,s)},[s],S),ln(()=>{a!==void 0&&M.current?.revealLine(a)},[a],S),ln(()=>{k.current?.editor.setTheme(i)},[i],S);let H=v.useCallback(()=>{if(!(!T.current||!k.current)&&!O.current){P.current(k.current);let j=o||n,U=Wr(k.current,r||e||"",t||s||"",j||"");M.current=k.current?.editor.create(T.current,{model:U,automaticLayout:!0,...c},d),u&&M.current.restoreViewState(Xo.get(j)),k.current.editor.setTheme(i),a!==void 0&&M.current.revealLine(a),w(!0),O.current=!0}},[e,t,n,r,s,o,c,d,u,i,a]);v.useEffect(()=>{S&&L.current(M.current,k.current)},[S]),v.useEffect(()=>{!N&&!S&&H()},[N,S,H]),D.current=r,v.useEffect(()=>{S&&x&&(F.current?.dispose(),F.current=M.current?.onDidChangeModelContent(j=>{V.current||x(M.current.getValue(),j)}))},[S,x]),v.useEffect(()=>{if(S){let j=k.current.editor.onDidChangeMarkers(U=>{let B=M.current.getModel()?.uri;if(B&&U.find(G=>G.path===B.path)){let G=k.current.editor.getModelMarkers({resource:B});E?.(G)}});return()=>{j?.dispose()}}return()=>{}},[S,E]);function W(){F.current?.dispose(),f?u&&Xo.set(o,M.current.saveViewState()):M.current.getModel()?.dispose(),M.current.dispose()}return v.createElement(Su,{width:g,height:m,isEditorReady:S,loading:l,_ref:T,className:p,wrapperProps:y})}var zv=Vv,Hv=v.memo(zv),Uv=Hv;const Bv="0.54.0",jv="sirsoft-admin_basic",Mu="monaco-editor";function Nu(){const e=window?.G7Core?.asset;return typeof e?.templateDir!="function"?!1:(Ko.config({paths:{vs:e.templateDir(jv,`vendor/monaco-editor/${Bv}/vs`)}}),!0)}let qo=!1;const Wv=({value:e,onChange:t,language:n="json",height:r="100%",readOnly:s=!1,theme:o="vs-dark"})=>{const i=v.useRef(null),[a,l]=v.useState(!1);qo||(qo=Nu());const c=(f,g)=>{i.current=f,window?.G7Core?.assets?.clearFailure?.(Mu),n==="json"&&g.languages.json.jsonDefaults.setDiagnosticsOptions({validate:!0,schemaValidation:"error",allowComments:!1}),f.updateOptions({readOnly:s,minimap:{enabled:!1},scrollBeyondLastLine:!1,fontSize:14,lineNumbers:"on",renderWhitespace:"selection",automaticLayout:!0})},d=()=>{l(!0),window?.G7Core?.assets?.notifyFailure?.({id:Mu,label:"코드 편집기",retry:()=>{l(!1)}})},u=f=>{t&&f!==void 0&&t({target:{value:f}})};return v.useEffect(()=>{i.current&&i.current.updateOptions({readOnly:s})},[s]),v.useEffect(()=>{if(a)return;let f=!1;return Ko.init().catch(()=>{f||d()}),()=>{f=!0}},[a]),a?h.jsx("div",{className:"border border-gray-300 dark:border-gray-700 rounded-lg overflow-hidden",children:h.jsx("textarea",{"data-testid":"code-editor-fallback",className:"w-full block p-3 font-mono text-sm bg-gray-100 text-gray-900 dark:bg-gray-900 dark:text-gray-100 outline-none resize-y",style:{height:r==="100%"?"480px":r},value:e,readOnly:s,spellCheck:!1,wrap:"off",onChange:f=>u(f.target.value),onKeyDown:f=>{if(f.key!=="Tab")return;f.preventDefault();const g=f.currentTarget,{selectionStart:m,selectionEnd:p}=g,y=`${e.slice(0,m)} ${e.slice(p)}`;u(y),requestAnimationFrame(()=>{g.selectionStart=g.selectionEnd=m+2})}})}):h.jsx("div",{className:"border border-gray-300 dark:border-gray-700 rounded-lg overflow-hidden",children:h.jsx(Uv,{height:r,language:n,value:e,theme:o,onChange:u,onMount:c,loading:h.jsx("div",{className:"p-4 text-sm text-gray-500 dark:text-gray-400",children:"편집기를 불러오는 중..."}),beforeMount:()=>{qo||(qo=Nu())},options:{readOnly:s,minimap:{enabled:!1},scrollBeyondLastLine:!1,fontSize:14,lineNumbers:"on",renderWhitespace:"selection",automaticLayout:!0}})})},Gv=e=>{const t=new Date(e);return new Intl.DateTimeFormat("ko-KR",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}).format(t)},Ou=v.memo(({version:e,isSelected:t,onSelect:n})=>{const r=v.useCallback(()=>{n?.(e.id)},[n,e.id]);return h.jsx(za,{role:"listitem","aria-selected":t,className:` + `},ef=lx(fx)(Ru),hx={config:dx},gx=function(){for(var t=arguments.length,n=new Array(t),r=0;r{r.current=!1}:e,t)}var bn=Lx;function Xs(){}function ss(e,t,n,r){return Px(e,r)||$x(e,t,n,r)}function Px(e,t){return e.editor.getModel(af(e,t))}function $x(e,t,n,r){return e.editor.createModel(t,n,r?af(e,r):void 0)}function af(e,t){return e.Uri.parse(t)}function Fx({original:e,modified:t,language:n,originalLanguage:r,modifiedLanguage:s,originalModelPath:o,modifiedModelPath:i,keepCurrentOriginalModel:a=!1,keepCurrentModifiedModel:l=!1,theme:c="light",loading:d="Loading...",options:u={},height:f="100%",width:g="100%",className:m,wrapperProps:p={},beforeMount:y=Xs,onMount:b=Xs}){let[_,x]=v.useState(!1),[M,S]=v.useState(!0),k=v.useRef(null),N=v.useRef(null),C=v.useRef(null),w=v.useRef(b),E=v.useRef(y),T=v.useRef(!1);of(()=>{let A=li.init();return A.then(D=>(N.current=D)&&S(!1)).catch(D=>D?.type!=="cancelation"&&console.error("Monaco initialization: error:",D)),()=>k.current?F():A.cancel()}),bn(()=>{if(k.current&&N.current){let A=k.current.getOriginalEditor(),D=ss(N.current,e||"",r||n||"text",o||"");D!==A.getModel()&&A.setModel(D)}},[o],_),bn(()=>{if(k.current&&N.current){let A=k.current.getModifiedEditor(),D=ss(N.current,t||"",s||n||"text",i||"");D!==A.getModel()&&A.setModel(D)}},[i],_),bn(()=>{let A=k.current.getModifiedEditor();A.getOption(N.current.editor.EditorOption.readOnly)?A.setValue(t||""):t!==A.getValue()&&(A.executeEdits("",[{range:A.getModel().getFullModelRange(),text:t||"",forceMoveMarkers:!0}]),A.pushUndoStop())},[t],_),bn(()=>{k.current?.getModel()?.original.setValue(e||"")},[e],_),bn(()=>{let{original:A,modified:D}=k.current.getModel();N.current.editor.setModelLanguage(A,r||n||"text"),N.current.editor.setModelLanguage(D,s||n||"text")},[n,r,s],_),bn(()=>{N.current?.editor.setTheme(c)},[c],_),bn(()=>{k.current?.updateOptions(u)},[u],_);let P=v.useCallback(()=>{if(!N.current)return;E.current(N.current);let A=ss(N.current,e||"",r||n||"text",o||""),D=ss(N.current,t||"",s||n||"text",i||"");k.current?.setModel({original:A,modified:D})},[n,t,s,e,r,o,i]),L=v.useCallback(()=>{!T.current&&C.current&&(k.current=N.current.editor.createDiffEditor(C.current,{automaticLayout:!0,...u}),P(),N.current?.editor.setTheme(c),x(!0),T.current=!0)},[u,c,P]);v.useEffect(()=>{_&&w.current(k.current,N.current)},[_]),v.useEffect(()=>{!M&&!_&&L()},[M,_,L]);function F(){let A=k.current?.getModel();a||A?.original?.dispose(),l||A?.modified?.dispose(),k.current?.dispose()}return v.createElement(sf,{width:g,height:f,isEditorReady:_,loading:d,_ref:C,className:m,wrapperProps:p})}var zx=Fx;v.memo(zx);function Vx(e){let t=v.useRef();return v.useEffect(()=>{t.current=e},[e]),t.current}var Hx=Vx,ci=new Map;function Ux({defaultValue:e,defaultLanguage:t,defaultPath:n,value:r,language:s,path:o,theme:i="light",line:a,loading:l="Loading...",options:c={},overrideServices:d={},saveViewState:u=!0,keepCurrentModel:f=!1,width:g="100%",height:m="100%",className:p,wrapperProps:y={},beforeMount:b=Xs,onMount:_=Xs,onChange:x,onValidate:M=Xs}){let[S,k]=v.useState(!1),[N,C]=v.useState(!0),w=v.useRef(null),E=v.useRef(null),T=v.useRef(null),P=v.useRef(_),L=v.useRef(b),F=v.useRef(),A=v.useRef(r),D=Hx(o),O=v.useRef(!1),z=v.useRef(!1);of(()=>{let Y=li.init();return Y.then(B=>(w.current=B)&&C(!1)).catch(B=>B?.type!=="cancelation"&&console.error("Monaco initialization: error:",B)),()=>E.current?j():Y.cancel()}),bn(()=>{let Y=ss(w.current,e||r||"",t||s||"",o||n||"");Y!==E.current?.getModel()&&(u&&ci.set(D,E.current?.saveViewState()),E.current?.setModel(Y),u&&E.current?.restoreViewState(ci.get(o)))},[o],S),bn(()=>{E.current?.updateOptions(c)},[c],S),bn(()=>{!E.current||r===void 0||(E.current.getOption(w.current.editor.EditorOption.readOnly)?E.current.setValue(r):r!==E.current.getValue()&&(z.current=!0,E.current.executeEdits("",[{range:E.current.getModel().getFullModelRange(),text:r,forceMoveMarkers:!0}]),E.current.pushUndoStop(),z.current=!1))},[r],S),bn(()=>{let Y=E.current?.getModel();Y&&s&&w.current?.editor.setModelLanguage(Y,s)},[s],S),bn(()=>{a!==void 0&&E.current?.revealLine(a)},[a],S),bn(()=>{w.current?.editor.setTheme(i)},[i],S);let U=v.useCallback(()=>{if(!(!T.current||!w.current)&&!O.current){L.current(w.current);let Y=o||n,B=ss(w.current,r||e||"",t||s||"",Y||"");E.current=w.current?.editor.create(T.current,{model:B,automaticLayout:!0,...c},d),u&&E.current.restoreViewState(ci.get(Y)),w.current.editor.setTheme(i),a!==void 0&&E.current.revealLine(a),k(!0),O.current=!0}},[e,t,n,r,s,o,c,d,u,i,a]);v.useEffect(()=>{S&&P.current(E.current,w.current)},[S]),v.useEffect(()=>{!N&&!S&&U()},[N,S,U]),A.current=r,v.useEffect(()=>{S&&x&&(F.current?.dispose(),F.current=E.current?.onDidChangeModelContent(Y=>{z.current||x(E.current.getValue(),Y)}))},[S,x]),v.useEffect(()=>{if(S){let Y=w.current.editor.onDidChangeMarkers(B=>{let W=E.current.getModel()?.uri;if(W&&B.find(G=>G.path===W.path)){let G=w.current.editor.getModelMarkers({resource:W});M?.(G)}});return()=>{Y?.dispose()}}return()=>{}},[S,M]);function j(){F.current?.dispose(),f?u&&ci.set(o,E.current.saveViewState()):E.current.getModel()?.dispose(),E.current.dispose()}return v.createElement(sf,{width:g,height:m,isEditorReady:S,loading:l,_ref:T,className:p,wrapperProps:y})}var Bx=Ux,jx=v.memo(Bx),Wx=jx;const Gx="0.54.0",Yx="sirsoft-admin_basic",lf="monaco-editor";function cf(){const e=window?.G7Core?.asset;return typeof e?.templateDir!="function"?!1:(li.config({paths:{vs:e.templateDir(Yx,`vendor/monaco-editor/${Gx}/vs`)}}),!0)}let di=!1;const Kx=({value:e,onChange:t,language:n="json",height:r="100%",readOnly:s=!1,theme:o="vs-dark"})=>{const i=v.useRef(null),[a,l]=v.useState(!1);di||(di=cf());const c=(f,g)=>{i.current=f,window?.G7Core?.assets?.clearFailure?.(lf),n==="json"&&g.languages.json.jsonDefaults.setDiagnosticsOptions({validate:!0,schemaValidation:"error",allowComments:!1}),f.updateOptions({readOnly:s,minimap:{enabled:!1},scrollBeyondLastLine:!1,fontSize:14,lineNumbers:"on",renderWhitespace:"selection",automaticLayout:!0})},d=()=>{l(!0),window?.G7Core?.assets?.notifyFailure?.({id:lf,label:"코드 편집기",retry:()=>{l(!1)}})},u=f=>{t&&f!==void 0&&t({target:{value:f}})};return v.useEffect(()=>{i.current&&i.current.updateOptions({readOnly:s})},[s]),v.useEffect(()=>{if(a)return;let f=!1;return li.init().catch(()=>{f||d()}),()=>{f=!0}},[a]),a?h.jsx("div",{className:"border border-gray-300 dark:border-gray-700 rounded-lg overflow-hidden",children:h.jsx("textarea",{"data-testid":"code-editor-fallback",className:"w-full block p-3 font-mono text-sm bg-gray-100 text-gray-900 dark:bg-gray-900 dark:text-gray-100 outline-none resize-y",style:{height:r==="100%"?"480px":r},value:e,readOnly:s,spellCheck:!1,wrap:"off",onChange:f=>u(f.target.value),onKeyDown:f=>{if(f.key!=="Tab")return;f.preventDefault();const g=f.currentTarget,{selectionStart:m,selectionEnd:p}=g,y=`${e.slice(0,m)} ${e.slice(p)}`;u(y),requestAnimationFrame(()=>{g.selectionStart=g.selectionEnd=m+2})}})}):h.jsx("div",{className:"border border-gray-300 dark:border-gray-700 rounded-lg overflow-hidden",children:h.jsx(Wx,{height:r,language:n,value:e,theme:o,onChange:u,onMount:c,loading:h.jsx("div",{className:"p-4 text-sm text-gray-500 dark:text-gray-400",children:"편집기를 불러오는 중..."}),beforeMount:()=>{di||(di=cf())},options:{readOnly:s,minimap:{enabled:!1},scrollBeyondLastLine:!1,fontSize:14,lineNumbers:"on",renderWhitespace:"selection",automaticLayout:!0}})})},Xx=e=>{const t=new Date(e);return new Intl.DateTimeFormat("ko-KR",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}).format(t)},df=v.memo(({version:e,isSelected:t,onSelect:n})=>{const r=v.useCallback(()=>{n?.(e.id)},[n,e.id]);return h.jsx(il,{role:"listitem","aria-selected":t,className:` p-3 rounded-lg border cursor-pointer transition-colors ${t?"border-blue-500 bg-blue-50 dark:bg-blue-900/20":"border-gray-300 hover:border-gray-400 dark:border-gray-600 dark:hover:border-gray-500"} - `,onClick:r,children:h.jsxs(I,{className:"flex justify-between items-start",children:[h.jsxs(I,{className:"flex-1",children:[h.jsxs(Q,{className:"font-semibold text-gray-900 dark:text-gray-100",children:["버전 ",e.version]}),h.jsx(Q,{className:"ml-2 text-sm text-gray-500 dark:text-gray-400",children:Gv(e.created_at)})]}),h.jsxs(I,{className:"flex gap-3 text-sm",children:[h.jsxs(Q,{className:"text-green-600 dark:text-green-400",children:["+",e.changes_summary.added]}),h.jsxs(Q,{className:"text-red-600 dark:text-red-400",children:["-",e.changes_summary.removed]})]})]})})});Ou.displayName="VersionListItem";const Tu=({versions:e,selectedId:t,onSelect:n})=>e.length===0?h.jsx(I,{className:"p-4 text-center text-gray-500 dark:text-gray-400",children:"버전이 없습니다."}):h.jsx(Va,{role:"list",className:"space-y-2",children:e.map(r=>h.jsx(Ou,{version:r,isSelected:t===r.id,onSelect:n},r.id))}),Yv=({layoutId:e,versions:t,onRestore:n})=>{const[r,s]=v.useState(),o=l=>{s(l)},i=()=>{r!==void 0&&n(r)},a=r===void 0;return h.jsxs(I,{className:"space-y-4",role:"region","aria-label":"레이아웃 히스토리 패널",children:[h.jsx(I,{className:"border border-gray-300 dark:border-gray-600 rounded-lg p-4",children:h.jsx(Tu,{versions:t,selectedId:r,onSelect:o})}),h.jsx(I,{className:"flex justify-end",children:h.jsx(oe,{variant:"primary",disabled:a,onClick:i,"aria-label":"선택한 버전으로 복원",children:"복원"})})]})},Kv=({emailLabel:e="Email",passwordLabel:t="Password",submitButtonText:n="Sign In",processingText:r="Processing...",emailPlaceholder:s="Email",passwordPlaceholder:o="Password",forgotPasswordText:i="Forgot your password?",forgotPasswordUrl:a="/admin/password/reset",emailRequiredError:l="Please enter your email.",emailInvalidError:c="Please enter a valid email address.",passwordRequiredError:d="Please enter your password.",onSubmit:u,loadingActions:f={},isLoading:g=!1,disabled:m=!1,apiError:p="",className:y="",style:b})=>{const[_,x]=v.useState(""),[E,S]=v.useState(""),[w,N]=v.useState({}),C=p,k=Object.values(f).some(F=>F===!0),M=g||k,T=m||M,L=()=>{const F={},D=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;return!_||_.trim()===""?F.email=l:D.test(_)||(F.email=c),(!E||E.trim()==="")&&(F.password=d),N(F),Object.keys(F).length===0},P=async F=>{if(!L()){F.preventDefault();return}N({}),u?await u(F):F.preventDefault()};return h.jsx(I,{className:`w-full ${y}`,style:b,children:h.jsxs(Ha,{onSubmit:P,className:"space-y-6",noValidate:!0,children:[C&&h.jsx(I,{className:"p-4 rounded-lg bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800",children:h.jsx(yt,{className:"text-sm text-red-600 dark:text-red-400",children:C})}),h.jsxs(I,{children:[h.jsx(on,{htmlFor:"email",className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:e}),h.jsx(wt,{id:"email",name:"email",type:"email",value:_,onChange:F=>x(F.target.value),placeholder:s,disabled:T,className:` + `,onClick:r,children:h.jsxs(I,{className:"flex justify-between items-start",children:[h.jsxs(I,{className:"flex-1",children:[h.jsxs(J,{className:"font-semibold text-gray-900 dark:text-gray-100",children:["버전 ",e.version]}),h.jsx(J,{className:"ml-2 text-sm text-gray-500 dark:text-gray-400",children:Xx(e.created_at)})]}),h.jsxs(I,{className:"flex gap-3 text-sm",children:[h.jsxs(J,{className:"text-green-600 dark:text-green-400",children:["+",e.changes_summary.added]}),h.jsxs(J,{className:"text-red-600 dark:text-red-400",children:["-",e.changes_summary.removed]})]})]})})});df.displayName="VersionListItem";const uf=({versions:e,selectedId:t,onSelect:n})=>e.length===0?h.jsx(I,{className:"p-4 text-center text-gray-500 dark:text-gray-400",children:"버전이 없습니다."}):h.jsx(ol,{role:"list",className:"space-y-2",children:e.map(r=>h.jsx(df,{version:r,isSelected:t===r.id,onSelect:n},r.id))}),qx=({layoutId:e,versions:t,onRestore:n})=>{const[r,s]=v.useState(),o=l=>{s(l)},i=()=>{r!==void 0&&n(r)},a=r===void 0;return h.jsxs(I,{className:"space-y-4",role:"region","aria-label":"레이아웃 히스토리 패널",children:[h.jsx(I,{className:"border border-gray-300 dark:border-gray-600 rounded-lg p-4",children:h.jsx(uf,{versions:t,selectedId:r,onSelect:o})}),h.jsx(I,{className:"flex justify-end",children:h.jsx(le,{variant:"primary",disabled:a,onClick:i,"aria-label":"선택한 버전으로 복원",children:"복원"})})]})},Zx=({emailLabel:e="Email",passwordLabel:t="Password",submitButtonText:n="Sign In",processingText:r="Processing...",emailPlaceholder:s="Email",passwordPlaceholder:o="Password",forgotPasswordText:i="Forgot your password?",forgotPasswordUrl:a="/admin/password/reset",emailRequiredError:l="Please enter your email.",emailInvalidError:c="Please enter a valid email address.",passwordRequiredError:d="Please enter your password.",onSubmit:u,loadingActions:f={},isLoading:g=!1,disabled:m=!1,apiError:p="",className:y="",style:b})=>{const[_,x]=v.useState(""),[M,S]=v.useState(""),[k,N]=v.useState({}),C=p,w=Object.values(f).some(F=>F===!0),E=g||w,T=m||E,P=()=>{const F={},A=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;return!_||_.trim()===""?F.email=l:A.test(_)||(F.email=c),(!M||M.trim()==="")&&(F.password=d),N(F),Object.keys(F).length===0},L=async F=>{if(!P()){F.preventDefault();return}N({}),u?await u(F):F.preventDefault()};return h.jsx(I,{className:`w-full ${y}`,style:b,children:h.jsxs(al,{onSubmit:L,className:"space-y-6",noValidate:!0,children:[C&&h.jsx(I,{className:"p-4 rounded-lg bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800",children:h.jsx(kt,{className:"text-sm text-red-600 dark:text-red-400",children:C})}),h.jsxs(I,{children:[h.jsx(gn,{htmlFor:"email",className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:e}),h.jsx(Et,{id:"email",name:"email",type:"email",value:_,onChange:F=>x(F.target.value),placeholder:s,disabled:T,className:` w-full px-4 py-3 rounded-lg border - ${w.email?"border-red-500 focus:border-red-500 focus:ring-red-500":"border-gray-300 dark:border-gray-600 focus:border-blue-500 focus:ring-blue-500"} + ${k.email?"border-red-500 focus:border-red-500 focus:ring-red-500":"border-gray-300 dark:border-gray-600 focus:border-blue-500 focus:ring-blue-500"} bg-white dark:bg-gray-800 text-gray-900 dark:text-white placeholder-gray-400 dark:placeholder-gray-500 focus:outline-none focus:ring-2 disabled:opacity-50 disabled:cursor-not-allowed transition-colors duration-200 - `}),w.email&&h.jsx(yt,{className:"mt-2 text-sm text-red-600 dark:text-red-400",children:w.email})]}),h.jsxs(I,{children:[h.jsx(on,{htmlFor:"password",className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:t}),h.jsx(wt,{id:"password",name:"password",type:"password",value:E,onChange:F=>S(F.target.value),placeholder:o,disabled:T,className:` + `}),k.email&&h.jsx(kt,{className:"mt-2 text-sm text-red-600 dark:text-red-400",children:k.email})]}),h.jsxs(I,{children:[h.jsx(gn,{htmlFor:"password",className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:t}),h.jsx(Et,{id:"password",name:"password",type:"password",value:M,onChange:F=>S(F.target.value),placeholder:o,disabled:T,className:` w-full px-4 py-3 rounded-lg border - ${w.password?"border-red-500 focus:border-red-500 focus:ring-red-500":"border-gray-300 dark:border-gray-600 focus:border-blue-500 focus:ring-blue-500"} + ${k.password?"border-red-500 focus:border-red-500 focus:ring-red-500":"border-gray-300 dark:border-gray-600 focus:border-blue-500 focus:ring-blue-500"} bg-white dark:bg-gray-800 text-gray-900 dark:text-white placeholder-gray-400 dark:placeholder-gray-500 focus:outline-none focus:ring-2 disabled:opacity-50 disabled:cursor-not-allowed transition-colors duration-200 - `}),w.password&&h.jsx(yt,{className:"mt-2 text-sm text-red-600 dark:text-red-400",children:w.password})]}),a&&h.jsx(I,{className:"flex items-center justify-end",children:h.jsx(Fr,{href:a,className:"text-sm text-blue-600 hover:text-blue-500 dark:text-blue-400 dark:hover:text-blue-300 transition-colors duration-200",children:i})}),h.jsx(oe,{type:"submit",disabled:T,className:` + `}),k.password&&h.jsx(kt,{className:"mt-2 text-sm text-red-600 dark:text-red-400",children:k.password})]}),a&&h.jsx(I,{className:"flex items-center justify-end",children:h.jsx(qr,{href:a,className:"text-sm text-blue-600 hover:text-blue-500 dark:text-blue-400 dark:hover:text-blue-300 transition-colors duration-200",children:i})}),h.jsx(le,{type:"submit",disabled:T,className:` w-full px-4 py-3 rounded-lg font-medium bg-blue-600 hover:bg-blue-700 dark:bg-blue-500 dark:hover:bg-blue-600 @@ -146,16 +147,16 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho disabled:opacity-50 disabled:cursor-not-allowed transition-colors duration-200 flex items-center justify-center - `,children:M?h.jsxs(h.Fragment,{children:[h.jsxs(Wn,{className:"animate-spin -ml-1 mr-3 h-5 w-5 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[h.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),h.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),r]}):n})]})})},Au=e=>e==="auto"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":e,fl=e=>{const t=Au(e);document.documentElement.setAttribute("data-theme",t),t==="dark"?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark")},Xv=()=>{const e=localStorage.getItem("g7_color_scheme");return e&&["auto","light","dark"].includes(e)?e:"auto"},qv=({onThemeChange:e,className:t="",autoText:n="System",lightText:r="Light",darkText:s="Dark",id:o,editorAttrs:i})=>{const a=Xv(),[l,c]=v.useState(a),[d,u]=v.useState(!1),f=v.useRef(null);v.useEffect(()=>{fl(l)},[]),v.useEffect(()=>{if(l!=="auto")return;const p=window.matchMedia("(prefers-color-scheme: dark)"),y=()=>{fl("auto")};return p.addEventListener("change",y),()=>p.removeEventListener("change",y)},[l]),v.useEffect(()=>{const p=y=>{f.current&&!f.current.contains(y.target)&&u(!1)};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[]);const g=p=>{c(p),localStorage.setItem("g7_color_scheme",p),fl(p),u(!1),e?.(p)},m=()=>Au(l)==="dark"?de.Moon:de.Sun;return h.jsxs(I,{ref:f,className:`relative ${t}`,id:o,...i,children:[h.jsx(oe,{onClick:()=>u(!d),className:"w-9 h-9 flex items-center justify-center hover:bg-gray-100 dark:hover:bg-gray-800 rounded-full transition-colors","aria-label":"Toggle theme",children:h.jsx(re,{name:m(),className:"text-sm text-slate-500 dark:text-slate-400"})}),d&&h.jsx(I,{className:"absolute right-0 mt-2 w-48 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg z-50",children:h.jsxs(I,{className:"py-2",children:[h.jsxs(oe,{onClick:()=>g("auto"),className:` + `,children:E?h.jsxs(h.Fragment,{children:[h.jsxs(Jn,{className:"animate-spin -ml-1 mr-3 h-5 w-5 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[h.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),h.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),r]}):n})]})})},ff=e=>e==="auto"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":e,Ll=e=>{const t=ff(e);document.documentElement.setAttribute("data-theme",t),t==="dark"?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark")},Qx=()=>{const e=localStorage.getItem("g7_color_scheme");return e&&["auto","light","dark"].includes(e)?e:"auto"},Jx=({onThemeChange:e,className:t="",autoText:n="System",lightText:r="Light",darkText:s="Dark",id:o,editorAttrs:i})=>{const a=Qx(),[l,c]=v.useState(a),[d,u]=v.useState(!1),f=v.useRef(null);v.useEffect(()=>{Ll(l)},[]),v.useEffect(()=>{if(l!=="auto")return;const p=window.matchMedia("(prefers-color-scheme: dark)"),y=()=>{Ll("auto")};return p.addEventListener("change",y),()=>p.removeEventListener("change",y)},[l]),v.useEffect(()=>{const p=y=>{f.current&&!f.current.contains(y.target)&&u(!1)};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[]);const g=p=>{c(p),localStorage.setItem("g7_color_scheme",p),Ll(p),u(!1),e?.(p)},m=()=>ff(l)==="dark"?he.Moon:he.Sun;return h.jsxs(I,{ref:f,className:`relative ${t}`,id:o,...i,children:[h.jsx(le,{onClick:()=>u(!d),className:"w-9 h-9 flex items-center justify-center hover:bg-gray-100 dark:hover:bg-gray-800 rounded-full transition-colors","aria-label":"Toggle theme",children:h.jsx(ae,{name:m(),className:"text-sm text-slate-500 dark:text-slate-400"})}),d&&h.jsx(I,{className:"absolute right-0 mt-2 w-48 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg z-50",children:h.jsxs(I,{className:"py-2",children:[h.jsxs(le,{onClick:()=>g("auto"),className:` w-full px-4 py-2 text-left hover:bg-gray-50 dark:hover:bg-gray-700 flex items-center gap-3 transition-colors ${l==="auto"?"bg-gray-50 dark:bg-gray-700":""} - `,children:[h.jsx(re,{name:de.Settings,className:"w-5 h-5 text-gray-600 dark:text-gray-400"}),h.jsx(Q,{className:"flex-1 text-left text-gray-900 dark:text-white",children:n}),l==="auto"&&h.jsx(re,{name:de.Check,className:"w-4 h-4 text-blue-600 dark:text-blue-400 ml-auto"})]}),h.jsxs(oe,{onClick:()=>g("light"),className:` + `,children:[h.jsx(ae,{name:he.Settings,className:"w-5 h-5 text-gray-600 dark:text-gray-400"}),h.jsx(J,{className:"flex-1 text-left text-gray-900 dark:text-white",children:n}),l==="auto"&&h.jsx(ae,{name:he.Check,className:"w-4 h-4 text-blue-600 dark:text-blue-400 ml-auto"})]}),h.jsxs(le,{onClick:()=>g("light"),className:` w-full px-4 py-2 text-left hover:bg-gray-50 dark:hover:bg-gray-700 flex items-center gap-3 transition-colors ${l==="light"?"bg-gray-50 dark:bg-gray-700":""} - `,children:[h.jsx(re,{name:de.Sun,className:"w-5 h-5 text-gray-600 dark:text-gray-400"}),h.jsx(Q,{className:"flex-1 text-left text-gray-900 dark:text-white",children:r}),l==="light"&&h.jsx(re,{name:de.Check,className:"w-4 h-4 text-blue-600 dark:text-blue-400 ml-auto"})]}),h.jsxs(oe,{onClick:()=>g("dark"),className:` + `,children:[h.jsx(ae,{name:he.Sun,className:"w-5 h-5 text-gray-600 dark:text-gray-400"}),h.jsx(J,{className:"flex-1 text-left text-gray-900 dark:text-white",children:r}),l==="light"&&h.jsx(ae,{name:he.Check,className:"w-4 h-4 text-blue-600 dark:text-blue-400 ml-auto"})]}),h.jsxs(le,{onClick:()=>g("dark"),className:` w-full px-4 py-2 text-left hover:bg-gray-50 dark:hover:bg-gray-700 flex items-center gap-3 transition-colors ${l==="dark"?"bg-gray-50 dark:bg-gray-700":""} - `,children:[h.jsx(re,{name:de.Moon,className:"w-5 h-5 text-gray-600 dark:text-gray-400"}),h.jsx(Q,{className:"flex-1 text-left text-gray-900 dark:text-white",children:s}),l==="dark"&&h.jsx(re,{name:de.Check,className:"w-4 h-4 text-blue-600 dark:text-blue-400 ml-auto"})]})]})})]})},Du=window.G7Core?.createLogger?.("Comp:ColumnSelector")??{log:(...e)=>console.log("[Comp:ColumnSelector]",...e),warn:(...e)=>console.warn("[Comp:ColumnSelector]",...e),error:(...e)=>console.error("[Comp:ColumnSelector]",...e)},Iu=(e,t)=>window.G7Core?.t?.(e,t)??e,Zv=()=>window.G7Core,Qv=({id:e,columns:t,visibleColumns:n,onColumnVisibilityChange:r,triggerLabel:s,triggerIconName:o=de.Sliders,position:i="right",className:a="",style:l,requiredText:c,menuTitle:d,menuDescription:u,defaultColumns:f,triggerClassName:g,labelClassName:m,dynamicColumns:p,dynamicColumnsInsertAfter:y,editorAttrs:b})=>{const _=s??Iu("common.column_selector"),x=c??Iu("common.required"),E=v.useMemo(()=>{if(!p||!Array.isArray(p)||p.length===0)return t;if(y){const z=t.findIndex(K=>K.field===y);if(z!==-1)return[...t.slice(0,z+1),...p,...t.slice(z+1)]}return[...t,...p]},[t,p,y]),[S,w]=v.useState(!1),N=v.useRef(null),C=v.useRef(null),[k,M]=v.useState(!1),[T,L]=v.useState(i),P=v.useMemo(()=>{try{const z=window.G7Core?.AuthManager?.getInstance();return z?z.getUser()?.uuid:void 0}catch{return}},[]),F=e?`g7_columns_${e}${P!==void 0?`_${P}`:""}`:null,D=()=>{if(!F)return null;try{const z=localStorage.getItem(F);if(z){const K=JSON.parse(z);if(Array.isArray(K)&&K.length>0)return K}}catch(z){Du.warn("Failed to load from localStorage:",z)}return null},A=z=>{if(F)try{localStorage.setItem(F,JSON.stringify(z))}catch(K){Du.warn("Failed to save to localStorage:",K)}},O=()=>{const z=D();return z||(n&&n.length>0?n:f&&f.length>0?f:E.filter(K=>K.visible!==!1).map(K=>K.field))},[V,H]=v.useState(O);v.useEffect(()=>{k||(r&&V.length>0&&r(V),M(!0))},[k,r,V]),v.useEffect(()=>{k&&n&&n.length>0&&(D()||H(n))},[n,k]);const W=v.useRef([]),j=v.useRef(null);v.useEffect(()=>{if(k&&p&&p.length>0){const z=p.map(Z=>Z.field);if(j.current===null){const Z=D();if(j.current=Z!==null,Z!==null){W.current=z;return}}const K=W.current,Y=z.filter(Z=>!K.includes(Z));if(Y.length>0){const Z=n&&n.length>0?n:V,ee=Y.filter(te=>!Z.includes(te));if(ee.length>0){const te=[...Z,...ee];H(te),A(te),r?.(te)}}W.current=z}},[p,k]);const U=n&&n.length>0?n:V;v.useEffect(()=>{const z=K=>{N.current&&!N.current.contains(K.target)&&w(!1)};return S&&document.addEventListener("mousedown",z),()=>{document.removeEventListener("mousedown",z)}},[S]),v.useEffect(()=>{if(S&&C.current&&N.current){const z=C.current.getBoundingClientRect(),K=N.current.getBoundingClientRect(),Y=window.innerWidth,Z=z.width||256;i==="right"?K.right-Z<0?L("left"):L("right"):K.left+Z>Y?L("right"):L("left")}},[S,i]);const B=z=>{if(E.find(Z=>Z.field===z)?.required)return;const Y=U.includes(z)?U.filter(Z=>Z!==z):[...U,z];H(Y),A(Y),r?.(Y)},G=T==="left"?"left-0":"right-0";return h.jsxs(I,{ref:N,className:`relative inline-block ${a}`,style:l,id:e,...b,children:[h.jsxs(oe,{onClick:()=>w(!S),className:Zv()?.style?.mergeClasses?.("flex items-center gap-2 px-3 py-2 bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 rounded-lg hover:bg-gray-200 dark:hover:bg-gray-600 transition-colors",g)??`flex items-center gap-2 px-3 py-2 bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 rounded-lg hover:bg-gray-200 dark:hover:bg-gray-600 transition-colors ${g??""}`,children:[h.jsx(re,{name:o,className:"w-5 h-5"}),_&&h.jsx(Q,{className:`${m||"hidden sm:inline"} text-sm`,children:_})]}),S&&h.jsxs(I,{ref:C,className:`absolute ${G} z-50 mt-2 w-64 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg`,children:[(d||u)&&h.jsxs(I,{className:"px-4 pt-3 pb-2 border-b border-gray-200 dark:border-gray-700",children:[d&&h.jsx(Q,{className:"block text-sm font-medium text-gray-900 dark:text-white",children:d}),u&&h.jsx(Q,{className:"block text-xs text-gray-500 dark:text-gray-400 mt-1",children:u})]}),h.jsx(I,{className:"p-2 max-h-64 overflow-y-auto",children:E.map(z=>{const K=U.includes(z.field),Y=z.required===!0;return h.jsxs(I,{onClick:()=>!Y&&B(z.field),className:`flex items-center gap-2 px-3 py-2 rounded hover:bg-gray-50 dark:hover:bg-gray-700 ${Y?"cursor-default":"cursor-pointer"}`,children:[h.jsx(Cn,{checked:K,disabled:Y,readOnly:!0,className:"h-4 w-4 text-blue-600 rounded border-gray-300 dark:border-gray-600 pointer-events-none"}),h.jsx(Q,{className:"text-sm text-gray-700 dark:text-gray-300",children:z.header}),Y&&x&&h.jsx(Q,{className:"ml-auto text-xs text-gray-400 dark:text-gray-500",children:x})]},z.field)})})]})]})},Jv=window.G7Core?.createLogger?.("Comp:PageTransition")??{log:(...e)=>console.log("[Comp:PageTransition]",...e),warn:(...e)=>console.warn("[Comp:PageTransition]",...e),error:(...e)=>console.error("[Comp:PageTransition]",...e)},Rv=({className:e="",style:t})=>{const[n,r]=v.useState(!1);return v.useEffect(()=>{const s=window.G7Core?.TransitionManager;if(!s){Jv.warn("TransitionManager를 찾을 수 없습니다.");return}return r(s.getIsPending()),s.subscribe(i=>{r(i)})},[]),n?h.jsxs(I,{className:`fixed top-0 left-0 right-0 z-[999] ${e}`,style:t,role:"progressbar","aria-label":"페이지 로딩 중",children:[h.jsx(I,{className:"h-1 bg-gradient-to-r from-blue-500 via-blue-600 to-blue-500 animate-pulse",children:h.jsx(I,{className:"h-full bg-blue-700 animate-[loading_1.5s_ease-in-out_infinite]",style:{width:"30%",animation:"loading 1.5s ease-in-out infinite"}})}),h.jsx("style",{children:` + `,children:[h.jsx(ae,{name:he.Moon,className:"w-5 h-5 text-gray-600 dark:text-gray-400"}),h.jsx(J,{className:"flex-1 text-left text-gray-900 dark:text-white",children:s}),l==="dark"&&h.jsx(ae,{name:he.Check,className:"w-4 h-4 text-blue-600 dark:text-blue-400 ml-auto"})]})]})})]})},hf=window.G7Core?.createLogger?.("Comp:ColumnSelector")??{log:(...e)=>console.log("[Comp:ColumnSelector]",...e),warn:(...e)=>console.warn("[Comp:ColumnSelector]",...e),error:(...e)=>console.error("[Comp:ColumnSelector]",...e)},gf=(e,t)=>window.G7Core?.t?.(e,t)??e,Rx=()=>window.G7Core,ew=({id:e,columns:t,visibleColumns:n,onColumnVisibilityChange:r,triggerLabel:s,triggerIconName:o=he.Sliders,position:i="right",className:a="",style:l,requiredText:c,menuTitle:d,menuDescription:u,defaultColumns:f,triggerClassName:g,labelClassName:m,dynamicColumns:p,dynamicColumnsInsertAfter:y,editorAttrs:b})=>{const _=s??gf("common.column_selector"),x=c??gf("common.required"),M=v.useMemo(()=>{if(!p||!Array.isArray(p)||p.length===0)return t;if(y){const V=t.findIndex(X=>X.field===y);if(V!==-1)return[...t.slice(0,V+1),...p,...t.slice(V+1)]}return[...t,...p]},[t,p,y]),[S,k]=v.useState(!1),N=v.useRef(null),C=v.useRef(null),[w,E]=v.useState(!1),[T,P]=v.useState(i),L=v.useMemo(()=>{try{const V=window.G7Core?.AuthManager?.getInstance();return V?V.getUser()?.uuid:void 0}catch{return}},[]),F=e?`g7_columns_${e}${L!==void 0?`_${L}`:""}`:null,A=()=>{if(!F)return null;try{const V=localStorage.getItem(F);if(V){const X=JSON.parse(V);if(Array.isArray(X)&&X.length>0)return X}}catch(V){hf.warn("Failed to load from localStorage:",V)}return null},D=V=>{if(F)try{localStorage.setItem(F,JSON.stringify(V))}catch(X){hf.warn("Failed to save to localStorage:",X)}},O=()=>{const V=A();return V||(n&&n.length>0?n:f&&f.length>0?f:M.filter(X=>X.visible!==!1).map(X=>X.field))},[z,U]=v.useState(O);v.useEffect(()=>{w||(r&&z.length>0&&r(z),E(!0))},[w,r,z]),v.useEffect(()=>{w&&n&&n.length>0&&(A()||U(n))},[n,w]);const j=v.useRef([]),Y=v.useRef(null);v.useEffect(()=>{if(w&&p&&p.length>0){const V=p.map(Q=>Q.field);if(Y.current===null){const Q=A();if(Y.current=Q!==null,Q!==null){j.current=V;return}}const X=j.current,K=V.filter(Q=>!X.includes(Q));if(K.length>0){const Q=n&&n.length>0?n:z,ne=K.filter(se=>!Q.includes(se));if(ne.length>0){const se=[...Q,...ne];U(se),D(se),r?.(se)}}j.current=V}},[p,w]);const B=n&&n.length>0?n:z;v.useEffect(()=>{const V=X=>{N.current&&!N.current.contains(X.target)&&k(!1)};return S&&document.addEventListener("mousedown",V),()=>{document.removeEventListener("mousedown",V)}},[S]),v.useEffect(()=>{if(S&&C.current&&N.current){const V=C.current.getBoundingClientRect(),X=N.current.getBoundingClientRect(),K=window.innerWidth,Q=V.width||256;i==="right"?X.right-Q<0?P("left"):P("right"):X.left+Q>K?P("right"):P("left")}},[S,i]);const W=V=>{if(M.find(Q=>Q.field===V)?.required)return;const K=B.includes(V)?B.filter(Q=>Q!==V):[...B,V];U(K),D(K),r?.(K)},G=T==="left"?"left-0":"right-0";return h.jsxs(I,{ref:N,className:`relative inline-block ${a}`,style:l,id:e,...b,children:[h.jsxs(le,{onClick:()=>k(!S),className:Rx()?.style?.mergeClasses?.("flex items-center gap-2 px-3 py-2 bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 rounded-lg hover:bg-gray-200 dark:hover:bg-gray-600 transition-colors",g)??`flex items-center gap-2 px-3 py-2 bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 rounded-lg hover:bg-gray-200 dark:hover:bg-gray-600 transition-colors ${g??""}`,children:[h.jsx(ae,{name:o,className:"w-5 h-5"}),_&&h.jsx(J,{className:`${m||"hidden sm:inline"} text-sm`,children:_})]}),S&&h.jsxs(I,{ref:C,className:`absolute ${G} z-50 mt-2 w-64 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg`,children:[(d||u)&&h.jsxs(I,{className:"px-4 pt-3 pb-2 border-b border-gray-200 dark:border-gray-700",children:[d&&h.jsx(J,{className:"block text-sm font-medium text-gray-900 dark:text-white",children:d}),u&&h.jsx(J,{className:"block text-xs text-gray-500 dark:text-gray-400 mt-1",children:u})]}),h.jsx(I,{className:"p-2 max-h-64 overflow-y-auto",children:M.map(V=>{const X=B.includes(V.field),K=V.required===!0;return h.jsxs(I,{onClick:()=>!K&&W(V.field),className:`flex items-center gap-2 px-3 py-2 rounded hover:bg-gray-50 dark:hover:bg-gray-700 ${K?"cursor-default":"cursor-pointer"}`,children:[h.jsx(On,{checked:X,disabled:K,readOnly:!0,className:"h-4 w-4 text-blue-600 rounded border-gray-300 dark:border-gray-600 pointer-events-none"}),h.jsx(J,{className:"text-sm text-gray-700 dark:text-gray-300",children:V.header}),K&&x&&h.jsx(J,{className:"ml-auto text-xs text-gray-400 dark:text-gray-500",children:x})]},V.field)})})]})]})},tw=window.G7Core?.createLogger?.("Comp:PageTransition")??{log:(...e)=>console.log("[Comp:PageTransition]",...e),warn:(...e)=>console.warn("[Comp:PageTransition]",...e),error:(...e)=>console.error("[Comp:PageTransition]",...e)},nw=({className:e="",style:t})=>{const[n,r]=v.useState(!1);return v.useEffect(()=>{const s=window.G7Core?.TransitionManager;if(!s){tw.warn("TransitionManager를 찾을 수 없습니다.");return}return r(s.getIsPending()),s.subscribe(i=>{r(i)})},[]),n?h.jsxs(I,{className:`fixed top-0 left-0 right-0 z-[999] ${e}`,style:t,role:"progressbar","aria-label":"페이지 로딩 중",children:[h.jsx(I,{className:"h-1 bg-gradient-to-r from-blue-500 via-blue-600 to-blue-500 animate-pulse",children:h.jsx(I,{className:"h-full bg-blue-700 animate-[loading_1.5s_ease-in-out_infinite]",style:{width:"30%",animation:"loading 1.5s ease-in-out infinite"}})}),h.jsx("style",{children:` @keyframes loading { 0% { transform: translateX(-100%); @@ -167,19 +168,19 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho transform: translateX(-100%); } } - `})]}):null},ex=(e,t)=>window.G7Core?.t?.(e,t)??e,tx=({options:e})=>{const t=document.documentElement.classList.contains("dark"),n=t?"rgb(17,24,39)":"rgb(249,250,251)",r=t?"#6b7280":"#9ca3af",s=t?"#9ca3af":"#6b7280";return h.jsxs("div",{style:{position:"absolute",inset:0,zIndex:2147483647,overflow:"hidden",background:n,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"flex-start",paddingTop:"15%",gap:"12px"},children:[h.jsx("div",{style:{width:"32px",height:"32px",border:`3px solid ${r}`,borderTopColor:"transparent",borderRadius:"50%",animation:"g7-spin 0.8s linear infinite"}}),h.jsx("span",{style:{color:s,fontSize:"14px"},children:e?.text||ex("nav.loading")})]})};function pr(e){"@babel/helpers - typeof";return pr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},pr(e)}function nx(e,t){if(pr(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(pr(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Lu(e){var t=nx(e,"string");return pr(t)=="symbol"?t:t+""}function Ls(e,t,n){return(t=Lu(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Pu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function Ee(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);n0?$t(Kr,--Rt):0,Yr--,kt===10&&(Yr=1,ei--),kt}function cn(){return kt=Rt2||Vs(kt)>3?"":" "}function Tx(e,t){for(;--t&&cn()&&!(kt<48||kt>102||kt>57&&kt<65||kt>70&&kt<97););return Fs(e,ni()+(t<6&&Pn()==32&&cn()==32))}function vl(e){for(;cn();)switch(kt){case e:return Rt;case 34:case 39:e!==34&&e!==39&&vl(kt);break;case 40:e===41&&vl(e);break;case 92:cn();break}return Rt}function Ax(e,t){for(;cn()&&e+kt!==57;)if(e+kt===84&&Pn()===47)break;return"/*"+Fs(t,Rt-1)+"*"+Jo(e===47?e:cn())}function Dx(e){for(;!Vs(Pn());)cn();return Fs(e,Rt)}function Ix(e){return Gu(si("",null,null,null,[""],e=Wu(e),0,[0],e))}function si(e,t,n,r,s,o,i,a,l){for(var c=0,d=0,u=i,f=0,g=0,m=0,p=1,y=1,b=1,_=0,x="",E=s,S=o,w=r,N=x;y;)switch(m=_,_=cn()){case 40:if(m!=108&&$t(N,u-1)==58){bl(N+=Je(ri(_),"&","&\f"),"&\f")!=-1&&(b=-1);break}case 34:case 39:case 91:N+=ri(_);break;case 9:case 10:case 13:case 32:N+=Ox(m);break;case 92:N+=Tx(ni()-1,7);continue;case 47:switch(Pn()){case 42:case 47:Ro(Lx(Ax(cn(),ni()),t,n),l);break;default:N+="/"}break;case 123*p:a[c++]=Ln(N)*b;case 125*p:case 59:case 0:switch(_){case 0:case 125:y=0;case 59+d:b==-1&&(N=Je(N,/\f/g,"")),g>0&&Ln(N)-u&&Ro(g>32?Ku(N+";",r,n,u-1):Ku(Je(N," ","")+";",r,n,u-2),l);break;case 59:N+=";";default:if(Ro(w=Yu(N,t,n,c,d,s,a,x,E=[],S=[],u),o),_===123)if(d===0)si(N,t,w,w,E,o,u,a,S);else switch(f===99&&$t(N,3)===110?100:f){case 100:case 108:case 109:case 115:si(e,w,w,r&&Ro(Yu(e,w,w,0,0,s,a,x,s,E=[],u),S),s,S,u,a,r?E:S);break;default:si(N,w,w,w,[""],S,0,a,S)}}c=d=g=0,p=b=1,x=N="",u=i;break;case 58:u=1+Ln(N),g=m;default:if(p<1){if(_==123)--p;else if(_==125&&p++==0&&Nx()==125)continue}switch(N+=Jo(_),_*p){case 38:b=d>0?1:(N+="\f",-1);break;case 44:a[c++]=(Ln(N)-1)*b,b=1;break;case 64:Pn()===45&&(N+=ri(cn())),f=Pn(),d=u=Ln(x=N+=Dx(ni())),_++;break;case 45:m===45&&Ln(N)==2&&(p=0)}}return o}function Yu(e,t,n,r,s,o,i,a,l,c,d){for(var u=s-1,f=s===0?o:[""],g=yl(f),m=0,p=0,y=0;m0?f[b]+" "+_:Je(_,/&\f/g,f[b])))&&(l[y++]=x);return ti(e,t,n,s===0?pl:a,l,c,d)}function Lx(e,t,n){return ti(e,t,n,Hu,Jo(Mx()),Ps(e,2,-2),0)}function Ku(e,t,n,r){return ti(e,t,n,ml,Ps(e,0,r),Ps(e,r+1,-1),r)}function Xr(e,t){for(var n="",r=yl(e),s=0;s6)switch($t(e,t+1)){case 109:if($t(e,t+4)!==45)break;case 102:return Je(e,/(.+:)(.+)-([^]+)/,"$1"+Qe+"$2-$3$1"+Qo+($t(e,t+3)==108?"$3":"$2-$3"))+e;case 115:return~bl(e,"stretch")?qu(Je(e,"stretch","fill-available"),t)+e:e}break;case 4949:if($t(e,t+1)!==115)break;case 6444:switch($t(e,Ln(e)-3-(~bl(e,"!important")&&10))){case 107:return Je(e,":",":"+Qe)+e;case 101:return Je(e,/(.+:)([^;!]+)(;|!.+)?/,"$1"+Qe+($t(e,14)===45?"inline-":"")+"box$3$1"+Qe+"$2$3$1"+zt+"$2box$3")+e}break;case 5936:switch($t(e,t+11)){case 114:return Qe+e+zt+Je(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return Qe+e+zt+Je(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return Qe+e+zt+Je(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return Qe+e+zt+e+e}return e}var Wx=function(t,n,r,s){if(t.length>-1&&!t.return)switch(t.type){case ml:t.return=qu(t.value,t.length);break;case Uu:return Xr([$s(t,{value:Je(t.value,"@","@"+Qe)})],s);case pl:if(t.length)return Ex(t.props,function(o){switch(_x(o,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return Xr([$s(t,{props:[Je(o,/:(read-\w+)/,":"+Qo+"$1")]})],s);case"::placeholder":return Xr([$s(t,{props:[Je(o,/:(plac\w+)/,":"+Qe+"input-$1")]}),$s(t,{props:[Je(o,/:(plac\w+)/,":"+Qo+"$1")]}),$s(t,{props:[Je(o,/:(plac\w+)/,zt+"input-$1")]})],s)}return""})}},Gx=[Wx],Yx=function(t){var n=t.key;if(n==="css"){var r=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(r,function(p){var y=p.getAttribute("data-emotion");y.indexOf(" ")!==-1&&(document.head.appendChild(p),p.setAttribute("data-s",""))})}var s=t.stylisPlugins||Gx,o={},i,a=[];i=t.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+n+' "]'),function(p){for(var y=p.getAttribute("data-emotion").split(" "),b=1;bwindow.G7Core?.t?.(e,t)??e,sw=({options:e})=>{const t=document.documentElement.classList.contains("dark"),n=t?"rgb(17,24,39)":"rgb(249,250,251)",r=t?"#6b7280":"#9ca3af",s=t?"#9ca3af":"#6b7280";return h.jsxs("div",{style:{position:"absolute",inset:0,zIndex:2147483647,overflow:"hidden",background:n,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"flex-start",paddingTop:"15%",gap:"12px"},children:[h.jsx("div",{style:{width:"32px",height:"32px",border:`3px solid ${r}`,borderTopColor:"transparent",borderRadius:"50%",animation:"g7-spin 0.8s linear infinite"}}),h.jsx("span",{style:{color:s,fontSize:"14px"},children:e?.text||rw("nav.loading")})]})};function Mr(e){"@babel/helpers - typeof";return Mr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Mr(e)}function ow(e,t){if(Mr(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Mr(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function pf(e){var t=ow(e,"string");return Mr(t)=="symbol"?t:t+""}function qs(e,t,n){return(t=pf(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function mf(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function Me(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);n0?jt(as,--on):0,is--,Nt===10&&(is=1,pi--),Nt}function yn(){return Nt=on2||Rs(Nt)>3?"":" "}function Iw(e,t){for(;--t&&yn()&&!(Nt<48||Nt>102||Nt>57&&Nt<65||Nt>70&&Nt<97););return Js(e,bi()+(t<6&&Bn()==32&&yn()==32))}function Ul(e){for(;yn();)switch(Nt){case e:return on;case 34:case 39:e!==34&&e!==39&&Ul(Nt);break;case 40:e===41&&Ul(e);break;case 92:yn();break}return on}function Lw(e,t){for(;yn()&&e+Nt!==57;)if(e+Nt===84&&Bn()===47)break;return"/*"+Js(t,on-1)+"*"+hi(e===47?e:yn())}function Pw(e){for(;!Rs(Bn());)yn();return Js(e,on)}function $w(e){return Ef(vi("",null,null,null,[""],e=_f(e),0,[0],e))}function vi(e,t,n,r,s,o,i,a,l){for(var c=0,d=0,u=i,f=0,g=0,m=0,p=1,y=1,b=1,_=0,x="",M=s,S=o,k=r,N=x;y;)switch(m=_,_=yn()){case 40:if(m!=108&&jt(N,u-1)==58){Vl(N+=st(yi(_),"&","&\f"),"&\f")!=-1&&(b=-1);break}case 34:case 39:case 91:N+=yi(_);break;case 9:case 10:case 13:case 32:N+=Dw(m);break;case 92:N+=Iw(bi()-1,7);continue;case 47:switch(Bn()){case 42:case 47:gi(Fw(Lw(yn(),bi()),t,n),l);break;default:N+="/"}break;case 123*p:a[c++]=Un(N)*b;case 125*p:case 59:case 0:switch(_){case 0:case 125:y=0;case 59+d:b==-1&&(N=st(N,/\f/g,"")),g>0&&Un(N)-u&&gi(g>32?Nf(N+";",r,n,u-1):Nf(st(N," ","")+";",r,n,u-2),l);break;case 59:N+=";";default:if(gi(k=Mf(N,t,n,c,d,s,a,x,M=[],S=[],u),o),_===123)if(d===0)vi(N,t,k,k,M,o,u,a,S);else switch(f===99&&jt(N,3)===110?100:f){case 100:case 108:case 109:case 115:vi(e,k,k,r&&gi(Mf(e,k,k,0,0,s,a,x,s,M=[],u),S),s,S,u,a,r?M:S);break;default:vi(N,k,k,k,[""],S,0,a,S)}}c=d=g=0,p=b=1,x=N="",u=i;break;case 58:u=1+Un(N),g=m;default:if(p<1){if(_==123)--p;else if(_==125&&p++==0&&Aw()==125)continue}switch(N+=hi(_),_*p){case 38:b=d>0?1:(N+="\f",-1);break;case 44:a[c++]=(Un(N)-1)*b,b=1;break;case 64:Bn()===45&&(N+=yi(yn())),f=Bn(),d=u=Un(x=N+=Pw(bi())),_++;break;case 45:m===45&&Un(N)==2&&(p=0)}}return o}function Mf(e,t,n,r,s,o,i,a,l,c,d){for(var u=s-1,f=s===0?o:[""],g=Hl(f),m=0,p=0,y=0;m0?f[b]+" "+_:st(_,/&\f/g,f[b])))&&(l[y++]=x);return mi(e,t,n,s===0?Fl:a,l,c,d)}function Fw(e,t,n){return mi(e,t,n,wf,hi(Tw()),Zs(e,2,-2),0)}function Nf(e,t,n,r){return mi(e,t,n,zl,Zs(e,0,r),Zs(e,r+1,-1),r)}function ls(e,t){for(var n="",r=Hl(e),s=0;s6)switch(jt(e,t+1)){case 109:if(jt(e,t+4)!==45)break;case 102:return st(e,/(.+:)(.+)-([^]+)/,"$1"+rt+"$2-$3$1"+fi+(jt(e,t+3)==108?"$3":"$2-$3"))+e;case 115:return~Vl(e,"stretch")?Tf(st(e,"stretch","fill-available"),t)+e:e}break;case 4949:if(jt(e,t+1)!==115)break;case 6444:switch(jt(e,Un(e)-3-(~Vl(e,"!important")&&10))){case 107:return st(e,":",":"+rt)+e;case 101:return st(e,/(.+:)([^;!]+)(;|!.+)?/,"$1"+rt+(jt(e,14)===45?"inline-":"")+"box$3$1"+rt+"$2$3$1"+Xt+"$2box$3")+e}break;case 5936:switch(jt(e,t+11)){case 114:return rt+e+Xt+st(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return rt+e+Xt+st(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return rt+e+Xt+st(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return rt+e+Xt+e+e}return e}var Kw=function(t,n,r,s){if(t.length>-1&&!t.return)switch(t.type){case zl:t.return=Tf(t.value,t.length);break;case kf:return ls([Qs(t,{value:st(t.value,"@","@"+rt)})],s);case Fl:if(t.length)return Ow(t.props,function(o){switch(Nw(o,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return ls([Qs(t,{props:[st(o,/:(read-\w+)/,":"+fi+"$1")]})],s);case"::placeholder":return ls([Qs(t,{props:[st(o,/:(plac\w+)/,":"+rt+"input-$1")]}),Qs(t,{props:[st(o,/:(plac\w+)/,":"+fi+"$1")]}),Qs(t,{props:[st(o,/:(plac\w+)/,Xt+"input-$1")]})],s)}return""})}},Xw=[Kw],qw=function(t){var n=t.key;if(n==="css"){var r=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(r,function(p){var y=p.getAttribute("data-emotion");y.indexOf(" ")!==-1&&(document.head.appendChild(p),p.setAttribute("data-s",""))})}var s=t.stylisPlugins||Xw,o={},i,a=[];i=t.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+n+' "]'),function(p){for(var y=p.getAttribute("data-emotion").split(" "),b=1;b=4;++r,s-=4)n=e.charCodeAt(r)&255|(e.charCodeAt(++r)&255)<<8|(e.charCodeAt(++r)&255)<<16|(e.charCodeAt(++r)&255)<<24,n=(n&65535)*1540483477+((n>>>16)*59797<<16),n^=n>>>24,t=(n&65535)*1540483477+((n>>>16)*59797<<16)^(t&65535)*1540483477+((t>>>16)*59797<<16);switch(s){case 3:t^=(e.charCodeAt(r+2)&255)<<16;case 2:t^=(e.charCodeAt(r+1)&255)<<8;case 1:t^=e.charCodeAt(r)&255,t=(t&65535)*1540483477+((t>>>16)*59797<<16)}return t^=t>>>13,t=(t&65535)*1540483477+((t>>>16)*59797<<16),((t^t>>>15)>>>0).toString(36)}var ew={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,scale:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},tw=/[A-Z]|^ms/g,nw=/_EMO_([^_]+?)_([^]*?)_EMO_/g,ef=function(t){return t.charCodeAt(1)===45},tf=function(t){return t!=null&&typeof t!="boolean"},kl=Vx(function(e){return ef(e)?e:e.replace(tw,"-$&").toLowerCase()}),nf=function(t,n){switch(t){case"animation":case"animationName":if(typeof n=="string")return n.replace(nw,function(r,s,o){return $n={name:s,styles:o,next:$n},s})}return ew[t]!==1&&!ef(t)&&typeof n=="number"&&n!==0?n+"px":n};function zs(e,t,n){if(n==null)return"";var r=n;if(r.__emotion_styles!==void 0)return r;switch(typeof n){case"boolean":return"";case"object":{var s=n;if(s.anim===1)return $n={name:s.name,styles:s.styles,next:$n},s.name;var o=n;if(o.styles!==void 0){var i=o.next;if(i!==void 0)for(;i!==void 0;)$n={name:i.name,styles:i.styles,next:$n},i=i.next;var a=o.styles+";";return a}return rw(e,t,n)}case"function":{if(e!==void 0){var l=$n,c=n(e);return $n=l,zs(e,t,c)}break}}var d=n;return d}function rw(e,t,n){var r="";if(Array.isArray(n))for(var s=0;s({x:e,y:e});function bw(e){const{x:t,y:n,width:r,height:s}=e;return{width:r,height:s,top:n,left:t,right:t+r,bottom:n+s,x:t,y:n}}function li(){return typeof window<"u"}function af(e){return cf(e)?(e.nodeName||"").toLowerCase():"#document"}function Yn(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function lf(e){var t;return(t=(cf(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function cf(e){return li()?e instanceof Node||e instanceof Yn(e).Node:!1}function yw(e){return li()?e instanceof Element||e instanceof Yn(e).Element:!1}function El(e){return li()?e instanceof HTMLElement||e instanceof Yn(e).HTMLElement:!1}function df(e){return!li()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Yn(e).ShadowRoot}const vw=new Set(["inline","contents"]);function uf(e){const{overflow:t,overflowX:n,overflowY:r,display:s}=Ml(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!vw.has(s)}function xw(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const ww=new Set(["html","body","#document"]);function kw(e){return ww.has(af(e))}function Ml(e){return Yn(e).getComputedStyle(e)}function Cw(e){if(af(e)==="html")return e;const t=e.assignedSlot||e.parentNode||df(e)&&e.host||lf(e);return df(t)?t.host:t}function ff(e){const t=Cw(e);return kw(t)?e.ownerDocument?e.ownerDocument.body:e.body:El(t)&&uf(t)?t:ff(t)}function ci(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=ff(e),o=s===((r=e.ownerDocument)==null?void 0:r.body),i=Yn(s);if(o){const a=Nl(i);return t.concat(i,i.visualViewport||[],uf(s)?s:[],a&&n?ci(a):[])}return t.concat(s,ci(s,[],n))}function Nl(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Sw(e){const t=Ml(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const s=El(e),o=s?e.offsetWidth:n,i=s?e.offsetHeight:r,a=oi(n)!==o||oi(r)!==i;return a&&(n=o,r=i),{width:n,height:r,$:a}}function Ol(e){return yw(e)?e:e.contextElement}function hf(e){const t=Ol(e);if(!El(t))return ai(1);const n=t.getBoundingClientRect(),{width:r,height:s,$:o}=Sw(t);let i=(o?oi(n.width):n.width)/r,a=(o?oi(n.height):n.height)/s;return(!i||!Number.isFinite(i))&&(i=1),(!a||!Number.isFinite(a))&&(a=1),{x:i,y:a}}const _w=ai(0);function Ew(e){const t=Yn(e);return!xw()||!t.visualViewport?_w:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Mw(e,t,n){return!1}function gf(e,t,n,r){t===void 0&&(t=!1);const s=e.getBoundingClientRect(),o=Ol(e);let i=ai(1);t&&(i=hf(e));const a=Mw()?Ew(o):ai(0);let l=(s.left+a.x)/i.x,c=(s.top+a.y)/i.y,d=s.width/i.x,u=s.height/i.y;if(o){const f=Yn(o),g=r;let m=f,p=Nl(m);for(;p&&r&&g!==m;){const y=hf(p),b=p.getBoundingClientRect(),_=Ml(p),x=b.left+(p.clientLeft+parseFloat(_.paddingLeft))*y.x,E=b.top+(p.clientTop+parseFloat(_.paddingTop))*y.y;l*=y.x,c*=y.y,d*=y.x,u*=y.y,l+=x,c+=E,m=Yn(p),p=Nl(m)}}return bw({width:d,height:u,x:l,y:c})}function pf(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Nw(e,t){let n=null,r;const s=lf(e);function o(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function i(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),o();const c=e.getBoundingClientRect(),{left:d,top:u,width:f,height:g}=c;if(a||t(),!f||!g)return;const m=ii(u),p=ii(s.clientWidth-(d+f)),y=ii(s.clientHeight-(u+g)),b=ii(d),x={rootMargin:-m+"px "+-p+"px "+-y+"px "+-b+"px",threshold:mw(0,pw(1,l))||1};let E=!0;function S(w){const N=w[0].intersectionRatio;if(N!==l){if(!E)return i();N?i(!1,N):r=setTimeout(()=>{i(!1,1e-7)},1e3)}N===1&&!pf(c,e.getBoundingClientRect())&&i(),E=!1}try{n=new IntersectionObserver(S,{...x,root:s.ownerDocument})}catch{n=new IntersectionObserver(S,x)}n.observe(e)}return i(!0),o}function Ow(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:o=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,c=Ol(e),d=s||o?[...c?ci(c):[],...ci(t)]:[];d.forEach(b=>{s&&b.addEventListener("scroll",n,{passive:!0}),o&&b.addEventListener("resize",n)});const u=c&&a?Nw(c,n):null;let f=-1,g=null;i&&(g=new ResizeObserver(b=>{let[_]=b;_&&_.target===c&&g&&(g.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var x;(x=g)==null||x.observe(t)})),n()}),c&&!l&&g.observe(c),g.observe(t));let m,p=l?gf(e):null;l&&y();function y(){const b=gf(e);p&&!pf(p,b)&&n(),p=b,m=requestAnimationFrame(y)}return n(),()=>{var b;d.forEach(_=>{s&&_.removeEventListener("scroll",n),o&&_.removeEventListener("resize",n)}),u?.(),(b=g)==null||b.disconnect(),g=null,l&&cancelAnimationFrame(m)}}var Tl=v.useLayoutEffect,Tw=["className","clearValue","cx","getStyles","getClassNames","getValue","hasValue","isMulti","isRtl","options","selectOption","selectProps","setValue","theme"],di=function(){};function Aw(e,t){return t?t[0]==="-"?e+t:e+"__"+t:e}function Dw(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),s=2;s-1}function Iw(e){return fi(e)?window.innerHeight:e.clientHeight}function bf(e){return fi(e)?window.pageYOffset:e.scrollTop}function hi(e,t){if(fi(e)){window.scrollTo(0,t);return}e.scrollTop=t}function Lw(e){var t=getComputedStyle(e),n=t.position==="absolute",r=/(auto|scroll)/;if(t.position==="fixed")return document.documentElement;for(var s=e;s=s.parentElement;)if(t=getComputedStyle(s),!(n&&t.position==="static")&&r.test(t.overflow+t.overflowY+t.overflowX))return s;return document.documentElement}function Pw(e,t,n,r){return n*((e=e/r-1)*e*e+1)+t}function gi(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:200,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:di,s=bf(e),o=t-s,i=10,a=0;function l(){a+=i;var c=Pw(a,s,o,n);hi(e,c),an.bottom?hi(e,Math.min(t.offsetTop+t.clientHeight-e.offsetHeight+s,e.scrollHeight)):r.top-s1?n-1:0),s=1;s=m)return{placement:"bottom",maxHeight:t};if(k>=m&&!i)return o&&gi(l,M,L),{placement:"bottom",maxHeight:t};if(!i&&k>=r||i&&N>=r){o&&gi(l,M,L);var P=i?N-E:k-E;return{placement:"bottom",maxHeight:P}}if(s==="auto"||i){var F=t,D=i?w:C;return D>=r&&(F=Math.min(D-E-a,t)),{placement:"top",maxHeight:F}}if(s==="bottom")return o&&hi(l,M),{placement:"bottom",maxHeight:t};break;case"top":if(w>=m)return{placement:"top",maxHeight:t};if(C>=m&&!i)return o&&gi(l,T,L),{placement:"top",maxHeight:t};if(!i&&C>=r||i&&w>=r){var A=t;return(!i&&C>=r||i&&w>=r)&&(A=i?w-S:C-S),o&&gi(l,T,L),{placement:"top",maxHeight:A}}return{placement:"bottom",maxHeight:t};default:throw new Error('Invalid placement provided "'.concat(s,'".'))}return c}function Yw(e){var t={bottom:"top",top:"bottom"};return e?t[e]:"bottom"}var wf=function(t){return t==="auto"?"bottom":t},Kw=function(t,n){var r,s=t.placement,o=t.theme,i=o.borderRadius,a=o.spacing,l=o.colors;return Ee((r={label:"menu"},Ls(r,Yw(s),"100%"),Ls(r,"position","absolute"),Ls(r,"width","100%"),Ls(r,"zIndex",1),r),n?{}:{backgroundColor:l.neutral0,borderRadius:i,boxShadow:"0 0 0 1px hsla(0, 0%, 0%, 0.1), 0 4px 11px hsla(0, 0%, 0%, 0.1)",marginBottom:a.menuGutter,marginTop:a.menuGutter})},kf=v.createContext(null),Xw=function(t){var n=t.children,r=t.minMenuHeight,s=t.maxMenuHeight,o=t.menuPlacement,i=t.menuPosition,a=t.menuShouldScrollIntoView,l=t.theme,c=v.useContext(kf)||{},d=c.setPortalPlacement,u=v.useRef(null),f=v.useState(s),g=Gn(f,2),m=g[0],p=g[1],y=v.useState(null),b=Gn(y,2),_=b[0],x=b[1],E=l.spacing.controlHeight;return Tl(function(){var S=u.current;if(S){var w=i==="fixed",N=a&&!w,C=Gw({maxHeight:s,menuEl:S,minHeight:r,placement:o,shouldScroll:N,isFixedPosition:w,controlHeight:E});p(C.maxHeight),x(C.placement),d?.(C.placement)}},[s,o,i,a,r,d,E]),n({ref:u,placerProps:Ee(Ee({},t),{},{placement:_||wf(o),maxHeight:m})})},qw=function(t){var n=t.children,r=t.innerRef,s=t.innerProps;return _e("div",Ae({},vt(t,"menu",{menu:!0}),{ref:r},s),n)},Zw=qw,Qw=function(t,n){var r=t.maxHeight,s=t.theme.spacing.baseUnit;return Ee({maxHeight:r,overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},n?{}:{paddingBottom:s,paddingTop:s})},Jw=function(t){var n=t.children,r=t.innerProps,s=t.innerRef,o=t.isMulti;return _e("div",Ae({},vt(t,"menuList",{"menu-list":!0,"menu-list--is-multi":o}),{ref:s},r),n)},Cf=function(t,n){var r=t.theme,s=r.spacing.baseUnit,o=r.colors;return Ee({textAlign:"center"},n?{}:{color:o.neutral40,padding:"".concat(s*2,"px ").concat(s*3,"px")})},Rw=Cf,e1=Cf,t1=function(t){var n=t.children,r=n===void 0?"No options":n,s=t.innerProps,o=In(t,jw);return _e("div",Ae({},vt(Ee(Ee({},o),{},{children:r,innerProps:s}),"noOptionsMessage",{"menu-notice":!0,"menu-notice--no-options":!0}),s),r)},n1=function(t){var n=t.children,r=n===void 0?"Loading...":n,s=t.innerProps,o=In(t,Ww);return _e("div",Ae({},vt(Ee(Ee({},o),{},{children:r,innerProps:s}),"loadingMessage",{"menu-notice":!0,"menu-notice--loading":!0}),s),r)},r1=function(t){var n=t.rect,r=t.offset,s=t.position;return{left:n.left,position:s,top:r,width:n.width,zIndex:1}},s1=function(t){var n=t.appendTo,r=t.children,s=t.controlElement,o=t.innerProps,i=t.menuPlacement,a=t.menuPosition,l=v.useRef(null),c=v.useRef(null),d=v.useState(wf(i)),u=Gn(d,2),f=u[0],g=u[1],m=v.useMemo(function(){return{setPortalPlacement:g}},[]),p=v.useState(null),y=Gn(p,2),b=y[0],_=y[1],x=v.useCallback(function(){if(s){var N=$w(s),C=a==="fixed"?0:window.pageYOffset,k=N[f]+C;(k!==b?.offset||N.left!==b?.rect.left||N.width!==b?.rect.width)&&_({offset:k,rect:N})}},[s,a,f,b?.offset,b?.rect.left,b?.rect.width]);Tl(function(){x()},[x]);var E=v.useCallback(function(){typeof c.current=="function"&&(c.current(),c.current=null),s&&l.current&&(c.current=Ow(s,l.current,x,{elementResize:"ResizeObserver"in window}))},[s,x]);Tl(function(){E()},[E]);var S=v.useCallback(function(N){l.current=N,E()},[E]);if(!n&&a!=="fixed"||!b)return null;var w=_e("div",Ae({ref:S},vt(Ee(Ee({},t),{},{offset:b.offset,position:a,rect:b.rect}),"menuPortal",{"menu-portal":!0}),o),r);return _e(kf.Provider,{value:m},n?Dn.createPortal(w,n):w)},o1=function(t){var n=t.isDisabled,r=t.isRtl;return{label:"container",direction:r?"rtl":void 0,pointerEvents:n?"none":void 0,position:"relative"}},i1=function(t){var n=t.children,r=t.innerProps,s=t.isDisabled,o=t.isRtl;return _e("div",Ae({},vt(t,"container",{"--is-disabled":s,"--is-rtl":o}),r),n)},a1=function(t,n){var r=t.theme.spacing,s=t.isMulti,o=t.hasValue,i=t.selectProps.controlShouldRenderValue;return Ee({alignItems:"center",display:s&&o&&i?"flex":"grid",flex:1,flexWrap:"wrap",WebkitOverflowScrolling:"touch",position:"relative",overflow:"hidden"},n?{}:{padding:"".concat(r.baseUnit/2,"px ").concat(r.baseUnit*2,"px")})},l1=function(t){var n=t.children,r=t.innerProps,s=t.isMulti,o=t.hasValue;return _e("div",Ae({},vt(t,"valueContainer",{"value-container":!0,"value-container--is-multi":s,"value-container--has-value":o}),r),n)},c1=function(){return{alignItems:"center",alignSelf:"stretch",display:"flex",flexShrink:0}},d1=function(t){var n=t.children,r=t.innerProps;return _e("div",Ae({},vt(t,"indicatorsContainer",{indicators:!0}),r),n)},Sf,u1=["size"],f1=["innerProps","isRtl","size"],h1={name:"8mmkcg",styles:"display:inline-block;fill:currentColor;line-height:1;stroke:currentColor;stroke-width:0"},_f=function(t){var n=t.size,r=In(t,u1);return _e("svg",Ae({height:n,width:n,viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",css:h1},r))},Al=function(t){return _e(_f,Ae({size:20},t),_e("path",{d:"M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z"}))},Ef=function(t){return _e(_f,Ae({size:20},t),_e("path",{d:"M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z"}))},Mf=function(t,n){var r=t.isFocused,s=t.theme,o=s.spacing.baseUnit,i=s.colors;return Ee({label:"indicatorContainer",display:"flex",transition:"color 150ms"},n?{}:{color:r?i.neutral60:i.neutral20,padding:o*2,":hover":{color:r?i.neutral80:i.neutral40}})},g1=Mf,p1=function(t){var n=t.children,r=t.innerProps;return _e("div",Ae({},vt(t,"dropdownIndicator",{indicator:!0,"dropdown-indicator":!0}),r),n||_e(Ef,null))},m1=Mf,b1=function(t){var n=t.children,r=t.innerProps;return _e("div",Ae({},vt(t,"clearIndicator",{indicator:!0,"clear-indicator":!0}),r),n||_e(Al,null))},y1=function(t,n){var r=t.isDisabled,s=t.theme,o=s.spacing.baseUnit,i=s.colors;return Ee({label:"indicatorSeparator",alignSelf:"stretch",width:1},n?{}:{backgroundColor:r?i.neutral10:i.neutral20,marginBottom:o*2,marginTop:o*2})},v1=function(t){var n=t.innerProps;return _e("span",Ae({},n,vt(t,"indicatorSeparator",{"indicator-separator":!0})))},x1=hw(Sf||(Sf=gw([` + */var Af;function Zw(){if(Af)return it;Af=1;var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,r=e?Symbol.for("react.fragment"):60107,s=e?Symbol.for("react.strict_mode"):60108,o=e?Symbol.for("react.profiler"):60114,i=e?Symbol.for("react.provider"):60109,a=e?Symbol.for("react.context"):60110,l=e?Symbol.for("react.async_mode"):60111,c=e?Symbol.for("react.concurrent_mode"):60111,d=e?Symbol.for("react.forward_ref"):60112,u=e?Symbol.for("react.suspense"):60113,f=e?Symbol.for("react.suspense_list"):60120,g=e?Symbol.for("react.memo"):60115,m=e?Symbol.for("react.lazy"):60116,p=e?Symbol.for("react.block"):60121,y=e?Symbol.for("react.fundamental"):60117,b=e?Symbol.for("react.responder"):60118,_=e?Symbol.for("react.scope"):60119;function x(S){if(typeof S=="object"&&S!==null){var k=S.$$typeof;switch(k){case t:switch(S=S.type,S){case l:case c:case r:case o:case s:case u:return S;default:switch(S=S&&S.$$typeof,S){case a:case d:case m:case g:case i:return S;default:return k}}case n:return k}}}function M(S){return x(S)===c}return it.AsyncMode=l,it.ConcurrentMode=c,it.ContextConsumer=a,it.ContextProvider=i,it.Element=t,it.ForwardRef=d,it.Fragment=r,it.Lazy=m,it.Memo=g,it.Portal=n,it.Profiler=o,it.StrictMode=s,it.Suspense=u,it.isAsyncMode=function(S){return M(S)||x(S)===l},it.isConcurrentMode=M,it.isContextConsumer=function(S){return x(S)===a},it.isContextProvider=function(S){return x(S)===i},it.isElement=function(S){return typeof S=="object"&&S!==null&&S.$$typeof===t},it.isForwardRef=function(S){return x(S)===d},it.isFragment=function(S){return x(S)===r},it.isLazy=function(S){return x(S)===m},it.isMemo=function(S){return x(S)===g},it.isPortal=function(S){return x(S)===n},it.isProfiler=function(S){return x(S)===o},it.isStrictMode=function(S){return x(S)===s},it.isSuspense=function(S){return x(S)===u},it.isValidElementType=function(S){return typeof S=="string"||typeof S=="function"||S===r||S===c||S===o||S===s||S===u||S===f||typeof S=="object"&&S!==null&&(S.$$typeof===m||S.$$typeof===g||S.$$typeof===i||S.$$typeof===a||S.$$typeof===d||S.$$typeof===y||S.$$typeof===b||S.$$typeof===_||S.$$typeof===p)},it.typeOf=x,it}var Df;function Qw(){return Df||(Df=1,Bl.exports=Zw()),Bl.exports}var jl,If;function Jw(){if(If)return jl;If=1;var e=Qw(),t={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},n={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},r={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},s={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},o={};o[e.ForwardRef]=r,o[e.Memo]=s;function i(m){return e.isMemo(m)?s:o[m.$$typeof]||t}var a=Object.defineProperty,l=Object.getOwnPropertyNames,c=Object.getOwnPropertySymbols,d=Object.getOwnPropertyDescriptor,u=Object.getPrototypeOf,f=Object.prototype;function g(m,p,y){if(typeof p!="string"){if(f){var b=u(p);b&&b!==f&&g(m,b,y)}var _=l(p);c&&(_=_.concat(c(p)));for(var x=i(m),M=i(p),S=0;S<_.length;++S){var k=_[S];if(!n[k]&&!(y&&y[k])&&!(M&&M[k])&&!(x&&x[k])){var N=d(p,k);try{a(m,k,N)}catch{}}}}return m}return jl=g,jl}Jw();var Rw=!0;function e1(e,t,n){var r="";return n.split(" ").forEach(function(s){e[s]!==void 0?t.push(e[s]+";"):s&&(r+=s+" ")}),r}var Lf=function(t,n,r){var s=t.key+"-"+n.name;(r===!1||Rw===!1)&&t.registered[s]===void 0&&(t.registered[s]=n.styles)},t1=function(t,n,r){Lf(t,n,r);var s=t.key+"-"+n.name;if(t.inserted[n.name]===void 0){var o=n;do t.insert(n===o?"."+s:"",o,t.sheet,!0),o=o.next;while(o!==void 0)}};function n1(e){for(var t=0,n,r=0,s=e.length;s>=4;++r,s-=4)n=e.charCodeAt(r)&255|(e.charCodeAt(++r)&255)<<8|(e.charCodeAt(++r)&255)<<16|(e.charCodeAt(++r)&255)<<24,n=(n&65535)*1540483477+((n>>>16)*59797<<16),n^=n>>>24,t=(n&65535)*1540483477+((n>>>16)*59797<<16)^(t&65535)*1540483477+((t>>>16)*59797<<16);switch(s){case 3:t^=(e.charCodeAt(r+2)&255)<<16;case 2:t^=(e.charCodeAt(r+1)&255)<<8;case 1:t^=e.charCodeAt(r)&255,t=(t&65535)*1540483477+((t>>>16)*59797<<16)}return t^=t>>>13,t=(t&65535)*1540483477+((t>>>16)*59797<<16),((t^t>>>15)>>>0).toString(36)}var r1={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,scale:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},s1=/[A-Z]|^ms/g,o1=/_EMO_([^_]+?)_([^]*?)_EMO_/g,Pf=function(t){return t.charCodeAt(1)===45},$f=function(t){return t!=null&&typeof t!="boolean"},Wl=Uw(function(e){return Pf(e)?e:e.replace(s1,"-$&").toLowerCase()}),Ff=function(t,n){switch(t){case"animation":case"animationName":if(typeof n=="string")return n.replace(o1,function(r,s,o){return jn={name:s,styles:o,next:jn},s})}return r1[t]!==1&&!Pf(t)&&typeof n=="number"&&n!==0?n+"px":n};function eo(e,t,n){if(n==null)return"";var r=n;if(r.__emotion_styles!==void 0)return r;switch(typeof n){case"boolean":return"";case"object":{var s=n;if(s.anim===1)return jn={name:s.name,styles:s.styles,next:jn},s.name;var o=n;if(o.styles!==void 0){var i=o.next;if(i!==void 0)for(;i!==void 0;)jn={name:i.name,styles:i.styles,next:jn},i=i.next;var a=o.styles+";";return a}return i1(e,t,n)}case"function":{if(e!==void 0){var l=jn,c=n(e);return jn=l,eo(e,t,c)}break}}var d=n;return d}function i1(e,t,n){var r="";if(Array.isArray(n))for(var s=0;s({x:e,y:e});function x1(e){const{x:t,y:n,width:r,height:s}=e;return{width:r,height:s,top:n,left:t,right:t+r,bottom:n+s,x:t,y:n}}function Ci(){return typeof window<"u"}function Uf(e){return jf(e)?(e.nodeName||"").toLowerCase():"#document"}function er(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Bf(e){var t;return(t=(jf(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function jf(e){return Ci()?e instanceof Node||e instanceof er(e).Node:!1}function w1(e){return Ci()?e instanceof Element||e instanceof er(e).Element:!1}function Xl(e){return Ci()?e instanceof HTMLElement||e instanceof er(e).HTMLElement:!1}function Wf(e){return!Ci()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof er(e).ShadowRoot}const k1=new Set(["inline","contents"]);function Gf(e){const{overflow:t,overflowX:n,overflowY:r,display:s}=ql(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!k1.has(s)}function C1(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const S1=new Set(["html","body","#document"]);function _1(e){return S1.has(Uf(e))}function ql(e){return er(e).getComputedStyle(e)}function E1(e){if(Uf(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Wf(e)&&e.host||Bf(e);return Wf(t)?t.host:t}function Yf(e){const t=E1(e);return _1(t)?e.ownerDocument?e.ownerDocument.body:e.body:Xl(t)&&Gf(t)?t:Yf(t)}function Si(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=Yf(e),o=s===((r=e.ownerDocument)==null?void 0:r.body),i=er(s);if(o){const a=Zl(i);return t.concat(i,i.visualViewport||[],Gf(s)?s:[],a&&n?Si(a):[])}return t.concat(s,Si(s,[],n))}function Zl(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function M1(e){const t=ql(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const s=Xl(e),o=s?e.offsetWidth:n,i=s?e.offsetHeight:r,a=xi(n)!==o||xi(r)!==i;return a&&(n=o,r=i),{width:n,height:r,$:a}}function Ql(e){return w1(e)?e:e.contextElement}function Kf(e){const t=Ql(e);if(!Xl(t))return ki(1);const n=t.getBoundingClientRect(),{width:r,height:s,$:o}=M1(t);let i=(o?xi(n.width):n.width)/r,a=(o?xi(n.height):n.height)/s;return(!i||!Number.isFinite(i))&&(i=1),(!a||!Number.isFinite(a))&&(a=1),{x:i,y:a}}const N1=ki(0);function O1(e){const t=er(e);return!C1()||!t.visualViewport?N1:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function T1(e,t,n){return!1}function Xf(e,t,n,r){t===void 0&&(t=!1);const s=e.getBoundingClientRect(),o=Ql(e);let i=ki(1);t&&(i=Kf(e));const a=T1()?O1(o):ki(0);let l=(s.left+a.x)/i.x,c=(s.top+a.y)/i.y,d=s.width/i.x,u=s.height/i.y;if(o){const f=er(o),g=r;let m=f,p=Zl(m);for(;p&&r&&g!==m;){const y=Kf(p),b=p.getBoundingClientRect(),_=ql(p),x=b.left+(p.clientLeft+parseFloat(_.paddingLeft))*y.x,M=b.top+(p.clientTop+parseFloat(_.paddingTop))*y.y;l*=y.x,c*=y.y,d*=y.x,u*=y.y,l+=x,c+=M,m=er(p),p=Zl(m)}}return x1({width:d,height:u,x:l,y:c})}function qf(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function A1(e,t){let n=null,r;const s=Bf(e);function o(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function i(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),o();const c=e.getBoundingClientRect(),{left:d,top:u,width:f,height:g}=c;if(a||t(),!f||!g)return;const m=wi(u),p=wi(s.clientWidth-(d+f)),y=wi(s.clientHeight-(u+g)),b=wi(d),x={rootMargin:-m+"px "+-p+"px "+-y+"px "+-b+"px",threshold:v1(0,y1(1,l))||1};let M=!0;function S(k){const N=k[0].intersectionRatio;if(N!==l){if(!M)return i();N?i(!1,N):r=setTimeout(()=>{i(!1,1e-7)},1e3)}N===1&&!qf(c,e.getBoundingClientRect())&&i(),M=!1}try{n=new IntersectionObserver(S,{...x,root:s.ownerDocument})}catch{n=new IntersectionObserver(S,x)}n.observe(e)}return i(!0),o}function D1(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:o=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,c=Ql(e),d=s||o?[...c?Si(c):[],...Si(t)]:[];d.forEach(b=>{s&&b.addEventListener("scroll",n,{passive:!0}),o&&b.addEventListener("resize",n)});const u=c&&a?A1(c,n):null;let f=-1,g=null;i&&(g=new ResizeObserver(b=>{let[_]=b;_&&_.target===c&&g&&(g.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var x;(x=g)==null||x.observe(t)})),n()}),c&&!l&&g.observe(c),g.observe(t));let m,p=l?Xf(e):null;l&&y();function y(){const b=Xf(e);p&&!qf(p,b)&&n(),p=b,m=requestAnimationFrame(y)}return n(),()=>{var b;d.forEach(_=>{s&&_.removeEventListener("scroll",n),o&&_.removeEventListener("resize",n)}),u?.(),(b=g)==null||b.disconnect(),g=null,l&&cancelAnimationFrame(m)}}var Jl=v.useLayoutEffect,I1=["className","clearValue","cx","getStyles","getClassNames","getValue","hasValue","isMulti","isRtl","options","selectOption","selectProps","setValue","theme"],_i=function(){};function L1(e,t){return t?t[0]==="-"?e+t:e+"__"+t:e}function P1(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),s=2;s-1}function $1(e){return Mi(e)?window.innerHeight:e.clientHeight}function Qf(e){return Mi(e)?window.pageYOffset:e.scrollTop}function Ni(e,t){if(Mi(e)){window.scrollTo(0,t);return}e.scrollTop=t}function F1(e){var t=getComputedStyle(e),n=t.position==="absolute",r=/(auto|scroll)/;if(t.position==="fixed")return document.documentElement;for(var s=e;s=s.parentElement;)if(t=getComputedStyle(s),!(n&&t.position==="static")&&r.test(t.overflow+t.overflowY+t.overflowX))return s;return document.documentElement}function z1(e,t,n,r){return n*((e=e/r-1)*e*e+1)+t}function Oi(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:200,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:_i,s=Qf(e),o=t-s,i=10,a=0;function l(){a+=i;var c=z1(a,s,o,n);Ni(e,c),an.bottom?Ni(e,Math.min(t.offsetTop+t.clientHeight-e.offsetHeight+s,e.scrollHeight)):r.top-s1?n-1:0),s=1;s=m)return{placement:"bottom",maxHeight:t};if(w>=m&&!i)return o&&Oi(l,E,P),{placement:"bottom",maxHeight:t};if(!i&&w>=r||i&&N>=r){o&&Oi(l,E,P);var L=i?N-M:w-M;return{placement:"bottom",maxHeight:L}}if(s==="auto"||i){var F=t,A=i?k:C;return A>=r&&(F=Math.min(A-M-a,t)),{placement:"top",maxHeight:F}}if(s==="bottom")return o&&Ni(l,E),{placement:"bottom",maxHeight:t};break;case"top":if(k>=m)return{placement:"top",maxHeight:t};if(C>=m&&!i)return o&&Oi(l,T,P),{placement:"top",maxHeight:t};if(!i&&C>=r||i&&k>=r){var D=t;return(!i&&C>=r||i&&k>=r)&&(D=i?k-S:C-S),o&&Oi(l,T,P),{placement:"top",maxHeight:D}}return{placement:"bottom",maxHeight:t};default:throw new Error('Invalid placement provided "'.concat(s,'".'))}return c}function q1(e){var t={bottom:"top",top:"bottom"};return e?t[e]:"bottom"}var th=function(t){return t==="auto"?"bottom":t},Z1=function(t,n){var r,s=t.placement,o=t.theme,i=o.borderRadius,a=o.spacing,l=o.colors;return Me((r={label:"menu"},qs(r,q1(s),"100%"),qs(r,"position","absolute"),qs(r,"width","100%"),qs(r,"zIndex",1),r),n?{}:{backgroundColor:l.neutral0,borderRadius:i,boxShadow:"0 0 0 1px hsla(0, 0%, 0%, 0.1), 0 4px 11px hsla(0, 0%, 0%, 0.1)",marginBottom:a.menuGutter,marginTop:a.menuGutter})},nh=v.createContext(null),Q1=function(t){var n=t.children,r=t.minMenuHeight,s=t.maxMenuHeight,o=t.menuPlacement,i=t.menuPosition,a=t.menuShouldScrollIntoView,l=t.theme,c=v.useContext(nh)||{},d=c.setPortalPlacement,u=v.useRef(null),f=v.useState(s),g=Rn(f,2),m=g[0],p=g[1],y=v.useState(null),b=Rn(y,2),_=b[0],x=b[1],M=l.spacing.controlHeight;return Jl(function(){var S=u.current;if(S){var k=i==="fixed",N=a&&!k,C=X1({maxHeight:s,menuEl:S,minHeight:r,placement:o,shouldScroll:N,isFixedPosition:k,controlHeight:M});p(C.maxHeight),x(C.placement),d?.(C.placement)}},[s,o,i,a,r,d,M]),n({ref:u,placerProps:Me(Me({},t),{},{placement:_||th(o),maxHeight:m})})},J1=function(t){var n=t.children,r=t.innerRef,s=t.innerProps;return Ee("div",De({},Ct(t,"menu",{menu:!0}),{ref:r},s),n)},R1=J1,ek=function(t,n){var r=t.maxHeight,s=t.theme.spacing.baseUnit;return Me({maxHeight:r,overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},n?{}:{paddingBottom:s,paddingTop:s})},tk=function(t){var n=t.children,r=t.innerProps,s=t.innerRef,o=t.isMulti;return Ee("div",De({},Ct(t,"menuList",{"menu-list":!0,"menu-list--is-multi":o}),{ref:s},r),n)},rh=function(t,n){var r=t.theme,s=r.spacing.baseUnit,o=r.colors;return Me({textAlign:"center"},n?{}:{color:o.neutral40,padding:"".concat(s*2,"px ").concat(s*3,"px")})},nk=rh,rk=rh,sk=function(t){var n=t.children,r=n===void 0?"No options":n,s=t.innerProps,o=Hn(t,Y1);return Ee("div",De({},Ct(Me(Me({},o),{},{children:r,innerProps:s}),"noOptionsMessage",{"menu-notice":!0,"menu-notice--no-options":!0}),s),r)},ok=function(t){var n=t.children,r=n===void 0?"Loading...":n,s=t.innerProps,o=Hn(t,K1);return Ee("div",De({},Ct(Me(Me({},o),{},{children:r,innerProps:s}),"loadingMessage",{"menu-notice":!0,"menu-notice--loading":!0}),s),r)},ik=function(t){var n=t.rect,r=t.offset,s=t.position;return{left:n.left,position:s,top:r,width:n.width,zIndex:1}},ak=function(t){var n=t.appendTo,r=t.children,s=t.controlElement,o=t.innerProps,i=t.menuPlacement,a=t.menuPosition,l=v.useRef(null),c=v.useRef(null),d=v.useState(th(i)),u=Rn(d,2),f=u[0],g=u[1],m=v.useMemo(function(){return{setPortalPlacement:g}},[]),p=v.useState(null),y=Rn(p,2),b=y[0],_=y[1],x=v.useCallback(function(){if(s){var N=V1(s),C=a==="fixed"?0:window.pageYOffset,w=N[f]+C;(w!==b?.offset||N.left!==b?.rect.left||N.width!==b?.rect.width)&&_({offset:w,rect:N})}},[s,a,f,b?.offset,b?.rect.left,b?.rect.width]);Jl(function(){x()},[x]);var M=v.useCallback(function(){typeof c.current=="function"&&(c.current(),c.current=null),s&&l.current&&(c.current=D1(s,l.current,x,{elementResize:"ResizeObserver"in window}))},[s,x]);Jl(function(){M()},[M]);var S=v.useCallback(function(N){l.current=N,M()},[M]);if(!n&&a!=="fixed"||!b)return null;var k=Ee("div",De({ref:S},Ct(Me(Me({},t),{},{offset:b.offset,position:a,rect:b.rect}),"menuPortal",{"menu-portal":!0}),o),r);return Ee(nh.Provider,{value:m},n?Vn.createPortal(k,n):k)},lk=function(t){var n=t.isDisabled,r=t.isRtl;return{label:"container",direction:r?"rtl":void 0,pointerEvents:n?"none":void 0,position:"relative"}},ck=function(t){var n=t.children,r=t.innerProps,s=t.isDisabled,o=t.isRtl;return Ee("div",De({},Ct(t,"container",{"--is-disabled":s,"--is-rtl":o}),r),n)},dk=function(t,n){var r=t.theme.spacing,s=t.isMulti,o=t.hasValue,i=t.selectProps.controlShouldRenderValue;return Me({alignItems:"center",display:s&&o&&i?"flex":"grid",flex:1,flexWrap:"wrap",WebkitOverflowScrolling:"touch",position:"relative",overflow:"hidden"},n?{}:{padding:"".concat(r.baseUnit/2,"px ").concat(r.baseUnit*2,"px")})},uk=function(t){var n=t.children,r=t.innerProps,s=t.isMulti,o=t.hasValue;return Ee("div",De({},Ct(t,"valueContainer",{"value-container":!0,"value-container--is-multi":s,"value-container--has-value":o}),r),n)},fk=function(){return{alignItems:"center",alignSelf:"stretch",display:"flex",flexShrink:0}},hk=function(t){var n=t.children,r=t.innerProps;return Ee("div",De({},Ct(t,"indicatorsContainer",{indicators:!0}),r),n)},sh,gk=["size"],pk=["innerProps","isRtl","size"],mk={name:"8mmkcg",styles:"display:inline-block;fill:currentColor;line-height:1;stroke:currentColor;stroke-width:0"},oh=function(t){var n=t.size,r=Hn(t,gk);return Ee("svg",De({height:n,width:n,viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",css:mk},r))},Rl=function(t){return Ee(oh,De({size:20},t),Ee("path",{d:"M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z"}))},ih=function(t){return Ee(oh,De({size:20},t),Ee("path",{d:"M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z"}))},ah=function(t,n){var r=t.isFocused,s=t.theme,o=s.spacing.baseUnit,i=s.colors;return Me({label:"indicatorContainer",display:"flex",transition:"color 150ms"},n?{}:{color:r?i.neutral60:i.neutral20,padding:o*2,":hover":{color:r?i.neutral80:i.neutral40}})},bk=ah,yk=function(t){var n=t.children,r=t.innerProps;return Ee("div",De({},Ct(t,"dropdownIndicator",{indicator:!0,"dropdown-indicator":!0}),r),n||Ee(ih,null))},vk=ah,xk=function(t){var n=t.children,r=t.innerProps;return Ee("div",De({},Ct(t,"clearIndicator",{indicator:!0,"clear-indicator":!0}),r),n||Ee(Rl,null))},wk=function(t,n){var r=t.isDisabled,s=t.theme,o=s.spacing.baseUnit,i=s.colors;return Me({label:"indicatorSeparator",alignSelf:"stretch",width:1},n?{}:{backgroundColor:r?i.neutral10:i.neutral20,marginBottom:o*2,marginTop:o*2})},kk=function(t){var n=t.innerProps;return Ee("span",De({},n,Ct(t,"indicatorSeparator",{"indicator-separator":!0})))},Ck=m1(sh||(sh=b1([` 0%, 80%, 100% { opacity: 0; } 40% { opacity: 1; } -`]))),w1=function(t,n){var r=t.isFocused,s=t.size,o=t.theme,i=o.colors,a=o.spacing.baseUnit;return Ee({label:"loadingIndicator",display:"flex",transition:"color 150ms",alignSelf:"center",fontSize:s,lineHeight:1,marginRight:s,textAlign:"center",verticalAlign:"middle"},n?{}:{color:r?i.neutral60:i.neutral20,padding:a*2})},Dl=function(t){var n=t.delay,r=t.offset;return _e("span",{css:_l({animation:"".concat(x1," 1s ease-in-out ").concat(n,"ms infinite;"),backgroundColor:"currentColor",borderRadius:"1em",display:"inline-block",marginLeft:r?"1em":void 0,height:"1em",verticalAlign:"top",width:"1em"},"","")})},k1=function(t){var n=t.innerProps,r=t.isRtl,s=t.size,o=s===void 0?4:s,i=In(t,f1);return _e("div",Ae({},vt(Ee(Ee({},i),{},{innerProps:n,isRtl:r,size:o}),"loadingIndicator",{indicator:!0,"loading-indicator":!0}),n),_e(Dl,{delay:0,offset:r}),_e(Dl,{delay:160,offset:!0}),_e(Dl,{delay:320,offset:!r}))},C1=function(t,n){var r=t.isDisabled,s=t.isFocused,o=t.theme,i=o.colors,a=o.borderRadius,l=o.spacing;return Ee({label:"control",alignItems:"center",cursor:"default",display:"flex",flexWrap:"wrap",justifyContent:"space-between",minHeight:l.controlHeight,outline:"0 !important",position:"relative",transition:"all 100ms"},n?{}:{backgroundColor:r?i.neutral5:i.neutral0,borderColor:r?i.neutral10:s?i.primary:i.neutral20,borderRadius:a,borderStyle:"solid",borderWidth:1,boxShadow:s?"0 0 0 1px ".concat(i.primary):void 0,"&:hover":{borderColor:s?i.primary:i.neutral30}})},S1=function(t){var n=t.children,r=t.isDisabled,s=t.isFocused,o=t.innerRef,i=t.innerProps,a=t.menuIsOpen;return _e("div",Ae({ref:o},vt(t,"control",{control:!0,"control--is-disabled":r,"control--is-focused":s,"control--menu-is-open":a}),i,{"aria-disabled":r||void 0}),n)},_1=S1,E1=["data"],M1=function(t,n){var r=t.theme.spacing;return n?{}:{paddingBottom:r.baseUnit*2,paddingTop:r.baseUnit*2}},N1=function(t){var n=t.children,r=t.cx,s=t.getStyles,o=t.getClassNames,i=t.Heading,a=t.headingProps,l=t.innerProps,c=t.label,d=t.theme,u=t.selectProps;return _e("div",Ae({},vt(t,"group",{group:!0}),l),_e(i,Ae({},a,{selectProps:u,theme:d,getStyles:s,getClassNames:o,cx:r}),c),_e("div",null,n))},O1=function(t,n){var r=t.theme,s=r.colors,o=r.spacing;return Ee({label:"group",cursor:"default",display:"block"},n?{}:{color:s.neutral40,fontSize:"75%",fontWeight:500,marginBottom:"0.25em",paddingLeft:o.baseUnit*3,paddingRight:o.baseUnit*3,textTransform:"uppercase"})},T1=function(t){var n=mf(t);n.data;var r=In(n,E1);return _e("div",Ae({},vt(t,"groupHeading",{"group-heading":!0}),r))},A1=N1,D1=["innerRef","isDisabled","isHidden","inputClassName"],I1=function(t,n){var r=t.isDisabled,s=t.value,o=t.theme,i=o.spacing,a=o.colors;return Ee(Ee({visibility:r?"hidden":"visible",transform:s?"translateZ(0)":""},L1),n?{}:{margin:i.baseUnit/2,paddingBottom:i.baseUnit/2,paddingTop:i.baseUnit/2,color:a.neutral80})},Nf={gridArea:"1 / 2",font:"inherit",minWidth:"2px",border:0,margin:0,outline:0,padding:0},L1={flex:"1 1 auto",display:"inline-grid",gridArea:"1 / 1 / 2 / 3",gridTemplateColumns:"0 min-content","&:after":Ee({content:'attr(data-value) " "',visibility:"hidden",whiteSpace:"pre"},Nf)},P1=function(t){return Ee({label:"input",color:"inherit",background:0,opacity:t?0:1,width:"100%"},Nf)},$1=function(t){var n=t.cx,r=t.value,s=mf(t),o=s.innerRef,i=s.isDisabled,a=s.isHidden,l=s.inputClassName,c=In(s,D1);return _e("div",Ae({},vt(t,"input",{"input-container":!0}),{"data-value":r||""}),_e("input",Ae({className:n({input:!0},l),ref:o,style:P1(a),disabled:i},c)))},F1=$1,V1=function(t,n){var r=t.theme,s=r.spacing,o=r.borderRadius,i=r.colors;return Ee({label:"multiValue",display:"flex",minWidth:0},n?{}:{backgroundColor:i.neutral10,borderRadius:o/2,margin:s.baseUnit/2})},z1=function(t,n){var r=t.theme,s=r.borderRadius,o=r.colors,i=t.cropWithEllipsis;return Ee({overflow:"hidden",textOverflow:i||i===void 0?"ellipsis":void 0,whiteSpace:"nowrap"},n?{}:{borderRadius:s/2,color:o.neutral80,fontSize:"85%",padding:3,paddingLeft:6})},H1=function(t,n){var r=t.theme,s=r.spacing,o=r.borderRadius,i=r.colors,a=t.isFocused;return Ee({alignItems:"center",display:"flex"},n?{}:{borderRadius:o/2,backgroundColor:a?i.dangerLight:void 0,paddingLeft:s.baseUnit,paddingRight:s.baseUnit,":hover":{backgroundColor:i.dangerLight,color:i.danger}})},Of=function(t){var n=t.children,r=t.innerProps;return _e("div",r,n)},U1=Of,B1=Of;function j1(e){var t=e.children,n=e.innerProps;return _e("div",Ae({role:"button"},n),t||_e(Al,{size:14}))}var W1=function(t){var n=t.children,r=t.components,s=t.data,o=t.innerProps,i=t.isDisabled,a=t.removeProps,l=t.selectProps,c=r.Container,d=r.Label,u=r.Remove;return _e(c,{data:s,innerProps:Ee(Ee({},vt(t,"multiValue",{"multi-value":!0,"multi-value--is-disabled":i})),o),selectProps:l},_e(d,{data:s,innerProps:Ee({},vt(t,"multiValueLabel",{"multi-value__label":!0})),selectProps:l},n),_e(u,{data:s,innerProps:Ee(Ee({},vt(t,"multiValueRemove",{"multi-value__remove":!0})),{},{"aria-label":"Remove ".concat(n||"option")},a),selectProps:l}))},G1=W1,Y1=function(t,n){var r=t.isDisabled,s=t.isFocused,o=t.isSelected,i=t.theme,a=i.spacing,l=i.colors;return Ee({label:"option",cursor:"default",display:"block",fontSize:"inherit",width:"100%",userSelect:"none",WebkitTapHighlightColor:"rgba(0, 0, 0, 0)"},n?{}:{backgroundColor:o?l.primary:s?l.primary25:"transparent",color:r?l.neutral20:o?l.neutral0:"inherit",padding:"".concat(a.baseUnit*2,"px ").concat(a.baseUnit*3,"px"),":active":{backgroundColor:r?void 0:o?l.primary:l.primary50}})},K1=function(t){var n=t.children,r=t.isDisabled,s=t.isFocused,o=t.isSelected,i=t.innerRef,a=t.innerProps;return _e("div",Ae({},vt(t,"option",{option:!0,"option--is-disabled":r,"option--is-focused":s,"option--is-selected":o}),{ref:i,"aria-disabled":r},a),n)},X1=K1,q1=function(t,n){var r=t.theme,s=r.spacing,o=r.colors;return Ee({label:"placeholder",gridArea:"1 / 1 / 2 / 3"},n?{}:{color:o.neutral50,marginLeft:s.baseUnit/2,marginRight:s.baseUnit/2})},Z1=function(t){var n=t.children,r=t.innerProps;return _e("div",Ae({},vt(t,"placeholder",{placeholder:!0}),r),n)},Q1=Z1,J1=function(t,n){var r=t.isDisabled,s=t.theme,o=s.spacing,i=s.colors;return Ee({label:"singleValue",gridArea:"1 / 1 / 2 / 3",maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},n?{}:{color:r?i.neutral40:i.neutral80,marginLeft:o.baseUnit/2,marginRight:o.baseUnit/2})},R1=function(t){var n=t.children,r=t.isDisabled,s=t.innerProps;return _e("div",Ae({},vt(t,"singleValue",{"single-value":!0,"single-value--is-disabled":r}),s),n)},ek=R1,mi={ClearIndicator:b1,Control:_1,DropdownIndicator:p1,DownChevron:Ef,CrossIcon:Al,Group:A1,GroupHeading:T1,IndicatorsContainer:d1,IndicatorSeparator:v1,Input:F1,LoadingIndicator:k1,Menu:Zw,MenuList:Jw,MenuPortal:s1,LoadingMessage:n1,NoOptionsMessage:t1,MultiValue:G1,MultiValueContainer:U1,MultiValueLabel:B1,MultiValueRemove:j1,Option:X1,Placeholder:Q1,SelectContainer:i1,SingleValue:ek,ValueContainer:l1},tk=function(t){return Ee(Ee({},mi),t.components)},Tf=Number.isNaN||function(t){return typeof t=="number"&&t!==t};function nk(e,t){return!!(e===t||Tf(e)&&Tf(t))}function rk(e,t){if(e.length!==t.length)return!1;for(var n=0;n1?"s":""," ").concat(o.join(","),", selected.");case"select-option":return i?"option ".concat(s," is disabled. Select another option."):"option ".concat(s,", selected.");default:return""}},onFocus:function(t){var n=t.context,r=t.focused,s=t.options,o=t.label,i=o===void 0?"":o,a=t.selectValue,l=t.isDisabled,c=t.isSelected,d=t.isAppleDevice,u=function(p,y){return p&&p.length?"".concat(p.indexOf(y)+1," of ").concat(p.length):""};if(n==="value"&&a)return"value ".concat(i," focused, ").concat(u(a,r),".");if(n==="menu"&&d){var f=l?" disabled":"",g="".concat(c?" selected":"").concat(f);return"".concat(i).concat(g,", ").concat(u(s,r),".")}return""},onFilter:function(t){var n=t.inputValue,r=t.resultsMessage;return"".concat(r).concat(n?" for search term "+n:"",".")}},lk=function(t){var n=t.ariaSelection,r=t.focusedOption,s=t.focusedValue,o=t.focusableOptions,i=t.isFocused,a=t.selectValue,l=t.selectProps,c=t.id,d=t.isAppleDevice,u=l.ariaLiveMessages,f=l.getOptionLabel,g=l.inputValue,m=l.isMulti,p=l.isOptionDisabled,y=l.isSearchable,b=l.menuIsOpen,_=l.options,x=l.screenReaderStatus,E=l.tabSelectsValue,S=l.isLoading,w=l["aria-label"],N=l["aria-live"],C=v.useMemo(function(){return Ee(Ee({},ak),u||{})},[u]),k=v.useMemo(function(){var D="";if(n&&C.onChange){var A=n.option,O=n.options,V=n.removedValue,H=n.removedValues,W=n.value,j=function(Z){return Array.isArray(Z)?null:Z},U=V||A||j(W),B=U?f(U):"",G=O||H||void 0,z=G?G.map(f):[],K=Ee({isDisabled:U&&p(U,a),label:B,labels:z},n);D=C.onChange(K)}return D},[n,C,p,a,f]),M=v.useMemo(function(){var D="",A=r||s,O=!!(r&&a&&a.includes(r));if(A&&C.onFocus){var V={focused:A,label:f(A),isDisabled:p(A,a),isSelected:O,options:o,context:A===r?"menu":"value",selectValue:a,isAppleDevice:d};D=C.onFocus(V)}return D},[r,s,f,p,C,o,a,d]),T=v.useMemo(function(){var D="";if(b&&_.length&&!S&&C.onFilter){var A=x({count:o.length});D=C.onFilter({inputValue:g,resultsMessage:A})}return D},[o,g,b,C,_,x,S]),L=n?.action==="initial-input-focus",P=v.useMemo(function(){var D="";if(C.guidance){var A=s?"value":b?"menu":"input";D=C.guidance({"aria-label":w,context:A,isDisabled:r&&p(r,a),isMulti:m,isSearchable:y,tabSelectsValue:E,isInitialFocus:L})}return D},[w,r,s,m,p,y,b,C,a,E,L]),F=_e(v.Fragment,null,_e("span",{id:"aria-selection"},k),_e("span",{id:"aria-focused"},M),_e("span",{id:"aria-results"},T),_e("span",{id:"aria-guidance"},P));return _e(v.Fragment,null,_e(Af,{id:c},L&&F),_e(Af,{"aria-live":N,"aria-atomic":"false","aria-relevant":"additions text",role:"log"},i&&!L&&F))},ck=lk,Il=[{base:"A",letters:"AⒶAÀÁÂẦẤẪẨÃĀĂẰẮẴẲȦǠÄǞẢÅǺǍȀȂẠẬẶḀĄȺⱯ"},{base:"AA",letters:"Ꜳ"},{base:"AE",letters:"ÆǼǢ"},{base:"AO",letters:"Ꜵ"},{base:"AU",letters:"Ꜷ"},{base:"AV",letters:"ꜸꜺ"},{base:"AY",letters:"Ꜽ"},{base:"B",letters:"BⒷBḂḄḆɃƂƁ"},{base:"C",letters:"CⒸCĆĈĊČÇḈƇȻꜾ"},{base:"D",letters:"DⒹDḊĎḌḐḒḎĐƋƊƉꝹ"},{base:"DZ",letters:"DZDŽ"},{base:"Dz",letters:"DzDž"},{base:"E",letters:"EⒺEÈÉÊỀẾỄỂẼĒḔḖĔĖËẺĚȄȆẸỆȨḜĘḘḚƐƎ"},{base:"F",letters:"FⒻFḞƑꝻ"},{base:"G",letters:"GⒼGǴĜḠĞĠǦĢǤƓꞠꝽꝾ"},{base:"H",letters:"HⒽHĤḢḦȞḤḨḪĦⱧⱵꞍ"},{base:"I",letters:"IⒾIÌÍÎĨĪĬİÏḮỈǏȈȊỊĮḬƗ"},{base:"J",letters:"JⒿJĴɈ"},{base:"K",letters:"KⓀKḰǨḲĶḴƘⱩꝀꝂꝄꞢ"},{base:"L",letters:"LⓁLĿĹĽḶḸĻḼḺŁȽⱢⱠꝈꝆꞀ"},{base:"LJ",letters:"LJ"},{base:"Lj",letters:"Lj"},{base:"M",letters:"MⓂMḾṀṂⱮƜ"},{base:"N",letters:"NⓃNǸŃÑṄŇṆŅṊṈȠƝꞐꞤ"},{base:"NJ",letters:"NJ"},{base:"Nj",letters:"Nj"},{base:"O",letters:"OⓄOÒÓÔỒỐỖỔÕṌȬṎŌṐṒŎȮȰÖȪỎŐǑȌȎƠỜỚỠỞỢỌỘǪǬØǾƆƟꝊꝌ"},{base:"OI",letters:"Ƣ"},{base:"OO",letters:"Ꝏ"},{base:"OU",letters:"Ȣ"},{base:"P",letters:"PⓅPṔṖƤⱣꝐꝒꝔ"},{base:"Q",letters:"QⓆQꝖꝘɊ"},{base:"R",letters:"RⓇRŔṘŘȐȒṚṜŖṞɌⱤꝚꞦꞂ"},{base:"S",letters:"SⓈSẞŚṤŜṠŠṦṢṨȘŞⱾꞨꞄ"},{base:"T",letters:"TⓉTṪŤṬȚŢṰṮŦƬƮȾꞆ"},{base:"TZ",letters:"Ꜩ"},{base:"U",letters:"UⓊUÙÚÛŨṸŪṺŬÜǛǗǕǙỦŮŰǓȔȖƯỪỨỮỬỰỤṲŲṶṴɄ"},{base:"V",letters:"VⓋVṼṾƲꝞɅ"},{base:"VY",letters:"Ꝡ"},{base:"W",letters:"WⓌWẀẂŴẆẄẈⱲ"},{base:"X",letters:"XⓍXẊẌ"},{base:"Y",letters:"YⓎYỲÝŶỸȲẎŸỶỴƳɎỾ"},{base:"Z",letters:"ZⓏZŹẐŻŽẒẔƵȤⱿⱫꝢ"},{base:"a",letters:"aⓐaẚàáâầấẫẩãāăằắẵẳȧǡäǟảåǻǎȁȃạậặḁąⱥɐ"},{base:"aa",letters:"ꜳ"},{base:"ae",letters:"æǽǣ"},{base:"ao",letters:"ꜵ"},{base:"au",letters:"ꜷ"},{base:"av",letters:"ꜹꜻ"},{base:"ay",letters:"ꜽ"},{base:"b",letters:"bⓑbḃḅḇƀƃɓ"},{base:"c",letters:"cⓒcćĉċčçḉƈȼꜿↄ"},{base:"d",letters:"dⓓdḋďḍḑḓḏđƌɖɗꝺ"},{base:"dz",letters:"dzdž"},{base:"e",letters:"eⓔeèéêềếễểẽēḕḗĕėëẻěȅȇẹệȩḝęḙḛɇɛǝ"},{base:"f",letters:"fⓕfḟƒꝼ"},{base:"g",letters:"gⓖgǵĝḡğġǧģǥɠꞡᵹꝿ"},{base:"h",letters:"hⓗhĥḣḧȟḥḩḫẖħⱨⱶɥ"},{base:"hv",letters:"ƕ"},{base:"i",letters:"iⓘiìíîĩīĭïḯỉǐȉȋịįḭɨı"},{base:"j",letters:"jⓙjĵǰɉ"},{base:"k",letters:"kⓚkḱǩḳķḵƙⱪꝁꝃꝅꞣ"},{base:"l",letters:"lⓛlŀĺľḷḹļḽḻſłƚɫⱡꝉꞁꝇ"},{base:"lj",letters:"lj"},{base:"m",letters:"mⓜmḿṁṃɱɯ"},{base:"n",letters:"nⓝnǹńñṅňṇņṋṉƞɲʼnꞑꞥ"},{base:"nj",letters:"nj"},{base:"o",letters:"oⓞoòóôồốỗổõṍȭṏōṑṓŏȯȱöȫỏőǒȍȏơờớỡởợọộǫǭøǿɔꝋꝍɵ"},{base:"oi",letters:"ƣ"},{base:"ou",letters:"ȣ"},{base:"oo",letters:"ꝏ"},{base:"p",letters:"pⓟpṕṗƥᵽꝑꝓꝕ"},{base:"q",letters:"qⓠqɋꝗꝙ"},{base:"r",letters:"rⓡrŕṙřȑȓṛṝŗṟɍɽꝛꞧꞃ"},{base:"s",letters:"sⓢsßśṥŝṡšṧṣṩșşȿꞩꞅẛ"},{base:"t",letters:"tⓣtṫẗťṭțţṱṯŧƭʈⱦꞇ"},{base:"tz",letters:"ꜩ"},{base:"u",letters:"uⓤuùúûũṹūṻŭüǜǘǖǚủůűǔȕȗưừứữửựụṳųṷṵʉ"},{base:"v",letters:"vⓥvṽṿʋꝟʌ"},{base:"vy",letters:"ꝡ"},{base:"w",letters:"wⓦwẁẃŵẇẅẘẉⱳ"},{base:"x",letters:"xⓧxẋẍ"},{base:"y",letters:"yⓨyỳýŷỹȳẏÿỷẙỵƴɏỿ"},{base:"z",letters:"zⓩzźẑżžẓẕƶȥɀⱬꝣ"}],dk=new RegExp("["+Il.map(function(e){return e.letters}).join("")+"]","g"),Df={},Ll=0;Ll-1}},gk=["innerRef"];function pk(e){var t=e.innerRef,n=In(e,gk),r=Bw(n,"onExited","in","enter","exit","appear");return _e("input",Ae({ref:t},r,{css:_l({label:"dummyInput",background:0,border:0,caretColor:"transparent",fontSize:"inherit",gridArea:"1 / 1 / 2 / 3",outline:0,padding:0,width:1,color:"transparent",left:-100,opacity:0,position:"relative",transform:"scale(.01)"},"","")}))}var mk=function(t){t.cancelable&&t.preventDefault(),t.stopPropagation()};function bk(e){var t=e.isEnabled,n=e.onBottomArrive,r=e.onBottomLeave,s=e.onTopArrive,o=e.onTopLeave,i=v.useRef(!1),a=v.useRef(!1),l=v.useRef(0),c=v.useRef(null),d=v.useCallback(function(y,b){if(c.current!==null){var _=c.current,x=_.scrollTop,E=_.scrollHeight,S=_.clientHeight,w=c.current,N=b>0,C=E-S-x,k=!1;C>b&&i.current&&(r&&r(y),i.current=!1),N&&a.current&&(o&&o(y),a.current=!1),N&&b>C?(n&&!i.current&&n(y),w.scrollTop=E,k=!0,i.current=!0):!N&&-b>x&&(s&&!a.current&&s(y),w.scrollTop=0,k=!0,a.current=!0),k&&mk(y)}},[n,r,s,o]),u=v.useCallback(function(y){d(y,y.deltaY)},[d]),f=v.useCallback(function(y){l.current=y.changedTouches[0].clientY},[]),g=v.useCallback(function(y){var b=l.current-y.changedTouches[0].clientY;d(y,b)},[d]),m=v.useCallback(function(y){if(y){var b=zw?{passive:!1}:!1;y.addEventListener("wheel",u,b),y.addEventListener("touchstart",f,b),y.addEventListener("touchmove",g,b)}},[g,f,u]),p=v.useCallback(function(y){y&&(y.removeEventListener("wheel",u,!1),y.removeEventListener("touchstart",f,!1),y.removeEventListener("touchmove",g,!1))},[g,f,u]);return v.useEffect(function(){if(t){var y=c.current;return m(y),function(){p(y)}}},[t,m,p]),function(y){c.current=y}}var Pf=["boxSizing","height","overflow","paddingRight","position"],$f={boxSizing:"border-box",overflow:"hidden",position:"relative",height:"100%"};function Ff(e){e.cancelable&&e.preventDefault()}function Vf(e){e.stopPropagation()}function zf(){var e=this.scrollTop,t=this.scrollHeight,n=e+this.offsetHeight;e===0?this.scrollTop=1:n===t&&(this.scrollTop=e-1)}function Hf(){return"ontouchstart"in window||navigator.maxTouchPoints}var Uf=!!(typeof window<"u"&&window.document&&window.document.createElement),Us=0,qr={capture:!1,passive:!1};function yk(e){var t=e.isEnabled,n=e.accountForScrollbars,r=n===void 0?!0:n,s=v.useRef({}),o=v.useRef(null),i=v.useCallback(function(l){if(Uf){var c=document.body,d=c&&c.style;if(r&&Pf.forEach(function(m){var p=d&&d[m];s.current[m]=p}),r&&Us<1){var u=parseInt(s.current.paddingRight,10)||0,f=document.body?document.body.clientWidth:0,g=window.innerWidth-f+u||0;Object.keys($f).forEach(function(m){var p=$f[m];d&&(d[m]=p)}),d&&(d.paddingRight="".concat(g,"px"))}c&&Hf()&&(c.addEventListener("touchmove",Ff,qr),l&&(l.addEventListener("touchstart",zf,qr),l.addEventListener("touchmove",Vf,qr))),Us+=1}},[r]),a=v.useCallback(function(l){if(Uf){var c=document.body,d=c&&c.style;Us=Math.max(Us-1,0),r&&Us<1&&Pf.forEach(function(u){var f=s.current[u];d&&(d[u]=f)}),c&&Hf()&&(c.removeEventListener("touchmove",Ff,qr),l&&(l.removeEventListener("touchstart",zf,qr),l.removeEventListener("touchmove",Vf,qr)))}},[r]);return v.useEffect(function(){if(t){var l=o.current;return i(l),function(){a(l)}}},[t,i,a]),function(l){o.current=l}}var vk=function(t){var n=t.target;return n.ownerDocument.activeElement&&n.ownerDocument.activeElement.blur()},xk={name:"1kfdb0e",styles:"position:fixed;left:0;bottom:0;right:0;top:0"};function wk(e){var t=e.children,n=e.lockEnabled,r=e.captureEnabled,s=r===void 0?!0:r,o=e.onBottomArrive,i=e.onBottomLeave,a=e.onTopArrive,l=e.onTopLeave,c=bk({isEnabled:s,onBottomArrive:o,onBottomLeave:i,onTopArrive:a,onTopLeave:l}),d=yk({isEnabled:n}),u=function(g){c(g),d(g)};return _e(v.Fragment,null,n&&_e("div",{onClick:vk,css:xk}),t(u))}var kk={name:"1a0ro4n-requiredInput",styles:"label:requiredInput;opacity:0;pointer-events:none;position:absolute;bottom:0;left:0;right:0;width:100%"},Ck=function(t){var n=t.name,r=t.onFocus;return _e("input",{required:!0,name:n,tabIndex:-1,"aria-hidden":"true",onFocus:r,css:kk,value:"",onChange:function(){}})},Sk=Ck;function Fl(e){var t;return typeof window<"u"&&window.navigator!=null?e.test(((t=window.navigator.userAgentData)===null||t===void 0?void 0:t.platform)||window.navigator.platform):!1}function _k(){return Fl(/^iPhone/i)}function Bf(){return Fl(/^Mac/i)}function Ek(){return Fl(/^iPad/i)||Bf()&&navigator.maxTouchPoints>1}function Mk(){return _k()||Ek()}function Nk(){return Bf()||Mk()}var Ok=function(t){return t.label},jf=function(t){return t.label},Wf=function(t){return t.value},Tk=function(t){return!!t.isDisabled},Ak={clearIndicator:m1,container:o1,control:C1,dropdownIndicator:g1,group:M1,groupHeading:O1,indicatorsContainer:c1,indicatorSeparator:y1,input:I1,loadingIndicator:w1,loadingMessage:e1,menu:Kw,menuList:Qw,menuPortal:r1,multiValue:V1,multiValueLabel:z1,multiValueRemove:H1,noOptionsMessage:Rw,option:Y1,placeholder:q1,singleValue:J1,valueContainer:a1},Dk={primary:"#2684FF",primary75:"#4C9AFF",primary50:"#B2D4FF",primary25:"#DEEBFF",danger:"#DE350B",dangerLight:"#FFBDAD",neutral0:"hsl(0, 0%, 100%)",neutral5:"hsl(0, 0%, 95%)",neutral10:"hsl(0, 0%, 90%)",neutral20:"hsl(0, 0%, 80%)",neutral30:"hsl(0, 0%, 70%)",neutral40:"hsl(0, 0%, 60%)",neutral50:"hsl(0, 0%, 50%)",neutral60:"hsl(0, 0%, 40%)",neutral70:"hsl(0, 0%, 30%)",neutral80:"hsl(0, 0%, 20%)",neutral90:"hsl(0, 0%, 10%)"},Ik=4,Gf=4,Lk=38,Pk=Gf*2,$k={baseUnit:Gf,controlHeight:Lk,menuGutter:Pk},Vl={borderRadius:Ik,colors:Dk,spacing:$k},Fk={"aria-live":"polite",backspaceRemovesValue:!0,blurInputOnSelect:vf(),captureMenuScroll:!vf(),classNames:{},closeMenuOnSelect:!0,closeMenuOnScroll:!1,components:{},controlShouldRenderValue:!0,escapeClearsValue:!1,filterOption:hk(),formatGroupLabel:Ok,getOptionLabel:jf,getOptionValue:Wf,isDisabled:!1,isLoading:!1,isMulti:!1,isRtl:!1,isSearchable:!0,isOptionDisabled:Tk,loadingMessage:function(){return"Loading..."},maxMenuHeight:300,minMenuHeight:140,menuIsOpen:!1,menuPlacement:"bottom",menuPosition:"absolute",menuShouldBlockScroll:!1,menuShouldScrollIntoView:!Fw(),noOptionsMessage:function(){return"No options"},openMenuOnFocus:!1,openMenuOnClick:!0,options:[],pageSize:5,placeholder:"Select...",screenReaderStatus:function(t){var n=t.count;return"".concat(n," result").concat(n!==1?"s":""," available")},styles:{},tabIndex:0,tabSelectsValue:!0,unstyled:!1};function Yf(e,t,n,r){var s=Qf(e,t,n),o=Jf(e,t,n),i=Zf(e,t),a=yi(e,t);return{type:"option",data:t,isDisabled:s,isSelected:o,label:i,value:a,index:r}}function bi(e,t){return e.options.map(function(n,r){if("options"in n){var s=n.options.map(function(i,a){return Yf(e,i,t,a)}).filter(function(i){return qf(e,i)});return s.length>0?{type:"group",data:n,options:s,index:r}:void 0}var o=Yf(e,n,t,r);return qf(e,o)?o:void 0}).filter(Hw)}function Kf(e){return e.reduce(function(t,n){return n.type==="group"?t.push.apply(t,Gr(n.options.map(function(r){return r.data}))):t.push(n.data),t},[])}function Xf(e,t){return e.reduce(function(n,r){return r.type==="group"?n.push.apply(n,Gr(r.options.map(function(s){return{data:s.data,id:"".concat(t,"-").concat(r.index,"-").concat(s.index)}}))):n.push({data:r.data,id:"".concat(t,"-").concat(r.index)}),n},[])}function Vk(e,t){return Kf(bi(e,t))}function qf(e,t){var n=e.inputValue,r=n===void 0?"":n,s=t.data,o=t.isSelected,i=t.label,a=t.value;return(!eh(e)||!o)&&Rf(e,{label:i,value:a,data:s},r)}function zk(e,t){var n=e.focusedValue,r=e.selectValue,s=r.indexOf(n);if(s>-1){var o=t.indexOf(n);if(o>-1)return n;if(s-1?n:t[0]}var zl=function(t,n){var r,s=(r=t.find(function(o){return o.data===n}))===null||r===void 0?void 0:r.id;return s||null},Zf=function(t,n){return t.getOptionLabel(n)},yi=function(t,n){return t.getOptionValue(n)};function Qf(e,t,n){return typeof e.isOptionDisabled=="function"?e.isOptionDisabled(t,n):!1}function Jf(e,t,n){if(n.indexOf(t)>-1)return!0;if(typeof e.isOptionSelected=="function")return e.isOptionSelected(t,n);var r=yi(e,t);return n.some(function(s){return yi(e,s)===r})}function Rf(e,t,n){return e.filterOption?e.filterOption(t,n):!0}var eh=function(t){var n=t.hideSelectedOptions,r=t.isMulti;return n===void 0?r:n},Uk=1,Hl=(function(e){dx(n,e);var t=hx(n);function n(r){var s;if(lx(this,n),s=t.call(this,r),s.state={ariaSelection:null,focusedOption:null,focusedOptionId:null,focusableOptionsWithIds:[],focusedValue:null,inputIsHidden:!1,isFocused:!1,selectValue:[],clearFocusValueOnUpdate:!1,prevWasFocused:!1,inputIsHiddenAfterUpdate:void 0,prevProps:void 0,instancePrefix:"",isAppleDevice:!1},s.blockOptionHover=!1,s.isComposing=!1,s.commonProps=void 0,s.initialTouchX=0,s.initialTouchY=0,s.openAfterFocus=!1,s.scrollToFocusedOptionOnUpdate=!1,s.userIsDragging=void 0,s.controlRef=null,s.getControlRef=function(l){s.controlRef=l},s.focusedOptionRef=null,s.getFocusedOptionRef=function(l){s.focusedOptionRef=l},s.menuListRef=null,s.getMenuListRef=function(l){s.menuListRef=l},s.inputRef=null,s.getInputRef=function(l){s.inputRef=l},s.focus=s.focusInput,s.blur=s.blurInput,s.onChange=function(l,c){var d=s.props,u=d.onChange,f=d.name;c.name=f,s.ariaOnChange(l,c),u(l,c)},s.setValue=function(l,c,d){var u=s.props,f=u.closeMenuOnSelect,g=u.isMulti,m=u.inputValue;s.onInputChange("",{action:"set-value",prevInputValue:m}),f&&(s.setState({inputIsHiddenAfterUpdate:!g}),s.onMenuClose()),s.setState({clearFocusValueOnUpdate:!0}),s.onChange(l,{action:c,option:d})},s.selectOption=function(l){var c=s.props,d=c.blurInputOnSelect,u=c.isMulti,f=c.name,g=s.state.selectValue,m=u&&s.isOptionSelected(l,g),p=s.isOptionDisabled(l,g);if(m){var y=s.getOptionValue(l);s.setValue(g.filter(function(b){return s.getOptionValue(b)!==y}),"deselect-option",l)}else if(!p)u?s.setValue([].concat(Gr(g),[l]),"select-option",l):s.setValue(l,"select-option");else{s.ariaOnChange(l,{action:"select-option",option:l,name:f});return}d&&s.blurInput()},s.removeValue=function(l){var c=s.props.isMulti,d=s.state.selectValue,u=s.getOptionValue(l),f=d.filter(function(m){return s.getOptionValue(m)!==u}),g=Hs(c,f,f[0]||null);s.onChange(g,{action:"remove-value",removedValue:l}),s.focusInput()},s.clearValue=function(){var l=s.state.selectValue;s.onChange(Hs(s.props.isMulti,[],null),{action:"clear",removedValues:l})},s.popValue=function(){var l=s.props.isMulti,c=s.state.selectValue,d=c[c.length-1],u=c.slice(0,c.length-1),f=Hs(l,u,u[0]||null);d&&s.onChange(f,{action:"pop-value",removedValue:d})},s.getFocusedOptionId=function(l){return zl(s.state.focusableOptionsWithIds,l)},s.getFocusableOptionsWithIds=function(){return Xf(bi(s.props,s.state.selectValue),s.getElementId("option"))},s.getValue=function(){return s.state.selectValue},s.cx=function(){for(var l=arguments.length,c=new Array(l),d=0;dg||f>g}},s.onTouchEnd=function(l){s.userIsDragging||(s.controlRef&&!s.controlRef.contains(l.target)&&s.menuListRef&&!s.menuListRef.contains(l.target)&&s.blurInput(),s.initialTouchX=0,s.initialTouchY=0)},s.onControlTouchEnd=function(l){s.userIsDragging||s.onControlMouseDown(l)},s.onClearIndicatorTouchEnd=function(l){s.userIsDragging||s.onClearIndicatorMouseDown(l)},s.onDropdownIndicatorTouchEnd=function(l){s.userIsDragging||s.onDropdownIndicatorMouseDown(l)},s.handleInputChange=function(l){var c=s.props.inputValue,d=l.currentTarget.value;s.setState({inputIsHiddenAfterUpdate:!1}),s.onInputChange(d,{action:"input-change",prevInputValue:c}),s.props.menuIsOpen||s.onMenuOpen()},s.onInputFocus=function(l){s.props.onFocus&&s.props.onFocus(l),s.setState({inputIsHiddenAfterUpdate:!1,isFocused:!0}),(s.openAfterFocus||s.props.openMenuOnFocus)&&s.openMenu("first"),s.openAfterFocus=!1},s.onInputBlur=function(l){var c=s.props.inputValue;if(s.menuListRef&&s.menuListRef.contains(document.activeElement)){s.inputRef.focus();return}s.props.onBlur&&s.props.onBlur(l),s.onInputChange("",{action:"input-blur",prevInputValue:c}),s.onMenuClose(),s.setState({focusedValue:null,isFocused:!1})},s.onOptionHover=function(l){if(!(s.blockOptionHover||s.state.focusedOption===l)){var c=s.getFocusableOptions(),d=c.indexOf(l);s.setState({focusedOption:l,focusedOptionId:d>-1?s.getFocusedOptionId(l):null})}},s.shouldHideSelectedOptions=function(){return eh(s.props)},s.onValueInputFocus=function(l){l.preventDefault(),l.stopPropagation(),s.focus()},s.onKeyDown=function(l){var c=s.props,d=c.isMulti,u=c.backspaceRemovesValue,f=c.escapeClearsValue,g=c.inputValue,m=c.isClearable,p=c.isDisabled,y=c.menuIsOpen,b=c.onKeyDown,_=c.tabSelectsValue,x=c.openMenuOnFocus,E=s.state,S=E.focusedOption,w=E.focusedValue,N=E.selectValue;if(!p&&!(typeof b=="function"&&(b(l),l.defaultPrevented))){switch(s.blockOptionHover=!0,l.key){case"ArrowLeft":if(!d||g)return;s.focusValue("previous");break;case"ArrowRight":if(!d||g)return;s.focusValue("next");break;case"Delete":case"Backspace":if(g)return;if(w)s.removeValue(w);else{if(!u)return;d?s.popValue():m&&s.clearValue()}break;case"Tab":if(s.isComposing||l.shiftKey||!y||!_||!S||x&&s.isOptionSelected(S,N))return;s.selectOption(S);break;case"Enter":if(l.keyCode===229)break;if(y){if(!S||s.isComposing)return;s.selectOption(S);break}return;case"Escape":y?(s.setState({inputIsHiddenAfterUpdate:!1}),s.onInputChange("",{action:"menu-close",prevInputValue:g}),s.onMenuClose()):m&&f&&s.clearValue();break;case" ":if(g)return;if(!y){s.openMenu("first");break}if(!S)return;s.selectOption(S);break;case"ArrowUp":y?s.focusOption("up"):s.openMenu("last");break;case"ArrowDown":y?s.focusOption("down"):s.openMenu("first");break;case"PageUp":if(!y)return;s.focusOption("pageup");break;case"PageDown":if(!y)return;s.focusOption("pagedown");break;case"Home":if(!y)return;s.focusOption("first");break;case"End":if(!y)return;s.focusOption("last");break;default:return}l.preventDefault()}},s.state.instancePrefix="react-select-"+(s.props.instanceId||++Uk),s.state.selectValue=ui(r.value),r.menuIsOpen&&s.state.selectValue.length){var o=s.getFocusableOptionsWithIds(),i=s.buildFocusableOptions(),a=i.indexOf(s.state.selectValue[0]);s.state.focusableOptionsWithIds=o,s.state.focusedOption=i[a],s.state.focusedOptionId=zl(o,i[a])}return s}return cx(n,[{key:"componentDidMount",value:function(){this.startListeningComposition(),this.startListeningToTouch(),this.props.closeMenuOnScroll&&document&&document.addEventListener&&document.addEventListener("scroll",this.onScroll,!0),this.props.autoFocus&&this.focusInput(),this.props.menuIsOpen&&this.state.focusedOption&&this.menuListRef&&this.focusedOptionRef&&yf(this.menuListRef,this.focusedOptionRef),Nk()&&this.setState({isAppleDevice:!0})}},{key:"componentDidUpdate",value:function(s){var o=this.props,i=o.isDisabled,a=o.menuIsOpen,l=this.state.isFocused;(l&&!i&&s.isDisabled||l&&a&&!s.menuIsOpen)&&this.focusInput(),l&&i&&!s.isDisabled?this.setState({isFocused:!1},this.onMenuClose):!l&&!i&&s.isDisabled&&this.inputRef===document.activeElement&&this.setState({isFocused:!0}),this.menuListRef&&this.focusedOptionRef&&this.scrollToFocusedOptionOnUpdate&&(yf(this.menuListRef,this.focusedOptionRef),this.scrollToFocusedOptionOnUpdate=!1)}},{key:"componentWillUnmount",value:function(){this.stopListeningComposition(),this.stopListeningToTouch(),document.removeEventListener("scroll",this.onScroll,!0)}},{key:"onMenuOpen",value:function(){this.props.onMenuOpen()}},{key:"onMenuClose",value:function(){this.onInputChange("",{action:"menu-close",prevInputValue:this.props.inputValue}),this.props.onMenuClose()}},{key:"onInputChange",value:function(s,o){this.props.onInputChange(s,o)}},{key:"focusInput",value:function(){this.inputRef&&this.inputRef.focus()}},{key:"blurInput",value:function(){this.inputRef&&this.inputRef.blur()}},{key:"openMenu",value:function(s){var o=this,i=this.state,a=i.selectValue,l=i.isFocused,c=this.buildFocusableOptions(),d=s==="first"?0:c.length-1;if(!this.props.isMulti){var u=c.indexOf(a[0]);u>-1&&(d=u)}this.scrollToFocusedOptionOnUpdate=!(l&&this.menuListRef),this.setState({inputIsHiddenAfterUpdate:!1,focusedValue:null,focusedOption:c[d],focusedOptionId:this.getFocusedOptionId(c[d])},function(){return o.onMenuOpen()})}},{key:"focusValue",value:function(s){var o=this.state,i=o.selectValue,a=o.focusedValue;if(this.props.isMulti){this.setState({focusedOption:null});var l=i.indexOf(a);a||(l=-1);var c=i.length-1,d=-1;if(i.length){switch(s){case"previous":l===0?d=0:l===-1?d=c:d=l-1;break;case"next":l>-1&&l0&&arguments[0]!==void 0?arguments[0]:"first",o=this.props.pageSize,i=this.state.focusedOption,a=this.getFocusableOptions();if(a.length){var l=0,c=a.indexOf(i);i||(c=-1),s==="up"?l=c>0?c-1:a.length-1:s==="down"?l=(c+1)%a.length:s==="pageup"?(l=c-o,l<0&&(l=0)):s==="pagedown"?(l=c+o,l>a.length-1&&(l=a.length-1)):s==="last"&&(l=a.length-1),this.scrollToFocusedOptionOnUpdate=!0,this.setState({focusedOption:a[l],focusedValue:null,focusedOptionId:this.getFocusedOptionId(a[l])})}}},{key:"getTheme",value:(function(){return this.props.theme?typeof this.props.theme=="function"?this.props.theme(Vl):Ee(Ee({},Vl),this.props.theme):Vl})},{key:"getCommonProps",value:function(){var s=this.clearValue,o=this.cx,i=this.getStyles,a=this.getClassNames,l=this.getValue,c=this.selectOption,d=this.setValue,u=this.props,f=u.isMulti,g=u.isRtl,m=u.options,p=this.hasValue();return{clearValue:s,cx:o,getStyles:i,getClassNames:a,getValue:l,hasValue:p,isMulti:f,isRtl:g,options:m,selectOption:c,selectProps:u,setValue:d,theme:this.getTheme()}}},{key:"hasValue",value:function(){var s=this.state.selectValue;return s.length>0}},{key:"hasOptions",value:function(){return!!this.getFocusableOptions().length}},{key:"isClearable",value:function(){var s=this.props,o=s.isClearable,i=s.isMulti;return o===void 0?i:o}},{key:"isOptionDisabled",value:function(s,o){return Qf(this.props,s,o)}},{key:"isOptionSelected",value:function(s,o){return Jf(this.props,s,o)}},{key:"filterOption",value:function(s,o){return Rf(this.props,s,o)}},{key:"formatOptionLabel",value:function(s,o){if(typeof this.props.formatOptionLabel=="function"){var i=this.props.inputValue,a=this.state.selectValue;return this.props.formatOptionLabel(s,{context:o,inputValue:i,selectValue:a})}else return this.getOptionLabel(s)}},{key:"formatGroupLabel",value:function(s){return this.props.formatGroupLabel(s)}},{key:"startListeningComposition",value:(function(){document&&document.addEventListener&&(document.addEventListener("compositionstart",this.onCompositionStart,!1),document.addEventListener("compositionend",this.onCompositionEnd,!1))})},{key:"stopListeningComposition",value:function(){document&&document.removeEventListener&&(document.removeEventListener("compositionstart",this.onCompositionStart),document.removeEventListener("compositionend",this.onCompositionEnd))}},{key:"startListeningToTouch",value:(function(){document&&document.addEventListener&&(document.addEventListener("touchstart",this.onTouchStart,!1),document.addEventListener("touchmove",this.onTouchMove,!1),document.addEventListener("touchend",this.onTouchEnd,!1))})},{key:"stopListeningToTouch",value:function(){document&&document.removeEventListener&&(document.removeEventListener("touchstart",this.onTouchStart),document.removeEventListener("touchmove",this.onTouchMove),document.removeEventListener("touchend",this.onTouchEnd))}},{key:"renderInput",value:(function(){var s=this.props,o=s.isDisabled,i=s.isSearchable,a=s.inputId,l=s.inputValue,c=s.tabIndex,d=s.form,u=s.menuIsOpen,f=s.required,g=this.getComponents(),m=g.Input,p=this.state,y=p.inputIsHidden,b=p.ariaSelection,_=this.commonProps,x=a||this.getElementId("input"),E=Ee(Ee(Ee({"aria-autocomplete":"list","aria-expanded":u,"aria-haspopup":!0,"aria-errormessage":this.props["aria-errormessage"],"aria-invalid":this.props["aria-invalid"],"aria-label":this.props["aria-label"],"aria-labelledby":this.props["aria-labelledby"],"aria-required":f,role:"combobox","aria-activedescendant":this.state.isAppleDevice?void 0:this.state.focusedOptionId||""},u&&{"aria-controls":this.getElementId("listbox")}),!i&&{"aria-readonly":!0}),this.hasValue()?b?.action==="initial-input-focus"&&{"aria-describedby":this.getElementId("live-region")}:{"aria-describedby":this.getElementId("placeholder")});return i?$.createElement(m,Ae({},_,{autoCapitalize:"none",autoComplete:"off",autoCorrect:"off",id:x,innerRef:this.getInputRef,isDisabled:o,isHidden:y,onBlur:this.onInputBlur,onChange:this.handleInputChange,onFocus:this.onInputFocus,spellCheck:"false",tabIndex:c,form:d,type:"text",value:l},E)):$.createElement(pk,Ae({id:x,innerRef:this.getInputRef,onBlur:this.onInputBlur,onChange:di,onFocus:this.onInputFocus,disabled:o,tabIndex:c,inputMode:"none",form:d,value:""},E))})},{key:"renderPlaceholderOrValue",value:function(){var s=this,o=this.getComponents(),i=o.MultiValue,a=o.MultiValueContainer,l=o.MultiValueLabel,c=o.MultiValueRemove,d=o.SingleValue,u=o.Placeholder,f=this.commonProps,g=this.props,m=g.controlShouldRenderValue,p=g.isDisabled,y=g.isMulti,b=g.inputValue,_=g.placeholder,x=this.state,E=x.selectValue,S=x.focusedValue,w=x.isFocused;if(!this.hasValue()||!m)return b?null:$.createElement(u,Ae({},f,{key:"placeholder",isDisabled:p,isFocused:w,innerProps:{id:this.getElementId("placeholder")}}),_);if(y)return E.map(function(C,k){var M=C===S,T="".concat(s.getOptionLabel(C),"-").concat(s.getOptionValue(C));return $.createElement(i,Ae({},f,{components:{Container:a,Label:l,Remove:c},isFocused:M,isDisabled:p,key:T,index:k,removeProps:{onClick:function(){return s.removeValue(C)},onTouchEnd:function(){return s.removeValue(C)},onMouseDown:function(P){P.preventDefault()}},data:C}),s.formatOptionLabel(C,"value"))});if(b)return null;var N=E[0];return $.createElement(d,Ae({},f,{data:N,isDisabled:p}),this.formatOptionLabel(N,"value"))}},{key:"renderClearIndicator",value:function(){var s=this.getComponents(),o=s.ClearIndicator,i=this.commonProps,a=this.props,l=a.isDisabled,c=a.isLoading,d=this.state.isFocused;if(!this.isClearable()||!o||l||!this.hasValue()||c)return null;var u={onMouseDown:this.onClearIndicatorMouseDown,onTouchEnd:this.onClearIndicatorTouchEnd,"aria-hidden":"true"};return $.createElement(o,Ae({},i,{innerProps:u,isFocused:d}))}},{key:"renderLoadingIndicator",value:function(){var s=this.getComponents(),o=s.LoadingIndicator,i=this.commonProps,a=this.props,l=a.isDisabled,c=a.isLoading,d=this.state.isFocused;if(!o||!c)return null;var u={"aria-hidden":"true"};return $.createElement(o,Ae({},i,{innerProps:u,isDisabled:l,isFocused:d}))}},{key:"renderIndicatorSeparator",value:function(){var s=this.getComponents(),o=s.DropdownIndicator,i=s.IndicatorSeparator;if(!o||!i)return null;var a=this.commonProps,l=this.props.isDisabled,c=this.state.isFocused;return $.createElement(i,Ae({},a,{isDisabled:l,isFocused:c}))}},{key:"renderDropdownIndicator",value:function(){var s=this.getComponents(),o=s.DropdownIndicator;if(!o)return null;var i=this.commonProps,a=this.props.isDisabled,l=this.state.isFocused,c={onMouseDown:this.onDropdownIndicatorMouseDown,onTouchEnd:this.onDropdownIndicatorTouchEnd,"aria-hidden":"true"};return $.createElement(o,Ae({},i,{innerProps:c,isDisabled:a,isFocused:l}))}},{key:"renderMenu",value:function(){var s=this,o=this.getComponents(),i=o.Group,a=o.GroupHeading,l=o.Menu,c=o.MenuList,d=o.MenuPortal,u=o.LoadingMessage,f=o.NoOptionsMessage,g=o.Option,m=this.commonProps,p=this.state.focusedOption,y=this.props,b=y.captureMenuScroll,_=y.inputValue,x=y.isLoading,E=y.loadingMessage,S=y.minMenuHeight,w=y.maxMenuHeight,N=y.menuIsOpen,C=y.menuPlacement,k=y.menuPosition,M=y.menuPortalTarget,T=y.menuShouldBlockScroll,L=y.menuShouldScrollIntoView,P=y.noOptionsMessage,F=y.onMenuScrollToTop,D=y.onMenuScrollToBottom;if(!N)return null;var A=function(B,G){var z=B.type,K=B.data,Y=B.isDisabled,Z=B.isSelected,ee=B.label,te=B.value,ce=p===K,J=Y?void 0:function(){return s.onOptionHover(K)},he=Y?void 0:function(){return s.selectOption(K)},le="".concat(s.getElementId("option"),"-").concat(G),ae={id:le,onClick:he,onMouseMove:J,onMouseOver:J,tabIndex:-1,role:"option","aria-selected":s.state.isAppleDevice?void 0:Z};return $.createElement(g,Ae({},m,{innerProps:ae,data:K,isDisabled:Y,isSelected:Z,key:le,label:ee,type:z,value:te,isFocused:ce,innerRef:ce?s.getFocusedOptionRef:void 0}),s.formatOptionLabel(B.data,"menu"))},O;if(this.hasOptions())O=this.getCategorizedOptions().map(function(U){if(U.type==="group"){var B=U.data,G=U.options,z=U.index,K="".concat(s.getElementId("group"),"-").concat(z),Y="".concat(K,"-heading");return $.createElement(i,Ae({},m,{key:K,data:B,options:G,Heading:a,headingProps:{id:Y,data:U.data},label:s.formatGroupLabel(U.data)}),U.options.map(function(Z){return A(Z,"".concat(z,"-").concat(Z.index))}))}else if(U.type==="option")return A(U,"".concat(U.index))});else if(x){var V=E({inputValue:_});if(V===null)return null;O=$.createElement(u,m,V)}else{var H=P({inputValue:_});if(H===null)return null;O=$.createElement(f,m,H)}var W={minMenuHeight:S,maxMenuHeight:w,menuPlacement:C,menuPosition:k,menuShouldScrollIntoView:L},j=$.createElement(Xw,Ae({},m,W),function(U){var B=U.ref,G=U.placerProps,z=G.placement,K=G.maxHeight;return $.createElement(l,Ae({},m,W,{innerRef:B,innerProps:{onMouseDown:s.onMenuMouseDown,onMouseMove:s.onMenuMouseMove},isLoading:x,placement:z}),$.createElement(wk,{captureEnabled:b,onTopArrive:F,onBottomArrive:D,lockEnabled:T},function(Y){return $.createElement(c,Ae({},m,{innerRef:function(ee){s.getMenuListRef(ee),Y(ee)},innerProps:{role:"listbox","aria-multiselectable":m.isMulti,id:s.getElementId("listbox")},isLoading:x,maxHeight:K,focusedOption:p}),O)}))});return M||k==="fixed"?$.createElement(d,Ae({},m,{appendTo:M,controlElement:this.controlRef,menuPlacement:C,menuPosition:k}),j):j}},{key:"renderFormField",value:function(){var s=this,o=this.props,i=o.delimiter,a=o.isDisabled,l=o.isMulti,c=o.name,d=o.required,u=this.state.selectValue;if(d&&!this.hasValue()&&!a)return $.createElement(Sk,{name:c,onFocus:this.onValueInputFocus});if(!(!c||a))if(l)if(i){var f=u.map(function(p){return s.getOptionValue(p)}).join(i);return $.createElement("input",{name:c,type:"hidden",value:f})}else{var g=u.length>0?u.map(function(p,y){return $.createElement("input",{key:"i-".concat(y),name:c,type:"hidden",value:s.getOptionValue(p)})}):$.createElement("input",{name:c,type:"hidden",value:""});return $.createElement("div",null,g)}else{var m=u[0]?this.getOptionValue(u[0]):"";return $.createElement("input",{name:c,type:"hidden",value:m})}}},{key:"renderLiveRegion",value:function(){var s=this.commonProps,o=this.state,i=o.ariaSelection,a=o.focusedOption,l=o.focusedValue,c=o.isFocused,d=o.selectValue,u=this.getFocusableOptions();return $.createElement(ck,Ae({},s,{id:this.getElementId("live-region"),ariaSelection:i,focusedOption:a,focusedValue:l,isFocused:c,selectValue:d,focusableOptions:u,isAppleDevice:this.state.isAppleDevice}))}},{key:"render",value:function(){var s=this.getComponents(),o=s.Control,i=s.IndicatorsContainer,a=s.SelectContainer,l=s.ValueContainer,c=this.props,d=c.className,u=c.id,f=c.isDisabled,g=c.menuIsOpen,m=this.state.isFocused,p=this.commonProps=this.getCommonProps();return $.createElement(a,Ae({},p,{className:d,innerProps:{id:u,onKeyDown:this.onKeyDown},isDisabled:f,isFocused:m}),this.renderLiveRegion(),$.createElement(o,Ae({},p,{innerRef:this.getControlRef,innerProps:{onMouseDown:this.onControlMouseDown,onTouchEnd:this.onControlTouchEnd},isDisabled:f,isFocused:m,menuIsOpen:g}),$.createElement(l,Ae({},p,{isDisabled:f}),this.renderPlaceholderOrValue(),this.renderInput()),$.createElement(i,Ae({},p,{isDisabled:f}),this.renderClearIndicator(),this.renderLoadingIndicator(),this.renderIndicatorSeparator(),this.renderDropdownIndicator())),this.renderMenu(),this.renderFormField())}}],[{key:"getDerivedStateFromProps",value:function(s,o){var i=o.prevProps,a=o.clearFocusValueOnUpdate,l=o.inputIsHiddenAfterUpdate,c=o.ariaSelection,d=o.isFocused,u=o.prevWasFocused,f=o.instancePrefix,g=s.options,m=s.value,p=s.menuIsOpen,y=s.inputValue,b=s.isMulti,_=ui(m),x={};if(i&&(m!==i.value||g!==i.options||p!==i.menuIsOpen||y!==i.inputValue)){var E=p?Vk(s,_):[],S=p?Xf(bi(s,_),"".concat(f,"-option")):[],w=a?zk(o,_):null,N=Hk(o,E),C=zl(S,N);x={selectValue:_,focusedOption:N,focusedOptionId:C,focusableOptionsWithIds:S,focusedValue:w,clearFocusValueOnUpdate:!1}}var k=l!=null&&s!==i?{inputIsHidden:l,inputIsHiddenAfterUpdate:void 0}:{},M=c,T=d&&u;return d&&!T&&(M={value:Hs(b,_,_[0]||null),options:_,action:"initial-input-focus"},T=!u),c?.action==="initial-input-focus"&&(M=null),Ee(Ee(Ee({},x),k),{},{prevProps:s,ariaSelection:M,prevWasFocused:T})}}]),n})(v.Component);Hl.defaultProps=Fk;var Bk=v.forwardRef(function(e,t){var n=Fu(e);return $.createElement(Hl,Ae({ref:t},n))}),th=Bk,jk=["allowCreateWhileLoading","createOptionPosition","formatCreateLabel","isValidNewOption","getNewOptionData","onCreateOption","options","onChange"],nh=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",n=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0,s=String(t).toLowerCase(),o=String(r.getOptionValue(n)).toLowerCase(),i=String(r.getOptionLabel(n)).toLowerCase();return o===s||i===s},Ul={formatCreateLabel:function(t){return'Create "'.concat(t,'"')},isValidNewOption:function(t,n,r,s){return!(!t||n.some(function(o){return nh(t,o,s)})||r.some(function(o){return nh(t,o,s)}))},getNewOptionData:function(t,n){return{label:n,value:t,__isNew__:!0}}};function Wk(e){var t=e.allowCreateWhileLoading,n=t===void 0?!1:t,r=e.createOptionPosition,s=r===void 0?"last":r,o=e.formatCreateLabel,i=o===void 0?Ul.formatCreateLabel:o,a=e.isValidNewOption,l=a===void 0?Ul.isValidNewOption:a,c=e.getNewOptionData,d=c===void 0?Ul.getNewOptionData:c,u=e.onCreateOption,f=e.options,g=f===void 0?[]:f,m=e.onChange,p=In(e,jk),y=p.getOptionValue,b=y===void 0?Wf:y,_=p.getOptionLabel,x=_===void 0?jf:_,E=p.inputValue,S=p.isLoading,w=p.isMulti,N=p.value,C=p.name,k=v.useMemo(function(){return l(E,ui(N),g,{getOptionValue:b,getOptionLabel:x})?d(E,i(E)):void 0},[i,d,x,b,E,l,g,N]),M=v.useMemo(function(){return(n||!S)&&k?s==="first"?[k].concat(Gr(g)):[].concat(Gr(g),[k]):g},[n,s,S,k,g]),T=v.useCallback(function(L,P){if(P.action!=="select-option")return m(L,P);var F=Array.isArray(L)?L:[L];if(F[F.length-1]===k){if(u)u(E);else{var D=d(E,E),A={action:"create-option",name:C,option:D};m(Hs(w,[].concat(Gr(ui(N)),[D]),D),A)}return}m(L,P)},[d,E,w,C,k,u,m,N]);return Ee(Ee({},p),{},{options:M,onChange:T})}var Gk=v.forwardRef(function(e,t){var n=Fu(e),r=Wk(n);return $.createElement(Hl,Ae({ref:t},r))}),rh=Gk;const Ft={control:"input-tag",valueContainer:"gap-1 flex flex-wrap",multiValue:{blue:"bg-blue-100 dark:bg-blue-900/20 rounded px-1.5 py-0.5 flex items-center gap-1",green:"bg-green-100 dark:bg-green-900/20 rounded px-1.5 py-0.5 flex items-center gap-1",amber:"bg-amber-100 dark:bg-amber-900/20 rounded px-1.5 py-0.5 flex items-center gap-1",red:"bg-red-100 dark:bg-red-900/20 rounded px-1.5 py-0.5 flex items-center gap-1",purple:"bg-purple-100 dark:bg-purple-900/20 rounded px-1.5 py-0.5 flex items-center gap-1",gray:"bg-gray-100 dark:bg-gray-700/50 rounded px-1.5 py-0.5 flex items-center gap-1"},multiValueLabel:{blue:"text-blue-700 dark:text-blue-300 text-xs",green:"text-green-700 dark:text-green-300 text-xs font-semibold",amber:"text-amber-700 dark:text-amber-300 text-xs font-semibold",red:"text-red-700 dark:text-red-300 text-xs font-semibold",purple:"text-purple-700 dark:text-purple-300 text-xs font-semibold",gray:"text-gray-700 dark:text-gray-300 text-xs"},multiValueRemove:{blue:"text-blue-700 dark:text-blue-300 hover:bg-red-100 dark:hover:bg-red-900/30 hover:text-red-600 dark:hover:text-red-400 rounded px-1",green:"text-green-700 dark:text-green-300 hover:bg-red-100 dark:hover:bg-red-900/30 hover:text-red-600 dark:hover:text-red-400 rounded px-1",amber:"text-amber-700 dark:text-amber-300 hover:bg-red-100 dark:hover:bg-red-900/30 hover:text-red-600 dark:hover:text-red-400 rounded px-1",red:"text-red-700 dark:text-red-300 hover:bg-red-100 dark:hover:bg-red-900/30 hover:text-red-600 dark:hover:text-red-400 rounded px-1",purple:"text-purple-700 dark:text-purple-300 hover:bg-red-100 dark:hover:bg-red-900/30 hover:text-red-600 dark:hover:text-red-400 rounded px-1",gray:"text-gray-700 dark:text-gray-300 hover:bg-red-100 dark:hover:bg-red-900/30 hover:text-red-600 dark:hover:text-red-400 rounded px-1"},input:"text-gray-900 dark:text-white text-sm",placeholder:"text-gray-400 dark:text-gray-500 text-sm",menu:"mt-2 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg",menuList:"py-1",option:{base:"px-3 py-2 cursor-pointer text-gray-900 dark:text-white text-[13px]",selected:"bg-blue-100 dark:bg-blue-900/20",focused:"bg-gray-100 dark:bg-gray-700",default:"bg-white dark:bg-gray-800"},noOptionsMessage:"px-3 py-2 text-gray-500 dark:text-gray-400 text-[13px]",checkbox:{base:"w-4 h-4 rounded border flex items-center justify-center text-white text-[10px] shrink-0",selected:"bg-blue-500 border-blue-500",unselected:"border-gray-400 dark:border-gray-500"}},sh=e=>{const{data:t,isSelected:n}=e;return h.jsx(mi.Option,{...e,children:h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("span",{className:`${Ft.checkbox.base} ${n?Ft.checkbox.selected:Ft.checkbox.unselected}`,children:n?"✓":""}),h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsxs("div",{className:"flex items-center gap-1",children:[h.jsx("span",{className:"text-[13px]",children:t.label}),t.count!==void 0&&t.count>0&&h.jsxs("span",{className:"text-gray-500 dark:text-gray-400 text-[10px]",children:["(",t.count,")"]})]}),t.description&&h.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 truncate",children:t.description})]})]})})},oh=e=>h.jsx(mi.GroupHeading,{...e,children:h.jsx("div",{className:"px-3 py-1.5 text-xs font-medium text-gray-500 dark:text-gray-400 bg-gray-50 dark:bg-gray-800/50 border-b border-gray-200 dark:border-gray-700",children:e.data.label})}),Yk=e=>{const{data:t}=e;return h.jsxs(mi.MultiValueLabel,{...e,children:[h.jsx("span",{children:t.label}),t.count!==void 0&&t.count>0&&h.jsxs("span",{className:"text-xs opacity-60 ml-1",children:["(",t.count,")"]})]})},Kk=({value:e,options:t=[],onChange:n,creatable:r=!1,placeholder:s="검색 또는 입력...",noOptionsMessage:o="검색 결과가 없습니다",formatCreateLabel:i,createLabelSuffix:a="추가",maxItems:l,disabled:c=!1,onBeforeRemove:d,onCreateOption:u,className:f="",tagVariants:g,defaultVariant:m="blue",name:p,isMulti:y=!0,isClearable:b=!0,isSearchable:_=!0,delimiters:x=[","],splitOnPaste:E=!0,onInputChange:S,id:w,editorAttrs:N})=>{const C=c===!0||c==="true",k=v.useCallback(J=>J==null?[]:Array.isArray(J)?J:[J],[]),[M,T]=v.useState(()=>k(e)),[L,P]=v.useState(""),F=v.useRef(void 0);v.useEffect(()=>{const J=(le,ae)=>!le&&!ae?!0:!le||!ae||le.length!==ae.length?!1:le.every((Se,ue)=>Se===ae[ue]),he=k(e);J(he,F.current)||(T(he),F.current=he)},[e,k]);const D=v.useMemo(()=>i?typeof i=="string"?J=>`${i} "${J}"`:i:J=>h.jsxs("span",{className:"text-[13px]",children:[h.jsx("strong",{children:J})," ",a]}),[i,a]),A=v.useMemo(()=>!M||!Array.isArray(M)?[]:M.map(J=>t.find(le=>le.value===J)||{value:J,label:String(J)}).filter(J=>J!==void 0),[M,t]),O=v.useMemo(()=>{const J=new Set(t.map(we=>we.value)),he=M?M.filter(we=>!J.has(we)).map(we=>({value:we,label:String(we)})):[],le=[...t,...he];if(!le.some(we=>we.group))return le;const Se=new Map,ue=[];le.forEach(we=>{if(we.group){const He=Se.get(we.group)||[];He.push(we),Se.set(we.group,He)}else ue.push(we)});const pe=[];return Se.forEach((we,He)=>{pe.push({label:He,options:we})}),ue.length>0&&pe.push({label:"",options:ue}),pe},[t,M]),V=v.useCallback(J=>({target:{value:J},currentTarget:{value:J},preventDefault:()=>{},stopPropagation:()=>{}}),[]),H=v.useCallback(J=>{if(!x?.length)return[J.trim()].filter(Boolean);const he=x.map(ae=>ae.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),le=new RegExp(`[${he.join("")}]`);return J.split(le).map(ae=>ae.trim()).filter(Boolean)},[x]),W=v.useCallback((J,he)=>{if(he.action!=="input-change"){P(J);return}if(S&&S(V(J)),!x?.some(ue=>J.includes(ue))||!r||!y){P(J);return}const Se=H(J).filter(ue=>ue&&!M.includes(ue));if(Se.length>0){const ue=l?l-M.length:1/0,pe=Se.slice(0,ue);if(pe.length>0){const we=[...M,...pe];T(we),n(V(we))}}P("")},[x,r,y,H,M,l,n,V,S]),j=v.useCallback(J=>{if(!E||!r||!y)return;const he=J.clipboardData.getData("text"),le=H(he);if(le.length<=1)return;J.preventDefault();const ae=le.filter(Se=>Se&&!M.includes(Se));if(ae.length>0){const Se=l?l-M.length:1/0,ue=ae.slice(0,Se);if(ue.length>0){const pe=[...M,...ue];T(pe),n(V(pe))}}},[E,r,y,H,M,l,n,V]),U=v.useCallback((J,he)=>{if((he.action==="remove-value"||he.action==="pop-value")&&he.removedValue&&d){const ae=d(he.removedValue);if(ae!==!0){const Se=typeof ae=="string"?ae:`"${he.removedValue.label}"은(는) 제거할 수 없습니다.`;alert(Se);return}}if(l&&J.length>l)return;const le=J.map(ae=>ae.value);T(le),n(V(le))},[n,d,l,V]),B=v.useCallback((J,he)=>{if(he.action==="clear"&&M.length>0&&d){const Se=t.find(pe=>pe.value===M[0])||{value:M[0],label:String(M[0])},ue=d(Se);if(ue!==!0){const pe=typeof ue=="string"?ue:`"${Se.label}"은(는) 제거할 수 없습니다.`;alert(pe);return}}const le=J?J.value:null,ae=J?[J.value]:[];T(ae),n(V(le))},[n,d,M,t,V]),G=v.useCallback(J=>{u&&u(J);const he=[...M||[],J];T(he),n(V(he))},[n,u,M,V]),z=v.useCallback(J=>!J||!J.trim()?!1:!M?.includes(J.trim()),[M]),K=v.useCallback(J=>{const he=L.trim();if(J.key==="Tab"&&r&&y&&he){if(M.includes(he))J.preventDefault(),P("");else if(!l||M.lengthg&&g[J]?g[J]:m,[g,m]),Z={control:()=>`${Ft.control} ${f} ${C?"opacity-60 cursor-not-allowed":""}`,valueContainer:()=>Ft.valueContainer,multiValue:J=>{const he=Y(J.data.value);return Ft.multiValue[he]},multiValueLabel:J=>{const he=Y(J.data.value);return Ft.multiValueLabel[he]},multiValueRemove:J=>{const he=Y(J.data.value);return`${Ft.multiValueRemove[he]} ${C?"pointer-events-none":""}`},singleValue:()=>"text-gray-900 dark:text-white text-sm",input:()=>Ft.input,placeholder:()=>Ft.placeholder,menu:()=>Ft.menu,menuList:()=>Ft.menuList,menuPortal:()=>"z-[9999]",option:J=>`${Ft.option.base} ${J.isSelected?Ft.option.selected:J.isFocused?Ft.option.focused:Ft.option.default}`,noOptionsMessage:()=>Ft.noOptionsMessage,clearIndicator:()=>"text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 cursor-pointer px-1",dropdownIndicator:()=>"text-gray-400 dark:text-gray-500 px-1"},ee={options:O,onKeyDown:K,placeholder:s,noOptionsMessage:()=>o,isDisabled:C,isSearchable:_,menuIsOpen:void 0,openMenuOnClick:!0,openMenuOnFocus:!0,menuPortalTarget:typeof document<"u"?document.body:null,menuPosition:"fixed",classNamePrefix:"tag-input",unstyled:!0,classNames:Z,styles:{menuPortal:J=>({...J,zIndex:9999})},...r&&y||S?{inputValue:L,onInputChange:W}:{}},te=y?M.join(","):M[0]??"";if(!y){const J={...ee,isMulti:!1,value:A[0]||null,onChange:B,isClearable:b,closeMenuOnSelect:!0,components:{Option:sh,GroupHeading:oh,IndicatorSeparator:()=>null,...b?{}:{ClearIndicator:()=>null}}};return r?h.jsxs(I,{id:w,...N,children:[p&&h.jsx("input",{type:"hidden",name:p,value:te}),h.jsx(rh,{...J,onCreateOption:G,formatCreateLabel:D,isValidNewOption:z,createOptionPosition:"first"})]}):h.jsxs(I,{id:w,...N,children:[p&&h.jsx("input",{type:"hidden",name:p,value:te}),h.jsx(th,{...J})]})}const ce={...ee,isMulti:!0,value:A,onChange:U,closeMenuOnSelect:!1,hideSelectedOptions:!1,backspaceRemovesValue:!1,isClearable:!1,components:{Option:sh,GroupHeading:oh,MultiValueLabel:Yk,ClearIndicator:()=>null,DropdownIndicator:()=>null,IndicatorSeparator:()=>null}};return r?h.jsxs(I,{id:w,...N,onPaste:j,children:[p&&h.jsx("input",{type:"hidden",name:p,value:te}),h.jsx(rh,{...ce,onCreateOption:G,formatCreateLabel:D,isValidNewOption:z,createOptionPosition:"first"})]}):h.jsxs(I,{id:w,...N,children:[p&&h.jsx("input",{type:"hidden",name:p,value:te}),h.jsx(th,{...ce})]})},Zr=(e,t)=>window.G7Core?.t?.(e,t)??e,Xk=()=>window.G7Core?.locale?.supported?.()??["ko","en"],qk=()=>window.G7Core?.locale?.current?.()??"ko",Bl=e=>{const t=Zr(`common.language_${e}`);return t===`common.language_${e}`?{ko:"한국어",en:"English",ja:"日本語",zh:"中文"}[e]||e.toUpperCase():t},Zk=({value:e=[],onChange:t,placeholder:n="입력 후 Enter",disabled:r=!1,creatable:s=!0,delimiters:o=[","],className:i="",name:a,error:l,maxItems:c,modalId:d,statePath:u,__componentContext:f,id:g,editorAttrs:m})=>{const p=v.useMemo(()=>Xk(),[]),y=v.useMemo(()=>qk(),[]),[b,_]=v.useState(()=>e||[]),[x,E]=v.useState(""),[S,w]=v.useState(!1),[N,C]=v.useState(null),[k,M]=v.useState({}),T=v.useRef(null),L=v.useRef(void 0);v.useEffect(()=>{const z=(Y,Z)=>!Y&&!Z?!0:!Y||!Z||Y.length!==Z.length?!1:JSON.stringify(Y)===JSON.stringify(Z),K=e||[];z(K,L.current)||(_(K),L.current=K)},[e]);const P=v.useCallback(z=>({target:{name:a,value:z},currentTarget:{name:a,value:z},preventDefault:()=>{},stopPropagation:()=>{}}),[a]),F=v.useCallback(z=>{const K=[];for(const Y of p){const Z=z[Y];Z?.trim()&&K.push(`${Y.toUpperCase()}: ${Z}`)}return K.length>0?K.join(" / "):""},[p]),D=v.useCallback(z=>{const K=b.filter((Y,Z)=>Z!==z);_(K),t?.(P(K))},[b,t,P]),A=v.useCallback((z,K,Y)=>{const Z=window.G7Core;if(!Z?.dispatch)return;const ee=p.map(te=>({code:te,label:Bl(te)}));Z.dispatch({handler:"setState",params:{target:"global",multilingualTagEdit:{fieldName:a,editingIndex:z,values:K,supportedLocales:ee,defaultLocale:y,statePath:u,currentTags:Y}}}),Z.dispatch({handler:"openModal",target:d},{componentContext:f})},[a,p,y,d,u,f]),O=v.useCallback(z=>{r||(d?A(z,{...b[z]},b):(C(z),M({...b[z]}),w(!0)))},[r,b,d,A]),V=v.useCallback((z="")=>{const K={};p.forEach(Y=>{K[Y]=Y===y?z:""}),d?(A(null,K,b),E("")):(C(null),M(K),w(!0),E(""))},[p,y,d,A,b]),H=v.useCallback(()=>{if(!Object.values(k).some(Y=>Y.trim()!=="")){w(!1);return}let K;N!==null?K=b.map((Y,Z)=>Z===N?k:Y):K=[...b,k],_(K),t?.(P(K)),w(!1),M({}),C(null)},[k,N,b,t,P]),W=v.useCallback(()=>{w(!1),M({}),C(null)},[]),j=v.useCallback(z=>{const K=z.target.value;if(o.some(Z=>K.includes(Z))&&s){const Z=o.map(ce=>ce.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),ee=new RegExp(`[${Z.join("")}]`),te=K.split(ee).map(ce=>ce.trim()).filter(Boolean);if(te.length>0){V(te[0]);return}}E(K)},[o,s,V]),U=v.useCallback(z=>{if(z.key==="Enter"&&x.trim()&&s){if(z.preventDefault(),c&&b.length>=c)return;V(x.trim())}},[x,s,c,b.length,V]),B=v.useCallback((z,K)=>{M(Y=>({...Y,[z]:K}))},[]),G=!!l;return h.jsxs(I,{className:i,id:g,...m,children:[h.jsxs(I,{className:`flex flex-wrap gap-1.5 p-2 border rounded-lg bg-white dark:bg-gray-700 min-h-[42px] ${G?"border-red-500 dark:border-red-400":"border-gray-300 dark:border-gray-600 focus-within:ring-2 focus-within:ring-blue-500 focus-within:border-blue-500"} ${r?"opacity-60 bg-gray-100 dark:bg-gray-800 cursor-not-allowed":""}`,children:[b.map((z,K)=>h.jsxs(I,{className:"flex items-center gap-1 bg-blue-100 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300 rounded px-2 py-0.5 text-sm",children:[h.jsx(Q,{className:`cursor-pointer hover:underline ${r?"cursor-not-allowed":""}`,onClick:()=>O(K),children:F(z)}),!r&&h.jsx(oe,{type:"button",className:"p-0 h-4 w-4 min-w-0 border-0 bg-transparent text-blue-600 dark:text-blue-400 hover:text-red-600 dark:hover:text-red-400 hover:bg-transparent",onClick:Y=>{Y.stopPropagation(),D(K)},children:h.jsx(re,{name:"times",className:"text-xs"})})]},K)),s&&!r&&(!c||b.lengthh.jsxs(I,{className:"space-y-1",children:[h.jsxs(I,{className:"flex items-center gap-2",children:[h.jsx(Q,{className:"text-sm font-medium text-gray-700 dark:text-gray-300 w-16",children:Bl(z)}),h.jsxs(Q,{className:"text-xs text-gray-400 dark:text-gray-500",children:["(",z.toUpperCase(),")"]})]}),h.jsx(wt,{type:"text",value:k[z]??"",onChange:K=>B(z,K.target.value),placeholder:`${Bl(z)} 값 입력`,className:"w-full",autoFocus:z===y})]},z)),h.jsxs(I,{className:"flex justify-end gap-2 pt-4 border-t border-gray-200 dark:border-gray-700",children:[h.jsx(oe,{type:"button",variant:"secondary",onClick:W,children:Zr("common.cancel")}),h.jsx(oe,{type:"button",variant:"primary",onClick:H,children:Zr(N!==null?"common.save":"common.add")})]})]})}),a&&h.jsx("input",{type:"hidden",name:a,value:JSON.stringify(b)})]})},ih=(e,t)=>window.G7Core?.t?.(e,t)??e,ah=({type:e,identifier:t,name:n,installedModules:r=[],installedPlugins:s=[],className:o="",style:i,id:a,editorAttrs:l})=>{const c={module:de.Cubes,plugin:de.PuzzlePiece},d={module:ih("common.module"),plugin:ih("common.plugin")},u=v.useMemo(()=>{if(n)return n;if(t){const p=(e==="module"?r:s)?.find(y=>y.identifier===t);if(p)return p.name}},[n,t,e,r,s]),f=c[e],g=u?`${u} ${d[e]}`:d[e];return h.jsxs(Q,{className:`inline-flex items-center gap-1.5 px-2 py-1 rounded text-xs font-medium text-gray-400 dark:text-gray-500 ${o}`,style:i,id:a,...l,children:[h.jsx(re,{name:f,className:"w-3.5 h-3.5"}),h.jsx(Q,{children:g})]})},Qk=({options:e=[],value:t,onChange:n,multiple:r=!1,searchPlaceholder:s="Search...",onSearch:o,noResultsText:i="No results found",initialText:a="Type to search",triggerLabel:l="Select",triggerIcon:c,disabled:d=!1,className:u="",id:f,editorAttrs:g})=>{const[m,p]=v.useState(!1),[y,b]=v.useState(""),_=v.useRef(null),x=v.useRef(null),E=v.useRef(`searchable-dropdown-input-${Math.random().toString(36).slice(2,9)}`).current,S=v.useMemo(()=>t==null?[]:Array.isArray(t)?t:[t],[t]),w=v.useMemo(()=>{if(!y.trim())return e;const D=y.toLowerCase();return e.filter(A=>A.label.toLowerCase().includes(D)||A.description?.toLowerCase().includes(D))},[e,y]),N=v.useMemo(()=>{if(S.length===0)return l;if(r){const A=S.length;return A===1?e.find(V=>String(V.value)===String(S[0]))?.label||l:`${A} selected`}return e.find(A=>String(A.value)===String(S[0]))?.label||l},[S,e,r,l]);v.useEffect(()=>{const D=A=>{_.current&&!_.current.contains(A.target)&&p(!1)};return m&&document.addEventListener("mousedown",D),()=>{document.removeEventListener("mousedown",D)}},[m]),v.useEffect(()=>{const D=A=>{A.key==="Escape"&&m&&(p(!1),x.current?.focus())};return document.addEventListener("keydown",D),()=>document.removeEventListener("keydown",D)},[m]),v.useEffect(()=>{if(!m){b("");return}const D=setTimeout(()=>{document.getElementById(E)?.focus()},50);return()=>{clearTimeout(D)}},[m,E]);const C=v.useCallback(()=>{d||p(D=>!D)},[d]),k=v.useCallback(D=>{const A=D.target.value;b(A),o?.(A)},[o]),M=v.useCallback(D=>{if(r){const O=S.some(V=>String(V)===String(D))?S.filter(V=>String(V)!==String(D)):[...S,D];n?.(O)}else n?.(D),p(!1),x.current?.focus()},[r,S,n]),T=D=>S.some(A=>String(A)===String(D)),L=y.length===0&&e.length===0,P=y.length>0&&w.length===0,F=w.length>0;return h.jsxs(I,{ref:_,className:`relative inline-block ${u}`,id:f,...g,children:[h.jsxs(oe,{ref:x,type:"button",onClick:C,disabled:d,className:` +`]))),Sk=function(t,n){var r=t.isFocused,s=t.size,o=t.theme,i=o.colors,a=o.spacing.baseUnit;return Me({label:"loadingIndicator",display:"flex",transition:"color 150ms",alignSelf:"center",fontSize:s,lineHeight:1,marginRight:s,textAlign:"center",verticalAlign:"middle"},n?{}:{color:r?i.neutral60:i.neutral20,padding:a*2})},ec=function(t){var n=t.delay,r=t.offset;return Ee("span",{css:Kl({animation:"".concat(Ck," 1s ease-in-out ").concat(n,"ms infinite;"),backgroundColor:"currentColor",borderRadius:"1em",display:"inline-block",marginLeft:r?"1em":void 0,height:"1em",verticalAlign:"top",width:"1em"},"","")})},_k=function(t){var n=t.innerProps,r=t.isRtl,s=t.size,o=s===void 0?4:s,i=Hn(t,pk);return Ee("div",De({},Ct(Me(Me({},i),{},{innerProps:n,isRtl:r,size:o}),"loadingIndicator",{indicator:!0,"loading-indicator":!0}),n),Ee(ec,{delay:0,offset:r}),Ee(ec,{delay:160,offset:!0}),Ee(ec,{delay:320,offset:!r}))},Ek=function(t,n){var r=t.isDisabled,s=t.isFocused,o=t.theme,i=o.colors,a=o.borderRadius,l=o.spacing;return Me({label:"control",alignItems:"center",cursor:"default",display:"flex",flexWrap:"wrap",justifyContent:"space-between",minHeight:l.controlHeight,outline:"0 !important",position:"relative",transition:"all 100ms"},n?{}:{backgroundColor:r?i.neutral5:i.neutral0,borderColor:r?i.neutral10:s?i.primary:i.neutral20,borderRadius:a,borderStyle:"solid",borderWidth:1,boxShadow:s?"0 0 0 1px ".concat(i.primary):void 0,"&:hover":{borderColor:s?i.primary:i.neutral30}})},Mk=function(t){var n=t.children,r=t.isDisabled,s=t.isFocused,o=t.innerRef,i=t.innerProps,a=t.menuIsOpen;return Ee("div",De({ref:o},Ct(t,"control",{control:!0,"control--is-disabled":r,"control--is-focused":s,"control--menu-is-open":a}),i,{"aria-disabled":r||void 0}),n)},Nk=Mk,Ok=["data"],Tk=function(t,n){var r=t.theme.spacing;return n?{}:{paddingBottom:r.baseUnit*2,paddingTop:r.baseUnit*2}},Ak=function(t){var n=t.children,r=t.cx,s=t.getStyles,o=t.getClassNames,i=t.Heading,a=t.headingProps,l=t.innerProps,c=t.label,d=t.theme,u=t.selectProps;return Ee("div",De({},Ct(t,"group",{group:!0}),l),Ee(i,De({},a,{selectProps:u,theme:d,getStyles:s,getClassNames:o,cx:r}),c),Ee("div",null,n))},Dk=function(t,n){var r=t.theme,s=r.colors,o=r.spacing;return Me({label:"group",cursor:"default",display:"block"},n?{}:{color:s.neutral40,fontSize:"75%",fontWeight:500,marginBottom:"0.25em",paddingLeft:o.baseUnit*3,paddingRight:o.baseUnit*3,textTransform:"uppercase"})},Ik=function(t){var n=Zf(t);n.data;var r=Hn(n,Ok);return Ee("div",De({},Ct(t,"groupHeading",{"group-heading":!0}),r))},Lk=Ak,Pk=["innerRef","isDisabled","isHidden","inputClassName"],$k=function(t,n){var r=t.isDisabled,s=t.value,o=t.theme,i=o.spacing,a=o.colors;return Me(Me({visibility:r?"hidden":"visible",transform:s?"translateZ(0)":""},Fk),n?{}:{margin:i.baseUnit/2,paddingBottom:i.baseUnit/2,paddingTop:i.baseUnit/2,color:a.neutral80})},lh={gridArea:"1 / 2",font:"inherit",minWidth:"2px",border:0,margin:0,outline:0,padding:0},Fk={flex:"1 1 auto",display:"inline-grid",gridArea:"1 / 1 / 2 / 3",gridTemplateColumns:"0 min-content","&:after":Me({content:'attr(data-value) " "',visibility:"hidden",whiteSpace:"pre"},lh)},zk=function(t){return Me({label:"input",color:"inherit",background:0,opacity:t?0:1,width:"100%"},lh)},Vk=function(t){var n=t.cx,r=t.value,s=Zf(t),o=s.innerRef,i=s.isDisabled,a=s.isHidden,l=s.inputClassName,c=Hn(s,Pk);return Ee("div",De({},Ct(t,"input",{"input-container":!0}),{"data-value":r||""}),Ee("input",De({className:n({input:!0},l),ref:o,style:zk(a),disabled:i},c)))},Hk=Vk,Uk=function(t,n){var r=t.theme,s=r.spacing,o=r.borderRadius,i=r.colors;return Me({label:"multiValue",display:"flex",minWidth:0},n?{}:{backgroundColor:i.neutral10,borderRadius:o/2,margin:s.baseUnit/2})},Bk=function(t,n){var r=t.theme,s=r.borderRadius,o=r.colors,i=t.cropWithEllipsis;return Me({overflow:"hidden",textOverflow:i||i===void 0?"ellipsis":void 0,whiteSpace:"nowrap"},n?{}:{borderRadius:s/2,color:o.neutral80,fontSize:"85%",padding:3,paddingLeft:6})},jk=function(t,n){var r=t.theme,s=r.spacing,o=r.borderRadius,i=r.colors,a=t.isFocused;return Me({alignItems:"center",display:"flex"},n?{}:{borderRadius:o/2,backgroundColor:a?i.dangerLight:void 0,paddingLeft:s.baseUnit,paddingRight:s.baseUnit,":hover":{backgroundColor:i.dangerLight,color:i.danger}})},ch=function(t){var n=t.children,r=t.innerProps;return Ee("div",r,n)},Wk=ch,Gk=ch;function Yk(e){var t=e.children,n=e.innerProps;return Ee("div",De({role:"button"},n),t||Ee(Rl,{size:14}))}var Kk=function(t){var n=t.children,r=t.components,s=t.data,o=t.innerProps,i=t.isDisabled,a=t.removeProps,l=t.selectProps,c=r.Container,d=r.Label,u=r.Remove;return Ee(c,{data:s,innerProps:Me(Me({},Ct(t,"multiValue",{"multi-value":!0,"multi-value--is-disabled":i})),o),selectProps:l},Ee(d,{data:s,innerProps:Me({},Ct(t,"multiValueLabel",{"multi-value__label":!0})),selectProps:l},n),Ee(u,{data:s,innerProps:Me(Me({},Ct(t,"multiValueRemove",{"multi-value__remove":!0})),{},{"aria-label":"Remove ".concat(n||"option")},a),selectProps:l}))},Xk=Kk,qk=function(t,n){var r=t.isDisabled,s=t.isFocused,o=t.isSelected,i=t.theme,a=i.spacing,l=i.colors;return Me({label:"option",cursor:"default",display:"block",fontSize:"inherit",width:"100%",userSelect:"none",WebkitTapHighlightColor:"rgba(0, 0, 0, 0)"},n?{}:{backgroundColor:o?l.primary:s?l.primary25:"transparent",color:r?l.neutral20:o?l.neutral0:"inherit",padding:"".concat(a.baseUnit*2,"px ").concat(a.baseUnit*3,"px"),":active":{backgroundColor:r?void 0:o?l.primary:l.primary50}})},Zk=function(t){var n=t.children,r=t.isDisabled,s=t.isFocused,o=t.isSelected,i=t.innerRef,a=t.innerProps;return Ee("div",De({},Ct(t,"option",{option:!0,"option--is-disabled":r,"option--is-focused":s,"option--is-selected":o}),{ref:i,"aria-disabled":r},a),n)},Qk=Zk,Jk=function(t,n){var r=t.theme,s=r.spacing,o=r.colors;return Me({label:"placeholder",gridArea:"1 / 1 / 2 / 3"},n?{}:{color:o.neutral50,marginLeft:s.baseUnit/2,marginRight:s.baseUnit/2})},Rk=function(t){var n=t.children,r=t.innerProps;return Ee("div",De({},Ct(t,"placeholder",{placeholder:!0}),r),n)},eC=Rk,tC=function(t,n){var r=t.isDisabled,s=t.theme,o=s.spacing,i=s.colors;return Me({label:"singleValue",gridArea:"1 / 1 / 2 / 3",maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},n?{}:{color:r?i.neutral40:i.neutral80,marginLeft:o.baseUnit/2,marginRight:o.baseUnit/2})},nC=function(t){var n=t.children,r=t.isDisabled,s=t.innerProps;return Ee("div",De({},Ct(t,"singleValue",{"single-value":!0,"single-value--is-disabled":r}),s),n)},rC=nC,Ai={ClearIndicator:xk,Control:Nk,DropdownIndicator:yk,DownChevron:ih,CrossIcon:Rl,Group:Lk,GroupHeading:Ik,IndicatorsContainer:hk,IndicatorSeparator:kk,Input:Hk,LoadingIndicator:_k,Menu:R1,MenuList:tk,MenuPortal:ak,LoadingMessage:ok,NoOptionsMessage:sk,MultiValue:Xk,MultiValueContainer:Wk,MultiValueLabel:Gk,MultiValueRemove:Yk,Option:Qk,Placeholder:eC,SelectContainer:ck,SingleValue:rC,ValueContainer:uk},sC=function(t){return Me(Me({},Ai),t.components)},dh=Number.isNaN||function(t){return typeof t=="number"&&t!==t};function oC(e,t){return!!(e===t||dh(e)&&dh(t))}function iC(e,t){if(e.length!==t.length)return!1;for(var n=0;n1?"s":""," ").concat(o.join(","),", selected.");case"select-option":return i?"option ".concat(s," is disabled. Select another option."):"option ".concat(s,", selected.");default:return""}},onFocus:function(t){var n=t.context,r=t.focused,s=t.options,o=t.label,i=o===void 0?"":o,a=t.selectValue,l=t.isDisabled,c=t.isSelected,d=t.isAppleDevice,u=function(p,y){return p&&p.length?"".concat(p.indexOf(y)+1," of ").concat(p.length):""};if(n==="value"&&a)return"value ".concat(i," focused, ").concat(u(a,r),".");if(n==="menu"&&d){var f=l?" disabled":"",g="".concat(c?" selected":"").concat(f);return"".concat(i).concat(g,", ").concat(u(s,r),".")}return""},onFilter:function(t){var n=t.inputValue,r=t.resultsMessage;return"".concat(r).concat(n?" for search term "+n:"",".")}},uC=function(t){var n=t.ariaSelection,r=t.focusedOption,s=t.focusedValue,o=t.focusableOptions,i=t.isFocused,a=t.selectValue,l=t.selectProps,c=t.id,d=t.isAppleDevice,u=l.ariaLiveMessages,f=l.getOptionLabel,g=l.inputValue,m=l.isMulti,p=l.isOptionDisabled,y=l.isSearchable,b=l.menuIsOpen,_=l.options,x=l.screenReaderStatus,M=l.tabSelectsValue,S=l.isLoading,k=l["aria-label"],N=l["aria-live"],C=v.useMemo(function(){return Me(Me({},dC),u||{})},[u]),w=v.useMemo(function(){var A="";if(n&&C.onChange){var D=n.option,O=n.options,z=n.removedValue,U=n.removedValues,j=n.value,Y=function(Q){return Array.isArray(Q)?null:Q},B=z||D||Y(j),W=B?f(B):"",G=O||U||void 0,V=G?G.map(f):[],X=Me({isDisabled:B&&p(B,a),label:W,labels:V},n);A=C.onChange(X)}return A},[n,C,p,a,f]),E=v.useMemo(function(){var A="",D=r||s,O=!!(r&&a&&a.includes(r));if(D&&C.onFocus){var z={focused:D,label:f(D),isDisabled:p(D,a),isSelected:O,options:o,context:D===r?"menu":"value",selectValue:a,isAppleDevice:d};A=C.onFocus(z)}return A},[r,s,f,p,C,o,a,d]),T=v.useMemo(function(){var A="";if(b&&_.length&&!S&&C.onFilter){var D=x({count:o.length});A=C.onFilter({inputValue:g,resultsMessage:D})}return A},[o,g,b,C,_,x,S]),P=n?.action==="initial-input-focus",L=v.useMemo(function(){var A="";if(C.guidance){var D=s?"value":b?"menu":"input";A=C.guidance({"aria-label":k,context:D,isDisabled:r&&p(r,a),isMulti:m,isSearchable:y,tabSelectsValue:M,isInitialFocus:P})}return A},[k,r,s,m,p,y,b,C,a,M,P]),F=Ee(v.Fragment,null,Ee("span",{id:"aria-selection"},w),Ee("span",{id:"aria-focused"},E),Ee("span",{id:"aria-results"},T),Ee("span",{id:"aria-guidance"},L));return Ee(v.Fragment,null,Ee(uh,{id:c},P&&F),Ee(uh,{"aria-live":N,"aria-atomic":"false","aria-relevant":"additions text",role:"log"},i&&!P&&F))},fC=uC,tc=[{base:"A",letters:"AⒶAÀÁÂẦẤẪẨÃĀĂẰẮẴẲȦǠÄǞẢÅǺǍȀȂẠẬẶḀĄȺⱯ"},{base:"AA",letters:"Ꜳ"},{base:"AE",letters:"ÆǼǢ"},{base:"AO",letters:"Ꜵ"},{base:"AU",letters:"Ꜷ"},{base:"AV",letters:"ꜸꜺ"},{base:"AY",letters:"Ꜽ"},{base:"B",letters:"BⒷBḂḄḆɃƂƁ"},{base:"C",letters:"CⒸCĆĈĊČÇḈƇȻꜾ"},{base:"D",letters:"DⒹDḊĎḌḐḒḎĐƋƊƉꝹ"},{base:"DZ",letters:"DZDŽ"},{base:"Dz",letters:"DzDž"},{base:"E",letters:"EⒺEÈÉÊỀẾỄỂẼĒḔḖĔĖËẺĚȄȆẸỆȨḜĘḘḚƐƎ"},{base:"F",letters:"FⒻFḞƑꝻ"},{base:"G",letters:"GⒼGǴĜḠĞĠǦĢǤƓꞠꝽꝾ"},{base:"H",letters:"HⒽHĤḢḦȞḤḨḪĦⱧⱵꞍ"},{base:"I",letters:"IⒾIÌÍÎĨĪĬİÏḮỈǏȈȊỊĮḬƗ"},{base:"J",letters:"JⒿJĴɈ"},{base:"K",letters:"KⓀKḰǨḲĶḴƘⱩꝀꝂꝄꞢ"},{base:"L",letters:"LⓁLĿĹĽḶḸĻḼḺŁȽⱢⱠꝈꝆꞀ"},{base:"LJ",letters:"LJ"},{base:"Lj",letters:"Lj"},{base:"M",letters:"MⓂMḾṀṂⱮƜ"},{base:"N",letters:"NⓃNǸŃÑṄŇṆŅṊṈȠƝꞐꞤ"},{base:"NJ",letters:"NJ"},{base:"Nj",letters:"Nj"},{base:"O",letters:"OⓄOÒÓÔỒỐỖỔÕṌȬṎŌṐṒŎȮȰÖȪỎŐǑȌȎƠỜỚỠỞỢỌỘǪǬØǾƆƟꝊꝌ"},{base:"OI",letters:"Ƣ"},{base:"OO",letters:"Ꝏ"},{base:"OU",letters:"Ȣ"},{base:"P",letters:"PⓅPṔṖƤⱣꝐꝒꝔ"},{base:"Q",letters:"QⓆQꝖꝘɊ"},{base:"R",letters:"RⓇRŔṘŘȐȒṚṜŖṞɌⱤꝚꞦꞂ"},{base:"S",letters:"SⓈSẞŚṤŜṠŠṦṢṨȘŞⱾꞨꞄ"},{base:"T",letters:"TⓉTṪŤṬȚŢṰṮŦƬƮȾꞆ"},{base:"TZ",letters:"Ꜩ"},{base:"U",letters:"UⓊUÙÚÛŨṸŪṺŬÜǛǗǕǙỦŮŰǓȔȖƯỪỨỮỬỰỤṲŲṶṴɄ"},{base:"V",letters:"VⓋVṼṾƲꝞɅ"},{base:"VY",letters:"Ꝡ"},{base:"W",letters:"WⓌWẀẂŴẆẄẈⱲ"},{base:"X",letters:"XⓍXẊẌ"},{base:"Y",letters:"YⓎYỲÝŶỸȲẎŸỶỴƳɎỾ"},{base:"Z",letters:"ZⓏZŹẐŻŽẒẔƵȤⱿⱫꝢ"},{base:"a",letters:"aⓐaẚàáâầấẫẩãāăằắẵẳȧǡäǟảåǻǎȁȃạậặḁąⱥɐ"},{base:"aa",letters:"ꜳ"},{base:"ae",letters:"æǽǣ"},{base:"ao",letters:"ꜵ"},{base:"au",letters:"ꜷ"},{base:"av",letters:"ꜹꜻ"},{base:"ay",letters:"ꜽ"},{base:"b",letters:"bⓑbḃḅḇƀƃɓ"},{base:"c",letters:"cⓒcćĉċčçḉƈȼꜿↄ"},{base:"d",letters:"dⓓdḋďḍḑḓḏđƌɖɗꝺ"},{base:"dz",letters:"dzdž"},{base:"e",letters:"eⓔeèéêềếễểẽēḕḗĕėëẻěȅȇẹệȩḝęḙḛɇɛǝ"},{base:"f",letters:"fⓕfḟƒꝼ"},{base:"g",letters:"gⓖgǵĝḡğġǧģǥɠꞡᵹꝿ"},{base:"h",letters:"hⓗhĥḣḧȟḥḩḫẖħⱨⱶɥ"},{base:"hv",letters:"ƕ"},{base:"i",letters:"iⓘiìíîĩīĭïḯỉǐȉȋịįḭɨı"},{base:"j",letters:"jⓙjĵǰɉ"},{base:"k",letters:"kⓚkḱǩḳķḵƙⱪꝁꝃꝅꞣ"},{base:"l",letters:"lⓛlŀĺľḷḹļḽḻſłƚɫⱡꝉꞁꝇ"},{base:"lj",letters:"lj"},{base:"m",letters:"mⓜmḿṁṃɱɯ"},{base:"n",letters:"nⓝnǹńñṅňṇņṋṉƞɲʼnꞑꞥ"},{base:"nj",letters:"nj"},{base:"o",letters:"oⓞoòóôồốỗổõṍȭṏōṑṓŏȯȱöȫỏőǒȍȏơờớỡởợọộǫǭøǿɔꝋꝍɵ"},{base:"oi",letters:"ƣ"},{base:"ou",letters:"ȣ"},{base:"oo",letters:"ꝏ"},{base:"p",letters:"pⓟpṕṗƥᵽꝑꝓꝕ"},{base:"q",letters:"qⓠqɋꝗꝙ"},{base:"r",letters:"rⓡrŕṙřȑȓṛṝŗṟɍɽꝛꞧꞃ"},{base:"s",letters:"sⓢsßśṥŝṡšṧṣṩșşȿꞩꞅẛ"},{base:"t",letters:"tⓣtṫẗťṭțţṱṯŧƭʈⱦꞇ"},{base:"tz",letters:"ꜩ"},{base:"u",letters:"uⓤuùúûũṹūṻŭüǜǘǖǚủůűǔȕȗưừứữửựụṳųṷṵʉ"},{base:"v",letters:"vⓥvṽṿʋꝟʌ"},{base:"vy",letters:"ꝡ"},{base:"w",letters:"wⓦwẁẃŵẇẅẘẉⱳ"},{base:"x",letters:"xⓧxẋẍ"},{base:"y",letters:"yⓨyỳýŷỹȳẏÿỷẙỵƴɏỿ"},{base:"z",letters:"zⓩzźẑżžẓẕƶȥɀⱬꝣ"}],hC=new RegExp("["+tc.map(function(e){return e.letters}).join("")+"]","g"),fh={},nc=0;nc-1}},bC=["innerRef"];function yC(e){var t=e.innerRef,n=Hn(e,bC),r=G1(n,"onExited","in","enter","exit","appear");return Ee("input",De({ref:t},r,{css:Kl({label:"dummyInput",background:0,border:0,caretColor:"transparent",fontSize:"inherit",gridArea:"1 / 1 / 2 / 3",outline:0,padding:0,width:1,color:"transparent",left:-100,opacity:0,position:"relative",transform:"scale(.01)"},"","")}))}var vC=function(t){t.cancelable&&t.preventDefault(),t.stopPropagation()};function xC(e){var t=e.isEnabled,n=e.onBottomArrive,r=e.onBottomLeave,s=e.onTopArrive,o=e.onTopLeave,i=v.useRef(!1),a=v.useRef(!1),l=v.useRef(0),c=v.useRef(null),d=v.useCallback(function(y,b){if(c.current!==null){var _=c.current,x=_.scrollTop,M=_.scrollHeight,S=_.clientHeight,k=c.current,N=b>0,C=M-S-x,w=!1;C>b&&i.current&&(r&&r(y),i.current=!1),N&&a.current&&(o&&o(y),a.current=!1),N&&b>C?(n&&!i.current&&n(y),k.scrollTop=M,w=!0,i.current=!0):!N&&-b>x&&(s&&!a.current&&s(y),k.scrollTop=0,w=!0,a.current=!0),w&&vC(y)}},[n,r,s,o]),u=v.useCallback(function(y){d(y,y.deltaY)},[d]),f=v.useCallback(function(y){l.current=y.changedTouches[0].clientY},[]),g=v.useCallback(function(y){var b=l.current-y.changedTouches[0].clientY;d(y,b)},[d]),m=v.useCallback(function(y){if(y){var b=B1?{passive:!1}:!1;y.addEventListener("wheel",u,b),y.addEventListener("touchstart",f,b),y.addEventListener("touchmove",g,b)}},[g,f,u]),p=v.useCallback(function(y){y&&(y.removeEventListener("wheel",u,!1),y.removeEventListener("touchstart",f,!1),y.removeEventListener("touchmove",g,!1))},[g,f,u]);return v.useEffect(function(){if(t){var y=c.current;return m(y),function(){p(y)}}},[t,m,p]),function(y){c.current=y}}var ph=["boxSizing","height","overflow","paddingRight","position"],mh={boxSizing:"border-box",overflow:"hidden",position:"relative",height:"100%"};function bh(e){e.cancelable&&e.preventDefault()}function yh(e){e.stopPropagation()}function vh(){var e=this.scrollTop,t=this.scrollHeight,n=e+this.offsetHeight;e===0?this.scrollTop=1:n===t&&(this.scrollTop=e-1)}function xh(){return"ontouchstart"in window||navigator.maxTouchPoints}var wh=!!(typeof window<"u"&&window.document&&window.document.createElement),no=0,cs={capture:!1,passive:!1};function wC(e){var t=e.isEnabled,n=e.accountForScrollbars,r=n===void 0?!0:n,s=v.useRef({}),o=v.useRef(null),i=v.useCallback(function(l){if(wh){var c=document.body,d=c&&c.style;if(r&&ph.forEach(function(m){var p=d&&d[m];s.current[m]=p}),r&&no<1){var u=parseInt(s.current.paddingRight,10)||0,f=document.body?document.body.clientWidth:0,g=window.innerWidth-f+u||0;Object.keys(mh).forEach(function(m){var p=mh[m];d&&(d[m]=p)}),d&&(d.paddingRight="".concat(g,"px"))}c&&xh()&&(c.addEventListener("touchmove",bh,cs),l&&(l.addEventListener("touchstart",vh,cs),l.addEventListener("touchmove",yh,cs))),no+=1}},[r]),a=v.useCallback(function(l){if(wh){var c=document.body,d=c&&c.style;no=Math.max(no-1,0),r&&no<1&&ph.forEach(function(u){var f=s.current[u];d&&(d[u]=f)}),c&&xh()&&(c.removeEventListener("touchmove",bh,cs),l&&(l.removeEventListener("touchstart",vh,cs),l.removeEventListener("touchmove",yh,cs)))}},[r]);return v.useEffect(function(){if(t){var l=o.current;return i(l),function(){a(l)}}},[t,i,a]),function(l){o.current=l}}var kC=function(t){var n=t.target;return n.ownerDocument.activeElement&&n.ownerDocument.activeElement.blur()},CC={name:"1kfdb0e",styles:"position:fixed;left:0;bottom:0;right:0;top:0"};function SC(e){var t=e.children,n=e.lockEnabled,r=e.captureEnabled,s=r===void 0?!0:r,o=e.onBottomArrive,i=e.onBottomLeave,a=e.onTopArrive,l=e.onTopLeave,c=xC({isEnabled:s,onBottomArrive:o,onBottomLeave:i,onTopArrive:a,onTopLeave:l}),d=wC({isEnabled:n}),u=function(g){c(g),d(g)};return Ee(v.Fragment,null,n&&Ee("div",{onClick:kC,css:CC}),t(u))}var _C={name:"1a0ro4n-requiredInput",styles:"label:requiredInput;opacity:0;pointer-events:none;position:absolute;bottom:0;left:0;right:0;width:100%"},EC=function(t){var n=t.name,r=t.onFocus;return Ee("input",{required:!0,name:n,tabIndex:-1,"aria-hidden":"true",onFocus:r,css:_C,value:"",onChange:function(){}})},MC=EC;function oc(e){var t;return typeof window<"u"&&window.navigator!=null?e.test(((t=window.navigator.userAgentData)===null||t===void 0?void 0:t.platform)||window.navigator.platform):!1}function NC(){return oc(/^iPhone/i)}function kh(){return oc(/^Mac/i)}function OC(){return oc(/^iPad/i)||kh()&&navigator.maxTouchPoints>1}function TC(){return NC()||OC()}function AC(){return kh()||TC()}var DC=function(t){return t.label},Ch=function(t){return t.label},Sh=function(t){return t.value},IC=function(t){return!!t.isDisabled},LC={clearIndicator:vk,container:lk,control:Ek,dropdownIndicator:bk,group:Tk,groupHeading:Dk,indicatorsContainer:fk,indicatorSeparator:wk,input:$k,loadingIndicator:Sk,loadingMessage:rk,menu:Z1,menuList:ek,menuPortal:ik,multiValue:Uk,multiValueLabel:Bk,multiValueRemove:jk,noOptionsMessage:nk,option:qk,placeholder:Jk,singleValue:tC,valueContainer:dk},PC={primary:"#2684FF",primary75:"#4C9AFF",primary50:"#B2D4FF",primary25:"#DEEBFF",danger:"#DE350B",dangerLight:"#FFBDAD",neutral0:"hsl(0, 0%, 100%)",neutral5:"hsl(0, 0%, 95%)",neutral10:"hsl(0, 0%, 90%)",neutral20:"hsl(0, 0%, 80%)",neutral30:"hsl(0, 0%, 70%)",neutral40:"hsl(0, 0%, 60%)",neutral50:"hsl(0, 0%, 50%)",neutral60:"hsl(0, 0%, 40%)",neutral70:"hsl(0, 0%, 30%)",neutral80:"hsl(0, 0%, 20%)",neutral90:"hsl(0, 0%, 10%)"},$C=4,_h=4,FC=38,zC=_h*2,VC={baseUnit:_h,controlHeight:FC,menuGutter:zC},ic={borderRadius:$C,colors:PC,spacing:VC},HC={"aria-live":"polite",backspaceRemovesValue:!0,blurInputOnSelect:Rf(),captureMenuScroll:!Rf(),classNames:{},closeMenuOnSelect:!0,closeMenuOnScroll:!1,components:{},controlShouldRenderValue:!0,escapeClearsValue:!1,filterOption:mC(),formatGroupLabel:DC,getOptionLabel:Ch,getOptionValue:Sh,isDisabled:!1,isLoading:!1,isMulti:!1,isRtl:!1,isSearchable:!0,isOptionDisabled:IC,loadingMessage:function(){return"Loading..."},maxMenuHeight:300,minMenuHeight:140,menuIsOpen:!1,menuPlacement:"bottom",menuPosition:"absolute",menuShouldBlockScroll:!1,menuShouldScrollIntoView:!H1(),noOptionsMessage:function(){return"No options"},openMenuOnFocus:!1,openMenuOnClick:!0,options:[],pageSize:5,placeholder:"Select...",screenReaderStatus:function(t){var n=t.count;return"".concat(n," result").concat(n!==1?"s":""," available")},styles:{},tabIndex:0,tabSelectsValue:!0,unstyled:!1};function Eh(e,t,n,r){var s=Ah(e,t,n),o=Dh(e,t,n),i=Th(e,t),a=Ii(e,t);return{type:"option",data:t,isDisabled:s,isSelected:o,label:i,value:a,index:r}}function Di(e,t){return e.options.map(function(n,r){if("options"in n){var s=n.options.map(function(i,a){return Eh(e,i,t,a)}).filter(function(i){return Oh(e,i)});return s.length>0?{type:"group",data:n,options:s,index:r}:void 0}var o=Eh(e,n,t,r);return Oh(e,o)?o:void 0}).filter(j1)}function Mh(e){return e.reduce(function(t,n){return n.type==="group"?t.push.apply(t,os(n.options.map(function(r){return r.data}))):t.push(n.data),t},[])}function Nh(e,t){return e.reduce(function(n,r){return r.type==="group"?n.push.apply(n,os(r.options.map(function(s){return{data:s.data,id:"".concat(t,"-").concat(r.index,"-").concat(s.index)}}))):n.push({data:r.data,id:"".concat(t,"-").concat(r.index)}),n},[])}function UC(e,t){return Mh(Di(e,t))}function Oh(e,t){var n=e.inputValue,r=n===void 0?"":n,s=t.data,o=t.isSelected,i=t.label,a=t.value;return(!Lh(e)||!o)&&Ih(e,{label:i,value:a,data:s},r)}function BC(e,t){var n=e.focusedValue,r=e.selectValue,s=r.indexOf(n);if(s>-1){var o=t.indexOf(n);if(o>-1)return n;if(s-1?n:t[0]}var ac=function(t,n){var r,s=(r=t.find(function(o){return o.data===n}))===null||r===void 0?void 0:r.id;return s||null},Th=function(t,n){return t.getOptionLabel(n)},Ii=function(t,n){return t.getOptionValue(n)};function Ah(e,t,n){return typeof e.isOptionDisabled=="function"?e.isOptionDisabled(t,n):!1}function Dh(e,t,n){if(n.indexOf(t)>-1)return!0;if(typeof e.isOptionSelected=="function")return e.isOptionSelected(t,n);var r=Ii(e,t);return n.some(function(s){return Ii(e,s)===r})}function Ih(e,t,n){return e.filterOption?e.filterOption(t,n):!0}var Lh=function(t){var n=t.hideSelectedOptions,r=t.isMulti;return n===void 0?r:n},WC=1,lc=(function(e){hw(n,e);var t=mw(n);function n(r){var s;if(uw(this,n),s=t.call(this,r),s.state={ariaSelection:null,focusedOption:null,focusedOptionId:null,focusableOptionsWithIds:[],focusedValue:null,inputIsHidden:!1,isFocused:!1,selectValue:[],clearFocusValueOnUpdate:!1,prevWasFocused:!1,inputIsHiddenAfterUpdate:void 0,prevProps:void 0,instancePrefix:"",isAppleDevice:!1},s.blockOptionHover=!1,s.isComposing=!1,s.commonProps=void 0,s.initialTouchX=0,s.initialTouchY=0,s.openAfterFocus=!1,s.scrollToFocusedOptionOnUpdate=!1,s.userIsDragging=void 0,s.controlRef=null,s.getControlRef=function(l){s.controlRef=l},s.focusedOptionRef=null,s.getFocusedOptionRef=function(l){s.focusedOptionRef=l},s.menuListRef=null,s.getMenuListRef=function(l){s.menuListRef=l},s.inputRef=null,s.getInputRef=function(l){s.inputRef=l},s.focus=s.focusInput,s.blur=s.blurInput,s.onChange=function(l,c){var d=s.props,u=d.onChange,f=d.name;c.name=f,s.ariaOnChange(l,c),u(l,c)},s.setValue=function(l,c,d){var u=s.props,f=u.closeMenuOnSelect,g=u.isMulti,m=u.inputValue;s.onInputChange("",{action:"set-value",prevInputValue:m}),f&&(s.setState({inputIsHiddenAfterUpdate:!g}),s.onMenuClose()),s.setState({clearFocusValueOnUpdate:!0}),s.onChange(l,{action:c,option:d})},s.selectOption=function(l){var c=s.props,d=c.blurInputOnSelect,u=c.isMulti,f=c.name,g=s.state.selectValue,m=u&&s.isOptionSelected(l,g),p=s.isOptionDisabled(l,g);if(m){var y=s.getOptionValue(l);s.setValue(g.filter(function(b){return s.getOptionValue(b)!==y}),"deselect-option",l)}else if(!p)u?s.setValue([].concat(os(g),[l]),"select-option",l):s.setValue(l,"select-option");else{s.ariaOnChange(l,{action:"select-option",option:l,name:f});return}d&&s.blurInput()},s.removeValue=function(l){var c=s.props.isMulti,d=s.state.selectValue,u=s.getOptionValue(l),f=d.filter(function(m){return s.getOptionValue(m)!==u}),g=to(c,f,f[0]||null);s.onChange(g,{action:"remove-value",removedValue:l}),s.focusInput()},s.clearValue=function(){var l=s.state.selectValue;s.onChange(to(s.props.isMulti,[],null),{action:"clear",removedValues:l})},s.popValue=function(){var l=s.props.isMulti,c=s.state.selectValue,d=c[c.length-1],u=c.slice(0,c.length-1),f=to(l,u,u[0]||null);d&&s.onChange(f,{action:"pop-value",removedValue:d})},s.getFocusedOptionId=function(l){return ac(s.state.focusableOptionsWithIds,l)},s.getFocusableOptionsWithIds=function(){return Nh(Di(s.props,s.state.selectValue),s.getElementId("option"))},s.getValue=function(){return s.state.selectValue},s.cx=function(){for(var l=arguments.length,c=new Array(l),d=0;dg||f>g}},s.onTouchEnd=function(l){s.userIsDragging||(s.controlRef&&!s.controlRef.contains(l.target)&&s.menuListRef&&!s.menuListRef.contains(l.target)&&s.blurInput(),s.initialTouchX=0,s.initialTouchY=0)},s.onControlTouchEnd=function(l){s.userIsDragging||s.onControlMouseDown(l)},s.onClearIndicatorTouchEnd=function(l){s.userIsDragging||s.onClearIndicatorMouseDown(l)},s.onDropdownIndicatorTouchEnd=function(l){s.userIsDragging||s.onDropdownIndicatorMouseDown(l)},s.handleInputChange=function(l){var c=s.props.inputValue,d=l.currentTarget.value;s.setState({inputIsHiddenAfterUpdate:!1}),s.onInputChange(d,{action:"input-change",prevInputValue:c}),s.props.menuIsOpen||s.onMenuOpen()},s.onInputFocus=function(l){s.props.onFocus&&s.props.onFocus(l),s.setState({inputIsHiddenAfterUpdate:!1,isFocused:!0}),(s.openAfterFocus||s.props.openMenuOnFocus)&&s.openMenu("first"),s.openAfterFocus=!1},s.onInputBlur=function(l){var c=s.props.inputValue;if(s.menuListRef&&s.menuListRef.contains(document.activeElement)){s.inputRef.focus();return}s.props.onBlur&&s.props.onBlur(l),s.onInputChange("",{action:"input-blur",prevInputValue:c}),s.onMenuClose(),s.setState({focusedValue:null,isFocused:!1})},s.onOptionHover=function(l){if(!(s.blockOptionHover||s.state.focusedOption===l)){var c=s.getFocusableOptions(),d=c.indexOf(l);s.setState({focusedOption:l,focusedOptionId:d>-1?s.getFocusedOptionId(l):null})}},s.shouldHideSelectedOptions=function(){return Lh(s.props)},s.onValueInputFocus=function(l){l.preventDefault(),l.stopPropagation(),s.focus()},s.onKeyDown=function(l){var c=s.props,d=c.isMulti,u=c.backspaceRemovesValue,f=c.escapeClearsValue,g=c.inputValue,m=c.isClearable,p=c.isDisabled,y=c.menuIsOpen,b=c.onKeyDown,_=c.tabSelectsValue,x=c.openMenuOnFocus,M=s.state,S=M.focusedOption,k=M.focusedValue,N=M.selectValue;if(!p&&!(typeof b=="function"&&(b(l),l.defaultPrevented))){switch(s.blockOptionHover=!0,l.key){case"ArrowLeft":if(!d||g)return;s.focusValue("previous");break;case"ArrowRight":if(!d||g)return;s.focusValue("next");break;case"Delete":case"Backspace":if(g)return;if(k)s.removeValue(k);else{if(!u)return;d?s.popValue():m&&s.clearValue()}break;case"Tab":if(s.isComposing||l.shiftKey||!y||!_||!S||x&&s.isOptionSelected(S,N))return;s.selectOption(S);break;case"Enter":if(l.keyCode===229)break;if(y){if(!S||s.isComposing)return;s.selectOption(S);break}return;case"Escape":y?(s.setState({inputIsHiddenAfterUpdate:!1}),s.onInputChange("",{action:"menu-close",prevInputValue:g}),s.onMenuClose()):m&&f&&s.clearValue();break;case" ":if(g)return;if(!y){s.openMenu("first");break}if(!S)return;s.selectOption(S);break;case"ArrowUp":y?s.focusOption("up"):s.openMenu("last");break;case"ArrowDown":y?s.focusOption("down"):s.openMenu("first");break;case"PageUp":if(!y)return;s.focusOption("pageup");break;case"PageDown":if(!y)return;s.focusOption("pagedown");break;case"Home":if(!y)return;s.focusOption("first");break;case"End":if(!y)return;s.focusOption("last");break;default:return}l.preventDefault()}},s.state.instancePrefix="react-select-"+(s.props.instanceId||++WC),s.state.selectValue=Ei(r.value),r.menuIsOpen&&s.state.selectValue.length){var o=s.getFocusableOptionsWithIds(),i=s.buildFocusableOptions(),a=i.indexOf(s.state.selectValue[0]);s.state.focusableOptionsWithIds=o,s.state.focusedOption=i[a],s.state.focusedOptionId=ac(o,i[a])}return s}return fw(n,[{key:"componentDidMount",value:function(){this.startListeningComposition(),this.startListeningToTouch(),this.props.closeMenuOnScroll&&document&&document.addEventListener&&document.addEventListener("scroll",this.onScroll,!0),this.props.autoFocus&&this.focusInput(),this.props.menuIsOpen&&this.state.focusedOption&&this.menuListRef&&this.focusedOptionRef&&Jf(this.menuListRef,this.focusedOptionRef),AC()&&this.setState({isAppleDevice:!0})}},{key:"componentDidUpdate",value:function(s){var o=this.props,i=o.isDisabled,a=o.menuIsOpen,l=this.state.isFocused;(l&&!i&&s.isDisabled||l&&a&&!s.menuIsOpen)&&this.focusInput(),l&&i&&!s.isDisabled?this.setState({isFocused:!1},this.onMenuClose):!l&&!i&&s.isDisabled&&this.inputRef===document.activeElement&&this.setState({isFocused:!0}),this.menuListRef&&this.focusedOptionRef&&this.scrollToFocusedOptionOnUpdate&&(Jf(this.menuListRef,this.focusedOptionRef),this.scrollToFocusedOptionOnUpdate=!1)}},{key:"componentWillUnmount",value:function(){this.stopListeningComposition(),this.stopListeningToTouch(),document.removeEventListener("scroll",this.onScroll,!0)}},{key:"onMenuOpen",value:function(){this.props.onMenuOpen()}},{key:"onMenuClose",value:function(){this.onInputChange("",{action:"menu-close",prevInputValue:this.props.inputValue}),this.props.onMenuClose()}},{key:"onInputChange",value:function(s,o){this.props.onInputChange(s,o)}},{key:"focusInput",value:function(){this.inputRef&&this.inputRef.focus()}},{key:"blurInput",value:function(){this.inputRef&&this.inputRef.blur()}},{key:"openMenu",value:function(s){var o=this,i=this.state,a=i.selectValue,l=i.isFocused,c=this.buildFocusableOptions(),d=s==="first"?0:c.length-1;if(!this.props.isMulti){var u=c.indexOf(a[0]);u>-1&&(d=u)}this.scrollToFocusedOptionOnUpdate=!(l&&this.menuListRef),this.setState({inputIsHiddenAfterUpdate:!1,focusedValue:null,focusedOption:c[d],focusedOptionId:this.getFocusedOptionId(c[d])},function(){return o.onMenuOpen()})}},{key:"focusValue",value:function(s){var o=this.state,i=o.selectValue,a=o.focusedValue;if(this.props.isMulti){this.setState({focusedOption:null});var l=i.indexOf(a);a||(l=-1);var c=i.length-1,d=-1;if(i.length){switch(s){case"previous":l===0?d=0:l===-1?d=c:d=l-1;break;case"next":l>-1&&l0&&arguments[0]!==void 0?arguments[0]:"first",o=this.props.pageSize,i=this.state.focusedOption,a=this.getFocusableOptions();if(a.length){var l=0,c=a.indexOf(i);i||(c=-1),s==="up"?l=c>0?c-1:a.length-1:s==="down"?l=(c+1)%a.length:s==="pageup"?(l=c-o,l<0&&(l=0)):s==="pagedown"?(l=c+o,l>a.length-1&&(l=a.length-1)):s==="last"&&(l=a.length-1),this.scrollToFocusedOptionOnUpdate=!0,this.setState({focusedOption:a[l],focusedValue:null,focusedOptionId:this.getFocusedOptionId(a[l])})}}},{key:"getTheme",value:(function(){return this.props.theme?typeof this.props.theme=="function"?this.props.theme(ic):Me(Me({},ic),this.props.theme):ic})},{key:"getCommonProps",value:function(){var s=this.clearValue,o=this.cx,i=this.getStyles,a=this.getClassNames,l=this.getValue,c=this.selectOption,d=this.setValue,u=this.props,f=u.isMulti,g=u.isRtl,m=u.options,p=this.hasValue();return{clearValue:s,cx:o,getStyles:i,getClassNames:a,getValue:l,hasValue:p,isMulti:f,isRtl:g,options:m,selectOption:c,selectProps:u,setValue:d,theme:this.getTheme()}}},{key:"hasValue",value:function(){var s=this.state.selectValue;return s.length>0}},{key:"hasOptions",value:function(){return!!this.getFocusableOptions().length}},{key:"isClearable",value:function(){var s=this.props,o=s.isClearable,i=s.isMulti;return o===void 0?i:o}},{key:"isOptionDisabled",value:function(s,o){return Ah(this.props,s,o)}},{key:"isOptionSelected",value:function(s,o){return Dh(this.props,s,o)}},{key:"filterOption",value:function(s,o){return Ih(this.props,s,o)}},{key:"formatOptionLabel",value:function(s,o){if(typeof this.props.formatOptionLabel=="function"){var i=this.props.inputValue,a=this.state.selectValue;return this.props.formatOptionLabel(s,{context:o,inputValue:i,selectValue:a})}else return this.getOptionLabel(s)}},{key:"formatGroupLabel",value:function(s){return this.props.formatGroupLabel(s)}},{key:"startListeningComposition",value:(function(){document&&document.addEventListener&&(document.addEventListener("compositionstart",this.onCompositionStart,!1),document.addEventListener("compositionend",this.onCompositionEnd,!1))})},{key:"stopListeningComposition",value:function(){document&&document.removeEventListener&&(document.removeEventListener("compositionstart",this.onCompositionStart),document.removeEventListener("compositionend",this.onCompositionEnd))}},{key:"startListeningToTouch",value:(function(){document&&document.addEventListener&&(document.addEventListener("touchstart",this.onTouchStart,!1),document.addEventListener("touchmove",this.onTouchMove,!1),document.addEventListener("touchend",this.onTouchEnd,!1))})},{key:"stopListeningToTouch",value:function(){document&&document.removeEventListener&&(document.removeEventListener("touchstart",this.onTouchStart),document.removeEventListener("touchmove",this.onTouchMove),document.removeEventListener("touchend",this.onTouchEnd))}},{key:"renderInput",value:(function(){var s=this.props,o=s.isDisabled,i=s.isSearchable,a=s.inputId,l=s.inputValue,c=s.tabIndex,d=s.form,u=s.menuIsOpen,f=s.required,g=this.getComponents(),m=g.Input,p=this.state,y=p.inputIsHidden,b=p.ariaSelection,_=this.commonProps,x=a||this.getElementId("input"),M=Me(Me(Me({"aria-autocomplete":"list","aria-expanded":u,"aria-haspopup":!0,"aria-errormessage":this.props["aria-errormessage"],"aria-invalid":this.props["aria-invalid"],"aria-label":this.props["aria-label"],"aria-labelledby":this.props["aria-labelledby"],"aria-required":f,role:"combobox","aria-activedescendant":this.state.isAppleDevice?void 0:this.state.focusedOptionId||""},u&&{"aria-controls":this.getElementId("listbox")}),!i&&{"aria-readonly":!0}),this.hasValue()?b?.action==="initial-input-focus"&&{"aria-describedby":this.getElementId("live-region")}:{"aria-describedby":this.getElementId("placeholder")});return i?$.createElement(m,De({},_,{autoCapitalize:"none",autoComplete:"off",autoCorrect:"off",id:x,innerRef:this.getInputRef,isDisabled:o,isHidden:y,onBlur:this.onInputBlur,onChange:this.handleInputChange,onFocus:this.onInputFocus,spellCheck:"false",tabIndex:c,form:d,type:"text",value:l},M)):$.createElement(yC,De({id:x,innerRef:this.getInputRef,onBlur:this.onInputBlur,onChange:_i,onFocus:this.onInputFocus,disabled:o,tabIndex:c,inputMode:"none",form:d,value:""},M))})},{key:"renderPlaceholderOrValue",value:function(){var s=this,o=this.getComponents(),i=o.MultiValue,a=o.MultiValueContainer,l=o.MultiValueLabel,c=o.MultiValueRemove,d=o.SingleValue,u=o.Placeholder,f=this.commonProps,g=this.props,m=g.controlShouldRenderValue,p=g.isDisabled,y=g.isMulti,b=g.inputValue,_=g.placeholder,x=this.state,M=x.selectValue,S=x.focusedValue,k=x.isFocused;if(!this.hasValue()||!m)return b?null:$.createElement(u,De({},f,{key:"placeholder",isDisabled:p,isFocused:k,innerProps:{id:this.getElementId("placeholder")}}),_);if(y)return M.map(function(C,w){var E=C===S,T="".concat(s.getOptionLabel(C),"-").concat(s.getOptionValue(C));return $.createElement(i,De({},f,{components:{Container:a,Label:l,Remove:c},isFocused:E,isDisabled:p,key:T,index:w,removeProps:{onClick:function(){return s.removeValue(C)},onTouchEnd:function(){return s.removeValue(C)},onMouseDown:function(L){L.preventDefault()}},data:C}),s.formatOptionLabel(C,"value"))});if(b)return null;var N=M[0];return $.createElement(d,De({},f,{data:N,isDisabled:p}),this.formatOptionLabel(N,"value"))}},{key:"renderClearIndicator",value:function(){var s=this.getComponents(),o=s.ClearIndicator,i=this.commonProps,a=this.props,l=a.isDisabled,c=a.isLoading,d=this.state.isFocused;if(!this.isClearable()||!o||l||!this.hasValue()||c)return null;var u={onMouseDown:this.onClearIndicatorMouseDown,onTouchEnd:this.onClearIndicatorTouchEnd,"aria-hidden":"true"};return $.createElement(o,De({},i,{innerProps:u,isFocused:d}))}},{key:"renderLoadingIndicator",value:function(){var s=this.getComponents(),o=s.LoadingIndicator,i=this.commonProps,a=this.props,l=a.isDisabled,c=a.isLoading,d=this.state.isFocused;if(!o||!c)return null;var u={"aria-hidden":"true"};return $.createElement(o,De({},i,{innerProps:u,isDisabled:l,isFocused:d}))}},{key:"renderIndicatorSeparator",value:function(){var s=this.getComponents(),o=s.DropdownIndicator,i=s.IndicatorSeparator;if(!o||!i)return null;var a=this.commonProps,l=this.props.isDisabled,c=this.state.isFocused;return $.createElement(i,De({},a,{isDisabled:l,isFocused:c}))}},{key:"renderDropdownIndicator",value:function(){var s=this.getComponents(),o=s.DropdownIndicator;if(!o)return null;var i=this.commonProps,a=this.props.isDisabled,l=this.state.isFocused,c={onMouseDown:this.onDropdownIndicatorMouseDown,onTouchEnd:this.onDropdownIndicatorTouchEnd,"aria-hidden":"true"};return $.createElement(o,De({},i,{innerProps:c,isDisabled:a,isFocused:l}))}},{key:"renderMenu",value:function(){var s=this,o=this.getComponents(),i=o.Group,a=o.GroupHeading,l=o.Menu,c=o.MenuList,d=o.MenuPortal,u=o.LoadingMessage,f=o.NoOptionsMessage,g=o.Option,m=this.commonProps,p=this.state.focusedOption,y=this.props,b=y.captureMenuScroll,_=y.inputValue,x=y.isLoading,M=y.loadingMessage,S=y.minMenuHeight,k=y.maxMenuHeight,N=y.menuIsOpen,C=y.menuPlacement,w=y.menuPosition,E=y.menuPortalTarget,T=y.menuShouldBlockScroll,P=y.menuShouldScrollIntoView,L=y.noOptionsMessage,F=y.onMenuScrollToTop,A=y.onMenuScrollToBottom;if(!N)return null;var D=function(W,G){var V=W.type,X=W.data,K=W.isDisabled,Q=W.isSelected,ne=W.label,se=W.value,ue=p===X,ee=K?void 0:function(){return s.onOptionHover(X)},me=K?void 0:function(){return s.selectOption(X)},ie="".concat(s.getElementId("option"),"-").concat(G),de={id:ie,onClick:me,onMouseMove:ee,onMouseOver:ee,tabIndex:-1,role:"option","aria-selected":s.state.isAppleDevice?void 0:Q};return $.createElement(g,De({},m,{innerProps:de,data:X,isDisabled:K,isSelected:Q,key:ie,label:ne,type:V,value:se,isFocused:ue,innerRef:ue?s.getFocusedOptionRef:void 0}),s.formatOptionLabel(W.data,"menu"))},O;if(this.hasOptions())O=this.getCategorizedOptions().map(function(B){if(B.type==="group"){var W=B.data,G=B.options,V=B.index,X="".concat(s.getElementId("group"),"-").concat(V),K="".concat(X,"-heading");return $.createElement(i,De({},m,{key:X,data:W,options:G,Heading:a,headingProps:{id:K,data:B.data},label:s.formatGroupLabel(B.data)}),B.options.map(function(Q){return D(Q,"".concat(V,"-").concat(Q.index))}))}else if(B.type==="option")return D(B,"".concat(B.index))});else if(x){var z=M({inputValue:_});if(z===null)return null;O=$.createElement(u,m,z)}else{var U=L({inputValue:_});if(U===null)return null;O=$.createElement(f,m,U)}var j={minMenuHeight:S,maxMenuHeight:k,menuPlacement:C,menuPosition:w,menuShouldScrollIntoView:P},Y=$.createElement(Q1,De({},m,j),function(B){var W=B.ref,G=B.placerProps,V=G.placement,X=G.maxHeight;return $.createElement(l,De({},m,j,{innerRef:W,innerProps:{onMouseDown:s.onMenuMouseDown,onMouseMove:s.onMenuMouseMove},isLoading:x,placement:V}),$.createElement(SC,{captureEnabled:b,onTopArrive:F,onBottomArrive:A,lockEnabled:T},function(K){return $.createElement(c,De({},m,{innerRef:function(ne){s.getMenuListRef(ne),K(ne)},innerProps:{role:"listbox","aria-multiselectable":m.isMulti,id:s.getElementId("listbox")},isLoading:x,maxHeight:X,focusedOption:p}),O)}))});return E||w==="fixed"?$.createElement(d,De({},m,{appendTo:E,controlElement:this.controlRef,menuPlacement:C,menuPosition:w}),Y):Y}},{key:"renderFormField",value:function(){var s=this,o=this.props,i=o.delimiter,a=o.isDisabled,l=o.isMulti,c=o.name,d=o.required,u=this.state.selectValue;if(d&&!this.hasValue()&&!a)return $.createElement(MC,{name:c,onFocus:this.onValueInputFocus});if(!(!c||a))if(l)if(i){var f=u.map(function(p){return s.getOptionValue(p)}).join(i);return $.createElement("input",{name:c,type:"hidden",value:f})}else{var g=u.length>0?u.map(function(p,y){return $.createElement("input",{key:"i-".concat(y),name:c,type:"hidden",value:s.getOptionValue(p)})}):$.createElement("input",{name:c,type:"hidden",value:""});return $.createElement("div",null,g)}else{var m=u[0]?this.getOptionValue(u[0]):"";return $.createElement("input",{name:c,type:"hidden",value:m})}}},{key:"renderLiveRegion",value:function(){var s=this.commonProps,o=this.state,i=o.ariaSelection,a=o.focusedOption,l=o.focusedValue,c=o.isFocused,d=o.selectValue,u=this.getFocusableOptions();return $.createElement(fC,De({},s,{id:this.getElementId("live-region"),ariaSelection:i,focusedOption:a,focusedValue:l,isFocused:c,selectValue:d,focusableOptions:u,isAppleDevice:this.state.isAppleDevice}))}},{key:"render",value:function(){var s=this.getComponents(),o=s.Control,i=s.IndicatorsContainer,a=s.SelectContainer,l=s.ValueContainer,c=this.props,d=c.className,u=c.id,f=c.isDisabled,g=c.menuIsOpen,m=this.state.isFocused,p=this.commonProps=this.getCommonProps();return $.createElement(a,De({},p,{className:d,innerProps:{id:u,onKeyDown:this.onKeyDown},isDisabled:f,isFocused:m}),this.renderLiveRegion(),$.createElement(o,De({},p,{innerRef:this.getControlRef,innerProps:{onMouseDown:this.onControlMouseDown,onTouchEnd:this.onControlTouchEnd},isDisabled:f,isFocused:m,menuIsOpen:g}),$.createElement(l,De({},p,{isDisabled:f}),this.renderPlaceholderOrValue(),this.renderInput()),$.createElement(i,De({},p,{isDisabled:f}),this.renderClearIndicator(),this.renderLoadingIndicator(),this.renderIndicatorSeparator(),this.renderDropdownIndicator())),this.renderMenu(),this.renderFormField())}}],[{key:"getDerivedStateFromProps",value:function(s,o){var i=o.prevProps,a=o.clearFocusValueOnUpdate,l=o.inputIsHiddenAfterUpdate,c=o.ariaSelection,d=o.isFocused,u=o.prevWasFocused,f=o.instancePrefix,g=s.options,m=s.value,p=s.menuIsOpen,y=s.inputValue,b=s.isMulti,_=Ei(m),x={};if(i&&(m!==i.value||g!==i.options||p!==i.menuIsOpen||y!==i.inputValue)){var M=p?UC(s,_):[],S=p?Nh(Di(s,_),"".concat(f,"-option")):[],k=a?BC(o,_):null,N=jC(o,M),C=ac(S,N);x={selectValue:_,focusedOption:N,focusedOptionId:C,focusableOptionsWithIds:S,focusedValue:k,clearFocusValueOnUpdate:!1}}var w=l!=null&&s!==i?{inputIsHidden:l,inputIsHiddenAfterUpdate:void 0}:{},E=c,T=d&&u;return d&&!T&&(E={value:to(b,_,_[0]||null),options:_,action:"initial-input-focus"},T=!u),c?.action==="initial-input-focus"&&(E=null),Me(Me(Me({},x),w),{},{prevProps:s,ariaSelection:E,prevWasFocused:T})}}]),n})(v.Component);lc.defaultProps=HC;var GC=v.forwardRef(function(e,t){var n=yf(e);return $.createElement(lc,De({ref:t},n))}),Ph=GC,YC=["allowCreateWhileLoading","createOptionPosition","formatCreateLabel","isValidNewOption","getNewOptionData","onCreateOption","options","onChange"],$h=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",n=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0,s=String(t).toLowerCase(),o=String(r.getOptionValue(n)).toLowerCase(),i=String(r.getOptionLabel(n)).toLowerCase();return o===s||i===s},cc={formatCreateLabel:function(t){return'Create "'.concat(t,'"')},isValidNewOption:function(t,n,r,s){return!(!t||n.some(function(o){return $h(t,o,s)})||r.some(function(o){return $h(t,o,s)}))},getNewOptionData:function(t,n){return{label:n,value:t,__isNew__:!0}}};function KC(e){var t=e.allowCreateWhileLoading,n=t===void 0?!1:t,r=e.createOptionPosition,s=r===void 0?"last":r,o=e.formatCreateLabel,i=o===void 0?cc.formatCreateLabel:o,a=e.isValidNewOption,l=a===void 0?cc.isValidNewOption:a,c=e.getNewOptionData,d=c===void 0?cc.getNewOptionData:c,u=e.onCreateOption,f=e.options,g=f===void 0?[]:f,m=e.onChange,p=Hn(e,YC),y=p.getOptionValue,b=y===void 0?Sh:y,_=p.getOptionLabel,x=_===void 0?Ch:_,M=p.inputValue,S=p.isLoading,k=p.isMulti,N=p.value,C=p.name,w=v.useMemo(function(){return l(M,Ei(N),g,{getOptionValue:b,getOptionLabel:x})?d(M,i(M)):void 0},[i,d,x,b,M,l,g,N]),E=v.useMemo(function(){return(n||!S)&&w?s==="first"?[w].concat(os(g)):[].concat(os(g),[w]):g},[n,s,S,w,g]),T=v.useCallback(function(P,L){if(L.action!=="select-option")return m(P,L);var F=Array.isArray(P)?P:[P];if(F[F.length-1]===w){if(u)u(M);else{var A=d(M,M),D={action:"create-option",name:C,option:A};m(to(k,[].concat(os(Ei(N)),[A]),A),D)}return}m(P,L)},[d,M,k,C,w,u,m,N]);return Me(Me({},p),{},{options:E,onChange:T})}var XC=v.forwardRef(function(e,t){var n=yf(e),r=KC(n);return $.createElement(lc,De({ref:t},r))}),Fh=XC;const Wt={control:"input-tag",valueContainer:"gap-1 flex flex-wrap",multiValue:{blue:"bg-blue-100 dark:bg-blue-900/20 rounded px-1.5 py-0.5 flex items-center gap-1",green:"bg-green-100 dark:bg-green-900/20 rounded px-1.5 py-0.5 flex items-center gap-1",amber:"bg-amber-100 dark:bg-amber-900/20 rounded px-1.5 py-0.5 flex items-center gap-1",red:"bg-red-100 dark:bg-red-900/20 rounded px-1.5 py-0.5 flex items-center gap-1",purple:"bg-purple-100 dark:bg-purple-900/20 rounded px-1.5 py-0.5 flex items-center gap-1",gray:"bg-gray-100 dark:bg-gray-700/50 rounded px-1.5 py-0.5 flex items-center gap-1"},multiValueLabel:{blue:"text-blue-700 dark:text-blue-300 text-xs",green:"text-green-700 dark:text-green-300 text-xs font-semibold",amber:"text-amber-700 dark:text-amber-300 text-xs font-semibold",red:"text-red-700 dark:text-red-300 text-xs font-semibold",purple:"text-purple-700 dark:text-purple-300 text-xs font-semibold",gray:"text-gray-700 dark:text-gray-300 text-xs"},multiValueRemove:{blue:"text-blue-700 dark:text-blue-300 hover:bg-red-100 dark:hover:bg-red-900/30 hover:text-red-600 dark:hover:text-red-400 rounded px-1",green:"text-green-700 dark:text-green-300 hover:bg-red-100 dark:hover:bg-red-900/30 hover:text-red-600 dark:hover:text-red-400 rounded px-1",amber:"text-amber-700 dark:text-amber-300 hover:bg-red-100 dark:hover:bg-red-900/30 hover:text-red-600 dark:hover:text-red-400 rounded px-1",red:"text-red-700 dark:text-red-300 hover:bg-red-100 dark:hover:bg-red-900/30 hover:text-red-600 dark:hover:text-red-400 rounded px-1",purple:"text-purple-700 dark:text-purple-300 hover:bg-red-100 dark:hover:bg-red-900/30 hover:text-red-600 dark:hover:text-red-400 rounded px-1",gray:"text-gray-700 dark:text-gray-300 hover:bg-red-100 dark:hover:bg-red-900/30 hover:text-red-600 dark:hover:text-red-400 rounded px-1"},input:"text-gray-900 dark:text-white text-sm",placeholder:"text-gray-400 dark:text-gray-500 text-sm",menu:"mt-2 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg",menuList:"py-1",option:{base:"px-3 py-2 cursor-pointer text-gray-900 dark:text-white text-[13px]",selected:"bg-blue-100 dark:bg-blue-900/20",focused:"bg-gray-100 dark:bg-gray-700",default:"bg-white dark:bg-gray-800"},noOptionsMessage:"px-3 py-2 text-gray-500 dark:text-gray-400 text-[13px]",checkbox:{base:"w-4 h-4 rounded border flex items-center justify-center text-white text-[10px] shrink-0",selected:"bg-blue-500 border-blue-500",unselected:"border-gray-400 dark:border-gray-500"}},zh=e=>{const{data:t,isSelected:n}=e;return h.jsx(Ai.Option,{...e,children:h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("span",{className:`${Wt.checkbox.base} ${n?Wt.checkbox.selected:Wt.checkbox.unselected}`,children:n?"✓":""}),h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsxs("div",{className:"flex items-center gap-1",children:[h.jsx("span",{className:"text-[13px]",children:t.label}),t.count!==void 0&&t.count>0&&h.jsxs("span",{className:"text-gray-500 dark:text-gray-400 text-[10px]",children:["(",t.count,")"]})]}),t.description&&h.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 truncate",children:t.description})]})]})})},Vh=e=>h.jsx(Ai.GroupHeading,{...e,children:h.jsx("div",{className:"px-3 py-1.5 text-xs font-medium text-gray-500 dark:text-gray-400 bg-gray-50 dark:bg-gray-800/50 border-b border-gray-200 dark:border-gray-700",children:e.data.label})}),qC=e=>{const{data:t}=e;return h.jsxs(Ai.MultiValueLabel,{...e,children:[h.jsx("span",{children:t.label}),t.count!==void 0&&t.count>0&&h.jsxs("span",{className:"text-xs opacity-60 ml-1",children:["(",t.count,")"]})]})},ZC=({value:e,options:t=[],onChange:n,creatable:r=!1,placeholder:s="검색 또는 입력...",noOptionsMessage:o="검색 결과가 없습니다",formatCreateLabel:i,createLabelSuffix:a="추가",maxItems:l,disabled:c=!1,onBeforeRemove:d,onCreateOption:u,className:f="",tagVariants:g,defaultVariant:m="blue",name:p,isMulti:y=!0,isClearable:b=!0,isSearchable:_=!0,delimiters:x=[","],splitOnPaste:M=!0,onInputChange:S,id:k,editorAttrs:N})=>{const C=c===!0||c==="true",w=v.useCallback(ee=>ee==null?[]:Array.isArray(ee)?ee:[ee],[]),[E,T]=v.useState(()=>w(e)),[P,L]=v.useState(""),F=v.useRef(void 0);v.useEffect(()=>{const ee=(ie,de)=>!ie&&!de?!0:!ie||!de||ie.length!==de.length?!1:ie.every((fe,be)=>fe===de[be]),me=w(e);ee(me,F.current)||(T(me),F.current=me)},[e,w]);const A=v.useMemo(()=>i?typeof i=="string"?ee=>`${i} "${ee}"`:i:ee=>h.jsxs("span",{className:"text-[13px]",children:[h.jsx("strong",{children:ee})," ",a]}),[i,a]),D=v.useMemo(()=>!E||!Array.isArray(E)?[]:E.map(ee=>t.find(ie=>ie.value===ee)||{value:ee,label:String(ee)}).filter(ee=>ee!==void 0),[E,t]),O=v.useMemo(()=>{const ee=new Set(t.map(Ce=>Ce.value)),me=E?E.filter(Ce=>!ee.has(Ce)).map(Ce=>({value:Ce,label:String(Ce)})):[],ie=[...t,...me];if(!ie.some(Ce=>Ce.group))return ie;const fe=new Map,be=[];ie.forEach(Ce=>{if(Ce.group){const je=fe.get(Ce.group)||[];je.push(Ce),fe.set(Ce.group,je)}else be.push(Ce)});const ge=[];return fe.forEach((Ce,je)=>{ge.push({label:je,options:Ce})}),be.length>0&&ge.push({label:"",options:be}),ge},[t,E]),z=v.useCallback(ee=>({target:{value:ee},currentTarget:{value:ee},preventDefault:()=>{},stopPropagation:()=>{}}),[]),U=v.useCallback(ee=>{if(!x?.length)return[ee.trim()].filter(Boolean);const me=x.map(de=>de.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),ie=new RegExp(`[${me.join("")}]`);return ee.split(ie).map(de=>de.trim()).filter(Boolean)},[x]),j=v.useCallback((ee,me)=>{if(me.action!=="input-change"){L(ee);return}if(S&&S(z(ee)),!x?.some(be=>ee.includes(be))||!r||!y){L(ee);return}const fe=U(ee).filter(be=>be&&!E.includes(be));if(fe.length>0){const be=l?l-E.length:1/0,ge=fe.slice(0,be);if(ge.length>0){const Ce=[...E,...ge];T(Ce),n(z(Ce))}}L("")},[x,r,y,U,E,l,n,z,S]),Y=v.useCallback(ee=>{if(!M||!r||!y)return;const me=ee.clipboardData.getData("text"),ie=U(me);if(ie.length<=1)return;ee.preventDefault();const de=ie.filter(fe=>fe&&!E.includes(fe));if(de.length>0){const fe=l?l-E.length:1/0,be=de.slice(0,fe);if(be.length>0){const ge=[...E,...be];T(ge),n(z(ge))}}},[M,r,y,U,E,l,n,z]),B=v.useCallback((ee,me)=>{if((me.action==="remove-value"||me.action==="pop-value")&&me.removedValue&&d){const de=d(me.removedValue);if(de!==!0){const fe=typeof de=="string"?de:`"${me.removedValue.label}"은(는) 제거할 수 없습니다.`;alert(fe);return}}if(l&&ee.length>l)return;const ie=ee.map(de=>de.value);T(ie),n(z(ie))},[n,d,l,z]),W=v.useCallback((ee,me)=>{if(me.action==="clear"&&E.length>0&&d){const fe=t.find(ge=>ge.value===E[0])||{value:E[0],label:String(E[0])},be=d(fe);if(be!==!0){const ge=typeof be=="string"?be:`"${fe.label}"은(는) 제거할 수 없습니다.`;alert(ge);return}}const ie=ee?ee.value:null,de=ee?[ee.value]:[];T(de),n(z(ie))},[n,d,E,t,z]),G=v.useCallback(ee=>{u&&u(ee);const me=[...E||[],ee];T(me),n(z(me))},[n,u,E,z]),V=v.useCallback(ee=>!ee||!ee.trim()?!1:!E?.includes(ee.trim()),[E]),X=v.useCallback(ee=>{const me=P.trim();if(ee.key==="Tab"&&r&&y&&me){if(E.includes(me))ee.preventDefault(),L("");else if(!l||E.lengthg&&g[ee]?g[ee]:m,[g,m]),Q={control:()=>`${Wt.control} ${f} ${C?"opacity-60 cursor-not-allowed":""}`,valueContainer:()=>Wt.valueContainer,multiValue:ee=>{const me=K(ee.data.value);return Wt.multiValue[me]},multiValueLabel:ee=>{const me=K(ee.data.value);return Wt.multiValueLabel[me]},multiValueRemove:ee=>{const me=K(ee.data.value);return`${Wt.multiValueRemove[me]} ${C?"pointer-events-none":""}`},singleValue:()=>"text-gray-900 dark:text-white text-sm",input:()=>Wt.input,placeholder:()=>Wt.placeholder,menu:()=>Wt.menu,menuList:()=>Wt.menuList,menuPortal:()=>"z-[9999]",option:ee=>`${Wt.option.base} ${ee.isSelected?Wt.option.selected:ee.isFocused?Wt.option.focused:Wt.option.default}`,noOptionsMessage:()=>Wt.noOptionsMessage,clearIndicator:()=>"text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 cursor-pointer px-1",dropdownIndicator:()=>"text-gray-400 dark:text-gray-500 px-1"},ne={options:O,onKeyDown:X,placeholder:s,noOptionsMessage:()=>o,isDisabled:C,isSearchable:_,menuIsOpen:void 0,openMenuOnClick:!0,openMenuOnFocus:!0,menuPortalTarget:typeof document<"u"?document.body:null,menuPosition:"fixed",classNamePrefix:"tag-input",unstyled:!0,classNames:Q,styles:{menuPortal:ee=>({...ee,zIndex:9999})},...r&&y||S?{inputValue:P,onInputChange:j}:{}},se=y?E.join(","):E[0]??"";if(!y){const ee={...ne,isMulti:!1,value:D[0]||null,onChange:W,isClearable:b,closeMenuOnSelect:!0,components:{Option:zh,GroupHeading:Vh,IndicatorSeparator:()=>null,...b?{}:{ClearIndicator:()=>null}}};return r?h.jsxs(I,{id:k,...N,children:[p&&h.jsx("input",{type:"hidden",name:p,value:se}),h.jsx(Fh,{...ee,onCreateOption:G,formatCreateLabel:A,isValidNewOption:V,createOptionPosition:"first"})]}):h.jsxs(I,{id:k,...N,children:[p&&h.jsx("input",{type:"hidden",name:p,value:se}),h.jsx(Ph,{...ee})]})}const ue={...ne,isMulti:!0,value:D,onChange:B,closeMenuOnSelect:!1,hideSelectedOptions:!1,backspaceRemovesValue:!1,isClearable:!1,components:{Option:zh,GroupHeading:Vh,MultiValueLabel:qC,ClearIndicator:()=>null,DropdownIndicator:()=>null,IndicatorSeparator:()=>null}};return r?h.jsxs(I,{id:k,...N,onPaste:Y,children:[p&&h.jsx("input",{type:"hidden",name:p,value:se}),h.jsx(Fh,{...ue,onCreateOption:G,formatCreateLabel:A,isValidNewOption:V,createOptionPosition:"first"})]}):h.jsxs(I,{id:k,...N,children:[p&&h.jsx("input",{type:"hidden",name:p,value:se}),h.jsx(Ph,{...ue})]})},ds=(e,t)=>window.G7Core?.t?.(e,t)??e,QC=()=>window.G7Core?.locale?.supported?.()??["ko","en"],JC=()=>window.G7Core?.locale?.current?.()??"ko",dc=e=>{const t=ds(`common.language_${e}`);return t===`common.language_${e}`?{ko:"한국어",en:"English",ja:"日本語",zh:"中文"}[e]||e.toUpperCase():t},RC=({value:e=[],onChange:t,placeholder:n="입력 후 Enter",disabled:r=!1,creatable:s=!0,delimiters:o=[","],className:i="",name:a,error:l,maxItems:c,modalId:d,statePath:u,__componentContext:f,id:g,editorAttrs:m})=>{const p=v.useMemo(()=>QC(),[]),y=v.useMemo(()=>JC(),[]),[b,_]=v.useState(()=>e||[]),[x,M]=v.useState(""),[S,k]=v.useState(!1),[N,C]=v.useState(null),[w,E]=v.useState({}),T=v.useRef(null),P=v.useRef(void 0);v.useEffect(()=>{const V=(K,Q)=>!K&&!Q?!0:!K||!Q||K.length!==Q.length?!1:JSON.stringify(K)===JSON.stringify(Q),X=e||[];V(X,P.current)||(_(X),P.current=X)},[e]);const L=v.useCallback(V=>({target:{name:a,value:V},currentTarget:{name:a,value:V},preventDefault:()=>{},stopPropagation:()=>{}}),[a]),F=v.useCallback(V=>{const X=[];for(const K of p){const Q=V[K];Q?.trim()&&X.push(`${K.toUpperCase()}: ${Q}`)}return X.length>0?X.join(" / "):""},[p]),A=v.useCallback(V=>{const X=b.filter((K,Q)=>Q!==V);_(X),t?.(L(X))},[b,t,L]),D=v.useCallback((V,X,K)=>{const Q=window.G7Core;if(!Q?.dispatch)return;const ne=p.map(se=>({code:se,label:dc(se)}));Q.dispatch({handler:"setState",params:{target:"global",multilingualTagEdit:{fieldName:a,editingIndex:V,values:X,supportedLocales:ne,defaultLocale:y,statePath:u,currentTags:K}}}),Q.dispatch({handler:"openModal",target:d},{componentContext:f})},[a,p,y,d,u,f]),O=v.useCallback(V=>{r||(d?D(V,{...b[V]},b):(C(V),E({...b[V]}),k(!0)))},[r,b,d,D]),z=v.useCallback((V="")=>{const X={};p.forEach(K=>{X[K]=K===y?V:""}),d?(D(null,X,b),M("")):(C(null),E(X),k(!0),M(""))},[p,y,d,D,b]),U=v.useCallback(()=>{if(!Object.values(w).some(K=>K.trim()!=="")){k(!1);return}let X;N!==null?X=b.map((K,Q)=>Q===N?w:K):X=[...b,w],_(X),t?.(L(X)),k(!1),E({}),C(null)},[w,N,b,t,L]),j=v.useCallback(()=>{k(!1),E({}),C(null)},[]),Y=v.useCallback(V=>{const X=V.target.value;if(o.some(Q=>X.includes(Q))&&s){const Q=o.map(ue=>ue.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),ne=new RegExp(`[${Q.join("")}]`),se=X.split(ne).map(ue=>ue.trim()).filter(Boolean);if(se.length>0){z(se[0]);return}}M(X)},[o,s,z]),B=v.useCallback(V=>{if(V.key==="Enter"&&x.trim()&&s){if(V.preventDefault(),c&&b.length>=c)return;z(x.trim())}},[x,s,c,b.length,z]),W=v.useCallback((V,X)=>{E(K=>({...K,[V]:X}))},[]),G=!!l;return h.jsxs(I,{className:i,id:g,...m,children:[h.jsxs(I,{className:`flex flex-wrap gap-1.5 p-2 border rounded-lg bg-white dark:bg-gray-700 min-h-[42px] ${G?"border-red-500 dark:border-red-400":"border-gray-300 dark:border-gray-600 focus-within:ring-2 focus-within:ring-blue-500 focus-within:border-blue-500"} ${r?"opacity-60 bg-gray-100 dark:bg-gray-800 cursor-not-allowed":""}`,children:[b.map((V,X)=>h.jsxs(I,{className:"flex items-center gap-1 bg-blue-100 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300 rounded px-2 py-0.5 text-sm",children:[h.jsx(J,{className:`cursor-pointer hover:underline ${r?"cursor-not-allowed":""}`,onClick:()=>O(X),children:F(V)}),!r&&h.jsx(le,{type:"button",className:"p-0 h-4 w-4 min-w-0 border-0 bg-transparent text-blue-600 dark:text-blue-400 hover:text-red-600 dark:hover:text-red-400 hover:bg-transparent",onClick:K=>{K.stopPropagation(),A(X)},children:h.jsx(ae,{name:"times",className:"text-xs"})})]},X)),s&&!r&&(!c||b.lengthh.jsxs(I,{className:"space-y-1",children:[h.jsxs(I,{className:"flex items-center gap-2",children:[h.jsx(J,{className:"text-sm font-medium text-gray-700 dark:text-gray-300 w-16",children:dc(V)}),h.jsxs(J,{className:"text-xs text-gray-400 dark:text-gray-500",children:["(",V.toUpperCase(),")"]})]}),h.jsx(Et,{type:"text",value:w[V]??"",onChange:X=>W(V,X.target.value),placeholder:`${dc(V)} 값 입력`,className:"w-full",autoFocus:V===y})]},V)),h.jsxs(I,{className:"flex justify-end gap-2 pt-4 border-t border-gray-200 dark:border-gray-700",children:[h.jsx(le,{type:"button",variant:"secondary",onClick:j,children:ds("common.cancel")}),h.jsx(le,{type:"button",variant:"primary",onClick:U,children:ds(N!==null?"common.save":"common.add")})]})]})}),a&&h.jsx("input",{type:"hidden",name:a,value:JSON.stringify(b)})]})},Hh=(e,t)=>window.G7Core?.t?.(e,t)??e,Uh=({type:e,identifier:t,name:n,installedModules:r=[],installedPlugins:s=[],className:o="",style:i,id:a,editorAttrs:l})=>{const c={module:he.Cubes,plugin:he.PuzzlePiece},d={module:Hh("common.module"),plugin:Hh("common.plugin")},u=v.useMemo(()=>{if(n)return n;if(t){const p=(e==="module"?r:s)?.find(y=>y.identifier===t);if(p)return p.name}},[n,t,e,r,s]),f=c[e],g=u?`${u} ${d[e]}`:d[e];return h.jsxs(J,{className:`inline-flex items-center gap-1.5 px-2 py-1 rounded text-xs font-medium text-gray-400 dark:text-gray-500 ${o}`,style:i,id:a,...l,children:[h.jsx(ae,{name:f,className:"w-3.5 h-3.5"}),h.jsx(J,{children:g})]})},eS=({options:e=[],value:t,onChange:n,multiple:r=!1,searchPlaceholder:s="Search...",onSearch:o,noResultsText:i="No results found",initialText:a="Type to search",triggerLabel:l="Select",triggerIcon:c,disabled:d=!1,className:u="",id:f,editorAttrs:g})=>{const[m,p]=v.useState(!1),[y,b]=v.useState(""),_=v.useRef(null),x=v.useRef(null),M=v.useRef(`searchable-dropdown-input-${Math.random().toString(36).slice(2,9)}`).current,S=v.useMemo(()=>t==null?[]:Array.isArray(t)?t:[t],[t]),k=v.useMemo(()=>{if(!y.trim())return e;const A=y.toLowerCase();return e.filter(D=>D.label.toLowerCase().includes(A)||D.description?.toLowerCase().includes(A))},[e,y]),N=v.useMemo(()=>{if(S.length===0)return l;if(r){const D=S.length;return D===1?e.find(z=>String(z.value)===String(S[0]))?.label||l:`${D} selected`}return e.find(D=>String(D.value)===String(S[0]))?.label||l},[S,e,r,l]);v.useEffect(()=>{const A=D=>{_.current&&!_.current.contains(D.target)&&p(!1)};return m&&document.addEventListener("mousedown",A),()=>{document.removeEventListener("mousedown",A)}},[m]),v.useEffect(()=>{const A=D=>{D.key==="Escape"&&m&&(p(!1),x.current?.focus())};return document.addEventListener("keydown",A),()=>document.removeEventListener("keydown",A)},[m]),v.useEffect(()=>{if(!m){b("");return}const A=setTimeout(()=>{document.getElementById(M)?.focus()},50);return()=>{clearTimeout(A)}},[m,M]);const C=v.useCallback(()=>{d||p(A=>!A)},[d]),w=v.useCallback(A=>{const D=A.target.value;b(D),o?.(D)},[o]),E=v.useCallback(A=>{if(r){const O=S.some(z=>String(z)===String(A))?S.filter(z=>String(z)!==String(A)):[...S,A];n?.(O)}else n?.(A),p(!1),x.current?.focus()},[r,S,n]),T=A=>S.some(D=>String(D)===String(A)),P=y.length===0&&e.length===0,L=y.length>0&&k.length===0,F=k.length>0;return h.jsxs(I,{ref:_,className:`relative inline-block ${u}`,id:f,...g,children:[h.jsxs(le,{ref:x,type:"button",onClick:C,disabled:d,className:` px-4 py-2.5 bg-gray-100 dark:bg-gray-700 border-0 rounded-xl text-gray-700 dark:text-gray-200 font-medium @@ -188,27 +189,27 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho text-left cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed min-w-[200px] - `,"aria-haspopup":"listbox","aria-expanded":m,children:[h.jsxs(I,{className:"flex items-center gap-2",children:[c,h.jsx(Q,{className:"truncate",children:N})]}),h.jsx(Wn,{className:`w-4 h-4 flex-shrink-0 transition-transform duration-200 ${m?"rotate-180":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),m&&h.jsxs(I,{className:"absolute z-50 w-full mt-2 bg-white dark:bg-gray-800 rounded-2xl shadow-lg border border-gray-200 dark:border-gray-600 overflow-hidden min-w-[280px]",role:"listbox",children:[h.jsx(I,{className:"p-3 border-b border-gray-200 dark:border-gray-700",children:h.jsx("input",{id:E,type:"text",value:y,onChange:k,placeholder:s,className:"w-full px-3 py-2 bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600 rounded-lg text-gray-900 dark:text-white placeholder-gray-400 dark:placeholder-gray-500 focus:ring-2 focus:ring-blue-500 focus:border-transparent focus:outline-none"})}),h.jsxs(I,{className:"max-h-80 overflow-auto",children:[L&&h.jsx(I,{className:"px-4 py-6 text-center text-gray-500 dark:text-gray-400",children:a}),P&&h.jsx(I,{className:"px-4 py-6 text-center text-gray-500 dark:text-gray-400",children:i}),F&&h.jsx(I,{className:"py-2",children:w.map(D=>{const A=T(D.value);return h.jsxs(oe,{type:"button",onClick:()=>!D.disabled&&M(D.value),disabled:D.disabled,className:` + `,"aria-haspopup":"listbox","aria-expanded":m,children:[h.jsxs(I,{className:"flex items-center gap-2",children:[c,h.jsx(J,{className:"truncate",children:N})]}),h.jsx(Jn,{className:`w-4 h-4 flex-shrink-0 transition-transform duration-200 ${m?"rotate-180":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),m&&h.jsxs(I,{className:"absolute z-50 w-full mt-2 bg-white dark:bg-gray-800 rounded-2xl shadow-lg border border-gray-200 dark:border-gray-600 overflow-hidden min-w-[280px]",role:"listbox",children:[h.jsx(I,{className:"p-3 border-b border-gray-200 dark:border-gray-700",children:h.jsx("input",{id:M,type:"text",value:y,onChange:w,placeholder:s,className:"w-full px-3 py-2 bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600 rounded-lg text-gray-900 dark:text-white placeholder-gray-400 dark:placeholder-gray-500 focus:ring-2 focus:ring-blue-500 focus:border-transparent focus:outline-none"})}),h.jsxs(I,{className:"max-h-80 overflow-auto",children:[P&&h.jsx(I,{className:"px-4 py-6 text-center text-gray-500 dark:text-gray-400",children:a}),L&&h.jsx(I,{className:"px-4 py-6 text-center text-gray-500 dark:text-gray-400",children:i}),F&&h.jsx(I,{className:"py-2",children:k.map(A=>{const D=T(A.value);return h.jsxs(le,{type:"button",onClick:()=>!A.disabled&&E(A.value),disabled:A.disabled,className:` w-full px-4 py-3 text-left flex items-start gap-3 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors - ${D.disabled?"opacity-50 cursor-not-allowed":"cursor-pointer"} - `,role:"option","aria-selected":A,children:[h.jsx(I,{className:"w-5 h-5 flex-shrink-0 mt-0.5",children:A&&h.jsx(Wn,{className:"w-5 h-5 text-blue-600 dark:text-blue-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),h.jsxs(I,{className:"flex-1 min-w-0",children:[h.jsx(I,{className:`font-medium ${A?"text-blue-600 dark:text-blue-400":"text-gray-900 dark:text-white"}`,children:D.label}),D.description&&h.jsx(I,{className:"text-sm text-gray-500 dark:text-gray-400 mt-0.5",children:D.description})]})]},D.value)})})]})]})]})},Bs={container:{base:"tag-select",disabled:"opacity-50 cursor-not-allowed"},tag:"tag",tagRemove:"tag-remove",placeholder:"tag-select-placeholder"},Jk=({options:e=[],value:t=[],onChange:n,placeholder:r="No items selected",disabled:s=!1,className:o="",id:i,editorAttrs:a})=>{const l=v.useCallback(f=>e.find(m=>String(m.value)===String(f))?.label||String(f),[e]),c=v.useCallback(f=>{if(s)return;const g=t.filter(m=>String(m)!==String(f));n?.(g)},[t,n,s]),d=v.useMemo(()=>t.map(f=>({value:f,label:l(f)})),[t,l]),u=`${Bs.container.base} ${s?Bs.container.disabled:""} ${o}`.trim();return h.jsx(I,{className:u,id:i,...a,children:d.length===0?h.jsx(Q,{className:Bs.placeholder,children:r}):d.map(f=>h.jsxs(Q,{className:Bs.tag,children:[f.label,!s&&h.jsx(Q,{className:Bs.tagRemove,onClick:()=>c(f.value),role:"button","aria-label":`Remove ${f.label}`,children:h.jsx(Wn,{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]},f.value))})};function Rk(){for(var e=arguments.length,t=new Array(e),n=0;nr=>{t.forEach(s=>s(r))},t)}const vi=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Qr(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function jl(e){return"nodeType"in e}function qt(e){var t,n;return e?Qr(e)?e:jl(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function Wl(e){const{Document:t}=qt(e);return e instanceof t}function js(e){return Qr(e)?!1:e instanceof qt(e).HTMLElement}function lh(e){return e instanceof qt(e).SVGElement}function Jr(e){return e?Qr(e)?e.document:jl(e)?Wl(e)?e:js(e)||lh(e)?e.ownerDocument:document:document:document}const _n=vi?v.useLayoutEffect:v.useEffect;function xi(e){const t=v.useRef(e);return _n(()=>{t.current=e}),v.useCallback(function(){for(var n=arguments.length,r=new Array(n),s=0;s{e.current=setInterval(r,s)},[]),n=v.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function Ws(e,t){t===void 0&&(t=[e]);const n=v.useRef(e);return _n(()=>{n.current!==e&&(n.current=e)},t),n}function Gs(e,t){const n=v.useRef();return v.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function wi(e){const t=xi(e),n=v.useRef(null),r=v.useCallback(s=>{s!==n.current&&t?.(s,n.current),n.current=s},[]);return[n,r]}function ki(e){const t=v.useRef();return v.useEffect(()=>{t.current=e},[e]),t.current}let Gl={};function Ys(e,t){return v.useMemo(()=>{if(t)return t;const n=Gl[e]==null?0:Gl[e]+1;return Gl[e]=n,e+"-"+n},[e,t])}function ch(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),s=1;s{const a=Object.entries(i);for(const[l,c]of a){const d=o[l];d!=null&&(o[l]=d+e*c)}return o},{...t})}}const Rr=ch(1),Ks=ch(-1);function tC(e){return"clientX"in e&&"clientY"in e}function Ci(e){if(!e)return!1;const{KeyboardEvent:t}=qt(e.target);return t&&e instanceof t}function nC(e){if(!e)return!1;const{TouchEvent:t}=qt(e.target);return t&&e instanceof t}function Si(e){if(nC(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return tC(e)?{x:e.clientX,y:e.clientY}:null}const Fn=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[Fn.Translate.toString(e),Fn.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),dh="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function rC(e){return e.matches(dh)?e:e.querySelector(dh)}const sC={display:"none"};function oC(e){let{id:t,value:n}=e;return v.createElement("div",{id:t,style:sC},n)}function iC(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const s={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return v.createElement("div",{id:t,style:s,role:"status","aria-live":r,"aria-atomic":!0},n)}function aC(){const[e,t]=v.useState("");return{announce:v.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const uh=v.createContext(null);function lC(e){const t=v.useContext(uh);v.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of ");return t(e)},[e,t])}function cC(){const[e]=v.useState(()=>new Set),t=v.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[v.useCallback(r=>{let{type:s,event:o}=r;e.forEach(i=>{var a;return(a=i[s])==null?void 0:a.call(i,o)})},[e]),t]}const dC={draggable:` + ${A.disabled?"opacity-50 cursor-not-allowed":"cursor-pointer"} + `,role:"option","aria-selected":D,children:[h.jsx(I,{className:"w-5 h-5 flex-shrink-0 mt-0.5",children:D&&h.jsx(Jn,{className:"w-5 h-5 text-blue-600 dark:text-blue-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),h.jsxs(I,{className:"flex-1 min-w-0",children:[h.jsx(I,{className:`font-medium ${D?"text-blue-600 dark:text-blue-400":"text-gray-900 dark:text-white"}`,children:A.label}),A.description&&h.jsx(I,{className:"text-sm text-gray-500 dark:text-gray-400 mt-0.5",children:A.description})]})]},A.value)})})]})]})]})},ro={container:{base:"tag-select",disabled:"opacity-50 cursor-not-allowed"},tag:"tag",tagRemove:"tag-remove",placeholder:"tag-select-placeholder"},tS=({options:e=[],value:t=[],onChange:n,placeholder:r="No items selected",disabled:s=!1,className:o="",id:i,editorAttrs:a})=>{const l=v.useCallback(f=>e.find(m=>String(m.value)===String(f))?.label||String(f),[e]),c=v.useCallback(f=>{if(s)return;const g=t.filter(m=>String(m)!==String(f));n?.(g)},[t,n,s]),d=v.useMemo(()=>t.map(f=>({value:f,label:l(f)})),[t,l]),u=`${ro.container.base} ${s?ro.container.disabled:""} ${o}`.trim();return h.jsx(I,{className:u,id:i,...a,children:d.length===0?h.jsx(J,{className:ro.placeholder,children:r}):d.map(f=>h.jsxs(J,{className:ro.tag,children:[f.label,!s&&h.jsx(J,{className:ro.tagRemove,onClick:()=>c(f.value),role:"button","aria-label":`Remove ${f.label}`,children:h.jsx(Jn,{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]},f.value))})};function nS(){for(var e=arguments.length,t=new Array(e),n=0;nr=>{t.forEach(s=>s(r))},t)}const Li=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function us(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function uc(e){return"nodeType"in e}function en(e){var t,n;return e?us(e)?e:uc(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function fc(e){const{Document:t}=en(e);return e instanceof t}function so(e){return us(e)?!1:e instanceof en(e).HTMLElement}function Bh(e){return e instanceof en(e).SVGElement}function fs(e){return e?us(e)?e.document:uc(e)?fc(e)?e:so(e)||Bh(e)?e.ownerDocument:document:document:document}const An=Li?v.useLayoutEffect:v.useEffect;function Pi(e){const t=v.useRef(e);return An(()=>{t.current=e}),v.useCallback(function(){for(var n=arguments.length,r=new Array(n),s=0;s{e.current=setInterval(r,s)},[]),n=v.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function oo(e,t){t===void 0&&(t=[e]);const n=v.useRef(e);return An(()=>{n.current!==e&&(n.current=e)},t),n}function io(e,t){const n=v.useRef();return v.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function $i(e){const t=Pi(e),n=v.useRef(null),r=v.useCallback(s=>{s!==n.current&&t?.(s,n.current),n.current=s},[]);return[n,r]}function Fi(e){const t=v.useRef();return v.useEffect(()=>{t.current=e},[e]),t.current}let hc={};function ao(e,t){return v.useMemo(()=>{if(t)return t;const n=hc[e]==null?0:hc[e]+1;return hc[e]=n,e+"-"+n},[e,t])}function jh(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),s=1;s{const a=Object.entries(i);for(const[l,c]of a){const d=o[l];d!=null&&(o[l]=d+e*c)}return o},{...t})}}const hs=jh(1),lo=jh(-1);function sS(e){return"clientX"in e&&"clientY"in e}function zi(e){if(!e)return!1;const{KeyboardEvent:t}=en(e.target);return t&&e instanceof t}function oS(e){if(!e)return!1;const{TouchEvent:t}=en(e.target);return t&&e instanceof t}function Vi(e){if(oS(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return sS(e)?{x:e.clientX,y:e.clientY}:null}const Wn=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[Wn.Translate.toString(e),Wn.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),Wh="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function iS(e){return e.matches(Wh)?e:e.querySelector(Wh)}const aS={display:"none"};function lS(e){let{id:t,value:n}=e;return v.createElement("div",{id:t,style:aS},n)}function cS(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const s={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return v.createElement("div",{id:t,style:s,role:"status","aria-live":r,"aria-atomic":!0},n)}function dS(){const[e,t]=v.useState("");return{announce:v.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const Gh=v.createContext(null);function uS(e){const t=v.useContext(Gh);v.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of ");return t(e)},[e,t])}function fS(){const[e]=v.useState(()=>new Set),t=v.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[v.useCallback(r=>{let{type:s,event:o}=r;e.forEach(i=>{var a;return(a=i[s])==null?void 0:a.call(i,o)})},[e]),t]}const hS={draggable:` To pick up a draggable item, press the space bar. While dragging, use the arrow keys to move the item. Press space again to drop the item in its new position, or press escape to cancel. - `},uC={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function fC(e){let{announcements:t=uC,container:n,hiddenTextDescribedById:r,screenReaderInstructions:s=dC}=e;const{announce:o,announcement:i}=aC(),a=Ys("DndLiveRegion"),[l,c]=v.useState(!1);if(v.useEffect(()=>{c(!0)},[]),lC(v.useMemo(()=>({onDragStart(u){let{active:f}=u;o(t.onDragStart({active:f}))},onDragMove(u){let{active:f,over:g}=u;t.onDragMove&&o(t.onDragMove({active:f,over:g}))},onDragOver(u){let{active:f,over:g}=u;o(t.onDragOver({active:f,over:g}))},onDragEnd(u){let{active:f,over:g}=u;o(t.onDragEnd({active:f,over:g}))},onDragCancel(u){let{active:f,over:g}=u;o(t.onDragCancel({active:f,over:g}))}}),[o,t])),!l)return null;const d=v.createElement(v.Fragment,null,v.createElement(oC,{id:r,value:s.draggable}),v.createElement(iC,{id:a,announcement:i}));return n?Dn.createPortal(d,n):d}var Et;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(Et||(Et={}));function _i(){}function es(e,t){return v.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function Yl(){for(var e=arguments.length,t=new Array(e),n=0;n[...t].filter(r=>r!=null),[...t])}const En=Object.freeze({x:0,y:0});function fh(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function hC(e,t){const n=Si(e);if(!n)return"0 0";const r={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return r.x+"% "+r.y+"%"}function hh(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function gC(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function gh(e){let{left:t,top:n,height:r,width:s}=e;return[{x:t,y:n},{x:t+s,y:n},{x:t,y:n+r},{x:t+s,y:n+r}]}function ph(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function mh(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}const Kl=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const s=mh(t,t.left,t.top),o=[];for(const i of r){const{id:a}=i,l=n.get(a);if(l){const c=fh(mh(l),s);o.push({id:a,data:{droppableContainer:i,value:c}})}}return o.sort(hh)},pC=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const s=gh(t),o=[];for(const i of r){const{id:a}=i,l=n.get(a);if(l){const c=gh(l),d=s.reduce((f,g,m)=>f+fh(c[m],g),0),u=Number((d/4).toFixed(4));o.push({id:a,data:{droppableContainer:i,value:u}})}}return o.sort(hh)};function mC(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),s=Math.min(t.left+t.width,e.left+e.width),o=Math.min(t.top+t.height,e.top+e.height),i=s-r,a=o-n;if(r{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const s=[];for(const o of r){const{id:i}=o,a=n.get(i);if(a){const l=mC(a,t);l>0&&s.push({id:i,data:{droppableContainer:o,value:l}})}}return s.sort(gC)};function yC(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function bh(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:En}function vC(e){return function(n){for(var r=arguments.length,s=new Array(r>1?r-1:0),o=1;o({...i,top:i.top+e*a.y,bottom:i.bottom+e*a.y,left:i.left+e*a.x,right:i.right+e*a.x}),{...n})}}const xC=vC(1);function yh(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function wC(e,t,n){const r=yh(t);if(!r)return e;const{scaleX:s,scaleY:o,x:i,y:a}=r,l=e.left-i-(1-s)*parseFloat(n),c=e.top-a-(1-o)*parseFloat(n.slice(n.indexOf(" ")+1)),d=s?e.width/s:e.width,u=o?e.height/o:e.height;return{width:d,height:u,top:c,right:l+d,bottom:c+u,left:l}}const kC={ignoreTransform:!1};function ts(e,t){t===void 0&&(t=kC);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:c,transformOrigin:d}=qt(e).getComputedStyle(e);c&&(n=wC(n,c,d))}const{top:r,left:s,width:o,height:i,bottom:a,right:l}=n;return{top:r,left:s,width:o,height:i,bottom:a,right:l}}function vh(e){return ts(e,{ignoreTransform:!0})}function CC(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function SC(e,t){return t===void 0&&(t=qt(e).getComputedStyle(e)),t.position==="fixed"}function _C(e,t){t===void 0&&(t=qt(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(s=>{const o=t[s];return typeof o=="string"?n.test(o):!1})}function Ei(e,t){const n=[];function r(s){if(t!=null&&n.length>=t||!s)return n;if(Wl(s)&&s.scrollingElement!=null&&!n.includes(s.scrollingElement))return n.push(s.scrollingElement),n;if(!js(s)||lh(s)||n.includes(s))return n;const o=qt(e).getComputedStyle(s);return s!==e&&_C(s,o)&&n.push(s),SC(s,o)?n:r(s.parentNode)}return e?r(e):n}function xh(e){const[t]=Ei(e,1);return t??null}function Xl(e){return!vi||!e?null:Qr(e)?e:jl(e)?Wl(e)||e===Jr(e).scrollingElement?window:js(e)?e:null:null}function wh(e){return Qr(e)?e.scrollX:e.scrollLeft}function kh(e){return Qr(e)?e.scrollY:e.scrollTop}function ql(e){return{x:wh(e),y:kh(e)}}var At;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(At||(At={}));function Ch(e){return!vi||!e?!1:e===document.scrollingElement}function Sh(e){const t={x:0,y:0},n=Ch(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},s=e.scrollTop<=t.y,o=e.scrollLeft<=t.x,i=e.scrollTop>=r.y,a=e.scrollLeft>=r.x;return{isTop:s,isLeft:o,isBottom:i,isRight:a,maxScroll:r,minScroll:t}}const EC={x:.2,y:.2};function MC(e,t,n,r,s){let{top:o,left:i,right:a,bottom:l}=n;r===void 0&&(r=10),s===void 0&&(s=EC);const{isTop:c,isBottom:d,isLeft:u,isRight:f}=Sh(e),g={x:0,y:0},m={x:0,y:0},p={height:t.height*s.y,width:t.width*s.x};return!c&&o<=t.top+p.height?(g.y=At.Backward,m.y=r*Math.abs((t.top+p.height-o)/p.height)):!d&&l>=t.bottom-p.height&&(g.y=At.Forward,m.y=r*Math.abs((t.bottom-p.height-l)/p.height)),!f&&a>=t.right-p.width?(g.x=At.Forward,m.x=r*Math.abs((t.right-p.width-a)/p.width)):!u&&i<=t.left+p.width&&(g.x=At.Backward,m.x=r*Math.abs((t.left+p.width-i)/p.width)),{direction:g,speed:m}}function NC(e){if(e===document.scrollingElement){const{innerWidth:o,innerHeight:i}=window;return{top:0,left:0,right:o,bottom:i,width:o,height:i}}const{top:t,left:n,right:r,bottom:s}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:s,width:e.clientWidth,height:e.clientHeight}}function _h(e){return e.reduce((t,n)=>Rr(t,ql(n)),En)}function OC(e){return e.reduce((t,n)=>t+wh(n),0)}function TC(e){return e.reduce((t,n)=>t+kh(n),0)}function Eh(e,t){if(t===void 0&&(t=ts),!e)return;const{top:n,left:r,bottom:s,right:o}=t(e);xh(e)&&(s<=0||o<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const AC=[["x",["left","right"],OC],["y",["top","bottom"],TC]];class Zl{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=Ei(n),s=_h(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[o,i,a]of AC)for(const l of i)Object.defineProperty(this,l,{get:()=>{const c=a(r),d=s[o]-c;return this.rect[l]+d},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Xs{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var s;(s=this.target)==null||s.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function DC(e){const{EventTarget:t}=qt(e);return e instanceof t?e:Jr(e)}function Ql(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var fn;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(fn||(fn={}));function Mh(e){e.preventDefault()}function IC(e){e.stopPropagation()}var Ye;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(Ye||(Ye={}));const Nh={start:[Ye.Space,Ye.Enter],cancel:[Ye.Esc],end:[Ye.Space,Ye.Enter,Ye.Tab]},LC=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case Ye.Right:return{...n,x:n.x+25};case Ye.Left:return{...n,x:n.x-25};case Ye.Down:return{...n,y:n.y+25};case Ye.Up:return{...n,y:n.y-25}}};class qs{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new Xs(Jr(n)),this.windowListeners=new Xs(qt(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(fn.Resize,this.handleCancel),this.windowListeners.add(fn.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(fn.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&Eh(r),n(En)}handleKeyDown(t){if(Ci(t)){const{active:n,context:r,options:s}=this.props,{keyboardCodes:o=Nh,coordinateGetter:i=LC,scrollBehavior:a="smooth"}=s,{code:l}=t;if(o.end.includes(l)){this.handleEnd(t);return}if(o.cancel.includes(l)){this.handleCancel(t);return}const{collisionRect:c}=r.current,d=c?{x:c.left,y:c.top}:En;this.referenceCoordinates||(this.referenceCoordinates=d);const u=i(t,{active:n,context:r.current,currentCoordinates:d});if(u){const f=Ks(u,d),g={x:0,y:0},{scrollableAncestors:m}=r.current;for(const p of m){const y=t.code,{isTop:b,isRight:_,isLeft:x,isBottom:E,maxScroll:S,minScroll:w}=Sh(p),N=NC(p),C={x:Math.min(y===Ye.Right?N.right-N.width/2:N.right,Math.max(y===Ye.Right?N.left:N.left+N.width/2,u.x)),y:Math.min(y===Ye.Down?N.bottom-N.height/2:N.bottom,Math.max(y===Ye.Down?N.top:N.top+N.height/2,u.y))},k=y===Ye.Right&&!_||y===Ye.Left&&!x,M=y===Ye.Down&&!E||y===Ye.Up&&!b;if(k&&C.x!==u.x){const T=p.scrollLeft+f.x,L=y===Ye.Right&&T<=S.x||y===Ye.Left&&T>=w.x;if(L&&!f.y){p.scrollTo({left:T,behavior:a});return}L?g.x=p.scrollLeft-T:g.x=y===Ye.Right?p.scrollLeft-S.x:p.scrollLeft-w.x,g.x&&p.scrollBy({left:-g.x,behavior:a});break}else if(M&&C.y!==u.y){const T=p.scrollTop+f.y,L=y===Ye.Down&&T<=S.y||y===Ye.Up&&T>=w.y;if(L&&!f.x){p.scrollTo({top:T,behavior:a});return}L?g.y=p.scrollTop-T:g.y=y===Ye.Down?p.scrollTop-S.y:p.scrollTop-w.y,g.y&&p.scrollBy({top:-g.y,behavior:a});break}}this.handleMove(t,Rr(Ks(u,this.referenceCoordinates),g))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}qs.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=Nh,onActivation:s}=t,{active:o}=n;const{code:i}=e.nativeEvent;if(r.start.includes(i)){const a=o.activatorNode.current;return a&&e.target!==a?!1:(e.preventDefault(),s?.({event:e.nativeEvent}),!0)}return!1}}];function Oh(e){return!!(e&&"distance"in e)}function Th(e){return!!(e&&"delay"in e)}class Jl{constructor(t,n,r){var s;r===void 0&&(r=DC(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:o}=t,{target:i}=o;this.props=t,this.events=n,this.document=Jr(i),this.documentListeners=new Xs(this.document),this.listeners=new Xs(r),this.windowListeners=new Xs(qt(i)),this.initialCoordinates=(s=Si(o))!=null?s:En,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(fn.Resize,this.handleCancel),this.windowListeners.add(fn.DragStart,Mh),this.windowListeners.add(fn.VisibilityChange,this.handleCancel),this.windowListeners.add(fn.ContextMenu,Mh),this.documentListeners.add(fn.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Th(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(Oh(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:r,onPending:s}=this.props;s(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(fn.Click,IC,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(fn.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:s,props:o}=this,{onMove:i,options:{activationConstraint:a}}=o;if(!s)return;const l=(n=Si(t))!=null?n:En,c=Ks(s,l);if(!r&&a){if(Oh(a)){if(a.tolerance!=null&&Ql(c,a.tolerance))return this.handleCancel();if(Ql(c,a.distance))return this.handleStart()}if(Th(a)&&Ql(c,a.tolerance))return this.handleCancel();this.handlePending(a,c);return}t.cancelable&&t.preventDefault(),i(l)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===Ye.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const PC={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Zs extends Jl{constructor(t){const{event:n}=t,r=Jr(n.target);super(t,PC,r)}}Zs.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];const $C={move:{name:"mousemove"},end:{name:"mouseup"}};var Rl;(function(e){e[e.RightClick=2]="RightClick"})(Rl||(Rl={}));class FC extends Jl{constructor(t){super(t,$C,Jr(t.event.target))}}FC.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===Rl.RightClick?!1:(r?.({event:n}),!0)}}];const ec={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class VC extends Jl{constructor(t){super(t,ec)}static setup(){return window.addEventListener(ec.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(ec.move.name,t)};function t(){}}}VC.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:s}=n;return s.length>1?!1:(r?.({event:n}),!0)}}];var Qs;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Qs||(Qs={}));var Mi;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Mi||(Mi={}));function zC(e){let{acceleration:t,activator:n=Qs.Pointer,canScroll:r,draggingRect:s,enabled:o,interval:i=5,order:a=Mi.TreeOrder,pointerCoordinates:l,scrollableAncestors:c,scrollableAncestorRects:d,delta:u,threshold:f}=e;const g=UC({delta:u,disabled:!o}),[m,p]=eC(),y=v.useRef({x:0,y:0}),b=v.useRef({x:0,y:0}),_=v.useMemo(()=>{switch(n){case Qs.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case Qs.DraggableRect:return s}},[n,s,l]),x=v.useRef(null),E=v.useCallback(()=>{const w=x.current;if(!w)return;const N=y.current.x*b.current.x,C=y.current.y*b.current.y;w.scrollBy(N,C)},[]),S=v.useMemo(()=>a===Mi.TreeOrder?[...c].reverse():c,[a,c]);v.useEffect(()=>{if(!o||!c.length||!_){p();return}for(const w of S){if(r?.(w)===!1)continue;const N=c.indexOf(w),C=d[N];if(!C)continue;const{direction:k,speed:M}=MC(w,C,_,t,f);for(const T of["x","y"])g[T][k[T]]||(M[T]=0,k[T]=0);if(M.x>0||M.y>0){p(),x.current=w,m(E,i),y.current=M,b.current=k;return}}y.current={x:0,y:0},b.current={x:0,y:0},p()},[t,E,r,p,o,i,JSON.stringify(_),JSON.stringify(g),m,c,S,d,JSON.stringify(f)])}const HC={x:{[At.Backward]:!1,[At.Forward]:!1},y:{[At.Backward]:!1,[At.Forward]:!1}};function UC(e){let{delta:t,disabled:n}=e;const r=ki(t);return Gs(s=>{if(n||!r||!s)return HC;const o={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[At.Backward]:s.x[At.Backward]||o.x===-1,[At.Forward]:s.x[At.Forward]||o.x===1},y:{[At.Backward]:s.y[At.Backward]||o.y===-1,[At.Forward]:s.y[At.Forward]||o.y===1}}},[n,t,r])}function BC(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return Gs(s=>{var o;return t==null?null:(o=r??s)!=null?o:null},[r,t])}function jC(e,t){return v.useMemo(()=>e.reduce((n,r)=>{const{sensor:s}=r,o=s.activators.map(i=>({eventName:i.eventName,handler:t(i.handler,r)}));return[...n,...o]},[]),[e,t])}var Js;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Js||(Js={}));var tc;(function(e){e.Optimized="optimized"})(tc||(tc={}));const Ah=new Map;function WC(e,t){let{dragging:n,dependencies:r,config:s}=t;const[o,i]=v.useState(null),{frequency:a,measure:l,strategy:c}=s,d=v.useRef(e),u=y(),f=Ws(u),g=v.useCallback(function(b){b===void 0&&(b=[]),!f.current&&i(_=>_===null?b:_.concat(b.filter(x=>!_.includes(x))))},[f]),m=v.useRef(null),p=Gs(b=>{if(u&&!n)return Ah;if(!b||b===Ah||d.current!==e||o!=null){const _=new Map;for(let x of e){if(!x)continue;if(o&&o.length>0&&!o.includes(x.id)&&x.rect.current){_.set(x.id,x.rect.current);continue}const E=x.node.current,S=E?new Zl(l(E),E):null;x.rect.current=S,S&&_.set(x.id,S)}return _}return b},[e,o,n,u,l]);return v.useEffect(()=>{d.current=e},[e]),v.useEffect(()=>{u||g()},[n,u]),v.useEffect(()=>{o&&o.length>0&&i(null)},[JSON.stringify(o)]),v.useEffect(()=>{u||typeof a!="number"||m.current!==null||(m.current=setTimeout(()=>{g(),m.current=null},a))},[a,u,g,...r]),{droppableRects:p,measureDroppableContainers:g,measuringScheduled:o!=null};function y(){switch(c){case Js.Always:return!1;case Js.BeforeDragging:return n;default:return!n}}}function nc(e,t){return Gs(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function GC(e,t){return nc(e,t)}function YC(e){let{callback:t,disabled:n}=e;const r=xi(t),s=v.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:o}=window;return new o(r)},[r,n]);return v.useEffect(()=>()=>s?.disconnect(),[s]),s}function Ni(e){let{callback:t,disabled:n}=e;const r=xi(t),s=v.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:o}=window;return new o(r)},[n]);return v.useEffect(()=>()=>s?.disconnect(),[s]),s}function KC(e){return new Zl(ts(e),e)}function Dh(e,t,n){t===void 0&&(t=KC);const[r,s]=v.useState(null);function o(){s(l=>{if(!e)return null;if(e.isConnected===!1){var c;return(c=l??n)!=null?c:null}const d=t(e);return JSON.stringify(l)===JSON.stringify(d)?l:d})}const i=YC({callback(l){if(e)for(const c of l){const{type:d,target:u}=c;if(d==="childList"&&u instanceof HTMLElement&&u.contains(e)){o();break}}}}),a=Ni({callback:o});return _n(()=>{o(),e?(a?.observe(e),i?.observe(document.body,{childList:!0,subtree:!0})):(a?.disconnect(),i?.disconnect())},[e]),r}function XC(e){const t=nc(e);return bh(e,t)}const Ih=[];function qC(e){const t=v.useRef(e),n=Gs(r=>e?r&&r!==Ih&&e&&t.current&&e.parentNode===t.current.parentNode?r:Ei(e):Ih,[e]);return v.useEffect(()=>{t.current=e},[e]),n}function ZC(e){const[t,n]=v.useState(null),r=v.useRef(e),s=v.useCallback(o=>{const i=Xl(o.target);i&&n(a=>a?(a.set(i,ql(i)),new Map(a)):null)},[]);return v.useEffect(()=>{const o=r.current;if(e!==o){i(o);const a=e.map(l=>{const c=Xl(l);return c?(c.addEventListener("scroll",s,{passive:!0}),[c,ql(c)]):null}).filter(l=>l!=null);n(a.length?new Map(a):null),r.current=e}return()=>{i(e),i(o)};function i(a){a.forEach(l=>{const c=Xl(l);c?.removeEventListener("scroll",s)})}},[s,e]),v.useMemo(()=>e.length?t?Array.from(t.values()).reduce((o,i)=>Rr(o,i),En):_h(e):En,[e,t])}function Lh(e,t){t===void 0&&(t=[]);const n=v.useRef(null);return v.useEffect(()=>{n.current=null},t),v.useEffect(()=>{const r=e!==En;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?Ks(e,n.current):En}function QC(e){v.useEffect(()=>{if(!vi)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n?.()}},e.map(t=>{let{sensor:n}=t;return n}))}function JC(e,t){return v.useMemo(()=>e.reduce((n,r)=>{let{eventName:s,handler:o}=r;return n[s]=i=>{o(i,t)},n},{}),[e,t])}function Ph(e){return v.useMemo(()=>e?CC(e):null,[e])}const $h=[];function RC(e,t){t===void 0&&(t=ts);const[n]=e,r=Ph(n?qt(n):null),[s,o]=v.useState($h);function i(){o(()=>e.length?e.map(l=>Ch(l)?r:new Zl(t(l),l)):$h)}const a=Ni({callback:i});return _n(()=>{a?.disconnect(),i(),e.forEach(l=>a?.observe(l))},[e]),s}function Fh(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return js(t)?t:e}function eS(e){let{measure:t}=e;const[n,r]=v.useState(null),s=v.useCallback(c=>{for(const{target:d}of c)if(js(d)){r(u=>{const f=t(d);return u?{...u,width:f.width,height:f.height}:f});break}},[t]),o=Ni({callback:s}),i=v.useCallback(c=>{const d=Fh(c);o?.disconnect(),d&&o?.observe(d),r(d?t(d):null)},[t,o]),[a,l]=wi(i);return v.useMemo(()=>({nodeRef:a,rect:n,setRef:l}),[n,a,l])}const tS=[{sensor:Zs,options:{}},{sensor:qs,options:{}}],nS={current:{}},Oi={draggable:{measure:vh},droppable:{measure:vh,strategy:Js.WhileDragging,frequency:tc.Optimized},dragOverlay:{measure:ts}};class Rs extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const rS={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Rs,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:_i},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Oi,measureDroppableContainers:_i,windowRect:null,measuringScheduled:!1},Vh={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:_i,draggableNodes:new Map,over:null,measureDroppableContainers:_i},eo=v.createContext(Vh),zh=v.createContext(rS);function sS(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Rs}}}function oS(e,t){switch(t.type){case Et.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Et.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case Et.DragEnd:case Et.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Et.RegisterDroppable:{const{element:n}=t,{id:r}=n,s=new Rs(e.droppable.containers);return s.set(r,n),{...e,droppable:{...e.droppable,containers:s}}}case Et.SetDroppableDisabled:{const{id:n,key:r,disabled:s}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const i=new Rs(e.droppable.containers);return i.set(n,{...o,disabled:s}),{...e,droppable:{...e.droppable,containers:i}}}case Et.UnregisterDroppable:{const{id:n,key:r}=t,s=e.droppable.containers.get(n);if(!s||r!==s.key)return e;const o=new Rs(e.droppable.containers);return o.delete(n),{...e,droppable:{...e.droppable,containers:o}}}default:return e}}function iS(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:s}=v.useContext(eo),o=ki(r),i=ki(n?.id);return v.useEffect(()=>{if(!t&&!r&&o&&i!=null){if(!Ci(o)||document.activeElement===o.target)return;const a=s.get(i);if(!a)return;const{activatorNode:l,node:c}=a;if(!l.current&&!c.current)return;requestAnimationFrame(()=>{for(const d of[l.current,c.current]){if(!d)continue;const u=rC(d);if(u){u.focus();break}}})}},[r,t,s,i,o]),null}function Hh(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((s,o)=>o({transform:s,...r}),n):n}function aS(e){return v.useMemo(()=>({draggable:{...Oi.draggable,...e?.draggable},droppable:{...Oi.droppable,...e?.droppable},dragOverlay:{...Oi.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function lS(e){let{activeNode:t,measure:n,initialRect:r,config:s=!0}=e;const o=v.useRef(!1),{x:i,y:a}=typeof s=="boolean"?{x:s,y:s}:s;_n(()=>{if(!i&&!a||!t){o.current=!1;return}if(o.current||!r)return;const c=t?.node.current;if(!c||c.isConnected===!1)return;const d=n(c),u=bh(d,r);if(i||(u.x=0),a||(u.y=0),o.current=!0,Math.abs(u.x)>0||Math.abs(u.y)>0){const f=xh(c);f&&f.scrollBy({top:u.y,left:u.x})}},[t,i,a,r,n])}const Ti=v.createContext({...En,scaleX:1,scaleY:1});var sr;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(sr||(sr={}));const rc=v.memo(function(t){var n,r,s,o;let{id:i,accessibility:a,autoScroll:l=!0,children:c,sensors:d=tS,collisionDetection:u=bC,measuring:f,modifiers:g,...m}=t;const p=v.useReducer(oS,void 0,sS),[y,b]=p,[_,x]=cC(),[E,S]=v.useState(sr.Uninitialized),w=E===sr.Initialized,{draggable:{active:N,nodes:C,translate:k},droppable:{containers:M}}=y,T=N!=null?C.get(N):null,L=v.useRef({initial:null,translated:null}),P=v.useMemo(()=>{var ye;return N!=null?{id:N,data:(ye=T?.data)!=null?ye:nS,rect:L}:null},[N,T]),F=v.useRef(null),[D,A]=v.useState(null),[O,V]=v.useState(null),H=Ws(m,Object.values(m)),W=Ys("DndDescribedBy",i),j=v.useMemo(()=>M.getEnabled(),[M]),U=aS(f),{droppableRects:B,measureDroppableContainers:G,measuringScheduled:z}=WC(j,{dragging:w,dependencies:[k.x,k.y],config:U.droppable}),K=BC(C,N),Y=v.useMemo(()=>O?Si(O):null,[O]),Z=ot(),ee=GC(K,U.draggable.measure);lS({activeNode:N!=null?C.get(N):null,config:Z.layoutShiftCompensation,initialRect:ee,measure:U.draggable.measure});const te=Dh(K,U.draggable.measure,ee),ce=Dh(K?K.parentElement:null),J=v.useRef({activatorEvent:null,active:null,activeNode:K,collisionRect:null,collisions:null,droppableRects:B,draggableNodes:C,draggingNode:null,draggingNodeRect:null,droppableContainers:M,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),he=M.getNodeFor((n=J.current.over)==null?void 0:n.id),le=eS({measure:U.dragOverlay.measure}),ae=(r=le.nodeRef.current)!=null?r:K,Se=w?(s=le.rect)!=null?s:te:null,ue=!!(le.nodeRef.current&&le.rect),pe=XC(ue?null:te),we=Ph(ae?qt(ae):null),He=qC(w?he??K:null),se=RC(He),Oe=Hh(g,{transform:{x:k.x-pe.x,y:k.y-pe.y,scaleX:1,scaleY:1},activatorEvent:O,active:P,activeNodeRect:te,containerNodeRect:ce,draggingNodeRect:Se,over:J.current.over,overlayNodeRect:le.rect,scrollableAncestors:He,scrollableAncestorRects:se,windowRect:we}),Le=Y?Rr(Y,k):null,Ie=ZC(He),Ue=Lh(Ie),et=Lh(Ie,[te]),bt=Rr(Oe,Ue),Ge=Se?xC(Se,Oe):null,ft=P&&Ge?u({active:P,collisionRect:Ge,droppableRects:B,droppableContainers:j,pointerCoordinates:Le}):null,Be=ph(ft,"id"),[ne,fe]=v.useState(null),xe=ue?Oe:Rr(Oe,et),ge=yC(xe,(o=ne?.rect)!=null?o:null,te),be=v.useRef(null),Ve=v.useCallback((ye,Ce)=>{let{sensor:Fe,options:nt}=Ce;if(F.current==null)return;const pt=C.get(F.current);if(!pt)return;const it=ye.nativeEvent,rt=new Fe({active:F.current,activeNode:pt,event:it,options:nt,context:J,onAbort(ht){if(!C.get(ht))return;const{onDragAbort:Gt}=H.current,mt={id:ht};Gt?.(mt),_({type:"onDragAbort",event:mt})},onPending(ht,Qt,Gt,mt){if(!C.get(ht))return;const{onDragPending:xn}=H.current,Vt={id:ht,constraint:Qt,initialCoordinates:Gt,offset:mt};xn?.(Vt),_({type:"onDragPending",event:Vt})},onStart(ht){const Qt=F.current;if(Qt==null)return;const Gt=C.get(Qt);if(!Gt)return;const{onDragStart:mt}=H.current,St={activatorEvent:it,active:{id:Qt,data:Gt.data,rect:L}};Dn.unstable_batchedUpdates(()=>{mt?.(St),S(sr.Initializing),b({type:Et.DragStart,initialCoordinates:ht,active:Qt}),_({type:"onDragStart",event:St}),A(be.current),V(it)})},onMove(ht){b({type:Et.DragMove,coordinates:ht})},onEnd:Ot(Et.DragEnd),onCancel:Ot(Et.DragCancel)});be.current=rt;function Ot(ht){return async function(){const{active:Gt,collisions:mt,over:St,scrollAdjustedTranslate:xn}=J.current;let Vt=null;if(Gt&&xn){const{cancelDrop:Ze}=H.current;Vt={activatorEvent:it,active:Gt,collisions:mt,delta:xn,over:St},ht===Et.DragEnd&&typeof Ze=="function"&&await Promise.resolve(Ze(Vt))&&(ht=Et.DragCancel)}F.current=null,Dn.unstable_batchedUpdates(()=>{b({type:ht}),S(sr.Uninitialized),fe(null),A(null),V(null),be.current=null;const Ze=ht===Et.DragEnd?"onDragEnd":"onDragCancel";if(Vt){const jn=H.current[Ze];jn?.(Vt),_({type:Ze,event:Vt})}})}}},[C]),De=v.useCallback((ye,Ce)=>(Fe,nt)=>{const pt=Fe.nativeEvent,it=C.get(nt);if(F.current!==null||!it||pt.dndKit||pt.defaultPrevented)return;const rt={active:it};ye(Fe,Ce.options,rt)===!0&&(pt.dndKit={capturedBy:Ce.sensor},F.current=nt,Ve(Fe,Ce))},[C,Ve]),$e=jC(d,De);QC(d),_n(()=>{te&&E===sr.Initializing&&S(sr.Initialized)},[te,E]),v.useEffect(()=>{const{onDragMove:ye}=H.current,{active:Ce,activatorEvent:Fe,collisions:nt,over:pt}=J.current;if(!Ce||!Fe)return;const it={active:Ce,activatorEvent:Fe,collisions:nt,delta:{x:bt.x,y:bt.y},over:pt};Dn.unstable_batchedUpdates(()=>{ye?.(it),_({type:"onDragMove",event:it})})},[bt.x,bt.y]),v.useEffect(()=>{const{active:ye,activatorEvent:Ce,collisions:Fe,droppableContainers:nt,scrollAdjustedTranslate:pt}=J.current;if(!ye||F.current==null||!Ce||!pt)return;const{onDragOver:it}=H.current,rt=nt.get(Be),Ot=rt&&rt.rect.current?{id:rt.id,rect:rt.rect.current,data:rt.data,disabled:rt.disabled}:null,ht={active:ye,activatorEvent:Ce,collisions:Fe,delta:{x:pt.x,y:pt.y},over:Ot};Dn.unstable_batchedUpdates(()=>{fe(Ot),it?.(ht),_({type:"onDragOver",event:ht})})},[Be]),_n(()=>{J.current={activatorEvent:O,active:P,activeNode:K,collisionRect:Ge,collisions:ft,droppableRects:B,draggableNodes:C,draggingNode:ae,draggingNodeRect:Se,droppableContainers:M,over:ne,scrollableAncestors:He,scrollAdjustedTranslate:bt},L.current={initial:Se,translated:Ge}},[P,K,ft,Ge,C,ae,Se,B,M,ne,He,bt]),zC({...Z,delta:k,draggingRect:Ge,pointerCoordinates:Le,scrollableAncestors:He,scrollableAncestorRects:se});const Me=v.useMemo(()=>({active:P,activeNode:K,activeNodeRect:te,activatorEvent:O,collisions:ft,containerNodeRect:ce,dragOverlay:le,draggableNodes:C,droppableContainers:M,droppableRects:B,over:ne,measureDroppableContainers:G,scrollableAncestors:He,scrollableAncestorRects:se,measuringConfiguration:U,measuringScheduled:z,windowRect:we}),[P,K,te,O,ft,ce,le,C,M,B,ne,G,He,se,U,z,we]),qe=v.useMemo(()=>({activatorEvent:O,activators:$e,active:P,activeNodeRect:te,ariaDescribedById:{draggable:W},dispatch:b,draggableNodes:C,over:ne,measureDroppableContainers:G}),[O,$e,P,te,b,W,C,ne,G]);return v.createElement(uh.Provider,{value:x},v.createElement(eo.Provider,{value:qe},v.createElement(zh.Provider,{value:Me},v.createElement(Ti.Provider,{value:ge},c)),v.createElement(iS,{disabled:a?.restoreFocus===!1})),v.createElement(fC,{...a,hiddenTextDescribedById:W}));function ot(){const ye=D?.autoScrollEnabled===!1,Ce=typeof l=="object"?l.enabled===!1:l===!1,Fe=w&&!ye&&!Ce;return typeof l=="object"?{...l,enabled:Fe}:{enabled:Fe}}}),cS=v.createContext(null),Uh="button",dS="Draggable";function uS(e){let{id:t,data:n,disabled:r=!1,attributes:s}=e;const o=Ys(dS),{activators:i,activatorEvent:a,active:l,activeNodeRect:c,ariaDescribedById:d,draggableNodes:u,over:f}=v.useContext(eo),{role:g=Uh,roleDescription:m="draggable",tabIndex:p=0}=s??{},y=l?.id===t,b=v.useContext(y?Ti:cS),[_,x]=wi(),[E,S]=wi(),w=JC(i,t),N=Ws(n);_n(()=>(u.set(t,{id:t,key:o,node:_,activatorNode:E,data:N}),()=>{const k=u.get(t);k&&k.key===o&&u.delete(t)}),[u,t]);const C=v.useMemo(()=>({role:g,tabIndex:p,"aria-disabled":r,"aria-pressed":y&&g===Uh?!0:void 0,"aria-roledescription":m,"aria-describedby":d.draggable}),[r,g,p,y,m,d.draggable]);return{active:l,activatorEvent:a,activeNodeRect:c,attributes:C,isDragging:y,listeners:r?void 0:w,node:_,over:f,setNodeRef:x,setActivatorNodeRef:S,transform:b}}function Bh(){return v.useContext(zh)}const fS="Droppable",hS={timeout:25};function gS(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:s}=e;const o=Ys(fS),{active:i,dispatch:a,over:l,measureDroppableContainers:c}=v.useContext(eo),d=v.useRef({disabled:n}),u=v.useRef(!1),f=v.useRef(null),g=v.useRef(null),{disabled:m,updateMeasurementsFor:p,timeout:y}={...hS,...s},b=Ws(p??r),_=v.useCallback(()=>{if(!u.current){u.current=!0;return}g.current!=null&&clearTimeout(g.current),g.current=setTimeout(()=>{c(Array.isArray(b.current)?b.current:[b.current]),g.current=null},y)},[y]),x=Ni({callback:_,disabled:m||!i}),E=v.useCallback((C,k)=>{x&&(k&&(x.unobserve(k),u.current=!1),C&&x.observe(C))},[x]),[S,w]=wi(E),N=Ws(t);return v.useEffect(()=>{!x||!S.current||(x.disconnect(),u.current=!1,x.observe(S.current))},[S,x]),v.useEffect(()=>(a({type:Et.RegisterDroppable,element:{id:r,key:o,disabled:n,node:S,rect:f,data:N}}),()=>a({type:Et.UnregisterDroppable,key:o,id:r})),[r]),v.useEffect(()=>{n!==d.current.disabled&&(a({type:Et.SetDroppableDisabled,id:r,key:o,disabled:n}),d.current.disabled=n)},[r,o,n,a]),{active:i,rect:f,isOver:l?.id===r,node:S,over:l,setNodeRef:w}}function pS(e){let{animation:t,children:n}=e;const[r,s]=v.useState(null),[o,i]=v.useState(null),a=ki(n);return!n&&!r&&a&&s(a),_n(()=>{if(!o)return;const l=r?.key,c=r?.props.id;if(l==null||c==null){s(null);return}Promise.resolve(t(c,o)).then(()=>{s(null)})},[t,r,o]),v.createElement(v.Fragment,null,n,r?v.cloneElement(r,{ref:i}):null)}const mS={x:0,y:0,scaleX:1,scaleY:1};function bS(e){let{children:t}=e;return v.createElement(eo.Provider,{value:Vh},v.createElement(Ti.Provider,{value:mS},t))}const yS={position:"fixed",touchAction:"none"},vS=e=>Ci(e)?"transform 250ms ease":void 0,xS=v.forwardRef((e,t)=>{let{as:n,activatorEvent:r,adjustScale:s,children:o,className:i,rect:a,style:l,transform:c,transition:d=vS}=e;if(!a)return null;const u=s?c:{...c,scaleX:1,scaleY:1},f={...yS,width:a.width,height:a.height,top:a.top,left:a.left,transform:Fn.Transform.toString(u),transformOrigin:s&&r?hC(r,a):void 0,transition:typeof d=="function"?d(r):d,...l};return v.createElement(n,{className:i,style:f,ref:t},o)}),wS={duration:250,easing:"ease",keyframes:e=>{let{transform:{initial:t,final:n}}=e;return[{transform:Fn.Transform.toString(t)},{transform:Fn.Transform.toString(n)}]},sideEffects:(e=>t=>{let{active:n,dragOverlay:r}=t;const s={},{styles:o,className:i}=e;if(o!=null&&o.active)for(const[a,l]of Object.entries(o.active))l!==void 0&&(s[a]=n.node.style.getPropertyValue(a),n.node.style.setProperty(a,l));if(o!=null&&o.dragOverlay)for(const[a,l]of Object.entries(o.dragOverlay))l!==void 0&&r.node.style.setProperty(a,l);return i!=null&&i.active&&n.node.classList.add(i.active),i!=null&&i.dragOverlay&&r.node.classList.add(i.dragOverlay),function(){for(const[l,c]of Object.entries(s))n.node.style.setProperty(l,c);i!=null&&i.active&&n.node.classList.remove(i.active)}})({styles:{active:{opacity:"0"}}})};function kS(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:s}=e;return xi((o,i)=>{if(t===null)return;const a=n.get(o);if(!a)return;const l=a.node.current;if(!l)return;const c=Fh(i);if(!c)return;const{transform:d}=qt(i).getComputedStyle(i),u=yh(d);if(!u)return;const f=typeof t=="function"?t:CS(t);return Eh(l,s.draggable.measure),f({active:{id:o,data:a.data,node:l,rect:s.draggable.measure(l)},draggableNodes:n,dragOverlay:{node:i,rect:s.dragOverlay.measure(c)},droppableContainers:r,measuringConfiguration:s,transform:u})})}function CS(e){const{duration:t,easing:n,sideEffects:r,keyframes:s}={...wS,...e};return o=>{let{active:i,dragOverlay:a,transform:l,...c}=o;if(!t)return;const d={x:a.rect.left-i.rect.left,y:a.rect.top-i.rect.top},u={scaleX:l.scaleX!==1?i.rect.width*l.scaleX/a.rect.width:1,scaleY:l.scaleY!==1?i.rect.height*l.scaleY/a.rect.height:1},f={x:l.x-d.x,y:l.y-d.y,...u},g=s({...c,active:i,dragOverlay:a,transform:{initial:l,final:f}}),[m]=g,p=g[g.length-1];if(JSON.stringify(m)===JSON.stringify(p))return;const y=r?.({active:i,dragOverlay:a,...c}),b=a.node.animate(g,{duration:t,easing:n,fill:"forwards"});return new Promise(_=>{b.onfinish=()=>{y?.(),_()}})}}let jh=0;function SS(e){return v.useMemo(()=>{if(e!=null)return jh++,jh},[e])}const _S=v.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:r,style:s,transition:o,modifiers:i,wrapperElement:a="div",className:l,zIndex:c=999}=e;const{activatorEvent:d,active:u,activeNodeRect:f,containerNodeRect:g,draggableNodes:m,droppableContainers:p,dragOverlay:y,over:b,measuringConfiguration:_,scrollableAncestors:x,scrollableAncestorRects:E,windowRect:S}=Bh(),w=v.useContext(Ti),N=SS(u?.id),C=Hh(i,{activatorEvent:d,active:u,activeNodeRect:f,containerNodeRect:g,draggingNodeRect:y.rect,over:b,overlayNodeRect:y.rect,scrollableAncestors:x,scrollableAncestorRects:E,transform:w,windowRect:S}),k=nc(f),M=kS({config:r,draggableNodes:m,droppableContainers:p,measuringConfiguration:_}),T=k?y.setRef:void 0;return v.createElement(bS,null,v.createElement(pS,{animation:M},u&&N?v.createElement(xS,{key:N,id:u.id,ref:T,as:a,activatorEvent:d,adjustScale:t,className:l,transition:o,rect:k,style:{zIndex:c,...s},transform:C},n):null))});function ns(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function ES(e,t){return e.reduce((n,r,s)=>{const o=t.get(r);return o&&(n[s]=o),n},Array(e.length))}function Ai(e){return e!==null&&e>=0}function MS(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n{let{rects:t,activeIndex:n,overIndex:r,index:s}=e;const o=ns(t,r,n),i=t[s],a=o[s];return!a||!i?null:{x:a.left-i.left,y:a.top-i.top,scaleX:a.width/i.width,scaleY:a.height/i.height}},Ii={scaleX:1,scaleY:1},sc=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:s,rects:o,overIndex:i}=e;const a=(t=o[n])!=null?t:r;if(!a)return null;if(s===n){const c=o[i];return c?{x:0,y:nn&&s<=i?{x:0,y:-a.height-l,...Ii}:s=i?{x:0,y:a.height+l,...Ii}:{x:0,y:0,...Ii}};function OS(e,t,n){const r=e[t],s=e[t-1],o=e[t+1];return r?nr.map(w=>typeof w=="object"&&"id"in w?w.id:w),[r]),m=i!=null,p=i?g.indexOf(i.id):-1,y=c?g.indexOf(c.id):-1,b=v.useRef(g),_=!MS(g,b.current),x=y!==-1&&p===-1||_,E=NS(o);_n(()=>{_&&m&&d(g)},[_,g,m,d]),v.useEffect(()=>{b.current=g},[g]);const S=v.useMemo(()=>({activeIndex:p,containerId:u,disabled:E,disableTransforms:x,items:g,overIndex:y,useDragOverlay:f,sortedRects:ES(g,l),strategy:s}),[p,u,E.draggable,E.droppable,x,g,y,l,f,s]);return v.createElement(Gh.Provider,{value:S},t)}const Yh=e=>{let{id:t,items:n,activeIndex:r,overIndex:s}=e;return ns(n,r,s).indexOf(t)},Kh=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:s,items:o,newIndex:i,previousItems:a,previousContainerId:l,transition:c}=e;return!c||!r||a!==o&&s===i?!1:n?!0:i!==s&&t===l},TS={duration:200,easing:"ease"},Xh="transform",AS=Fn.Transition.toString({property:Xh,duration:0,easing:"linear"}),DS={roleDescription:"sortable"};function IS(e){let{disabled:t,index:n,node:r,rect:s}=e;const[o,i]=v.useState(null),a=v.useRef(n);return _n(()=>{if(!t&&n!==a.current&&r.current){const l=s.current;if(l){const c=ts(r.current,{ignoreTransform:!0}),d={x:l.left-c.left,y:l.top-c.top,scaleX:l.width/c.width,scaleY:l.height/c.height};(d.x||d.y)&&i(d)}}n!==a.current&&(a.current=n)},[t,n,r,s]),v.useEffect(()=>{o&&i(null)},[o]),o}function Pi(e){let{animateLayoutChanges:t=Kh,attributes:n,disabled:r,data:s,getNewIndex:o=Yh,id:i,strategy:a,resizeObserverConfig:l,transition:c=TS}=e;const{items:d,containerId:u,activeIndex:f,disabled:g,disableTransforms:m,sortedRects:p,overIndex:y,useDragOverlay:b,strategy:_}=v.useContext(Gh),x=LS(r,g),E=d.indexOf(i),S=v.useMemo(()=>({sortable:{containerId:u,index:E,items:d},...s}),[u,s,E,d]),w=v.useMemo(()=>d.slice(d.indexOf(i)),[d,i]),{rect:N,node:C,isOver:k,setNodeRef:M}=gS({id:i,data:S,disabled:x.droppable,resizeObserverConfig:{updateMeasurementsFor:w,...l}}),{active:T,activatorEvent:L,activeNodeRect:P,attributes:F,setNodeRef:D,listeners:A,isDragging:O,over:V,setActivatorNodeRef:H,transform:W}=uS({id:i,data:S,attributes:{...DS,...n},disabled:x.draggable}),j=Rk(M,D),U=!!T,B=U&&!m&&Ai(f)&&Ai(y),G=!b&&O,z=G&&B?W:null,Y=B?z??(a??_)({rects:p,activeNodeRect:P,activeIndex:f,overIndex:y,index:E}):null,Z=Ai(f)&&Ai(y)?o({id:i,items:d,activeIndex:f,overIndex:y}):E,ee=T?.id,te=v.useRef({activeId:ee,items:d,newIndex:Z,containerId:u}),ce=d!==te.current.items,J=t({active:T,containerId:u,isDragging:O,isSorting:U,id:i,index:E,items:d,newIndex:te.current.newIndex,previousItems:te.current.items,previousContainerId:te.current.containerId,transition:c,wasDragging:te.current.activeId!=null}),he=IS({disabled:!J,index:E,node:C,rect:N});return v.useEffect(()=>{U&&te.current.newIndex!==Z&&(te.current.newIndex=Z),u!==te.current.containerId&&(te.current.containerId=u),d!==te.current.items&&(te.current.items=d)},[U,Z,u,d]),v.useEffect(()=>{if(ee===te.current.activeId)return;if(ee!=null&&te.current.activeId==null){te.current.activeId=ee;return}const ae=setTimeout(()=>{te.current.activeId=ee},50);return()=>clearTimeout(ae)},[ee]),{active:T,activeIndex:f,attributes:F,data:S,rect:N,index:E,newIndex:Z,items:d,isOver:k,isSorting:U,isDragging:O,listeners:A,node:C,overIndex:y,over:V,setNodeRef:j,setActivatorNodeRef:H,setDroppableNodeRef:M,setDraggableNodeRef:D,transform:he??Y,transition:le()};function le(){if(he||ce&&te.current.newIndex===E)return AS;if(!(G&&!Ci(L)||!c)&&(U||J))return Fn.Transition.toString({...c,property:Xh})}}function LS(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e?.draggable)!=null?n:t.draggable,droppable:(r=e?.droppable)!=null?r:t.droppable}}function to(e){if(!e)return!1;const t=e.data.current;return!!(t&&"sortable"in t&&typeof t.sortable=="object"&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}const PS=[Ye.Down,Ye.Right,Ye.Up,Ye.Left],$i=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:s,droppableContainers:o,over:i,scrollableAncestors:a}}=t;if(PS.includes(e.code)){if(e.preventDefault(),!n||!r)return;const l=[];o.getEnabled().forEach(u=>{if(!u||u!=null&&u.disabled)return;const f=s.get(u.id);if(f)switch(e.code){case Ye.Down:r.topf.top&&l.push(u);break;case Ye.Left:r.left>f.left&&l.push(u);break;case Ye.Right:r.left1&&(d=c[1].id),d!=null){const u=o.get(n.id),f=o.get(d),g=f?s.get(f.id):null,m=f?.node.current;if(m&&g&&u&&f){const y=Ei(m).some((w,N)=>a[N]!==w),b=qh(u,f),_=$S(u,f),x=y||!b?{x:0,y:0}:{x:_?r.width-g.width:0,y:_?r.height-g.height:0},E={x:g.left,y:g.top};return x.x&&x.y?E:Ks(E,x)}}}};function qh(e,t){return!to(e)||!to(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function $S(e,t){return!to(e)||!to(t)||!qh(e,t)?!1:e.data.current.sortable.indexwindow.G7Core,Zh=({item:e,isSelected:t=!1,isExpanded:n=!1,level:r=0,onClick:s,onToggle:o,onExpandToggle:i,className:a="",selectedClassName:l="bg-blue-50 dark:bg-blue-900/30 border-blue-500",defaultClassName:c="bg-white dark:bg-gray-800 border-gray-200 dark:border-gray-700 hover:border-gray-300 dark:hover:border-gray-600",dragHandleClassName:d="text-gray-400 hover:text-gray-600 dark:hover:text-gray-300",iconContainerClassName:u="bg-gray-100 dark:bg-gray-700",contentClassName:f="",enableDrag:g=!0,toggleDisabled:m=!1})=>{const{attributes:p,listeners:y,setNodeRef:b,transform:_,transition:x,isDragging:E}=Pi({id:e.id}),S={transform:Fn.Transform.toString(_),transition:x,opacity:E?.5:1},w=r*24+12,C=`flex items-center gap-2 cursor-pointer transition-colors ${t?l:c}`,k=VS()?.style?.mergeClasses?.(C,a)??`${C} ${a}`.trim();return h.jsxs(I,{ref:b,style:S,className:k,onClick:s,children:[g&&h.jsx(I,{...p,...y,className:`flex-shrink-0 cursor-grab active:cursor-grabbing p-1 ${d}`,style:{paddingLeft:`${w}px`},children:h.jsx(re,{name:"grip-vertical",className:"w-4 h-4"})}),!g&&r>0&&h.jsx(I,{style:{paddingLeft:`${w}px`}}),g&&h.jsx(h.Fragment,{children:e.hasChildren?h.jsx(oe,{type:"button",onClick:M=>{M.stopPropagation(),i?.()},className:`flex-shrink-0 p-1 ${d}`,children:h.jsx(re,{name:n?"chevron-down":"chevron-right",className:"w-4 h-4"})}):h.jsx(I,{className:"flex-shrink-0 w-6"})}),h.jsx(I,{className:`flex-shrink-0 w-8 h-8 flex items-center justify-center rounded ${u}`,children:h.jsx(re,{name:e.icon||"file",className:"w-4 h-4 text-gray-600 dark:text-gray-400"})}),h.jsxs(I,{className:`flex-1 min-w-0 ${f}`,children:[h.jsxs(I,{className:"flex items-center gap-1",children:[h.jsx(Q,{className:"text-sm font-medium text-gray-900 dark:text-white truncate",children:e.name}),e.isModuleMenu&&h.jsx(re,{name:"cube",className:"w-2 h-2 text-gray-300 dark:text-gray-500 ml-2",title:e.moduleName})]}),h.jsx(Q,{className:"text-xs text-gray-500 dark:text-gray-400 truncate block",children:e.url})]}),h.jsx(I,{className:"flex-shrink-0",onClick:M=>M.stopPropagation(),children:h.jsx(Ya,{checked:e.isActive,onChange:()=>o?.(new MouseEvent("click")),size:"sm",disabled:m})})]})},zS=()=>window.G7Core;function Qh(e,t,n=0,r=null){const s=[];for(const o of e)s.push({item:o,depth:n,parentId:r}),o.children?.length>0&&t.has(o.id)&&s.push(...Qh(o.children,t,n+1,o.id));return s}function oc(e,t){for(const n of e){if(n.id===t)return n;if(n.children){const r=oc(n.children,t);if(r)return r}}return null}function Jh(e){const t=[];if(e.children)for(const n of e.children)t.push(n.id),t.push(...Jh(n));return t}function Rh(e,t){return e.filter(n=>n.id!==t).map(n=>n.children?.length>0?{...n,children:Rh(n.children,t)}:n)}function eg(e,t,n,r){if(n===null){const s=[...e];return s.splice(r,0,t),s}return e.map(s=>{if(s.id===n){const o=[...s.children||[]];return o.splice(r,0,t),{...s,children:o}}return s.children?.length>0?{...s,children:eg(s.children,t,n,r)}:s})}function tg(e,t,n,r){if(t===null){const s=e.findIndex(i=>i.id===n),o=e.findIndex(i=>i.id===r);return s===-1||o===-1?e:ns(e,s,o)}return e.map(s=>{if(s.id===t&&s.children){const o=s.children.findIndex(a=>a.id===n),i=s.children.findIndex(a=>a.id===r);return o===-1||i===-1?s:{...s,children:ns(s.children,o,i)}}return s.children?.length>0?{...s,children:tg(s.children,t,n,r)}:s})}function ng(e){const t=e.map((s,o)=>({id:s.id,order:o+1})),n={},r=s=>{s.forEach(o=>{o.children?.length>0&&(n[o.id]=o.children.map((i,a)=>({id:i.id,order:a+1})),r(o.children))})};return r(e),{parent_menus:t,child_menus:n}}const HS=({items:e=[],selectedId:t,onSelect:n,onOrderChange:r,onToggleStatus:s,title:o,className:i="",listClassName:a="",childrenContainerClassName:l="bg-gray-50 dark:bg-gray-900/50",itemClassName:c="py-2.5 px-3 mx-4 my-2 rounded-lg border",itemSelectedClassName:d,itemDefaultClassName:u,titleClassName:f="px-4 py-3 border-b border-gray-200 dark:border-gray-700",enableDrag:g=!0,toggleDisabled:m=!1,id:p,editorAttrs:y})=>{const[b,_]=v.useState(new Set),[x,E]=v.useState(null),[S,w]=v.useState(e),N=v.useRef(!1),C=v.useRef(""),k=v.useRef(""),M=v.useCallback(B=>JSON.stringify(B),[]),T=v.useCallback(B=>B.map(G=>{const z=G.children?.map(K=>K.id).join(",")||"";return`${G.id}:${z}`}).join("|"),[]);v.useEffect(()=>{const B=T(e),G=M(e);if(N.current){const z=T(S);(B===z||B!==C.current)&&(N.current=!1,C.current=B,k.current=G,(B!==z||G!==M(S))&&w(e));return}G!==k.current&&(C.current=B,k.current=G,w(e))},[e,T,M,S]);const L=Yl(es(Zs,{activationConstraint:{distance:8}}),es(qs,{coordinateGetter:$i})),P=v.useCallback(B=>{if(typeof B=="string")return B;const z=zS()?.locale?.current?.()||"ko";return B[z]||B.en||Object.values(B)[0]||""},[]),F=v.useCallback(B=>{_(G=>{const z=new Set(G);return z.has(B)?z.delete(B):z.add(B),z})},[]),D=v.useCallback(B=>{n?.(B)},[n]),A=v.useCallback((B,G,z)=>{z.stopPropagation(),s?.(B,G)},[s]),O=B=>{E(B.active.id)},V=B=>{const{active:G,over:z}=B;if(E(null),!z||G.id===z.id)return;const K=W.find(Z=>Z.item.id===Number(G.id)),Y=W.find(Z=>Z.item.id===Number(z.id));if(!(!K||!Y))if(K.parentId===Y.parentId){const Z=tg(S,K.parentId,Number(G.id),Number(z.id));w(Z),N.current=!0,r?.(ng(Z))}else{const Z=K.item;if(Jh(Z).includes(Number(z.id)))return;let te=Rh(S,Z.id);const ce=W.findIndex(pe=>pe.item.id===Number(G.id)),J=W.findIndex(pe=>pe.item.id===Number(z.id)),he=ce>J,le=Y.parentId;let ae;if(le===null)ae=te.findIndex(pe=>pe.id===Number(z.id)),ae===-1?ae=te.length:he||(ae+=1);else{const we=oc(te,le)?.children||[];ae=we.findIndex(He=>He.id===Number(z.id)),ae===-1?ae=we.length:he||(ae+=1)}const Se={...Z,parent_id:le,children:Z.children||[]};te=eg(te,Se,le,ae),w(te),N.current=!0;const ue=ng(te);ue.moved_items=[{id:Z.id,new_parent_id:le}],r?.(ue)}},H=B=>({id:B.id,name:P(B.name),slug:B.slug,url:B.url,icon:B.icon,isActive:B.is_active,isModuleMenu:!!B.module_id,moduleName:B.module?P(B.module.name):void 0,hasChildren:B.children&&B.children.length>0}),W=v.useMemo(()=>Qh(S,b),[S,b]),j=v.useMemo(()=>W.map(B=>B.item.id),[W]),U=x?oc(S,Number(x)):null;return h.jsxs(I,{className:i,id:p,...y,children:[o&&h.jsx(I,{className:f,children:h.jsx($r,{className:"text-sm font-medium text-gray-900 dark:text-white",children:o})}),h.jsxs(rc,{sensors:L,collisionDetection:Kl,onDragStart:O,onDragEnd:V,children:[h.jsx(Li,{items:j,strategy:sc,children:h.jsx(I,{className:a,children:W.map(B=>h.jsx(I,{className:B.depth>0?l:"",children:h.jsx(Zh,{item:H(B.item),isSelected:t===B.item.id,isExpanded:b.has(B.item.id),level:B.depth,onClick:()=>D(B.item),onToggle:G=>A(B.item.id,B.item.is_active,G),onExpandToggle:()=>F(B.item.id),className:c,selectedClassName:d,defaultClassName:u,enableDrag:g,toggleDisabled:m})},B.item.id))})}),h.jsx(_S,{children:U?h.jsx(I,{className:"bg-white dark:bg-gray-800 shadow-lg rounded-lg border border-blue-500 p-3",children:h.jsx(I,{className:"flex items-center gap-2",children:h.jsx(I,{className:"text-sm font-medium text-gray-900 dark:text-white",children:P(U.name)})})}):null})]})]})},US=[{value:"LayoutDashboard",label:"LayoutDashboard",faIcon:"tachometer-alt"},{value:"Settings",label:"Settings",faIcon:"cog"},{value:"Menu",label:"Menu",faIcon:"bars"},{value:"Users",label:"Users",faIcon:"users"},{value:"Package",label:"Package",faIcon:"cube"},{value:"Puzzle",label:"Puzzle",faIcon:"puzzle-piece"},{value:"FileText",label:"FileText",faIcon:"file-alt"},{value:"ShoppingCart",label:"ShoppingCart",faIcon:"shopping-cart"},{value:"MessageSquare",label:"MessageSquare",faIcon:"comment"},{value:"Home",label:"Home",faIcon:"home"},{value:"User",label:"User",faIcon:"user"},{value:"Search",label:"Search",faIcon:"search"},{value:"Bell",label:"Bell",faIcon:"bell"},{value:"Mail",label:"Mail",faIcon:"envelope"},{value:"Calendar",label:"Calendar",faIcon:"calendar"},{value:"Chart",label:"Chart",faIcon:"chart-bar"},{value:"Database",label:"Database",faIcon:"database"},{value:"Lock",label:"Lock",faIcon:"lock"},{value:"Globe",label:"Globe",faIcon:"globe"},{value:"Image",label:"Image",faIcon:"image"}],BS=({value:e,onChange:t,options:n=US,placeholder:r,searchPlaceholder:s,noResultsText:o,className:i="",disabled:a=!1,name:l,id:c,editorAttrs:d})=>{const[u,f]=v.useState(!1),[g,m]=v.useState(""),p=v.useRef(null),y=n.find(x=>{if(!e)return!1;if(e.includes("fa-")){const E=e.replace(/^(fas|far|fab|fal|fad)\s+fa-/,"");return x.faIcon===E||x.faIcon===e}return x.value===e||x.faIcon===e}),b=n.filter(x=>x.label.toLowerCase().includes(g.toLowerCase()));v.useEffect(()=>{const x=E=>{p.current&&!p.current.contains(E.target)&&(f(!1),m(""))};if(u)return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[u]);const _=x=>{const E=`fas fa-${x.faIcon}`;t?.(E),f(!1),m("")};return h.jsxs(I,{ref:p,className:`relative ${i}`,id:c,...d,children:[h.jsxs(oe,{type:"button",onClick:()=>!a&&f(!u),disabled:a,className:` + `},gS={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function pS(e){let{announcements:t=gS,container:n,hiddenTextDescribedById:r,screenReaderInstructions:s=hS}=e;const{announce:o,announcement:i}=dS(),a=ao("DndLiveRegion"),[l,c]=v.useState(!1);if(v.useEffect(()=>{c(!0)},[]),uS(v.useMemo(()=>({onDragStart(u){let{active:f}=u;o(t.onDragStart({active:f}))},onDragMove(u){let{active:f,over:g}=u;t.onDragMove&&o(t.onDragMove({active:f,over:g}))},onDragOver(u){let{active:f,over:g}=u;o(t.onDragOver({active:f,over:g}))},onDragEnd(u){let{active:f,over:g}=u;o(t.onDragEnd({active:f,over:g}))},onDragCancel(u){let{active:f,over:g}=u;o(t.onDragCancel({active:f,over:g}))}}),[o,t])),!l)return null;const d=v.createElement(v.Fragment,null,v.createElement(lS,{id:r,value:s.draggable}),v.createElement(cS,{id:a,announcement:i}));return n?Vn.createPortal(d,n):d}var At;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(At||(At={}));function Hi(){}function gs(e,t){return v.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function gc(){for(var e=arguments.length,t=new Array(e),n=0;n[...t].filter(r=>r!=null),[...t])}const Dn=Object.freeze({x:0,y:0});function Yh(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function mS(e,t){const n=Vi(e);if(!n)return"0 0";const r={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return r.x+"% "+r.y+"%"}function Kh(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function bS(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function Xh(e){let{left:t,top:n,height:r,width:s}=e;return[{x:t,y:n},{x:t+s,y:n},{x:t,y:n+r},{x:t+s,y:n+r}]}function qh(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function Zh(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}const pc=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const s=Zh(t,t.left,t.top),o=[];for(const i of r){const{id:a}=i,l=n.get(a);if(l){const c=Yh(Zh(l),s);o.push({id:a,data:{droppableContainer:i,value:c}})}}return o.sort(Kh)},yS=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const s=Xh(t),o=[];for(const i of r){const{id:a}=i,l=n.get(a);if(l){const c=Xh(l),d=s.reduce((f,g,m)=>f+Yh(c[m],g),0),u=Number((d/4).toFixed(4));o.push({id:a,data:{droppableContainer:i,value:u}})}}return o.sort(Kh)};function vS(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),s=Math.min(t.left+t.width,e.left+e.width),o=Math.min(t.top+t.height,e.top+e.height),i=s-r,a=o-n;if(r{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const s=[];for(const o of r){const{id:i}=o,a=n.get(i);if(a){const l=vS(a,t);l>0&&s.push({id:i,data:{droppableContainer:o,value:l}})}}return s.sort(bS)};function wS(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function Qh(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Dn}function kS(e){return function(n){for(var r=arguments.length,s=new Array(r>1?r-1:0),o=1;o({...i,top:i.top+e*a.y,bottom:i.bottom+e*a.y,left:i.left+e*a.x,right:i.right+e*a.x}),{...n})}}const CS=kS(1);function Jh(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function SS(e,t,n){const r=Jh(t);if(!r)return e;const{scaleX:s,scaleY:o,x:i,y:a}=r,l=e.left-i-(1-s)*parseFloat(n),c=e.top-a-(1-o)*parseFloat(n.slice(n.indexOf(" ")+1)),d=s?e.width/s:e.width,u=o?e.height/o:e.height;return{width:d,height:u,top:c,right:l+d,bottom:c+u,left:l}}const _S={ignoreTransform:!1};function ps(e,t){t===void 0&&(t=_S);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:c,transformOrigin:d}=en(e).getComputedStyle(e);c&&(n=SS(n,c,d))}const{top:r,left:s,width:o,height:i,bottom:a,right:l}=n;return{top:r,left:s,width:o,height:i,bottom:a,right:l}}function Rh(e){return ps(e,{ignoreTransform:!0})}function ES(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function MS(e,t){return t===void 0&&(t=en(e).getComputedStyle(e)),t.position==="fixed"}function NS(e,t){t===void 0&&(t=en(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(s=>{const o=t[s];return typeof o=="string"?n.test(o):!1})}function Ui(e,t){const n=[];function r(s){if(t!=null&&n.length>=t||!s)return n;if(fc(s)&&s.scrollingElement!=null&&!n.includes(s.scrollingElement))return n.push(s.scrollingElement),n;if(!so(s)||Bh(s)||n.includes(s))return n;const o=en(e).getComputedStyle(s);return s!==e&&NS(s,o)&&n.push(s),MS(s,o)?n:r(s.parentNode)}return e?r(e):n}function eg(e){const[t]=Ui(e,1);return t??null}function mc(e){return!Li||!e?null:us(e)?e:uc(e)?fc(e)||e===fs(e).scrollingElement?window:so(e)?e:null:null}function tg(e){return us(e)?e.scrollX:e.scrollLeft}function ng(e){return us(e)?e.scrollY:e.scrollTop}function bc(e){return{x:tg(e),y:ng(e)}}var $t;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})($t||($t={}));function rg(e){return!Li||!e?!1:e===document.scrollingElement}function sg(e){const t={x:0,y:0},n=rg(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},s=e.scrollTop<=t.y,o=e.scrollLeft<=t.x,i=e.scrollTop>=r.y,a=e.scrollLeft>=r.x;return{isTop:s,isLeft:o,isBottom:i,isRight:a,maxScroll:r,minScroll:t}}const OS={x:.2,y:.2};function TS(e,t,n,r,s){let{top:o,left:i,right:a,bottom:l}=n;r===void 0&&(r=10),s===void 0&&(s=OS);const{isTop:c,isBottom:d,isLeft:u,isRight:f}=sg(e),g={x:0,y:0},m={x:0,y:0},p={height:t.height*s.y,width:t.width*s.x};return!c&&o<=t.top+p.height?(g.y=$t.Backward,m.y=r*Math.abs((t.top+p.height-o)/p.height)):!d&&l>=t.bottom-p.height&&(g.y=$t.Forward,m.y=r*Math.abs((t.bottom-p.height-l)/p.height)),!f&&a>=t.right-p.width?(g.x=$t.Forward,m.x=r*Math.abs((t.right-p.width-a)/p.width)):!u&&i<=t.left+p.width&&(g.x=$t.Backward,m.x=r*Math.abs((t.left+p.width-i)/p.width)),{direction:g,speed:m}}function AS(e){if(e===document.scrollingElement){const{innerWidth:o,innerHeight:i}=window;return{top:0,left:0,right:o,bottom:i,width:o,height:i}}const{top:t,left:n,right:r,bottom:s}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:s,width:e.clientWidth,height:e.clientHeight}}function og(e){return e.reduce((t,n)=>hs(t,bc(n)),Dn)}function DS(e){return e.reduce((t,n)=>t+tg(n),0)}function IS(e){return e.reduce((t,n)=>t+ng(n),0)}function ig(e,t){if(t===void 0&&(t=ps),!e)return;const{top:n,left:r,bottom:s,right:o}=t(e);eg(e)&&(s<=0||o<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const LS=[["x",["left","right"],DS],["y",["top","bottom"],IS]];class yc{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=Ui(n),s=og(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[o,i,a]of LS)for(const l of i)Object.defineProperty(this,l,{get:()=>{const c=a(r),d=s[o]-c;return this.rect[l]+d},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class co{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var s;(s=this.target)==null||s.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function PS(e){const{EventTarget:t}=en(e);return e instanceof t?e:fs(e)}function vc(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var vn;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(vn||(vn={}));function ag(e){e.preventDefault()}function $S(e){e.stopPropagation()}var Xe;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(Xe||(Xe={}));const lg={start:[Xe.Space,Xe.Enter],cancel:[Xe.Esc],end:[Xe.Space,Xe.Enter,Xe.Tab]},FS=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case Xe.Right:return{...n,x:n.x+25};case Xe.Left:return{...n,x:n.x-25};case Xe.Down:return{...n,y:n.y+25};case Xe.Up:return{...n,y:n.y-25}}};class uo{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new co(fs(n)),this.windowListeners=new co(en(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(vn.Resize,this.handleCancel),this.windowListeners.add(vn.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(vn.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&ig(r),n(Dn)}handleKeyDown(t){if(zi(t)){const{active:n,context:r,options:s}=this.props,{keyboardCodes:o=lg,coordinateGetter:i=FS,scrollBehavior:a="smooth"}=s,{code:l}=t;if(o.end.includes(l)){this.handleEnd(t);return}if(o.cancel.includes(l)){this.handleCancel(t);return}const{collisionRect:c}=r.current,d=c?{x:c.left,y:c.top}:Dn;this.referenceCoordinates||(this.referenceCoordinates=d);const u=i(t,{active:n,context:r.current,currentCoordinates:d});if(u){const f=lo(u,d),g={x:0,y:0},{scrollableAncestors:m}=r.current;for(const p of m){const y=t.code,{isTop:b,isRight:_,isLeft:x,isBottom:M,maxScroll:S,minScroll:k}=sg(p),N=AS(p),C={x:Math.min(y===Xe.Right?N.right-N.width/2:N.right,Math.max(y===Xe.Right?N.left:N.left+N.width/2,u.x)),y:Math.min(y===Xe.Down?N.bottom-N.height/2:N.bottom,Math.max(y===Xe.Down?N.top:N.top+N.height/2,u.y))},w=y===Xe.Right&&!_||y===Xe.Left&&!x,E=y===Xe.Down&&!M||y===Xe.Up&&!b;if(w&&C.x!==u.x){const T=p.scrollLeft+f.x,P=y===Xe.Right&&T<=S.x||y===Xe.Left&&T>=k.x;if(P&&!f.y){p.scrollTo({left:T,behavior:a});return}P?g.x=p.scrollLeft-T:g.x=y===Xe.Right?p.scrollLeft-S.x:p.scrollLeft-k.x,g.x&&p.scrollBy({left:-g.x,behavior:a});break}else if(E&&C.y!==u.y){const T=p.scrollTop+f.y,P=y===Xe.Down&&T<=S.y||y===Xe.Up&&T>=k.y;if(P&&!f.x){p.scrollTo({top:T,behavior:a});return}P?g.y=p.scrollTop-T:g.y=y===Xe.Down?p.scrollTop-S.y:p.scrollTop-k.y,g.y&&p.scrollBy({top:-g.y,behavior:a});break}}this.handleMove(t,hs(lo(u,this.referenceCoordinates),g))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}uo.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=lg,onActivation:s}=t,{active:o}=n;const{code:i}=e.nativeEvent;if(r.start.includes(i)){const a=o.activatorNode.current;return a&&e.target!==a?!1:(e.preventDefault(),s?.({event:e.nativeEvent}),!0)}return!1}}];function cg(e){return!!(e&&"distance"in e)}function dg(e){return!!(e&&"delay"in e)}class xc{constructor(t,n,r){var s;r===void 0&&(r=PS(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:o}=t,{target:i}=o;this.props=t,this.events=n,this.document=fs(i),this.documentListeners=new co(this.document),this.listeners=new co(r),this.windowListeners=new co(en(i)),this.initialCoordinates=(s=Vi(o))!=null?s:Dn,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(vn.Resize,this.handleCancel),this.windowListeners.add(vn.DragStart,ag),this.windowListeners.add(vn.VisibilityChange,this.handleCancel),this.windowListeners.add(vn.ContextMenu,ag),this.documentListeners.add(vn.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(dg(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(cg(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:r,onPending:s}=this.props;s(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(vn.Click,$S,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(vn.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:s,props:o}=this,{onMove:i,options:{activationConstraint:a}}=o;if(!s)return;const l=(n=Vi(t))!=null?n:Dn,c=lo(s,l);if(!r&&a){if(cg(a)){if(a.tolerance!=null&&vc(c,a.tolerance))return this.handleCancel();if(vc(c,a.distance))return this.handleStart()}if(dg(a)&&vc(c,a.tolerance))return this.handleCancel();this.handlePending(a,c);return}t.cancelable&&t.preventDefault(),i(l)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===Xe.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const zS={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class fo extends xc{constructor(t){const{event:n}=t,r=fs(n.target);super(t,zS,r)}}fo.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];const VS={move:{name:"mousemove"},end:{name:"mouseup"}};var wc;(function(e){e[e.RightClick=2]="RightClick"})(wc||(wc={}));class HS extends xc{constructor(t){super(t,VS,fs(t.event.target))}}HS.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===wc.RightClick?!1:(r?.({event:n}),!0)}}];const kc={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class US extends xc{constructor(t){super(t,kc)}static setup(){return window.addEventListener(kc.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(kc.move.name,t)};function t(){}}}US.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:s}=n;return s.length>1?!1:(r?.({event:n}),!0)}}];var ho;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(ho||(ho={}));var Bi;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Bi||(Bi={}));function BS(e){let{acceleration:t,activator:n=ho.Pointer,canScroll:r,draggingRect:s,enabled:o,interval:i=5,order:a=Bi.TreeOrder,pointerCoordinates:l,scrollableAncestors:c,scrollableAncestorRects:d,delta:u,threshold:f}=e;const g=WS({delta:u,disabled:!o}),[m,p]=rS(),y=v.useRef({x:0,y:0}),b=v.useRef({x:0,y:0}),_=v.useMemo(()=>{switch(n){case ho.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case ho.DraggableRect:return s}},[n,s,l]),x=v.useRef(null),M=v.useCallback(()=>{const k=x.current;if(!k)return;const N=y.current.x*b.current.x,C=y.current.y*b.current.y;k.scrollBy(N,C)},[]),S=v.useMemo(()=>a===Bi.TreeOrder?[...c].reverse():c,[a,c]);v.useEffect(()=>{if(!o||!c.length||!_){p();return}for(const k of S){if(r?.(k)===!1)continue;const N=c.indexOf(k),C=d[N];if(!C)continue;const{direction:w,speed:E}=TS(k,C,_,t,f);for(const T of["x","y"])g[T][w[T]]||(E[T]=0,w[T]=0);if(E.x>0||E.y>0){p(),x.current=k,m(M,i),y.current=E,b.current=w;return}}y.current={x:0,y:0},b.current={x:0,y:0},p()},[t,M,r,p,o,i,JSON.stringify(_),JSON.stringify(g),m,c,S,d,JSON.stringify(f)])}const jS={x:{[$t.Backward]:!1,[$t.Forward]:!1},y:{[$t.Backward]:!1,[$t.Forward]:!1}};function WS(e){let{delta:t,disabled:n}=e;const r=Fi(t);return io(s=>{if(n||!r||!s)return jS;const o={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[$t.Backward]:s.x[$t.Backward]||o.x===-1,[$t.Forward]:s.x[$t.Forward]||o.x===1},y:{[$t.Backward]:s.y[$t.Backward]||o.y===-1,[$t.Forward]:s.y[$t.Forward]||o.y===1}}},[n,t,r])}function GS(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return io(s=>{var o;return t==null?null:(o=r??s)!=null?o:null},[r,t])}function YS(e,t){return v.useMemo(()=>e.reduce((n,r)=>{const{sensor:s}=r,o=s.activators.map(i=>({eventName:i.eventName,handler:t(i.handler,r)}));return[...n,...o]},[]),[e,t])}var go;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(go||(go={}));var Cc;(function(e){e.Optimized="optimized"})(Cc||(Cc={}));const ug=new Map;function KS(e,t){let{dragging:n,dependencies:r,config:s}=t;const[o,i]=v.useState(null),{frequency:a,measure:l,strategy:c}=s,d=v.useRef(e),u=y(),f=oo(u),g=v.useCallback(function(b){b===void 0&&(b=[]),!f.current&&i(_=>_===null?b:_.concat(b.filter(x=>!_.includes(x))))},[f]),m=v.useRef(null),p=io(b=>{if(u&&!n)return ug;if(!b||b===ug||d.current!==e||o!=null){const _=new Map;for(let x of e){if(!x)continue;if(o&&o.length>0&&!o.includes(x.id)&&x.rect.current){_.set(x.id,x.rect.current);continue}const M=x.node.current,S=M?new yc(l(M),M):null;x.rect.current=S,S&&_.set(x.id,S)}return _}return b},[e,o,n,u,l]);return v.useEffect(()=>{d.current=e},[e]),v.useEffect(()=>{u||g()},[n,u]),v.useEffect(()=>{o&&o.length>0&&i(null)},[JSON.stringify(o)]),v.useEffect(()=>{u||typeof a!="number"||m.current!==null||(m.current=setTimeout(()=>{g(),m.current=null},a))},[a,u,g,...r]),{droppableRects:p,measureDroppableContainers:g,measuringScheduled:o!=null};function y(){switch(c){case go.Always:return!1;case go.BeforeDragging:return n;default:return!n}}}function Sc(e,t){return io(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function XS(e,t){return Sc(e,t)}function qS(e){let{callback:t,disabled:n}=e;const r=Pi(t),s=v.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:o}=window;return new o(r)},[r,n]);return v.useEffect(()=>()=>s?.disconnect(),[s]),s}function ji(e){let{callback:t,disabled:n}=e;const r=Pi(t),s=v.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:o}=window;return new o(r)},[n]);return v.useEffect(()=>()=>s?.disconnect(),[s]),s}function ZS(e){return new yc(ps(e),e)}function fg(e,t,n){t===void 0&&(t=ZS);const[r,s]=v.useState(null);function o(){s(l=>{if(!e)return null;if(e.isConnected===!1){var c;return(c=l??n)!=null?c:null}const d=t(e);return JSON.stringify(l)===JSON.stringify(d)?l:d})}const i=qS({callback(l){if(e)for(const c of l){const{type:d,target:u}=c;if(d==="childList"&&u instanceof HTMLElement&&u.contains(e)){o();break}}}}),a=ji({callback:o});return An(()=>{o(),e?(a?.observe(e),i?.observe(document.body,{childList:!0,subtree:!0})):(a?.disconnect(),i?.disconnect())},[e]),r}function QS(e){const t=Sc(e);return Qh(e,t)}const hg=[];function JS(e){const t=v.useRef(e),n=io(r=>e?r&&r!==hg&&e&&t.current&&e.parentNode===t.current.parentNode?r:Ui(e):hg,[e]);return v.useEffect(()=>{t.current=e},[e]),n}function RS(e){const[t,n]=v.useState(null),r=v.useRef(e),s=v.useCallback(o=>{const i=mc(o.target);i&&n(a=>a?(a.set(i,bc(i)),new Map(a)):null)},[]);return v.useEffect(()=>{const o=r.current;if(e!==o){i(o);const a=e.map(l=>{const c=mc(l);return c?(c.addEventListener("scroll",s,{passive:!0}),[c,bc(c)]):null}).filter(l=>l!=null);n(a.length?new Map(a):null),r.current=e}return()=>{i(e),i(o)};function i(a){a.forEach(l=>{const c=mc(l);c?.removeEventListener("scroll",s)})}},[s,e]),v.useMemo(()=>e.length?t?Array.from(t.values()).reduce((o,i)=>hs(o,i),Dn):og(e):Dn,[e,t])}function gg(e,t){t===void 0&&(t=[]);const n=v.useRef(null);return v.useEffect(()=>{n.current=null},t),v.useEffect(()=>{const r=e!==Dn;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?lo(e,n.current):Dn}function e_(e){v.useEffect(()=>{if(!Li)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n?.()}},e.map(t=>{let{sensor:n}=t;return n}))}function t_(e,t){return v.useMemo(()=>e.reduce((n,r)=>{let{eventName:s,handler:o}=r;return n[s]=i=>{o(i,t)},n},{}),[e,t])}function pg(e){return v.useMemo(()=>e?ES(e):null,[e])}const mg=[];function n_(e,t){t===void 0&&(t=ps);const[n]=e,r=pg(n?en(n):null),[s,o]=v.useState(mg);function i(){o(()=>e.length?e.map(l=>rg(l)?r:new yc(t(l),l)):mg)}const a=ji({callback:i});return An(()=>{a?.disconnect(),i(),e.forEach(l=>a?.observe(l))},[e]),s}function bg(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return so(t)?t:e}function r_(e){let{measure:t}=e;const[n,r]=v.useState(null),s=v.useCallback(c=>{for(const{target:d}of c)if(so(d)){r(u=>{const f=t(d);return u?{...u,width:f.width,height:f.height}:f});break}},[t]),o=ji({callback:s}),i=v.useCallback(c=>{const d=bg(c);o?.disconnect(),d&&o?.observe(d),r(d?t(d):null)},[t,o]),[a,l]=$i(i);return v.useMemo(()=>({nodeRef:a,rect:n,setRef:l}),[n,a,l])}const s_=[{sensor:fo,options:{}},{sensor:uo,options:{}}],o_={current:{}},Wi={draggable:{measure:Rh},droppable:{measure:Rh,strategy:go.WhileDragging,frequency:Cc.Optimized},dragOverlay:{measure:ps}};class po extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const i_={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new po,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Hi},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Wi,measureDroppableContainers:Hi,windowRect:null,measuringScheduled:!1},yg={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Hi,draggableNodes:new Map,over:null,measureDroppableContainers:Hi},mo=v.createContext(yg),vg=v.createContext(i_);function a_(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new po}}}function l_(e,t){switch(t.type){case At.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case At.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case At.DragEnd:case At.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case At.RegisterDroppable:{const{element:n}=t,{id:r}=n,s=new po(e.droppable.containers);return s.set(r,n),{...e,droppable:{...e.droppable,containers:s}}}case At.SetDroppableDisabled:{const{id:n,key:r,disabled:s}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const i=new po(e.droppable.containers);return i.set(n,{...o,disabled:s}),{...e,droppable:{...e.droppable,containers:i}}}case At.UnregisterDroppable:{const{id:n,key:r}=t,s=e.droppable.containers.get(n);if(!s||r!==s.key)return e;const o=new po(e.droppable.containers);return o.delete(n),{...e,droppable:{...e.droppable,containers:o}}}default:return e}}function c_(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:s}=v.useContext(mo),o=Fi(r),i=Fi(n?.id);return v.useEffect(()=>{if(!t&&!r&&o&&i!=null){if(!zi(o)||document.activeElement===o.target)return;const a=s.get(i);if(!a)return;const{activatorNode:l,node:c}=a;if(!l.current&&!c.current)return;requestAnimationFrame(()=>{for(const d of[l.current,c.current]){if(!d)continue;const u=iS(d);if(u){u.focus();break}}})}},[r,t,s,i,o]),null}function xg(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((s,o)=>o({transform:s,...r}),n):n}function d_(e){return v.useMemo(()=>({draggable:{...Wi.draggable,...e?.draggable},droppable:{...Wi.droppable,...e?.droppable},dragOverlay:{...Wi.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function u_(e){let{activeNode:t,measure:n,initialRect:r,config:s=!0}=e;const o=v.useRef(!1),{x:i,y:a}=typeof s=="boolean"?{x:s,y:s}:s;An(()=>{if(!i&&!a||!t){o.current=!1;return}if(o.current||!r)return;const c=t?.node.current;if(!c||c.isConnected===!1)return;const d=n(c),u=Qh(d,r);if(i||(u.x=0),a||(u.y=0),o.current=!0,Math.abs(u.x)>0||Math.abs(u.y)>0){const f=eg(c);f&&f.scrollBy({top:u.y,left:u.x})}},[t,i,a,r,n])}const Gi=v.createContext({...Dn,scaleX:1,scaleY:1});var gr;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(gr||(gr={}));const _c=v.memo(function(t){var n,r,s,o;let{id:i,accessibility:a,autoScroll:l=!0,children:c,sensors:d=s_,collisionDetection:u=xS,measuring:f,modifiers:g,...m}=t;const p=v.useReducer(l_,void 0,a_),[y,b]=p,[_,x]=fS(),[M,S]=v.useState(gr.Uninitialized),k=M===gr.Initialized,{draggable:{active:N,nodes:C,translate:w},droppable:{containers:E}}=y,T=N!=null?C.get(N):null,P=v.useRef({initial:null,translated:null}),L=v.useMemo(()=>{var Ne;return N!=null?{id:N,data:(Ne=T?.data)!=null?Ne:o_,rect:P}:null},[N,T]),F=v.useRef(null),[A,D]=v.useState(null),[O,z]=v.useState(null),U=oo(m,Object.values(m)),j=ao("DndDescribedBy",i),Y=v.useMemo(()=>E.getEnabled(),[E]),B=d_(f),{droppableRects:W,measureDroppableContainers:G,measuringScheduled:V}=KS(Y,{dragging:k,dependencies:[w.x,w.y],config:B.droppable}),X=GS(C,N),K=v.useMemo(()=>O?Vi(O):null,[O]),Q=Re(),ne=XS(X,B.draggable.measure);u_({activeNode:N!=null?C.get(N):null,config:Q.layoutShiftCompensation,initialRect:ne,measure:B.draggable.measure});const se=fg(X,B.draggable.measure,ne),ue=fg(X?X.parentElement:null),ee=v.useRef({activatorEvent:null,active:null,activeNode:X,collisionRect:null,collisions:null,droppableRects:W,draggableNodes:C,draggingNode:null,draggingNodeRect:null,droppableContainers:E,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),me=E.getNodeFor((n=ee.current.over)==null?void 0:n.id),ie=r_({measure:B.dragOverlay.measure}),de=(r=ie.nodeRef.current)!=null?r:X,fe=k?(s=ie.rect)!=null?s:se:null,be=!!(ie.nodeRef.current&&ie.rect),ge=QS(be?null:se),Ce=pg(de?en(de):null),je=JS(k?me??X:null),oe=n_(je),Te=xg(g,{transform:{x:w.x-ge.x,y:w.y-ge.y,scaleX:1,scaleY:1},activatorEvent:O,active:L,activeNodeRect:se,containerNodeRect:ue,draggingNodeRect:fe,over:ee.current.over,overlayNodeRect:ie.rect,scrollableAncestors:je,scrollableAncestorRects:oe,windowRect:Ce}),Pe=K?hs(K,w):null,Fe=RS(je),Ke=gg(Fe),nt=gg(Fe,[se]),dt=hs(Te,Ke),We=fe?CS(fe,Te):null,pt=L&&We?u({active:L,collisionRect:We,droppableRects:W,droppableContainers:Y,pointerCoordinates:Pe}):null,Ge=qh(pt,"id"),[te,pe]=v.useState(null),we=be?Te:hs(Te,nt),xe=wS(we,(o=te?.rect)!=null?o:null,se),ke=v.useRef(null),Be=v.useCallback((Ne,Oe)=>{let{sensor:Ue,options:lt}=Oe;if(F.current==null)return;const vt=C.get(F.current);if(!vt)return;const ut=Ne.nativeEvent,ot=new Ue({active:F.current,activeNode:vt,event:ut,options:lt,context:ee,onAbort(et){if(!C.get(et))return;const{onDragAbort:Ut}=U.current,Gt={id:et};Ut?.(Gt),_({type:"onDragAbort",event:Gt})},onPending(et,Lt,Ut,Gt){if(!C.get(et))return;const{onDragPending:Mn}=U.current,Bt={id:et,constraint:Lt,initialCoordinates:Ut,offset:Gt};Mn?.(Bt),_({type:"onDragPending",event:Bt})},onStart(et){const Lt=F.current;if(Lt==null)return;const Ut=C.get(Lt);if(!Ut)return;const{onDragStart:Gt}=U.current,Yt={activatorEvent:ut,active:{id:Lt,data:Ut.data,rect:P}};Vn.unstable_batchedUpdates(()=>{Gt?.(Yt),S(gr.Initializing),b({type:At.DragStart,initialCoordinates:et,active:Lt}),_({type:"onDragStart",event:Yt}),D(ke.current),z(ut)})},onMove(et){b({type:At.DragMove,coordinates:et})},onEnd:St(At.DragEnd),onCancel:St(At.DragCancel)});ke.current=ot;function St(et){return async function(){const{active:Ut,collisions:Gt,over:Yt,scrollAdjustedTranslate:Mn}=ee.current;let Bt=null;if(Ut&&Mn){const{cancelDrop:tt}=U.current;Bt={activatorEvent:ut,active:Ut,collisions:Gt,delta:Mn,over:Yt},et===At.DragEnd&&typeof tt=="function"&&await Promise.resolve(tt(Bt))&&(et=At.DragCancel)}F.current=null,Vn.unstable_batchedUpdates(()=>{b({type:et}),S(gr.Uninitialized),pe(null),D(null),z(null),ke.current=null;const tt=et===At.DragEnd?"onDragEnd":"onDragCancel";if(Bt){const zn=U.current[tt];zn?.(Bt),_({type:tt,event:Bt})}})}}},[C]),Le=v.useCallback((Ne,Oe)=>(Ue,lt)=>{const vt=Ue.nativeEvent,ut=C.get(lt);if(F.current!==null||!ut||vt.dndKit||vt.defaultPrevented)return;const ot={active:ut};Ne(Ue,Oe.options,ot)===!0&&(vt.dndKit={capturedBy:Oe.sensor},F.current=lt,Be(Ue,Oe))},[C,Be]),ze=YS(d,Le);e_(d),An(()=>{se&&M===gr.Initializing&&S(gr.Initialized)},[se,M]),v.useEffect(()=>{const{onDragMove:Ne}=U.current,{active:Oe,activatorEvent:Ue,collisions:lt,over:vt}=ee.current;if(!Oe||!Ue)return;const ut={active:Oe,activatorEvent:Ue,collisions:lt,delta:{x:dt.x,y:dt.y},over:vt};Vn.unstable_batchedUpdates(()=>{Ne?.(ut),_({type:"onDragMove",event:ut})})},[dt.x,dt.y]),v.useEffect(()=>{const{active:Ne,activatorEvent:Oe,collisions:Ue,droppableContainers:lt,scrollAdjustedTranslate:vt}=ee.current;if(!Ne||F.current==null||!Oe||!vt)return;const{onDragOver:ut}=U.current,ot=lt.get(Ge),St=ot&&ot.rect.current?{id:ot.id,rect:ot.rect.current,data:ot.data,disabled:ot.disabled}:null,et={active:Ne,activatorEvent:Oe,collisions:Ue,delta:{x:vt.x,y:vt.y},over:St};Vn.unstable_batchedUpdates(()=>{pe(St),ut?.(et),_({type:"onDragOver",event:et})})},[Ge]),An(()=>{ee.current={activatorEvent:O,active:L,activeNode:X,collisionRect:We,collisions:pt,droppableRects:W,draggableNodes:C,draggingNode:de,draggingNodeRect:fe,droppableContainers:E,over:te,scrollableAncestors:je,scrollAdjustedTranslate:dt},P.current={initial:fe,translated:We}},[L,X,pt,We,C,de,fe,W,E,te,je,dt]),BS({...Q,delta:w,draggingRect:We,pointerCoordinates:Pe,scrollableAncestors:je,scrollableAncestorRects:oe});const Ie=v.useMemo(()=>({active:L,activeNode:X,activeNodeRect:se,activatorEvent:O,collisions:pt,containerNodeRect:ue,dragOverlay:ie,draggableNodes:C,droppableContainers:E,droppableRects:W,over:te,measureDroppableContainers:G,scrollableAncestors:je,scrollableAncestorRects:oe,measuringConfiguration:B,measuringScheduled:V,windowRect:Ce}),[L,X,se,O,pt,ue,ie,C,E,W,te,G,je,oe,B,V,Ce]),qe=v.useMemo(()=>({activatorEvent:O,activators:ze,active:L,activeNodeRect:se,ariaDescribedById:{draggable:j},dispatch:b,draggableNodes:C,over:te,measureDroppableContainers:G}),[O,ze,L,se,b,j,C,te,G]);return v.createElement(Gh.Provider,{value:x},v.createElement(mo.Provider,{value:qe},v.createElement(vg.Provider,{value:Ie},v.createElement(Gi.Provider,{value:xe},c)),v.createElement(c_,{disabled:a?.restoreFocus===!1})),v.createElement(pS,{...a,hiddenTextDescribedById:j}));function Re(){const Ne=A?.autoScrollEnabled===!1,Oe=typeof l=="object"?l.enabled===!1:l===!1,Ue=k&&!Ne&&!Oe;return typeof l=="object"?{...l,enabled:Ue}:{enabled:Ue}}}),f_=v.createContext(null),wg="button",h_="Draggable";function g_(e){let{id:t,data:n,disabled:r=!1,attributes:s}=e;const o=ao(h_),{activators:i,activatorEvent:a,active:l,activeNodeRect:c,ariaDescribedById:d,draggableNodes:u,over:f}=v.useContext(mo),{role:g=wg,roleDescription:m="draggable",tabIndex:p=0}=s??{},y=l?.id===t,b=v.useContext(y?Gi:f_),[_,x]=$i(),[M,S]=$i(),k=t_(i,t),N=oo(n);An(()=>(u.set(t,{id:t,key:o,node:_,activatorNode:M,data:N}),()=>{const w=u.get(t);w&&w.key===o&&u.delete(t)}),[u,t]);const C=v.useMemo(()=>({role:g,tabIndex:p,"aria-disabled":r,"aria-pressed":y&&g===wg?!0:void 0,"aria-roledescription":m,"aria-describedby":d.draggable}),[r,g,p,y,m,d.draggable]);return{active:l,activatorEvent:a,activeNodeRect:c,attributes:C,isDragging:y,listeners:r?void 0:k,node:_,over:f,setNodeRef:x,setActivatorNodeRef:S,transform:b}}function kg(){return v.useContext(vg)}const p_="Droppable",m_={timeout:25};function b_(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:s}=e;const o=ao(p_),{active:i,dispatch:a,over:l,measureDroppableContainers:c}=v.useContext(mo),d=v.useRef({disabled:n}),u=v.useRef(!1),f=v.useRef(null),g=v.useRef(null),{disabled:m,updateMeasurementsFor:p,timeout:y}={...m_,...s},b=oo(p??r),_=v.useCallback(()=>{if(!u.current){u.current=!0;return}g.current!=null&&clearTimeout(g.current),g.current=setTimeout(()=>{c(Array.isArray(b.current)?b.current:[b.current]),g.current=null},y)},[y]),x=ji({callback:_,disabled:m||!i}),M=v.useCallback((C,w)=>{x&&(w&&(x.unobserve(w),u.current=!1),C&&x.observe(C))},[x]),[S,k]=$i(M),N=oo(t);return v.useEffect(()=>{!x||!S.current||(x.disconnect(),u.current=!1,x.observe(S.current))},[S,x]),v.useEffect(()=>(a({type:At.RegisterDroppable,element:{id:r,key:o,disabled:n,node:S,rect:f,data:N}}),()=>a({type:At.UnregisterDroppable,key:o,id:r})),[r]),v.useEffect(()=>{n!==d.current.disabled&&(a({type:At.SetDroppableDisabled,id:r,key:o,disabled:n}),d.current.disabled=n)},[r,o,n,a]),{active:i,rect:f,isOver:l?.id===r,node:S,over:l,setNodeRef:k}}function y_(e){let{animation:t,children:n}=e;const[r,s]=v.useState(null),[o,i]=v.useState(null),a=Fi(n);return!n&&!r&&a&&s(a),An(()=>{if(!o)return;const l=r?.key,c=r?.props.id;if(l==null||c==null){s(null);return}Promise.resolve(t(c,o)).then(()=>{s(null)})},[t,r,o]),v.createElement(v.Fragment,null,n,r?v.cloneElement(r,{ref:i}):null)}const v_={x:0,y:0,scaleX:1,scaleY:1};function x_(e){let{children:t}=e;return v.createElement(mo.Provider,{value:yg},v.createElement(Gi.Provider,{value:v_},t))}const w_={position:"fixed",touchAction:"none"},k_=e=>zi(e)?"transform 250ms ease":void 0,C_=v.forwardRef((e,t)=>{let{as:n,activatorEvent:r,adjustScale:s,children:o,className:i,rect:a,style:l,transform:c,transition:d=k_}=e;if(!a)return null;const u=s?c:{...c,scaleX:1,scaleY:1},f={...w_,width:a.width,height:a.height,top:a.top,left:a.left,transform:Wn.Transform.toString(u),transformOrigin:s&&r?mS(r,a):void 0,transition:typeof d=="function"?d(r):d,...l};return v.createElement(n,{className:i,style:f,ref:t},o)}),S_={duration:250,easing:"ease",keyframes:e=>{let{transform:{initial:t,final:n}}=e;return[{transform:Wn.Transform.toString(t)},{transform:Wn.Transform.toString(n)}]},sideEffects:(e=>t=>{let{active:n,dragOverlay:r}=t;const s={},{styles:o,className:i}=e;if(o!=null&&o.active)for(const[a,l]of Object.entries(o.active))l!==void 0&&(s[a]=n.node.style.getPropertyValue(a),n.node.style.setProperty(a,l));if(o!=null&&o.dragOverlay)for(const[a,l]of Object.entries(o.dragOverlay))l!==void 0&&r.node.style.setProperty(a,l);return i!=null&&i.active&&n.node.classList.add(i.active),i!=null&&i.dragOverlay&&r.node.classList.add(i.dragOverlay),function(){for(const[l,c]of Object.entries(s))n.node.style.setProperty(l,c);i!=null&&i.active&&n.node.classList.remove(i.active)}})({styles:{active:{opacity:"0"}}})};function __(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:s}=e;return Pi((o,i)=>{if(t===null)return;const a=n.get(o);if(!a)return;const l=a.node.current;if(!l)return;const c=bg(i);if(!c)return;const{transform:d}=en(i).getComputedStyle(i),u=Jh(d);if(!u)return;const f=typeof t=="function"?t:E_(t);return ig(l,s.draggable.measure),f({active:{id:o,data:a.data,node:l,rect:s.draggable.measure(l)},draggableNodes:n,dragOverlay:{node:i,rect:s.dragOverlay.measure(c)},droppableContainers:r,measuringConfiguration:s,transform:u})})}function E_(e){const{duration:t,easing:n,sideEffects:r,keyframes:s}={...S_,...e};return o=>{let{active:i,dragOverlay:a,transform:l,...c}=o;if(!t)return;const d={x:a.rect.left-i.rect.left,y:a.rect.top-i.rect.top},u={scaleX:l.scaleX!==1?i.rect.width*l.scaleX/a.rect.width:1,scaleY:l.scaleY!==1?i.rect.height*l.scaleY/a.rect.height:1},f={x:l.x-d.x,y:l.y-d.y,...u},g=s({...c,active:i,dragOverlay:a,transform:{initial:l,final:f}}),[m]=g,p=g[g.length-1];if(JSON.stringify(m)===JSON.stringify(p))return;const y=r?.({active:i,dragOverlay:a,...c}),b=a.node.animate(g,{duration:t,easing:n,fill:"forwards"});return new Promise(_=>{b.onfinish=()=>{y?.(),_()}})}}let Cg=0;function M_(e){return v.useMemo(()=>{if(e!=null)return Cg++,Cg},[e])}const N_=v.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:r,style:s,transition:o,modifiers:i,wrapperElement:a="div",className:l,zIndex:c=999}=e;const{activatorEvent:d,active:u,activeNodeRect:f,containerNodeRect:g,draggableNodes:m,droppableContainers:p,dragOverlay:y,over:b,measuringConfiguration:_,scrollableAncestors:x,scrollableAncestorRects:M,windowRect:S}=kg(),k=v.useContext(Gi),N=M_(u?.id),C=xg(i,{activatorEvent:d,active:u,activeNodeRect:f,containerNodeRect:g,draggingNodeRect:y.rect,over:b,overlayNodeRect:y.rect,scrollableAncestors:x,scrollableAncestorRects:M,transform:k,windowRect:S}),w=Sc(f),E=__({config:r,draggableNodes:m,droppableContainers:p,measuringConfiguration:_}),T=w?y.setRef:void 0;return v.createElement(x_,null,v.createElement(y_,{animation:E},u&&N?v.createElement(C_,{key:N,id:u.id,ref:T,as:a,activatorEvent:d,adjustScale:t,className:l,transition:o,rect:w,style:{zIndex:c,...s},transform:C},n):null))});function ms(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function O_(e,t){return e.reduce((n,r,s)=>{const o=t.get(r);return o&&(n[s]=o),n},Array(e.length))}function Yi(e){return e!==null&&e>=0}function T_(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n{let{rects:t,activeIndex:n,overIndex:r,index:s}=e;const o=ms(t,r,n),i=t[s],a=o[s];return!a||!i?null:{x:a.left-i.left,y:a.top-i.top,scaleX:a.width/i.width,scaleY:a.height/i.height}},Xi={scaleX:1,scaleY:1},Ec=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:s,rects:o,overIndex:i}=e;const a=(t=o[n])!=null?t:r;if(!a)return null;if(s===n){const c=o[i];return c?{x:0,y:nn&&s<=i?{x:0,y:-a.height-l,...Xi}:s=i?{x:0,y:a.height+l,...Xi}:{x:0,y:0,...Xi}};function D_(e,t,n){const r=e[t],s=e[t-1],o=e[t+1];return r?nr.map(k=>typeof k=="object"&&"id"in k?k.id:k),[r]),m=i!=null,p=i?g.indexOf(i.id):-1,y=c?g.indexOf(c.id):-1,b=v.useRef(g),_=!T_(g,b.current),x=y!==-1&&p===-1||_,M=A_(o);An(()=>{_&&m&&d(g)},[_,g,m,d]),v.useEffect(()=>{b.current=g},[g]);const S=v.useMemo(()=>({activeIndex:p,containerId:u,disabled:M,disableTransforms:x,items:g,overIndex:y,useDragOverlay:f,sortedRects:O_(g,l),strategy:s}),[p,u,M.draggable,M.droppable,x,g,y,l,f,s]);return v.createElement(_g.Provider,{value:S},t)}const Eg=e=>{let{id:t,items:n,activeIndex:r,overIndex:s}=e;return ms(n,r,s).indexOf(t)},Mg=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:s,items:o,newIndex:i,previousItems:a,previousContainerId:l,transition:c}=e;return!c||!r||a!==o&&s===i?!1:n?!0:i!==s&&t===l},I_={duration:200,easing:"ease"},Ng="transform",L_=Wn.Transition.toString({property:Ng,duration:0,easing:"linear"}),P_={roleDescription:"sortable"};function $_(e){let{disabled:t,index:n,node:r,rect:s}=e;const[o,i]=v.useState(null),a=v.useRef(n);return An(()=>{if(!t&&n!==a.current&&r.current){const l=s.current;if(l){const c=ps(r.current,{ignoreTransform:!0}),d={x:l.left-c.left,y:l.top-c.top,scaleX:l.width/c.width,scaleY:l.height/c.height};(d.x||d.y)&&i(d)}}n!==a.current&&(a.current=n)},[t,n,r,s]),v.useEffect(()=>{o&&i(null)},[o]),o}function Zi(e){let{animateLayoutChanges:t=Mg,attributes:n,disabled:r,data:s,getNewIndex:o=Eg,id:i,strategy:a,resizeObserverConfig:l,transition:c=I_}=e;const{items:d,containerId:u,activeIndex:f,disabled:g,disableTransforms:m,sortedRects:p,overIndex:y,useDragOverlay:b,strategy:_}=v.useContext(_g),x=F_(r,g),M=d.indexOf(i),S=v.useMemo(()=>({sortable:{containerId:u,index:M,items:d},...s}),[u,s,M,d]),k=v.useMemo(()=>d.slice(d.indexOf(i)),[d,i]),{rect:N,node:C,isOver:w,setNodeRef:E}=b_({id:i,data:S,disabled:x.droppable,resizeObserverConfig:{updateMeasurementsFor:k,...l}}),{active:T,activatorEvent:P,activeNodeRect:L,attributes:F,setNodeRef:A,listeners:D,isDragging:O,over:z,setActivatorNodeRef:U,transform:j}=g_({id:i,data:S,attributes:{...P_,...n},disabled:x.draggable}),Y=nS(E,A),B=!!T,W=B&&!m&&Yi(f)&&Yi(y),G=!b&&O,V=G&&W?j:null,K=W?V??(a??_)({rects:p,activeNodeRect:L,activeIndex:f,overIndex:y,index:M}):null,Q=Yi(f)&&Yi(y)?o({id:i,items:d,activeIndex:f,overIndex:y}):M,ne=T?.id,se=v.useRef({activeId:ne,items:d,newIndex:Q,containerId:u}),ue=d!==se.current.items,ee=t({active:T,containerId:u,isDragging:O,isSorting:B,id:i,index:M,items:d,newIndex:se.current.newIndex,previousItems:se.current.items,previousContainerId:se.current.containerId,transition:c,wasDragging:se.current.activeId!=null}),me=$_({disabled:!ee,index:M,node:C,rect:N});return v.useEffect(()=>{B&&se.current.newIndex!==Q&&(se.current.newIndex=Q),u!==se.current.containerId&&(se.current.containerId=u),d!==se.current.items&&(se.current.items=d)},[B,Q,u,d]),v.useEffect(()=>{if(ne===se.current.activeId)return;if(ne!=null&&se.current.activeId==null){se.current.activeId=ne;return}const de=setTimeout(()=>{se.current.activeId=ne},50);return()=>clearTimeout(de)},[ne]),{active:T,activeIndex:f,attributes:F,data:S,rect:N,index:M,newIndex:Q,items:d,isOver:w,isSorting:B,isDragging:O,listeners:D,node:C,overIndex:y,over:z,setNodeRef:Y,setActivatorNodeRef:U,setDroppableNodeRef:E,setDraggableNodeRef:A,transform:me??K,transition:ie()};function ie(){if(me||ue&&se.current.newIndex===M)return L_;if(!(G&&!zi(P)||!c)&&(B||ee))return Wn.Transition.toString({...c,property:Ng})}}function F_(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e?.draggable)!=null?n:t.draggable,droppable:(r=e?.droppable)!=null?r:t.droppable}}function bo(e){if(!e)return!1;const t=e.data.current;return!!(t&&"sortable"in t&&typeof t.sortable=="object"&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}const z_=[Xe.Down,Xe.Right,Xe.Up,Xe.Left],Qi=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:s,droppableContainers:o,over:i,scrollableAncestors:a}}=t;if(z_.includes(e.code)){if(e.preventDefault(),!n||!r)return;const l=[];o.getEnabled().forEach(u=>{if(!u||u!=null&&u.disabled)return;const f=s.get(u.id);if(f)switch(e.code){case Xe.Down:r.topf.top&&l.push(u);break;case Xe.Left:r.left>f.left&&l.push(u);break;case Xe.Right:r.left1&&(d=c[1].id),d!=null){const u=o.get(n.id),f=o.get(d),g=f?s.get(f.id):null,m=f?.node.current;if(m&&g&&u&&f){const y=Ui(m).some((k,N)=>a[N]!==k),b=Og(u,f),_=V_(u,f),x=y||!b?{x:0,y:0}:{x:_?r.width-g.width:0,y:_?r.height-g.height:0},M={x:g.left,y:g.top};return x.x&&x.y?M:lo(M,x)}}}};function Og(e,t){return!bo(e)||!bo(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function V_(e,t){return!bo(e)||!bo(t)||!Og(e,t)?!1:e.data.current.sortable.indexwindow.G7Core,Tg=({item:e,isSelected:t=!1,isExpanded:n=!1,level:r=0,onClick:s,onToggle:o,onExpandToggle:i,className:a="",selectedClassName:l="bg-blue-50 dark:bg-blue-900/30 border-blue-500",defaultClassName:c="bg-white dark:bg-gray-800 border-gray-200 dark:border-gray-700 hover:border-gray-300 dark:hover:border-gray-600",dragHandleClassName:d="text-gray-400 hover:text-gray-600 dark:hover:text-gray-300",iconContainerClassName:u="bg-gray-100 dark:bg-gray-700",contentClassName:f="",enableDrag:g=!0,toggleDisabled:m=!1})=>{const{attributes:p,listeners:y,setNodeRef:b,transform:_,transition:x,isDragging:M}=Zi({id:e.id}),S={transform:Wn.Transform.toString(_),transition:x,opacity:M?.5:1},k=r*24+12,C=`flex items-center gap-2 cursor-pointer transition-colors ${t?l:c}`,w=U_()?.style?.mergeClasses?.(C,a)??`${C} ${a}`.trim();return h.jsxs(I,{ref:b,style:S,className:w,onClick:s,children:[g&&h.jsx(I,{...p,...y,className:`flex-shrink-0 cursor-grab active:cursor-grabbing p-1 ${d}`,style:{paddingLeft:`${k}px`},children:h.jsx(ae,{name:"grip-vertical",className:"w-4 h-4"})}),!g&&r>0&&h.jsx(I,{style:{paddingLeft:`${k}px`}}),g&&h.jsx(h.Fragment,{children:e.hasChildren?h.jsx(le,{type:"button",onClick:E=>{E.stopPropagation(),i?.()},className:`flex-shrink-0 p-1 ${d}`,children:h.jsx(ae,{name:n?"chevron-down":"chevron-right",className:"w-4 h-4"})}):h.jsx(I,{className:"flex-shrink-0 w-6"})}),h.jsx(I,{className:`flex-shrink-0 w-8 h-8 flex items-center justify-center rounded ${u}`,children:h.jsx(ae,{name:e.icon||"file",className:"w-4 h-4 text-gray-600 dark:text-gray-400"})}),h.jsxs(I,{className:`flex-1 min-w-0 ${f}`,children:[h.jsxs(I,{className:"flex items-center gap-1",children:[h.jsx(J,{className:"text-sm font-medium text-gray-900 dark:text-white truncate",children:e.name}),e.isModuleMenu&&h.jsx(ae,{name:"cube",className:"w-2 h-2 text-gray-300 dark:text-gray-500 ml-2",title:e.moduleName})]}),h.jsx(J,{className:"text-xs text-gray-500 dark:text-gray-400 truncate block",children:e.url})]}),h.jsx(I,{className:"flex-shrink-0",onClick:E=>E.stopPropagation(),children:h.jsx(hl,{checked:e.isActive,onChange:()=>o?.(new MouseEvent("click")),size:"sm",disabled:m})})]})},B_=()=>window.G7Core;function Ag(e,t,n=0,r=null){const s=[];for(const o of e)s.push({item:o,depth:n,parentId:r}),o.children?.length>0&&t.has(o.id)&&s.push(...Ag(o.children,t,n+1,o.id));return s}function Mc(e,t){for(const n of e){if(n.id===t)return n;if(n.children){const r=Mc(n.children,t);if(r)return r}}return null}function Dg(e){const t=[];if(e.children)for(const n of e.children)t.push(n.id),t.push(...Dg(n));return t}function Ig(e,t){return e.filter(n=>n.id!==t).map(n=>n.children?.length>0?{...n,children:Ig(n.children,t)}:n)}function Lg(e,t,n,r){if(n===null){const s=[...e];return s.splice(r,0,t),s}return e.map(s=>{if(s.id===n){const o=[...s.children||[]];return o.splice(r,0,t),{...s,children:o}}return s.children?.length>0?{...s,children:Lg(s.children,t,n,r)}:s})}function Pg(e,t,n,r){if(t===null){const s=e.findIndex(i=>i.id===n),o=e.findIndex(i=>i.id===r);return s===-1||o===-1?e:ms(e,s,o)}return e.map(s=>{if(s.id===t&&s.children){const o=s.children.findIndex(a=>a.id===n),i=s.children.findIndex(a=>a.id===r);return o===-1||i===-1?s:{...s,children:ms(s.children,o,i)}}return s.children?.length>0?{...s,children:Pg(s.children,t,n,r)}:s})}function $g(e){const t=e.map((s,o)=>({id:s.id,order:o+1})),n={},r=s=>{s.forEach(o=>{o.children?.length>0&&(n[o.id]=o.children.map((i,a)=>({id:i.id,order:a+1})),r(o.children))})};return r(e),{parent_menus:t,child_menus:n}}const j_=({items:e=[],selectedId:t,onSelect:n,onOrderChange:r,onToggleStatus:s,title:o,className:i="",listClassName:a="",childrenContainerClassName:l="bg-gray-50 dark:bg-gray-900/50",itemClassName:c="py-2.5 px-3 mx-4 my-2 rounded-lg border",itemSelectedClassName:d,itemDefaultClassName:u,titleClassName:f="px-4 py-3 border-b border-gray-200 dark:border-gray-700",enableDrag:g=!0,toggleDisabled:m=!1,id:p,editorAttrs:y})=>{const[b,_]=v.useState(new Set),[x,M]=v.useState(null),[S,k]=v.useState(e),N=v.useRef(!1),C=v.useRef(""),w=v.useRef(""),E=v.useCallback(W=>JSON.stringify(W),[]),T=v.useCallback(W=>W.map(G=>{const V=G.children?.map(X=>X.id).join(",")||"";return`${G.id}:${V}`}).join("|"),[]);v.useEffect(()=>{const W=T(e),G=E(e);if(N.current){const V=T(S);(W===V||W!==C.current)&&(N.current=!1,C.current=W,w.current=G,(W!==V||G!==E(S))&&k(e));return}G!==w.current&&(C.current=W,w.current=G,k(e))},[e,T,E,S]);const P=gc(gs(fo,{activationConstraint:{distance:8}}),gs(uo,{coordinateGetter:Qi})),L=v.useCallback(W=>{if(typeof W=="string")return W;const V=B_()?.locale?.current?.()||"ko";return W[V]||W.en||Object.values(W)[0]||""},[]),F=v.useCallback(W=>{_(G=>{const V=new Set(G);return V.has(W)?V.delete(W):V.add(W),V})},[]),A=v.useCallback(W=>{n?.(W)},[n]),D=v.useCallback((W,G,V)=>{V.stopPropagation(),s?.(W,G)},[s]),O=W=>{M(W.active.id)},z=W=>{const{active:G,over:V}=W;if(M(null),!V||G.id===V.id)return;const X=j.find(Q=>Q.item.id===Number(G.id)),K=j.find(Q=>Q.item.id===Number(V.id));if(!(!X||!K))if(X.parentId===K.parentId){const Q=Pg(S,X.parentId,Number(G.id),Number(V.id));k(Q),N.current=!0,r?.($g(Q))}else{const Q=X.item;if(Dg(Q).includes(Number(V.id)))return;let se=Ig(S,Q.id);const ue=j.findIndex(ge=>ge.item.id===Number(G.id)),ee=j.findIndex(ge=>ge.item.id===Number(V.id)),me=ue>ee,ie=K.parentId;let de;if(ie===null)de=se.findIndex(ge=>ge.id===Number(V.id)),de===-1?de=se.length:me||(de+=1);else{const Ce=Mc(se,ie)?.children||[];de=Ce.findIndex(je=>je.id===Number(V.id)),de===-1?de=Ce.length:me||(de+=1)}const fe={...Q,parent_id:ie,children:Q.children||[]};se=Lg(se,fe,ie,de),k(se),N.current=!0;const be=$g(se);be.moved_items=[{id:Q.id,new_parent_id:ie}],r?.(be)}},U=W=>({id:W.id,name:L(W.name),slug:W.slug,url:W.url,icon:W.icon,isActive:W.is_active,isModuleMenu:!!W.module_id,moduleName:W.module?L(W.module.name):void 0,hasChildren:W.children&&W.children.length>0}),j=v.useMemo(()=>Ag(S,b),[S,b]),Y=v.useMemo(()=>j.map(W=>W.item.id),[j]),B=x?Mc(S,Number(x)):null;return h.jsxs(I,{className:i,id:p,...y,children:[o&&h.jsx(I,{className:f,children:h.jsx(Xr,{className:"text-sm font-medium text-gray-900 dark:text-white",children:o})}),h.jsxs(_c,{sensors:P,collisionDetection:pc,onDragStart:O,onDragEnd:z,children:[h.jsx(qi,{items:Y,strategy:Ec,children:h.jsx(I,{className:a,children:j.map(W=>h.jsx(I,{className:W.depth>0?l:"",children:h.jsx(Tg,{item:U(W.item),isSelected:t===W.item.id,isExpanded:b.has(W.item.id),level:W.depth,onClick:()=>A(W.item),onToggle:G=>D(W.item.id,W.item.is_active,G),onExpandToggle:()=>F(W.item.id),className:c,selectedClassName:d,defaultClassName:u,enableDrag:g,toggleDisabled:m})},W.item.id))})}),h.jsx(N_,{children:B?h.jsx(I,{className:"bg-white dark:bg-gray-800 shadow-lg rounded-lg border border-blue-500 p-3",children:h.jsx(I,{className:"flex items-center gap-2",children:h.jsx(I,{className:"text-sm font-medium text-gray-900 dark:text-white",children:L(B.name)})})}):null})]})]})},W_=[{value:"LayoutDashboard",label:"LayoutDashboard",faIcon:"tachometer-alt"},{value:"Settings",label:"Settings",faIcon:"cog"},{value:"Menu",label:"Menu",faIcon:"bars"},{value:"Users",label:"Users",faIcon:"users"},{value:"Package",label:"Package",faIcon:"cube"},{value:"Puzzle",label:"Puzzle",faIcon:"puzzle-piece"},{value:"FileText",label:"FileText",faIcon:"file-alt"},{value:"ShoppingCart",label:"ShoppingCart",faIcon:"shopping-cart"},{value:"MessageSquare",label:"MessageSquare",faIcon:"comment"},{value:"Home",label:"Home",faIcon:"home"},{value:"User",label:"User",faIcon:"user"},{value:"Search",label:"Search",faIcon:"search"},{value:"Bell",label:"Bell",faIcon:"bell"},{value:"Mail",label:"Mail",faIcon:"envelope"},{value:"Calendar",label:"Calendar",faIcon:"calendar"},{value:"Chart",label:"Chart",faIcon:"chart-bar"},{value:"Database",label:"Database",faIcon:"database"},{value:"Lock",label:"Lock",faIcon:"lock"},{value:"Globe",label:"Globe",faIcon:"globe"},{value:"Image",label:"Image",faIcon:"image"}],G_=({value:e,onChange:t,options:n=W_,placeholder:r,searchPlaceholder:s,noResultsText:o,className:i="",disabled:a=!1,name:l,id:c,editorAttrs:d})=>{const[u,f]=v.useState(!1),[g,m]=v.useState(""),p=v.useRef(null),y=n.find(x=>{if(!e)return!1;if(e.includes("fa-")){const M=e.replace(/^(fas|far|fab|fal|fad)\s+fa-/,"");return x.faIcon===M||x.faIcon===e}return x.value===e||x.faIcon===e}),b=n.filter(x=>x.label.toLowerCase().includes(g.toLowerCase()));v.useEffect(()=>{const x=M=>{p.current&&!p.current.contains(M.target)&&(f(!1),m(""))};if(u)return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[u]);const _=x=>{const M=`fas fa-${x.faIcon}`;t?.(M),f(!1),m("")};return h.jsxs(I,{ref:p,className:`relative ${i}`,id:c,...d,children:[h.jsxs(le,{type:"button",onClick:()=>!a&&f(!u),disabled:a,className:` w-full flex items-center justify-between px-3 py-2 bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 rounded-lg text-left text-sm ${a?"opacity-50 cursor-not-allowed":"hover:border-gray-400 dark:hover:border-gray-500"} focus:outline-none focus:ring-2 focus:ring-blue-500 - `,children:[h.jsx(I,{className:"flex items-center gap-2",children:y?h.jsxs(h.Fragment,{children:[h.jsx(re,{name:y.faIcon,className:"w-4 h-4 text-gray-600 dark:text-gray-400"}),h.jsx(Q,{className:"text-gray-900 dark:text-white",children:y.label})]}):h.jsx(Q,{className:"text-gray-500 dark:text-gray-400",children:r})}),h.jsx(re,{name:"chevron-down",className:`w-4 h-4 text-gray-400 dark:text-gray-500 transition-transform ${u?"rotate-180":""}`})]}),l&&h.jsx("input",{type:"hidden",name:l,value:e||""}),u&&h.jsxs(I,{className:"absolute z-50 w-full mt-1 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg max-h-72 overflow-hidden",children:[h.jsx(I,{className:"p-2 border-b border-gray-200 dark:border-gray-700",children:h.jsx(wt,{type:"text",value:g,onChange:x=>m(x.target.value),placeholder:s,className:"w-full px-3 py-1.5 text-sm border border-gray-300 dark:border-gray-600 rounded bg-gray-50 dark:bg-gray-700 text-gray-900 dark:text-white",autoFocus:!0})}),h.jsx(I,{className:"max-h-56 overflow-y-auto",children:b.length>0?b.map(x=>h.jsxs(oe,{type:"button",onClick:()=>_(x),className:` + `,children:[h.jsx(I,{className:"flex items-center gap-2",children:y?h.jsxs(h.Fragment,{children:[h.jsx(ae,{name:y.faIcon,className:"w-4 h-4 text-gray-600 dark:text-gray-400"}),h.jsx(J,{className:"text-gray-900 dark:text-white",children:y.label})]}):h.jsx(J,{className:"text-gray-500 dark:text-gray-400",children:r})}),h.jsx(ae,{name:"chevron-down",className:`w-4 h-4 text-gray-400 dark:text-gray-500 transition-transform ${u?"rotate-180":""}`})]}),l&&h.jsx("input",{type:"hidden",name:l,value:e||""}),u&&h.jsxs(I,{className:"absolute z-50 w-full mt-1 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg max-h-72 overflow-hidden",children:[h.jsx(I,{className:"p-2 border-b border-gray-200 dark:border-gray-700",children:h.jsx(Et,{type:"text",value:g,onChange:x=>m(x.target.value),placeholder:s,className:"w-full px-3 py-1.5 text-sm border border-gray-300 dark:border-gray-600 rounded bg-gray-50 dark:bg-gray-700 text-gray-900 dark:text-white",autoFocus:!0})}),h.jsx(I,{className:"max-h-56 overflow-y-auto",children:b.length>0?b.map(x=>h.jsxs(le,{type:"button",onClick:()=>_(x),className:` w-full flex items-center gap-3 px-3 py-2 text-left text-sm ${y?.faIcon===x.faIcon?"bg-blue-50 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300":"text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-700"} - `,children:[h.jsx(re,{name:x.faIcon,className:"w-4 h-4"}),h.jsx(Q,{children:x.label}),y?.faIcon===x.faIcon&&h.jsx(re,{name:"check",className:"w-4 h-4 ml-auto text-blue-600"})]},x.value)):h.jsx(I,{className:"px-3 py-4 text-sm text-gray-500 dark:text-gray-400 text-center",children:o})})]})]})},ic=({defaultOpen:e=!1,isOpen:t,onToggle:n,className:r="",style:s,children:o,disabled:i=!1,id:a,editorAttrs:l})=>{const[c,d]=v.useState(e),u=t!==void 0,f=u?t:c,g=v.useRef(null),[m,p]=v.useState(e?void 0:0),y=()=>{if(i)return;const _=!f;u||d(_),n?.(_)};v.useEffect(()=>{if(g.current)if(f){p(g.current.scrollHeight);const _=setTimeout(()=>{p(void 0)},300);return()=>clearTimeout(_)}else p(g.current.scrollHeight),requestAnimationFrame(()=>{p(0)})},[f]);const b={};if(v.Children.forEach(o,_=>{if(v.isValidElement(_)){const x=_.props?.slot;x==="trigger"?b.trigger=_:x==="content"&&(b.content=_)}}),!b.trigger&&!b.content){const _=v.Children.toArray(o);_.length>=2?(b.trigger=_[0],b.content=_.slice(1)):_.length===1&&(b.content=_[0])}return h.jsxs(I,{className:`border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden ${r}`,style:s,id:a,...l,children:[h.jsxs(oe,{type:"button",onClick:y,disabled:i,className:`w-full flex items-center justify-between p-3 text-left bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors ${i?"opacity-50 cursor-not-allowed":""} ${f?"border-b border-gray-200 dark:border-gray-700":""}`,"aria-expanded":f,children:[h.jsx(I,{className:"flex-1",children:b.trigger}),!b.trigger&&h.jsx("svg",{className:`w-5 h-5 text-gray-500 dark:text-gray-400 transition-transform duration-200 ${f?"rotate-180":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),h.jsx(I,{ref:g,className:"overflow-hidden transition-all duration-300 ease-in-out",style:{height:m!==void 0?`${m}px`:"auto"},children:h.jsx(I,{className:"bg-white dark:bg-gray-800",children:b.content})})]})},no=window.G7Core,rg=no?.useControllableState,sg=(e,t)=>window.G7Core?.t?.(e,t)??e,jS={"":"common.scope_type_all_desc",self:"common.scope_type_self_desc",role:"common.scope_type_role_desc"},WS=({options:e,value:t,onChange:n,disabled:r=!1})=>{const[s,o]=v.useState(!1),[i,a]=v.useState({}),l=v.useRef(null),c=e.find(u=>u.value===t)??e[0];v.useEffect(()=>{if(!s)return;const u=g=>{l.current&&!l.current.contains(g.target)&&o(!1)},f=()=>{if(!l.current)return;const g=l.current.getBoundingClientRect();a({position:"fixed",top:g.bottom+4,right:window.innerWidth-g.right,zIndex:9999})};return document.addEventListener("mousedown",u),window.addEventListener("scroll",f,!0),window.addEventListener("resize",f),()=>{document.removeEventListener("mousedown",u),window.removeEventListener("scroll",f,!0),window.removeEventListener("resize",f)}},[s]);const d=v.useCallback(()=>{if(r||!l.current)return;const u=l.current.getBoundingClientRect();a({position:"fixed",top:u.bottom+4,right:window.innerWidth-u.right,zIndex:9999}),o(f=>!f)},[r]);return h.jsxs(I,{ref:l,className:"relative flex-shrink-0",children:[h.jsxs(I,{role:"button",tabIndex:0,onClick:u=>{u.stopPropagation(),u.preventDefault(),d()},onMouseDown:u=>u.stopPropagation(),onKeyDown:u=>{(u.key==="Enter"||u.key===" ")&&(u.stopPropagation(),u.preventDefault(),d()),u.key==="Escape"&&o(!1)},className:`flex items-center gap-1 text-xs px-2 py-1 rounded border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-700 dark:text-gray-300 cursor-pointer select-none ${r?"opacity-50 cursor-not-allowed":"hover:border-blue-400 dark:hover:border-blue-500"}`,children:[h.jsx(Q,{children:c?.label??""}),h.jsx(re,{name:de.ChevronDown,className:"w-3 h-3 text-gray-400 dark:text-gray-500"})]}),s&&h.jsx(I,{style:i,className:"w-56 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-600 rounded-lg shadow-lg py-1",children:e.map(u=>{const f=u.value??"",g=jS[f],m=g?sg(g):"",p=u.value===t;return h.jsxs(I,{role:"option","aria-selected":p,onClick:y=>{y.stopPropagation(),y.preventDefault(),n(u.value),o(!1)},onMouseDown:y=>y.stopPropagation(),className:`px-3 py-2 cursor-pointer transition-colors ${p?"bg-blue-50 dark:bg-blue-900/30":"hover:bg-gray-50 dark:hover:bg-gray-700/50"}`,children:[h.jsxs(I,{className:"flex items-center justify-between",children:[h.jsx(Q,{className:`text-xs font-medium ${p?"text-blue-700 dark:text-blue-300":"text-gray-900 dark:text-white"}`,children:u.label}),p&&h.jsx(re,{name:de.Check,className:"w-3.5 h-3.5 text-blue-600 dark:text-blue-400"})]}),m&&h.jsx(Q,{className:"block text-xs text-gray-500 dark:text-gray-400 mt-0.5",children:m})]},f||"__null__")})})]})},GS=(e,t)=>{if(e.length!==t.length)return!1;const n=[...e].sort((s,o)=>s.id-o.id),r=[...t].sort((s,o)=>s.id-o.id);return n.every((s,o)=>s.id===r[o].id&&s.scope_type===r[o].scope_type)},YS=({data:e=[],value:t=[],onChange:n,scopeOptions:r=[],className:s="",disabled:o=!1,desktopColumns:i=2,installedModules:a=[],installedPlugins:l=[],id:c,editorAttrs:d})=>{const u=v.useCallback(M=>{if(n){const T=no?.createChangeEvent?no.createChangeEvent({value:M}):{target:{value:M}};n(T)}},[n]),[f,g]=rg?rg(t,[],u,{isEqual:GS}):(()=>{const[M,T]=v.useState(t),L=v.useRef(n);L.current=n;const P=v.useRef(!1);v.useEffect(()=>{if(P.current){P.current=!1;return}T(t)},[t]);const F=v.useCallback(D=>{P.current=!0,T(A=>{const O=typeof D=="function"?D(A):D;if(L.current){const V=no?.createChangeEvent?no.createChangeEvent({value:O}):{target:{value:O}};L.current(V)}return O})},[]);return[M,F]})(),m=v.useMemo(()=>new Set(f.map(M=>M.id)),[f]),p=v.useCallback(M=>M.is_assignable?[M.id]:M.children.flatMap(T=>p(T)),[]),y=v.useCallback(M=>{const T=p(M);return T.length>0&&T.every(L=>m.has(L))},[m,p]),b=v.useCallback(M=>{const T=p(M),L=T.filter(P=>m.has(P)).length;return L>0&&Lp(M).filter(L=>m.has(L)).length,[m,p]),x=v.useCallback((M,T)=>{o||g(L=>T?[...L,{id:M,scope_type:null}]:L.filter(P=>P.id!==M))},[o,g]),E=v.useCallback((M,T)=>{if(o)return;const L=p(M),P=new Set(L);g(F=>{if(T){const D=new Set(F.map(O=>O.id)),A=L.filter(O=>!D.has(O)).map(O=>({id:O,scope_type:null}));return[...F,...A]}else return F.filter(D=>!P.has(D.id))})},[o,p,g]),S=v.useCallback((M,T)=>{o||g(L=>L.map(P=>P.id===M?{...P,scope_type:T}:P))},[o,g]),w=M=>{const T=m.has(M.id),L=!!M.resource_route_key,P=T&&L&&r.length>0,F=f.find(D=>D.id===M.id)?.scope_type??null;return h.jsxs(on,{className:`flex items-start gap-3 p-3 rounded-lg border cursor-pointer transition-colors ${T?"border-blue-200 bg-blue-50 dark:border-blue-800 dark:bg-blue-900/20":"border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-700/50"} ${o?"opacity-50 cursor-not-allowed":""}`,children:[h.jsx(wt,{type:"checkbox",checked:T,onChange:D=>{D.stopPropagation(),x(M.id,D.target.checked)},disabled:o,className:"w-4 h-4 mt-0.5 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:bg-gray-700 dark:border-gray-600"}),h.jsxs(I,{className:"flex-1 min-w-0",children:[h.jsxs(I,{className:"flex items-center justify-between gap-2",children:[h.jsx(Q,{className:"text-sm font-medium text-gray-900 dark:text-white",children:M.name}),P&&h.jsx(WS,{options:r,value:F,onChange:D=>S(M.id,D),disabled:o})]}),M.description&&h.jsx(Q,{className:"block text-xs text-gray-500 dark:text-gray-400 mt-0.5",children:M.description})]})]},M.id)},N=(M,T)=>{const L=y(M),P=b(M),F=_(M),D=M.children.filter(V=>V.is_assignable);if(D.length===0&&M.children.length===0)return null;const A=M.children.some(V=>!V.is_assignable),O=i===1?"grid-cols-1":i===3?"grid-cols-1 md:grid-cols-3":"grid-cols-1 md:grid-cols-2";return h.jsxs(ic,{defaultOpen:!1,className:"border-0 rounded-none",children:[h.jsxs(I,{slot:"trigger",className:"flex items-center gap-3 w-full py-2",children:[h.jsx("input",{type:"checkbox",checked:L,ref:V=>{V&&(V.indeterminate=P)},onChange:V=>{V.stopPropagation(),E(M,V.target.checked)},onClick:V=>V.stopPropagation(),onMouseDown:V=>V.stopPropagation(),disabled:o,className:"w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:bg-gray-700 dark:border-gray-600"}),h.jsx(re,{name:de.Folder,className:"w-4 h-4 text-gray-400 dark:text-gray-500"}),h.jsx(Q,{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:M.name}),h.jsxs(Q,{className:"inline-flex items-center px-1.5 py-0.5 rounded text-xs font-medium bg-gray-100 text-gray-600 dark:bg-gray-700 dark:text-gray-300 ml-1",children:[F,"/",M.leaf_count]}),h.jsx(re,{name:de.ChevronDown,className:"w-4 h-4 text-gray-400 dark:text-gray-500 ml-auto"})]}),h.jsx(I,{slot:"content",className:`pl-8 grid ${O} gap-2 py-2`,children:A?M.children.map(V=>V.is_assignable?w(V):N(V)):D.map(V=>w(V))})]},M.id)},C=M=>{if(M.extension_type==="core")return"core";if(M.extension_type==="module")return"module";if(M.extension_type==="plugin")return"plugin";const T=M.extension_identifier??M.module??"";return T==="core"||!T?"core":l?.some(P=>P.identifier===T)?"plugin":"module"},k=M=>{const T=y(M),L=b(M),P=_(M),F=C(M);return h.jsxs(ic,{defaultOpen:!1,className:"mb-2",children:[h.jsxs(I,{slot:"trigger",className:"flex items-center gap-3 w-full py-2",children:[h.jsx("input",{type:"checkbox",checked:T,ref:D=>{D&&(D.indeterminate=L)},onChange:D=>{D.stopPropagation(),E(M,D.target.checked)},onClick:D=>D.stopPropagation(),onMouseDown:D=>D.stopPropagation(),disabled:o,className:"w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:bg-gray-700 dark:border-gray-600"}),h.jsx(re,{name:F==="core"?de.Cog:de.Cube,className:"w-5 h-5 text-gray-400 dark:text-gray-500"}),h.jsx(Q,{className:"font-medium text-gray-900 dark:text-white",children:M.name}),F!=="core"&&h.jsx(ah,{type:F,identifier:M.extension_identifier??M.module,installedModules:a,installedPlugins:l}),h.jsxs(Q,{className:"inline-flex items-center px-1.5 py-0.5 rounded text-xs font-medium bg-gray-100 text-gray-600 dark:bg-gray-700 dark:text-gray-300 ml-2",children:[P,"/",M.leaf_count]}),h.jsx(re,{name:de.ChevronDown,className:"w-4 h-4 text-gray-400 dark:text-gray-500 ml-auto"})]}),h.jsx(I,{slot:"content",className:"pl-8 space-y-2 pb-2",children:M.children.map(D=>D.is_assignable?w(D):N(D))})]},M.id)};return e.length===0?h.jsx(I,{className:`text-sm text-gray-400 dark:text-gray-500 py-4 text-center ${s}`,id:c,...d,children:sg("common.no_data")??"데이터가 없습니다."}):h.jsx(I,{className:`space-y-2 ${s}`,id:c,...d,children:e.map(M=>k(M))})};function KS({text:e,keyword:t}){if(!t||!e)return h.jsx(h.Fragment,{children:e});const n=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),r=e.split(new RegExp(`(${n})`,"gi"));return h.jsx(h.Fragment,{children:r.map((s,o)=>s.toLowerCase()===t.toLowerCase()?h.jsx(Q,{className:"bg-yellow-200 dark:bg-yellow-700 rounded px-0.5",children:s},o):s)})}const XS=({data:e=[],expandedIds:t=[],selectedIds:n=[],searchKeyword:r="",showProductCount:s=!1,selectable:o=!1,className:i="",onToggle:a,onSelectionChange:l,id:c,editorAttrs:d})=>{const u=v.useCallback(y=>{if(!a)return;const b=t.includes(y)?t.filter(_=>_!==y):[...t,y];a(b)},[t,a]),f=v.useCallback((y,b)=>{if(!l)return;const _=b?[...n,y]:n.filter(x=>x!==y);l(_)},[n,l]),g=v.useMemo(()=>{if(!r)return null;const y=new Set,b=_=>{for(const x of _)(x.localized_name||x.name).toLowerCase().includes(r.toLowerCase())&&y.add(x.id),x.children&&b(x.children)};return b(e),y},[e,r]),m=v.useCallback(y=>!g||g.has(y.id)?!0:(y.children??[]).some(b=>m(b)),[g]),p=(y,b=0)=>{const _=(y.children??[]).length>0,x=t.includes(y.id),E=n.includes(y.id),S=y.localized_name||y.name;return r&&!m(y)?null:h.jsxs(I,{"data-testid":`category-node-${y.id}`,children:[h.jsxs(I,{className:`flex items-center gap-2 py-1.5 px-2 rounded cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-700/50 transition-colors ${b>0?"ml-"+Math.min(b*5,20):""}`,style:b>0?{marginLeft:`${b*20}px`}:void 0,children:[_?h.jsx(I,{className:"flex-shrink-0 w-5 h-5 flex items-center justify-center text-gray-400 dark:text-gray-500",onClick:()=>u(y.id),"data-testid":`toggle-${y.id}`,children:h.jsx(re,{name:x?de.CaretDown:de.CaretRight,className:"text-xs"})}):h.jsx(I,{className:"flex-shrink-0 w-5 h-5"}),o&&h.jsx(Cn,{checked:E,onChange:w=>{w.stopPropagation(),f(y.id,w.target.checked)},className:"flex-shrink-0","data-testid":`checkbox-${y.id}`}),h.jsx(re,{name:de.Folder,className:`flex-shrink-0 text-sm ${_?"text-yellow-500 dark:text-yellow-400":"text-gray-400 dark:text-gray-500"}`}),h.jsx(Q,{className:"text-sm text-gray-700 dark:text-gray-300 select-none",onClick:()=>_&&u(y.id),children:h.jsx(KS,{text:S,keyword:r})}),s&&y.products_count!==void 0&&h.jsx(Q,{className:"inline-flex items-center px-1.5 py-0.5 rounded text-xs font-medium bg-gray-100 text-gray-500 dark:bg-gray-700 dark:text-gray-400 ml-1",children:y.products_count})]}),_&&x&&h.jsx(I,{"data-testid":`children-${y.id}`,children:(y.children??[]).map(w=>p(w,b+1))})]},y.id)};return e.length===0?h.jsx(I,{className:`text-sm text-gray-400 dark:text-gray-500 py-4 text-center ${i}`,id:c,...d,children:"데이터가 없습니다."}):h.jsx(I,{className:`border border-gray-200 dark:border-gray-700 rounded-lg p-2 max-h-80 overflow-y-auto ${i}`,id:c,...d,children:e.map(y=>p(y,0))})},og="carousel",ro="controller",qS="navigation",ZS="no-scroll",ac="portal",QS="root",ig="toolbar",JS="counter",so="fullscreen",ag="slideshow",oo="thumbnails",lg="zoom",rs="loading",lc="playing",io="error",ao="complete",RS="placeholder",lo=e=>`active-slide-${e}`,e_=lo(rs),t_=lo(lc),n_=lo(io),r_=lo(ao),cg="fullsize",ss="flex_center",s_="no_scroll",dg="no_scroll_padding",cc="slide",ug="slide_wrapper",o_="slide_wrapper_interactive",or="prev",ir="next",dc="swipe",os="close",fg="onPointerDown",hg="onPointerMove",gg="onPointerUp",pg="onPointerLeave",mg="onPointerCancel",uc="onKeyDown",i_="onKeyUp",fc="onWheel",a_="Escape",l_="ArrowLeft",c_="ArrowRight",d_="button",Fi="icon",bg="contain",yg="cover",vg="Unknown action type",xg="yarl__";function Ht(...e){return[...e].filter(Boolean).join(" ")}function Ne(e){return`${xg}${e}`}function dt(e){return`--${xg}${e}`}function mr(e,t){return`${e}${t?`_${t}`:""}`}function br(e){return t=>mr(e,t)}function yr(e,t){var n;return(n=e?.[t])!==null&&n!==void 0?n:t}function wg(e,t,n){return yr(e,"{index} of {total}").replace(/\{index}/g,`${mc(n,t.length)+1}`).replace(/\{total}/g,`${t.length}`)}function is(...e){return()=>{e.forEach(t=>{t()})}}function hn(e,t,n){return()=>{const r=$.useContext(n);if(!r)throw new Error(`${e} must be used within a ${t}.Provider`);return r}}function hc(){return typeof window<"u"}function gc(e,t=0){const n=10**t;return Math.round((e+Number.EPSILON)*n)/n}function vr(e){return e.type===void 0||e.type==="image"}function pc(e,t){return e.imageFit===yg||e.imageFit!==bg&&t===yg}function Vi(e){return typeof e=="string"?Number.parseInt(e,10):e}function zi(e){if(typeof e=="number")return{pixel:e};if(typeof e=="string"){const t=Vi(e);return e.endsWith("%")?{percent:t}:{pixel:t}}return{pixel:0}}function u_(e,t){const n=zi(t),r=n.percent!==void 0?e.width/100*n.percent:n.pixel;return{width:Math.max(e.width-2*r,0),height:Math.max(e.height-2*r,0)}}function f_(){return(hc()?window?.devicePixelRatio:void 0)||1}function mc(e,t){return t>0?(e%t+t)%t:0}function bc(e){return e.length>0}function yc(e,t){return e[mc(t,e.length)]}function vc(e,t){return bc(e)?yc(e,t):void 0}function kg(e){return vr(e)?e.src:void 0}function Hi(e,t,n){if(!n)return e;const{buttons:r,...s}=e,o=r.findIndex(a=>a===t),i=$.isValidElement(n)?$.cloneElement(n,{key:t},null):n;if(o>=0){const a=[...r];return a.splice(o,1,i),{buttons:a,...s}}return{buttons:[i,...r],...s}}function Cg(e,t,n=0){return Math.min(e.preload,Math.max(e.finite?t.length-1:Math.floor(t.length/2),n))}const h_=Number($.version.split(".")[0])>=19;function g_(e){return{inert:h_?e:e?"":void 0}}function p_(e){e.scrollTop}const xc={open:!1,close:()=>{},index:0,slides:[],render:{},plugins:[],toolbar:{buttons:[os]},labels:{},animation:{fade:250,swipe:500,easing:{fade:"ease",swipe:"ease-out",navigation:"ease-in-out"}},carousel:{finite:!1,preload:2,padding:"16px",spacing:"30%",imageFit:bg,imageProps:{}},controller:{ref:null,focus:!0,aria:!1,touchAction:"none",closeOnPullUp:!1,closeOnPullDown:!1,closeOnBackdropClick:!1,preventDefaultWheelX:!0,preventDefaultWheelY:!1,disableSwipeNavigation:!1},portal:{},noScroll:{disabled:!1},on:{},styles:{},className:""};function gn(e,t){return{name:e,component:t}}function Dt(e,t){return{module:e,children:t}}function Sg(e,t,n){return e.module.name===t?n(e):e.children?[Dt(e.module,e.children.flatMap(r=>{var s;return(s=Sg(r,t,n))!==null&&s!==void 0?s:[]}))]:[e]}function as(e,t,n){return e.flatMap(r=>{var s;return(s=Sg(r,t,n))!==null&&s!==void 0?s:[]})}function m_(e,t=[],n=[]){let r=e;const s=g=>{const m=[...r];for(;m.length>0;){const p=m.pop();if(p?.module.name===g)return!0;p?.children&&m.push(...p.children)}return!1},o=(g,m)=>{if(g===""){r=[Dt(m,r)];return}r=as(r,g,p=>[Dt(m,[p])])},i=(g,m)=>{r=as(r,g,p=>[Dt(p.module,[Dt(m,p.children)])])},a=(g,m,p)=>{r=as(r,g,y=>{var b;return[Dt(y.module,[...p?[Dt(m)]:[],...(b=y.children)!==null&&b!==void 0?b:[],...p?[]:[Dt(m)]])]})},l=(g,m,p)=>{r=as(r,g,y=>[...p?[Dt(m)]:[],y,...p?[]:[Dt(m)]])},c=g=>{i(ro,g)},d=(g,m)=>{r=as(r,g,p=>[Dt(m,p.children)])},u=g=>{r=as(r,g,m=>m.children)},f=g=>{n.push(g)};return t.forEach(g=>{g({contains:s,addParent:o,append:i,addChild:a,addSibling:l,addModule:c,replace:d,remove:u,augment:f})}),{config:r,augmentation:g=>n.reduce((m,p)=>p(m),g)}}const _g=$.createContext(null),wc=hn("useA11yContext","A11yContext",_g);function b_({children:e}){const[t,n]=$.useState(!1),[r,s]=$.useState(!1),o=$.useMemo(()=>({focusWithin:t,trackFocusWithin:(a,l)=>{const c=d=>u=>{var f;u.currentTarget.contains(u.relatedTarget)||n(d),(f=d?a:l)===null||f===void 0||f(u)};return{onFocus:c(!0),onBlur:c(!1)}},autoPlaying:r,setAutoPlaying:s}),[t,r]);return $.createElement(_g.Provider,{value:o},e)}const Eg=$.createContext(null),ls=hn("useDocument","DocumentContext",Eg);function y_({nodeRef:e,children:t}){const n=$.useMemo(()=>{const r=o=>{var i;return((i=o||e.current)===null||i===void 0?void 0:i.ownerDocument)||document};return{getOwnerDocument:r,getOwnerWindow:o=>{var i;return((i=r(o))===null||i===void 0?void 0:i.defaultView)||window}}},[e]);return $.createElement(Eg.Provider,{value:n},t)}const Mg=$.createContext(null),cs=hn("useEvents","EventsContext",Mg);function v_({children:e}){const[t]=$.useState({});$.useEffect(()=>()=>{Object.keys(t).forEach(r=>delete t[r])},[t]);const n=$.useMemo(()=>{const r=(i,a)=>{var l;(l=t[i])===null||l===void 0||l.splice(0,t[i].length,...t[i].filter(c=>c!==a))};return{publish:(...[i,a])=>{var l;(l=t[i])===null||l===void 0||l.forEach(c=>c(a))},subscribe:(i,a)=>(t[i]||(t[i]=[]),t[i].push(a),()=>r(i,a)),unsubscribe:r}},[t]);return $.createElement(Mg.Provider,{value:n},e)}const Ng=$.createContext(null),It=hn("useLightboxProps","LightboxPropsContext",Ng);function Og({children:e,...t}){return $.createElement(Ng.Provider,{value:t},e)}const Tg=$.createContext(null),pn=hn("useLightboxState","LightboxStateContext",Tg),Ag=$.createContext(null),x_=hn("useLightboxDispatch","LightboxDispatchContext",Ag);function w_(e,t){switch(t.type){case"swipe":{const{slides:n}=e,r=t?.increment||0,s=e.globalIndex+r,o=mc(s,n.length),i=vc(n,o),a=r||t.duration!==void 0?{increment:r,duration:t.duration,easing:t.easing}:void 0;return{slides:n,currentIndex:o,globalIndex:s,currentSlide:i,animation:a}}case"update":return t.slides!==e.slides||t.index!==e.currentIndex?{slides:t.slides,currentIndex:t.index,globalIndex:t.index,currentSlide:vc(t.slides,t.index)}:e;default:throw new Error(vg)}}function k_({slides:e,index:t,children:n}){const[r,s]=$.useReducer(w_,{slides:e,currentIndex:t,globalIndex:t,currentSlide:vc(e,t)});$.useEffect(()=>{s({type:"update",slides:e,index:t})},[e,t]);const o=$.useMemo(()=>({...r,state:r,dispatch:s}),[r,s]);return $.createElement(Ag.Provider,{value:s},$.createElement(Tg.Provider,{value:o},n))}const Dg=$.createContext(null),co=hn("useTimeouts","TimeoutsContext",Dg);function C_({children:e}){const[t]=$.useState([]);$.useEffect(()=>()=>{t.forEach(r=>window.clearTimeout(r)),t.splice(0,t.length)},[t]);const n=$.useMemo(()=>{const r=i=>{t.splice(0,t.length,...t.filter(a=>a!==i))};return{setTimeout:(i,a)=>{const l=window.setTimeout(()=>{r(l),i()},a);return t.push(l),l},clearTimeout:i=>{i!==void 0&&(r(i),window.clearTimeout(i))}}},[t]);return $.createElement(Dg.Provider,{value:n},e)}const ds=$.forwardRef(function({label:t,className:n,icon:r,renderIcon:s,onClick:o,style:i,...a},l){const{styles:c,labels:d}=It(),u=yr(d,t);return $.createElement("button",{ref:l,type:"button",title:u,"aria-label":u,className:Ht(Ne(d_),n),onClick:o,style:{...i,...c.button},...a},s?s():$.createElement(r,{className:Ne(Fi),style:c.icon}))});function Ig(e,t){const n=r=>$.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"24",height:"24","aria-hidden":"true",focusable:"false",...r},t);return n.displayName=e,n}function en(e,t){return Ig(e,$.createElement("g",{fill:"currentColor"},$.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),t))}function S_(e,t){return Ig(e,$.createElement($.Fragment,null,$.createElement("defs",null,$.createElement("mask",{id:"strike"},$.createElement("path",{d:"M0 0h24v24H0z",fill:"white"}),$.createElement("path",{d:"M0 0L24 24",stroke:"black",strokeWidth:4}))),$.createElement("path",{d:"M0.70707 2.121320L21.878680 23.292883",stroke:"currentColor",strokeWidth:2}),$.createElement("g",{fill:"currentColor",mask:"url(#strike)"},$.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),t)))}const __=en("Close",$.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"})),E_=en("Previous",$.createElement("path",{d:"M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"})),M_=en("Next",$.createElement("path",{d:"M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"})),N_=en("Loading",$.createElement($.Fragment,null,Array.from({length:8}).map((e,t,n)=>$.createElement("line",{key:t,x1:"12",y1:"6.5",x2:"12",y2:"1.8",strokeLinecap:"round",strokeWidth:"2.6",stroke:"currentColor",strokeOpacity:1/n.length*(t+1),transform:`rotate(${360/n.length*t}, 12, 12)`})))),O_=en("Error",$.createElement("path",{d:"M21.9,21.9l-8.49-8.49l0,0L3.59,3.59l0,0L2.1,2.1L0.69,3.51L3,5.83V19c0,1.1,0.9,2,2,2h13.17l2.31,2.31L21.9,21.9z M5,18 l3.5-4.5l2.5,3.01L12.17,15l3,3H5z M21,18.17L5.83,3H19c1.1,0,2,0.9,2,2V18.17z"})),Mn=hc()?$.useLayoutEffect:$.useEffect;function kc(){const[e,t]=$.useState(!1);return $.useEffect(()=>{var n,r;const s=(n=window.matchMedia)===null||n===void 0?void 0:n.call(window,"(prefers-reduced-motion: reduce)");t(s?.matches);const o=i=>t(i.matches);return(r=s?.addEventListener)===null||r===void 0||r.call(s,"change",o),()=>{var i;return(i=s?.removeEventListener)===null||i===void 0?void 0:i.call(s,"change",o)}},[]),e}function T_(e){let t=0,n=0,r=0;const o=window.getComputedStyle(e).transform.match(/matrix.*\((.+)\)/);if(o){const i=o[1].split(",").map(Vi);i.length===6?(t=i[4],n=i[5]):i.length===16&&(t=i[12],n=i[13],r=i[14])}return{x:t,y:n,z:r}}function Cc(e,t){const n=$.useRef(void 0),r=$.useRef(void 0),s=kc();return Mn(()=>{var o,i,a;if(e.current&&n.current!==void 0&&!s){const{keyframes:l,duration:c,easing:d,onfinish:u}=t(n.current,e.current.getBoundingClientRect(),T_(e.current))||{};if(l&&c){(o=r.current)===null||o===void 0||o.cancel(),r.current=void 0;try{r.current=(a=(i=e.current).animate)===null||a===void 0?void 0:a.call(i,l,{duration:c,easing:d})}catch(f){console.error(f)}r.current&&(r.current.onfinish=()=>{r.current=void 0,u?.()})}}n.current=void 0}),{prepareAnimation:o=>{n.current=o},isAnimationPlaying:()=>{var o;return((o=r.current)===null||o===void 0?void 0:o.playState)==="running"}}}function Lg(){const e=$.useRef(null),t=$.useRef(void 0),[n,r]=$.useState();return{setContainerRef:$.useCallback(o=>{e.current=o,t.current&&(t.current.disconnect(),t.current=void 0);const i=()=>{if(o){const a=window.getComputedStyle(o),l=c=>parseFloat(c)||0;r({width:Math.round(o.clientWidth-l(a.paddingLeft)-l(a.paddingRight)),height:Math.round(o.clientHeight-l(a.paddingTop)-l(a.paddingBottom))})}else r(void 0)};i(),o&&typeof ResizeObserver<"u"&&(t.current=new ResizeObserver(i),t.current.observe(o))},[]),containerRef:e,containerRect:n}}function Ui(){const e=$.useRef(void 0),{setTimeout:t,clearTimeout:n}=co();return $.useCallback((r,s)=>{n(e.current),e.current=t(r,s>0?s:0)},[t,n])}function We(e){const t=$.useRef(e);return Mn(()=>{t.current=e}),$.useCallback((...n)=>{var r;return(r=t.current)===null||r===void 0?void 0:r.call(t,...n)},[])}function Pg(e,t){typeof e=="function"?e(t):e&&(e.current=t)}function Sc(e,t){return $.useMemo(()=>e==null&&t==null?null:n=>{Pg(e,n),Pg(t,n)},[e,t])}function $g(e,t=!1){const n=$.useRef(!1);Mn(()=>{t&&n.current&&(n.current=!1,e())},[t,e]);const r=$.useCallback(()=>{n.current=!0},[]),s=$.useCallback(()=>{n.current=!1},[]);return{onFocus:r,onBlur:s}}function Bi(){const[e,t]=$.useState(!1);return Mn(()=>{t(window.getComputedStyle(window.document.documentElement).direction==="rtl")},[]),e}function Fg(){const[e]=$.useState({}),t=$.useCallback((s,o)=>{var i;(i=e[s])===null||i===void 0||i.forEach(a=>{o.isPropagationStopped()||a(o)})},[e]),n=$.useMemo(()=>({onPointerDown:s=>t(fg,s),onPointerMove:s=>t(hg,s),onPointerUp:s=>t(gg,s),onPointerLeave:s=>t(pg,s),onPointerCancel:s=>t(mg,s),onKeyDown:s=>t(uc,s),onKeyUp:s=>t(i_,s),onWheel:s=>t(fc,s)}),[t]),r=$.useCallback((s,o)=>(e[s]||(e[s]=[]),e[s].unshift(o),()=>{const i=e[s];i&&i.splice(0,i.length,...i.filter(a=>a!==o))}),[e]);return{registerSensors:n,subscribeSensors:r}}function Vg(e,t){const n=$.useRef(0),r=Ui(),s=We((...o)=>{n.current=Date.now(),e(o)});return $.useCallback((...o)=>{r(()=>{s(o)},t-(Date.now()-n.current))},[t,s,r])}const _c=br("slide"),Ec=br("slide_image");function xr({slide:e,offset:t,render:n,rect:r,imageFit:s,imageProps:o,onClick:i,onLoad:a,onError:l,style:c}){var d,u,f,g,m,p,y,b;const[_,x]=$.useState(rs),{publish:E}=cs(),{setTimeout:S}=co(),w=$.useRef(null);$.useEffect(()=>{t===0&&E(lo(_))},[t,_,E]);const N=We(U=>{("decode"in U?U.decode():Promise.resolve()).catch(()=>{}).then(()=>{U.parentNode&&(x(ao),S(()=>{a?.(U)},0))})}),C=$.useCallback(U=>{w.current=U,U?.complete&&N(U)},[N]),k=$.useCallback(U=>{N(U.currentTarget)},[N]),M=We(()=>{x(io),l?.()}),T=pc(e,s),L=(U,B)=>Number.isFinite(U)?U:B,P=L(Math.max(...((u=(d=e.srcSet)===null||d===void 0?void 0:d.map(U=>U.width))!==null&&u!==void 0?u:[]).concat(e.width?[e.width]:[]).filter(Boolean)),((f=w.current)===null||f===void 0?void 0:f.naturalWidth)||0),F=L(Math.max(...((m=(g=e.srcSet)===null||g===void 0?void 0:g.map(U=>U.height))!==null&&m!==void 0?m:[]).concat(e.height?[e.height]:[]).filter(Boolean)),((p=w.current)===null||p===void 0?void 0:p.naturalHeight)||0),D=P&&F?{maxWidth:`min(${P}px, 100%)`,maxHeight:`min(${F}px, 100%)`}:{maxWidth:"100%",maxHeight:"100%"},A=(y=e.srcSet)===null||y===void 0?void 0:y.sort((U,B)=>U.width-B.width).map(U=>`${U.src} ${U.width}w`).join(", "),O=()=>r&&!T&&e.width&&e.height?r.height/e.height*e.width:Number.MAX_VALUE,V=A&&r&&hc()?`${Math.round(Math.min(O(),r.width))}px`:void 0,{style:H,className:W,...j}=o||{};return $.createElement($.Fragment,null,$.createElement("img",{ref:C,onLoad:k,onError:M,onClick:i,draggable:!1,className:Ht(Ne(Ec()),T&&Ne(Ec("cover")),_!==ao&&Ne(Ec("loading")),W),style:{...D,...c,...H},...j,alt:(b=e.alt)!==null&&b!==void 0?b:"",sizes:V,srcSet:A,src:e.src}),_!==ao&&$.createElement("div",{className:Ne(_c(RS))},_===rs&&(n?.iconLoading?n.iconLoading():$.createElement(N_,{className:Ht(Ne(Fi),Ne(_c(rs)))})),_===io&&(n?.iconError?n.iconError():$.createElement(O_,{className:Ht(Ne(Fi),Ne(_c(io)))}))))}const A_=$.forwardRef(function({className:t,children:n,onFocus:r,onBlur:s,...o},i){const a=$.useRef(null),{trackFocusWithin:l}=wc();return $.createElement(y_,{nodeRef:a},$.createElement("div",{ref:Sc(i,a),className:Ht(Ne("root"),t),...l(r,s),...o},n))});var Ut;(function(e){e[e.NONE=0]="NONE",e[e.SWIPE=1]="SWIPE",e[e.PULL=2]="PULL",e[e.ANIMATION=3]="ANIMATION"})(Ut||(Ut={}));function zg(e,t,n,r,s){$.useEffect(()=>s?()=>{}:is(e(fg,t),e(hg,n),e(gg,r),e(pg,r),e(mg,r)),[e,t,n,r,s])}var Nn;(function(e){e[e.NONE=0]="NONE",e[e.SWIPE=1]="SWIPE",e[e.PULL=2]="PULL"})(Nn||(Nn={}));const Mc=30;function D_({disableSwipeNavigation:e,closeOnBackdropClick:t},n,r,s,o,i,a,l,c,d,u,f,g,m,p,y){const b=$.useRef(0),_=$.useRef([]),x=$.useRef(void 0),E=$.useRef(0),S=$.useRef(Nn.NONE),w=$.useCallback(P=>{x.current===P.pointerId&&(x.current=void 0,S.current=Nn.NONE);const F=_.current;F.splice(0,F.length,...F.filter(D=>D.pointerId!==P.pointerId))},[]),N=$.useCallback(P=>{w(P),P.persist(),_.current.push(P)},[w]),C=$.useCallback(P=>_.current.find(({pointerId:F})=>P.pointerId===F),[]),k=We(P=>{N(P)}),M=(P,F)=>u&&P>F||d&&P<-F,T=We(P=>{const F=C(P);if(F)if(x.current===P.pointerId){const D=Date.now()-E.current,A=b.current;S.current===Nn.SWIPE?Math.abs(A)>.3*s||Math.abs(A)>5&&D{const F=C(P);if(F){const D=x.current===P.pointerId;if(P.buttons===0){D&&b.current!==0?T(P):w(F);return}const A=P.clientX-F.clientX,O=P.clientY-F.clientY;if(x.current===void 0){const V=H=>{N(P),x.current=P.pointerId,E.current=Date.now(),S.current=H};Math.abs(A)>Math.abs(O)&&Math.abs(A)>Mc&&r(A)?e||(V(Nn.SWIPE),i()):Math.abs(O)>Math.abs(A)&&M(O,Mc)&&(V(Nn.PULL),f())}else D&&(S.current===Nn.SWIPE?(b.current=A,a(A)):S.current===Nn.PULL&&(b.current=O,g(O)))}});zg(n,k,L,T)}function I_({preventDefaultWheelX:e,preventDefaultWheelY:t}){const n=$.useRef(null),r=We(s=>{const o=Math.abs(s.deltaX)>Math.abs(s.deltaY);(o&&e||!o&&t||s.ctrlKey)&&s.preventDefault()});return $.useCallback(s=>{var o;s?s.addEventListener("wheel",r,{passive:!1}):(o=n.current)===null||o===void 0||o.removeEventListener("wheel",r),n.current=s},[r])}function L_(e,t,n,r,s,o,i,a,l){const c=$.useRef(0),d=$.useRef(0),u=$.useRef(void 0),f=$.useRef(void 0),g=$.useRef(0),m=$.useRef(void 0),p=$.useRef(0),{setTimeout:y,clearTimeout:b}=co(),_=$.useCallback(()=>{u.current&&(b(u.current),u.current=void 0)},[b]),x=$.useCallback(()=>{f.current&&(b(f.current),f.current=void 0)},[b]),E=We(()=>{e!==Ut.SWIPE&&(c.current=0,p.current=0,_(),x())});$.useEffect(E,[e,E]);const S=We(N=>{f.current=void 0,c.current===N&&l(c.current)}),w=We(N=>{if(N.ctrlKey||Math.abs(N.deltaY)>Math.abs(N.deltaX))return;const C=k=>{g.current=k,b(m.current),m.current=k>0?y(()=>{g.current=0,m.current=void 0},300):void 0};if(e===Ut.NONE){if(Math.abs(N.deltaX)<=1.2*Math.abs(g.current)){C(N.deltaX);return}if(!n(-N.deltaX))return;if(d.current+=N.deltaX,_(),Math.abs(d.current)>30)d.current=0,C(0),p.current=Date.now(),o();else{const k=d.current;u.current=y(()=>{u.current=void 0,k===d.current&&(d.current=0)},s)}}else if(e===Ut.SWIPE){let k=c.current-N.deltaX;if(k=Math.min(Math.abs(k),r)*Math.sign(k),c.current=k,i(k),x(),Math.abs(k)>.2*r){C(N.deltaX),a(k,Date.now()-p.current);return}f.current=y(()=>S(k),2*s)}else C(N.deltaX)});$.useEffect(()=>t(fc,w),[t,w])}const Hg=br("container"),Ug=$.createContext(null),On=hn("useController","ControllerContext",Ug);function P_({children:e,...t}){var n;const{carousel:r,animation:s,controller:o,on:i,styles:a,render:l}=t,{closeOnPullUp:c,closeOnPullDown:d,preventDefaultWheelX:u,preventDefaultWheelY:f}=o,[g,m]=$.useState(),p=pn(),y=x_(),[b,_]=$.useState(Ut.NONE),x=$.useRef(0),E=$.useRef(0),S=$.useRef(1),{registerSensors:w,subscribeSensors:N}=Fg(),{subscribe:C,publish:k}=cs(),M=Ui(),T=Ui(),L=Ui(),{containerRef:P,setContainerRef:F,containerRect:D}=Lg(),A=Sc(I_({preventDefaultWheelX:u,preventDefaultWheelY:f}),F),O=$.useRef(null),V=Sc(O,void 0),{getOwnerDocument:H}=ls(),W=Bi(),j=se=>(W?-1:1)*(typeof se=="number"?se:1),U=We(()=>{var se;return(se=P.current)===null||se===void 0?void 0:se.focus()}),B=We(()=>t),G=We(()=>p),z=$.useCallback(se=>k(or,se),[k]),K=$.useCallback(se=>k(ir,se),[k]),Y=$.useCallback(()=>k(os),[k]),Z=se=>!(r.finite&&(j(se)>0&&p.currentIndex===0||j(se)<0&&p.currentIndex===p.slides.length-1)),ee=se=>{var Oe;x.current=se,(Oe=P.current)===null||Oe===void 0||Oe.style.setProperty(dt("swipe_offset"),`${Math.round(se)}px`)},te=se=>{var Oe,Le;E.current=se,S.current=(()=>{const et=d&&se>0?se:c&&se<0?-se:0;return Math.min(Math.max(gc(1-et/60*(1-.5),2),.5),1)})(),(Oe=P.current)===null||Oe===void 0||Oe.style.setProperty(dt("pull_offset"),`${Math.round(se)}px`),(Le=P.current)===null||Le===void 0||Le.style.setProperty(dt("pull_opacity"),`${S.current}`)},{prepareAnimation:ce}=Cc(O,(se,Oe,Le)=>{if(O.current&&D)return{keyframes:[{transform:`translate(0, ${se.rect.y-Oe.y+Le.y}px)`,opacity:se.opacity},{transform:"translate(0, 0)",opacity:1}],duration:se.duration,easing:s.easing.fade}}),J=(se,Oe)=>{if(c||d){te(se);let Le=0;O.current&&(Le=s.fade*(Oe?2:1),ce({rect:O.current.getBoundingClientRect(),opacity:S.current,duration:Le})),L(()=>{te(0),_(Ut.NONE)},Le),_(Ut.ANIMATION),Oe||Y()}},{prepareAnimation:he,isAnimationPlaying:le}=Cc(O,(se,Oe,Le)=>{var Ie;if(O.current&&D&&(!((Ie=p.animation)===null||Ie===void 0)&&Ie.duration)){const Ue=zi(r.spacing),et=(Ue.percent?Ue.percent*D.width/100:Ue.pixel)||0;return{keyframes:[{transform:`translate(${j(p.globalIndex-se.index)*(D.width+et)+se.rect.x-Oe.x+Le.x}px, 0)`},{transform:"translate(0, 0)"}],duration:p.animation.duration,easing:p.animation.easing}}}),ae=We(se=>{var Oe,Le;const Ie=se.offset||0,Ue=Ie?s.swipe:(Oe=s.navigation)!==null&&Oe!==void 0?Oe:s.swipe,et=!Ie&&!le()?s.easing.navigation:s.easing.swipe;let{direction:bt}=se;const Ge=(Le=se.count)!==null&&Le!==void 0?Le:1;let ft=Ut.ANIMATION,Be=Ue*Ge;if(!bt){const fe=D?.width,xe=se.duration||0,ge=fe?Ue/fe*Math.abs(Ie):Ue;Ge!==0?(xe0?or:ir):Be=Ue/2}let ne=0;bt===or?Z(j(1))?ne=-Ge:(ft=Ut.NONE,Be=Ue):bt===ir&&(Z(j(-1))?ne=Ge:(ft=Ut.NONE,Be=Ue)),Be=Math.round(Be),T(()=>{ee(0),_(Ut.NONE)},Be),O.current&&he({rect:O.current.getBoundingClientRect(),index:p.globalIndex}),_(ft),k(dc,{type:"swipe",increment:ne,duration:Be,easing:et})});$.useEffect(()=>{var se,Oe;!((se=p.animation)===null||se===void 0)&&se.increment&&(!((Oe=p.animation)===null||Oe===void 0)&&Oe.duration)&&M(()=>y({type:"swipe",increment:0}),p.animation.duration)},[p.animation,y,M]);const Se=[N,Z,D?.width||0,s.swipe,()=>_(Ut.SWIPE),se=>ee(se),(se,Oe)=>ae({offset:se,duration:Oe,count:1}),se=>ae({offset:se,count:0})],ue=[()=>{d&&_(Ut.PULL)},se=>te(se),se=>J(se),se=>J(se,!0)];D_(o,...Se,c,d,...ue,Y),L_(b,...Se);const pe=We(()=>{o.focus&&H().querySelector(`.${Ne(ac)} .${Ne(Hg())}`)&&U()});$.useEffect(pe,[pe]);const we=We(()=>{var se;(se=i.view)===null||se===void 0||se.call(i,{index:p.currentIndex})});$.useEffect(we,[p.globalIndex,we]),$.useEffect(()=>is(C(or,se=>ae({direction:or,...se})),C(ir,se=>ae({direction:ir,...se})),C(dc,se=>y(se))),[C,ae,y]);const He=$.useMemo(()=>({prev:z,next:K,close:Y,focus:U,slideRect:D?u_(D,r.padding):{width:0,height:0},containerRect:D||{width:0,height:0},subscribeSensors:N,containerRef:P,setCarouselRef:V,toolbarWidth:g,setToolbarWidth:m}),[z,K,Y,U,N,D,P,V,g,m,r.padding]);return $.useImperativeHandle(o.ref,()=>({prev:z,next:K,close:Y,focus:U,getLightboxProps:B,getLightboxState:G}),[z,K,Y,U,B,G]),$.createElement("div",{ref:A,className:Ht(Ne(Hg()),Ne(ss)),style:{...b===Ut.SWIPE?{[dt("swipe_offset")]:`${Math.round(x.current)}px`}:null,...b===Ut.PULL?{[dt("pull_offset")]:`${Math.round(E.current)}px`,[dt("pull_opacity")]:`${S.current}`}:null,...o.touchAction!=="none"?{[dt("controller_touch_action")]:o.touchAction}:null,...a.container},tabIndex:-1,...w},D&&$.createElement(Ug.Provider,{value:He},e,(n=l.controls)===null||n===void 0?void 0:n.call(l)))}const $_=gn(ro,P_);function wr(e){return mr(og,e)}function Bg(e){return mr(cc,e)}function F_({slide:e,offset:t}){const n=$.useRef(null),{currentIndex:r,slides:s}=pn(),{slideRect:o,focus:i}=On(),{render:a,carousel:{imageFit:l,imageProps:c},on:{click:d},styles:{slide:u},labels:f}=It(),{getOwnerDocument:g}=ls(),m=t!==0;$.useEffect(()=>{var y;m&&(!((y=n.current)===null||y===void 0)&&y.contains(g().activeElement))&&i()},[m,i,g]);const p=()=>{var y,b,_,x;let E=(y=a.slide)===null||y===void 0?void 0:y.call(a,{slide:e,offset:t,rect:o});return!E&&vr(e)&&(E=$.createElement(xr,{slide:e,offset:t,render:a,rect:o,imageFit:l,imageProps:c,onClick:m?void 0:()=>d?.({index:r})})),E?$.createElement($.Fragment,null,(b=a.slideHeader)===null||b===void 0?void 0:b.call(a,{slide:e}),((_=a.slideContainer)!==null&&_!==void 0?_:(({children:S})=>S))({slide:e,children:E}),(x=a.slideFooter)===null||x===void 0?void 0:x.call(a,{slide:e})):null};return $.createElement("div",{ref:n,className:Ht(Ne(Bg()),!m&&Ne(Bg("current")),Ne(ss)),...g_(m),style:u,role:"group","aria-roledescription":yr(f,"Slide"),"aria-label":wg(f,s,r+t)},p())}function V_(){const e=It().styles.slide;return $.createElement("div",{className:Ne(cc),style:e})}function z_({carousel:e,labels:t}){const{slides:n,currentIndex:r,globalIndex:s}=pn(),{setCarouselRef:o}=On(),{autoPlaying:i,focusWithin:a}=wc(),l=zi(e.spacing),c=zi(e.padding),d=Cg(e,n,1),u=[];if(bc(n))for(let f=r-d;f<=r+d;f+=1){const g=yc(n,f),m=s-r+f,p=e.finite&&(f<0||f>n.length-1);u.push(p?{key:m}:{key:[`${m}`,kg(g)].filter(Boolean).join("|"),offset:f-r,slide:g})}return $.createElement("div",{ref:o,className:Ht(Ne(wr()),u.length>0&&Ne(wr("with_slides"))),style:{[`${dt(wr("slides_count"))}`]:u.length,[`${dt(wr("spacing_px"))}`]:l.pixel||0,[`${dt(wr("spacing_percent"))}`]:l.percent||0,[`${dt(wr("padding_px"))}`]:c.pixel||0,[`${dt(wr("padding_percent"))}`]:c.percent||0},role:"region","aria-live":i&&!a?"off":"polite","aria-roledescription":yr(t,"Carousel"),"aria-label":yr(t,"Photo gallery")},u.map(({key:f,slide:g,offset:m})=>g?$.createElement(F_,{key:f,slide:g,offset:m}):$.createElement(V_,{key:f})))}const H_=gn(og,z_);function jg(){const{carousel:e}=It(),{slides:t,currentIndex:n}=pn(),r=t.length===0||e.finite&&n===0,s=t.length===0||e.finite&&n===t.length-1;return{prevDisabled:r,nextDisabled:s}}function Wg(e){var t;const n=Bi(),{publish:r}=cs(),{animation:s}=It(),{prevDisabled:o,nextDisabled:i}=jg(),a=((t=s.navigation)!==null&&t!==void 0?t:s.swipe)/2,l=Vg(()=>r(or),a),c=Vg(()=>r(ir),a),d=We(u=>{switch(u.key){case a_:r(os);break;case l_:(n?i:o)||(n?c:l)();break;case c_:(n?o:i)||(n?l:c)();break}});$.useEffect(()=>e(uc,d),[e,d])}function Gg({label:e,icon:t,renderIcon:n,action:r,onClick:s,disabled:o,style:i}){return $.createElement(ds,{label:e,icon:t,renderIcon:n,className:Ne(`navigation_${r}`),disabled:o,onClick:s,style:i,...$g(On().focus,o)})}function U_({render:{buttonPrev:e,buttonNext:t,iconPrev:n,iconNext:r},styles:s}){const{prev:o,next:i,subscribeSensors:a}=On(),{prevDisabled:l,nextDisabled:c}=jg();return Wg(a),$.createElement($.Fragment,null,e?e():$.createElement(Gg,{label:"Previous",action:or,icon:E_,renderIcon:n,style:s.navigationPrev,disabled:l,onClick:o}),t?t():$.createElement(Gg,{label:"Next",action:ir,icon:M_,renderIcon:r,style:s.navigationNext,disabled:c,onClick:i}))}const B_=gn(qS,U_),Yg=Ne(s_),j_=Ne(dg);function W_(e){return"style"in e}function Kg(e,t,n){const r=window.getComputedStyle(e),s=n?"padding-left":"padding-right",o=n?r.paddingLeft:r.paddingRight,i=e.style.getPropertyValue(s);return e.style.setProperty(s,`${(Vi(o)||0)+t}px`),()=>{i?e.style.setProperty(s,i):e.style.removeProperty(s)}}function G_({noScroll:{disabled:e},children:t}){const n=Bi(),{getOwnerDocument:r,getOwnerWindow:s}=ls();return $.useEffect(()=>{if(e)return()=>{};const o=[],i=s(),{body:a,documentElement:l}=r(),c=Math.round(i.innerWidth-l.clientWidth);if(c>0){o.push(Kg(a,c,n));const d=a.getElementsByTagName("*");for(let u=0;u{a.classList.remove(Yg),o.forEach(d=>d())}},[n,e,r,s]),$.createElement($.Fragment,null,t)}const Y_=gn(ZS,G_);function Xg(e){return mr(ac,e)}function qg(e,t,n){const r=e.getAttribute(t);return e.setAttribute(t,n),()=>{r?e.setAttribute(t,r):e.removeAttribute(t)}}function K_({children:e,animation:t,styles:n,className:r,on:s,portal:o,close:i,labels:a}){const[l,c]=$.useState(!1),[d,u]=$.useState(!1),f=$.useRef([]),g=$.useRef(null),{setTimeout:m}=co(),{subscribe:p}=cs(),b=kc()?0:t.fade;$.useEffect(()=>(c(!0),()=>{c(!1),u(!1)}),[]);const _=We(()=>{f.current.forEach(w=>w()),f.current=[]}),x=We(()=>{var w;u(!1),_(),(w=s.exiting)===null||w===void 0||w.call(s),m(()=>{var N;(N=s.exited)===null||N===void 0||N.call(s),i()},b)});$.useEffect(()=>p(os,x),[p,x]);const E=We(w=>{var N,C,k;p_(w),u(!0),(N=s.entering)===null||N===void 0||N.call(s);const M=(k=(C=w.parentNode)===null||C===void 0?void 0:C.children)!==null&&k!==void 0?k:[];for(let T=0;T{var T,L;(L=(T=g.current)===null||T===void 0?void 0:T.focus)===null||L===void 0||L.call(T)}),m(()=>{var T;(T=s.entered)===null||T===void 0||T.call(s)},b)}),S=$.useCallback(w=>{w?E(w):_()},[E,_]);return l?Dn.createPortal($.createElement(A_,{ref:S,className:Ht(r,Ne(Xg()),Ne(dg),d&&Ne(Xg("open"))),"aria-modal":!0,role:"dialog","aria-label":yr(a,"Lightbox"),style:{...t.fade!==xc.animation.fade?{[dt("fade_animation_duration")]:`${b}ms`}:null,...t.easing.fade!==xc.animation.easing.fade?{[dt("fade_animation_timing_function")]:t.easing.fade}:null,...n.root},onFocus:w=>{g.current||(g.current=w.relatedTarget)}},e),o.root||document.body):null}const X_=gn(ac,K_);function q_({children:e}){return $.createElement($.Fragment,null,e)}const Z_=gn(QS,q_);function Q_(e){return mr(ig,e)}function J_({toolbar:{buttons:e},render:{buttonClose:t,iconClose:n},styles:r}){const{close:s,setToolbarWidth:o}=On(),{setContainerRef:i,containerRect:a}=Lg();Mn(()=>{o(a?.width)},[o,a?.width]);const l=()=>t?t():$.createElement(ds,{key:os,label:"Close",icon:__,renderIcon:n,onClick:s});return $.createElement("div",{ref:i,style:r.toolbar,className:Ne(Q_())},e?.map(c=>c===os?l():c))}const R_=gn(ig,J_);function Zg(e,t){var n;return $.createElement(e.module.component,{key:e.module.name,...t},(n=e.children)===null||n===void 0?void 0:n.map(r=>Zg(r,t)))}function e2(e,t={}){const{easing:n,...r}=e,{easing:s,...o}=t;return{easing:{...n,...s},...r,...o}}function t2({carousel:e,animation:t,render:n,toolbar:r,controller:s,noScroll:o,on:i,plugins:a,slides:l,index:c,...d}){const{animation:u,carousel:f,render:g,toolbar:m,controller:p,noScroll:y,on:b,slides:_,index:x,plugins:E,...S}=xc,{config:w,augmentation:N}=m_([Dt(X_,[Dt(Y_,[Dt($_,[Dt(H_),Dt(R_),Dt(B_)])])])],a||E),C=N({animation:e2(u,t),carousel:{...f,...e},render:{...g,...n},toolbar:{...m,...r},controller:{...p,...s},noScroll:{...y,...o},on:{...b,...i},...S,...d});return C.open?$.createElement(Og,{...C},$.createElement(k_,{slides:l||_,index:Vi(c||x)},$.createElement(C_,null,$.createElement(v_,null,$.createElement(b_,null,Zg(Dt(Z_,w),C)))))):null}const n2={minZoom:1,maxZoomPixelRatio:1,zoomInMultiplier:2,doubleTapDelay:300,doubleClickDelay:500,doubleClickMaxStops:2,keyboardMoveDistance:50,wheelZoomDistanceFactor:100,pinchZoomDistanceFactor:100,pinchZoomV4:!1,scrollToZoom:!1};function r2(e){return Math.min(Math.max(e,Number.EPSILON),1)}function Qg(e){const{minZoom:t,...n}={...n2,...e};return{minZoom:r2(t),...n}}function s2(e,t,n,r){const s=$.useRef(void 0),o=$.useRef(void 0),{zoom:i}=It().animation,a=kc(),l=We(()=>{var c,d,u;if((c=s.current)===null||c===void 0||c.cancel(),s.current=void 0,o.current&&r?.current){try{s.current=(u=(d=r.current).animate)===null||u===void 0?void 0:u.call(d,[{transform:o.current},{transform:`scale(${e}) translateX(${t}px) translateY(${n}px)`}],{duration:a?0:i??500,easing:s.current?"ease-out":"ease-in-out"})}catch(f){console.error(f)}o.current=void 0,s.current&&(s.current.onfinish=()=>{s.current=void 0})}});return Mn(l,[e,t,n,l]),$.useCallback(()=>{o.current=r?.current?window.getComputedStyle(r.current).transform:void 0},[r])}function o2(e,t){const{on:n}=It(),r=We(()=>{var s;t||(s=n.zoom)===null||s===void 0||s.call(n,{zoom:e})});$.useEffect(r,[e,r])}function ji(){const{zoom:e}=It();return Qg(e)}function i2(e,t){var n,r;let s={width:0,height:0},o={width:0,height:0};const{currentSlide:i}=pn(),{imageFit:a}=It().carousel,{maxZoomPixelRatio:l}=ji();if(e&&i){const d={...i,...t};if(vr(d)){const u=pc(d,a),f=Math.max(...(((n=d.srcSet)===null||n===void 0?void 0:n.map(m=>m.width))||[]).concat(d.width?[d.width]:[])),g=Math.max(...(((r=d.srcSet)===null||r===void 0?void 0:r.map(m=>m.height))||[]).concat(d.height?[d.height]:[]));f>0&&g>0&&e.width>0&&e.height>0&&(o=u?{width:Math.round(Math.min(f,e.width/e.height*g)),height:Math.round(Math.min(g,e.height/e.width*f))}:{width:f,height:g},o={width:o.width*l,height:o.height*l},s=u?{width:Math.min(e.width,o.width,f),height:Math.min(e.height,o.height,g)}:{width:Math.round(Math.min(e.width,e.height/g*f,f)),height:Math.round(Math.min(e.height,e.width/f*g,g))})}}const c=s.width?Math.max(gc(o.width/s.width,5),1):1;return{imageRect:s,maxZoom:c}}function Jg(e,t){return Math.hypot(e.clientX-t.clientX,e.clientY-t.clientY)}function Rg(e,t,n=100,r=2){return e*Math.min(1+Math.abs(t/n),r)**Math.sign(t)}function a2(e,t,n,r,s,o,i,a,l){const c=$.useRef([]),d=$.useRef(0),u=$.useRef(void 0),{globalIndex:f}=pn(),{getOwnerWindow:g}=ls(),{containerRef:m,subscribeSensors:p}=On(),{keyboardMoveDistance:y,zoomInMultiplier:b,wheelZoomDistanceFactor:_,scrollToZoom:x,doubleTapDelay:E,doubleClickDelay:S,doubleClickMaxStops:w,pinchZoomDistanceFactor:N,pinchZoomV4:C}=ji(),k=$.useCallback(V=>{if(m.current){const{pageX:H,pageY:W}=V,{scrollX:j,scrollY:U}=g(),{left:B,top:G,width:z,height:K}=m.current.getBoundingClientRect();return[H-B-j-z/2,W-G-U-K/2]}return[]},[m,g]),M=We(V=>{const{key:H,metaKey:W,ctrlKey:j}=V,U=W||j,B=()=>{V.preventDefault(),V.stopPropagation()};if(e>1){const G=(z,K)=>{B(),a(z,K)};H==="ArrowDown"?G(0,y):H==="ArrowUp"?G(0,-y):H==="ArrowLeft"?G(-y,0):H==="ArrowRight"&&G(y,0)}H==="+"||U&&H==="="?(B(),s()):H==="-"||U&&H==="_"?(B(),o()):U&&H==="0"&&(B(),i(1))}),T=We(V=>{if((V.ctrlKey||x)&&Math.abs(V.deltaY)>Math.abs(V.deltaX)){V.stopPropagation(),i(Rg(e,-V.deltaY,_),!0,...k(V));return}e>1&&(V.stopPropagation(),x||a(V.deltaX,V.deltaY))}),L=$.useCallback(V=>{const H=c.current;H.splice(0,H.length,...H.filter(W=>W.pointerId!==V.pointerId))},[]),P=$.useCallback(V=>{L(V),V.persist(),c.current.push(V)},[L]),F=We(V=>{var H;const W=c.current;if(V.pointerType==="mouse"&&V.buttons>1||!(!((H=l?.current)===null||H===void 0)&&H.contains(V.target)))return;e>1&&V.stopPropagation();const{timeStamp:j}=V;if(W.length===0&&j-d.current<(V.pointerType==="touch"?E:S)){d.current=0;const U=e>=1?e!==n?e*Math.max(n**(1/w),b):1:e!==t?e/Math.max(t**(-1/w),b):1;i(U,!1,...k(V))}else d.current=j;if(P(V),W.length===2){const U=Jg(W[0],W[1]);u.current={previousDistance:U,initialDistance:Math.max(U,1),initialZoom:e}}}),D=We(V=>{const H=c.current,W=H.find(j=>j.pointerId===V.pointerId);if(H.length===2&&u.current){V.stopPropagation(),P(V);const j=Jg(H[0],H[1]),U=C?u.current.initialZoom/u.current.initialDistance*j:Rg(e,j-u.current.previousDistance,N);i(U,!0,...H.map(B=>k(B)).reduce((B,G)=>G.map((z,K)=>B[K]+z/2))),u.current.previousDistance=j;return}e>1&&(V.stopPropagation(),W&&(H.length===1&&a((W.clientX-V.clientX)/e,(W.clientY-V.clientY)/e),P(V)))}),A=$.useCallback(V=>{const H=c.current;H.length===2&&H.find(W=>W.pointerId===V.pointerId)&&(u.current=void 0),L(V)},[L]),O=$.useCallback(()=>{const V=c.current;V.splice(0,V.length),d.current=0,u.current=void 0},[]);zg(p,F,D,A,r),$.useEffect(O,[f,O]),$.useEffect(()=>r?()=>{}:is(O,p(uc,M),p(fc,T)),[r,p,O,M,T])}function l2(e,t,n){const[r,s]=$.useState(1),[o,i]=$.useState(0),[a,l]=$.useState(0),c=s2(r,o,a,n),{currentSlide:d,globalIndex:u}=pn(),{containerRect:f,slideRect:g}=On(),{minZoom:m,zoomInMultiplier:p}=ji(),y=d&&vr(d)?d.src:void 0,b=!y||!n?.current;Mn(()=>{s(1),i(0),l(0)},[u,y]);const _=$.useCallback((N,C,k)=>{const M=k||r,T=o-(N||0),L=a-(C||0),P=(e.width*M-g.width)/2/M,F=(e.height*M-g.height)/2/M;i(Math.min(Math.abs(T),Math.max(P,0))*Math.sign(T)),l(Math.min(Math.abs(L),Math.max(F,0))*Math.sign(L))},[r,o,a,g,e.width,e.height]),x=$.useCallback((N,C,k,M)=>{const T=gc(N+.01m?N:m:t,5);C||c(),_(k?k*(1/r-1/T):0,M?M*(1/r-1/T):0,T),s(T)},[r,m,t,_,c]),E=We(()=>{r>1&&(r>t&&x(t,!0),_())});Mn(E,[f.width,f.height,E]);const S=$.useCallback(()=>{const N=r*p;x(r<1&&N>1?1:N)},[r,p,x]),w=$.useCallback(()=>{const N=r/p;x(r>1&&N<1?1:N)},[r,p,x]);return{zoom:r,offsetX:o,offsetY:a,disabled:b,changeOffsets:_,changeZoom:x,zoomIn:S,zoomOut:w}}const ep=$.createContext(null),Nc=hn("useZoom","ZoomControllerContext",ep);function c2({children:e}){const[t,n]=$.useState(),{slideRect:r}=On(),{ref:s,minZoom:o}=ji(),{imageRect:i,maxZoom:a}=i2(r,t?.imageDimensions),{zoom:l,offsetX:c,offsetY:d,disabled:u,changeZoom:f,changeOffsets:g,zoomIn:m,zoomOut:p}=l2(i,a,t?.zoomWrapperRef);o2(l,u),a2(l,o,a,u,m,p,f,g,t?.zoomWrapperRef);const y=$.useMemo(()=>({zoom:l,minZoom:o,maxZoom:a,offsetX:c,offsetY:d,disabled:u,zoomIn:m,zoomOut:p,changeZoom:f}),[l,o,a,c,d,u,m,p,f]);$.useImperativeHandle(s,()=>y,[y]);const b=$.useMemo(()=>({...y,setZoomWrapper:n}),[y,n]);return $.createElement(ep.Provider,{value:b},e)}const d2=en("ZoomIn",$.createElement($.Fragment,null,$.createElement("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"}),$.createElement("path",{d:"M12 10h-2v2H9v-2H7V9h2V7h1v2h2v1z"}))),u2=en("ZoomOut",$.createElement("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14zM7 9h5v1H7z"})),tp=$.forwardRef(function({zoomIn:t,onLoseFocus:n},r){const s=$.useRef(!1),o=$.useRef(!1),{zoom:i,minZoom:a,maxZoom:l,zoomIn:c,zoomOut:d,disabled:u}=Nc(),{render:f}=It(),g=u||(t?i>=l:i<=a);return $.useEffect(()=>{g&&s.current&&o.current&&n(),g||(s.current=!0)},[g,n]),$.createElement(ds,{ref:r,disabled:g,label:t?"Zoom in":"Zoom out",icon:t?d2:u2,renderIcon:t?f.iconZoomIn:f.iconZoomOut,onClick:t?c:d,onFocus:()=>{o.current=!0},onBlur:()=>{o.current=!1}})});function f2(){const e=$.useRef(null),t=$.useRef(null),{focus:n}=On(),r=$.useCallback(i=>{var a,l;!((a=i.current)===null||a===void 0)&&a.disabled?n():(l=i.current)===null||l===void 0||l.focus()},[n]),s=$.useCallback(()=>r(e),[r]),o=$.useCallback(()=>r(t),[r]);return $.createElement($.Fragment,null,$.createElement(tp,{zoomIn:!0,ref:e,onLoseFocus:o}),$.createElement(tp,{ref:t,onLoseFocus:s}))}function h2(){const{render:e}=It(),t=Nc();return e.buttonZoom?$.createElement($.Fragment,null,e.buttonZoom(t)):$.createElement(f2,null)}function g2(e){var t;return(((t=e.srcSet)===null||t===void 0?void 0:t.length)||0)>0}function p2({current:e,preload:t},{type:n,source:r}){switch(n){case"fetch":return e?{current:e,preload:r}:{current:r};case"done":return r===t?{current:r}:{current:e,preload:t};default:throw new Error(vg)}}function m2(e){var t,n;const[{current:r,preload:s},o]=$.useReducer(p2,{}),{slide:i,rect:a,imageFit:l,render:c,interactive:d}=e,u=i.srcSet.sort((S,w)=>S.width-w.width),f=(t=i.width)!==null&&t!==void 0?t:u[u.length-1].width,g=(n=i.height)!==null&&n!==void 0?n:u[u.length-1].height,m=pc(i,l),p=Math.max(...u.map(S=>S.width)),y=Math.min((m?Math.max:Math.min)(a.width,f*(a.height/g)),p),b=f_(),_=We(()=>{var S;const w=(S=u.find(N=>N.width>=y*b))!==null&&S!==void 0?S:u[u.length-1];(!r||u.findIndex(N=>N.src===r)N===w))&&o({type:"fetch",source:w.src})});Mn(_,[a.width,a.height,b,_]);const x=We(S=>o({type:"done",source:S})),E={WebkitTransform:d?"initial":"translateZ(0)"};return m||Object.assign(E,a.width/a.heightx(s),render:{...c,iconLoading:()=>null,iconError:()=>null}}),r&&$.createElement(xr,{key:"current",...e,slide:{...i,src:r,srcSet:void 0},style:E}))}function b2({render:e,slide:t,offset:n,rect:r}){var s;const[o,i]=$.useState(),a=$.useRef(null),{zoom:l,maxZoom:c,offsetX:d,offsetY:u,setZoomWrapper:f}=Nc(),g=l>1,{carousel:m,on:p}=It(),{currentIndex:y}=pn();Mn(()=>n===0?(f({zoomWrapperRef:a,imageDimensions:o}),()=>f(void 0)):()=>{},[n,o,f]);let b=(s=e.slide)===null||s===void 0?void 0:s.call(e,{slide:t,offset:n,rect:r,zoom:l,maxZoom:c});if(!b&&vr(t)){const _={slide:t,offset:n,rect:r,render:e,imageFit:m.imageFit,imageProps:m.imageProps,onClick:n===0?()=>{var x;return(x=p.click)===null||x===void 0?void 0:x.call(p,{index:y})}:void 0};b=g2(t)?$.createElement(m2,{..._,slide:t,interactive:g,rect:n===0?{width:r.width*l,height:r.height*l}:r}):$.createElement(xr,{onLoad:x=>i({width:x.naturalWidth,height:x.naturalHeight}),..._})}return b?$.createElement("div",{ref:a,className:Ht(Ne(cg),Ne(ss),Ne(ug),g&&Ne(o_)),style:n===0?{transform:`scale(${l}) translateX(${d}px) translateY(${u}px)`}:void 0},b):null}const y2=({augment:e,addModule:t})=>{e(({zoom:n,toolbar:r,render:s,controller:o,...i})=>{const a=Qg(n);return{zoom:a,toolbar:Hi(r,lg,$.createElement(h2,null)),render:{...s,slide:l=>{var c;return vr(l.slide)?$.createElement(b2,{render:s,...l}):(c=s.slide)===null||c===void 0?void 0:c.call(s,l)}},controller:{...o,preventDefaultWheelY:a.scrollToZoom},...i}}),t(gn(lg,c2))},v2={separator:"/",container:{}},np=e=>({...v2,...e});function x2({counter:e}){const{slides:t,currentIndex:n}=pn(),{separator:r,container:{className:s,...o},className:i,...a}=np(e);return t.length===0?null:$.createElement("div",{className:Ht(Ne("counter"),s||i),...a,...o,"aria-hidden":!0},n+1," ",r," ",t.length)}function w2({augment:e,addChild:t}){e(({counter:n,...r})=>({counter:np(n),...r})),t(ro,gn(JS,x2))}const k2={autoplay:!1,delay:3e3,ref:null},rp=e=>({...k2,...e}),sp=$.createContext(null),C2=hn("useSlideshow","SlideshowContext",sp);function S2({slideshow:e,carousel:{finite:t},on:n,children:r}){const{autoplay:s,delay:o,ref:i}=rp(e),a=$.useRef(s),[l,c]=$.useState(s),d=$.useRef(void 0),u=$.useRef(void 0),{slides:f,currentIndex:g}=pn(),{setTimeout:m,clearTimeout:p}=co(),{subscribe:y}=cs(),{next:b}=On(),{setAutoPlaying:_}=wc();$.useEffect(()=>_(l),[l,_]);const x=f.length===0||t&&g===f.length-1,E=$.useCallback(()=>{!l&&!x&&c(!0)},[l,x]),S=$.useCallback(()=>{l&&c(!1)},[l]),w=$.useCallback(()=>{p(d.current),d.current=void 0},[p]),N=We(()=>{w(),!(!l||x||u.current===rs||u.current===lc)&&(d.current=m(()=>{l&&(u.current=void 0,b())},o))});$.useEffect(N,[g,l,N]),$.useEffect(()=>{l&&x&&c(!1)},[g,l,x]);const C=We(()=>{var T;return(T=n.slideshowStart)===null||T===void 0?void 0:T.call(n)}),k=We(()=>{var T;return(T=n.slideshowStop)===null||T===void 0?void 0:T.call(n)});$.useEffect(()=>{l?C():a.current&&k(),a.current=l},[l,C,k]),$.useEffect(()=>is(w,y(e_,()=>{u.current=rs,w()}),y(t_,()=>{u.current=lc,w()}),y(n_,()=>{u.current=io,N()}),y(r_,()=>{u.current=ao,N()})),[y,w,N]);const M=$.useMemo(()=>({playing:l,disabled:x,play:E,pause:S}),[l,x,E,S]);return $.useImperativeHandle(i,()=>M,[M]),$.createElement(sp.Provider,{value:M},r)}const _2=en("Play",$.createElement("path",{d:"M8 5v14l11-7z"})),E2=en("Pause",$.createElement("path",{d:"M6 19h4V5H6v14zm8-14v14h4V5h-4z"}));function M2(){const{playing:e,disabled:t,play:n,pause:r}=C2(),{render:s}=It(),o=$g(On().focus,t);return s.buttonSlideshow?$.createElement($.Fragment,null,s.buttonSlideshow({playing:e,disabled:t,play:n,pause:r})):$.createElement(ds,{label:e?"Pause":"Play",icon:e?E2:_2,renderIcon:e?s.iconSlideshowPause:s.iconSlideshowPlay,onClick:e?r:n,disabled:t,...o})}function N2({augment:e,addModule:t}){e(({slideshow:n,toolbar:r,...s})=>({toolbar:Hi(r,ag,$.createElement(M2,null)),slideshow:rp(n),...s})),t(gn(ag,S2))}const O2={auto:!1,ref:null},op=e=>({...O2,...e}),ip=$.createContext(null),T2=hn("useFullscreen","FullscreenContext",ip);function A2({fullscreen:e,on:t,children:n}){const{auto:r,ref:s}=op(e),o=$.useRef(null),[i,a]=$.useState(),[l,c]=$.useState(!1),d=$.useRef(!1),{getOwnerDocument:u}=ls();Mn(()=>{var x,E,S,w;const N=u();a(!((w=(S=(E=(x=N.fullscreenEnabled)!==null&&x!==void 0?x:N.webkitFullscreenEnabled)!==null&&E!==void 0?E:N.mozFullScreenEnabled)!==null&&S!==void 0?S:N.msFullscreenEnabled)!==null&&w!==void 0&&w))},[u]);const f=$.useCallback(()=>{var x;const E=u(),S=E.fullscreenElement||E.webkitFullscreenElement||E.mozFullScreenElement||E.msFullscreenElement;return((x=S?.shadowRoot)===null||x===void 0?void 0:x.fullscreenElement)||S},[u]),g=$.useCallback(()=>{const x=o.current;try{x.requestFullscreen?x.requestFullscreen().catch(()=>{}):x.webkitRequestFullscreen?x.webkitRequestFullscreen():x.mozRequestFullScreen?x.mozRequestFullScreen():x.msRequestFullscreen&&x.msRequestFullscreen()}catch{}},[]),m=$.useCallback(()=>{if(!f())return;const x=u();try{x.exitFullscreen?x.exitFullscreen().catch(()=>{}):x.webkitExitFullscreen?x.webkitExitFullscreen():x.mozCancelFullScreen?x.mozCancelFullScreen():x.msExitFullscreen&&x.msExitFullscreen()}catch{}},[f,u]);$.useEffect(()=>{const x=u(),E=()=>{c(f()===o.current)};return is(...["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"].map(S=>(x.addEventListener(S,E),()=>x.removeEventListener(S,E))))},[f,u]);const p=We(()=>{var x;return(x=t.enterFullscreen)===null||x===void 0?void 0:x.call(t)}),y=We(()=>{var x;return(x=t.exitFullscreen)===null||x===void 0?void 0:x.call(t)});$.useEffect(()=>{l&&(d.current=!0),d.current&&(l?p:y)()},[l,p,y]);const b=We(()=>{var x;return(x=r?g:null)===null||x===void 0||x(),m});$.useEffect(b,[b]);const _=$.useMemo(()=>({fullscreen:l,disabled:i,enter:g,exit:m}),[l,i,g,m]);return $.useImperativeHandle(s,()=>_,[_]),$.createElement("div",{ref:o,className:Ht(Ne(so),Ne(cg))},$.createElement(ip.Provider,{value:_},n))}const D2=en("EnterFullscreen",$.createElement("path",{d:"M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"})),I2=en("ExitFullscreen",$.createElement("path",{d:"M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z"}));function L2(){var e;const{fullscreen:t,disabled:n,enter:r,exit:s}=T2(),{render:o}=It();return n?null:o.buttonFullscreen?$.createElement($.Fragment,null,(e=o.buttonFullscreen)===null||e===void 0?void 0:e.call(o,{fullscreen:t,disabled:n,enter:r,exit:s})):$.createElement(ds,{disabled:n,label:t?"Exit Fullscreen":"Enter Fullscreen",icon:t?I2:D2,renderIcon:t?o.iconExitFullscreen:o.iconEnterFullscreen,onClick:t?s:r})}function P2({augment:e,contains:t,addParent:n}){e(({fullscreen:r,toolbar:s,...o})=>({toolbar:Hi(s,so,$.createElement(L2,null)),fullscreen:op(r),...o})),n(t(oo)?oo:ro,gn(so,A2))}const kr={ref:null,position:"bottom",width:120,height:80,border:1,borderRadius:4,padding:4,gap:16,imageFit:"contain",vignette:!0,hidden:!1,showToggle:!1},Oc=e=>({...kr,...e});function ap(){const{thumbnails:e}=It();return Oc(e)}const Cr=e=>mr(oo,e),Lt=e=>Cr(mr("thumbnail",e)),$2=en("VideoThumbnail",$.createElement("path",{d:"M10 16.5l6-4.5-6-4.5v9zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z"})),F2=en("UnknownThumbnail",$.createElement("path",{d:"M23 18V6c0-1.1-.9-2-2-2H3c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2zM8.5 12.5l2.5 3.01L14.5 11l4.5 6H5l3.5-4.5z"}));function V2({slide:e,render:t,rect:n,imageFit:r}){var s;const o=(s=t.thumbnail)===null||s===void 0?void 0:s.call(t,{slide:e,render:t,rect:n,imageFit:r});if(o)return o;const i={render:t,rect:n,imageFit:r};if(e.thumbnail)return $.createElement(xr,{slide:{src:e.thumbnail},...i});if(vr(e))return $.createElement(xr,{slide:e,...i});const a=Ne(Lt(Fi));return e.type==="video"?$.createElement($.Fragment,null,e.poster&&$.createElement(xr,{slide:{src:e.poster},...i}),$.createElement($2,{className:a})):$.createElement(F2,{className:a})}const z2=br("active"),Tc=br("fadein"),Ac=br("fadeout"),H2=br("placeholder"),lp="delay",cp="duration";function U2({slide:e,index:t,onClick:n,fadeIn:r,fadeOut:s,placeholder:o,onLoseFocus:i}){const a=$.useRef(null),{render:l,styles:c,labels:d}=It(),{slides:u,globalIndex:f}=pn(),{getOwnerDocument:g}=ls(),{width:m,height:p,imageFit:y}=ap(),b={width:m,height:p},_=t===f,x=We(i);return $.useEffect(()=>{s&&g().activeElement===a.current&&x()},[s,x,g]),$.createElement("button",{ref:a,type:"button",className:Ht(Ne(ss),Ne(Lt()),_&&Ne(Lt(z2())),r&&Ne(Lt(Tc())),s&&Ne(Lt(Ac())),o&&Ne(Lt(H2()))),style:{...r?{[dt(Lt(Tc(cp)))]:`${r.duration}ms`,[dt(Lt(Tc(lp)))]:`${r.delay}ms`}:null,...s?{[dt(Lt(Ac(cp)))]:`${s.duration}ms`,[dt(Lt(Ac(lp)))]:`${s.delay}ms`}:null,...c.thumbnail},onClick:n,"aria-current":_?!0:void 0,"aria-label":wg(d,u,t)},e&&V2({slide:e,render:l,rect:b,imageFit:y}))}function dp(e){return["top","bottom"].includes(e)}function up(e,t){return t+2*(e.border+e.padding)+e.gap}function B2(e){const{thumbnail:t,poster:n}=e||{thumbnail:"placeholder"};return typeof t=="string"&&t||typeof n=="string"&&n||e&&kg(e)||void 0}function fp({visible:e,containerRef:t}){const n=$.useRef(null),r=Bi(),{publish:s,subscribe:o}=cs(),{carousel:i,styles:a,labels:l}=It(),{slides:c,globalIndex:d,animation:u}=pn(),{registerSensors:f,subscribeSensors:g}=Fg();Wg(g);const m=ap(),{position:p,width:y,height:b,border:_,borderStyle:x,borderColor:E,borderRadius:S,padding:w,gap:N,vignette:C}=m,k=u?.duration!==void 0&&u?.increment||0,M=u?.duration||0,{prepareAnimation:T}=Cc(n,A=>({keyframes:dp(p)?[{transform:`translateX(${(r?-1:1)*up(m,y)*k+A}px)`},{transform:"translateX(0)"}]:[{transform:`translateY(${up(m,b)*k+A}px)`},{transform:"translateY(0)"}],duration:M,easing:u?.easing})),L=We(()=>{let A=0;if(t.current&&n.current){const O=t.current.getBoundingClientRect(),V=n.current.getBoundingClientRect();A=dp(p)?V.left-O.left-(O.width-V.width)/2:V.top-O.top-(O.height-V.height)/2}T(A)});$.useEffect(()=>is(o(dc,L)),[o,L]);const P=Cg(i,c),F=[];if(bc(c))for(let A=d-P-Math.abs(k);A<=d+P+Math.abs(k);A+=1){const V=i.finite&&(A<0||A>c.length-1)||k<0&&A0&&A>d+P?null:yc(c,A),H=[`${A}`,B2(V)].filter(Boolean).join("|");F.push({key:H,index:A,slide:V})}const D=A=>()=>{A>d?s(ir,{count:A-d}):A{const H=M/Math.abs(k||1),W=k>0&&O>d+P-k&&O<=d+P||k<0&&O=d-P?{duration:H,delay:((k>0?O-(d+P-k):d-P-k-O)-1)*H}:void 0,j=k>0&&Od+P?{duration:H,delay:(k>0?k-(d-P-O):-k-(O-(d+P)))*H}:void 0;return $.createElement(U2,{key:A,index:O,slide:V,fadeIn:W,fadeOut:j,placeholder:!V,onClick:D(O),onLoseFocus:()=>{var U;return(U=n.current)===null||U===void 0?void 0:U.focus()}})})),C&&$.createElement("div",{className:Ne(Cr("vignette"))}))}const hp=$.createContext(null),j2=hn("useThumbnails","ThumbnailsContext",hp);function W2({children:e,...t}){const{ref:n,position:r,hidden:s}=Oc(t.thumbnails),[o,i]=$.useState(!s),a=$.useRef(null),l=$.useMemo(()=>({visible:o,show:()=>i(!0),hide:()=>i(!1)}),[o]);return $.useImperativeHandle(n,()=>l,[l]),$.createElement(Og,{...t},$.createElement(hp.Provider,{value:l},$.createElement("div",{ref:a,className:Ht(Ne(Cr()),Ne(Cr(`${r}`)))},["start","top"].includes(r)&&$.createElement(fp,{containerRef:a,visible:o}),$.createElement("div",{className:Ne(Cr("wrapper"))},e),["end","bottom"].includes(r)&&$.createElement(fp,{containerRef:a,visible:o}))))}const gp=()=>$.createElement($.Fragment,null,$.createElement("path",{strokeWidth:2,stroke:"currentColor",strokeLinejoin:"round",fill:"none",d:"M3 5l18 0l0 14l-18 0l0-14z"}),$.createElement("path",{d:"M5 14h4v3h-4zM10 14h4v3h-4zM15 14h4v3h-4z"})),G2=en("ThumbnailsVisible",gp()),Y2=S_("ThumbnailsHidden",gp());function K2(){const{visible:e,show:t,hide:n}=j2(),{render:r}=It();return r.buttonThumbnails?$.createElement($.Fragment,null,r.buttonThumbnails({visible:e,show:t,hide:n})):$.createElement(ds,{label:e?"Hide thumbnails":"Show thumbnails",icon:e?G2:Y2,renderIcon:e?r.iconThumbnailsVisible:r.iconThumbnailsHidden,onClick:e?n:t})}function X2({augment:e,contains:t,append:n,addParent:r}){e(({thumbnails:o,toolbar:i,...a})=>{const l=Oc(o);return{toolbar:Hi(i,oo,l.showToggle?$.createElement(K2,null):null),thumbnails:l,...a}});const s=gn(oo,W2);t(so)?n(so,s):r(ro,s)}const Dc=e=>{if(!e||typeof window>"u"||!window.location||!/^(https?:)?\/\//i.test(e))return!1;try{return new URL(e,window.location.href).origin!==window.location.origin}catch{return!1}},q2=window.G7Core?.createLogger?.("Comp:ImageGallery")??{log:(...e)=>console.log("[Comp:ImageGallery]",...e),warn:(...e)=>console.warn("[Comp:ImageGallery]",...e),error:(...e)=>console.error("[Comp:ImageGallery]",...e)},Ic=window.G7Core,Wi=(e,t)=>Ic?.t?.(e,t)??e,Z2=async(e,t)=>{try{const n=await Ic.api.get(e,{responseType:"blob"});if(n){const r=URL.createObjectURL(n),s=document.createElement("a");s.href=r,s.download=t,document.body.appendChild(s),s.click(),document.body.removeChild(s),URL.revokeObjectURL(r)}}catch(n){q2.error("Failed to download file:",n),Ic?.toast?.error?.(Wi("common.download_failed"))}},Q2=(e,t)=>{const n=document.createElement("a");n.href=e,n.download=t,n.target="_blank",document.body.appendChild(n),n.click(),document.body.removeChild(n)},Lc=async e=>{const t=e.downloadUrl||e.src,n=e.filename||e.title||"image";e.downloadRequiresAuth&&!Dc(t)?await Z2(t,n):Q2(t,n)},J2=({image:e,index:t,onDownload:n})=>{const[r,s]=v.useState(!1),o=async i=>{if(i.stopPropagation(),n){n(e,t);return}s(!0);try{await Lc(e)}finally{s(!1)}};return h.jsx(oe,{type:"button",onClick:o,disabled:r,className:"yarl__button flex items-center justify-center","aria-label":Wi("common.download"),title:Wi("common.download"),children:r?h.jsx(gt,{className:"fa-solid fa-spinner fa-spin text-white"}):h.jsx(gt,{className:"fa-solid fa-download text-white"})})},Gi=({images:e,isOpen:t,onClose:n,startIndex:r=0,enableZoom:s=!0,enableSlideshow:o=!1,enableFullscreen:i=!0,showCounter:a=!0,showDownload:l=!0,showThumbnails:c=!0,onDownload:d,editorAttrs:u,id:f})=>{const[g,m]=v.useState(r),p=v.useRef(r),y=e.map(x=>({src:x.src,title:x.title,description:x.description})),b=[];s&&b.push(y2),o&&b.push(N2),i&&b.push(P2),a&&b.push(w2),c&&b.push(X2);const _=e[g];if(v.useEffect(()=>{p.current=g},[g]),u){const x=(e??[]).slice(0,4);return h.jsx(I,{id:f,className:"grid grid-cols-2 gap-2 p-3 rounded-lg border border-dashed border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800",...u,children:x.length>0?x.map((E,S)=>h.jsx(kn,{src:E.thumbnail||E.src,alt:E.title||"",className:"w-full aspect-square object-cover rounded bg-gray-200 dark:bg-gray-700"},S)):h.jsxs(I,{className:"col-span-2 flex items-center justify-center py-6 text-sm text-gray-400 dark:text-gray-500",children:[h.jsx(gt,{className:"fa-regular fa-images mr-2"}),Wi("editor.component.image_gallery")]})})}return h.jsx(t2,{open:t,close:n,slides:y,index:g,plugins:b,on:{view:({index:x})=>{x!==p.current&&m(x)}},zoom:{maxZoomPixelRatio:3,zoomInMultiplier:2,doubleTapDelay:300,doubleClickDelay:300,doubleClickMaxStops:2,keyboardMoveDistance:50,wheelZoomDistanceFactor:100,pinchZoomDistanceFactor:100,scrollToZoom:!0},carousel:{finite:!0,preload:2,padding:"16px",spacing:"30%"},animation:{fade:250,swipe:500,easing:{fade:"ease",swipe:"ease-out",navigation:"ease-in-out"}},controller:{closeOnBackdropClick:!0,closeOnPullDown:!0,closeOnPullUp:!0},thumbnails:{position:"bottom",width:120,height:80,border:2,borderRadius:4,padding:4,gap:16,showToggle:!1,vignette:!0},toolbar:{buttons:[l&&_&&h.jsx(J2,{image:_,index:g,onDownload:d},"download"),"close"].filter(Boolean)},styles:{container:{backgroundColor:"rgba(0, 0, 0, 0.9)"}}})},pp=()=>{const[e,t]=v.useState(!1),[n,r]=v.useState([]),[s,o]=v.useState(0),i=v.useCallback((l,c=0)=>{r(l),o(c),t(!0)},[]),a=v.useCallback(()=>{t(!1)},[]);return{isOpen:e,openGallery:i,closeGallery:a,galleryProps:{images:n,isOpen:e,onClose:a,startIndex:s}}};Gi.displayName="ImageGallery";const R2=Object.freeze(Object.defineProperty({__proto__:null,ImageGallery:Gi,executeImageDownload:Lc,useImageGallery:pp},Symbol.toStringTag,{value:"Module"})),eE=v.createContext(null),tE=({value:e,children:t})=>h.jsx(eE.Provider,{value:e,children:t});function nE(e,t){return t.forEach((function(n){n&&typeof n!="string"&&!Array.isArray(n)&&Object.keys(n).forEach((function(r){if(r!=="default"&&!(r in e)){var s=Object.getOwnPropertyDescriptor(n,r);Object.defineProperty(e,r,s.get?s:{enumerable:!0,get:function(){return n[r]}})}}))})),Object.freeze(e)}function mp(e,t){return new Promise((function(n,r){let s;return rE(e).then((function(o){try{return s=o,n(new Blob([t.slice(0,2),s,t.slice(2)],{type:"image/jpeg"}))}catch(i){return r(i)}}),r)}))}const rE=e=>new Promise(((t,n)=>{const r=new FileReader;r.addEventListener("load",(({target:{result:s}})=>{const o=new DataView(s);let i=0;if(o.getUint16(i)!==65496)return n("not a valid JPEG");for(i+=2;;){const a=o.getUint16(i);if(a===65498)break;const l=o.getUint16(i+2);if(a===65505&&o.getUint32(i+4)===1165519206){const c=i+10;let d;switch(o.getUint16(c)){case 18761:d=!0;break;case 19789:d=!1;break;default:return n("TIFF header contains invalid endian")}if(o.getUint16(c+2,d)!==42)return n("TIFF header contains invalid version");const u=o.getUint32(c+4,d),f=c+u+2+12*o.getUint16(c+u,d);for(let g=c+u+2;g>>24&255,a[i+1]=l>>>16&255,a[i+2]=l>>>8&255,a[i+3]=l>>>0&255,new Uint8Array(a.buffer,0,i+4)},r.deflateRaw=function(s,o){o==null&&(o={level:6});var i=new Uint8Array(50+Math.floor(1.1*s.length)),a=r.F.deflateRaw(s,i,a,o.level);return new Uint8Array(i.buffer,0,a)},r.encode=function(s,o){o==null&&(o=!1);var i=0,a=r.bin.writeUint,l=r.bin.writeUshort,c={};for(var d in s){var u=!r._noNeed(d)&&!o,f=s[d],g=r.crc.crc(f,0,f.length);c[d]={cpr:u,usize:f.length,crc:g,file:u?r.deflateRaw(f):f}}for(var d in c)i+=c[d].file.length+30+46+2*r.bin.sizeUTF8(d);i+=22;var m=new Uint8Array(i),p=0,y=[];for(var d in c){var b=c[d];y.push(p),p=r._writeHeader(m,p,d,b,0)}var _=0,x=p;for(var d in c)b=c[d],y.push(p),p=r._writeHeader(m,p,d,b,1,y[_++]);var E=p-x;return a(m,p,101010256),p+=4,l(m,p+=4,_),l(m,p+=2,_),a(m,p+=2,E),a(m,p+=4,x),p+=4,p+=2,m.buffer},r._noNeed=function(s){var o=s.split(".").pop().toLowerCase();return"png,jpg,jpeg,zip".indexOf(o)!=-1},r._writeHeader=function(s,o,i,a,l,c){var d=r.bin.writeUint,u=r.bin.writeUshort,f=a.file;return d(s,o,l==0?67324752:33639248),o+=4,l==1&&(o+=2),u(s,o,20),u(s,o+=2,0),u(s,o+=2,a.cpr?8:0),d(s,o+=2,0),d(s,o+=4,a.crc),d(s,o+=4,f.length),d(s,o+=4,a.usize),u(s,o+=4,r.bin.sizeUTF8(i)),u(s,o+=2,0),o+=2,l==1&&(o+=2,o+=2,d(s,o+=6,c),o+=4),o+=r.bin.writeUTF8(s,o,i),l==0&&(s.set(f,o),o+=f.length),o},r.crc={table:(function(){for(var s=new Uint32Array(256),o=0;o<256;o++){for(var i=o,a=0;a<8;a++)1&i?i=3988292384^i>>>1:i>>>=1;s[o]=i}return s})(),update:function(s,o,i,a){for(var l=0;l>>8;return s},crc:function(s,o,i){return 4294967295^r.crc.update(4294967295,s,o,i)}},r.adler=function(s,o,i){for(var a=1,l=0,c=o,d=o+i;c>8&255},readUint:function(s,o){return 16777216*s[o+3]+(s[o+2]<<16|s[o+1]<<8|s[o])},writeUint:function(s,o,i){s[o]=255&i,s[o+1]=i>>8&255,s[o+2]=i>>16&255,s[o+3]=i>>24&255},readASCII:function(s,o,i){for(var a="",l=0;l>6,s[o+l+1]=128|d>>0&63,l+=2;else if((4294901760&d)==0)s[o+l]=224|d>>12,s[o+l+1]=128|d>>6&63,s[o+l+2]=128|d>>0&63,l+=3;else{if((4292870144&d)!=0)throw"e";s[o+l]=240|d>>18,s[o+l+1]=128|d>>12&63,s[o+l+2]=128|d>>6&63,s[o+l+3]=128|d>>0&63,l+=4}}return l},sizeUTF8:function(s){for(var o=s.length,i=0,a=0;a>>3}var y=c.lits,b=c.strt,_=c.prev,x=0,E=0,S=0,w=0,N=0,C=0;for(p>2&&(b[C=r.F._hash(s,0)]=0),f=0;f14e3||E>26697)&&p-f>100&&(m>>16,L=65535&M;if(M!=0){L=65535&M;var P=d(T=M>>>16,c.of0);c.lhst[257+P]++;var F=d(L,c.df0);c.dhst[F]++,w+=c.exb[P]+c.dxb[F],y[x]=T<<23|f-m,y[x+1]=L<<16|P<<8|F,x+=2,m=f+T}else c.lhst[s[f]]++;E++}}for(S==f&&s.length!=0||(m>>3},r.F._bestMatch=function(s,o,i,a,l,c){var d=32767&o,u=i[d],f=d-u+32768&32767;if(u==d||a!=r.F._hash(s,o-f))return 0;for(var g=0,m=0,p=Math.min(32767,o);f<=p&&--c!=0&&u!=d;){if(g==0||s[o+g]==s[o+g-f]){var y=r.F._howLong(s,o,f);if(y>g){if(m=f,(g=y)>=l)break;f+2b&&(b=E,u=x)}}}f+=(d=u)-(u=i[d])+32768&32767}return g<<16|m},r.F._howLong=function(s,o,i){if(s[o]!=s[o-i]||s[o+1]!=s[o+1-i]||s[o+2]!=s[o+2-i])return 0;var a=o,l=Math.min(s.length,o+258);for(o+=3;o>>23,j=O+(8388607&H);O>16,G=U>>8&255,z=255&U;C(u,f=r.F._writeLit(257+G,F,u,f),W-w.of0[G]),f+=w.exb[G],N(u,f=r.F._writeLit(z,D,u,f),B-w.df0[z]),f+=w.dxb[z],O+=W}}f=r.F._writeLit(256,F,u,f)}return f},r.F._copyExact=function(s,o,i,a,l){var c=l>>>3;return a[c]=i,a[c+1]=i>>>8,a[c+2]=255-a[c],a[c+3]=255-a[c+1],c+=4,a.set(new Uint8Array(s.buffer,o,i),c),l+(i+4<<3)},r.F.getTrees=function(){for(var s=r.F.U,o=r.F._hufTree(s.lhst,s.ltree,15),i=r.F._hufTree(s.dhst,s.dtree,15),a=[],l=r.F._lenCodes(s.ltree,a),c=[],d=r.F._lenCodes(s.dtree,c),u=0;u4&&s.itree[1+(s.ordr[g-1]<<1)]==0;)g--;return[o,i,f,l,d,g,a,c]},r.F.getSecond=function(s){for(var o=[],i=0;i>1)+",");return o},r.F.contSize=function(s,o){for(var i=0,a=0;a15&&(r.F._putsE(i,a,d,u),a+=u)}return a},r.F._lenCodes=function(s,o){for(var i=s.length;i!=2&&s[i-1]==0;)i-=2;for(var a=0;a>>1,138))<11?o.push(17,g-3):o.push(18,g-11),a+=2*g-2}else if(l==u&&c==l&&d==l){for(f=a+5;f+2>>1,6);o.push(16,g-3),a+=2*g-2}else o.push(l,0)}return i>>>1},r.F._hufTree=function(s,o,i){var a=[],l=s.length,c=o.length,d=0;for(d=0;di&&(r.F.restrictDepth(f,i,x),x=i),d=0;do;a++){var d=s[a].d;s[a].d=o,c+=l-(1<>>=i-o;c>0;)(d=s[a].d)=0;a--)s[a].d==o&&c<0&&(s[a].d--,c++);c!=0&&console.log("debt left")},r.F._goodIndex=function(s,o){var i=0;return o[16|i]<=s&&(i|=16),o[8|i]<=s&&(i|=8),o[4|i]<=s&&(i|=4),o[2|i]<=s&&(i|=2),o[1|i]<=s&&(i|=1),i},r.F._writeLit=function(s,o,i,a){return r.F._putsF(i,a,o[s<<1]),a+o[1+(s<<1)]},r.F.inflate=function(s,o){var i=Uint8Array;if(s[0]==3&&s[1]==0)return o||new i(0);var a=r.F,l=a._bitsF,c=a._bitsE,d=a._decodeTiny,u=a.makeCodes,f=a.codes2map,g=a._get17,m=a.U,p=o==null;p&&(o=new i(s.length>>>2<<3));for(var y,b,_=0,x=0,E=0,S=0,w=0,N=0,C=0,k=0,M=0;_==0;)if(_=l(s,M,1),x=l(s,M+1,2),M+=3,x!=0){if(p&&(o=r.F._check(o,k+131072)),x==1&&(y=m.flmap,b=m.fdmap,N=511,C=31),x==2){E=c(s,M,5)+257,S=c(s,M+5,5)+1,w=c(s,M+10,4)+4,M+=14;for(var T=0;T<38;T+=2)m.itree[T]=0,m.itree[T+1]=0;var L=1;for(T=0;TL&&(L=P)}M+=3*w,u(m.itree,L),f(m.itree,L,m.imap),y=m.lmap,b=m.dmap,M=d(m.imap,(1<>>4;if(!(O>>>8))o[k++]=O;else{if(O==256)break;var V=k+O-254;if(O>264){var H=m.ldef[O-257];V=k+(H>>>3)+c(s,M,7&H),M+=7&H}var W=b[g(s,M)&C];M+=15&W;var j=W>>>4,U=m.ddef[j],B=(U>>>4)+l(s,M,15&U);for(M+=15&U,p&&(o=r.F._check(o,k+131072));k>>3),z=s[G-4]|s[G-3]<<8;p&&(o=r.F._check(o,k+z)),o.set(new i(s.buffer,s.byteOffset+G,z),k),M=G+z<<3,k+=z}return o.length==k?o:o.slice(0,k)},r.F._check=function(s,o){var i=s.length;if(o<=i)return s;var a=new Uint8Array(Math.max(i<<1,o));return a.set(s,0),a},r.F._decodeTiny=function(s,o,i,a,l,c){for(var d=r.F._bitsE,u=r.F._get17,f=0;f>>4;if(m<=15)c[f]=m,f++;else{var p=0,y=0;m==16?(y=3+d(a,l,2),l+=2,p=c[f-1]):m==17?(y=3+d(a,l,3),l+=3):m==18&&(y=11+d(a,l,7),l+=7);for(var b=f+y;f>>1;cl&&(l=u),c++}for(;c>1,u=s[c+1],f=d<<4|u,g=o-u,m=s[c]<>>15-o]=f,m++},r.F.revCodes=function(s,o){for(var i=r.F.U.rev15,a=15-o,l=0;l>>a}},r.F._putsE=function(s,o,i){i<<=7&o;var a=o>>>3;s[a]|=i,s[a+1]|=i>>>8},r.F._putsF=function(s,o,i){i<<=7&o;var a=o>>>3;s[a]|=i,s[a+1]|=i>>>8,s[a+2]|=i>>>16},r.F._bitsE=function(s,o,i){return(s[o>>>3]|s[1+(o>>>3)]<<8)>>>(7&o)&(1<>>3]|s[1+(o>>>3)]<<8|s[2+(o>>>3)]<<16)>>>(7&o)&(1<>>3]|s[1+(o>>>3)]<<8|s[2+(o>>>3)]<<16)>>>(7&o)},r.F._get25=function(s,o){return(s[o>>>3]|s[1+(o>>>3)]<<8|s[2+(o>>>3)]<<16|s[3+(o>>>3)]<<24)>>>(7&o)},r.F.U=(t=Uint16Array,n=Uint32Array,{next_code:new t(16),bl_count:new t(16),ordr:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],of0:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],exb:[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0],ldef:new t(32),df0:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],dxb:[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0],ddef:new n(32),flmap:new t(512),fltree:[],fdmap:new t(32),fdtree:[],lmap:new t(32768),ltree:[],ttree:[],dmap:new t(32768),dtree:[],imap:new t(512),itree:[],rev15:new t(32768),lhst:new n(286),dhst:new n(30),ihst:new n(19),lits:new n(15e3),strt:new t(65536),prev:new t(32768)}),(function(){for(var s=r.F.U,o=0;o<32768;o++){var i=o;i=(4278255360&(i=(4042322160&(i=(3435973836&(i=(2863311530&i)>>>1|(1431655765&i)<<1))>>>2|(858993459&i)<<2))>>>4|(252645135&i)<<4))>>>8|(16711935&i)<<8,s.rev15[o]=(i>>>16|i<<16)>>>17}function a(l,c,d){for(;c--!=0;)l.push(0,d)}for(o=0;o<32;o++)s.ldef[o]=s.of0[o]<<3|s.exb[o],s.ddef[o]=s.df0[o]<<4|s.dxb[o];a(s.fltree,144,8),a(s.fltree,112,9),a(s.fltree,24,7),a(s.fltree,8,8),r.F.makeCodes(s.fltree,9),r.F.codes2map(s.fltree,9,s.flmap),r.F.revCodes(s.fltree,9),a(s.fdtree,32,5),r.F.makeCodes(s.fdtree,5),r.F.codes2map(s.fdtree,5,s.fdmap),r.F.revCodes(s.fdtree,5),a(s.itree,19,0),a(s.ltree,286,0),a(s.dtree,30,0),a(s.ttree,320,0)})()})();var oE=nE({__proto__:null,default:Yi},[Yi]);const Tn=(function(){var e={nextZero(d,u){for(;d[u]!=0;)u++;return u},readUshort:(d,u)=>d[u]<<8|d[u+1],writeUshort(d,u,f){d[u]=f>>8&255,d[u+1]=255&f},readUint:(d,u)=>16777216*d[u]+(d[u+1]<<16|d[u+2]<<8|d[u+3]),writeUint(d,u,f){d[u]=f>>24&255,d[u+1]=f>>16&255,d[u+2]=f>>8&255,d[u+3]=255&f},readASCII(d,u,f){let g="";for(let m=0;md.length<2?`0${d}`:d,readUTF8(d,u,f){let g,m="";for(let p=0;p>3)]>>7-((7&w)<<0)&1);b[k]=H[P],b[k+1]=H[P+1],b[k+2]=H[P+2],b[k+3]=F>2)]>>6-((3&w)<<1)&3),b[k]=H[P],b[k+1]=H[P+1],b[k+2]=H[P+2],b[k+3]=F>1)]>>4-((1&w)<<2)&15),b[k]=H[P],b[k+1]=H[P+1],b[k+2]=H[P+2],b[k+3]=F>>3)]>>>7-(7&O)&1))==255*C?0:255;_[W+O]=V<<24|D<<16|D<<8|D}else if(E==2)for(O=0;O>>2)]>>>6-((3&O)<<1)&3))==85*C?0:255,_[W+O]=V<<24|D<<16|D<<8|D;else if(E==4)for(O=0;O>>1)]>>>4-((1&O)<<2)&15))==17*C?0:255,_[W+O]=V<<24|D<<16|D<<8|D;else if(E==8)for(O=0;O>3,C=Math.ceil(E*w/8),k=new Uint8Array(S*C);let M=0;const T=[0,0,4,0,2,0,1],L=[0,4,0,2,0,1,0],P=[8,8,8,4,4,2,2],F=[8,8,4,4,2,2,1];let D=0;for(;D<7;){const O=P[D],V=F[D];let H=0,W=0,j=T[D];for(;j>3])>>7-(7&Y)&1,k[z*C+(K>>3)]|=A<<7-((7&K)<<0)),w==2&&(A=(A=_[Y>>3])>>6-(7&Y)&3,k[z*C+(K>>2)]|=A<<6-((3&K)<<1)),w==4&&(A=(A=_[Y>>3])>>4-(7&Y)&15,k[z*C+(K>>1)]|=A<<4-((1&K)<<2)),w>=8){const Z=z*C+K*N;for(let ee=0;ee>3)+ee]}Y+=w,K+=V}G++,z+=O}H*W!=0&&(M+=W*(1+B)),D+=1}return k})(u,d)),u}function r(d,u){return s(new Uint8Array(d.buffer,2,d.length-6),u)}var s=(function(){const d={H:{}};return d.H.N=function(u,f){const g=Uint8Array;let m,p,y=0,b=0,_=0,x=0,E=0,S=0,w=0,N=0,C=0;if(u[0]==3&&u[1]==0)return f||new g(0);const k=d.H,M=k.b,T=k.e,L=k.R,P=k.n,F=k.A,D=k.Z,A=k.m,O=f==null;for(O&&(f=new g(u.length>>>2<<5));y==0;)if(y=M(u,C,1),b=M(u,C+1,2),C+=3,b!=0){if(O&&(f=d.H.W(f,N+(1<<17))),b==1&&(m=A.J,p=A.h,S=511,w=31),b==2){_=T(u,C,5)+257,x=T(u,C+5,5)+1,E=T(u,C+10,4)+4,C+=14;let H=1;for(var V=0;V<38;V+=2)A.Q[V]=0,A.Q[V+1]=0;for(V=0;VH&&(H=U)}C+=3*E,P(A.Q,H),F(A.Q,H,A.u),m=A.w,p=A.d,C=L(A.u,(1<>>4;if(!(W>>>8))f[N++]=W;else{if(W==256)break;{let j=N+W-254;if(W>264){const K=A.q[W-257];j=N+(K>>>3)+T(u,C,7&K),C+=7&K}const U=p[D(u,C)&w];C+=15&U;const B=U>>>4,G=A.c[B],z=(G>>>4)+M(u,C,15&G);for(C+=15&G;N>>3),W=u[H-4]|u[H-3]<<8;O&&(f=d.H.W(f,N+W)),f.set(new g(u.buffer,u.byteOffset+H,W),N),C=H+W<<3,N+=W}return f.length==N?f:f.slice(0,N)},d.H.W=function(u,f){const g=u.length;if(f<=g)return u;const m=new Uint8Array(g<<1);return m.set(u,0),m},d.H.R=function(u,f,g,m,p,y){const b=d.H.e,_=d.H.Z;let x=0;for(;x>>4;if(S<=15)y[x]=S,x++;else{let w=0,N=0;S==16?(N=3+b(m,p,2),p+=2,w=y[x-1]):S==17?(N=3+b(m,p,3),p+=3):S==18&&(N=11+b(m,p,7),p+=7);const C=x+N;for(;x>>1;for(;yp&&(p=_),y++}for(;y>1,_=u[y+1],x=b<<4|_,E=f-_;let S=u[y]<>>15-f]=x,S++}},d.H.l=function(u,f){const g=d.H.m.r,m=15-f;for(let p=0;p>>m}},d.H.M=function(u,f,g){g<<=7&f;const m=f>>>3;u[m]|=g,u[m+1]|=g>>>8},d.H.I=function(u,f,g){g<<=7&f;const m=f>>>3;u[m]|=g,u[m+1]|=g>>>8,u[m+2]|=g>>>16},d.H.e=function(u,f,g){return(u[f>>>3]|u[1+(f>>>3)]<<8)>>>(7&f)&(1<>>3]|u[1+(f>>>3)]<<8|u[2+(f>>>3)]<<16)>>>(7&f)&(1<>>3]|u[1+(f>>>3)]<<8|u[2+(f>>>3)]<<16)>>>(7&f)},d.H.i=function(u,f){return(u[f>>>3]|u[1+(f>>>3)]<<8|u[2+(f>>>3)]<<16|u[3+(f>>>3)]<<24)>>>(7&f)},d.H.m=(function(){const u=Uint16Array,f=Uint32Array;return{K:new u(16),j:new u(16),X:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],S:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],T:[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0],q:new u(32),p:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],z:[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0],c:new f(32),J:new u(512),_:[],h:new u(32),$:[],w:new u(32768),C:[],v:[],d:new u(32768),D:[],u:new u(512),Q:[],r:new u(32768),s:new f(286),Y:new f(30),a:new f(19),t:new f(15e3),k:new u(65536),g:new u(32768)}})(),(function(){const u=d.H.m;for(var f=0;f<32768;f++){let m=f;m=(2863311530&m)>>>1|(1431655765&m)<<1,m=(3435973836&m)>>>2|(858993459&m)<<2,m=(4042322160&m)>>>4|(252645135&m)<<4,m=(4278255360&m)>>>8|(16711935&m)<<8,u.r[f]=(m>>>16|m<<16)>>>17}function g(m,p,y){for(;p--!=0;)m.push(0,y)}for(f=0;f<32;f++)u.q[f]=u.S[f]<<3|u.T[f],u.c[f]=u.p[f]<<4|u.z[f];g(u._,144,8),g(u._,112,9),g(u._,24,7),g(u._,8,8),d.H.n(u._,9),d.H.A(u._,9,u.J),d.H.l(u._,9),g(u.$,32,5),d.H.n(u.$,5),d.H.A(u.$,5,u.h),d.H.l(u.$,5),g(u.Q,19,0),g(u.C,286,0),g(u.D,30,0),g(u.v,320,0)})(),d.H.N})();function o(d){return[1,null,3,1,2,null,4][d.ctype]*d.depth}function i(d,u,f,g,m){let p=o(u);const y=Math.ceil(g*p/8);let b,_;p=Math.ceil(p/8);let x=d[f],E=0;if(x>1&&(d[f]=[0,0,1][x-2]),x==3)for(E=p;E>>1)&255;for(let S=0;S>>1);for(;E>>1)}else{for(;E=0&&b>=0?(S=D*u+A<<2,w=(b+D)*m+y+A<<2):(S=(-b+D)*u-y+A<<2,w=D*m+A<<2),_==0)g[w]=d[S],g[w+1]=d[S+1],g[w+2]=d[S+2],g[w+3]=d[S+3];else if(_==1){var N=d[S+3]*.00392156862745098,C=d[S]*N,k=d[S+1]*N,M=d[S+2]*N,T=g[w+3]*(1/255),L=g[w]*T,P=g[w+1]*T,F=g[w+2]*T;const O=1-N,V=N+T*O,H=V==0?0:1/V;g[w+3]=255*V,g[w+0]=(C+L*O)*H,g[w+1]=(k+P*O)*H,g[w+2]=(M+F*O)*H}else if(_==2)N=d[S+3],C=d[S],k=d[S+1],M=d[S+2],T=g[w+3],L=g[w],P=g[w+1],F=g[w+2],N==T&&C==L&&k==P&&M==F?(g[w]=0,g[w+1]=0,g[w+2]=0,g[w+3]=0):(g[w]=C,g[w+1]=k,g[w+2]=M,g[w+3]=N);else if(_==3){if(N=d[S+3],C=d[S],k=d[S+1],M=d[S+2],T=g[w+3],L=g[w],P=g[w+1],F=g[w+2],N==T&&C==L&&k==P&&M==F)continue;if(N<220&&T>20)return!1}return!0}return{decode:function(u){const f=new Uint8Array(u);let g=8;const m=e,p=m.readUshort,y=m.readUint,b={tabs:{},frames:[]},_=new Uint8Array(f.length);let x,E=0,S=0;const w=[137,80,78,71,13,10,26,10];for(var N=0;N<8;N++)if(f[N]!=w[N])throw"The input is not a PNG file!";for(;g>>1:M>>>=1;C[k]=M}return C})(),update(C,k,M,T){for(let L=0;L>>8;return C},crc:(C,k,M)=>4294967295^r.update(4294967295,C,k,M)};function s(C,k,M,T){k[M]+=C[0]*T>>4,k[M+1]+=C[1]*T>>4,k[M+2]+=C[2]*T>>4,k[M+3]+=C[3]*T>>4}function o(C){return Math.max(0,Math.min(255,C))}function i(C,k){const M=C[0]-k[0],T=C[1]-k[1],L=C[2]-k[2],P=C[3]-k[3];return M*M+T*T+L*L+P*P}function a(C,k,M,T,L,P,F){F==null&&(F=1);const D=T.length,A=[];for(var O=0;O>>0&255,z>>>8&255,z>>>16&255,z>>>24&255])}for(O=0;O>2]=V,j[O>>2]=T[V]}}function l(C,k,M,T,L){L==null&&(L={});const{crc:P}=r,F=t.writeUint,D=t.writeUshort,A=t.writeASCII;let O=8;const V=C.frames.length>1;let H,W=!1,j=33+(V?20:0);if(L.sRGB!=null&&(j+=13),L.pHYs!=null&&(j+=21),L.iCCP!=null&&(H=pako.deflate(L.iCCP),j+=21+H.length+4),C.ctype==3){for(var U=C.plte.length,B=0;B>>24!=255&&(W=!0);j+=8+3*U+4+(W?8+1*U+4:0)}for(var G=0;G>>8&255,he=te>>>16&255;z[O+ee+0]=ce,z[O+ee+1]=J,z[O+ee+2]=he}if(O+=3*U,F(z,O,P(z,O-3*U-4,3*U+4)),O+=4,W){for(F(z,O,U),O+=4,A(z,O,"tRNS"),O+=4,B=0;B>>24&255;O+=U,F(z,O,P(z,O-U-4,U+4)),O+=4}}let Y=0;for(G=0;GFe&&(Fe=rt),itnt&&(nt=it));Fe==-1&&(ye=Ce=Fe=nt=0),se&&((1&ye)==1&&ye--,(1&Ce)==1&&Ce--);const pt=(Fe-ye+1)*(nt-Ce+1);pt>2,He>>2);ee.push(te);const se=new Uint8Array(pe.abuf,we,He);V&&a(ce.img,ce.rect.width,ce.rect.height,Z,se,te),ce.img.set(se),we+=He}}else for(U=0;UJ&&ue==Se[G-J])te[G]=te[G-J];else{let pe=Y[ue];if(pe==null&&(Y[ue]=pe=Z.length,Z.push(ue),Z.length>=300))break;te[G]=pe}}}const he=Z.length;for(he<=256&&O==0&&(W=he<=2?1:he<=4?2:he<=16?4:8,W=Math.max(W,A)),U=0;U>1)]|=He[Oe+ae]<<4-4*(1&ae);else if(W==2)for(ae=0;ae>2)]|=He[Oe+ae]<<6-2*(3&ae);else if(W==1)for(ae=0;ae>3)]|=He[Oe+ae]<<7-1*(7&ae)}ue=le,H=3,we=1}else if(z==0&&K.length==1){le=new Uint8Array(J*Se*3);const He=J*Se;for(G=0;GG&&(G=ee),tez&&(z=te))}G==-1&&(U=B=G=z=0),F&&((1&U)==1&&U--,(1&B)==1&&B--),P={x:U,y:B,width:G-U+1,height:z-B+1};const K=T[L];K.rect=P,K.blend=1,K.img=new Uint8Array(P.width*P.height*4),T[L-1].dispose==0?(e(O,k,M,K.img,P.width,P.height,-P.x,-P.y,0),f(W,k,M,K.img,P)):e(W,k,M,K.img,P.width,P.height,-P.x,-P.y,0)}function f(C,k,M,T,L){e(C,k,M,T,L.width,L.height,-L.x,-L.y,2)}function g(C,k,M,T,L,P,F){const D=[];let A,O=[0,1,2,3,4];P!=-1?O=[P]:(k*T>5e5||M==1)&&(O=[0]),F&&(A={level:0});const V=oE;for(var H=0;H>1)+256&255;if(P==4)for(A=L;A>1)&255;for(A=L;A>1)&255}if(P==4){for(A=0;A>2);let V;if(M.length<2e7)for(var H=0;H>2]=V.ind,L[H>>2]=V.est.rgba;else for(H=0;H>2]=V.ind,L[H>>2]=V.est.rgba}return{abuf:T.buffer,inds:O,plte:D}}function y(C,k,M){M==null&&(M=1e-4);const T=new Uint32Array(C.buffer),L={i0:0,i1:C.length,bst:null,est:null,tdst:0,left:null,right:null};L.bst=S(C,L.i0,L.i1),L.est=w(L.bst);const P=[L];for(;P.lengthD&&(D=P[F].est.L,A=F);if(D=V||O.i1<=V){O.est.L=0;continue}const H={i0:O.i0,i1:V,bst:null,est:null,tdst:0,left:null,right:null};H.bst=S(C,H.i0,H.i1),H.est=w(H.bst);const W={i0:V,i1:O.i1,bst:null,est:null,tdst:0,left:null,right:null};for(W.bst={R:[],m:[],N:O.bst.N-H.bst.N},F=0;F<16;F++)W.bst.R[F]=O.bst.R[F]-H.bst.R[F];for(F=0;F<4;F++)W.bst.m[F]=O.bst.m[F]-H.bst.m[F];W.est=w(W.bst),O.left=H,O.right=W,P[A]=H,P.push(W)}for(P.sort(((D,A)=>A.bst.N-D.bst.N)),F=0;F0&&(F=C.right,D=C.left);const A=b(F,k,M,T,L);if(A.tdst<=P*P)return A;const O=b(D,k,M,T,L);return O.tdstP;)T-=4;if(M>=T)break;const F=k[M>>2];k[M>>2]=k[T>>2],k[T>>2]=F,M+=4,T-=4}for(;E(C,M,L)>P;)M-=4;return M+4}function E(C,k,M){return C[k]*M[0]+C[k+1]*M[1]+C[k+2]*M[2]+C[k+3]*M[3]}function S(C,k,M){const T=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],L=[0,0,0,0],P=M-k>>2;for(let F=k;F>>0}}var N={multVec:(C,k)=>[C[0]*k[0]+C[1]*k[1]+C[2]*k[2]+C[3]*k[3],C[4]*k[0]+C[5]*k[1]+C[6]*k[2]+C[7]*k[3],C[8]*k[0]+C[9]*k[1]+C[10]*k[2]+C[11]*k[3],C[12]*k[0]+C[13]*k[1]+C[14]*k[2]+C[15]*k[3]],dot:(C,k)=>C[0]*k[0]+C[1]*k[1]+C[2]*k[2]+C[3]*k[3],sml:(C,k)=>[C*k[0],C*k[1],C*k[2],C*k[3]]};Tn.encode=function(k,M,T,L,P,F,D){L==null&&(L=0),D==null&&(D=!1);const A=d(k,M,T,L,[!1,!1,!1,0,D,!1]);return c(A,-1),l(A,M,T,P,F)},Tn.encodeLL=function(k,M,T,L,P,F,D,A){const O={ctype:0+(L==1?0:2)+(P==0?0:4),depth:F,frames:[]},V=(L+P)*F,H=V*M;for(let W=0;W>>0),S(1),S(32),w(3),w(l),w(2835),w(2835),N(8),w(16711680),w(65280),w(255),w(4278190080),w(1466527264),(function C(){for(;_0;){for(y=122+_*a,g=0;g>>24,u.setUint32(y+g,m<<8|p),g+=4;_++}E{t(new Blob([n],{type:"image/bmp"}))}))},_dly:9};var tn={CHROME:"CHROME",FIREFOX:"FIREFOX",DESKTOP_SAFARI:"DESKTOP_SAFARI",IE:"IE",IOS:"IOS",ETC:"ETC"},iE={[tn.CHROME]:16384,[tn.FIREFOX]:11180,[tn.DESKTOP_SAFARI]:16384,[tn.IE]:8192,[tn.IOS]:4096,[tn.ETC]:8192};const Pc=typeof window<"u",yp=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,Ki=Pc&&window.cordova&&window.cordova.require&&window.cordova.require("cordova/modulemapper"),aE=(Pc||yp)&&(Ki&&Ki.getOriginalSymbol(window,"File")||typeof File<"u"&&File),vp=(Pc||yp)&&(Ki&&Ki.getOriginalSymbol(window,"FileReader")||typeof FileReader<"u"&&FileReader);function $c(e,t,n=Date.now()){return new Promise((r=>{const s=e.split(","),o=s[0].match(/:(.*?);/)[1],i=globalThis.atob(s[1]);let a=i.length;const l=new Uint8Array(a);for(;a--;)l[a]=i.charCodeAt(a);const c=new Blob([l],{type:o});c.name=t,c.lastModified=n,r(c)}))}function xp(e){return new Promise(((t,n)=>{const r=new vp;r.onload=()=>t(r.result),r.onerror=s=>n(s),r.readAsDataURL(e)}))}function wp(e){return new Promise(((t,n)=>{const r=new Image;r.onload=()=>t(r),r.onerror=s=>n(s),r.src=e}))}function Sr(){if(Sr.cachedResult!==void 0)return Sr.cachedResult;let e=tn.ETC;const{userAgent:t}=navigator;return/Chrom(e|ium)/i.test(t)?e=tn.CHROME:/iP(ad|od|hone)/i.test(t)&&/WebKit/i.test(t)?e=tn.IOS:/Safari/i.test(t)?e=tn.DESKTOP_SAFARI:/Firefox/i.test(t)?e=tn.FIREFOX:(/MSIE/i.test(t)||document.documentMode)&&(e=tn.IE),Sr.cachedResult=e,Sr.cachedResult}function kp(e,t){const n=Sr(),r=iE[n];let s=e,o=t,i=s*o;const a=s>o?o/s:s/o;for(;i>r*r;){const l=(r+s)/2,c=(r+o)/2;lbp.toBlob(e,d))).then(function(d){try{return a=d,a.name=n,a.lastModified=r,c.call(this)}catch(u){return i(u)}}.bind(this),i);{let d=function(){return c.call(this)};if(typeof OffscreenCanvas=="function"&&e instanceof OffscreenCanvas)return e.convertToBlob({type:t,quality:s}).then(function(u){try{return a=u,a.name=n,a.lastModified=r,d.call(this)}catch(f){return i(f)}}.bind(this),i);{let u;return u=e.toDataURL(t,s),$c(u,n,r).then(function(f){try{return a=f,d.call(this)}catch(g){return i(g)}}.bind(this),i)}}}function l(){return o(a)}}))}function Vn(e){e.width=0,e.height=0}function us(){return new Promise((function(e,t){let n,r,s,o;return us.cachedResult!==void 0?e(us.cachedResult):$c("data:image/jpeg;base64,/9j/4QAiRXhpZgAATU0AKgAAAAgAAQESAAMAAAABAAYAAAAAAAD/2wCEAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAf/AABEIAAEAAgMBEQACEQEDEQH/xABKAAEAAAAAAAAAAAAAAAAAAAALEAEAAAAAAAAAAAAAAAAAAAAAAQEAAAAAAAAAAAAAAAAAAAAAEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwA/8H//2Q==","test.jpg",Date.now()).then((function(i){try{return n=i,Zi(n).then((function(a){try{return r=a[1],Qi(r,n.type,n.name,n.lastModified).then((function(l){try{return s=l,Vn(r),Zi(s).then((function(c){try{return o=c[0],us.cachedResult=o.width===1&&o.height===2,e(us.cachedResult)}catch(d){return t(d)}}),t)}catch(c){return t(c)}}),t)}catch(l){return t(l)}}),t)}catch(a){return t(a)}}),t)}))}function Sp(e){return new Promise(((t,n)=>{const r=new vp;r.onload=s=>{const o=new DataView(s.target.result);if(o.getUint16(0,!1)!=65496)return t(-2);const i=o.byteLength;let a=2;for(;an(s),r.readAsArrayBuffer(e)}))}function _p(e,t){const{width:n}=e,{height:r}=e,{maxWidthOrHeight:s}=t;let o,i=e;return isFinite(s)&&(n>s||r>s)&&([i,o]=Xi(n,r),n>r?(i.width=s,i.height=r/n*s):(i.width=n/r*s,i.height=s),o.drawImage(e,0,0,i.width,i.height),Vn(e)),i}function Ep(e,t){const{width:n}=e,{height:r}=e,[s,o]=Xi(n,r);switch(t>4&&t<9?(s.width=r,s.height=n):(s.width=n,s.height=r),t){case 2:o.transform(-1,0,0,1,n,0);break;case 3:o.transform(-1,0,0,-1,n,r);break;case 4:o.transform(1,0,0,-1,0,r);break;case 5:o.transform(0,1,1,0,0,0);break;case 6:o.transform(0,1,-1,0,r,0);break;case 7:o.transform(0,-1,-1,0,r,n);break;case 8:o.transform(0,-1,1,0,0,n)}return o.drawImage(e,0,0,n,r),Vn(e),s}function Mp(e,t,n=0){return new Promise((function(r,s){let o,i,a,l,c,d,u,f,g,m,p,y,b,_,x,E,S,w,N,C;function k(T=5){if(t.signal&&t.signal.aborted)throw t.signal.reason;o+=T,t.onProgress(Math.min(o,100))}function M(T){if(t.signal&&t.signal.aborted)throw t.signal.reason;o=Math.min(Math.max(T,o),100),t.onProgress(o)}return o=n,i=t.maxIteration||10,a=1024*t.maxSizeMB*1024,k(),Zi(e,t).then(function(T){try{return[,l]=T,k(),c=_p(l,t),k(),new Promise((function(L,P){var F;if(!(F=t.exifOrientation))return Sp(e).then(function(A){try{return F=A,D.call(this)}catch(O){return P(O)}}.bind(this),P);function D(){return L(F)}return D.call(this)})).then(function(L){try{return d=L,k(),us().then(function(P){try{return u=P?c:Ep(c,d),k(),f=t.initialQuality||1,g=t.fileType||e.type,Qi(u,g,e.name,e.lastModified,f).then(function(F){try{{let A=function(){if(i--&&(x>a||x>b)){let V,H;return V=C?.95*N.width:N.width,H=C?.95*N.height:N.height,[S,w]=Xi(V,H),w.drawImage(N,0,0,V,H),f*=g==="image/png"?.85:.95,Qi(S,g,e.name,e.lastModified,f).then((function(W){try{return E=W,Vn(N),N=S,x=E.size,M(Math.min(99,Math.floor((_-x)/(_-a)*100))),A}catch(j){return s(j)}}),s)}return[1]},O=function(){return Vn(N),Vn(S),Vn(c),Vn(u),Vn(l),M(100),r(E)};if(m=F,k(),p=m.size>a,y=m.size>e.size,!p&&!y)return M(100),r(m);var D;return b=e.size,_=m.size,x=_,N=u,C=!t.alwaysKeepResolution&&p,(D=function(V){for(;V;){if(V.then)return void V.then(D,s);try{if(V.pop){if(V.length)return V.pop()?O.call(this):V;V=A}else V=V.call(this)}catch(H){return s(H)}}}.bind(this))(A)}}catch(A){return s(A)}}.bind(this),s)}catch(F){return s(F)}}.bind(this),s)}catch(P){return s(P)}}.bind(this),s)}catch(L){return s(L)}}.bind(this),s)}))}const lE=` + `,children:[h.jsx(ae,{name:x.faIcon,className:"w-4 h-4"}),h.jsx(J,{children:x.label}),y?.faIcon===x.faIcon&&h.jsx(ae,{name:"check",className:"w-4 h-4 ml-auto text-blue-600"})]},x.value)):h.jsx(I,{className:"px-3 py-4 text-sm text-gray-500 dark:text-gray-400 text-center",children:o})})]})]})},Nc=({defaultOpen:e=!1,isOpen:t,onToggle:n,className:r="",style:s,children:o,disabled:i=!1,id:a,editorAttrs:l})=>{const[c,d]=v.useState(e),u=t!==void 0,f=u?t:c,g=v.useRef(null),[m,p]=v.useState(e?void 0:0),y=()=>{if(i)return;const _=!f;u||d(_),n?.(_)};v.useEffect(()=>{if(g.current)if(f){p(g.current.scrollHeight);const _=setTimeout(()=>{p(void 0)},300);return()=>clearTimeout(_)}else p(g.current.scrollHeight),requestAnimationFrame(()=>{p(0)})},[f]);const b={};if(v.Children.forEach(o,_=>{if(v.isValidElement(_)){const x=_.props?.slot;x==="trigger"?b.trigger=_:x==="content"&&(b.content=_)}}),!b.trigger&&!b.content){const _=v.Children.toArray(o);_.length>=2?(b.trigger=_[0],b.content=_.slice(1)):_.length===1&&(b.content=_[0])}return h.jsxs(I,{className:`border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden ${r}`,style:s,id:a,...l,children:[h.jsxs(le,{type:"button",onClick:y,disabled:i,className:`w-full flex items-center justify-between p-3 text-left bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors ${i?"opacity-50 cursor-not-allowed":""} ${f?"border-b border-gray-200 dark:border-gray-700":""}`,"aria-expanded":f,children:[h.jsx(I,{className:"flex-1",children:b.trigger}),!b.trigger&&h.jsx("svg",{className:`w-5 h-5 text-gray-500 dark:text-gray-400 transition-transform duration-200 ${f?"rotate-180":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),h.jsx(I,{ref:g,className:"overflow-hidden transition-all duration-300 ease-in-out",style:{height:m!==void 0?`${m}px`:"auto"},children:h.jsx(I,{className:"bg-white dark:bg-gray-800",children:b.content})})]})},yo=window.G7Core,Fg=yo?.useControllableState,zg=(e,t)=>window.G7Core?.t?.(e,t)??e,Y_={"":"common.scope_type_all_desc",self:"common.scope_type_self_desc",role:"common.scope_type_role_desc"},K_=({options:e,value:t,onChange:n,disabled:r=!1})=>{const[s,o]=v.useState(!1),[i,a]=v.useState({}),l=v.useRef(null),c=e.find(u=>u.value===t)??e[0];v.useEffect(()=>{if(!s)return;const u=g=>{l.current&&!l.current.contains(g.target)&&o(!1)},f=()=>{if(!l.current)return;const g=l.current.getBoundingClientRect();a({position:"fixed",top:g.bottom+4,right:window.innerWidth-g.right,zIndex:9999})};return document.addEventListener("mousedown",u),window.addEventListener("scroll",f,!0),window.addEventListener("resize",f),()=>{document.removeEventListener("mousedown",u),window.removeEventListener("scroll",f,!0),window.removeEventListener("resize",f)}},[s]);const d=v.useCallback(()=>{if(r||!l.current)return;const u=l.current.getBoundingClientRect();a({position:"fixed",top:u.bottom+4,right:window.innerWidth-u.right,zIndex:9999}),o(f=>!f)},[r]);return h.jsxs(I,{ref:l,className:"relative flex-shrink-0",children:[h.jsxs(I,{role:"button",tabIndex:0,onClick:u=>{u.stopPropagation(),u.preventDefault(),d()},onMouseDown:u=>u.stopPropagation(),onKeyDown:u=>{(u.key==="Enter"||u.key===" ")&&(u.stopPropagation(),u.preventDefault(),d()),u.key==="Escape"&&o(!1)},className:`flex items-center gap-1 text-xs px-2 py-1 rounded border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-700 dark:text-gray-300 cursor-pointer select-none ${r?"opacity-50 cursor-not-allowed":"hover:border-blue-400 dark:hover:border-blue-500"}`,children:[h.jsx(J,{children:c?.label??""}),h.jsx(ae,{name:he.ChevronDown,className:"w-3 h-3 text-gray-400 dark:text-gray-500"})]}),s&&h.jsx(I,{style:i,className:"w-56 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-600 rounded-lg shadow-lg py-1",children:e.map(u=>{const f=u.value??"",g=Y_[f],m=g?zg(g):"",p=u.value===t;return h.jsxs(I,{role:"option","aria-selected":p,onClick:y=>{y.stopPropagation(),y.preventDefault(),n(u.value),o(!1)},onMouseDown:y=>y.stopPropagation(),className:`px-3 py-2 cursor-pointer transition-colors ${p?"bg-blue-50 dark:bg-blue-900/30":"hover:bg-gray-50 dark:hover:bg-gray-700/50"}`,children:[h.jsxs(I,{className:"flex items-center justify-between",children:[h.jsx(J,{className:`text-xs font-medium ${p?"text-blue-700 dark:text-blue-300":"text-gray-900 dark:text-white"}`,children:u.label}),p&&h.jsx(ae,{name:he.Check,className:"w-3.5 h-3.5 text-blue-600 dark:text-blue-400"})]}),m&&h.jsx(J,{className:"block text-xs text-gray-500 dark:text-gray-400 mt-0.5",children:m})]},f||"__null__")})})]})},X_=(e,t)=>{if(e.length!==t.length)return!1;const n=[...e].sort((s,o)=>s.id-o.id),r=[...t].sort((s,o)=>s.id-o.id);return n.every((s,o)=>s.id===r[o].id&&s.scope_type===r[o].scope_type)},q_=({data:e=[],value:t=[],onChange:n,scopeOptions:r=[],className:s="",disabled:o=!1,desktopColumns:i=2,installedModules:a=[],installedPlugins:l=[],id:c,editorAttrs:d})=>{const u=v.useCallback(E=>{if(n){const T=yo?.createChangeEvent?yo.createChangeEvent({value:E}):{target:{value:E}};n(T)}},[n]),[f,g]=Fg?Fg(t,[],u,{isEqual:X_}):(()=>{const[E,T]=v.useState(t),P=v.useRef(n);P.current=n;const L=v.useRef(!1);v.useEffect(()=>{if(L.current){L.current=!1;return}T(t)},[t]);const F=v.useCallback(A=>{L.current=!0,T(D=>{const O=typeof A=="function"?A(D):A;if(P.current){const z=yo?.createChangeEvent?yo.createChangeEvent({value:O}):{target:{value:O}};P.current(z)}return O})},[]);return[E,F]})(),m=v.useMemo(()=>new Set(f.map(E=>E.id)),[f]),p=v.useCallback(E=>E.is_assignable?[E.id]:E.children.flatMap(T=>p(T)),[]),y=v.useCallback(E=>{const T=p(E);return T.length>0&&T.every(P=>m.has(P))},[m,p]),b=v.useCallback(E=>{const T=p(E),P=T.filter(L=>m.has(L)).length;return P>0&&Pp(E).filter(P=>m.has(P)).length,[m,p]),x=v.useCallback((E,T)=>{o||g(P=>T?[...P,{id:E,scope_type:null}]:P.filter(L=>L.id!==E))},[o,g]),M=v.useCallback((E,T)=>{if(o)return;const P=p(E),L=new Set(P);g(F=>{if(T){const A=new Set(F.map(O=>O.id)),D=P.filter(O=>!A.has(O)).map(O=>({id:O,scope_type:null}));return[...F,...D]}else return F.filter(A=>!L.has(A.id))})},[o,p,g]),S=v.useCallback((E,T)=>{o||g(P=>P.map(L=>L.id===E?{...L,scope_type:T}:L))},[o,g]),k=E=>{const T=m.has(E.id),P=!!E.resource_route_key,L=T&&P&&r.length>0,F=f.find(A=>A.id===E.id)?.scope_type??null;return h.jsxs(gn,{className:`flex items-start gap-3 p-3 rounded-lg border cursor-pointer transition-colors ${T?"border-blue-200 bg-blue-50 dark:border-blue-800 dark:bg-blue-900/20":"border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-700/50"} ${o?"opacity-50 cursor-not-allowed":""}`,children:[h.jsx(Et,{type:"checkbox",checked:T,onChange:A=>{A.stopPropagation(),x(E.id,A.target.checked)},disabled:o,className:"w-4 h-4 mt-0.5 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:bg-gray-700 dark:border-gray-600"}),h.jsxs(I,{className:"flex-1 min-w-0",children:[h.jsxs(I,{className:"flex items-center justify-between gap-2",children:[h.jsx(J,{className:"text-sm font-medium text-gray-900 dark:text-white",children:E.name}),L&&h.jsx(K_,{options:r,value:F,onChange:A=>S(E.id,A),disabled:o})]}),E.description&&h.jsx(J,{className:"block text-xs text-gray-500 dark:text-gray-400 mt-0.5",children:E.description})]})]},E.id)},N=(E,T)=>{const P=y(E),L=b(E),F=_(E),A=E.children.filter(z=>z.is_assignable);if(A.length===0&&E.children.length===0)return null;const D=E.children.some(z=>!z.is_assignable),O=i===1?"grid-cols-1":i===3?"grid-cols-1 md:grid-cols-3":"grid-cols-1 md:grid-cols-2";return h.jsxs(Nc,{defaultOpen:!1,className:"border-0 rounded-none",children:[h.jsxs(I,{slot:"trigger",className:"flex items-center gap-3 w-full py-2",children:[h.jsx("input",{type:"checkbox",checked:P,ref:z=>{z&&(z.indeterminate=L)},onChange:z=>{z.stopPropagation(),M(E,z.target.checked)},onClick:z=>z.stopPropagation(),onMouseDown:z=>z.stopPropagation(),disabled:o,className:"w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:bg-gray-700 dark:border-gray-600"}),h.jsx(ae,{name:he.Folder,className:"w-4 h-4 text-gray-400 dark:text-gray-500"}),h.jsx(J,{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:E.name}),h.jsxs(J,{className:"inline-flex items-center px-1.5 py-0.5 rounded text-xs font-medium bg-gray-100 text-gray-600 dark:bg-gray-700 dark:text-gray-300 ml-1",children:[F,"/",E.leaf_count]}),h.jsx(ae,{name:he.ChevronDown,className:"w-4 h-4 text-gray-400 dark:text-gray-500 ml-auto"})]}),h.jsx(I,{slot:"content",className:`pl-8 grid ${O} gap-2 py-2`,children:D?E.children.map(z=>z.is_assignable?k(z):N(z)):A.map(z=>k(z))})]},E.id)},C=E=>{if(E.extension_type==="core")return"core";if(E.extension_type==="module")return"module";if(E.extension_type==="plugin")return"plugin";const T=E.extension_identifier??E.module??"";return T==="core"||!T?"core":l?.some(L=>L.identifier===T)?"plugin":"module"},w=E=>{const T=y(E),P=b(E),L=_(E),F=C(E);return h.jsxs(Nc,{defaultOpen:!1,className:"mb-2",children:[h.jsxs(I,{slot:"trigger",className:"flex items-center gap-3 w-full py-2",children:[h.jsx("input",{type:"checkbox",checked:T,ref:A=>{A&&(A.indeterminate=P)},onChange:A=>{A.stopPropagation(),M(E,A.target.checked)},onClick:A=>A.stopPropagation(),onMouseDown:A=>A.stopPropagation(),disabled:o,className:"w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:bg-gray-700 dark:border-gray-600"}),h.jsx(ae,{name:F==="core"?he.Cog:he.Cube,className:"w-5 h-5 text-gray-400 dark:text-gray-500"}),h.jsx(J,{className:"font-medium text-gray-900 dark:text-white",children:E.name}),F!=="core"&&h.jsx(Uh,{type:F,identifier:E.extension_identifier??E.module,installedModules:a,installedPlugins:l}),h.jsxs(J,{className:"inline-flex items-center px-1.5 py-0.5 rounded text-xs font-medium bg-gray-100 text-gray-600 dark:bg-gray-700 dark:text-gray-300 ml-2",children:[L,"/",E.leaf_count]}),h.jsx(ae,{name:he.ChevronDown,className:"w-4 h-4 text-gray-400 dark:text-gray-500 ml-auto"})]}),h.jsx(I,{slot:"content",className:"pl-8 space-y-2 pb-2",children:E.children.map(A=>A.is_assignable?k(A):N(A))})]},E.id)};return e.length===0?h.jsx(I,{className:`text-sm text-gray-400 dark:text-gray-500 py-4 text-center ${s}`,id:c,...d,children:zg("common.no_data")??"데이터가 없습니다."}):h.jsx(I,{className:`space-y-2 ${s}`,id:c,...d,children:e.map(E=>w(E))})};function Z_({text:e,keyword:t}){if(!t||!e)return h.jsx(h.Fragment,{children:e});const n=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),r=e.split(new RegExp(`(${n})`,"gi"));return h.jsx(h.Fragment,{children:r.map((s,o)=>s.toLowerCase()===t.toLowerCase()?h.jsx(J,{className:"bg-yellow-200 dark:bg-yellow-700 rounded px-0.5",children:s},o):s)})}const Q_=({data:e=[],expandedIds:t=[],selectedIds:n=[],searchKeyword:r="",showProductCount:s=!1,selectable:o=!1,className:i="",onToggle:a,onSelectionChange:l,id:c,editorAttrs:d})=>{const u=v.useCallback(y=>{if(!a)return;const b=t.includes(y)?t.filter(_=>_!==y):[...t,y];a(b)},[t,a]),f=v.useCallback((y,b)=>{if(!l)return;const _=b?[...n,y]:n.filter(x=>x!==y);l(_)},[n,l]),g=v.useMemo(()=>{if(!r)return null;const y=new Set,b=_=>{for(const x of _)(x.localized_name||x.name).toLowerCase().includes(r.toLowerCase())&&y.add(x.id),x.children&&b(x.children)};return b(e),y},[e,r]),m=v.useCallback(y=>!g||g.has(y.id)?!0:(y.children??[]).some(b=>m(b)),[g]),p=(y,b=0)=>{const _=(y.children??[]).length>0,x=t.includes(y.id),M=n.includes(y.id),S=y.localized_name||y.name;return r&&!m(y)?null:h.jsxs(I,{"data-testid":`category-node-${y.id}`,children:[h.jsxs(I,{className:`flex items-center gap-2 py-1.5 px-2 rounded cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-700/50 transition-colors ${b>0?"ml-"+Math.min(b*5,20):""}`,style:b>0?{marginLeft:`${b*20}px`}:void 0,children:[_?h.jsx(I,{className:"flex-shrink-0 w-5 h-5 flex items-center justify-center text-gray-400 dark:text-gray-500",onClick:()=>u(y.id),"data-testid":`toggle-${y.id}`,children:h.jsx(ae,{name:x?he.CaretDown:he.CaretRight,className:"text-xs"})}):h.jsx(I,{className:"flex-shrink-0 w-5 h-5"}),o&&h.jsx(On,{checked:M,onChange:k=>{k.stopPropagation(),f(y.id,k.target.checked)},className:"flex-shrink-0","data-testid":`checkbox-${y.id}`}),h.jsx(ae,{name:he.Folder,className:`flex-shrink-0 text-sm ${_?"text-yellow-500 dark:text-yellow-400":"text-gray-400 dark:text-gray-500"}`}),h.jsx(J,{className:"text-sm text-gray-700 dark:text-gray-300 select-none",onClick:()=>_&&u(y.id),children:h.jsx(Z_,{text:S,keyword:r})}),s&&y.products_count!==void 0&&h.jsx(J,{className:"inline-flex items-center px-1.5 py-0.5 rounded text-xs font-medium bg-gray-100 text-gray-500 dark:bg-gray-700 dark:text-gray-400 ml-1",children:y.products_count})]}),_&&x&&h.jsx(I,{"data-testid":`children-${y.id}`,children:(y.children??[]).map(k=>p(k,b+1))})]},y.id)};return e.length===0?h.jsx(I,{className:`text-sm text-gray-400 dark:text-gray-500 py-4 text-center ${i}`,id:c,...d,children:"데이터가 없습니다."}):h.jsx(I,{className:`border border-gray-200 dark:border-gray-700 rounded-lg p-2 max-h-80 overflow-y-auto ${i}`,id:c,...d,children:e.map(y=>p(y,0))})},Vg="carousel",vo="controller",J_="navigation",R_="no-scroll",Oc="portal",e2="root",Hg="toolbar",t2="counter",xo="fullscreen",Ug="slideshow",wo="thumbnails",Bg="zoom",bs="loading",Tc="playing",ko="error",Co="complete",n2="placeholder",So=e=>`active-slide-${e}`,r2=So(bs),s2=So(Tc),o2=So(ko),i2=So(Co),jg="fullsize",ys="flex_center",a2="no_scroll",Wg="no_scroll_padding",Ac="slide",Gg="slide_wrapper",l2="slide_wrapper_interactive",pr="prev",mr="next",Dc="swipe",vs="close",Yg="onPointerDown",Kg="onPointerMove",Xg="onPointerUp",qg="onPointerLeave",Zg="onPointerCancel",Ic="onKeyDown",c2="onKeyUp",Lc="onWheel",d2="Escape",u2="ArrowLeft",f2="ArrowRight",h2="button",Ji="icon",Qg="contain",Jg="cover",Rg="Unknown action type",ep="yarl__";function qt(...e){return[...e].filter(Boolean).join(" ")}function Ae(e){return`${ep}${e}`}function gt(e){return`--${ep}${e}`}function Nr(e,t){return`${e}${t?`_${t}`:""}`}function Or(e){return t=>Nr(e,t)}function Tr(e,t){var n;return(n=e?.[t])!==null&&n!==void 0?n:t}function tp(e,t,n){return Tr(e,"{index} of {total}").replace(/\{index}/g,`${zc(n,t.length)+1}`).replace(/\{total}/g,`${t.length}`)}function xs(...e){return()=>{e.forEach(t=>{t()})}}function xn(e,t,n){return()=>{const r=$.useContext(n);if(!r)throw new Error(`${e} must be used within a ${t}.Provider`);return r}}function Pc(){return typeof window<"u"}function $c(e,t=0){const n=10**t;return Math.round((e+Number.EPSILON)*n)/n}function Ar(e){return e.type===void 0||e.type==="image"}function Fc(e,t){return e.imageFit===Jg||e.imageFit!==Qg&&t===Jg}function Ri(e){return typeof e=="string"?Number.parseInt(e,10):e}function ea(e){if(typeof e=="number")return{pixel:e};if(typeof e=="string"){const t=Ri(e);return e.endsWith("%")?{percent:t}:{pixel:t}}return{pixel:0}}function g2(e,t){const n=ea(t),r=n.percent!==void 0?e.width/100*n.percent:n.pixel;return{width:Math.max(e.width-2*r,0),height:Math.max(e.height-2*r,0)}}function p2(){return(Pc()?window?.devicePixelRatio:void 0)||1}function zc(e,t){return t>0?(e%t+t)%t:0}function Vc(e){return e.length>0}function Hc(e,t){return e[zc(t,e.length)]}function Uc(e,t){return Vc(e)?Hc(e,t):void 0}function np(e){return Ar(e)?e.src:void 0}function ta(e,t,n){if(!n)return e;const{buttons:r,...s}=e,o=r.findIndex(a=>a===t),i=$.isValidElement(n)?$.cloneElement(n,{key:t},null):n;if(o>=0){const a=[...r];return a.splice(o,1,i),{buttons:a,...s}}return{buttons:[i,...r],...s}}function rp(e,t,n=0){return Math.min(e.preload,Math.max(e.finite?t.length-1:Math.floor(t.length/2),n))}const m2=Number($.version.split(".")[0])>=19;function b2(e){return{inert:m2?e:e?"":void 0}}function y2(e){e.scrollTop}const Bc={open:!1,close:()=>{},index:0,slides:[],render:{},plugins:[],toolbar:{buttons:[vs]},labels:{},animation:{fade:250,swipe:500,easing:{fade:"ease",swipe:"ease-out",navigation:"ease-in-out"}},carousel:{finite:!1,preload:2,padding:"16px",spacing:"30%",imageFit:Qg,imageProps:{}},controller:{ref:null,focus:!0,aria:!1,touchAction:"none",closeOnPullUp:!1,closeOnPullDown:!1,closeOnBackdropClick:!1,preventDefaultWheelX:!0,preventDefaultWheelY:!1,disableSwipeNavigation:!1},portal:{},noScroll:{disabled:!1},on:{},styles:{},className:""};function wn(e,t){return{name:e,component:t}}function Ft(e,t){return{module:e,children:t}}function sp(e,t,n){return e.module.name===t?n(e):e.children?[Ft(e.module,e.children.flatMap(r=>{var s;return(s=sp(r,t,n))!==null&&s!==void 0?s:[]}))]:[e]}function ws(e,t,n){return e.flatMap(r=>{var s;return(s=sp(r,t,n))!==null&&s!==void 0?s:[]})}function v2(e,t=[],n=[]){let r=e;const s=g=>{const m=[...r];for(;m.length>0;){const p=m.pop();if(p?.module.name===g)return!0;p?.children&&m.push(...p.children)}return!1},o=(g,m)=>{if(g===""){r=[Ft(m,r)];return}r=ws(r,g,p=>[Ft(m,[p])])},i=(g,m)=>{r=ws(r,g,p=>[Ft(p.module,[Ft(m,p.children)])])},a=(g,m,p)=>{r=ws(r,g,y=>{var b;return[Ft(y.module,[...p?[Ft(m)]:[],...(b=y.children)!==null&&b!==void 0?b:[],...p?[]:[Ft(m)]])]})},l=(g,m,p)=>{r=ws(r,g,y=>[...p?[Ft(m)]:[],y,...p?[]:[Ft(m)]])},c=g=>{i(vo,g)},d=(g,m)=>{r=ws(r,g,p=>[Ft(m,p.children)])},u=g=>{r=ws(r,g,m=>m.children)},f=g=>{n.push(g)};return t.forEach(g=>{g({contains:s,addParent:o,append:i,addChild:a,addSibling:l,addModule:c,replace:d,remove:u,augment:f})}),{config:r,augmentation:g=>n.reduce((m,p)=>p(m),g)}}const op=$.createContext(null),jc=xn("useA11yContext","A11yContext",op);function x2({children:e}){const[t,n]=$.useState(!1),[r,s]=$.useState(!1),o=$.useMemo(()=>({focusWithin:t,trackFocusWithin:(a,l)=>{const c=d=>u=>{var f;u.currentTarget.contains(u.relatedTarget)||n(d),(f=d?a:l)===null||f===void 0||f(u)};return{onFocus:c(!0),onBlur:c(!1)}},autoPlaying:r,setAutoPlaying:s}),[t,r]);return $.createElement(op.Provider,{value:o},e)}const ip=$.createContext(null),ks=xn("useDocument","DocumentContext",ip);function w2({nodeRef:e,children:t}){const n=$.useMemo(()=>{const r=o=>{var i;return((i=o||e.current)===null||i===void 0?void 0:i.ownerDocument)||document};return{getOwnerDocument:r,getOwnerWindow:o=>{var i;return((i=r(o))===null||i===void 0?void 0:i.defaultView)||window}}},[e]);return $.createElement(ip.Provider,{value:n},t)}const ap=$.createContext(null),Cs=xn("useEvents","EventsContext",ap);function k2({children:e}){const[t]=$.useState({});$.useEffect(()=>()=>{Object.keys(t).forEach(r=>delete t[r])},[t]);const n=$.useMemo(()=>{const r=(i,a)=>{var l;(l=t[i])===null||l===void 0||l.splice(0,t[i].length,...t[i].filter(c=>c!==a))};return{publish:(...[i,a])=>{var l;(l=t[i])===null||l===void 0||l.forEach(c=>c(a))},subscribe:(i,a)=>(t[i]||(t[i]=[]),t[i].push(a),()=>r(i,a)),unsubscribe:r}},[t]);return $.createElement(ap.Provider,{value:n},e)}const lp=$.createContext(null),zt=xn("useLightboxProps","LightboxPropsContext",lp);function cp({children:e,...t}){return $.createElement(lp.Provider,{value:t},e)}const dp=$.createContext(null),kn=xn("useLightboxState","LightboxStateContext",dp),up=$.createContext(null),C2=xn("useLightboxDispatch","LightboxDispatchContext",up);function S2(e,t){switch(t.type){case"swipe":{const{slides:n}=e,r=t?.increment||0,s=e.globalIndex+r,o=zc(s,n.length),i=Uc(n,o),a=r||t.duration!==void 0?{increment:r,duration:t.duration,easing:t.easing}:void 0;return{slides:n,currentIndex:o,globalIndex:s,currentSlide:i,animation:a}}case"update":return t.slides!==e.slides||t.index!==e.currentIndex?{slides:t.slides,currentIndex:t.index,globalIndex:t.index,currentSlide:Uc(t.slides,t.index)}:e;default:throw new Error(Rg)}}function _2({slides:e,index:t,children:n}){const[r,s]=$.useReducer(S2,{slides:e,currentIndex:t,globalIndex:t,currentSlide:Uc(e,t)});$.useEffect(()=>{s({type:"update",slides:e,index:t})},[e,t]);const o=$.useMemo(()=>({...r,state:r,dispatch:s}),[r,s]);return $.createElement(up.Provider,{value:s},$.createElement(dp.Provider,{value:o},n))}const fp=$.createContext(null),_o=xn("useTimeouts","TimeoutsContext",fp);function E2({children:e}){const[t]=$.useState([]);$.useEffect(()=>()=>{t.forEach(r=>window.clearTimeout(r)),t.splice(0,t.length)},[t]);const n=$.useMemo(()=>{const r=i=>{t.splice(0,t.length,...t.filter(a=>a!==i))};return{setTimeout:(i,a)=>{const l=window.setTimeout(()=>{r(l),i()},a);return t.push(l),l},clearTimeout:i=>{i!==void 0&&(r(i),window.clearTimeout(i))}}},[t]);return $.createElement(fp.Provider,{value:n},e)}const Ss=$.forwardRef(function({label:t,className:n,icon:r,renderIcon:s,onClick:o,style:i,...a},l){const{styles:c,labels:d}=zt(),u=Tr(d,t);return $.createElement("button",{ref:l,type:"button",title:u,"aria-label":u,className:qt(Ae(h2),n),onClick:o,style:{...i,...c.button},...a},s?s():$.createElement(r,{className:Ae(Ji),style:c.icon}))});function hp(e,t){const n=r=>$.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"24",height:"24","aria-hidden":"true",focusable:"false",...r},t);return n.displayName=e,n}function an(e,t){return hp(e,$.createElement("g",{fill:"currentColor"},$.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),t))}function M2(e,t){return hp(e,$.createElement($.Fragment,null,$.createElement("defs",null,$.createElement("mask",{id:"strike"},$.createElement("path",{d:"M0 0h24v24H0z",fill:"white"}),$.createElement("path",{d:"M0 0L24 24",stroke:"black",strokeWidth:4}))),$.createElement("path",{d:"M0.70707 2.121320L21.878680 23.292883",stroke:"currentColor",strokeWidth:2}),$.createElement("g",{fill:"currentColor",mask:"url(#strike)"},$.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),t)))}const N2=an("Close",$.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"})),O2=an("Previous",$.createElement("path",{d:"M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"})),T2=an("Next",$.createElement("path",{d:"M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"})),A2=an("Loading",$.createElement($.Fragment,null,Array.from({length:8}).map((e,t,n)=>$.createElement("line",{key:t,x1:"12",y1:"6.5",x2:"12",y2:"1.8",strokeLinecap:"round",strokeWidth:"2.6",stroke:"currentColor",strokeOpacity:1/n.length*(t+1),transform:`rotate(${360/n.length*t}, 12, 12)`})))),D2=an("Error",$.createElement("path",{d:"M21.9,21.9l-8.49-8.49l0,0L3.59,3.59l0,0L2.1,2.1L0.69,3.51L3,5.83V19c0,1.1,0.9,2,2,2h13.17l2.31,2.31L21.9,21.9z M5,18 l3.5-4.5l2.5,3.01L12.17,15l3,3H5z M21,18.17L5.83,3H19c1.1,0,2,0.9,2,2V18.17z"})),In=Pc()?$.useLayoutEffect:$.useEffect;function Wc(){const[e,t]=$.useState(!1);return $.useEffect(()=>{var n,r;const s=(n=window.matchMedia)===null||n===void 0?void 0:n.call(window,"(prefers-reduced-motion: reduce)");t(s?.matches);const o=i=>t(i.matches);return(r=s?.addEventListener)===null||r===void 0||r.call(s,"change",o),()=>{var i;return(i=s?.removeEventListener)===null||i===void 0?void 0:i.call(s,"change",o)}},[]),e}function I2(e){let t=0,n=0,r=0;const o=window.getComputedStyle(e).transform.match(/matrix.*\((.+)\)/);if(o){const i=o[1].split(",").map(Ri);i.length===6?(t=i[4],n=i[5]):i.length===16&&(t=i[12],n=i[13],r=i[14])}return{x:t,y:n,z:r}}function Gc(e,t){const n=$.useRef(void 0),r=$.useRef(void 0),s=Wc();return In(()=>{var o,i,a;if(e.current&&n.current!==void 0&&!s){const{keyframes:l,duration:c,easing:d,onfinish:u}=t(n.current,e.current.getBoundingClientRect(),I2(e.current))||{};if(l&&c){(o=r.current)===null||o===void 0||o.cancel(),r.current=void 0;try{r.current=(a=(i=e.current).animate)===null||a===void 0?void 0:a.call(i,l,{duration:c,easing:d})}catch(f){console.error(f)}r.current&&(r.current.onfinish=()=>{r.current=void 0,u?.()})}}n.current=void 0}),{prepareAnimation:o=>{n.current=o},isAnimationPlaying:()=>{var o;return((o=r.current)===null||o===void 0?void 0:o.playState)==="running"}}}function gp(){const e=$.useRef(null),t=$.useRef(void 0),[n,r]=$.useState();return{setContainerRef:$.useCallback(o=>{e.current=o,t.current&&(t.current.disconnect(),t.current=void 0);const i=()=>{if(o){const a=window.getComputedStyle(o),l=c=>parseFloat(c)||0;r({width:Math.round(o.clientWidth-l(a.paddingLeft)-l(a.paddingRight)),height:Math.round(o.clientHeight-l(a.paddingTop)-l(a.paddingBottom))})}else r(void 0)};i(),o&&typeof ResizeObserver<"u"&&(t.current=new ResizeObserver(i),t.current.observe(o))},[]),containerRef:e,containerRect:n}}function na(){const e=$.useRef(void 0),{setTimeout:t,clearTimeout:n}=_o();return $.useCallback((r,s)=>{n(e.current),e.current=t(r,s>0?s:0)},[t,n])}function Ye(e){const t=$.useRef(e);return In(()=>{t.current=e}),$.useCallback((...n)=>{var r;return(r=t.current)===null||r===void 0?void 0:r.call(t,...n)},[])}function pp(e,t){typeof e=="function"?e(t):e&&(e.current=t)}function Yc(e,t){return $.useMemo(()=>e==null&&t==null?null:n=>{pp(e,n),pp(t,n)},[e,t])}function mp(e,t=!1){const n=$.useRef(!1);In(()=>{t&&n.current&&(n.current=!1,e())},[t,e]);const r=$.useCallback(()=>{n.current=!0},[]),s=$.useCallback(()=>{n.current=!1},[]);return{onFocus:r,onBlur:s}}function ra(){const[e,t]=$.useState(!1);return In(()=>{t(window.getComputedStyle(window.document.documentElement).direction==="rtl")},[]),e}function bp(){const[e]=$.useState({}),t=$.useCallback((s,o)=>{var i;(i=e[s])===null||i===void 0||i.forEach(a=>{o.isPropagationStopped()||a(o)})},[e]),n=$.useMemo(()=>({onPointerDown:s=>t(Yg,s),onPointerMove:s=>t(Kg,s),onPointerUp:s=>t(Xg,s),onPointerLeave:s=>t(qg,s),onPointerCancel:s=>t(Zg,s),onKeyDown:s=>t(Ic,s),onKeyUp:s=>t(c2,s),onWheel:s=>t(Lc,s)}),[t]),r=$.useCallback((s,o)=>(e[s]||(e[s]=[]),e[s].unshift(o),()=>{const i=e[s];i&&i.splice(0,i.length,...i.filter(a=>a!==o))}),[e]);return{registerSensors:n,subscribeSensors:r}}function yp(e,t){const n=$.useRef(0),r=na(),s=Ye((...o)=>{n.current=Date.now(),e(o)});return $.useCallback((...o)=>{r(()=>{s(o)},t-(Date.now()-n.current))},[t,s,r])}const Kc=Or("slide"),Xc=Or("slide_image");function Dr({slide:e,offset:t,render:n,rect:r,imageFit:s,imageProps:o,onClick:i,onLoad:a,onError:l,style:c}){var d,u,f,g,m,p,y,b;const[_,x]=$.useState(bs),{publish:M}=Cs(),{setTimeout:S}=_o(),k=$.useRef(null);$.useEffect(()=>{t===0&&M(So(_))},[t,_,M]);const N=Ye(B=>{("decode"in B?B.decode():Promise.resolve()).catch(()=>{}).then(()=>{B.parentNode&&(x(Co),S(()=>{a?.(B)},0))})}),C=$.useCallback(B=>{k.current=B,B?.complete&&N(B)},[N]),w=$.useCallback(B=>{N(B.currentTarget)},[N]),E=Ye(()=>{x(ko),l?.()}),T=Fc(e,s),P=(B,W)=>Number.isFinite(B)?B:W,L=P(Math.max(...((u=(d=e.srcSet)===null||d===void 0?void 0:d.map(B=>B.width))!==null&&u!==void 0?u:[]).concat(e.width?[e.width]:[]).filter(Boolean)),((f=k.current)===null||f===void 0?void 0:f.naturalWidth)||0),F=P(Math.max(...((m=(g=e.srcSet)===null||g===void 0?void 0:g.map(B=>B.height))!==null&&m!==void 0?m:[]).concat(e.height?[e.height]:[]).filter(Boolean)),((p=k.current)===null||p===void 0?void 0:p.naturalHeight)||0),A=L&&F?{maxWidth:`min(${L}px, 100%)`,maxHeight:`min(${F}px, 100%)`}:{maxWidth:"100%",maxHeight:"100%"},D=(y=e.srcSet)===null||y===void 0?void 0:y.sort((B,W)=>B.width-W.width).map(B=>`${B.src} ${B.width}w`).join(", "),O=()=>r&&!T&&e.width&&e.height?r.height/e.height*e.width:Number.MAX_VALUE,z=D&&r&&Pc()?`${Math.round(Math.min(O(),r.width))}px`:void 0,{style:U,className:j,...Y}=o||{};return $.createElement($.Fragment,null,$.createElement("img",{ref:C,onLoad:w,onError:E,onClick:i,draggable:!1,className:qt(Ae(Xc()),T&&Ae(Xc("cover")),_!==Co&&Ae(Xc("loading")),j),style:{...A,...c,...U},...Y,alt:(b=e.alt)!==null&&b!==void 0?b:"",sizes:z,srcSet:D,src:e.src}),_!==Co&&$.createElement("div",{className:Ae(Kc(n2))},_===bs&&(n?.iconLoading?n.iconLoading():$.createElement(A2,{className:qt(Ae(Ji),Ae(Kc(bs)))})),_===ko&&(n?.iconError?n.iconError():$.createElement(D2,{className:qt(Ae(Ji),Ae(Kc(ko)))}))))}const L2=$.forwardRef(function({className:t,children:n,onFocus:r,onBlur:s,...o},i){const a=$.useRef(null),{trackFocusWithin:l}=jc();return $.createElement(w2,{nodeRef:a},$.createElement("div",{ref:Yc(i,a),className:qt(Ae("root"),t),...l(r,s),...o},n))});var Zt;(function(e){e[e.NONE=0]="NONE",e[e.SWIPE=1]="SWIPE",e[e.PULL=2]="PULL",e[e.ANIMATION=3]="ANIMATION"})(Zt||(Zt={}));function vp(e,t,n,r,s){$.useEffect(()=>s?()=>{}:xs(e(Yg,t),e(Kg,n),e(Xg,r),e(qg,r),e(Zg,r)),[e,t,n,r,s])}var Ln;(function(e){e[e.NONE=0]="NONE",e[e.SWIPE=1]="SWIPE",e[e.PULL=2]="PULL"})(Ln||(Ln={}));const qc=30;function P2({disableSwipeNavigation:e,closeOnBackdropClick:t},n,r,s,o,i,a,l,c,d,u,f,g,m,p,y){const b=$.useRef(0),_=$.useRef([]),x=$.useRef(void 0),M=$.useRef(0),S=$.useRef(Ln.NONE),k=$.useCallback(L=>{x.current===L.pointerId&&(x.current=void 0,S.current=Ln.NONE);const F=_.current;F.splice(0,F.length,...F.filter(A=>A.pointerId!==L.pointerId))},[]),N=$.useCallback(L=>{k(L),L.persist(),_.current.push(L)},[k]),C=$.useCallback(L=>_.current.find(({pointerId:F})=>L.pointerId===F),[]),w=Ye(L=>{N(L)}),E=(L,F)=>u&&L>F||d&&L<-F,T=Ye(L=>{const F=C(L);if(F)if(x.current===L.pointerId){const A=Date.now()-M.current,D=b.current;S.current===Ln.SWIPE?Math.abs(D)>.3*s||Math.abs(D)>5&&A{const F=C(L);if(F){const A=x.current===L.pointerId;if(L.buttons===0){A&&b.current!==0?T(L):k(F);return}const D=L.clientX-F.clientX,O=L.clientY-F.clientY;if(x.current===void 0){const z=U=>{N(L),x.current=L.pointerId,M.current=Date.now(),S.current=U};Math.abs(D)>Math.abs(O)&&Math.abs(D)>qc&&r(D)?e||(z(Ln.SWIPE),i()):Math.abs(O)>Math.abs(D)&&E(O,qc)&&(z(Ln.PULL),f())}else A&&(S.current===Ln.SWIPE?(b.current=D,a(D)):S.current===Ln.PULL&&(b.current=O,g(O)))}});vp(n,w,P,T)}function $2({preventDefaultWheelX:e,preventDefaultWheelY:t}){const n=$.useRef(null),r=Ye(s=>{const o=Math.abs(s.deltaX)>Math.abs(s.deltaY);(o&&e||!o&&t||s.ctrlKey)&&s.preventDefault()});return $.useCallback(s=>{var o;s?s.addEventListener("wheel",r,{passive:!1}):(o=n.current)===null||o===void 0||o.removeEventListener("wheel",r),n.current=s},[r])}function F2(e,t,n,r,s,o,i,a,l){const c=$.useRef(0),d=$.useRef(0),u=$.useRef(void 0),f=$.useRef(void 0),g=$.useRef(0),m=$.useRef(void 0),p=$.useRef(0),{setTimeout:y,clearTimeout:b}=_o(),_=$.useCallback(()=>{u.current&&(b(u.current),u.current=void 0)},[b]),x=$.useCallback(()=>{f.current&&(b(f.current),f.current=void 0)},[b]),M=Ye(()=>{e!==Zt.SWIPE&&(c.current=0,p.current=0,_(),x())});$.useEffect(M,[e,M]);const S=Ye(N=>{f.current=void 0,c.current===N&&l(c.current)}),k=Ye(N=>{if(N.ctrlKey||Math.abs(N.deltaY)>Math.abs(N.deltaX))return;const C=w=>{g.current=w,b(m.current),m.current=w>0?y(()=>{g.current=0,m.current=void 0},300):void 0};if(e===Zt.NONE){if(Math.abs(N.deltaX)<=1.2*Math.abs(g.current)){C(N.deltaX);return}if(!n(-N.deltaX))return;if(d.current+=N.deltaX,_(),Math.abs(d.current)>30)d.current=0,C(0),p.current=Date.now(),o();else{const w=d.current;u.current=y(()=>{u.current=void 0,w===d.current&&(d.current=0)},s)}}else if(e===Zt.SWIPE){let w=c.current-N.deltaX;if(w=Math.min(Math.abs(w),r)*Math.sign(w),c.current=w,i(w),x(),Math.abs(w)>.2*r){C(N.deltaX),a(w,Date.now()-p.current);return}f.current=y(()=>S(w),2*s)}else C(N.deltaX)});$.useEffect(()=>t(Lc,k),[t,k])}const xp=Or("container"),wp=$.createContext(null),Pn=xn("useController","ControllerContext",wp);function z2({children:e,...t}){var n;const{carousel:r,animation:s,controller:o,on:i,styles:a,render:l}=t,{closeOnPullUp:c,closeOnPullDown:d,preventDefaultWheelX:u,preventDefaultWheelY:f}=o,[g,m]=$.useState(),p=kn(),y=C2(),[b,_]=$.useState(Zt.NONE),x=$.useRef(0),M=$.useRef(0),S=$.useRef(1),{registerSensors:k,subscribeSensors:N}=bp(),{subscribe:C,publish:w}=Cs(),E=na(),T=na(),P=na(),{containerRef:L,setContainerRef:F,containerRect:A}=gp(),D=Yc($2({preventDefaultWheelX:u,preventDefaultWheelY:f}),F),O=$.useRef(null),z=Yc(O,void 0),{getOwnerDocument:U}=ks(),j=ra(),Y=oe=>(j?-1:1)*(typeof oe=="number"?oe:1),B=Ye(()=>{var oe;return(oe=L.current)===null||oe===void 0?void 0:oe.focus()}),W=Ye(()=>t),G=Ye(()=>p),V=$.useCallback(oe=>w(pr,oe),[w]),X=$.useCallback(oe=>w(mr,oe),[w]),K=$.useCallback(()=>w(vs),[w]),Q=oe=>!(r.finite&&(Y(oe)>0&&p.currentIndex===0||Y(oe)<0&&p.currentIndex===p.slides.length-1)),ne=oe=>{var Te;x.current=oe,(Te=L.current)===null||Te===void 0||Te.style.setProperty(gt("swipe_offset"),`${Math.round(oe)}px`)},se=oe=>{var Te,Pe;M.current=oe,S.current=(()=>{const nt=d&&oe>0?oe:c&&oe<0?-oe:0;return Math.min(Math.max($c(1-nt/60*(1-.5),2),.5),1)})(),(Te=L.current)===null||Te===void 0||Te.style.setProperty(gt("pull_offset"),`${Math.round(oe)}px`),(Pe=L.current)===null||Pe===void 0||Pe.style.setProperty(gt("pull_opacity"),`${S.current}`)},{prepareAnimation:ue}=Gc(O,(oe,Te,Pe)=>{if(O.current&&A)return{keyframes:[{transform:`translate(0, ${oe.rect.y-Te.y+Pe.y}px)`,opacity:oe.opacity},{transform:"translate(0, 0)",opacity:1}],duration:oe.duration,easing:s.easing.fade}}),ee=(oe,Te)=>{if(c||d){se(oe);let Pe=0;O.current&&(Pe=s.fade*(Te?2:1),ue({rect:O.current.getBoundingClientRect(),opacity:S.current,duration:Pe})),P(()=>{se(0),_(Zt.NONE)},Pe),_(Zt.ANIMATION),Te||K()}},{prepareAnimation:me,isAnimationPlaying:ie}=Gc(O,(oe,Te,Pe)=>{var Fe;if(O.current&&A&&(!((Fe=p.animation)===null||Fe===void 0)&&Fe.duration)){const Ke=ea(r.spacing),nt=(Ke.percent?Ke.percent*A.width/100:Ke.pixel)||0;return{keyframes:[{transform:`translate(${Y(p.globalIndex-oe.index)*(A.width+nt)+oe.rect.x-Te.x+Pe.x}px, 0)`},{transform:"translate(0, 0)"}],duration:p.animation.duration,easing:p.animation.easing}}}),de=Ye(oe=>{var Te,Pe;const Fe=oe.offset||0,Ke=Fe?s.swipe:(Te=s.navigation)!==null&&Te!==void 0?Te:s.swipe,nt=!Fe&&!ie()?s.easing.navigation:s.easing.swipe;let{direction:dt}=oe;const We=(Pe=oe.count)!==null&&Pe!==void 0?Pe:1;let pt=Zt.ANIMATION,Ge=Ke*We;if(!dt){const pe=A?.width,we=oe.duration||0,xe=pe?Ke/pe*Math.abs(Fe):Ke;We!==0?(we0?pr:mr):Ge=Ke/2}let te=0;dt===pr?Q(Y(1))?te=-We:(pt=Zt.NONE,Ge=Ke):dt===mr&&(Q(Y(-1))?te=We:(pt=Zt.NONE,Ge=Ke)),Ge=Math.round(Ge),T(()=>{ne(0),_(Zt.NONE)},Ge),O.current&&me({rect:O.current.getBoundingClientRect(),index:p.globalIndex}),_(pt),w(Dc,{type:"swipe",increment:te,duration:Ge,easing:nt})});$.useEffect(()=>{var oe,Te;!((oe=p.animation)===null||oe===void 0)&&oe.increment&&(!((Te=p.animation)===null||Te===void 0)&&Te.duration)&&E(()=>y({type:"swipe",increment:0}),p.animation.duration)},[p.animation,y,E]);const fe=[N,Q,A?.width||0,s.swipe,()=>_(Zt.SWIPE),oe=>ne(oe),(oe,Te)=>de({offset:oe,duration:Te,count:1}),oe=>de({offset:oe,count:0})],be=[()=>{d&&_(Zt.PULL)},oe=>se(oe),oe=>ee(oe),oe=>ee(oe,!0)];P2(o,...fe,c,d,...be,K),F2(b,...fe);const ge=Ye(()=>{o.focus&&U().querySelector(`.${Ae(Oc)} .${Ae(xp())}`)&&B()});$.useEffect(ge,[ge]);const Ce=Ye(()=>{var oe;(oe=i.view)===null||oe===void 0||oe.call(i,{index:p.currentIndex})});$.useEffect(Ce,[p.globalIndex,Ce]),$.useEffect(()=>xs(C(pr,oe=>de({direction:pr,...oe})),C(mr,oe=>de({direction:mr,...oe})),C(Dc,oe=>y(oe))),[C,de,y]);const je=$.useMemo(()=>({prev:V,next:X,close:K,focus:B,slideRect:A?g2(A,r.padding):{width:0,height:0},containerRect:A||{width:0,height:0},subscribeSensors:N,containerRef:L,setCarouselRef:z,toolbarWidth:g,setToolbarWidth:m}),[V,X,K,B,N,A,L,z,g,m,r.padding]);return $.useImperativeHandle(o.ref,()=>({prev:V,next:X,close:K,focus:B,getLightboxProps:W,getLightboxState:G}),[V,X,K,B,W,G]),$.createElement("div",{ref:D,className:qt(Ae(xp()),Ae(ys)),style:{...b===Zt.SWIPE?{[gt("swipe_offset")]:`${Math.round(x.current)}px`}:null,...b===Zt.PULL?{[gt("pull_offset")]:`${Math.round(M.current)}px`,[gt("pull_opacity")]:`${S.current}`}:null,...o.touchAction!=="none"?{[gt("controller_touch_action")]:o.touchAction}:null,...a.container},tabIndex:-1,...k},A&&$.createElement(wp.Provider,{value:je},e,(n=l.controls)===null||n===void 0?void 0:n.call(l)))}const V2=wn(vo,z2);function Ir(e){return Nr(Vg,e)}function kp(e){return Nr(Ac,e)}function H2({slide:e,offset:t}){const n=$.useRef(null),{currentIndex:r,slides:s}=kn(),{slideRect:o,focus:i}=Pn(),{render:a,carousel:{imageFit:l,imageProps:c},on:{click:d},styles:{slide:u},labels:f}=zt(),{getOwnerDocument:g}=ks(),m=t!==0;$.useEffect(()=>{var y;m&&(!((y=n.current)===null||y===void 0)&&y.contains(g().activeElement))&&i()},[m,i,g]);const p=()=>{var y,b,_,x;let M=(y=a.slide)===null||y===void 0?void 0:y.call(a,{slide:e,offset:t,rect:o});return!M&&Ar(e)&&(M=$.createElement(Dr,{slide:e,offset:t,render:a,rect:o,imageFit:l,imageProps:c,onClick:m?void 0:()=>d?.({index:r})})),M?$.createElement($.Fragment,null,(b=a.slideHeader)===null||b===void 0?void 0:b.call(a,{slide:e}),((_=a.slideContainer)!==null&&_!==void 0?_:(({children:S})=>S))({slide:e,children:M}),(x=a.slideFooter)===null||x===void 0?void 0:x.call(a,{slide:e})):null};return $.createElement("div",{ref:n,className:qt(Ae(kp()),!m&&Ae(kp("current")),Ae(ys)),...b2(m),style:u,role:"group","aria-roledescription":Tr(f,"Slide"),"aria-label":tp(f,s,r+t)},p())}function U2(){const e=zt().styles.slide;return $.createElement("div",{className:Ae(Ac),style:e})}function B2({carousel:e,labels:t}){const{slides:n,currentIndex:r,globalIndex:s}=kn(),{setCarouselRef:o}=Pn(),{autoPlaying:i,focusWithin:a}=jc(),l=ea(e.spacing),c=ea(e.padding),d=rp(e,n,1),u=[];if(Vc(n))for(let f=r-d;f<=r+d;f+=1){const g=Hc(n,f),m=s-r+f,p=e.finite&&(f<0||f>n.length-1);u.push(p?{key:m}:{key:[`${m}`,np(g)].filter(Boolean).join("|"),offset:f-r,slide:g})}return $.createElement("div",{ref:o,className:qt(Ae(Ir()),u.length>0&&Ae(Ir("with_slides"))),style:{[`${gt(Ir("slides_count"))}`]:u.length,[`${gt(Ir("spacing_px"))}`]:l.pixel||0,[`${gt(Ir("spacing_percent"))}`]:l.percent||0,[`${gt(Ir("padding_px"))}`]:c.pixel||0,[`${gt(Ir("padding_percent"))}`]:c.percent||0},role:"region","aria-live":i&&!a?"off":"polite","aria-roledescription":Tr(t,"Carousel"),"aria-label":Tr(t,"Photo gallery")},u.map(({key:f,slide:g,offset:m})=>g?$.createElement(H2,{key:f,slide:g,offset:m}):$.createElement(U2,{key:f})))}const j2=wn(Vg,B2);function Cp(){const{carousel:e}=zt(),{slides:t,currentIndex:n}=kn(),r=t.length===0||e.finite&&n===0,s=t.length===0||e.finite&&n===t.length-1;return{prevDisabled:r,nextDisabled:s}}function Sp(e){var t;const n=ra(),{publish:r}=Cs(),{animation:s}=zt(),{prevDisabled:o,nextDisabled:i}=Cp(),a=((t=s.navigation)!==null&&t!==void 0?t:s.swipe)/2,l=yp(()=>r(pr),a),c=yp(()=>r(mr),a),d=Ye(u=>{switch(u.key){case d2:r(vs);break;case u2:(n?i:o)||(n?c:l)();break;case f2:(n?o:i)||(n?l:c)();break}});$.useEffect(()=>e(Ic,d),[e,d])}function _p({label:e,icon:t,renderIcon:n,action:r,onClick:s,disabled:o,style:i}){return $.createElement(Ss,{label:e,icon:t,renderIcon:n,className:Ae(`navigation_${r}`),disabled:o,onClick:s,style:i,...mp(Pn().focus,o)})}function W2({render:{buttonPrev:e,buttonNext:t,iconPrev:n,iconNext:r},styles:s}){const{prev:o,next:i,subscribeSensors:a}=Pn(),{prevDisabled:l,nextDisabled:c}=Cp();return Sp(a),$.createElement($.Fragment,null,e?e():$.createElement(_p,{label:"Previous",action:pr,icon:O2,renderIcon:n,style:s.navigationPrev,disabled:l,onClick:o}),t?t():$.createElement(_p,{label:"Next",action:mr,icon:T2,renderIcon:r,style:s.navigationNext,disabled:c,onClick:i}))}const G2=wn(J_,W2),Ep=Ae(a2),Y2=Ae(Wg);function K2(e){return"style"in e}function Mp(e,t,n){const r=window.getComputedStyle(e),s=n?"padding-left":"padding-right",o=n?r.paddingLeft:r.paddingRight,i=e.style.getPropertyValue(s);return e.style.setProperty(s,`${(Ri(o)||0)+t}px`),()=>{i?e.style.setProperty(s,i):e.style.removeProperty(s)}}function X2({noScroll:{disabled:e},children:t}){const n=ra(),{getOwnerDocument:r,getOwnerWindow:s}=ks();return $.useEffect(()=>{if(e)return()=>{};const o=[],i=s(),{body:a,documentElement:l}=r(),c=Math.round(i.innerWidth-l.clientWidth);if(c>0){o.push(Mp(a,c,n));const d=a.getElementsByTagName("*");for(let u=0;u{a.classList.remove(Ep),o.forEach(d=>d())}},[n,e,r,s]),$.createElement($.Fragment,null,t)}const q2=wn(R_,X2);function Np(e){return Nr(Oc,e)}function Op(e,t,n){const r=e.getAttribute(t);return e.setAttribute(t,n),()=>{r?e.setAttribute(t,r):e.removeAttribute(t)}}function Z2({children:e,animation:t,styles:n,className:r,on:s,portal:o,close:i,labels:a}){const[l,c]=$.useState(!1),[d,u]=$.useState(!1),f=$.useRef([]),g=$.useRef(null),{setTimeout:m}=_o(),{subscribe:p}=Cs(),b=Wc()?0:t.fade;$.useEffect(()=>(c(!0),()=>{c(!1),u(!1)}),[]);const _=Ye(()=>{f.current.forEach(k=>k()),f.current=[]}),x=Ye(()=>{var k;u(!1),_(),(k=s.exiting)===null||k===void 0||k.call(s),m(()=>{var N;(N=s.exited)===null||N===void 0||N.call(s),i()},b)});$.useEffect(()=>p(vs,x),[p,x]);const M=Ye(k=>{var N,C,w;y2(k),u(!0),(N=s.entering)===null||N===void 0||N.call(s);const E=(w=(C=k.parentNode)===null||C===void 0?void 0:C.children)!==null&&w!==void 0?w:[];for(let T=0;T{var T,P;(P=(T=g.current)===null||T===void 0?void 0:T.focus)===null||P===void 0||P.call(T)}),m(()=>{var T;(T=s.entered)===null||T===void 0||T.call(s)},b)}),S=$.useCallback(k=>{k?M(k):_()},[M,_]);return l?Vn.createPortal($.createElement(L2,{ref:S,className:qt(r,Ae(Np()),Ae(Wg),d&&Ae(Np("open"))),"aria-modal":!0,role:"dialog","aria-label":Tr(a,"Lightbox"),style:{...t.fade!==Bc.animation.fade?{[gt("fade_animation_duration")]:`${b}ms`}:null,...t.easing.fade!==Bc.animation.easing.fade?{[gt("fade_animation_timing_function")]:t.easing.fade}:null,...n.root},onFocus:k=>{g.current||(g.current=k.relatedTarget)}},e),o.root||document.body):null}const Q2=wn(Oc,Z2);function J2({children:e}){return $.createElement($.Fragment,null,e)}const R2=wn(e2,J2);function eE(e){return Nr(Hg,e)}function tE({toolbar:{buttons:e},render:{buttonClose:t,iconClose:n},styles:r}){const{close:s,setToolbarWidth:o}=Pn(),{setContainerRef:i,containerRect:a}=gp();In(()=>{o(a?.width)},[o,a?.width]);const l=()=>t?t():$.createElement(Ss,{key:vs,label:"Close",icon:N2,renderIcon:n,onClick:s});return $.createElement("div",{ref:i,style:r.toolbar,className:Ae(eE())},e?.map(c=>c===vs?l():c))}const nE=wn(Hg,tE);function Tp(e,t){var n;return $.createElement(e.module.component,{key:e.module.name,...t},(n=e.children)===null||n===void 0?void 0:n.map(r=>Tp(r,t)))}function rE(e,t={}){const{easing:n,...r}=e,{easing:s,...o}=t;return{easing:{...n,...s},...r,...o}}function sE({carousel:e,animation:t,render:n,toolbar:r,controller:s,noScroll:o,on:i,plugins:a,slides:l,index:c,...d}){const{animation:u,carousel:f,render:g,toolbar:m,controller:p,noScroll:y,on:b,slides:_,index:x,plugins:M,...S}=Bc,{config:k,augmentation:N}=v2([Ft(Q2,[Ft(q2,[Ft(V2,[Ft(j2),Ft(nE),Ft(G2)])])])],a||M),C=N({animation:rE(u,t),carousel:{...f,...e},render:{...g,...n},toolbar:{...m,...r},controller:{...p,...s},noScroll:{...y,...o},on:{...b,...i},...S,...d});return C.open?$.createElement(cp,{...C},$.createElement(_2,{slides:l||_,index:Ri(c||x)},$.createElement(E2,null,$.createElement(k2,null,$.createElement(x2,null,Tp(Ft(R2,k),C)))))):null}const oE={minZoom:1,maxZoomPixelRatio:1,zoomInMultiplier:2,doubleTapDelay:300,doubleClickDelay:500,doubleClickMaxStops:2,keyboardMoveDistance:50,wheelZoomDistanceFactor:100,pinchZoomDistanceFactor:100,pinchZoomV4:!1,scrollToZoom:!1};function iE(e){return Math.min(Math.max(e,Number.EPSILON),1)}function Ap(e){const{minZoom:t,...n}={...oE,...e};return{minZoom:iE(t),...n}}function aE(e,t,n,r){const s=$.useRef(void 0),o=$.useRef(void 0),{zoom:i}=zt().animation,a=Wc(),l=Ye(()=>{var c,d,u;if((c=s.current)===null||c===void 0||c.cancel(),s.current=void 0,o.current&&r?.current){try{s.current=(u=(d=r.current).animate)===null||u===void 0?void 0:u.call(d,[{transform:o.current},{transform:`scale(${e}) translateX(${t}px) translateY(${n}px)`}],{duration:a?0:i??500,easing:s.current?"ease-out":"ease-in-out"})}catch(f){console.error(f)}o.current=void 0,s.current&&(s.current.onfinish=()=>{s.current=void 0})}});return In(l,[e,t,n,l]),$.useCallback(()=>{o.current=r?.current?window.getComputedStyle(r.current).transform:void 0},[r])}function lE(e,t){const{on:n}=zt(),r=Ye(()=>{var s;t||(s=n.zoom)===null||s===void 0||s.call(n,{zoom:e})});$.useEffect(r,[e,r])}function sa(){const{zoom:e}=zt();return Ap(e)}function cE(e,t){var n,r;let s={width:0,height:0},o={width:0,height:0};const{currentSlide:i}=kn(),{imageFit:a}=zt().carousel,{maxZoomPixelRatio:l}=sa();if(e&&i){const d={...i,...t};if(Ar(d)){const u=Fc(d,a),f=Math.max(...(((n=d.srcSet)===null||n===void 0?void 0:n.map(m=>m.width))||[]).concat(d.width?[d.width]:[])),g=Math.max(...(((r=d.srcSet)===null||r===void 0?void 0:r.map(m=>m.height))||[]).concat(d.height?[d.height]:[]));f>0&&g>0&&e.width>0&&e.height>0&&(o=u?{width:Math.round(Math.min(f,e.width/e.height*g)),height:Math.round(Math.min(g,e.height/e.width*f))}:{width:f,height:g},o={width:o.width*l,height:o.height*l},s=u?{width:Math.min(e.width,o.width,f),height:Math.min(e.height,o.height,g)}:{width:Math.round(Math.min(e.width,e.height/g*f,f)),height:Math.round(Math.min(e.height,e.width/f*g,g))})}}const c=s.width?Math.max($c(o.width/s.width,5),1):1;return{imageRect:s,maxZoom:c}}function Dp(e,t){return Math.hypot(e.clientX-t.clientX,e.clientY-t.clientY)}function Ip(e,t,n=100,r=2){return e*Math.min(1+Math.abs(t/n),r)**Math.sign(t)}function dE(e,t,n,r,s,o,i,a,l){const c=$.useRef([]),d=$.useRef(0),u=$.useRef(void 0),{globalIndex:f}=kn(),{getOwnerWindow:g}=ks(),{containerRef:m,subscribeSensors:p}=Pn(),{keyboardMoveDistance:y,zoomInMultiplier:b,wheelZoomDistanceFactor:_,scrollToZoom:x,doubleTapDelay:M,doubleClickDelay:S,doubleClickMaxStops:k,pinchZoomDistanceFactor:N,pinchZoomV4:C}=sa(),w=$.useCallback(z=>{if(m.current){const{pageX:U,pageY:j}=z,{scrollX:Y,scrollY:B}=g(),{left:W,top:G,width:V,height:X}=m.current.getBoundingClientRect();return[U-W-Y-V/2,j-G-B-X/2]}return[]},[m,g]),E=Ye(z=>{const{key:U,metaKey:j,ctrlKey:Y}=z,B=j||Y,W=()=>{z.preventDefault(),z.stopPropagation()};if(e>1){const G=(V,X)=>{W(),a(V,X)};U==="ArrowDown"?G(0,y):U==="ArrowUp"?G(0,-y):U==="ArrowLeft"?G(-y,0):U==="ArrowRight"&&G(y,0)}U==="+"||B&&U==="="?(W(),s()):U==="-"||B&&U==="_"?(W(),o()):B&&U==="0"&&(W(),i(1))}),T=Ye(z=>{if((z.ctrlKey||x)&&Math.abs(z.deltaY)>Math.abs(z.deltaX)){z.stopPropagation(),i(Ip(e,-z.deltaY,_),!0,...w(z));return}e>1&&(z.stopPropagation(),x||a(z.deltaX,z.deltaY))}),P=$.useCallback(z=>{const U=c.current;U.splice(0,U.length,...U.filter(j=>j.pointerId!==z.pointerId))},[]),L=$.useCallback(z=>{P(z),z.persist(),c.current.push(z)},[P]),F=Ye(z=>{var U;const j=c.current;if(z.pointerType==="mouse"&&z.buttons>1||!(!((U=l?.current)===null||U===void 0)&&U.contains(z.target)))return;e>1&&z.stopPropagation();const{timeStamp:Y}=z;if(j.length===0&&Y-d.current<(z.pointerType==="touch"?M:S)){d.current=0;const B=e>=1?e!==n?e*Math.max(n**(1/k),b):1:e!==t?e/Math.max(t**(-1/k),b):1;i(B,!1,...w(z))}else d.current=Y;if(L(z),j.length===2){const B=Dp(j[0],j[1]);u.current={previousDistance:B,initialDistance:Math.max(B,1),initialZoom:e}}}),A=Ye(z=>{const U=c.current,j=U.find(Y=>Y.pointerId===z.pointerId);if(U.length===2&&u.current){z.stopPropagation(),L(z);const Y=Dp(U[0],U[1]),B=C?u.current.initialZoom/u.current.initialDistance*Y:Ip(e,Y-u.current.previousDistance,N);i(B,!0,...U.map(W=>w(W)).reduce((W,G)=>G.map((V,X)=>W[X]+V/2))),u.current.previousDistance=Y;return}e>1&&(z.stopPropagation(),j&&(U.length===1&&a((j.clientX-z.clientX)/e,(j.clientY-z.clientY)/e),L(z)))}),D=$.useCallback(z=>{const U=c.current;U.length===2&&U.find(j=>j.pointerId===z.pointerId)&&(u.current=void 0),P(z)},[P]),O=$.useCallback(()=>{const z=c.current;z.splice(0,z.length),d.current=0,u.current=void 0},[]);vp(p,F,A,D,r),$.useEffect(O,[f,O]),$.useEffect(()=>r?()=>{}:xs(O,p(Ic,E),p(Lc,T)),[r,p,O,E,T])}function uE(e,t,n){const[r,s]=$.useState(1),[o,i]=$.useState(0),[a,l]=$.useState(0),c=aE(r,o,a,n),{currentSlide:d,globalIndex:u}=kn(),{containerRect:f,slideRect:g}=Pn(),{minZoom:m,zoomInMultiplier:p}=sa(),y=d&&Ar(d)?d.src:void 0,b=!y||!n?.current;In(()=>{s(1),i(0),l(0)},[u,y]);const _=$.useCallback((N,C,w)=>{const E=w||r,T=o-(N||0),P=a-(C||0),L=(e.width*E-g.width)/2/E,F=(e.height*E-g.height)/2/E;i(Math.min(Math.abs(T),Math.max(L,0))*Math.sign(T)),l(Math.min(Math.abs(P),Math.max(F,0))*Math.sign(P))},[r,o,a,g,e.width,e.height]),x=$.useCallback((N,C,w,E)=>{const T=$c(N+.01m?N:m:t,5);C||c(),_(w?w*(1/r-1/T):0,E?E*(1/r-1/T):0,T),s(T)},[r,m,t,_,c]),M=Ye(()=>{r>1&&(r>t&&x(t,!0),_())});In(M,[f.width,f.height,M]);const S=$.useCallback(()=>{const N=r*p;x(r<1&&N>1?1:N)},[r,p,x]),k=$.useCallback(()=>{const N=r/p;x(r>1&&N<1?1:N)},[r,p,x]);return{zoom:r,offsetX:o,offsetY:a,disabled:b,changeOffsets:_,changeZoom:x,zoomIn:S,zoomOut:k}}const Lp=$.createContext(null),Zc=xn("useZoom","ZoomControllerContext",Lp);function fE({children:e}){const[t,n]=$.useState(),{slideRect:r}=Pn(),{ref:s,minZoom:o}=sa(),{imageRect:i,maxZoom:a}=cE(r,t?.imageDimensions),{zoom:l,offsetX:c,offsetY:d,disabled:u,changeZoom:f,changeOffsets:g,zoomIn:m,zoomOut:p}=uE(i,a,t?.zoomWrapperRef);lE(l,u),dE(l,o,a,u,m,p,f,g,t?.zoomWrapperRef);const y=$.useMemo(()=>({zoom:l,minZoom:o,maxZoom:a,offsetX:c,offsetY:d,disabled:u,zoomIn:m,zoomOut:p,changeZoom:f}),[l,o,a,c,d,u,m,p,f]);$.useImperativeHandle(s,()=>y,[y]);const b=$.useMemo(()=>({...y,setZoomWrapper:n}),[y,n]);return $.createElement(Lp.Provider,{value:b},e)}const hE=an("ZoomIn",$.createElement($.Fragment,null,$.createElement("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"}),$.createElement("path",{d:"M12 10h-2v2H9v-2H7V9h2V7h1v2h2v1z"}))),gE=an("ZoomOut",$.createElement("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14zM7 9h5v1H7z"})),Pp=$.forwardRef(function({zoomIn:t,onLoseFocus:n},r){const s=$.useRef(!1),o=$.useRef(!1),{zoom:i,minZoom:a,maxZoom:l,zoomIn:c,zoomOut:d,disabled:u}=Zc(),{render:f}=zt(),g=u||(t?i>=l:i<=a);return $.useEffect(()=>{g&&s.current&&o.current&&n(),g||(s.current=!0)},[g,n]),$.createElement(Ss,{ref:r,disabled:g,label:t?"Zoom in":"Zoom out",icon:t?hE:gE,renderIcon:t?f.iconZoomIn:f.iconZoomOut,onClick:t?c:d,onFocus:()=>{o.current=!0},onBlur:()=>{o.current=!1}})});function pE(){const e=$.useRef(null),t=$.useRef(null),{focus:n}=Pn(),r=$.useCallback(i=>{var a,l;!((a=i.current)===null||a===void 0)&&a.disabled?n():(l=i.current)===null||l===void 0||l.focus()},[n]),s=$.useCallback(()=>r(e),[r]),o=$.useCallback(()=>r(t),[r]);return $.createElement($.Fragment,null,$.createElement(Pp,{zoomIn:!0,ref:e,onLoseFocus:o}),$.createElement(Pp,{ref:t,onLoseFocus:s}))}function mE(){const{render:e}=zt(),t=Zc();return e.buttonZoom?$.createElement($.Fragment,null,e.buttonZoom(t)):$.createElement(pE,null)}function bE(e){var t;return(((t=e.srcSet)===null||t===void 0?void 0:t.length)||0)>0}function yE({current:e,preload:t},{type:n,source:r}){switch(n){case"fetch":return e?{current:e,preload:r}:{current:r};case"done":return r===t?{current:r}:{current:e,preload:t};default:throw new Error(Rg)}}function vE(e){var t,n;const[{current:r,preload:s},o]=$.useReducer(yE,{}),{slide:i,rect:a,imageFit:l,render:c,interactive:d}=e,u=i.srcSet.sort((S,k)=>S.width-k.width),f=(t=i.width)!==null&&t!==void 0?t:u[u.length-1].width,g=(n=i.height)!==null&&n!==void 0?n:u[u.length-1].height,m=Fc(i,l),p=Math.max(...u.map(S=>S.width)),y=Math.min((m?Math.max:Math.min)(a.width,f*(a.height/g)),p),b=p2(),_=Ye(()=>{var S;const k=(S=u.find(N=>N.width>=y*b))!==null&&S!==void 0?S:u[u.length-1];(!r||u.findIndex(N=>N.src===r)N===k))&&o({type:"fetch",source:k.src})});In(_,[a.width,a.height,b,_]);const x=Ye(S=>o({type:"done",source:S})),M={WebkitTransform:d?"initial":"translateZ(0)"};return m||Object.assign(M,a.width/a.heightx(s),render:{...c,iconLoading:()=>null,iconError:()=>null}}),r&&$.createElement(Dr,{key:"current",...e,slide:{...i,src:r,srcSet:void 0},style:M}))}function xE({render:e,slide:t,offset:n,rect:r}){var s;const[o,i]=$.useState(),a=$.useRef(null),{zoom:l,maxZoom:c,offsetX:d,offsetY:u,setZoomWrapper:f}=Zc(),g=l>1,{carousel:m,on:p}=zt(),{currentIndex:y}=kn();In(()=>n===0?(f({zoomWrapperRef:a,imageDimensions:o}),()=>f(void 0)):()=>{},[n,o,f]);let b=(s=e.slide)===null||s===void 0?void 0:s.call(e,{slide:t,offset:n,rect:r,zoom:l,maxZoom:c});if(!b&&Ar(t)){const _={slide:t,offset:n,rect:r,render:e,imageFit:m.imageFit,imageProps:m.imageProps,onClick:n===0?()=>{var x;return(x=p.click)===null||x===void 0?void 0:x.call(p,{index:y})}:void 0};b=bE(t)?$.createElement(vE,{..._,slide:t,interactive:g,rect:n===0?{width:r.width*l,height:r.height*l}:r}):$.createElement(Dr,{onLoad:x=>i({width:x.naturalWidth,height:x.naturalHeight}),..._})}return b?$.createElement("div",{ref:a,className:qt(Ae(jg),Ae(ys),Ae(Gg),g&&Ae(l2)),style:n===0?{transform:`scale(${l}) translateX(${d}px) translateY(${u}px)`}:void 0},b):null}const wE=({augment:e,addModule:t})=>{e(({zoom:n,toolbar:r,render:s,controller:o,...i})=>{const a=Ap(n);return{zoom:a,toolbar:ta(r,Bg,$.createElement(mE,null)),render:{...s,slide:l=>{var c;return Ar(l.slide)?$.createElement(xE,{render:s,...l}):(c=s.slide)===null||c===void 0?void 0:c.call(s,l)}},controller:{...o,preventDefaultWheelY:a.scrollToZoom},...i}}),t(wn(Bg,fE))},kE={separator:"/",container:{}},$p=e=>({...kE,...e});function CE({counter:e}){const{slides:t,currentIndex:n}=kn(),{separator:r,container:{className:s,...o},className:i,...a}=$p(e);return t.length===0?null:$.createElement("div",{className:qt(Ae("counter"),s||i),...a,...o,"aria-hidden":!0},n+1," ",r," ",t.length)}function SE({augment:e,addChild:t}){e(({counter:n,...r})=>({counter:$p(n),...r})),t(vo,wn(t2,CE))}const _E={autoplay:!1,delay:3e3,ref:null},Fp=e=>({..._E,...e}),zp=$.createContext(null),EE=xn("useSlideshow","SlideshowContext",zp);function ME({slideshow:e,carousel:{finite:t},on:n,children:r}){const{autoplay:s,delay:o,ref:i}=Fp(e),a=$.useRef(s),[l,c]=$.useState(s),d=$.useRef(void 0),u=$.useRef(void 0),{slides:f,currentIndex:g}=kn(),{setTimeout:m,clearTimeout:p}=_o(),{subscribe:y}=Cs(),{next:b}=Pn(),{setAutoPlaying:_}=jc();$.useEffect(()=>_(l),[l,_]);const x=f.length===0||t&&g===f.length-1,M=$.useCallback(()=>{!l&&!x&&c(!0)},[l,x]),S=$.useCallback(()=>{l&&c(!1)},[l]),k=$.useCallback(()=>{p(d.current),d.current=void 0},[p]),N=Ye(()=>{k(),!(!l||x||u.current===bs||u.current===Tc)&&(d.current=m(()=>{l&&(u.current=void 0,b())},o))});$.useEffect(N,[g,l,N]),$.useEffect(()=>{l&&x&&c(!1)},[g,l,x]);const C=Ye(()=>{var T;return(T=n.slideshowStart)===null||T===void 0?void 0:T.call(n)}),w=Ye(()=>{var T;return(T=n.slideshowStop)===null||T===void 0?void 0:T.call(n)});$.useEffect(()=>{l?C():a.current&&w(),a.current=l},[l,C,w]),$.useEffect(()=>xs(k,y(r2,()=>{u.current=bs,k()}),y(s2,()=>{u.current=Tc,k()}),y(o2,()=>{u.current=ko,N()}),y(i2,()=>{u.current=Co,N()})),[y,k,N]);const E=$.useMemo(()=>({playing:l,disabled:x,play:M,pause:S}),[l,x,M,S]);return $.useImperativeHandle(i,()=>E,[E]),$.createElement(zp.Provider,{value:E},r)}const NE=an("Play",$.createElement("path",{d:"M8 5v14l11-7z"})),OE=an("Pause",$.createElement("path",{d:"M6 19h4V5H6v14zm8-14v14h4V5h-4z"}));function TE(){const{playing:e,disabled:t,play:n,pause:r}=EE(),{render:s}=zt(),o=mp(Pn().focus,t);return s.buttonSlideshow?$.createElement($.Fragment,null,s.buttonSlideshow({playing:e,disabled:t,play:n,pause:r})):$.createElement(Ss,{label:e?"Pause":"Play",icon:e?OE:NE,renderIcon:e?s.iconSlideshowPause:s.iconSlideshowPlay,onClick:e?r:n,disabled:t,...o})}function AE({augment:e,addModule:t}){e(({slideshow:n,toolbar:r,...s})=>({toolbar:ta(r,Ug,$.createElement(TE,null)),slideshow:Fp(n),...s})),t(wn(Ug,ME))}const DE={auto:!1,ref:null},Vp=e=>({...DE,...e}),Hp=$.createContext(null),IE=xn("useFullscreen","FullscreenContext",Hp);function LE({fullscreen:e,on:t,children:n}){const{auto:r,ref:s}=Vp(e),o=$.useRef(null),[i,a]=$.useState(),[l,c]=$.useState(!1),d=$.useRef(!1),{getOwnerDocument:u}=ks();In(()=>{var x,M,S,k;const N=u();a(!((k=(S=(M=(x=N.fullscreenEnabled)!==null&&x!==void 0?x:N.webkitFullscreenEnabled)!==null&&M!==void 0?M:N.mozFullScreenEnabled)!==null&&S!==void 0?S:N.msFullscreenEnabled)!==null&&k!==void 0&&k))},[u]);const f=$.useCallback(()=>{var x;const M=u(),S=M.fullscreenElement||M.webkitFullscreenElement||M.mozFullScreenElement||M.msFullscreenElement;return((x=S?.shadowRoot)===null||x===void 0?void 0:x.fullscreenElement)||S},[u]),g=$.useCallback(()=>{const x=o.current;try{x.requestFullscreen?x.requestFullscreen().catch(()=>{}):x.webkitRequestFullscreen?x.webkitRequestFullscreen():x.mozRequestFullScreen?x.mozRequestFullScreen():x.msRequestFullscreen&&x.msRequestFullscreen()}catch{}},[]),m=$.useCallback(()=>{if(!f())return;const x=u();try{x.exitFullscreen?x.exitFullscreen().catch(()=>{}):x.webkitExitFullscreen?x.webkitExitFullscreen():x.mozCancelFullScreen?x.mozCancelFullScreen():x.msExitFullscreen&&x.msExitFullscreen()}catch{}},[f,u]);$.useEffect(()=>{const x=u(),M=()=>{c(f()===o.current)};return xs(...["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"].map(S=>(x.addEventListener(S,M),()=>x.removeEventListener(S,M))))},[f,u]);const p=Ye(()=>{var x;return(x=t.enterFullscreen)===null||x===void 0?void 0:x.call(t)}),y=Ye(()=>{var x;return(x=t.exitFullscreen)===null||x===void 0?void 0:x.call(t)});$.useEffect(()=>{l&&(d.current=!0),d.current&&(l?p:y)()},[l,p,y]);const b=Ye(()=>{var x;return(x=r?g:null)===null||x===void 0||x(),m});$.useEffect(b,[b]);const _=$.useMemo(()=>({fullscreen:l,disabled:i,enter:g,exit:m}),[l,i,g,m]);return $.useImperativeHandle(s,()=>_,[_]),$.createElement("div",{ref:o,className:qt(Ae(xo),Ae(jg))},$.createElement(Hp.Provider,{value:_},n))}const PE=an("EnterFullscreen",$.createElement("path",{d:"M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"})),$E=an("ExitFullscreen",$.createElement("path",{d:"M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z"}));function FE(){var e;const{fullscreen:t,disabled:n,enter:r,exit:s}=IE(),{render:o}=zt();return n?null:o.buttonFullscreen?$.createElement($.Fragment,null,(e=o.buttonFullscreen)===null||e===void 0?void 0:e.call(o,{fullscreen:t,disabled:n,enter:r,exit:s})):$.createElement(Ss,{disabled:n,label:t?"Exit Fullscreen":"Enter Fullscreen",icon:t?$E:PE,renderIcon:t?o.iconExitFullscreen:o.iconEnterFullscreen,onClick:t?s:r})}function zE({augment:e,contains:t,addParent:n}){e(({fullscreen:r,toolbar:s,...o})=>({toolbar:ta(s,xo,$.createElement(FE,null)),fullscreen:Vp(r),...o})),n(t(wo)?wo:vo,wn(xo,LE))}const Lr={ref:null,position:"bottom",width:120,height:80,border:1,borderRadius:4,padding:4,gap:16,imageFit:"contain",vignette:!0,hidden:!1,showToggle:!1},Qc=e=>({...Lr,...e});function Up(){const{thumbnails:e}=zt();return Qc(e)}const Pr=e=>Nr(wo,e),Vt=e=>Pr(Nr("thumbnail",e)),VE=an("VideoThumbnail",$.createElement("path",{d:"M10 16.5l6-4.5-6-4.5v9zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z"})),HE=an("UnknownThumbnail",$.createElement("path",{d:"M23 18V6c0-1.1-.9-2-2-2H3c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2zM8.5 12.5l2.5 3.01L14.5 11l4.5 6H5l3.5-4.5z"}));function UE({slide:e,render:t,rect:n,imageFit:r}){var s;const o=(s=t.thumbnail)===null||s===void 0?void 0:s.call(t,{slide:e,render:t,rect:n,imageFit:r});if(o)return o;const i={render:t,rect:n,imageFit:r};if(e.thumbnail)return $.createElement(Dr,{slide:{src:e.thumbnail},...i});if(Ar(e))return $.createElement(Dr,{slide:e,...i});const a=Ae(Vt(Ji));return e.type==="video"?$.createElement($.Fragment,null,e.poster&&$.createElement(Dr,{slide:{src:e.poster},...i}),$.createElement(VE,{className:a})):$.createElement(HE,{className:a})}const BE=Or("active"),Jc=Or("fadein"),Rc=Or("fadeout"),jE=Or("placeholder"),Bp="delay",jp="duration";function WE({slide:e,index:t,onClick:n,fadeIn:r,fadeOut:s,placeholder:o,onLoseFocus:i}){const a=$.useRef(null),{render:l,styles:c,labels:d}=zt(),{slides:u,globalIndex:f}=kn(),{getOwnerDocument:g}=ks(),{width:m,height:p,imageFit:y}=Up(),b={width:m,height:p},_=t===f,x=Ye(i);return $.useEffect(()=>{s&&g().activeElement===a.current&&x()},[s,x,g]),$.createElement("button",{ref:a,type:"button",className:qt(Ae(ys),Ae(Vt()),_&&Ae(Vt(BE())),r&&Ae(Vt(Jc())),s&&Ae(Vt(Rc())),o&&Ae(Vt(jE()))),style:{...r?{[gt(Vt(Jc(jp)))]:`${r.duration}ms`,[gt(Vt(Jc(Bp)))]:`${r.delay}ms`}:null,...s?{[gt(Vt(Rc(jp)))]:`${s.duration}ms`,[gt(Vt(Rc(Bp)))]:`${s.delay}ms`}:null,...c.thumbnail},onClick:n,"aria-current":_?!0:void 0,"aria-label":tp(d,u,t)},e&&UE({slide:e,render:l,rect:b,imageFit:y}))}function Wp(e){return["top","bottom"].includes(e)}function Gp(e,t){return t+2*(e.border+e.padding)+e.gap}function GE(e){const{thumbnail:t,poster:n}=e||{thumbnail:"placeholder"};return typeof t=="string"&&t||typeof n=="string"&&n||e&&np(e)||void 0}function Yp({visible:e,containerRef:t}){const n=$.useRef(null),r=ra(),{publish:s,subscribe:o}=Cs(),{carousel:i,styles:a,labels:l}=zt(),{slides:c,globalIndex:d,animation:u}=kn(),{registerSensors:f,subscribeSensors:g}=bp();Sp(g);const m=Up(),{position:p,width:y,height:b,border:_,borderStyle:x,borderColor:M,borderRadius:S,padding:k,gap:N,vignette:C}=m,w=u?.duration!==void 0&&u?.increment||0,E=u?.duration||0,{prepareAnimation:T}=Gc(n,D=>({keyframes:Wp(p)?[{transform:`translateX(${(r?-1:1)*Gp(m,y)*w+D}px)`},{transform:"translateX(0)"}]:[{transform:`translateY(${Gp(m,b)*w+D}px)`},{transform:"translateY(0)"}],duration:E,easing:u?.easing})),P=Ye(()=>{let D=0;if(t.current&&n.current){const O=t.current.getBoundingClientRect(),z=n.current.getBoundingClientRect();D=Wp(p)?z.left-O.left-(O.width-z.width)/2:z.top-O.top-(O.height-z.height)/2}T(D)});$.useEffect(()=>xs(o(Dc,P)),[o,P]);const L=rp(i,c),F=[];if(Vc(c))for(let D=d-L-Math.abs(w);D<=d+L+Math.abs(w);D+=1){const z=i.finite&&(D<0||D>c.length-1)||w<0&&D0&&D>d+L?null:Hc(c,D),U=[`${D}`,GE(z)].filter(Boolean).join("|");F.push({key:U,index:D,slide:z})}const A=D=>()=>{D>d?s(mr,{count:D-d}):D{const U=E/Math.abs(w||1),j=w>0&&O>d+L-w&&O<=d+L||w<0&&O=d-L?{duration:U,delay:((w>0?O-(d+L-w):d-L-w-O)-1)*U}:void 0,Y=w>0&&Od+L?{duration:U,delay:(w>0?w-(d-L-O):-w-(O-(d+L)))*U}:void 0;return $.createElement(WE,{key:D,index:O,slide:z,fadeIn:j,fadeOut:Y,placeholder:!z,onClick:A(O),onLoseFocus:()=>{var B;return(B=n.current)===null||B===void 0?void 0:B.focus()}})})),C&&$.createElement("div",{className:Ae(Pr("vignette"))}))}const Kp=$.createContext(null),YE=xn("useThumbnails","ThumbnailsContext",Kp);function KE({children:e,...t}){const{ref:n,position:r,hidden:s}=Qc(t.thumbnails),[o,i]=$.useState(!s),a=$.useRef(null),l=$.useMemo(()=>({visible:o,show:()=>i(!0),hide:()=>i(!1)}),[o]);return $.useImperativeHandle(n,()=>l,[l]),$.createElement(cp,{...t},$.createElement(Kp.Provider,{value:l},$.createElement("div",{ref:a,className:qt(Ae(Pr()),Ae(Pr(`${r}`)))},["start","top"].includes(r)&&$.createElement(Yp,{containerRef:a,visible:o}),$.createElement("div",{className:Ae(Pr("wrapper"))},e),["end","bottom"].includes(r)&&$.createElement(Yp,{containerRef:a,visible:o}))))}const Xp=()=>$.createElement($.Fragment,null,$.createElement("path",{strokeWidth:2,stroke:"currentColor",strokeLinejoin:"round",fill:"none",d:"M3 5l18 0l0 14l-18 0l0-14z"}),$.createElement("path",{d:"M5 14h4v3h-4zM10 14h4v3h-4zM15 14h4v3h-4z"})),XE=an("ThumbnailsVisible",Xp()),qE=M2("ThumbnailsHidden",Xp());function ZE(){const{visible:e,show:t,hide:n}=YE(),{render:r}=zt();return r.buttonThumbnails?$.createElement($.Fragment,null,r.buttonThumbnails({visible:e,show:t,hide:n})):$.createElement(Ss,{label:e?"Hide thumbnails":"Show thumbnails",icon:e?XE:qE,renderIcon:e?r.iconThumbnailsVisible:r.iconThumbnailsHidden,onClick:e?n:t})}function QE({augment:e,contains:t,append:n,addParent:r}){e(({thumbnails:o,toolbar:i,...a})=>{const l=Qc(o);return{toolbar:ta(i,wo,l.showToggle?$.createElement(ZE,null):null),thumbnails:l,...a}});const s=wn(wo,KE);t(xo)?n(xo,s):r(vo,s)}const ed=e=>{if(!e||typeof window>"u"||!window.location||!/^(https?:)?\/\//i.test(e))return!1;try{return new URL(e,window.location.href).origin!==window.location.origin}catch{return!1}},JE=window.G7Core?.createLogger?.("Comp:ImageGallery")??{log:(...e)=>console.log("[Comp:ImageGallery]",...e),warn:(...e)=>console.warn("[Comp:ImageGallery]",...e),error:(...e)=>console.error("[Comp:ImageGallery]",...e)},td=window.G7Core,oa=(e,t)=>td?.t?.(e,t)??e,RE=async(e,t)=>{try{const n=await td.api.get(e,{responseType:"blob"});if(n){const r=URL.createObjectURL(n),s=document.createElement("a");s.href=r,s.download=t,document.body.appendChild(s),s.click(),document.body.removeChild(s),URL.revokeObjectURL(r)}}catch(n){JE.error("Failed to download file:",n),td?.toast?.error?.(oa("common.download_failed"))}},eM=(e,t)=>{const n=document.createElement("a");n.href=e,n.download=t,n.target="_blank",document.body.appendChild(n),n.click(),document.body.removeChild(n)},nd=async e=>{const t=e.downloadUrl||e.src,n=e.filename||e.title||"image";e.downloadRequiresAuth&&!ed(t)?await RE(t,n):eM(t,n)},tM=({image:e,index:t,onDownload:n})=>{const[r,s]=v.useState(!1),o=async i=>{if(i.stopPropagation(),n){n(e,t);return}s(!0);try{await nd(e)}finally{s(!1)}};return h.jsx(le,{type:"button",onClick:o,disabled:r,className:"yarl__button flex items-center justify-center","aria-label":oa("common.download"),title:oa("common.download"),children:r?h.jsx(yt,{className:"fa-solid fa-spinner fa-spin text-white"}):h.jsx(yt,{className:"fa-solid fa-download text-white"})})},ia=({images:e,isOpen:t,onClose:n,startIndex:r=0,enableZoom:s=!0,enableSlideshow:o=!1,enableFullscreen:i=!0,showCounter:a=!0,showDownload:l=!0,showThumbnails:c=!0,onDownload:d,editorAttrs:u,id:f})=>{const[g,m]=v.useState(r),p=v.useRef(r),y=e.map(x=>({src:x.src,title:x.title,description:x.description})),b=[];s&&b.push(wE),o&&b.push(AE),i&&b.push(zE),a&&b.push(SE),c&&b.push(QE);const _=e[g];if(v.useEffect(()=>{p.current=g},[g]),u){const x=(e??[]).slice(0,4);return h.jsx(I,{id:f,className:"grid grid-cols-2 gap-2 p-3 rounded-lg border border-dashed border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800",...u,children:x.length>0?x.map((M,S)=>h.jsx(Nn,{src:M.thumbnail||M.src,alt:M.title||"",className:"w-full aspect-square object-cover rounded bg-gray-200 dark:bg-gray-700"},S)):h.jsxs(I,{className:"col-span-2 flex items-center justify-center py-6 text-sm text-gray-400 dark:text-gray-500",children:[h.jsx(yt,{className:"fa-regular fa-images mr-2"}),oa("editor.component.image_gallery")]})})}return h.jsx(sE,{open:t,close:n,slides:y,index:g,plugins:b,on:{view:({index:x})=>{x!==p.current&&m(x)}},zoom:{maxZoomPixelRatio:3,zoomInMultiplier:2,doubleTapDelay:300,doubleClickDelay:300,doubleClickMaxStops:2,keyboardMoveDistance:50,wheelZoomDistanceFactor:100,pinchZoomDistanceFactor:100,scrollToZoom:!0},carousel:{finite:!0,preload:2,padding:"16px",spacing:"30%"},animation:{fade:250,swipe:500,easing:{fade:"ease",swipe:"ease-out",navigation:"ease-in-out"}},controller:{closeOnBackdropClick:!0,closeOnPullDown:!0,closeOnPullUp:!0},thumbnails:{position:"bottom",width:120,height:80,border:2,borderRadius:4,padding:4,gap:16,showToggle:!1,vignette:!0},toolbar:{buttons:[l&&_&&h.jsx(tM,{image:_,index:g,onDownload:d},"download"),"close"].filter(Boolean)},styles:{container:{backgroundColor:"rgba(0, 0, 0, 0.9)"}}})},qp=()=>{const[e,t]=v.useState(!1),[n,r]=v.useState([]),[s,o]=v.useState(0),i=v.useCallback((l,c=0)=>{r(l),o(c),t(!0)},[]),a=v.useCallback(()=>{t(!1)},[]);return{isOpen:e,openGallery:i,closeGallery:a,galleryProps:{images:n,isOpen:e,onClose:a,startIndex:s}}};ia.displayName="ImageGallery";const nM=Object.freeze(Object.defineProperty({__proto__:null,ImageGallery:ia,executeImageDownload:nd,useImageGallery:qp},Symbol.toStringTag,{value:"Module"})),rM=v.createContext(null),sM=({value:e,children:t})=>h.jsx(rM.Provider,{value:e,children:t});function oM(e,t){return t.forEach((function(n){n&&typeof n!="string"&&!Array.isArray(n)&&Object.keys(n).forEach((function(r){if(r!=="default"&&!(r in e)){var s=Object.getOwnPropertyDescriptor(n,r);Object.defineProperty(e,r,s.get?s:{enumerable:!0,get:function(){return n[r]}})}}))})),Object.freeze(e)}function Zp(e,t){return new Promise((function(n,r){let s;return iM(e).then((function(o){try{return s=o,n(new Blob([t.slice(0,2),s,t.slice(2)],{type:"image/jpeg"}))}catch(i){return r(i)}}),r)}))}const iM=e=>new Promise(((t,n)=>{const r=new FileReader;r.addEventListener("load",(({target:{result:s}})=>{const o=new DataView(s);let i=0;if(o.getUint16(i)!==65496)return n("not a valid JPEG");for(i+=2;;){const a=o.getUint16(i);if(a===65498)break;const l=o.getUint16(i+2);if(a===65505&&o.getUint32(i+4)===1165519206){const c=i+10;let d;switch(o.getUint16(c)){case 18761:d=!0;break;case 19789:d=!1;break;default:return n("TIFF header contains invalid endian")}if(o.getUint16(c+2,d)!==42)return n("TIFF header contains invalid version");const u=o.getUint32(c+4,d),f=c+u+2+12*o.getUint16(c+u,d);for(let g=c+u+2;g>>24&255,a[i+1]=l>>>16&255,a[i+2]=l>>>8&255,a[i+3]=l>>>0&255,new Uint8Array(a.buffer,0,i+4)},r.deflateRaw=function(s,o){o==null&&(o={level:6});var i=new Uint8Array(50+Math.floor(1.1*s.length)),a=r.F.deflateRaw(s,i,a,o.level);return new Uint8Array(i.buffer,0,a)},r.encode=function(s,o){o==null&&(o=!1);var i=0,a=r.bin.writeUint,l=r.bin.writeUshort,c={};for(var d in s){var u=!r._noNeed(d)&&!o,f=s[d],g=r.crc.crc(f,0,f.length);c[d]={cpr:u,usize:f.length,crc:g,file:u?r.deflateRaw(f):f}}for(var d in c)i+=c[d].file.length+30+46+2*r.bin.sizeUTF8(d);i+=22;var m=new Uint8Array(i),p=0,y=[];for(var d in c){var b=c[d];y.push(p),p=r._writeHeader(m,p,d,b,0)}var _=0,x=p;for(var d in c)b=c[d],y.push(p),p=r._writeHeader(m,p,d,b,1,y[_++]);var M=p-x;return a(m,p,101010256),p+=4,l(m,p+=4,_),l(m,p+=2,_),a(m,p+=2,M),a(m,p+=4,x),p+=4,p+=2,m.buffer},r._noNeed=function(s){var o=s.split(".").pop().toLowerCase();return"png,jpg,jpeg,zip".indexOf(o)!=-1},r._writeHeader=function(s,o,i,a,l,c){var d=r.bin.writeUint,u=r.bin.writeUshort,f=a.file;return d(s,o,l==0?67324752:33639248),o+=4,l==1&&(o+=2),u(s,o,20),u(s,o+=2,0),u(s,o+=2,a.cpr?8:0),d(s,o+=2,0),d(s,o+=4,a.crc),d(s,o+=4,f.length),d(s,o+=4,a.usize),u(s,o+=4,r.bin.sizeUTF8(i)),u(s,o+=2,0),o+=2,l==1&&(o+=2,o+=2,d(s,o+=6,c),o+=4),o+=r.bin.writeUTF8(s,o,i),l==0&&(s.set(f,o),o+=f.length),o},r.crc={table:(function(){for(var s=new Uint32Array(256),o=0;o<256;o++){for(var i=o,a=0;a<8;a++)1&i?i=3988292384^i>>>1:i>>>=1;s[o]=i}return s})(),update:function(s,o,i,a){for(var l=0;l>>8;return s},crc:function(s,o,i){return 4294967295^r.crc.update(4294967295,s,o,i)}},r.adler=function(s,o,i){for(var a=1,l=0,c=o,d=o+i;c>8&255},readUint:function(s,o){return 16777216*s[o+3]+(s[o+2]<<16|s[o+1]<<8|s[o])},writeUint:function(s,o,i){s[o]=255&i,s[o+1]=i>>8&255,s[o+2]=i>>16&255,s[o+3]=i>>24&255},readASCII:function(s,o,i){for(var a="",l=0;l>6,s[o+l+1]=128|d>>0&63,l+=2;else if((4294901760&d)==0)s[o+l]=224|d>>12,s[o+l+1]=128|d>>6&63,s[o+l+2]=128|d>>0&63,l+=3;else{if((4292870144&d)!=0)throw"e";s[o+l]=240|d>>18,s[o+l+1]=128|d>>12&63,s[o+l+2]=128|d>>6&63,s[o+l+3]=128|d>>0&63,l+=4}}return l},sizeUTF8:function(s){for(var o=s.length,i=0,a=0;a>>3}var y=c.lits,b=c.strt,_=c.prev,x=0,M=0,S=0,k=0,N=0,C=0;for(p>2&&(b[C=r.F._hash(s,0)]=0),f=0;f14e3||M>26697)&&p-f>100&&(m>>16,P=65535&E;if(E!=0){P=65535&E;var L=d(T=E>>>16,c.of0);c.lhst[257+L]++;var F=d(P,c.df0);c.dhst[F]++,k+=c.exb[L]+c.dxb[F],y[x]=T<<23|f-m,y[x+1]=P<<16|L<<8|F,x+=2,m=f+T}else c.lhst[s[f]]++;M++}}for(S==f&&s.length!=0||(m>>3},r.F._bestMatch=function(s,o,i,a,l,c){var d=32767&o,u=i[d],f=d-u+32768&32767;if(u==d||a!=r.F._hash(s,o-f))return 0;for(var g=0,m=0,p=Math.min(32767,o);f<=p&&--c!=0&&u!=d;){if(g==0||s[o+g]==s[o+g-f]){var y=r.F._howLong(s,o,f);if(y>g){if(m=f,(g=y)>=l)break;f+2b&&(b=M,u=x)}}}f+=(d=u)-(u=i[d])+32768&32767}return g<<16|m},r.F._howLong=function(s,o,i){if(s[o]!=s[o-i]||s[o+1]!=s[o+1-i]||s[o+2]!=s[o+2-i])return 0;var a=o,l=Math.min(s.length,o+258);for(o+=3;o>>23,Y=O+(8388607&U);O>16,G=B>>8&255,V=255&B;C(u,f=r.F._writeLit(257+G,F,u,f),j-k.of0[G]),f+=k.exb[G],N(u,f=r.F._writeLit(V,A,u,f),W-k.df0[V]),f+=k.dxb[V],O+=j}}f=r.F._writeLit(256,F,u,f)}return f},r.F._copyExact=function(s,o,i,a,l){var c=l>>>3;return a[c]=i,a[c+1]=i>>>8,a[c+2]=255-a[c],a[c+3]=255-a[c+1],c+=4,a.set(new Uint8Array(s.buffer,o,i),c),l+(i+4<<3)},r.F.getTrees=function(){for(var s=r.F.U,o=r.F._hufTree(s.lhst,s.ltree,15),i=r.F._hufTree(s.dhst,s.dtree,15),a=[],l=r.F._lenCodes(s.ltree,a),c=[],d=r.F._lenCodes(s.dtree,c),u=0;u4&&s.itree[1+(s.ordr[g-1]<<1)]==0;)g--;return[o,i,f,l,d,g,a,c]},r.F.getSecond=function(s){for(var o=[],i=0;i>1)+",");return o},r.F.contSize=function(s,o){for(var i=0,a=0;a15&&(r.F._putsE(i,a,d,u),a+=u)}return a},r.F._lenCodes=function(s,o){for(var i=s.length;i!=2&&s[i-1]==0;)i-=2;for(var a=0;a>>1,138))<11?o.push(17,g-3):o.push(18,g-11),a+=2*g-2}else if(l==u&&c==l&&d==l){for(f=a+5;f+2>>1,6);o.push(16,g-3),a+=2*g-2}else o.push(l,0)}return i>>>1},r.F._hufTree=function(s,o,i){var a=[],l=s.length,c=o.length,d=0;for(d=0;di&&(r.F.restrictDepth(f,i,x),x=i),d=0;do;a++){var d=s[a].d;s[a].d=o,c+=l-(1<>>=i-o;c>0;)(d=s[a].d)=0;a--)s[a].d==o&&c<0&&(s[a].d--,c++);c!=0&&console.log("debt left")},r.F._goodIndex=function(s,o){var i=0;return o[16|i]<=s&&(i|=16),o[8|i]<=s&&(i|=8),o[4|i]<=s&&(i|=4),o[2|i]<=s&&(i|=2),o[1|i]<=s&&(i|=1),i},r.F._writeLit=function(s,o,i,a){return r.F._putsF(i,a,o[s<<1]),a+o[1+(s<<1)]},r.F.inflate=function(s,o){var i=Uint8Array;if(s[0]==3&&s[1]==0)return o||new i(0);var a=r.F,l=a._bitsF,c=a._bitsE,d=a._decodeTiny,u=a.makeCodes,f=a.codes2map,g=a._get17,m=a.U,p=o==null;p&&(o=new i(s.length>>>2<<3));for(var y,b,_=0,x=0,M=0,S=0,k=0,N=0,C=0,w=0,E=0;_==0;)if(_=l(s,E,1),x=l(s,E+1,2),E+=3,x!=0){if(p&&(o=r.F._check(o,w+131072)),x==1&&(y=m.flmap,b=m.fdmap,N=511,C=31),x==2){M=c(s,E,5)+257,S=c(s,E+5,5)+1,k=c(s,E+10,4)+4,E+=14;for(var T=0;T<38;T+=2)m.itree[T]=0,m.itree[T+1]=0;var P=1;for(T=0;TP&&(P=L)}E+=3*k,u(m.itree,P),f(m.itree,P,m.imap),y=m.lmap,b=m.dmap,E=d(m.imap,(1<>>4;if(!(O>>>8))o[w++]=O;else{if(O==256)break;var z=w+O-254;if(O>264){var U=m.ldef[O-257];z=w+(U>>>3)+c(s,E,7&U),E+=7&U}var j=b[g(s,E)&C];E+=15&j;var Y=j>>>4,B=m.ddef[Y],W=(B>>>4)+l(s,E,15&B);for(E+=15&B,p&&(o=r.F._check(o,w+131072));w>>3),V=s[G-4]|s[G-3]<<8;p&&(o=r.F._check(o,w+V)),o.set(new i(s.buffer,s.byteOffset+G,V),w),E=G+V<<3,w+=V}return o.length==w?o:o.slice(0,w)},r.F._check=function(s,o){var i=s.length;if(o<=i)return s;var a=new Uint8Array(Math.max(i<<1,o));return a.set(s,0),a},r.F._decodeTiny=function(s,o,i,a,l,c){for(var d=r.F._bitsE,u=r.F._get17,f=0;f>>4;if(m<=15)c[f]=m,f++;else{var p=0,y=0;m==16?(y=3+d(a,l,2),l+=2,p=c[f-1]):m==17?(y=3+d(a,l,3),l+=3):m==18&&(y=11+d(a,l,7),l+=7);for(var b=f+y;f>>1;cl&&(l=u),c++}for(;c>1,u=s[c+1],f=d<<4|u,g=o-u,m=s[c]<>>15-o]=f,m++},r.F.revCodes=function(s,o){for(var i=r.F.U.rev15,a=15-o,l=0;l>>a}},r.F._putsE=function(s,o,i){i<<=7&o;var a=o>>>3;s[a]|=i,s[a+1]|=i>>>8},r.F._putsF=function(s,o,i){i<<=7&o;var a=o>>>3;s[a]|=i,s[a+1]|=i>>>8,s[a+2]|=i>>>16},r.F._bitsE=function(s,o,i){return(s[o>>>3]|s[1+(o>>>3)]<<8)>>>(7&o)&(1<>>3]|s[1+(o>>>3)]<<8|s[2+(o>>>3)]<<16)>>>(7&o)&(1<>>3]|s[1+(o>>>3)]<<8|s[2+(o>>>3)]<<16)>>>(7&o)},r.F._get25=function(s,o){return(s[o>>>3]|s[1+(o>>>3)]<<8|s[2+(o>>>3)]<<16|s[3+(o>>>3)]<<24)>>>(7&o)},r.F.U=(t=Uint16Array,n=Uint32Array,{next_code:new t(16),bl_count:new t(16),ordr:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],of0:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],exb:[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0],ldef:new t(32),df0:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],dxb:[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0],ddef:new n(32),flmap:new t(512),fltree:[],fdmap:new t(32),fdtree:[],lmap:new t(32768),ltree:[],ttree:[],dmap:new t(32768),dtree:[],imap:new t(512),itree:[],rev15:new t(32768),lhst:new n(286),dhst:new n(30),ihst:new n(19),lits:new n(15e3),strt:new t(65536),prev:new t(32768)}),(function(){for(var s=r.F.U,o=0;o<32768;o++){var i=o;i=(4278255360&(i=(4042322160&(i=(3435973836&(i=(2863311530&i)>>>1|(1431655765&i)<<1))>>>2|(858993459&i)<<2))>>>4|(252645135&i)<<4))>>>8|(16711935&i)<<8,s.rev15[o]=(i>>>16|i<<16)>>>17}function a(l,c,d){for(;c--!=0;)l.push(0,d)}for(o=0;o<32;o++)s.ldef[o]=s.of0[o]<<3|s.exb[o],s.ddef[o]=s.df0[o]<<4|s.dxb[o];a(s.fltree,144,8),a(s.fltree,112,9),a(s.fltree,24,7),a(s.fltree,8,8),r.F.makeCodes(s.fltree,9),r.F.codes2map(s.fltree,9,s.flmap),r.F.revCodes(s.fltree,9),a(s.fdtree,32,5),r.F.makeCodes(s.fdtree,5),r.F.codes2map(s.fdtree,5,s.fdmap),r.F.revCodes(s.fdtree,5),a(s.itree,19,0),a(s.ltree,286,0),a(s.dtree,30,0),a(s.ttree,320,0)})()})();var lM=oM({__proto__:null,default:aa},[aa]);const $n=(function(){var e={nextZero(d,u){for(;d[u]!=0;)u++;return u},readUshort:(d,u)=>d[u]<<8|d[u+1],writeUshort(d,u,f){d[u]=f>>8&255,d[u+1]=255&f},readUint:(d,u)=>16777216*d[u]+(d[u+1]<<16|d[u+2]<<8|d[u+3]),writeUint(d,u,f){d[u]=f>>24&255,d[u+1]=f>>16&255,d[u+2]=f>>8&255,d[u+3]=255&f},readASCII(d,u,f){let g="";for(let m=0;md.length<2?`0${d}`:d,readUTF8(d,u,f){let g,m="";for(let p=0;p>3)]>>7-((7&k)<<0)&1);b[w]=U[L],b[w+1]=U[L+1],b[w+2]=U[L+2],b[w+3]=F>2)]>>6-((3&k)<<1)&3),b[w]=U[L],b[w+1]=U[L+1],b[w+2]=U[L+2],b[w+3]=F>1)]>>4-((1&k)<<2)&15),b[w]=U[L],b[w+1]=U[L+1],b[w+2]=U[L+2],b[w+3]=F>>3)]>>>7-(7&O)&1))==255*C?0:255;_[j+O]=z<<24|A<<16|A<<8|A}else if(M==2)for(O=0;O>>2)]>>>6-((3&O)<<1)&3))==85*C?0:255,_[j+O]=z<<24|A<<16|A<<8|A;else if(M==4)for(O=0;O>>1)]>>>4-((1&O)<<2)&15))==17*C?0:255,_[j+O]=z<<24|A<<16|A<<8|A;else if(M==8)for(O=0;O>3,C=Math.ceil(M*k/8),w=new Uint8Array(S*C);let E=0;const T=[0,0,4,0,2,0,1],P=[0,4,0,2,0,1,0],L=[8,8,8,4,4,2,2],F=[8,8,4,4,2,2,1];let A=0;for(;A<7;){const O=L[A],z=F[A];let U=0,j=0,Y=T[A];for(;Y>3])>>7-(7&K)&1,w[V*C+(X>>3)]|=D<<7-((7&X)<<0)),k==2&&(D=(D=_[K>>3])>>6-(7&K)&3,w[V*C+(X>>2)]|=D<<6-((3&X)<<1)),k==4&&(D=(D=_[K>>3])>>4-(7&K)&15,w[V*C+(X>>1)]|=D<<4-((1&X)<<2)),k>=8){const Q=V*C+X*N;for(let ne=0;ne>3)+ne]}K+=k,X+=z}G++,V+=O}U*j!=0&&(E+=j*(1+W)),A+=1}return w})(u,d)),u}function r(d,u){return s(new Uint8Array(d.buffer,2,d.length-6),u)}var s=(function(){const d={H:{}};return d.H.N=function(u,f){const g=Uint8Array;let m,p,y=0,b=0,_=0,x=0,M=0,S=0,k=0,N=0,C=0;if(u[0]==3&&u[1]==0)return f||new g(0);const w=d.H,E=w.b,T=w.e,P=w.R,L=w.n,F=w.A,A=w.Z,D=w.m,O=f==null;for(O&&(f=new g(u.length>>>2<<5));y==0;)if(y=E(u,C,1),b=E(u,C+1,2),C+=3,b!=0){if(O&&(f=d.H.W(f,N+(1<<17))),b==1&&(m=D.J,p=D.h,S=511,k=31),b==2){_=T(u,C,5)+257,x=T(u,C+5,5)+1,M=T(u,C+10,4)+4,C+=14;let U=1;for(var z=0;z<38;z+=2)D.Q[z]=0,D.Q[z+1]=0;for(z=0;zU&&(U=B)}C+=3*M,L(D.Q,U),F(D.Q,U,D.u),m=D.w,p=D.d,C=P(D.u,(1<>>4;if(!(j>>>8))f[N++]=j;else{if(j==256)break;{let Y=N+j-254;if(j>264){const X=D.q[j-257];Y=N+(X>>>3)+T(u,C,7&X),C+=7&X}const B=p[A(u,C)&k];C+=15&B;const W=B>>>4,G=D.c[W],V=(G>>>4)+E(u,C,15&G);for(C+=15&G;N>>3),j=u[U-4]|u[U-3]<<8;O&&(f=d.H.W(f,N+j)),f.set(new g(u.buffer,u.byteOffset+U,j),N),C=U+j<<3,N+=j}return f.length==N?f:f.slice(0,N)},d.H.W=function(u,f){const g=u.length;if(f<=g)return u;const m=new Uint8Array(g<<1);return m.set(u,0),m},d.H.R=function(u,f,g,m,p,y){const b=d.H.e,_=d.H.Z;let x=0;for(;x>>4;if(S<=15)y[x]=S,x++;else{let k=0,N=0;S==16?(N=3+b(m,p,2),p+=2,k=y[x-1]):S==17?(N=3+b(m,p,3),p+=3):S==18&&(N=11+b(m,p,7),p+=7);const C=x+N;for(;x>>1;for(;yp&&(p=_),y++}for(;y>1,_=u[y+1],x=b<<4|_,M=f-_;let S=u[y]<>>15-f]=x,S++}},d.H.l=function(u,f){const g=d.H.m.r,m=15-f;for(let p=0;p>>m}},d.H.M=function(u,f,g){g<<=7&f;const m=f>>>3;u[m]|=g,u[m+1]|=g>>>8},d.H.I=function(u,f,g){g<<=7&f;const m=f>>>3;u[m]|=g,u[m+1]|=g>>>8,u[m+2]|=g>>>16},d.H.e=function(u,f,g){return(u[f>>>3]|u[1+(f>>>3)]<<8)>>>(7&f)&(1<>>3]|u[1+(f>>>3)]<<8|u[2+(f>>>3)]<<16)>>>(7&f)&(1<>>3]|u[1+(f>>>3)]<<8|u[2+(f>>>3)]<<16)>>>(7&f)},d.H.i=function(u,f){return(u[f>>>3]|u[1+(f>>>3)]<<8|u[2+(f>>>3)]<<16|u[3+(f>>>3)]<<24)>>>(7&f)},d.H.m=(function(){const u=Uint16Array,f=Uint32Array;return{K:new u(16),j:new u(16),X:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],S:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],T:[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0],q:new u(32),p:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],z:[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0],c:new f(32),J:new u(512),_:[],h:new u(32),$:[],w:new u(32768),C:[],v:[],d:new u(32768),D:[],u:new u(512),Q:[],r:new u(32768),s:new f(286),Y:new f(30),a:new f(19),t:new f(15e3),k:new u(65536),g:new u(32768)}})(),(function(){const u=d.H.m;for(var f=0;f<32768;f++){let m=f;m=(2863311530&m)>>>1|(1431655765&m)<<1,m=(3435973836&m)>>>2|(858993459&m)<<2,m=(4042322160&m)>>>4|(252645135&m)<<4,m=(4278255360&m)>>>8|(16711935&m)<<8,u.r[f]=(m>>>16|m<<16)>>>17}function g(m,p,y){for(;p--!=0;)m.push(0,y)}for(f=0;f<32;f++)u.q[f]=u.S[f]<<3|u.T[f],u.c[f]=u.p[f]<<4|u.z[f];g(u._,144,8),g(u._,112,9),g(u._,24,7),g(u._,8,8),d.H.n(u._,9),d.H.A(u._,9,u.J),d.H.l(u._,9),g(u.$,32,5),d.H.n(u.$,5),d.H.A(u.$,5,u.h),d.H.l(u.$,5),g(u.Q,19,0),g(u.C,286,0),g(u.D,30,0),g(u.v,320,0)})(),d.H.N})();function o(d){return[1,null,3,1,2,null,4][d.ctype]*d.depth}function i(d,u,f,g,m){let p=o(u);const y=Math.ceil(g*p/8);let b,_;p=Math.ceil(p/8);let x=d[f],M=0;if(x>1&&(d[f]=[0,0,1][x-2]),x==3)for(M=p;M>>1)&255;for(let S=0;S>>1);for(;M>>1)}else{for(;M=0&&b>=0?(S=A*u+D<<2,k=(b+A)*m+y+D<<2):(S=(-b+A)*u-y+D<<2,k=A*m+D<<2),_==0)g[k]=d[S],g[k+1]=d[S+1],g[k+2]=d[S+2],g[k+3]=d[S+3];else if(_==1){var N=d[S+3]*.00392156862745098,C=d[S]*N,w=d[S+1]*N,E=d[S+2]*N,T=g[k+3]*(1/255),P=g[k]*T,L=g[k+1]*T,F=g[k+2]*T;const O=1-N,z=N+T*O,U=z==0?0:1/z;g[k+3]=255*z,g[k+0]=(C+P*O)*U,g[k+1]=(w+L*O)*U,g[k+2]=(E+F*O)*U}else if(_==2)N=d[S+3],C=d[S],w=d[S+1],E=d[S+2],T=g[k+3],P=g[k],L=g[k+1],F=g[k+2],N==T&&C==P&&w==L&&E==F?(g[k]=0,g[k+1]=0,g[k+2]=0,g[k+3]=0):(g[k]=C,g[k+1]=w,g[k+2]=E,g[k+3]=N);else if(_==3){if(N=d[S+3],C=d[S],w=d[S+1],E=d[S+2],T=g[k+3],P=g[k],L=g[k+1],F=g[k+2],N==T&&C==P&&w==L&&E==F)continue;if(N<220&&T>20)return!1}return!0}return{decode:function(u){const f=new Uint8Array(u);let g=8;const m=e,p=m.readUshort,y=m.readUint,b={tabs:{},frames:[]},_=new Uint8Array(f.length);let x,M=0,S=0;const k=[137,80,78,71,13,10,26,10];for(var N=0;N<8;N++)if(f[N]!=k[N])throw"The input is not a PNG file!";for(;g>>1:E>>>=1;C[w]=E}return C})(),update(C,w,E,T){for(let P=0;P>>8;return C},crc:(C,w,E)=>4294967295^r.update(4294967295,C,w,E)};function s(C,w,E,T){w[E]+=C[0]*T>>4,w[E+1]+=C[1]*T>>4,w[E+2]+=C[2]*T>>4,w[E+3]+=C[3]*T>>4}function o(C){return Math.max(0,Math.min(255,C))}function i(C,w){const E=C[0]-w[0],T=C[1]-w[1],P=C[2]-w[2],L=C[3]-w[3];return E*E+T*T+P*P+L*L}function a(C,w,E,T,P,L,F){F==null&&(F=1);const A=T.length,D=[];for(var O=0;O>>0&255,V>>>8&255,V>>>16&255,V>>>24&255])}for(O=0;O>2]=z,Y[O>>2]=T[z]}}function l(C,w,E,T,P){P==null&&(P={});const{crc:L}=r,F=t.writeUint,A=t.writeUshort,D=t.writeASCII;let O=8;const z=C.frames.length>1;let U,j=!1,Y=33+(z?20:0);if(P.sRGB!=null&&(Y+=13),P.pHYs!=null&&(Y+=21),P.iCCP!=null&&(U=pako.deflate(P.iCCP),Y+=21+U.length+4),C.ctype==3){for(var B=C.plte.length,W=0;W>>24!=255&&(j=!0);Y+=8+3*B+4+(j?8+1*B+4:0)}for(var G=0;G>>8&255,me=se>>>16&255;V[O+ne+0]=ue,V[O+ne+1]=ee,V[O+ne+2]=me}if(O+=3*B,F(V,O,L(V,O-3*B-4,3*B+4)),O+=4,j){for(F(V,O,B),O+=4,D(V,O,"tRNS"),O+=4,W=0;W>>24&255;O+=B,F(V,O,L(V,O-B-4,B+4)),O+=4}}let K=0;for(G=0;GUe&&(Ue=ot),utlt&&(lt=ut));Ue==-1&&(Ne=Oe=Ue=lt=0),oe&&((1&Ne)==1&&Ne--,(1&Oe)==1&&Oe--);const vt=(Ue-Ne+1)*(lt-Oe+1);vt>2,je>>2);ne.push(se);const oe=new Uint8Array(ge.abuf,Ce,je);z&&a(ue.img,ue.rect.width,ue.rect.height,Q,oe,se),ue.img.set(oe),Ce+=je}}else for(B=0;Bee&&be==fe[G-ee])se[G]=se[G-ee];else{let ge=K[be];if(ge==null&&(K[be]=ge=Q.length,Q.push(be),Q.length>=300))break;se[G]=ge}}}const me=Q.length;for(me<=256&&O==0&&(j=me<=2?1:me<=4?2:me<=16?4:8,j=Math.max(j,D)),B=0;B>1)]|=je[Te+de]<<4-4*(1&de);else if(j==2)for(de=0;de>2)]|=je[Te+de]<<6-2*(3&de);else if(j==1)for(de=0;de>3)]|=je[Te+de]<<7-1*(7&de)}be=ie,U=3,Ce=1}else if(V==0&&X.length==1){ie=new Uint8Array(ee*fe*3);const je=ee*fe;for(G=0;GG&&(G=ne),seV&&(V=se))}G==-1&&(B=W=G=V=0),F&&((1&B)==1&&B--,(1&W)==1&&W--),L={x:B,y:W,width:G-B+1,height:V-W+1};const X=T[P];X.rect=L,X.blend=1,X.img=new Uint8Array(L.width*L.height*4),T[P-1].dispose==0?(e(O,w,E,X.img,L.width,L.height,-L.x,-L.y,0),f(j,w,E,X.img,L)):e(j,w,E,X.img,L.width,L.height,-L.x,-L.y,0)}function f(C,w,E,T,P){e(C,w,E,T,P.width,P.height,-P.x,-P.y,2)}function g(C,w,E,T,P,L,F){const A=[];let D,O=[0,1,2,3,4];L!=-1?O=[L]:(w*T>5e5||E==1)&&(O=[0]),F&&(D={level:0});const z=lM;for(var U=0;U>1)+256&255;if(L==4)for(D=P;D>1)&255;for(D=P;D>1)&255}if(L==4){for(D=0;D>2);let z;if(E.length<2e7)for(var U=0;U>2]=z.ind,P[U>>2]=z.est.rgba;else for(U=0;U>2]=z.ind,P[U>>2]=z.est.rgba}return{abuf:T.buffer,inds:O,plte:A}}function y(C,w,E){E==null&&(E=1e-4);const T=new Uint32Array(C.buffer),P={i0:0,i1:C.length,bst:null,est:null,tdst:0,left:null,right:null};P.bst=S(C,P.i0,P.i1),P.est=k(P.bst);const L=[P];for(;L.lengthA&&(A=L[F].est.L,D=F);if(A=z||O.i1<=z){O.est.L=0;continue}const U={i0:O.i0,i1:z,bst:null,est:null,tdst:0,left:null,right:null};U.bst=S(C,U.i0,U.i1),U.est=k(U.bst);const j={i0:z,i1:O.i1,bst:null,est:null,tdst:0,left:null,right:null};for(j.bst={R:[],m:[],N:O.bst.N-U.bst.N},F=0;F<16;F++)j.bst.R[F]=O.bst.R[F]-U.bst.R[F];for(F=0;F<4;F++)j.bst.m[F]=O.bst.m[F]-U.bst.m[F];j.est=k(j.bst),O.left=U,O.right=j,L[D]=U,L.push(j)}for(L.sort(((A,D)=>D.bst.N-A.bst.N)),F=0;F0&&(F=C.right,A=C.left);const D=b(F,w,E,T,P);if(D.tdst<=L*L)return D;const O=b(A,w,E,T,P);return O.tdstL;)T-=4;if(E>=T)break;const F=w[E>>2];w[E>>2]=w[T>>2],w[T>>2]=F,E+=4,T-=4}for(;M(C,E,P)>L;)E-=4;return E+4}function M(C,w,E){return C[w]*E[0]+C[w+1]*E[1]+C[w+2]*E[2]+C[w+3]*E[3]}function S(C,w,E){const T=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],P=[0,0,0,0],L=E-w>>2;for(let F=w;F>>0}}var N={multVec:(C,w)=>[C[0]*w[0]+C[1]*w[1]+C[2]*w[2]+C[3]*w[3],C[4]*w[0]+C[5]*w[1]+C[6]*w[2]+C[7]*w[3],C[8]*w[0]+C[9]*w[1]+C[10]*w[2]+C[11]*w[3],C[12]*w[0]+C[13]*w[1]+C[14]*w[2]+C[15]*w[3]],dot:(C,w)=>C[0]*w[0]+C[1]*w[1]+C[2]*w[2]+C[3]*w[3],sml:(C,w)=>[C*w[0],C*w[1],C*w[2],C*w[3]]};$n.encode=function(w,E,T,P,L,F,A){P==null&&(P=0),A==null&&(A=!1);const D=d(w,E,T,P,[!1,!1,!1,0,A,!1]);return c(D,-1),l(D,E,T,L,F)},$n.encodeLL=function(w,E,T,P,L,F,A,D){const O={ctype:0+(P==1?0:2)+(L==0?0:4),depth:F,frames:[]},z=(P+L)*F,U=z*E;for(let j=0;j>>0),S(1),S(32),k(3),k(l),k(2835),k(2835),N(8),k(16711680),k(65280),k(255),k(4278190080),k(1466527264),(function C(){for(;_0;){for(y=122+_*a,g=0;g>>24,u.setUint32(y+g,m<<8|p),g+=4;_++}M{t(new Blob([n],{type:"image/bmp"}))}))},_dly:9};var ln={CHROME:"CHROME",FIREFOX:"FIREFOX",DESKTOP_SAFARI:"DESKTOP_SAFARI",IE:"IE",IOS:"IOS",ETC:"ETC"},cM={[ln.CHROME]:16384,[ln.FIREFOX]:11180,[ln.DESKTOP_SAFARI]:16384,[ln.IE]:8192,[ln.IOS]:4096,[ln.ETC]:8192};const rd=typeof window<"u",Jp=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,la=rd&&window.cordova&&window.cordova.require&&window.cordova.require("cordova/modulemapper"),dM=(rd||Jp)&&(la&&la.getOriginalSymbol(window,"File")||typeof File<"u"&&File),Rp=(rd||Jp)&&(la&&la.getOriginalSymbol(window,"FileReader")||typeof FileReader<"u"&&FileReader);function sd(e,t,n=Date.now()){return new Promise((r=>{const s=e.split(","),o=s[0].match(/:(.*?);/)[1],i=globalThis.atob(s[1]);let a=i.length;const l=new Uint8Array(a);for(;a--;)l[a]=i.charCodeAt(a);const c=new Blob([l],{type:o});c.name=t,c.lastModified=n,r(c)}))}function e0(e){return new Promise(((t,n)=>{const r=new Rp;r.onload=()=>t(r.result),r.onerror=s=>n(s),r.readAsDataURL(e)}))}function t0(e){return new Promise(((t,n)=>{const r=new Image;r.onload=()=>t(r),r.onerror=s=>n(s),r.src=e}))}function $r(){if($r.cachedResult!==void 0)return $r.cachedResult;let e=ln.ETC;const{userAgent:t}=navigator;return/Chrom(e|ium)/i.test(t)?e=ln.CHROME:/iP(ad|od|hone)/i.test(t)&&/WebKit/i.test(t)?e=ln.IOS:/Safari/i.test(t)?e=ln.DESKTOP_SAFARI:/Firefox/i.test(t)?e=ln.FIREFOX:(/MSIE/i.test(t)||document.documentMode)&&(e=ln.IE),$r.cachedResult=e,$r.cachedResult}function n0(e,t){const n=$r(),r=cM[n];let s=e,o=t,i=s*o;const a=s>o?o/s:s/o;for(;i>r*r;){const l=(r+s)/2,c=(r+o)/2;lQp.toBlob(e,d))).then(function(d){try{return a=d,a.name=n,a.lastModified=r,c.call(this)}catch(u){return i(u)}}.bind(this),i);{let d=function(){return c.call(this)};if(typeof OffscreenCanvas=="function"&&e instanceof OffscreenCanvas)return e.convertToBlob({type:t,quality:s}).then(function(u){try{return a=u,a.name=n,a.lastModified=r,d.call(this)}catch(f){return i(f)}}.bind(this),i);{let u;return u=e.toDataURL(t,s),sd(u,n,r).then(function(f){try{return a=f,d.call(this)}catch(g){return i(g)}}.bind(this),i)}}}function l(){return o(a)}}))}function Gn(e){e.width=0,e.height=0}function _s(){return new Promise((function(e,t){let n,r,s,o;return _s.cachedResult!==void 0?e(_s.cachedResult):sd("data:image/jpeg;base64,/9j/4QAiRXhpZgAATU0AKgAAAAgAAQESAAMAAAABAAYAAAAAAAD/2wCEAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAf/AABEIAAEAAgMBEQACEQEDEQH/xABKAAEAAAAAAAAAAAAAAAAAAAALEAEAAAAAAAAAAAAAAAAAAAAAAQEAAAAAAAAAAAAAAAAAAAAAEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwA/8H//2Q==","test.jpg",Date.now()).then((function(i){try{return n=i,ua(n).then((function(a){try{return r=a[1],fa(r,n.type,n.name,n.lastModified).then((function(l){try{return s=l,Gn(r),ua(s).then((function(c){try{return o=c[0],_s.cachedResult=o.width===1&&o.height===2,e(_s.cachedResult)}catch(d){return t(d)}}),t)}catch(c){return t(c)}}),t)}catch(l){return t(l)}}),t)}catch(a){return t(a)}}),t)}))}function s0(e){return new Promise(((t,n)=>{const r=new Rp;r.onload=s=>{const o=new DataView(s.target.result);if(o.getUint16(0,!1)!=65496)return t(-2);const i=o.byteLength;let a=2;for(;an(s),r.readAsArrayBuffer(e)}))}function o0(e,t){const{width:n}=e,{height:r}=e,{maxWidthOrHeight:s}=t;let o,i=e;return isFinite(s)&&(n>s||r>s)&&([i,o]=ca(n,r),n>r?(i.width=s,i.height=r/n*s):(i.width=n/r*s,i.height=s),o.drawImage(e,0,0,i.width,i.height),Gn(e)),i}function i0(e,t){const{width:n}=e,{height:r}=e,[s,o]=ca(n,r);switch(t>4&&t<9?(s.width=r,s.height=n):(s.width=n,s.height=r),t){case 2:o.transform(-1,0,0,1,n,0);break;case 3:o.transform(-1,0,0,-1,n,r);break;case 4:o.transform(1,0,0,-1,0,r);break;case 5:o.transform(0,1,1,0,0,0);break;case 6:o.transform(0,1,-1,0,r,0);break;case 7:o.transform(0,-1,-1,0,r,n);break;case 8:o.transform(0,-1,1,0,0,n)}return o.drawImage(e,0,0,n,r),Gn(e),s}function a0(e,t,n=0){return new Promise((function(r,s){let o,i,a,l,c,d,u,f,g,m,p,y,b,_,x,M,S,k,N,C;function w(T=5){if(t.signal&&t.signal.aborted)throw t.signal.reason;o+=T,t.onProgress(Math.min(o,100))}function E(T){if(t.signal&&t.signal.aborted)throw t.signal.reason;o=Math.min(Math.max(T,o),100),t.onProgress(o)}return o=n,i=t.maxIteration||10,a=1024*t.maxSizeMB*1024,w(),ua(e,t).then(function(T){try{return[,l]=T,w(),c=o0(l,t),w(),new Promise((function(P,L){var F;if(!(F=t.exifOrientation))return s0(e).then(function(D){try{return F=D,A.call(this)}catch(O){return L(O)}}.bind(this),L);function A(){return P(F)}return A.call(this)})).then(function(P){try{return d=P,w(),_s().then(function(L){try{return u=L?c:i0(c,d),w(),f=t.initialQuality||1,g=t.fileType||e.type,fa(u,g,e.name,e.lastModified,f).then(function(F){try{{let D=function(){if(i--&&(x>a||x>b)){let z,U;return z=C?.95*N.width:N.width,U=C?.95*N.height:N.height,[S,k]=ca(z,U),k.drawImage(N,0,0,z,U),f*=g==="image/png"?.85:.95,fa(S,g,e.name,e.lastModified,f).then((function(j){try{return M=j,Gn(N),N=S,x=M.size,E(Math.min(99,Math.floor((_-x)/(_-a)*100))),D}catch(Y){return s(Y)}}),s)}return[1]},O=function(){return Gn(N),Gn(S),Gn(c),Gn(u),Gn(l),E(100),r(M)};if(m=F,w(),p=m.size>a,y=m.size>e.size,!p&&!y)return E(100),r(m);var A;return b=e.size,_=m.size,x=_,N=u,C=!t.alwaysKeepResolution&&p,(A=function(z){for(;z;){if(z.then)return void z.then(A,s);try{if(z.pop){if(z.length)return z.pop()?O.call(this):z;z=D}else z=z.call(this)}catch(U){return s(U)}}}.bind(this))(D)}}catch(D){return s(D)}}.bind(this),s)}catch(F){return s(F)}}.bind(this),s)}catch(L){return s(L)}}.bind(this),s)}catch(P){return s(P)}}.bind(this),s)}))}const uM=` let scriptImported = false self.addEventListener('message', async (e) => { const { file, id, imageCompressionLibUrl, options } = e.data @@ -227,11 +228,11 @@ self.addEventListener('message', async (e) => { self.postMessage({ error: e.message + '\\n' + e.stack, id }) } }) -`;let Fc;function cE(e,t){return new Promise(((n,r)=>{Fc||(Fc=(function(i){const a=[];return a.push(i),URL.createObjectURL(new Blob(a))})(lE));const s=new Worker(Fc);s.addEventListener("message",(function(i){if(t.signal&&t.signal.aborted)s.terminate();else if(i.data.progress===void 0){if(i.data.error)return r(new Error(i.data.error)),void s.terminate();n(i.data.file),s.terminate()}else t.onProgress(i.data.progress)})),s.addEventListener("error",r),t.signal&&t.signal.addEventListener("abort",(()=>{r(t.signal.reason),s.terminate()})),s.postMessage({file:e,imageCompressionLibUrl:t.libURL,options:{...t,onProgress:void 0,signal:void 0}})}))}function Bt(e,t){return new Promise((function(n,r){let s,o,i,a,l,c;if(s={...t},i=0,{onProgress:a}=s,s.maxSizeMB=s.maxSizeMB||Number.POSITIVE_INFINITY,l=typeof s.useWebWorker!="boolean"||s.useWebWorker,delete s.useWebWorker,s.onProgress=g=>{i=g,typeof a=="function"&&a(i)},!(e instanceof Blob||e instanceof aE))return r(new Error("The file given is not an instance of Blob or File"));if(!/^image/.test(e.type))return r(new Error("The file given is not an image"));if(c=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,!l||typeof Worker!="function"||c)return Mp(e,s).then(function(g){try{return o=g,f.call(this)}catch(m){return r(m)}}.bind(this),r);var d=function(){try{return f.call(this)}catch(g){return r(g)}}.bind(this),u=function(g){try{return Mp(e,s).then((function(m){try{return o=m,d()}catch(p){return r(p)}}),r)}catch(m){return r(m)}};try{return s.libURL=s.libURL||"https://cdn.jsdelivr.net/npm/browser-image-compression@2.0.2/dist/browser-image-compression.js",cE(e,s).then((function(g){try{return o=g,d()}catch{return u()}}),u)}catch{u()}function f(){try{o.name=e.name,o.lastModified=e.lastModified}catch{}try{s.preserveExif&&e.type==="image/jpeg"&&(!s.fileType||s.fileType&&s.fileType===e.type)&&(o=mp(e,o))}catch{}return n(o)}}))}Bt.getDataUrlFromFile=xp,Bt.getFilefromDataUrl=$c,Bt.loadImage=wp,Bt.drawImageInCanvas=Cp,Bt.drawFileInCanvas=Zi,Bt.canvasToFile=Qi,Bt.getExifOrientation=Sp,Bt.handleMaxWidthOrHeight=_p,Bt.followExifOrientation=Ep,Bt.cleanupCanvasMemory=Vn,Bt.isAutoOrientationInBrowser=us,Bt.approximateBelowMaximumCanvasSizeOfBrowser=kp,Bt.copyExifWithoutOrientation=mp,Bt.getBrowserName=Sr,Bt.version="2.0.2";const dE=window.G7Core,Vc=e=>{const t=["B","KB","MB","GB"];let n=0,r=e;for(;r>=1024&&n{if(e&&typeof e=="object"){const t=e;if(t.response?.data?.message)return t.response.data.message;if(t.response?.data?.errors){const n=Object.values(t.response.data.errors)[0];if(Array.isArray(n)&&n[0])return n[0]}if(t.message)return t.message}return e instanceof Error?e.message:"업로드 실패"},fE=e=>e?e.startsWith("image/")?"fa-file-image":e.startsWith("video/")?"fa-file-video":e.startsWith("audio/")?"fa-file-audio":e==="application/pdf"?"fa-file-pdf":e.includes("word")||e.includes("document")?"fa-file-word":e.includes("excel")||e.includes("spreadsheet")?"fa-file-excel":e.includes("zip")||e.includes("compressed")?"fa-file-zipper":"fa-file":"fa-file",Pt=(e,t)=>dE?.t?.(e,t)??e,Np=window.G7Core?.createLogger?.("Comp:FileUploader")??{log:(...e)=>console.log("[Comp:FileUploader]",...e),warn:(...e)=>console.warn("[Comp:FileUploader]",...e),error:(...e)=>console.error("[Comp:FileUploader]",...e)},hE="2.0.2";function gE(){const e=window?.G7Core?.asset;if(typeof e?.template=="function")return e.template("sirsoft-admin_basic",`vendor/browser-image-compression/${hE}/browser-image-compression.js`)}const _r=window.G7Core;function pE(e){const{attachmentableType:t,attachmentableId:n,collection:r,maxFiles:s,maxSize:o,maxConcurrentUploads:i,accept:a,imageCompression:l,roleIds:c,autoUpload:d,initialFiles:u,endpoints:f,onFilesChange:g,onUploadComplete:m,onUploadError:p,onRemove:y,onReorder:b,uploadTriggerEvent:_,confirmBeforeRemove:x,uploadParams:E}=e,[S,w]=v.useState(u),[N,C]=v.useState([]),[k,M]=v.useState(!1),T=v.useRef(null),L=v.useRef(0),P=v.useRef(new Set),F=v.useRef(new Map),D=v.useRef(null),[A,O]=v.useState(!1),[V,H]=v.useState(null),[W,j]=v.useState(!1),U=v.useRef(!1),[B,G]=v.useState([]),[z,K]=v.useState(!1),[Y,Z]=v.useState(0),ee=v.useRef(0),[te,ce]=v.useState(new Map),J=v.useRef(new Map),he=v.useRef(g);he.current=g,v.useEffect(()=>{he.current?.(N)},[N]),v.useEffect(()=>{if(U.current)return;const ne=u.filter(ge=>!P.current.has(ge.id)&&(!ge.hash||!P.current.has(ge.hash))),fe=new Set(ne.map(ge=>ge.id)),xe=Array.from(F.current.values()).filter(ge=>!fe.has(ge.id)&&!P.current.has(ge.id));w([...ne,...xe])},[u]);const le=v.useCallback(async ne=>{const fe={maxSizeMB:l?.maxSizeMB??1,maxWidthOrHeight:l?.maxWidthOrHeight??1920,useWebWorker:!0,libURL:gE()};return await Bt(ne,fe)},[l]),ae=v.useCallback(async ne=>{const fe=S.length+N.length,xe=Math.max(0,s-fe),ge=Array.from(ne).slice(0,xe);if(ne.length>xe){const be=Array.from(ne).slice(xe),Ve=Pt("attachment.upload_limit_exceeded",{max:s});p?.(Ve,be[0]??ne[0])}for(const be of ge){if(be.size>o*1024*1024){p?.(`[${be.name}] 파일 크기(${Vc(be.size)})가 최대 허용 크기(${o}MB)를 초과합니다.`,be);continue}if(a){const De="."+be.name.split(".").pop()?.toLowerCase();if(!a.split(",").map(Me=>Me.trim().toLowerCase()).includes(De)){p?.(`[${be.name}] 허용되지 않는 파일 형식입니다. (허용: ${a})`,be);continue}}const Ve={id:`pending-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,file:be,original_filename:be.name,mime_type:be.type,size:be.size,size_formatted:Vc(be.size),status:"pending",progress:0};if(be.type.startsWith("image/")&&(Ve.preview=URL.createObjectURL(be)),C(De=>[...De,Ve]),be.type.startsWith("image/")&&l){C(De=>De.map($e=>$e.id===Ve.id?{...$e,status:"compressing"}:$e));try{const De=await le(be);C($e=>$e.map(Me=>Me.id===Ve.id?{...Me,compressedBlob:De,size:De.size,size_formatted:Vc(De.size),status:"pending",progress:0}:Me))}catch{C(De=>De.map($e=>$e.id===Ve.id?{...$e,status:"error",error:"이미지 압축 실패"}:$e))}}}},[S.length,N.length,s,o,a,l,le,p]),Se=v.useCallback(async ne=>{const fe=new FormData,xe=ne.compressedBlob?new File([ne.compressedBlob],ne.original_filename,{type:ne.mime_type}):ne.file;fe.append("file",xe),t&&fe.append("attachmentable_type",t),n&&fe.append("attachmentable_id",String(n)),fe.append("collection",r),c.forEach(ge=>{fe.append("role_ids[]",String(ge))}),E&&Object.entries(E).forEach(([ge,be])=>{fe.append(ge,be)});try{const ge=await _r.api.post(f.upload,fe,{headers:{"Content-Type":"multipart/form-data"},onUploadProgress:Ve=>{const De=Math.round(Ve.loaded*100/(Ve.total??1));C($e=>$e.map(Me=>Me.id===ne.id?{...Me,progress:De}:Me))}});return ge?.data?.data??ge?.data}catch(ge){const be=uE(ge);throw new Error(be)}},[t,n,r,c,f.upload]),ue=v.useCallback(async()=>{const ne=N.filter(De=>De.status==="pending"||De.status==="error");if(ne.length===0)return D.current=S,[];const fe=[],xe=new Map,ge=[...ne],be=async()=>{for(;ge.length>0&&L.current$e.map(Me=>Me.id===De.id?{...Me,status:"uploading",progress:0}:Me));try{const $e=await Se(De);if($e)fe.push($e),xe.set(String(De.id),String($e.hash)),F.current.set($e.id,$e),C(Me=>Me.filter(qe=>qe.id!==De.id)),w(Me=>[...Me,$e]),G(Me=>{if(Me.length===0)return Me;const qe=String(De.id);return Me.some(ye=>String(ye)===qe)?Me.map(ye=>String(ye)===qe?String($e.hash):ye):Me}),De.preview&&URL.revokeObjectURL(De.preview);else{const Me=Pt("attachment.upload_response_invalid");C(qe=>qe.map(ot=>ot.id===De.id?{...ot,status:"error",error:Me}:ot)),p?.(`[${De.original_filename}] ${Me}`,De.file)}}catch($e){const Me=$e instanceof Error?$e.message:"업로드 실패";C(qe=>qe.map(ot=>ot.id===De.id?{...ot,status:"error",error:Me}:ot)),p?.(`[${De.original_filename}] ${Me}`,De.file)}finally{L.current--}}},Ve=Array(Math.min(i,ne.length)).fill(null).map(()=>be());if(await Promise.all(Ve),fe.length>0){m?.(fe);const De=[...S,...fe];if(B.length>0){const $e=B.map(ot=>xe.get(String(ot))??ot),Me=new Map($e.map((ot,ye)=>[String(ot),ye])),qe=[...De].sort((ot,ye)=>{const Ce=Me.get(String(ot.hash))??De.length,Fe=Me.get(String(ye.hash))??De.length;return Ce-Fe}).map((ot,ye)=>({...ot,sort_order:ye,order:ye+1}));D.current=qe,f.reorder&&b&&b(qe)}else D.current=De.map(($e,Me)=>({...$e,sort_order:Me,order:Me+1}))}else D.current=S;return fe},[N,i,Se,m,p,B,S,b,f.reorder]);v.useEffect(()=>{if(!_)return;const ne=_r.componentEvent.on(_,async()=>{const fe=await ue(),xe=D.current??[...S,...fe];return{uploadedAttachments:fe,existingFiles:S,allFiles:xe}});return()=>{ne()}},[_,ue,S]),v.useEffect(()=>{d&&N.some(ne=>ne.status==="pending")&&ue()},[d,N,ue]);const pe=v.useCallback(async ne=>{j(!0);try{if(ne.id&&f.delete){const xe=f.delete.replace(":id",String(ne.id));await _r.api.delete(xe)}const fe=ne.hash||ne.id;ne.id&&(P.current.add(ne.id),F.current.delete(ne.id)),ne.hash&&P.current.add(ne.hash),w(xe=>xe.filter(ge=>(ge.hash||ge.id)!==fe)),y?.(ne.hash||ne.id),O(!1),H(null)}catch{Np.error("첨부파일 삭제 실패")}finally{j(!1)}},[y,f.delete]),we=v.useCallback(async ne=>{"hash"in ne?x?(H(ne),O(!0)):await pe(ne):(ne.preview&&URL.revokeObjectURL(ne.preview),C(fe=>fe.filter(xe=>xe.id!==ne.id)))},[x,pe]),He=v.useCallback(ne=>{C(fe=>fe.map(xe=>xe.id===ne.id?{...xe,status:"pending",error:void 0}:xe))},[]),se=v.useCallback(async ne=>{const{arrayMove:fe}=await Promise.resolve().then(()=>FS),{active:xe,over:ge}=ne;if(!ge||xe.id===ge.id)return;const be=[...S,...N];let Ve;if(B.length===0)Ve=be;else{const Ce=new Map(B.map((Fe,nt)=>[String(Fe),nt]));Ve=[...be].sort((Fe,nt)=>{const pt="hash"in Fe?String(Fe.hash):String(Fe.id),it="hash"in nt?String(nt.hash):String(nt.id);return(Ce.get(pt)??be.length)-(Ce.get(it)??be.length)})}const De=Ve.findIndex(Ce=>"hash"in Ce?Ce.hash===xe.id:Ce.id===xe.id),$e=Ve.findIndex(Ce=>"hash"in Ce?Ce.hash===ge.id:Ce.id===ge.id),Me=fe(Ve,De,$e);G(Me.map(Ce=>"hash"in Ce?Ce.hash:Ce.id));const qe=Me.filter(Ce=>"hash"in Ce),ot=Me.filter(Ce=>!("hash"in Ce));U.current=!0,w(qe),C(ot);const ye=qe.map((Ce,Fe)=>({...Ce,sort_order:Fe,order:Fe+1}));if(qe.length>0&&f.reorder){const Ce=qe.map((Fe,nt)=>({id:Fe.id,order:nt+1}));try{const Fe=await _r.api.patch(f.reorder,{order:Ce});_r.toast.success(Fe.message)}catch(Fe){const nt=Fe instanceof Error?Fe.message:Pt("attachment.reorder_failed");_r.toast.error(nt)}}b?.(ye)},[S,N,B,f.reorder,b]),Oe=v.useMemo(()=>[...S,...N].filter(ne=>"is_image"in ne?ne.is_image:ne.mime_type?.startsWith("image/")??!1),[S,N]),Le=v.useCallback(ne=>{const fe=Oe.findIndex(xe=>"hash"in ne&&"hash"in xe?xe.hash===ne.hash:"id"in ne&&"id"in xe&&!("hash"in ne)&&!("hash"in xe)?xe.id===ne.id:!1);fe!==-1&&(ee.current+=1,Z(fe),K(!0))},[Oe]);v.useEffect(()=>{let ne=!1;return(async()=>{const xe=S.filter(be=>be.is_image),ge=new Set(xe.map(be=>be.id));for(const[be,Ve]of J.current)ge.has(be)||(URL.revokeObjectURL(Ve),J.current.delete(be));for(const be of xe){if(ne)break;if(!J.current.has(be.id)){if(Dc(be.download_url)){J.current.set(be.id,be.download_url),ce(new Map(J.current));continue}try{const Ve=await _r.api.get(be.download_url,{responseType:"blob"});if(!ne&&Ve){const De=URL.createObjectURL(Ve);J.current.set(be.id,De),ce(new Map(J.current))}}catch(Ve){Np.error("Failed to load authenticated image:",Ve)}}}})(),()=>{ne=!0}},[S]),v.useEffect(()=>()=>{J.current.forEach(ne=>URL.revokeObjectURL(ne)),J.current.clear()},[]);const Ie=v.useCallback(async ne=>{const{executeImageDownload:fe}=await Promise.resolve().then(()=>R2);await fe({src:ne.download_url,downloadUrl:ne.download_url,filename:ne.original_filename,downloadRequiresAuth:!0})},[]),Ue=v.useMemo(()=>{const ne=[...S,...N];if(B.length===0)return ne;const fe=new Map(B.map((xe,ge)=>[String(xe),ge]));return[...ne].sort((xe,ge)=>{const be="hash"in xe?String(xe.hash):String(xe.id),Ve="hash"in ge?String(ge.hash):String(ge.id),De=fe.get(be)??ne.length,$e=fe.get(Ve)??ne.length;return De-$e})},[S,N,B]),et=Ue.length,bt=et>0,Ge=etC([]),[]),Be=v.useCallback(()=>N,[N]);return{existingFiles:S,pendingFiles:N,isDragOver:k,setIsDragOver:M,isDeleting:W,totalCount:et,hasFiles:bt,canAddMore:Ge,allItems:Ue,imageFiles:Oe,handleFiles:ae,handleRemove:we,handleRetry:He,handleUploadAll:ue,handleOpenGallery:Le,handleDownload:Ie,handleDragEnd:se,inputRef:T,galleryOpen:z,setGalleryOpen:K,galleryStartIndex:Y,galleryKeyRef:ee,confirmDialogOpen:A,setConfirmDialogOpen:O,itemToDelete:V,executeRemoveAttachment:pe,authenticatedImageUrls:te,clear:ft,getPendingFiles:Be}}const mE=({isDragOver:e,canAddMore:t,onFiles:n,setIsDragOver:r,inputRef:s,accept:o,maxFiles:i,maxSize:a,disabled:l,children:c})=>{const d=t&&!l;return h.jsxs(I,{className:` +`;let od;function fM(e,t){return new Promise(((n,r)=>{od||(od=(function(i){const a=[];return a.push(i),URL.createObjectURL(new Blob(a))})(uM));const s=new Worker(od);s.addEventListener("message",(function(i){if(t.signal&&t.signal.aborted)s.terminate();else if(i.data.progress===void 0){if(i.data.error)return r(new Error(i.data.error)),void s.terminate();n(i.data.file),s.terminate()}else t.onProgress(i.data.progress)})),s.addEventListener("error",r),t.signal&&t.signal.addEventListener("abort",(()=>{r(t.signal.reason),s.terminate()})),s.postMessage({file:e,imageCompressionLibUrl:t.libURL,options:{...t,onProgress:void 0,signal:void 0}})}))}function Qt(e,t){return new Promise((function(n,r){let s,o,i,a,l,c;if(s={...t},i=0,{onProgress:a}=s,s.maxSizeMB=s.maxSizeMB||Number.POSITIVE_INFINITY,l=typeof s.useWebWorker!="boolean"||s.useWebWorker,delete s.useWebWorker,s.onProgress=g=>{i=g,typeof a=="function"&&a(i)},!(e instanceof Blob||e instanceof dM))return r(new Error("The file given is not an instance of Blob or File"));if(!/^image/.test(e.type))return r(new Error("The file given is not an image"));if(c=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,!l||typeof Worker!="function"||c)return a0(e,s).then(function(g){try{return o=g,f.call(this)}catch(m){return r(m)}}.bind(this),r);var d=function(){try{return f.call(this)}catch(g){return r(g)}}.bind(this),u=function(g){try{return a0(e,s).then((function(m){try{return o=m,d()}catch(p){return r(p)}}),r)}catch(m){return r(m)}};try{return s.libURL=s.libURL||"https://cdn.jsdelivr.net/npm/browser-image-compression@2.0.2/dist/browser-image-compression.js",fM(e,s).then((function(g){try{return o=g,d()}catch{return u()}}),u)}catch{u()}function f(){try{o.name=e.name,o.lastModified=e.lastModified}catch{}try{s.preserveExif&&e.type==="image/jpeg"&&(!s.fileType||s.fileType&&s.fileType===e.type)&&(o=Zp(e,o))}catch{}return n(o)}}))}Qt.getDataUrlFromFile=e0,Qt.getFilefromDataUrl=sd,Qt.loadImage=t0,Qt.drawImageInCanvas=r0,Qt.drawFileInCanvas=ua,Qt.canvasToFile=fa,Qt.getExifOrientation=s0,Qt.handleMaxWidthOrHeight=o0,Qt.followExifOrientation=i0,Qt.cleanupCanvasMemory=Gn,Qt.isAutoOrientationInBrowser=_s,Qt.approximateBelowMaximumCanvasSizeOfBrowser=n0,Qt.copyExifWithoutOrientation=Zp,Qt.getBrowserName=$r,Qt.version="2.0.2";const hM=window.G7Core,id=e=>{const t=["B","KB","MB","GB"];let n=0,r=e;for(;r>=1024&&n{if(e&&typeof e=="object"){const t=e;if(t.response?.data?.message)return t.response.data.message;if(t.response?.data?.errors){const n=Object.values(t.response.data.errors)[0];if(Array.isArray(n)&&n[0])return n[0]}if(t.message)return t.message}return e instanceof Error?e.message:"업로드 실패"},pM=e=>e?e.startsWith("image/")?"fa-file-image":e.startsWith("video/")?"fa-file-video":e.startsWith("audio/")?"fa-file-audio":e==="application/pdf"?"fa-file-pdf":e.includes("word")||e.includes("document")?"fa-file-word":e.includes("excel")||e.includes("spreadsheet")?"fa-file-excel":e.includes("zip")||e.includes("compressed")?"fa-file-zipper":"fa-file":"fa-file",Ht=(e,t)=>hM?.t?.(e,t)??e,l0=window.G7Core?.createLogger?.("Comp:FileUploader")??{log:(...e)=>console.log("[Comp:FileUploader]",...e),warn:(...e)=>console.warn("[Comp:FileUploader]",...e),error:(...e)=>console.error("[Comp:FileUploader]",...e)},mM="2.0.2";function bM(){const e=window?.G7Core?.asset;if(typeof e?.template=="function")return e.template("sirsoft-admin_basic",`vendor/browser-image-compression/${mM}/browser-image-compression.js`)}const Fr=window.G7Core;function yM(e){const{attachmentableType:t,attachmentableId:n,collection:r,maxFiles:s,maxSize:o,maxConcurrentUploads:i,accept:a,imageCompression:l,roleIds:c,autoUpload:d,initialFiles:u,endpoints:f,onFilesChange:g,onUploadComplete:m,onUploadError:p,onRemove:y,onReorder:b,uploadTriggerEvent:_,confirmBeforeRemove:x,uploadParams:M}=e,[S,k]=v.useState(u),[N,C]=v.useState([]),[w,E]=v.useState(!1),T=v.useRef(null),P=v.useRef(0),L=v.useRef(new Set),F=v.useRef(new Map),A=v.useRef(null),[D,O]=v.useState(!1),[z,U]=v.useState(null),[j,Y]=v.useState(!1),B=v.useRef(!1),[W,G]=v.useState([]),[V,X]=v.useState(!1),[K,Q]=v.useState(0),ne=v.useRef(0),[se,ue]=v.useState(new Map),ee=v.useRef(new Map),me=v.useRef(g);me.current=g,v.useEffect(()=>{me.current?.(N)},[N]),v.useEffect(()=>{if(B.current)return;const te=u.filter(xe=>!L.current.has(xe.id)&&(!xe.hash||!L.current.has(xe.hash))),pe=new Set(te.map(xe=>xe.id)),we=Array.from(F.current.values()).filter(xe=>!pe.has(xe.id)&&!L.current.has(xe.id));k([...te,...we])},[u]);const ie=v.useCallback(async te=>{const pe={maxSizeMB:l?.maxSizeMB??1,maxWidthOrHeight:l?.maxWidthOrHeight??1920,useWebWorker:!0,libURL:bM()};return await Qt(te,pe)},[l]),de=v.useCallback(async te=>{const pe=S.length+N.length,we=Math.max(0,s-pe),xe=Array.from(te).slice(0,we);if(te.length>we){const ke=Array.from(te).slice(we),Be=Ht("attachment.upload_limit_exceeded",{max:s});p?.(Be,ke[0]??te[0])}for(const ke of xe){if(ke.size>o*1024*1024){p?.(`[${ke.name}] 파일 크기(${id(ke.size)})가 최대 허용 크기(${o}MB)를 초과합니다.`,ke);continue}if(a){const Le="."+ke.name.split(".").pop()?.toLowerCase();if(!a.split(",").map(Ie=>Ie.trim().toLowerCase()).includes(Le)){p?.(`[${ke.name}] 허용되지 않는 파일 형식입니다. (허용: ${a})`,ke);continue}}const Be={id:`pending-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,file:ke,original_filename:ke.name,mime_type:ke.type,size:ke.size,size_formatted:id(ke.size),status:"pending",progress:0};if(ke.type.startsWith("image/")&&(Be.preview=URL.createObjectURL(ke)),C(Le=>[...Le,Be]),ke.type.startsWith("image/")&&l){C(Le=>Le.map(ze=>ze.id===Be.id?{...ze,status:"compressing"}:ze));try{const Le=await ie(ke);C(ze=>ze.map(Ie=>Ie.id===Be.id?{...Ie,compressedBlob:Le,size:Le.size,size_formatted:id(Le.size),status:"pending",progress:0}:Ie))}catch{C(Le=>Le.map(ze=>ze.id===Be.id?{...ze,status:"error",error:"이미지 압축 실패"}:ze))}}}},[S.length,N.length,s,o,a,l,ie,p]),fe=v.useCallback(async te=>{const pe=new FormData,we=te.compressedBlob?new File([te.compressedBlob],te.original_filename,{type:te.mime_type}):te.file;pe.append("file",we),t&&pe.append("attachmentable_type",t),n&&pe.append("attachmentable_id",String(n)),pe.append("collection",r),c.forEach(xe=>{pe.append("role_ids[]",String(xe))}),M&&Object.entries(M).forEach(([xe,ke])=>{pe.append(xe,ke)});try{const xe=await Fr.api.post(f.upload,pe,{headers:{"Content-Type":"multipart/form-data"},onUploadProgress:Be=>{const Le=Math.round(Be.loaded*100/(Be.total??1));C(ze=>ze.map(Ie=>Ie.id===te.id?{...Ie,progress:Le}:Ie))}});return xe?.data?.data??xe?.data}catch(xe){const ke=gM(xe);throw new Error(ke)}},[t,n,r,c,f.upload]),be=v.useCallback(async()=>{const te=N.filter(Le=>Le.status==="pending"||Le.status==="error");if(te.length===0)return A.current=S,[];const pe=[],we=new Map,xe=[...te],ke=async()=>{for(;xe.length>0&&P.currentze.map(Ie=>Ie.id===Le.id?{...Ie,status:"uploading",progress:0}:Ie));try{const ze=await fe(Le);if(ze)pe.push(ze),we.set(String(Le.id),String(ze.hash)),F.current.set(ze.id,ze),C(Ie=>Ie.filter(qe=>qe.id!==Le.id)),k(Ie=>[...Ie,ze]),G(Ie=>{if(Ie.length===0)return Ie;const qe=String(Le.id);return Ie.some(Ne=>String(Ne)===qe)?Ie.map(Ne=>String(Ne)===qe?String(ze.hash):Ne):Ie}),Le.preview&&URL.revokeObjectURL(Le.preview);else{const Ie=Ht("attachment.upload_response_invalid");C(qe=>qe.map(Re=>Re.id===Le.id?{...Re,status:"error",error:Ie}:Re)),p?.(`[${Le.original_filename}] ${Ie}`,Le.file)}}catch(ze){const Ie=ze instanceof Error?ze.message:"업로드 실패";C(qe=>qe.map(Re=>Re.id===Le.id?{...Re,status:"error",error:Ie}:Re)),p?.(`[${Le.original_filename}] ${Ie}`,Le.file)}finally{P.current--}}},Be=Array(Math.min(i,te.length)).fill(null).map(()=>ke());if(await Promise.all(Be),pe.length>0){m?.(pe);const Le=[...S,...pe];if(W.length>0){const ze=W.map(Re=>we.get(String(Re))??Re),Ie=new Map(ze.map((Re,Ne)=>[String(Re),Ne])),qe=[...Le].sort((Re,Ne)=>{const Oe=Ie.get(String(Re.hash))??Le.length,Ue=Ie.get(String(Ne.hash))??Le.length;return Oe-Ue}).map((Re,Ne)=>({...Re,sort_order:Ne,order:Ne+1}));A.current=qe,f.reorder&&b&&b(qe)}else A.current=Le.map((ze,Ie)=>({...ze,sort_order:Ie,order:Ie+1}))}else A.current=S;return pe},[N,i,fe,m,p,W,S,b,f.reorder]);v.useEffect(()=>{if(!_)return;const te=Fr.componentEvent.on(_,async()=>{const pe=await be(),we=A.current??[...S,...pe];return{uploadedAttachments:pe,existingFiles:S,allFiles:we}});return()=>{te()}},[_,be,S]),v.useEffect(()=>{d&&N.some(te=>te.status==="pending")&&be()},[d,N,be]);const ge=v.useCallback(async te=>{Y(!0);try{if(te.id&&f.delete){const we=f.delete.replace(":id",String(te.id));await Fr.api.delete(we)}const pe=te.hash||te.id;te.id&&(L.current.add(te.id),F.current.delete(te.id)),te.hash&&L.current.add(te.hash),k(we=>we.filter(xe=>(xe.hash||xe.id)!==pe)),y?.(te.hash||te.id),O(!1),U(null)}catch{l0.error("첨부파일 삭제 실패")}finally{Y(!1)}},[y,f.delete]),Ce=v.useCallback(async te=>{"hash"in te?x?(U(te),O(!0)):await ge(te):(te.preview&&URL.revokeObjectURL(te.preview),C(pe=>pe.filter(we=>we.id!==te.id)))},[x,ge]),je=v.useCallback(te=>{C(pe=>pe.map(we=>we.id===te.id?{...we,status:"pending",error:void 0}:we))},[]),oe=v.useCallback(async te=>{const{arrayMove:pe}=await Promise.resolve().then(()=>H_),{active:we,over:xe}=te;if(!xe||we.id===xe.id)return;const ke=[...S,...N];let Be;if(W.length===0)Be=ke;else{const Oe=new Map(W.map((Ue,lt)=>[String(Ue),lt]));Be=[...ke].sort((Ue,lt)=>{const vt="hash"in Ue?String(Ue.hash):String(Ue.id),ut="hash"in lt?String(lt.hash):String(lt.id);return(Oe.get(vt)??ke.length)-(Oe.get(ut)??ke.length)})}const Le=Be.findIndex(Oe=>"hash"in Oe?Oe.hash===we.id:Oe.id===we.id),ze=Be.findIndex(Oe=>"hash"in Oe?Oe.hash===xe.id:Oe.id===xe.id),Ie=pe(Be,Le,ze);G(Ie.map(Oe=>"hash"in Oe?Oe.hash:Oe.id));const qe=Ie.filter(Oe=>"hash"in Oe),Re=Ie.filter(Oe=>!("hash"in Oe));B.current=!0,k(qe),C(Re);const Ne=qe.map((Oe,Ue)=>({...Oe,sort_order:Ue,order:Ue+1}));if(qe.length>0&&f.reorder){const Oe=qe.map((Ue,lt)=>({id:Ue.id,order:lt+1}));try{const Ue=await Fr.api.patch(f.reorder,{order:Oe});Fr.toast.success(Ue.message)}catch(Ue){const lt=Ue instanceof Error?Ue.message:Ht("attachment.reorder_failed");Fr.toast.error(lt)}}b?.(Ne)},[S,N,W,f.reorder,b]),Te=v.useMemo(()=>[...S,...N].filter(te=>"is_image"in te?te.is_image:te.mime_type?.startsWith("image/")??!1),[S,N]),Pe=v.useCallback(te=>{const pe=Te.findIndex(we=>"hash"in te&&"hash"in we?we.hash===te.hash:"id"in te&&"id"in we&&!("hash"in te)&&!("hash"in we)?we.id===te.id:!1);pe!==-1&&(ne.current+=1,Q(pe),X(!0))},[Te]);v.useEffect(()=>{let te=!1;return(async()=>{const we=S.filter(ke=>ke.is_image),xe=new Set(we.map(ke=>ke.id));for(const[ke,Be]of ee.current)xe.has(ke)||(URL.revokeObjectURL(Be),ee.current.delete(ke));for(const ke of we){if(te)break;if(!ee.current.has(ke.id)){if(ed(ke.download_url)){ee.current.set(ke.id,ke.download_url),ue(new Map(ee.current));continue}try{const Be=await Fr.api.get(ke.download_url,{responseType:"blob"});if(!te&&Be){const Le=URL.createObjectURL(Be);ee.current.set(ke.id,Le),ue(new Map(ee.current))}}catch(Be){l0.error("Failed to load authenticated image:",Be)}}}})(),()=>{te=!0}},[S]),v.useEffect(()=>()=>{ee.current.forEach(te=>URL.revokeObjectURL(te)),ee.current.clear()},[]);const Fe=v.useCallback(async te=>{const{executeImageDownload:pe}=await Promise.resolve().then(()=>nM);await pe({src:te.download_url,downloadUrl:te.download_url,filename:te.original_filename,downloadRequiresAuth:!0})},[]),Ke=v.useMemo(()=>{const te=[...S,...N];if(W.length===0)return te;const pe=new Map(W.map((we,xe)=>[String(we),xe]));return[...te].sort((we,xe)=>{const ke="hash"in we?String(we.hash):String(we.id),Be="hash"in xe?String(xe.hash):String(xe.id),Le=pe.get(ke)??te.length,ze=pe.get(Be)??te.length;return Le-ze})},[S,N,W]),nt=Ke.length,dt=nt>0,We=ntC([]),[]),Ge=v.useCallback(()=>N,[N]);return{existingFiles:S,pendingFiles:N,isDragOver:w,setIsDragOver:E,isDeleting:j,totalCount:nt,hasFiles:dt,canAddMore:We,allItems:Ke,imageFiles:Te,handleFiles:de,handleRemove:Ce,handleRetry:je,handleUploadAll:be,handleOpenGallery:Pe,handleDownload:Fe,handleDragEnd:oe,inputRef:T,galleryOpen:V,setGalleryOpen:X,galleryStartIndex:K,galleryKeyRef:ne,confirmDialogOpen:D,setConfirmDialogOpen:O,itemToDelete:z,executeRemoveAttachment:ge,authenticatedImageUrls:se,clear:pt,getPendingFiles:Ge}}const vM=({isDragOver:e,canAddMore:t,onFiles:n,setIsDragOver:r,inputRef:s,accept:o,maxFiles:i,maxSize:a,disabled:l,children:c})=>{const d=t&&!l;return h.jsxs(I,{className:` relative border-2 border-dashed rounded-lg transition-colors ${l?"opacity-60 cursor-not-allowed":""} ${e&&!l?"border-blue-500 bg-blue-50 dark:bg-blue-900/20":"border-gray-300 dark:border-gray-600"} - `,onDragOver:u=>{u.preventDefault(),d&&r(!0)},onDragLeave:()=>r(!1),onDrop:u=>{u.preventDefault(),r(!1),d&&n(u.dataTransfer.files)},children:[h.jsx("input",{ref:s,type:"file",multiple:!0,accept:o,onChange:u=>u.target.files&&!l&&n(u.target.files),className:"hidden",disabled:l}),!c&&h.jsxs(I,{className:`p-8 text-center transition-colors ${l?"cursor-not-allowed":"cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800/50"}`,onClick:()=>!l&&s.current?.click(),children:[h.jsx(gt,{className:"fa-solid fa-cloud-arrow-up text-4xl text-gray-400 dark:text-gray-500 mb-4"}),h.jsx(yt,{className:"text-sm text-gray-600 dark:text-gray-400",children:Pt("attachment.drop_or_click")}),h.jsxs(yt,{className:"text-xs text-gray-500 dark:text-gray-500 mt-2",children:[Pt("attachment.upload_limit",{maxFiles:i,maxSize:a}),o&&` (${o})`]})]}),c]})},bE=window.G7Core,yE=window.G7Core?.createLogger?.("Comp:SortableThumbnail")??{log:(...e)=>console.log("[Comp:SortableThumbnail]",...e),warn:(...e)=>console.warn("[Comp:SortableThumbnail]",...e),error:(...e)=>console.error("[Comp:SortableThumbnail]",...e)},vE=({file:e,onRemove:t,onRetry:n,onImageClick:r,onDownload:s,isPrimary:o,onPrimaryClick:i,disabled:a})=>{const{attributes:l,listeners:c,setNodeRef:d,transform:u,transition:f,isDragging:g}=Pi({id:"hash"in e?e.hash:e.id}),m={transform:Fn.Transform.toString(u),transition:f,opacity:g?.5:1},p="status"in e&&e.status!==void 0,y=p?e.status:"done",b=y==="uploading",_=y==="compressing",x=y==="error",E=p?e.progress:100,S=p?e.preview:void 0,w=p?e.mime_type?.startsWith("image/")??!1:e.is_image,[N,C]=v.useState(void 0),k=!p&&w?e.download_url:void 0;v.useEffect(()=>{if(!k){C(void 0);return}if(Dc(k)){C(k);return}let T=!0,L;return(async()=>{try{const F=await bE.api.get(k,{responseType:"blob"});T&&F&&(L=URL.createObjectURL(F),C(L))}catch(F){yE.error("Failed to load authenticated image:",F)}})(),()=>{T=!1,L&&URL.revokeObjectURL(L)}},[k]);const M=N;return h.jsxs(I,{ref:d,style:m,className:"relative group bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:[h.jsxs(I,{className:`aspect-square w-full flex items-center justify-center bg-gray-50 dark:bg-gray-900 relative ${w||!p?"cursor-pointer":""}`,onClick:()=>{b||_||(w&&r?r():!p&&s&&s())},children:[S||M?h.jsx(kn,{src:S||M,alt:e.original_filename,className:"w-full h-full object-cover"}):h.jsx(gt,{className:`fa-solid ${fE(e.mime_type)} text-4xl text-gray-400 dark:text-gray-500`}),(b||_)&&h.jsxs(I,{className:"absolute inset-0 bg-black/50 flex flex-col items-center justify-center",children:[h.jsx(I,{className:"w-3/4 h-2 bg-gray-700 dark:bg-gray-600 rounded-full overflow-hidden",children:h.jsx(I,{className:"h-full bg-blue-500 dark:bg-blue-400 transition-all",style:{width:`${E}%`}})}),h.jsxs(Q,{className:"text-white text-xs mt-1",children:[E,"%"]})]}),x&&h.jsx(I,{className:"absolute inset-0 bg-red-500/50 dark:bg-red-600/50 flex items-center justify-center",children:h.jsx(gt,{className:"fa-solid fa-exclamation-triangle text-2xl text-white"})}),i&&h.jsx(oe,{type:"button",onClick:T=>{T.stopPropagation(),i()},className:`absolute top-1.5 left-1.5 z-10 p-1 rounded-full transition-colors ${o?"bg-yellow-500 text-white":"bg-gray-800/50 text-gray-300 hover:bg-yellow-500 hover:text-white opacity-0 group-hover:opacity-100"}`,title:Pt(o?"attachment.primary_image":"attachment.set_as_primary"),children:h.jsx(gt,{className:"fa-solid fa-star text-xs"})}),h.jsxs(I,{className:`absolute inset-0 bg-black/0 group-hover:bg-black/40 transition-colors flex items-start justify-end p-1 gap-1 opacity-0 group-hover:opacity-100 ${a?"hidden":""}`,children:[h.jsx(oe,{type:"button",...l,...c,className:"p-1.5 bg-white/90 dark:bg-gray-800/90 rounded text-gray-600 dark:text-gray-300 hover:bg-white cursor-grab active:cursor-grabbing",title:Pt("attachment.drag_to_reorder"),onClick:T=>T.stopPropagation(),children:h.jsx(gt,{className:"fa-solid fa-grip-vertical text-sm"})}),!p&&s&&h.jsx(oe,{type:"button",onClick:T=>{T.stopPropagation(),s()},className:"p-1.5 bg-white/90 dark:bg-gray-800/90 rounded text-blue-500 hover:bg-white",title:Pt("common.download"),children:h.jsx(gt,{className:"fa-solid fa-download text-sm"})}),x&&n&&h.jsx(oe,{type:"button",onClick:T=>{T.stopPropagation(),n()},className:"p-1.5 bg-white/90 dark:bg-gray-800/90 rounded text-orange-500 hover:bg-white",title:Pt("common.retry"),children:h.jsx(gt,{className:"fa-solid fa-arrow-rotate-right text-sm"})}),h.jsx(oe,{type:"button",onClick:T=>{T.stopPropagation(),t()},disabled:b||_,className:"p-1.5 bg-white/90 dark:bg-gray-800/90 rounded text-red-500 hover:bg-white disabled:opacity-50",title:Pt("common.delete"),children:h.jsx(gt,{className:"fa-solid fa-times text-sm"})})]})]}),h.jsxs(I,{className:`p-2 ${!p&&s?"cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-700":""}`,onClick:()=>{!p&&s&&s()},children:[h.jsx(yt,{className:"text-xs font-medium text-gray-900 dark:text-white truncate",title:e.original_filename,children:e.original_filename}),h.jsx(yt,{className:"text-xs text-gray-500 dark:text-gray-400",children:e.size_formatted})]})]})},xE=({allItems:e,canAddMore:t,totalCount:n,maxFiles:r,maxSize:s,accept:o,onRemove:i,onRetry:a,onImageClick:l,onDownload:c,onDragEnd:d,onAddClick:u,enablePrimarySelection:f,primaryFileId:g,onPrimaryChange:m,disabled:p})=>{const y=Yl(es(Zs,{activationConstraint:{distance:8}}),es(qs,{coordinateGetter:$i}));return h.jsxs(I,{className:"p-3",children:[h.jsx(rc,{sensors:y,collisionDetection:Kl,onDragEnd:d,children:h.jsx(Li,{items:e.map(b=>"hash"in b?b.hash:b.id),strategy:Di,children:h.jsxs(I,{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-3",children:[e.map(b=>{const _="hash"in b,x=_?b.is_image:b.mime_type?.startsWith("image/")??!1;return h.jsx(vE,{file:b,onRemove:()=>i(b),onRetry:"status"in b&&b.status==="error"?()=>a(b):void 0,onImageClick:x?()=>l(b):void 0,onDownload:_?()=>c(b):void 0,isPrimary:f&&_&&(b.hash||b.id)===g,onPrimaryClick:f&&_?()=>m?.(b.hash||b.id):void 0,disabled:p},_?b.hash:b.id)}),t&&!p&&h.jsxs(I,{className:"aspect-square flex flex-col items-center justify-center border-2 border-dashed border-gray-300 dark:border-gray-600 rounded-lg cursor-pointer hover:border-gray-400 dark:hover:border-gray-500 hover:bg-gray-50 dark:hover:bg-gray-800/50 transition-colors",onClick:u,children:[h.jsx(gt,{className:"fa-solid fa-plus text-2xl text-gray-400 dark:text-gray-500 mb-1"}),h.jsx(Q,{className:"text-xs text-gray-500 dark:text-gray-400",children:Pt("common.add")})]})]})})}),h.jsxs(I,{className:"mt-3 pt-3 border-t border-gray-200 dark:border-gray-700 flex justify-between items-center text-xs text-gray-500 dark:text-gray-400",children:[h.jsx(Q,{children:Pt("attachment.attached_count",{count:n,max:r})}),h.jsxs(Q,{children:[Pt("attachment.max_size",{size:s}),o&&` (${o})`]})]})]})},Op=v.forwardRef(({uploadTriggerEvent:e,attachmentableType:t,attachmentableId:n,collection:r="default",maxFiles:s=10,maxSize:o=10,maxConcurrentUploads:i=3,accept:a,imageCompression:l,roleIds:c=[],autoUpload:d=!0,onFilesChange:u,onUploadComplete:f,onUploadError:g,onRemove:m,onReorder:p,initialFiles:y=[],disabled:b=!1,className:_="",confirmBeforeRemove:x=!1,confirmRemoveTitle:E,confirmRemoveMessage:S,apiEndpoints:w,uploadParams:N,enablePrimarySelection:C=!1,primaryFileId:k,onPrimaryChange:M,id:T,editorAttrs:L},P)=>{const F={upload:w?.upload??"/api/admin/attachments",delete:w?.delete??"/api/admin/attachments/:id",reorder:w?.reorder??"/api/admin/attachments/reorder"},D=pE({attachmentableType:t,attachmentableId:n,collection:r,maxFiles:s,maxSize:o,maxConcurrentUploads:i,accept:a,imageCompression:l,roleIds:c,autoUpload:d,initialFiles:y,endpoints:F,onFilesChange:u,onUploadComplete:f,onUploadError:g,onRemove:m,onReorder:p,uploadTriggerEvent:e,confirmBeforeRemove:x,uploadParams:N});v.useImperativeHandle(P,()=>({uploadAll:D.handleUploadAll,clear:D.clear,getPendingFiles:D.getPendingFiles}));const A=v.useMemo(()=>D.imageFiles.map(V=>{const H=!("hash"in V),W=V,j=V;return H?{src:W.preview||"",filename:W.original_filename,title:W.original_filename,downloadRequiresAuth:!1}:{src:D.authenticatedImageUrls.get(j.id)||j.download_url,downloadUrl:j.download_url,filename:j.original_filename,title:j.original_filename,downloadRequiresAuth:!0}}),[D.imageFiles,D.authenticatedImageUrls]),O=v.useMemo(()=>({existingFiles:D.existingFiles,pendingFiles:D.pendingFiles,isDragOver:D.isDragOver,isDeleting:D.isDeleting,maxFiles:s,maxSize:o,accept:a,endpoints:F,confirmBeforeRemove:x,totalCount:D.totalCount,hasFiles:D.hasFiles,canAddMore:D.canAddMore,allItems:D.allItems,imageFiles:D.imageFiles,handleFiles:D.handleFiles,handleRemove:D.handleRemove,handleRetry:D.handleRetry,handleUploadAll:D.handleUploadAll,handleOpenGallery:D.handleOpenGallery,handleDownload:D.handleDownload,handleDragEnd:D.handleDragEnd,setIsDragOver:D.setIsDragOver,inputRef:D.inputRef,galleryOpen:D.galleryOpen,setGalleryOpen:D.setGalleryOpen,galleryStartIndex:D.galleryStartIndex,galleryKeyRef:D.galleryKeyRef,confirmDialogOpen:D.confirmDialogOpen,setConfirmDialogOpen:D.setConfirmDialogOpen,itemToDelete:D.itemToDelete,executeRemoveAttachment:D.executeRemoveAttachment,authenticatedImageUrls:D.authenticatedImageUrls}),[D,s,o,a,F,x]);return h.jsx(tE,{value:O,children:h.jsxs(I,{id:T,className:_,...L,children:[h.jsx(mE,{isDragOver:D.isDragOver,canAddMore:D.canAddMore,onFiles:D.handleFiles,setIsDragOver:D.setIsDragOver,inputRef:D.inputRef,accept:a,maxFiles:s,maxSize:o,disabled:b,children:D.hasFiles&&h.jsx(xE,{allItems:D.allItems,canAddMore:D.canAddMore,totalCount:D.totalCount,maxFiles:s,maxSize:o,accept:a,onRemove:D.handleRemove,onRetry:D.handleRetry,onImageClick:D.handleOpenGallery,onDownload:D.handleDownload,onDragEnd:D.handleDragEnd,onAddClick:()=>D.inputRef.current?.click(),enablePrimarySelection:C,primaryFileId:k,onPrimaryChange:M,disabled:b})}),x&&h.jsx(au,{isOpen:D.confirmDialogOpen,onClose:()=>{D.isDeleting||D.setConfirmDialogOpen(!1)},title:E??Pt("attachment.delete_confirm_title"),message:S??Pt("attachment.delete_confirm_message"),confirmText:Pt("common.delete"),confirmButtonVariant:"danger",onConfirm:()=>{D.itemToDelete&&D.executeRemoveAttachment(D.itemToDelete)},isLoading:D.isDeleting,loadingText:Pt("attachment.deleting")}),A.length>0&&D.galleryOpen&&h.jsx(Gi,{images:A,isOpen:!0,onClose:()=>D.setGalleryOpen(!1),startIndex:D.galleryStartIndex,showDownload:!0},`gallery-${D.galleryKeyRef.current}`)]})})});Op.displayName="FileUploader";const wE=({name:e,value:t,options:n,onChange:r,disabled:s=!1,inline:o=!1,className:i="",size:a="md",label:l,error:c,id:d,editorAttrs:u})=>{const[f,g]=v.useState(()=>t??"");v.useEffect(()=>{g(t??"")},[t]);const m=_=>{const x=_.target.value;g(x),r&&!s&&r(_)},y={sm:{radio:"w-3.5 h-3.5",label:"text-xs",gap:"gap-1.5"},md:{radio:"w-4 h-4",label:"text-sm",gap:"gap-2"},lg:{radio:"w-5 h-5",label:"text-base",gap:"gap-2.5"}}[a],b=o?"flex flex-wrap items-center gap-4":"flex flex-col gap-2";return h.jsxs(I,{className:i,id:d,...u,children:[l&&h.jsx(Q,{className:`block mb-2 font-medium text-gray-700 dark:text-gray-300 ${y.label}`,children:l}),h.jsx(I,{className:b,children:n.map(_=>{const x=String(_.value)===String(f),E=s||_.disabled;return h.jsxs(on,{className:`inline-flex items-center ${y.gap} ${E?"cursor-not-allowed opacity-50":"cursor-pointer"}`,children:[h.jsx("input",{type:"radio",name:e,value:_.value,checked:x,onChange:m,disabled:E,className:` + `,onDragOver:u=>{u.preventDefault(),d&&r(!0)},onDragLeave:()=>r(!1),onDrop:u=>{u.preventDefault(),r(!1),d&&n(u.dataTransfer.files)},children:[h.jsx("input",{ref:s,type:"file",multiple:!0,accept:o,onChange:u=>u.target.files&&!l&&n(u.target.files),className:"hidden",disabled:l}),!c&&h.jsxs(I,{className:`p-8 text-center transition-colors ${l?"cursor-not-allowed":"cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800/50"}`,onClick:()=>!l&&s.current?.click(),children:[h.jsx(yt,{className:"fa-solid fa-cloud-arrow-up text-4xl text-gray-400 dark:text-gray-500 mb-4"}),h.jsx(kt,{className:"text-sm text-gray-600 dark:text-gray-400",children:Ht("attachment.drop_or_click")}),h.jsxs(kt,{className:"text-xs text-gray-500 dark:text-gray-500 mt-2",children:[Ht("attachment.upload_limit",{maxFiles:i,maxSize:a}),o&&` (${o})`]})]}),c]})},xM=window.G7Core,wM=window.G7Core?.createLogger?.("Comp:SortableThumbnail")??{log:(...e)=>console.log("[Comp:SortableThumbnail]",...e),warn:(...e)=>console.warn("[Comp:SortableThumbnail]",...e),error:(...e)=>console.error("[Comp:SortableThumbnail]",...e)},kM=({file:e,onRemove:t,onRetry:n,onImageClick:r,onDownload:s,isPrimary:o,onPrimaryClick:i,disabled:a})=>{const{attributes:l,listeners:c,setNodeRef:d,transform:u,transition:f,isDragging:g}=Zi({id:"hash"in e?e.hash:e.id}),m={transform:Wn.Transform.toString(u),transition:f,opacity:g?.5:1},p="status"in e&&e.status!==void 0,y=p?e.status:"done",b=y==="uploading",_=y==="compressing",x=y==="error",M=p?e.progress:100,S=p?e.preview:void 0,k=p?e.mime_type?.startsWith("image/")??!1:e.is_image,[N,C]=v.useState(void 0),w=!p&&k?e.download_url:void 0;v.useEffect(()=>{if(!w){C(void 0);return}if(ed(w)){C(w);return}let T=!0,P;return(async()=>{try{const F=await xM.api.get(w,{responseType:"blob"});T&&F&&(P=URL.createObjectURL(F),C(P))}catch(F){wM.error("Failed to load authenticated image:",F)}})(),()=>{T=!1,P&&URL.revokeObjectURL(P)}},[w]);const E=N;return h.jsxs(I,{ref:d,style:m,className:"relative group bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:[h.jsxs(I,{className:`aspect-square w-full flex items-center justify-center bg-gray-50 dark:bg-gray-900 relative ${k||!p?"cursor-pointer":""}`,onClick:()=>{b||_||(k&&r?r():!p&&s&&s())},children:[S||E?h.jsx(Nn,{src:S||E,alt:e.original_filename,className:"w-full h-full object-cover"}):h.jsx(yt,{className:`fa-solid ${pM(e.mime_type)} text-4xl text-gray-400 dark:text-gray-500`}),(b||_)&&h.jsxs(I,{className:"absolute inset-0 bg-black/50 flex flex-col items-center justify-center",children:[h.jsx(I,{className:"w-3/4 h-2 bg-gray-700 dark:bg-gray-600 rounded-full overflow-hidden",children:h.jsx(I,{className:"h-full bg-blue-500 dark:bg-blue-400 transition-all",style:{width:`${M}%`}})}),h.jsxs(J,{className:"text-white text-xs mt-1",children:[M,"%"]})]}),x&&h.jsx(I,{className:"absolute inset-0 bg-red-500/50 dark:bg-red-600/50 flex items-center justify-center",children:h.jsx(yt,{className:"fa-solid fa-exclamation-triangle text-2xl text-white"})}),i&&h.jsx(le,{type:"button",onClick:T=>{T.stopPropagation(),i()},className:`absolute top-1.5 left-1.5 z-10 p-1 rounded-full transition-colors ${o?"bg-yellow-500 text-white":"bg-gray-800/50 text-gray-300 hover:bg-yellow-500 hover:text-white opacity-0 group-hover:opacity-100"}`,title:Ht(o?"attachment.primary_image":"attachment.set_as_primary"),children:h.jsx(yt,{className:"fa-solid fa-star text-xs"})}),h.jsxs(I,{className:`absolute inset-0 bg-black/0 group-hover:bg-black/40 transition-colors flex items-start justify-end p-1 gap-1 opacity-0 group-hover:opacity-100 ${a?"hidden":""}`,children:[h.jsx(le,{type:"button",...l,...c,className:"p-1.5 bg-white/90 dark:bg-gray-800/90 rounded text-gray-600 dark:text-gray-300 hover:bg-white cursor-grab active:cursor-grabbing",title:Ht("attachment.drag_to_reorder"),onClick:T=>T.stopPropagation(),children:h.jsx(yt,{className:"fa-solid fa-grip-vertical text-sm"})}),!p&&s&&h.jsx(le,{type:"button",onClick:T=>{T.stopPropagation(),s()},className:"p-1.5 bg-white/90 dark:bg-gray-800/90 rounded text-blue-500 hover:bg-white",title:Ht("common.download"),children:h.jsx(yt,{className:"fa-solid fa-download text-sm"})}),x&&n&&h.jsx(le,{type:"button",onClick:T=>{T.stopPropagation(),n()},className:"p-1.5 bg-white/90 dark:bg-gray-800/90 rounded text-orange-500 hover:bg-white",title:Ht("common.retry"),children:h.jsx(yt,{className:"fa-solid fa-arrow-rotate-right text-sm"})}),h.jsx(le,{type:"button",onClick:T=>{T.stopPropagation(),t()},disabled:b||_,className:"p-1.5 bg-white/90 dark:bg-gray-800/90 rounded text-red-500 hover:bg-white disabled:opacity-50",title:Ht("common.delete"),children:h.jsx(yt,{className:"fa-solid fa-times text-sm"})})]})]}),h.jsxs(I,{className:`p-2 ${!p&&s?"cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-700":""}`,onClick:()=>{!p&&s&&s()},children:[h.jsx(kt,{className:"text-xs font-medium text-gray-900 dark:text-white truncate",title:e.original_filename,children:e.original_filename}),h.jsx(kt,{className:"text-xs text-gray-500 dark:text-gray-400",children:e.size_formatted})]})]})},CM=({allItems:e,canAddMore:t,totalCount:n,maxFiles:r,maxSize:s,accept:o,onRemove:i,onRetry:a,onImageClick:l,onDownload:c,onDragEnd:d,onAddClick:u,enablePrimarySelection:f,primaryFileId:g,onPrimaryChange:m,disabled:p})=>{const y=gc(gs(fo,{activationConstraint:{distance:8}}),gs(uo,{coordinateGetter:Qi}));return h.jsxs(I,{className:"p-3",children:[h.jsx(_c,{sensors:y,collisionDetection:pc,onDragEnd:d,children:h.jsx(qi,{items:e.map(b=>"hash"in b?b.hash:b.id),strategy:Ki,children:h.jsxs(I,{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-3",children:[e.map(b=>{const _="hash"in b,x=_?b.is_image:b.mime_type?.startsWith("image/")??!1;return h.jsx(kM,{file:b,onRemove:()=>i(b),onRetry:"status"in b&&b.status==="error"?()=>a(b):void 0,onImageClick:x?()=>l(b):void 0,onDownload:_?()=>c(b):void 0,isPrimary:f&&_&&(b.hash||b.id)===g,onPrimaryClick:f&&_?()=>m?.(b.hash||b.id):void 0,disabled:p},_?b.hash:b.id)}),t&&!p&&h.jsxs(I,{className:"aspect-square flex flex-col items-center justify-center border-2 border-dashed border-gray-300 dark:border-gray-600 rounded-lg cursor-pointer hover:border-gray-400 dark:hover:border-gray-500 hover:bg-gray-50 dark:hover:bg-gray-800/50 transition-colors",onClick:u,children:[h.jsx(yt,{className:"fa-solid fa-plus text-2xl text-gray-400 dark:text-gray-500 mb-1"}),h.jsx(J,{className:"text-xs text-gray-500 dark:text-gray-400",children:Ht("common.add")})]})]})})}),h.jsxs(I,{className:"mt-3 pt-3 border-t border-gray-200 dark:border-gray-700 flex justify-between items-center text-xs text-gray-500 dark:text-gray-400",children:[h.jsx(J,{children:Ht("attachment.attached_count",{count:n,max:r})}),h.jsxs(J,{children:[Ht("attachment.max_size",{size:s}),o&&` (${o})`]})]})]})},c0=v.forwardRef(({uploadTriggerEvent:e,attachmentableType:t,attachmentableId:n,collection:r="default",maxFiles:s=10,maxSize:o=10,maxConcurrentUploads:i=3,accept:a,imageCompression:l,roleIds:c=[],autoUpload:d=!0,onFilesChange:u,onUploadComplete:f,onUploadError:g,onRemove:m,onReorder:p,initialFiles:y=[],disabled:b=!1,className:_="",confirmBeforeRemove:x=!1,confirmRemoveTitle:M,confirmRemoveMessage:S,apiEndpoints:k,uploadParams:N,enablePrimarySelection:C=!1,primaryFileId:w,onPrimaryChange:E,id:T,editorAttrs:P},L)=>{const F={upload:k?.upload??"/api/admin/attachments",delete:k?.delete??"/api/admin/attachments/:id",reorder:k?.reorder??"/api/admin/attachments/reorder"},A=yM({attachmentableType:t,attachmentableId:n,collection:r,maxFiles:s,maxSize:o,maxConcurrentUploads:i,accept:a,imageCompression:l,roleIds:c,autoUpload:d,initialFiles:y,endpoints:F,onFilesChange:u,onUploadComplete:f,onUploadError:g,onRemove:m,onReorder:p,uploadTriggerEvent:e,confirmBeforeRemove:x,uploadParams:N});v.useImperativeHandle(L,()=>({uploadAll:A.handleUploadAll,clear:A.clear,getPendingFiles:A.getPendingFiles}));const D=v.useMemo(()=>A.imageFiles.map(z=>{const U=!("hash"in z),j=z,Y=z;return U?{src:j.preview||"",filename:j.original_filename,title:j.original_filename,downloadRequiresAuth:!1}:{src:A.authenticatedImageUrls.get(Y.id)||Y.download_url,downloadUrl:Y.download_url,filename:Y.original_filename,title:Y.original_filename,downloadRequiresAuth:!0}}),[A.imageFiles,A.authenticatedImageUrls]),O=v.useMemo(()=>({existingFiles:A.existingFiles,pendingFiles:A.pendingFiles,isDragOver:A.isDragOver,isDeleting:A.isDeleting,maxFiles:s,maxSize:o,accept:a,endpoints:F,confirmBeforeRemove:x,totalCount:A.totalCount,hasFiles:A.hasFiles,canAddMore:A.canAddMore,allItems:A.allItems,imageFiles:A.imageFiles,handleFiles:A.handleFiles,handleRemove:A.handleRemove,handleRetry:A.handleRetry,handleUploadAll:A.handleUploadAll,handleOpenGallery:A.handleOpenGallery,handleDownload:A.handleDownload,handleDragEnd:A.handleDragEnd,setIsDragOver:A.setIsDragOver,inputRef:A.inputRef,galleryOpen:A.galleryOpen,setGalleryOpen:A.setGalleryOpen,galleryStartIndex:A.galleryStartIndex,galleryKeyRef:A.galleryKeyRef,confirmDialogOpen:A.confirmDialogOpen,setConfirmDialogOpen:A.setConfirmDialogOpen,itemToDelete:A.itemToDelete,executeRemoveAttachment:A.executeRemoveAttachment,authenticatedImageUrls:A.authenticatedImageUrls}),[A,s,o,a,F,x]);return h.jsx(sM,{value:O,children:h.jsxs(I,{id:T,className:_,...P,children:[h.jsx(vM,{isDragOver:A.isDragOver,canAddMore:A.canAddMore,onFiles:A.handleFiles,setIsDragOver:A.setIsDragOver,inputRef:A.inputRef,accept:a,maxFiles:s,maxSize:o,disabled:b,children:A.hasFiles&&h.jsx(CM,{allItems:A.allItems,canAddMore:A.canAddMore,totalCount:A.totalCount,maxFiles:s,maxSize:o,accept:a,onRemove:A.handleRemove,onRetry:A.handleRetry,onImageClick:A.handleOpenGallery,onDownload:A.handleDownload,onDragEnd:A.handleDragEnd,onAddClick:()=>A.inputRef.current?.click(),enablePrimarySelection:C,primaryFileId:w,onPrimaryChange:E,disabled:b})}),x&&h.jsx(Uu,{isOpen:A.confirmDialogOpen,onClose:()=>{A.isDeleting||A.setConfirmDialogOpen(!1)},title:M??Ht("attachment.delete_confirm_title"),message:S??Ht("attachment.delete_confirm_message"),confirmText:Ht("common.delete"),confirmButtonVariant:"danger",onConfirm:()=>{A.itemToDelete&&A.executeRemoveAttachment(A.itemToDelete)},isLoading:A.isDeleting,loadingText:Ht("attachment.deleting")}),D.length>0&&A.galleryOpen&&h.jsx(ia,{images:D,isOpen:!0,onClose:()=>A.setGalleryOpen(!1),startIndex:A.galleryStartIndex,showDownload:!0},`gallery-${A.galleryKeyRef.current}`)]})})});c0.displayName="FileUploader";const SM=({name:e,value:t,options:n,onChange:r,disabled:s=!1,inline:o=!1,className:i="",size:a="md",label:l,error:c,id:d,editorAttrs:u})=>{const[f,g]=v.useState(()=>t??"");v.useEffect(()=>{g(t??"")},[t]);const m=_=>{const x=_.target.value;g(x),r&&!s&&r(_)},y={sm:{radio:"w-3.5 h-3.5",label:"text-xs",gap:"gap-1.5"},md:{radio:"w-4 h-4",label:"text-sm",gap:"gap-2"},lg:{radio:"w-5 h-5",label:"text-base",gap:"gap-2.5"}}[a],b=o?"flex flex-wrap items-center gap-4":"flex flex-col gap-2";return h.jsxs(I,{className:i,id:d,...u,children:[l&&h.jsx(J,{className:`block mb-2 font-medium text-gray-700 dark:text-gray-300 ${y.label}`,children:l}),h.jsx(I,{className:b,children:n.map(_=>{const x=String(_.value)===String(f),M=s||_.disabled;return h.jsxs(gn,{className:`inline-flex items-center ${y.gap} ${M?"cursor-not-allowed opacity-50":"cursor-pointer"}`,children:[h.jsx("input",{type:"radio",name:e,value:_.value,checked:x,onChange:m,disabled:M,className:` ${y.radio} text-blue-600 bg-gray-100 dark:bg-gray-700 @@ -239,15 +240,15 @@ self.addEventListener('message', async (e) => { focus:ring-blue-500 dark:focus:ring-blue-600 focus:ring-2 dark:ring-offset-gray-800 - ${E?"cursor-not-allowed":"cursor-pointer"} - `}),h.jsx(Q,{className:` + ${M?"cursor-not-allowed":"cursor-pointer"} + `}),h.jsx(J,{className:` ${y.label} font-medium text-gray-900 dark:text-gray-300 - `,children:_.label})]},_.value)})}),c&&h.jsx(Q,{className:"mt-1 text-xs text-red-600 dark:text-red-400",children:c})]})},fs=()=>window.G7Core,Ji=(e,t)=>fs()?.t?.(e,t)??e,kE=()=>fs()?.locale?.supported?.()??["ko","en"],CE=()=>fs()?.locale?.current?.()??"ko",Tp=e=>{const t=Ji(`common.language_${e}`);return t===`common.language_${e}`?{ko:"한국어",en:"English",ja:"日本語",zh:"中文"}[e]||e.toUpperCase():t},SE=({content:e="",value:t,onChange:n,multilingual:r=!1,isHtml:s=!1,onIsHtmlChange:o,rows:i=15,placeholder:a="",label:l,showHtmlModeToggle:c=!0,contentClassName:d="",purifyConfig:u,className:f="",name:g="content",htmlFieldName:m="content_mode",readOnly:p=!1,id:y,editorAttrs:b})=>{const _=v.useMemo(()=>kE(),[]),x=v.useMemo(()=>CE(),[]),[E,S]=v.useState(x),[w,N]=v.useState(s),[C,k]=v.useState(e),[M,T]=v.useState(t??{}),[L,P]=v.useState(!1);v.useEffect(()=>{N(s)},[s]),v.useEffect(()=>{r||k(e)},[e,r]),v.useEffect(()=>{r&&t&&T(t)},[t,r]);const F=v.useCallback(j=>{const U=j.target.value;if(k(U),n){const B=fs()?.createChangeEvent?.({value:U,name:g,type:"textarea"})??{target:{name:g,value:U}};n(B)}},[n,g]),D=v.useCallback((j,U)=>{const B={...M,[j]:U};if(T(B),n){const G=fs()?.createChangeEvent?.({value:B,name:g,type:"multilingual"})??{target:{name:g,value:B}};n(G)}},[n,g,M]),A=v.useCallback(j=>{const U=j.target.checked;if(N(U),U||P(!1),o){const B=fs()?.createChangeEvent?.({checked:U,name:m,type:"checkbox"})??{target:{name:m,checked:U}};o(B)}},[o,m]),O=v.useCallback(()=>{P(j=>!j)},[]),V=r?M[E]??"":C,H=v.useCallback(j=>!!M[j]?.trim(),[M]),W=()=>h.jsx(I,{className:"flex flex-wrap items-center gap-2 mb-3",children:_.map(j=>{const U=j===x,B=E===j;return h.jsxs(oe,{type:"button",className:` + `,children:_.label})]},_.value)})}),c&&h.jsx(J,{className:"mt-1 text-xs text-red-600 dark:text-red-400",children:c})]})},Es=()=>window.G7Core,ha=(e,t)=>Es()?.t?.(e,t)??e,_M=()=>Es()?.locale?.supported?.()??["ko","en"],EM=()=>Es()?.locale?.current?.()??"ko",d0=e=>{const t=ha(`common.language_${e}`);return t===`common.language_${e}`?{ko:"한국어",en:"English",ja:"日本語",zh:"中文"}[e]||e.toUpperCase():t},MM=({content:e="",value:t,onChange:n,multilingual:r=!1,isHtml:s=!1,onIsHtmlChange:o,rows:i=15,placeholder:a="",label:l,showHtmlModeToggle:c=!0,contentClassName:d="",purifyConfig:u,className:f="",name:g="content",htmlFieldName:m="content_mode",readOnly:p=!1,id:y,editorAttrs:b})=>{const _=v.useMemo(()=>_M(),[]),x=v.useMemo(()=>EM(),[]),[M,S]=v.useState(x),[k,N]=v.useState(s),[C,w]=v.useState(e),[E,T]=v.useState(t??{}),[P,L]=v.useState(!1);v.useEffect(()=>{N(s)},[s]),v.useEffect(()=>{r||w(e)},[e,r]),v.useEffect(()=>{r&&t&&T(t)},[t,r]);const F=v.useCallback(Y=>{const B=Y.target.value;if(w(B),n){const W=Es()?.createChangeEvent?.({value:B,name:g,type:"textarea"})??{target:{name:g,value:B}};n(W)}},[n,g]),A=v.useCallback((Y,B)=>{const W={...E,[Y]:B};if(T(W),n){const G=Es()?.createChangeEvent?.({value:W,name:g,type:"multilingual"})??{target:{name:g,value:W}};n(G)}},[n,g,E]),D=v.useCallback(Y=>{const B=Y.target.checked;if(N(B),B||L(!1),o){const W=Es()?.createChangeEvent?.({checked:B,name:m,type:"checkbox"})??{target:{name:m,checked:B}};o(W)}},[o,m]),O=v.useCallback(()=>{L(Y=>!Y)},[]),z=r?E[M]??"":C,U=v.useCallback(Y=>!!E[Y]?.trim(),[E]),j=()=>h.jsx(I,{className:"flex flex-wrap items-center gap-2 mb-3",children:_.map(Y=>{const B=Y===x,W=M===Y;return h.jsxs(le,{type:"button",className:` inline-flex items-center gap-1.5 px-3 py-1.5 rounded-full text-xs font-semibold transition-all - ${B?U?"bg-blue-500 text-white dark:bg-blue-600 dark:text-white shadow-md scale-105":"bg-gray-500 text-white dark:bg-gray-600 dark:text-white shadow-md scale-105":U?"bg-blue-50 text-blue-600 dark:bg-blue-900/30 dark:text-blue-400 hover:bg-blue-100 dark:hover:bg-blue-900/50":"bg-gray-100 text-gray-600 dark:bg-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-600"} - `,onClick:()=>S(j),children:[h.jsx(re,{name:"globe",className:"w-3 h-3"}),h.jsx(Q,{children:Tp(j)}),U&&h.jsx(Q,{className:"text-red-500",children:"*"}),H(j)&&!B&&h.jsx(re,{name:"check",className:"w-3 h-3 text-green-500 dark:text-green-400"})]},j)})});return h.jsxs(I,{className:`space-y-2 ${f}`,id:y,...b,children:[h.jsxs(I,{className:"flex items-center justify-between",children:[l&&h.jsx(on,{className:"block text-sm font-medium text-gray-500 dark:text-gray-400",children:l}),h.jsxs(I,{className:"flex items-center gap-3",children:[w&&!p&&h.jsx(oe,{type:"button",onClick:O,className:`px-3 py-1.5 text-xs font-bold rounded-lg focus:outline-none focus:ring-2 ${L?"text-gray-700 dark:text-gray-200 bg-gray-200 dark:bg-gray-600 border border-gray-300 dark:border-gray-500 hover:bg-gray-300 dark:hover:bg-gray-500 focus:ring-gray-400 dark:focus:ring-gray-500":"text-blue-600 dark:text-blue-400 bg-white dark:bg-gray-700 border border-blue-300 dark:border-blue-600 hover:bg-blue-50 dark:hover:bg-gray-600 focus:ring-blue-500 dark:focus:ring-blue-600"}`,children:Ji(L?"common.preview_off":"common.preview")}),c&&h.jsxs(on,{className:"flex items-center gap-2 p-2 cursor-pointer",children:[h.jsx(wt,{type:"checkbox",name:m,checked:w,onChange:A,disabled:p,className:"w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600"}),h.jsx(I,{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:Ji("common.html_mode")})]})]})]}),r&&W(),!L&&(r?_.map(j=>h.jsx(I,{className:E===j?"block":"hidden",children:h.jsx(Rn,{name:`${g}[${j}]`,value:M[j]??"",onChange:U=>D(j,U.target.value),placeholder:`${a} (${Tp(j)})`,rows:i,readOnly:p,className:`block w-full rounded-lg border px-3 py-2 text-sm placeholder-gray-400 dark:placeholder-gray-500 focus:outline-none focus:ring-1 disabled:opacity-50 disabled:cursor-not-allowed ${w?"font-mono bg-white dark:bg-gray-800 border-blue-300 dark:border-blue-600 text-gray-800 dark:text-gray-200 focus:border-blue-500 focus:ring-blue-500":"bg-white dark:bg-gray-800 border-gray-300 dark:border-gray-600 text-gray-900 dark:text-white focus:border-blue-500 focus:ring-blue-500"}`})},j)):h.jsx(Rn,{name:g,value:C,onChange:F,placeholder:a,rows:i,readOnly:p,className:`block w-full rounded-lg border px-3 py-2 text-sm placeholder-gray-400 dark:placeholder-gray-500 focus:outline-none focus:ring-1 disabled:opacity-50 disabled:cursor-not-allowed ${w?"font-mono bg-white dark:bg-gray-800 border-blue-300 dark:border-blue-600 text-gray-800 dark:text-gray-200 focus:border-blue-500 focus:ring-blue-500":"bg-white dark:bg-gray-800 border-gray-300 dark:border-gray-600 text-gray-900 dark:text-white focus:border-blue-500 focus:ring-blue-500"}`})),L&&h.jsx(I,{className:"p-4 bg-gray-50 dark:bg-gray-900 rounded-lg border border-gray-200 dark:border-gray-800 min-h-[400px]",children:h.jsx(el,{content:V,isHtml:!0,className:d||"prose dark:prose-invert max-w-none text-gray-900 dark:text-gray-100",purifyConfig:u})})]})},Ap="g7_dismissed_warnings";function Dp(){try{const e=sessionStorage.getItem(Ap);return e?JSON.parse(e):[]}catch{return[]}}function _E(e){try{const t=Dp();t.includes(e)||(t.push(e),sessionStorage.setItem(Ap,JSON.stringify(t)))}catch{}}function EE(e){switch(e){case"error":return"error";case"warning":return"warning";case"info":default:return"info"}}const ME=({warnings:e,className:t=""})=>{const[n,r]=v.useState([]);v.useEffect(()=>{r(Dp())},[]);const s=v.useCallback(i=>{_E(i),r(a=>[...a,i])},[]);if(!e||e.length===0)return null;const o=e.filter(i=>!n.includes(i.id));return o.length===0?null:h.jsx(I,{className:`space-y-2 ${t}`.trim(),children:o.map(i=>h.jsx(hu,{type:EE(i.level),message:i.message,dismissible:!0,onDismiss:()=>s(i.id)},i.id))})},Ip=window.G7Core?.createLogger?.("Comp:FilterVisibility")??{log:(...e)=>console.log("[Comp:FilterVisibility]",...e),warn:(...e)=>console.warn("[Comp:FilterVisibility]",...e),error:(...e)=>console.error("[Comp:FilterVisibility]",...e)},NE=({id:e,visibleFilters:t,defaultFilters:n=[],onFilterVisibilityChange:r})=>{const[s,o]=v.useState(!1),i=v.useRef(!0),a=v.useMemo(()=>{try{const f=window.G7Core?.AuthManager?.getInstance();return f?f.getUser()?.uuid:void 0}catch{return}},[]),l=v.useMemo(()=>`g7_filters_${e}${a!==void 0?`_${a}`:""}`,[e,a]),c=v.useCallback(()=>{try{const f=localStorage.getItem(l);if(f){const g=JSON.parse(f);if(Array.isArray(g))return g}}catch(f){Ip.warn("Failed to load from localStorage:",f)}return null},[l]),d=v.useCallback(f=>{try{localStorage.setItem(l,JSON.stringify(f))}catch(g){Ip.warn("Failed to save to localStorage:",g)}},[l]),u=v.useCallback(()=>{const f=c();return f||(t&&t.length>0?t:n)},[c,t,n]);return v.useEffect(()=>{if(!s){const f=u();r&&f.length>0&&r(f),o(!0)}},[s,r,u]),v.useEffect(()=>{if(s&&t&&t.length>0){if(i.current){i.current=!1;return}d(t)}},[s,t,d]),null},OE=window.G7Core?.createLogger?.("Comp:SlotContainer")??{log:(...e)=>console.log("[Comp:SlotContainer]",...e),warn:(...e)=>console.warn("[Comp:SlotContainer]",...e),error:(...e)=>console.error("[Comp:SlotContainer]",...e)};function TE(e,t){return t&&e&&typeof e.id=="string"&&e.id.length>0?{...e,id:`${e.id}__${t}`}:e}const AE=({slotId:e,className:t="",emptyContent:n,style:r,id:s,children:o})=>{const[i,a]=v.useState([]),[,l]=v.useState({}),c=v.useCallback(()=>{const m=window.__slotContextValue;if(m)return m;const p=window.G7Core;return p&&p.getSlotContext?.()||null},[]),d=v.useCallback(()=>{const m=c();m&&m.isEnabled&&a(m.getSlotComponents(e))},[e,c]);v.useEffect(()=>{const m=c();return!m||!m.isEnabled?void 0:(d(),m.subscribeToSlot(e,()=>{d(),l({})}))},[e,c,d]);const u=v.useCallback(()=>{const m=window.G7Core;return m?m.getDynamicRenderer?.():null},[]);if(i.length===0)return n?h.jsx(I,{className:t,style:r,id:s,children:n}):o?h.jsx(I,{className:t,style:r,id:s,children:o}):null;const f=u(),g=window.G7Core;return!f||!g?(OE.error("G7Core or DynamicRenderer not available"),null):h.jsxs(I,{className:t,style:r,id:s,children:[i.map(m=>{const{componentDef:p,dataContext:y,parentFormContext:b,getParentComponentContext:_,translationContext:x}=m,E=TE(p,s);return h.jsx(f,{componentDef:E,dataContext:y,translationContext:x,registry:g.getComponentRegistry(),bindingEngine:g.getDataBindingEngine(),translationEngine:g.getTranslationEngine(),actionDispatcher:g.getActionDispatcher(),parentComponentContext:_?.(),parentFormContextProp:b,isRootRenderer:!1},E.id||`slot-${e}-${m.order}`)}),o]})},Lp=(e,t)=>window.G7Core?.t?.(e,t)??e,Pp=(e,t,n)=>window.G7Core?.renderComponentLayout?.(e,t,n)??null,DE=({options:e=[],value:t,onChange:n,placeholder:r,disabled:s=!1,className:o="",maxHeight:i="320px",children:a,selectedChildren:l,__componentLayoutDefs:c,id:d,editorAttrs:u})=>{const[f,g]=v.useState(!1),m=v.useRef(null),p=v.useRef(null),y=v.useMemo(()=>t==null?null:e.find(w=>String(w.value)===String(t))||null,[e,t]);v.useEffect(()=>{const w=N=>{m.current&&!m.current.contains(N.target)&&g(!1)};return f&&document.addEventListener("mousedown",w),()=>{document.removeEventListener("mousedown",w)}},[f]),v.useEffect(()=>{const w=N=>{N.key==="Escape"&&f&&(g(!1),p.current?.focus())};return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[f]);const b=v.useCallback(()=>{s||g(w=>!w)},[s]),_=v.useCallback(w=>{n&&n({target:{value:w},preventDefault:()=>{},stopPropagation:()=>{},type:"change"}),g(!1),p.current?.focus()},[n]),x=r??Lp("common.select"),E=()=>{if(!y)return h.jsx(Q,{className:"text-gray-400 dark:text-gray-500",children:x});if(c?.selected){const w=Pp(c.selected,{item:y,isSelected:!0},"selected");if(w)return w}return l||h.jsx(Q,{className:"truncate",children:y.label})},S=(w,N)=>h.jsxs(I,{className:"flex items-center justify-between w-full",children:[h.jsx(Q,{className:N?"text-blue-600 dark:text-blue-400 font-medium":"text-gray-900 dark:text-white",children:w.label}),N&&h.jsx(Wn,{className:"w-5 h-5 text-blue-600 dark:text-blue-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})]});return h.jsxs(I,{ref:m,className:`relative ${o}`,id:d,...u,children:[h.jsxs(oe,{ref:p,type:"button",onClick:b,disabled:s,className:` + ${W?B?"bg-blue-500 text-white dark:bg-blue-600 dark:text-white shadow-md scale-105":"bg-gray-500 text-white dark:bg-gray-600 dark:text-white shadow-md scale-105":B?"bg-blue-50 text-blue-600 dark:bg-blue-900/30 dark:text-blue-400 hover:bg-blue-100 dark:hover:bg-blue-900/50":"bg-gray-100 text-gray-600 dark:bg-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-600"} + `,onClick:()=>S(Y),children:[h.jsx(ae,{name:"globe",className:"w-3 h-3"}),h.jsx(J,{children:d0(Y)}),B&&h.jsx(J,{className:"text-red-500",children:"*"}),U(Y)&&!W&&h.jsx(ae,{name:"check",className:"w-3 h-3 text-green-500 dark:text-green-400"})]},Y)})});return h.jsxs(I,{className:`space-y-2 ${f}`,id:y,...b,children:[h.jsxs(I,{className:"flex items-center justify-between",children:[l&&h.jsx(gn,{className:"block text-sm font-medium text-gray-500 dark:text-gray-400",children:l}),h.jsxs(I,{className:"flex items-center gap-3",children:[k&&!p&&h.jsx(le,{type:"button",onClick:O,className:`px-3 py-1.5 text-xs font-bold rounded-lg focus:outline-none focus:ring-2 ${P?"text-gray-700 dark:text-gray-200 bg-gray-200 dark:bg-gray-600 border border-gray-300 dark:border-gray-500 hover:bg-gray-300 dark:hover:bg-gray-500 focus:ring-gray-400 dark:focus:ring-gray-500":"text-blue-600 dark:text-blue-400 bg-white dark:bg-gray-700 border border-blue-300 dark:border-blue-600 hover:bg-blue-50 dark:hover:bg-gray-600 focus:ring-blue-500 dark:focus:ring-blue-600"}`,children:ha(P?"common.preview_off":"common.preview")}),c&&h.jsxs(gn,{className:"flex items-center gap-2 p-2 cursor-pointer",children:[h.jsx(Et,{type:"checkbox",name:m,checked:k,onChange:D,disabled:p,className:"w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600"}),h.jsx(I,{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:ha("common.html_mode")})]})]})]}),r&&j(),!P&&(r?_.map(Y=>h.jsx(I,{className:M===Y?"block":"hidden",children:h.jsx(lr,{name:`${g}[${Y}]`,value:E[Y]??"",onChange:B=>A(Y,B.target.value),placeholder:`${a} (${d0(Y)})`,rows:i,readOnly:p,className:`block w-full rounded-lg border px-3 py-2 text-sm placeholder-gray-400 dark:placeholder-gray-500 focus:outline-none focus:ring-1 disabled:opacity-50 disabled:cursor-not-allowed ${k?"font-mono bg-white dark:bg-gray-800 border-blue-300 dark:border-blue-600 text-gray-800 dark:text-gray-200 focus:border-blue-500 focus:ring-blue-500":"bg-white dark:bg-gray-800 border-gray-300 dark:border-gray-600 text-gray-900 dark:text-white focus:border-blue-500 focus:ring-blue-500"}`})},Y)):h.jsx(lr,{name:g,value:C,onChange:F,placeholder:a,rows:i,readOnly:p,className:`block w-full rounded-lg border px-3 py-2 text-sm placeholder-gray-400 dark:placeholder-gray-500 focus:outline-none focus:ring-1 disabled:opacity-50 disabled:cursor-not-allowed ${k?"font-mono bg-white dark:bg-gray-800 border-blue-300 dark:border-blue-600 text-gray-800 dark:text-gray-200 focus:border-blue-500 focus:ring-blue-500":"bg-white dark:bg-gray-800 border-gray-300 dark:border-gray-600 text-gray-900 dark:text-white focus:border-blue-500 focus:ring-blue-500"}`})),P&&h.jsx(I,{className:"p-4 bg-gray-50 dark:bg-gray-900 rounded-lg border border-gray-200 dark:border-gray-800 min-h-[400px]",children:h.jsx(kl,{content:z,isHtml:!0,className:d||"prose dark:prose-invert max-w-none text-gray-900 dark:text-gray-100",purifyConfig:u})})]})},u0="g7_dismissed_warnings";function f0(){try{const e=sessionStorage.getItem(u0);return e?JSON.parse(e):[]}catch{return[]}}function NM(e){try{const t=f0();t.includes(e)||(t.push(e),sessionStorage.setItem(u0,JSON.stringify(t)))}catch{}}function OM(e){switch(e){case"error":return"error";case"warning":return"warning";case"info":default:return"info"}}const TM=({warnings:e,className:t=""})=>{const[n,r]=v.useState([]);v.useEffect(()=>{r(f0())},[]);const s=v.useCallback(i=>{NM(i),r(a=>[...a,i])},[]);if(!e||e.length===0)return null;const o=e.filter(i=>!n.includes(i.id));return o.length===0?null:h.jsx(I,{className:`space-y-2 ${t}`.trim(),children:o.map(i=>h.jsx(Ku,{type:OM(i.level),message:i.message,dismissible:!0,onDismiss:()=>s(i.id)},i.id))})},h0=window.G7Core?.createLogger?.("Comp:FilterVisibility")??{log:(...e)=>console.log("[Comp:FilterVisibility]",...e),warn:(...e)=>console.warn("[Comp:FilterVisibility]",...e),error:(...e)=>console.error("[Comp:FilterVisibility]",...e)},AM=({id:e,visibleFilters:t,defaultFilters:n=[],onFilterVisibilityChange:r})=>{const[s,o]=v.useState(!1),i=v.useRef(!0),a=v.useMemo(()=>{try{const f=window.G7Core?.AuthManager?.getInstance();return f?f.getUser()?.uuid:void 0}catch{return}},[]),l=v.useMemo(()=>`g7_filters_${e}${a!==void 0?`_${a}`:""}`,[e,a]),c=v.useCallback(()=>{try{const f=localStorage.getItem(l);if(f){const g=JSON.parse(f);if(Array.isArray(g))return g}}catch(f){h0.warn("Failed to load from localStorage:",f)}return null},[l]),d=v.useCallback(f=>{try{localStorage.setItem(l,JSON.stringify(f))}catch(g){h0.warn("Failed to save to localStorage:",g)}},[l]),u=v.useCallback(()=>{const f=c();return f||(t&&t.length>0?t:n)},[c,t,n]);return v.useEffect(()=>{if(!s){const f=u();r&&f.length>0&&r(f),o(!0)}},[s,r,u]),v.useEffect(()=>{if(s&&t&&t.length>0){if(i.current){i.current=!1;return}d(t)}},[s,t,d]),null},DM=window.G7Core?.createLogger?.("Comp:SlotContainer")??{log:(...e)=>console.log("[Comp:SlotContainer]",...e),warn:(...e)=>console.warn("[Comp:SlotContainer]",...e),error:(...e)=>console.error("[Comp:SlotContainer]",...e)};function IM(e,t){return t&&e&&typeof e.id=="string"&&e.id.length>0?{...e,id:`${e.id}__${t}`}:e}const LM=({slotId:e,className:t="",emptyContent:n,style:r,id:s,children:o})=>{const[i,a]=v.useState([]),[,l]=v.useState({}),c=v.useCallback(()=>{const m=window.__slotContextValue;if(m)return m;const p=window.G7Core;return p&&p.getSlotContext?.()||null},[]),d=v.useCallback(()=>{const m=c();m&&m.isEnabled&&a(m.getSlotComponents(e))},[e,c]);v.useEffect(()=>{const m=c();return!m||!m.isEnabled?void 0:(d(),m.subscribeToSlot(e,()=>{d(),l({})}))},[e,c,d]);const u=v.useCallback(()=>{const m=window.G7Core;return m?m.getDynamicRenderer?.():null},[]);if(i.length===0)return n?h.jsx(I,{className:t,style:r,id:s,children:n}):o?h.jsx(I,{className:t,style:r,id:s,children:o}):null;const f=u(),g=window.G7Core;return!f||!g?(DM.error("G7Core or DynamicRenderer not available"),null):h.jsxs(I,{className:t,style:r,id:s,children:[i.map(m=>{const{componentDef:p,dataContext:y,parentFormContext:b,getParentComponentContext:_,translationContext:x}=m,M=IM(p,s);return h.jsx(f,{componentDef:M,dataContext:y,translationContext:x,registry:g.getComponentRegistry(),bindingEngine:g.getDataBindingEngine(),translationEngine:g.getTranslationEngine(),actionDispatcher:g.getActionDispatcher(),parentComponentContext:_?.(),parentFormContextProp:b,isRootRenderer:!1},M.id||`slot-${e}-${m.order}`)}),o]})},g0=(e,t)=>window.G7Core?.t?.(e,t)??e,p0=(e,t,n)=>window.G7Core?.renderComponentLayout?.(e,t,n)??null,PM=({options:e=[],value:t,onChange:n,placeholder:r,disabled:s=!1,className:o="",maxHeight:i="320px",children:a,selectedChildren:l,__componentLayoutDefs:c,id:d,editorAttrs:u})=>{const[f,g]=v.useState(!1),m=v.useRef(null),p=v.useRef(null),y=v.useMemo(()=>t==null?null:e.find(k=>String(k.value)===String(t))||null,[e,t]);v.useEffect(()=>{const k=N=>{m.current&&!m.current.contains(N.target)&&g(!1)};return f&&document.addEventListener("mousedown",k),()=>{document.removeEventListener("mousedown",k)}},[f]),v.useEffect(()=>{const k=N=>{N.key==="Escape"&&f&&(g(!1),p.current?.focus())};return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[f]);const b=v.useCallback(()=>{s||g(k=>!k)},[s]),_=v.useCallback(k=>{n&&n({target:{value:k},preventDefault:()=>{},stopPropagation:()=>{},type:"change"}),g(!1),p.current?.focus()},[n]),x=r??g0("common.select"),M=()=>{if(!y)return h.jsx(J,{className:"text-gray-400 dark:text-gray-500",children:x});if(c?.selected){const k=p0(c.selected,{item:y,isSelected:!0},"selected");if(k)return k}return l||h.jsx(J,{className:"truncate",children:y.label})},S=(k,N)=>h.jsxs(I,{className:"flex items-center justify-between w-full",children:[h.jsx(J,{className:N?"text-blue-600 dark:text-blue-400 font-medium":"text-gray-900 dark:text-white",children:k.label}),N&&h.jsx(Jn,{className:"w-5 h-5 text-blue-600 dark:text-blue-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})]});return h.jsxs(I,{ref:m,className:`relative ${o}`,id:d,...u,children:[h.jsxs(le,{ref:p,type:"button",onClick:b,disabled:s,className:` w-full px-4 py-2.5 bg-gray-100 dark:bg-gray-700 border-0 rounded-xl @@ -256,27 +257,27 @@ self.addEventListener('message', async (e) => { flex items-center justify-between gap-2 text-left cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed - `,"aria-haspopup":"listbox","aria-expanded":f,children:[h.jsx(I,{className:"flex-1 min-w-0",children:E()}),h.jsx(Wn,{className:`w-4 h-4 flex-shrink-0 transition-transform duration-200 ${f?"rotate-180":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),f&&h.jsx(I,{className:"absolute z-50 w-full mt-2 bg-white dark:bg-gray-800 rounded-2xl shadow-lg border border-gray-200 dark:border-gray-600 overflow-hidden",role:"listbox",children:h.jsx(I,{className:"overflow-auto",style:{maxHeight:i},children:e.length===0?h.jsx(I,{className:"px-4 py-6 text-center text-gray-500 dark:text-gray-400",children:Lp("common.no_options")}):e.map((w,N)=>{const C=String(w.value)===String(t);return h.jsx(oe,{type:"button",onClick:()=>!w.disabled&&_(w.value),disabled:w.disabled,className:` + `,"aria-haspopup":"listbox","aria-expanded":f,children:[h.jsx(I,{className:"flex-1 min-w-0",children:M()}),h.jsx(Jn,{className:`w-4 h-4 flex-shrink-0 transition-transform duration-200 ${f?"rotate-180":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),f&&h.jsx(I,{className:"absolute z-50 w-full mt-2 bg-white dark:bg-gray-800 rounded-2xl shadow-lg border border-gray-200 dark:border-gray-600 overflow-hidden",role:"listbox",children:h.jsx(I,{className:"overflow-auto",style:{maxHeight:i},children:e.length===0?h.jsx(I,{className:"px-4 py-6 text-center text-gray-500 dark:text-gray-400",children:g0("common.no_options")}):e.map((k,N)=>{const C=String(k.value)===String(t);return h.jsx(le,{type:"button",onClick:()=>!k.disabled&&_(k.value),disabled:k.disabled,className:` w-full px-4 py-3 text-left text-sm hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors ${C?"bg-blue-50 dark:bg-blue-900/20":""} - ${w.disabled?"opacity-50 cursor-not-allowed":"cursor-pointer"} - `,role:"option","aria-selected":C,"data-item-value":w.value,"data-item-index":N,"data-item-selected":C,children:c?.item?Pp(c.item,{item:w,index:N,isSelected:C},`item-${N}`):a||S(w,C)},w.value)})})})]})};function IE(e){const t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16)}:null}const LE=({value:e,checked:t=!1,icon:n,label:r,variant:s="blue",customColor:o,className:i="",style:a,onChange:l,id:c,editorAttrs:d})=>{const[u,f]=v.useState(!1),g="inline-flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm font-medium border cursor-pointer transition-all";if(o){const b=IE(o),_=document.documentElement.classList.contains("dark");let x;return t?x={backgroundColor:o,color:"#ffffff",borderColor:o,opacity:u?.85:1}:x=b?{backgroundColor:`rgba(${b.r}, ${b.g}, ${b.b}, ${u?_?.25:.12:_?.15:.06})`,color:o,borderColor:`rgba(${b.r}, ${b.g}, ${b.b}, ${_?.3:.2})`}:{},h.jsxs(on,{className:`${g} ${i}`,style:{...x,...a},onMouseEnter:()=>f(!0),onMouseLeave:()=>f(!1),id:c,...d,children:[h.jsx(wt,{type:"checkbox",value:e,checked:t,onChange:E=>{l?.(E)},className:"hidden"}),n&&h.jsx(re,{name:n,className:"w-4 h-4"}),h.jsx(I,{children:r})]})}const y=t?{green:"bg-green-600 dark:bg-green-600 text-white dark:text-white border-green-700 dark:border-green-500 hover:bg-green-700 dark:hover:bg-green-500",orange:"bg-orange-600 dark:bg-orange-600 text-white dark:text-white border-orange-700 dark:border-orange-500 hover:bg-orange-700 dark:hover:bg-orange-500",yellow:"bg-yellow-600 dark:bg-yellow-600 text-white dark:text-white border-yellow-700 dark:border-yellow-500 hover:bg-yellow-700 dark:hover:bg-yellow-500",gray:"bg-gray-600 dark:bg-gray-500 text-white dark:text-white border-gray-700 dark:border-gray-400 hover:bg-gray-700 dark:hover:bg-gray-400",blue:"bg-blue-600 dark:bg-blue-600 text-white dark:text-white border-blue-700 dark:border-blue-500 hover:bg-blue-700 dark:hover:bg-blue-500"}[s]:{green:"bg-green-50 dark:bg-green-900/20 text-green-600 dark:text-green-400 border-green-200 dark:border-green-800 hover:bg-green-100 dark:hover:bg-green-900/30",orange:"bg-orange-50 dark:bg-orange-900/20 text-orange-600 dark:text-orange-400 border-orange-200 dark:border-orange-800 hover:bg-orange-100 dark:hover:bg-orange-900/30",yellow:"bg-yellow-50 dark:bg-yellow-900/20 text-yellow-600 dark:text-yellow-400 border-yellow-200 dark:border-yellow-800 hover:bg-yellow-100 dark:hover:bg-yellow-900/30",gray:"bg-gray-50 dark:bg-gray-700 text-gray-600 dark:text-gray-300 border-gray-200 dark:border-gray-600 hover:bg-gray-100 dark:hover:bg-gray-600",blue:"bg-blue-50 dark:bg-blue-900/20 text-blue-600 dark:text-blue-400 border-blue-200 dark:border-blue-800 hover:bg-blue-100 dark:hover:bg-blue-900/30"}[s];return h.jsxs(on,{className:`${g} ${y} ${i}`,style:a,id:c,...d,children:[h.jsx(wt,{type:"checkbox",value:e,checked:t,onChange:b=>{l?.(b)},className:"hidden"}),n&&h.jsx(re,{name:n,className:"w-4 h-4"}),h.jsx(I,{children:r})]})},PE=({label:e,icon:t,iconPosition:n="left",position:r="right",className:s="",style:o,children:i})=>{const[a,l]=v.useState(!1),[c,d]=v.useState({top:0,left:0}),u=v.useRef(null),f=v.useRef(null),g=v.useCallback(()=>{if(!u.current)return;const p=u.current.getBoundingClientRect(),y=224;let b=r==="right"?p.right-y:p.left;const _=p.bottom+8;b<8&&(b=8),b+y>window.innerWidth-8&&(b=window.innerWidth-y-8),d({top:_,left:b})},[r]);v.useEffect(()=>{a&&g()},[a,g]),v.useEffect(()=>{if(!a)return;const p=()=>{l(!1)};return window.addEventListener("scroll",p,!0),window.addEventListener("resize",p),()=>{window.removeEventListener("scroll",p,!0),window.removeEventListener("resize",p)}},[a]),v.useEffect(()=>{const p=y=>{const b=y.target,_=u.current?.contains(b),x=f.current?.contains(b);!_&&!x&&l(!1)};return a&&document.addEventListener("mousedown",p),()=>{document.removeEventListener("mousedown",p)}},[a]);const m=a?Dn.createPortal(h.jsx("div",{ref:f,className:"fixed z-[9999] w-56 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg overflow-hidden",style:{top:c.top,left:c.left},onClick:()=>l(!1),children:i}),document.body):null;return h.jsxs(I,{className:`relative inline-block ${s}`,style:o,children:[h.jsxs(oe,{ref:u,onClick:()=>l(!a),className:"flex items-center gap-2",children:[n==="left"&&t&&h.jsx(re,{name:t,className:"w-4 h-4"}),e&&h.jsx(Q,{className:"text-sm font-medium",children:e}),n==="right"&&t&&h.jsx(re,{name:t,className:"w-4 h-4"})]}),m]})},$E=({label:e,icon:t,variant:n="default",disabled:r=!1,divider:s=!1,className:o="",style:i,onClick:a})=>{if(s)return h.jsx(I,{className:"h-px bg-gray-200 dark:bg-gray-700 my-1",style:i});const l=n==="danger"?"text-red-600 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/20":"text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-700",c=r?"opacity-50 cursor-not-allowed":"cursor-pointer",d=()=>{!r&&a&&a()};return h.jsxs(I,{onClick:d,className:`flex items-center gap-3 px-4 py-3 transition-colors ${l} ${c} ${o}`,style:i,children:[t&&h.jsx(re,{name:t,className:"w-4 h-4"}),e&&h.jsx(Q,{className:"text-sm font-medium",children:e})]})},FE=()=>window.G7Core,zc=v.createContext(null),$p=()=>{const e=v.useContext(zc);if(!e){const t=FE(),n=t?.locale?.current?.()||"ko",r=t?.locale?.supported?.()||["ko","en"];return{activeLocale:n,getActiveLocale:()=>t?.locale?.current?.()||"ko",supportedLocales:r,isInsideMultilingualTabPanel:!1}}return{...e,isInsideMultilingualTabPanel:!0}},VE=()=>window.G7Core,zE=({value:e,onChange:t,placeholder:n,readOnly:r,disabled:s,hasError:o})=>{const{activeLocale:i,getActiveLocale:a}=$p(),l=typeof e=="string"?{[i]:e}:e||{},c=v.useCallback(u=>{const f=a();t({...l,[f]:u.target.value})},[l,a,t]),d=o?"border-red-500 dark:border-red-500 focus:ring-red-500 focus:border-red-500":"border-gray-300 dark:border-gray-600 focus:ring-blue-500 focus:border-blue-500";return h.jsx(wt,{type:"text",value:l[i]||"",onChange:c,placeholder:n,readOnly:r,disabled:s,className:`w-full px-3 py-2 text-sm border ${d} rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:ring-2`})},HE=(e,t)=>{if(!t)return!1;const n=t.startsWith("!"),r=n?t.slice(1):t,s=!!e[r];return n?!s:s},UE=({column:e,item:t,index:n,onValueChange:r,readOnly:s,error:o})=>{const i=t[e.key],a=s||e.readOnly||HE(t,e.readOnlyCondition)||e.disabled,l=!!o,c=l?"border-red-500 dark:border-red-500 focus:ring-red-500 focus:border-red-500":"border-gray-300 dark:border-gray-600 focus:ring-blue-500 focus:border-blue-500",d=v.useCallback(f=>{r(e.key,f)},[e.key,r]),u=f=>h.jsxs(I,{className:"w-full",children:[f,l&&h.jsx(Q,{className:"text-xs text-red-500 dark:text-red-400 mt-1 block",children:o})]});switch(e.type){case"input":return u(h.jsx(wt,{type:"text",value:i||"",onChange:f=>d(f.target.value),placeholder:e.placeholder,readOnly:a,disabled:a,className:`w-full px-3 py-2 text-sm border ${c} rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:ring-2 ${e.className||""}`}));case"number":return u(h.jsx(wt,{type:"number",value:i??"",onChange:f=>d(f.target.value?Number(f.target.value):null),placeholder:e.placeholder,min:e.min,max:e.max,step:e.step,readOnly:a,disabled:a,className:`w-full px-3 py-2 text-sm border ${c} rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:ring-2 ${e.className||""}`}));case"select":return u(h.jsxs(Vr,{value:i??"",onChange:f=>d(f.target.value),disabled:a,className:`w-full px-3 py-2 text-sm border ${c} rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:ring-2 ${e.className||""}`,children:[h.jsx("option",{value:"",children:"선택하세요"}),e.options?.map(f=>h.jsx("option",{value:f.value,disabled:f.disabled,children:f.label},f.value))]}));case"textarea":return u(h.jsx(Rn,{value:i||"",onChange:f=>d(f.target.value),placeholder:e.placeholder,readOnly:a,disabled:a,className:`w-full px-3 py-2 text-sm border ${c} rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:ring-2 resize-none ${e.className||""}`,rows:2}));case"multilingual":return u(h.jsx(zE,{value:i,onChange:f=>d(f),placeholder:e.placeholder,readOnly:a,disabled:a,hasError:l}));case"custom":return e.render?h.jsx(h.Fragment,{children:e.render(t,n,d)}):h.jsx(Q,{className:"text-gray-500 dark:text-gray-400",children:"-"});default:return h.jsx(Q,{className:"text-gray-900 dark:text-white text-sm",children:String(i??"")})}},BE=(e,t,n)=>{if(!e)return;if(n==="multilingual"){const o=VE()?.locale?.current?.()||"ko",i=`${t}.${o}`;return e[i]?.[0]}return e[t]?.[0]},jE=({item:e,index:t,id:n,columns:r,enableDrag:s=!0,showIndex:o=!0,canRemove:i=!0,rowActions:a,readOnly:l=!1,onValueChange:c,onRemove:d,className:u="",level:f=0,errors:g})=>{const{attributes:m,listeners:p,setNodeRef:y,transform:b,transition:_,isDragging:x}=Pi({id:n,disabled:!s||l}),E={transform:Fn.Transform.toString(b),transition:_,opacity:x?.5:1},S=v.useCallback((C,k)=>{c?.(C,k)},[c]),w=v.useCallback(C=>{C.onClick?.(e,t)},[e,t]),N=f>0?{paddingLeft:`${f*24}px`}:{};return h.jsxs(I,{ref:y,style:E,className:`flex items-center gap-2 py-2 px-2 border-b border-gray-100 dark:border-gray-700 last:border-b-0 hover:bg-gray-50 dark:hover:bg-gray-800/50 transition-colors ${x?"bg-blue-50 dark:bg-blue-900/20 shadow-lg rounded-lg z-10":""} ${u}`,children:[s&&!l&&h.jsx(I,{...m,...p,className:"flex-shrink-0 w-6 h-6 flex items-center justify-center cursor-grab active:cursor-grabbing text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-400",style:N,children:h.jsx(re,{name:"grip-vertical",className:"w-4 h-4"})}),o&&h.jsx(I,{className:"flex-shrink-0 w-8 text-center text-sm text-gray-500 dark:text-gray-400 font-medium",children:t+1}),r.map(C=>{const k=BE(g,C.key,C.type);return h.jsx(I,{className:`flex-1 min-w-0 ${C.width||""}`,style:C.width?{flex:"none",width:C.width}:{},children:h.jsx(UE,{column:C,item:e,index:t,onValueChange:S,readOnly:l,error:k})},C.key)}),a&&a.length>0&&!l&&h.jsx(I,{className:"flex-shrink-0 flex items-center gap-1",children:a.map(C=>{const k=typeof C.disabled=="function"?C.disabled(e,t):C.disabled;return h.jsx(oe,{type:"button",onClick:()=>w(C),disabled:k,className:`p-1.5 rounded transition-colors ${C.danger?"text-red-500 hover:bg-red-50 dark:hover:bg-red-900/20 hover:text-red-600":"text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 hover:text-gray-600 dark:hover:text-gray-300"} disabled:opacity-50 disabled:cursor-not-allowed`,title:C.label,children:C.icon?h.jsx(re,{name:C.icon,className:"w-4 h-4"}):h.jsx(Q,{className:"text-xs",children:C.label})},C.key)})}),i&&!a&&!l&&h.jsx(I,{className:"flex-shrink-0",children:h.jsx(oe,{type:"button",onClick:d,className:"p-1.5 text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 hover:text-gray-600 dark:hover:text-gray-300 rounded transition-colors",title:"삭제",children:h.jsx(re,{name:"minus",className:"w-4 h-4"})})})]})},Fp=()=>window.G7Core,Hc=()=>`item_${Date.now()}_${Math.random().toString(36).substring(2,9)}`,WE=e=>{const t={_id:Hc()};return e.forEach(n=>{if(n.type==="multilingual"){const s=Fp()?.locale?.all?.()||["ko","en"],o={};s.forEach(i=>{o[i]=""}),t[n.key]=o}else n.type==="number"?t[n.key]=null:(n.type,t[n.key]="")}),t},GE=(e,t)=>{if(!e)return{};const n=`fields.${t}.`,r={};return Object.keys(e).forEach(s=>{if(s.startsWith(n)){const o=s.substring(n.length);r[o]=e[s]}}),r},YE=({items:e=[],columns:t,onChange:n,onAddItem:r,onRemoveItem:s,onReorder:o,addLabel:i="항목 추가",enableDrag:a=!0,showIndex:l=!0,minItems:c=0,maxItems:d,rowActions:u,emptyMessage:f="항목이 없습니다.",className:g="",headerClassName:m="",rowClassName:p="",name:y,readOnly:b=!1,createDefaultItem:_,childrenKey:x,itemIdKey:E="_id",errors:S,id:w,editorAttrs:N})=>{const C=v.useRef(null),k=v.useRef([]),M=v.useRef(null),T=v.useMemo(()=>{let j=!1;for(const U of e)if(U[E]==null){j=!0;break}return j?e.map(U=>U[E]!=null?U:{...U,[E]:Hc()}):e},[e,E]);k.current=T,v.useEffect(()=>{M.current=null},[T]);const L=v.useCallback(j=>String(j[E]??""),[E]);v.useEffect(()=>{if(y){const j=Fp();j?.form&&(C.current=j.form)}},[y]);const P=Yl(es(Zs,{activationConstraint:{distance:8}}),es(qs,{coordinateGetter:$i})),F=v.useMemo(()=>T.map(j=>L(j)),[T,L]),D=v.useCallback(j=>{const{active:U,over:B}=j;if(B&&U.id!==B.id){const G=M.current??k.current,z=G.map(Z=>String(Z[E]??"")),K=z.indexOf(String(U.id)),Y=z.indexOf(String(B.id));if(K!==-1&&Y!==-1){const Z=ns([...G],K,Y);M.current=Z,n?.(Z),o?.(Z)}}},[n,o,E]),A=v.useCallback((j,U,B)=>{const z=[...M.current??k.current];z[j]={...z[j],[U]:B},M.current=z,n?.(z)},[n]),O=v.useCallback(()=>{const j=M.current??k.current;if(d&&j.length>=d)return;if(r){r();return}const U=_?_():WE(t);U[E]||(U[E]=Hc());const B=[...j,U];M.current=B,n?.(B)},[d,r,_,t,E,n]),V=v.useCallback(j=>{const U=M.current??k.current;if(U.length<=c)return;const B=U[j];if(s){s(j,B);return}const G=U.filter((z,K)=>K!==j);M.current=G,n?.(G)},[c,s,n]),H=T.length>c,W=!d||T.lengthh.jsxs(I,{className:`flex-1 min-w-0 text-xs font-medium text-gray-500 dark:text-gray-400 uppercase ${j.width||""}`,style:j.width?{flex:"none",width:j.width}:{},children:[j.label,j.required&&h.jsx(Q,{className:"text-red-500 dark:text-red-400 ml-0.5",children:"*"})]},j.key)),(u||!b&&H)&&h.jsx(I,{className:"flex-shrink-0 w-8"})]}),T.length>0?h.jsx(rc,{sensors:P,collisionDetection:Kl,onDragEnd:D,children:h.jsx(Li,{items:F,strategy:sc,children:h.jsx(I,{className:"border-x border-gray-200 dark:border-gray-700",children:T.map((j,U)=>{const B=L(j),G=GE(S,U);return h.jsx(jE,{id:B,item:j,index:U,columns:t,enableDrag:a,showIndex:l,canRemove:H,rowActions:u,readOnly:b,onValueChange:(z,K)=>A(U,z,K),onRemove:()=>V(U),className:p,errors:G},B)})})})}):h.jsx(I,{className:"border-x border-gray-200 dark:border-gray-700 py-8 text-center text-gray-500 dark:text-gray-400 text-sm",children:f}),!b&&W&&h.jsx(I,{className:"relative border border-gray-200 dark:border-gray-700 border-t-0 rounded-b-lg",children:h.jsx(I,{className:"flex items-center justify-center py-2",children:h.jsxs(oe,{type:"button",onClick:O,className:"flex items-center gap-1.5 px-4 py-1.5 text-sm text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:[h.jsx(re,{name:"plus",className:"w-4 h-4"}),h.jsx(Q,{children:i})]})})}),(b||!W)&&T.length>0&&h.jsx(I,{className:"border-x border-b border-gray-200 dark:border-gray-700 rounded-b-lg h-1"})]})},Vp=()=>window.G7Core,KE=()=>Vp()?.locale?.supported?.()??["ko","en"],XE=()=>Vp()?.locale?.current?.()??"ko",qE={ko:"한국어",en:"English",ja:"日本語",zh:"中文"},ZE=({children:e,className:t="",style:n,variant:r="default",defaultLocale:s,onLocaleChange:o,locales:i})=>{const a=v.useMemo(()=>i&&i.length>0?i:KE(),[i]),[l,c]=v.useState(s||XE());v.useEffect(()=>{if(a.length>0&&!a.includes(l)){const p=a[0];c(p),o?.(p)}},[a,l,o]);const d=v.useRef(l);d.current=l;const u=v.useCallback(()=>d.current,[]),f=v.useCallback(p=>{c(p),o?.(p)},[o]),g=v.useMemo(()=>({activeLocale:l,getActiveLocale:u,supportedLocales:a}),[l,u,a]),m=p=>{const y=p===l,b="px-4 py-2 text-sm font-medium transition-all";return r==="pills"?y?`${b} bg-blue-600 text-white rounded-lg`:`${b} text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg`:r==="underline"?y?`${b} text-blue-600 dark:text-blue-400 border-b-2 border-blue-600 dark:border-blue-400`:`${b} text-gray-600 dark:text-gray-400 border-b-2 border-transparent hover:border-gray-300 dark:hover:border-gray-500`:y?`${b} text-blue-600 dark:text-blue-400 bg-blue-50 dark:bg-blue-900/20 border-b-2 border-blue-600`:`${b} text-gray-600 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-700 border-b-2 border-transparent`};return h.jsxs(I,{className:t,style:n,children:[h.jsx(Po,{className:"flex gap-1 border-b border-gray-200 dark:border-gray-700 mb-4",children:a.map(p=>h.jsx(oe,{type:"button",onClick:()=>f(p),className:m(p),children:h.jsx(Q,{children:qE[p]||p})},p))}),h.jsx(zc.Provider,{value:g,children:e})]})},QE=({label:e,required:t=!1,error:n,helperText:r,className:s="",labelClassName:o="",children:i,horizontal:a=!1,labelWidth:l="w-1/3",id:c,editorAttrs:d})=>{const u=a?`flex items-start gap-4 ${s}`:`space-y-1 ${s}`,f=a?`${l} flex-shrink-0 pt-2`:"",g=a?"flex-1":"";return h.jsxs(I,{className:u,id:c,...d,children:[e&&h.jsx(I,{className:f,children:h.jsxs(on,{className:`block text-sm font-medium text-gray-700 dark:text-gray-300 ${o}`,children:[e,t&&h.jsx("span",{className:"ml-1 text-red-500 dark:text-red-400",children:"*"})]})}),h.jsxs(I,{className:`${g} ${n?"form-field-error":""}`.trim(),children:[i,r&&!n&&h.jsx(I,{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:r}),n&&h.jsx(I,{className:"mt-1 text-xs text-red-600 dark:text-red-400",children:n})]})]})};/*! + ${k.disabled?"opacity-50 cursor-not-allowed":"cursor-pointer"} + `,role:"option","aria-selected":C,"data-item-value":k.value,"data-item-index":N,"data-item-selected":C,children:c?.item?p0(c.item,{item:k,index:N,isSelected:C},`item-${N}`):a||S(k,C)},k.value)})})})]})};function $M(e){const t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16)}:null}const FM=({value:e,checked:t=!1,icon:n,label:r,variant:s="blue",customColor:o,className:i="",style:a,onChange:l,id:c,editorAttrs:d})=>{const[u,f]=v.useState(!1),g="inline-flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm font-medium border cursor-pointer transition-all";if(o){const b=$M(o),_=document.documentElement.classList.contains("dark");let x;return t?x={backgroundColor:o,color:"#ffffff",borderColor:o,opacity:u?.85:1}:x=b?{backgroundColor:`rgba(${b.r}, ${b.g}, ${b.b}, ${u?_?.25:.12:_?.15:.06})`,color:o,borderColor:`rgba(${b.r}, ${b.g}, ${b.b}, ${_?.3:.2})`}:{},h.jsxs(gn,{className:`${g} ${i}`,style:{...x,...a},onMouseEnter:()=>f(!0),onMouseLeave:()=>f(!1),id:c,...d,children:[h.jsx(Et,{type:"checkbox",value:e,checked:t,onChange:M=>{l?.(M)},className:"hidden"}),n&&h.jsx(ae,{name:n,className:"w-4 h-4"}),h.jsx(I,{children:r})]})}const y=t?{green:"bg-green-600 dark:bg-green-600 text-white dark:text-white border-green-700 dark:border-green-500 hover:bg-green-700 dark:hover:bg-green-500",orange:"bg-orange-600 dark:bg-orange-600 text-white dark:text-white border-orange-700 dark:border-orange-500 hover:bg-orange-700 dark:hover:bg-orange-500",yellow:"bg-yellow-600 dark:bg-yellow-600 text-white dark:text-white border-yellow-700 dark:border-yellow-500 hover:bg-yellow-700 dark:hover:bg-yellow-500",gray:"bg-gray-600 dark:bg-gray-500 text-white dark:text-white border-gray-700 dark:border-gray-400 hover:bg-gray-700 dark:hover:bg-gray-400",blue:"bg-blue-600 dark:bg-blue-600 text-white dark:text-white border-blue-700 dark:border-blue-500 hover:bg-blue-700 dark:hover:bg-blue-500"}[s]:{green:"bg-green-50 dark:bg-green-900/20 text-green-600 dark:text-green-400 border-green-200 dark:border-green-800 hover:bg-green-100 dark:hover:bg-green-900/30",orange:"bg-orange-50 dark:bg-orange-900/20 text-orange-600 dark:text-orange-400 border-orange-200 dark:border-orange-800 hover:bg-orange-100 dark:hover:bg-orange-900/30",yellow:"bg-yellow-50 dark:bg-yellow-900/20 text-yellow-600 dark:text-yellow-400 border-yellow-200 dark:border-yellow-800 hover:bg-yellow-100 dark:hover:bg-yellow-900/30",gray:"bg-gray-50 dark:bg-gray-700 text-gray-600 dark:text-gray-300 border-gray-200 dark:border-gray-600 hover:bg-gray-100 dark:hover:bg-gray-600",blue:"bg-blue-50 dark:bg-blue-900/20 text-blue-600 dark:text-blue-400 border-blue-200 dark:border-blue-800 hover:bg-blue-100 dark:hover:bg-blue-900/30"}[s];return h.jsxs(gn,{className:`${g} ${y} ${i}`,style:a,id:c,...d,children:[h.jsx(Et,{type:"checkbox",value:e,checked:t,onChange:b=>{l?.(b)},className:"hidden"}),n&&h.jsx(ae,{name:n,className:"w-4 h-4"}),h.jsx(I,{children:r})]})},zM=({label:e,icon:t,iconPosition:n="left",position:r="right",className:s="",style:o,children:i})=>{const[a,l]=v.useState(!1),[c,d]=v.useState({top:0,left:0}),u=v.useRef(null),f=v.useRef(null),g=v.useCallback(()=>{if(!u.current)return;const p=u.current.getBoundingClientRect(),y=224;let b=r==="right"?p.right-y:p.left;const _=p.bottom+8;b<8&&(b=8),b+y>window.innerWidth-8&&(b=window.innerWidth-y-8),d({top:_,left:b})},[r]);v.useEffect(()=>{a&&g()},[a,g]),v.useEffect(()=>{if(!a)return;const p=()=>{l(!1)};return window.addEventListener("scroll",p,!0),window.addEventListener("resize",p),()=>{window.removeEventListener("scroll",p,!0),window.removeEventListener("resize",p)}},[a]),v.useEffect(()=>{const p=y=>{const b=y.target,_=u.current?.contains(b),x=f.current?.contains(b);!_&&!x&&l(!1)};return a&&document.addEventListener("mousedown",p),()=>{document.removeEventListener("mousedown",p)}},[a]);const m=a?Vn.createPortal(h.jsx("div",{ref:f,className:"fixed z-[9999] w-56 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg overflow-hidden",style:{top:c.top,left:c.left},onClick:()=>l(!1),children:i}),document.body):null;return h.jsxs(I,{className:`relative inline-block ${s}`,style:o,children:[h.jsxs(le,{ref:u,onClick:()=>l(!a),className:"flex items-center gap-2",children:[n==="left"&&t&&h.jsx(ae,{name:t,className:"w-4 h-4"}),e&&h.jsx(J,{className:"text-sm font-medium",children:e}),n==="right"&&t&&h.jsx(ae,{name:t,className:"w-4 h-4"})]}),m]})},VM=({label:e,icon:t,variant:n="default",disabled:r=!1,divider:s=!1,className:o="",style:i,onClick:a})=>{if(s)return h.jsx(I,{className:"h-px bg-gray-200 dark:bg-gray-700 my-1",style:i});const l=n==="danger"?"text-red-600 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/20":"text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-700",c=r?"opacity-50 cursor-not-allowed":"cursor-pointer",d=()=>{!r&&a&&a()};return h.jsxs(I,{onClick:d,className:`flex items-center gap-3 px-4 py-3 transition-colors ${l} ${c} ${o}`,style:i,children:[t&&h.jsx(ae,{name:t,className:"w-4 h-4"}),e&&h.jsx(J,{className:"text-sm font-medium",children:e})]})},HM=()=>window.G7Core,ad=v.createContext(null),m0=()=>{const e=v.useContext(ad);if(!e){const t=HM(),n=t?.locale?.current?.()||"ko",r=t?.locale?.supported?.()||["ko","en"];return{activeLocale:n,getActiveLocale:()=>t?.locale?.current?.()||"ko",supportedLocales:r,isInsideMultilingualTabPanel:!1}}return{...e,isInsideMultilingualTabPanel:!0}},UM=()=>window.G7Core,BM=({value:e,onChange:t,placeholder:n,readOnly:r,disabled:s,hasError:o})=>{const{activeLocale:i,getActiveLocale:a}=m0(),l=typeof e=="string"?{[i]:e}:e||{},c=v.useCallback(u=>{const f=a();t({...l,[f]:u.target.value})},[l,a,t]),d=o?"border-red-500 dark:border-red-500 focus:ring-red-500 focus:border-red-500":"border-gray-300 dark:border-gray-600 focus:ring-blue-500 focus:border-blue-500";return h.jsx(Et,{type:"text",value:l[i]||"",onChange:c,placeholder:n,readOnly:r,disabled:s,className:`w-full px-3 py-2 text-sm border ${d} rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:ring-2`})},jM=(e,t)=>{if(!t)return!1;const n=t.startsWith("!"),r=n?t.slice(1):t,s=!!e[r];return n?!s:s},WM=({column:e,item:t,index:n,onValueChange:r,readOnly:s,error:o})=>{const i=t[e.key],a=s||e.readOnly||jM(t,e.readOnlyCondition)||e.disabled,l=!!o,c=l?"border-red-500 dark:border-red-500 focus:ring-red-500 focus:border-red-500":"border-gray-300 dark:border-gray-600 focus:ring-blue-500 focus:border-blue-500",d=v.useCallback(f=>{r(e.key,f)},[e.key,r]),u=f=>h.jsxs(I,{className:"w-full",children:[f,l&&h.jsx(J,{className:"text-xs text-red-500 dark:text-red-400 mt-1 block",children:o})]});switch(e.type){case"input":return u(h.jsx(Et,{type:"text",value:i||"",onChange:f=>d(f.target.value),placeholder:e.placeholder,readOnly:a,disabled:a,className:`w-full px-3 py-2 text-sm border ${c} rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:ring-2 ${e.className||""}`}));case"number":return u(h.jsx(Et,{type:"number",value:i??"",onChange:f=>d(f.target.value?Number(f.target.value):null),placeholder:e.placeholder,min:e.min,max:e.max,step:e.step,readOnly:a,disabled:a,className:`w-full px-3 py-2 text-sm border ${c} rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:ring-2 ${e.className||""}`}));case"select":return u(h.jsxs(Zr,{value:i??"",onChange:f=>d(f.target.value),disabled:a,className:`w-full px-3 py-2 text-sm border ${c} rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:ring-2 ${e.className||""}`,children:[h.jsx("option",{value:"",children:"선택하세요"}),e.options?.map(f=>h.jsx("option",{value:f.value,disabled:f.disabled,children:f.label},f.value))]}));case"textarea":return u(h.jsx(lr,{value:i||"",onChange:f=>d(f.target.value),placeholder:e.placeholder,readOnly:a,disabled:a,className:`w-full px-3 py-2 text-sm border ${c} rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:ring-2 resize-none ${e.className||""}`,rows:2}));case"multilingual":return u(h.jsx(BM,{value:i,onChange:f=>d(f),placeholder:e.placeholder,readOnly:a,disabled:a,hasError:l}));case"custom":return e.render?h.jsx(h.Fragment,{children:e.render(t,n,d)}):h.jsx(J,{className:"text-gray-500 dark:text-gray-400",children:"-"});default:return h.jsx(J,{className:"text-gray-900 dark:text-white text-sm",children:String(i??"")})}},GM=(e,t,n)=>{if(!e)return;if(n==="multilingual"){const o=UM()?.locale?.current?.()||"ko",i=`${t}.${o}`;return e[i]?.[0]}return e[t]?.[0]},YM=({item:e,index:t,id:n,columns:r,enableDrag:s=!0,showIndex:o=!0,canRemove:i=!0,rowActions:a,readOnly:l=!1,onValueChange:c,onRemove:d,className:u="",level:f=0,errors:g})=>{const{attributes:m,listeners:p,setNodeRef:y,transform:b,transition:_,isDragging:x}=Zi({id:n,disabled:!s||l}),M={transform:Wn.Transform.toString(b),transition:_,opacity:x?.5:1},S=v.useCallback((C,w)=>{c?.(C,w)},[c]),k=v.useCallback(C=>{C.onClick?.(e,t)},[e,t]),N=f>0?{paddingLeft:`${f*24}px`}:{};return h.jsxs(I,{ref:y,style:M,className:`flex items-center gap-2 py-2 px-2 border-b border-gray-100 dark:border-gray-700 last:border-b-0 hover:bg-gray-50 dark:hover:bg-gray-800/50 transition-colors ${x?"bg-blue-50 dark:bg-blue-900/20 shadow-lg rounded-lg z-10":""} ${u}`,children:[s&&!l&&h.jsx(I,{...m,...p,className:"flex-shrink-0 w-6 h-6 flex items-center justify-center cursor-grab active:cursor-grabbing text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-400",style:N,children:h.jsx(ae,{name:"grip-vertical",className:"w-4 h-4"})}),o&&h.jsx(I,{className:"flex-shrink-0 w-8 text-center text-sm text-gray-500 dark:text-gray-400 font-medium",children:t+1}),r.map(C=>{const w=GM(g,C.key,C.type);return h.jsx(I,{className:`flex-1 min-w-0 ${C.width||""}`,style:C.width?{flex:"none",width:C.width}:{},children:h.jsx(WM,{column:C,item:e,index:t,onValueChange:S,readOnly:l,error:w})},C.key)}),a&&a.length>0&&!l&&h.jsx(I,{className:"flex-shrink-0 flex items-center gap-1",children:a.map(C=>{const w=typeof C.disabled=="function"?C.disabled(e,t):C.disabled;return h.jsx(le,{type:"button",onClick:()=>k(C),disabled:w,className:`p-1.5 rounded transition-colors ${C.danger?"text-red-500 hover:bg-red-50 dark:hover:bg-red-900/20 hover:text-red-600":"text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 hover:text-gray-600 dark:hover:text-gray-300"} disabled:opacity-50 disabled:cursor-not-allowed`,title:C.label,children:C.icon?h.jsx(ae,{name:C.icon,className:"w-4 h-4"}):h.jsx(J,{className:"text-xs",children:C.label})},C.key)})}),i&&!a&&!l&&h.jsx(I,{className:"flex-shrink-0",children:h.jsx(le,{type:"button",onClick:d,className:"p-1.5 text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 hover:text-gray-600 dark:hover:text-gray-300 rounded transition-colors",title:"삭제",children:h.jsx(ae,{name:"minus",className:"w-4 h-4"})})})]})},b0=()=>window.G7Core,ld=()=>`item_${Date.now()}_${Math.random().toString(36).substring(2,9)}`,KM=e=>{const t={_id:ld()};return e.forEach(n=>{if(n.type==="multilingual"){const s=b0()?.locale?.all?.()||["ko","en"],o={};s.forEach(i=>{o[i]=""}),t[n.key]=o}else n.type==="number"?t[n.key]=null:(n.type,t[n.key]="")}),t},XM=(e,t)=>{if(!e)return{};const n=`fields.${t}.`,r={};return Object.keys(e).forEach(s=>{if(s.startsWith(n)){const o=s.substring(n.length);r[o]=e[s]}}),r},qM=({items:e=[],columns:t,onChange:n,onAddItem:r,onRemoveItem:s,onReorder:o,addLabel:i="항목 추가",enableDrag:a=!0,showIndex:l=!0,minItems:c=0,maxItems:d,rowActions:u,emptyMessage:f="항목이 없습니다.",className:g="",headerClassName:m="",rowClassName:p="",name:y,readOnly:b=!1,createDefaultItem:_,childrenKey:x,itemIdKey:M="_id",errors:S,id:k,editorAttrs:N})=>{const C=v.useRef(null),w=v.useRef([]),E=v.useRef(null),T=v.useMemo(()=>{let Y=!1;for(const B of e)if(B[M]==null){Y=!0;break}return Y?e.map(B=>B[M]!=null?B:{...B,[M]:ld()}):e},[e,M]);w.current=T,v.useEffect(()=>{E.current=null},[T]);const P=v.useCallback(Y=>String(Y[M]??""),[M]);v.useEffect(()=>{if(y){const Y=b0();Y?.form&&(C.current=Y.form)}},[y]);const L=gc(gs(fo,{activationConstraint:{distance:8}}),gs(uo,{coordinateGetter:Qi})),F=v.useMemo(()=>T.map(Y=>P(Y)),[T,P]),A=v.useCallback(Y=>{const{active:B,over:W}=Y;if(W&&B.id!==W.id){const G=E.current??w.current,V=G.map(Q=>String(Q[M]??"")),X=V.indexOf(String(B.id)),K=V.indexOf(String(W.id));if(X!==-1&&K!==-1){const Q=ms([...G],X,K);E.current=Q,n?.(Q),o?.(Q)}}},[n,o,M]),D=v.useCallback((Y,B,W)=>{const V=[...E.current??w.current];V[Y]={...V[Y],[B]:W},E.current=V,n?.(V)},[n]),O=v.useCallback(()=>{const Y=E.current??w.current;if(d&&Y.length>=d)return;if(r){r();return}const B=_?_():KM(t);B[M]||(B[M]=ld());const W=[...Y,B];E.current=W,n?.(W)},[d,r,_,t,M,n]),z=v.useCallback(Y=>{const B=E.current??w.current;if(B.length<=c)return;const W=B[Y];if(s){s(Y,W);return}const G=B.filter((V,X)=>X!==Y);E.current=G,n?.(G)},[c,s,n]),U=T.length>c,j=!d||T.lengthh.jsxs(I,{className:`flex-1 min-w-0 text-xs font-medium text-gray-500 dark:text-gray-400 uppercase ${Y.width||""}`,style:Y.width?{flex:"none",width:Y.width}:{},children:[Y.label,Y.required&&h.jsx(J,{className:"text-red-500 dark:text-red-400 ml-0.5",children:"*"})]},Y.key)),(u||!b&&U)&&h.jsx(I,{className:"flex-shrink-0 w-8"})]}),T.length>0?h.jsx(_c,{sensors:L,collisionDetection:pc,onDragEnd:A,children:h.jsx(qi,{items:F,strategy:Ec,children:h.jsx(I,{className:"border-x border-gray-200 dark:border-gray-700",children:T.map((Y,B)=>{const W=P(Y),G=XM(S,B);return h.jsx(YM,{id:W,item:Y,index:B,columns:t,enableDrag:a,showIndex:l,canRemove:U,rowActions:u,readOnly:b,onValueChange:(V,X)=>D(B,V,X),onRemove:()=>z(B),className:p,errors:G},W)})})})}):h.jsx(I,{className:"border-x border-gray-200 dark:border-gray-700 py-8 text-center text-gray-500 dark:text-gray-400 text-sm",children:f}),!b&&j&&h.jsx(I,{className:"relative border border-gray-200 dark:border-gray-700 border-t-0 rounded-b-lg",children:h.jsx(I,{className:"flex items-center justify-center py-2",children:h.jsxs(le,{type:"button",onClick:O,className:"flex items-center gap-1.5 px-4 py-1.5 text-sm text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:[h.jsx(ae,{name:"plus",className:"w-4 h-4"}),h.jsx(J,{children:i})]})})}),(b||!j)&&T.length>0&&h.jsx(I,{className:"border-x border-b border-gray-200 dark:border-gray-700 rounded-b-lg h-1"})]})},y0=()=>window.G7Core,ZM=()=>y0()?.locale?.supported?.()??["ko","en"],QM=()=>y0()?.locale?.current?.()??"ko",JM={ko:"한국어",en:"English",ja:"日本語",zh:"中文"},RM=({children:e,className:t="",style:n,variant:r="default",defaultLocale:s,onLocaleChange:o,locales:i})=>{const a=v.useMemo(()=>i&&i.length>0?i:ZM(),[i]),[l,c]=v.useState(s||QM());v.useEffect(()=>{if(a.length>0&&!a.includes(l)){const p=a[0];c(p),o?.(p)}},[a,l,o]);const d=v.useRef(l);d.current=l;const u=v.useCallback(()=>d.current,[]),f=v.useCallback(p=>{c(p),o?.(p)},[o]),g=v.useMemo(()=>({activeLocale:l,getActiveLocale:u,supportedLocales:a}),[l,u,a]),m=p=>{const y=p===l,b="px-4 py-2 text-sm font-medium transition-all";return r==="pills"?y?`${b} bg-blue-600 text-white rounded-lg`:`${b} text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg`:r==="underline"?y?`${b} text-blue-600 dark:text-blue-400 border-b-2 border-blue-600 dark:border-blue-400`:`${b} text-gray-600 dark:text-gray-400 border-b-2 border-transparent hover:border-gray-300 dark:hover:border-gray-500`:y?`${b} text-blue-600 dark:text-blue-400 bg-blue-50 dark:bg-blue-900/20 border-b-2 border-blue-600`:`${b} text-gray-600 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-700 border-b-2 border-transparent`};return h.jsxs(I,{className:t,style:n,children:[h.jsx(Jo,{className:"flex gap-1 border-b border-gray-200 dark:border-gray-700 mb-4",children:a.map(p=>h.jsx(le,{type:"button",onClick:()=>f(p),className:m(p),children:h.jsx(J,{children:JM[p]||p})},p))}),h.jsx(ad.Provider,{value:g,children:e})]})},eN=({label:e,required:t=!1,error:n,helperText:r,className:s="",labelClassName:o="",children:i,horizontal:a=!1,labelWidth:l="w-1/3",id:c,editorAttrs:d})=>{const u=a?`flex items-start gap-4 ${s}`:`space-y-1 ${s}`,f=a?`${l} flex-shrink-0 pt-2`:"",g=a?"flex-1":"";return h.jsxs(I,{className:u,id:c,...d,children:[e&&h.jsx(I,{className:f,children:h.jsxs(gn,{className:`block text-sm font-medium text-gray-700 dark:text-gray-300 ${o}`,children:[e,t&&h.jsx("span",{className:"ml-1 text-red-500 dark:text-red-400",children:"*"})]})}),h.jsxs(I,{className:`${g} ${n?"form-field-error":""}`.trim(),children:[i,r&&!n&&h.jsx(I,{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:r}),n&&h.jsx(I,{className:"mt-1 text-xs text-red-600 dark:text-red-400",children:n})]})]})};/*! * @kurkle/color v0.3.4 * https://github.com/kurkle/color#readme * (c) 2024 Jukka Kurkela * Released under the MIT License - */function uo(e){return e+.5|0}const ar=(e,t,n)=>Math.max(Math.min(e,n),t);function fo(e){return ar(uo(e*2.55),0,255)}function lr(e){return ar(uo(e*255),0,255)}function Kn(e){return ar(uo(e/2.55)/100,0,1)}function zp(e){return ar(uo(e*100),0,100)}const mn={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},Uc=[..."0123456789ABCDEF"],JE=e=>Uc[e&15],RE=e=>Uc[(e&240)>>4]+Uc[e&15],Ri=e=>(e&240)>>4===(e&15),eM=e=>Ri(e.r)&&Ri(e.g)&&Ri(e.b)&&Ri(e.a);function tM(e){var t=e.length,n;return e[0]==="#"&&(t===4||t===5?n={r:255&mn[e[1]]*17,g:255&mn[e[2]]*17,b:255&mn[e[3]]*17,a:t===5?mn[e[4]]*17:255}:(t===7||t===9)&&(n={r:mn[e[1]]<<4|mn[e[2]],g:mn[e[3]]<<4|mn[e[4]],b:mn[e[5]]<<4|mn[e[6]],a:t===9?mn[e[7]]<<4|mn[e[8]]:255})),n}const nM=(e,t)=>e<255?t(e):"";function rM(e){var t=eM(e)?JE:RE;return e?"#"+t(e.r)+t(e.g)+t(e.b)+nM(e.a,t):void 0}const sM=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function Hp(e,t,n){const r=t*Math.min(n,1-n),s=(o,i=(o+e/30)%12)=>n-r*Math.max(Math.min(i-3,9-i,1),-1);return[s(0),s(8),s(4)]}function oM(e,t,n){const r=(s,o=(s+e/60)%6)=>n-n*t*Math.max(Math.min(o,4-o,1),0);return[r(5),r(3),r(1)]}function iM(e,t,n){const r=Hp(e,1,.5);let s;for(t+n>1&&(s=1/(t+n),t*=s,n*=s),s=0;s<3;s++)r[s]*=1-t-n,r[s]+=t;return r}function aM(e,t,n,r,s){return e===s?(t-n)/r+(t.5?d/(2-o-i):d/(o+i),l=aM(n,r,s,d,o),l=l*60+.5),[l|0,c||0,a]}function jc(e,t,n,r){return(Array.isArray(t)?e(t[0],t[1],t[2]):e(t,n,r)).map(lr)}function Wc(e,t,n){return jc(Hp,e,t,n)}function lM(e,t,n){return jc(iM,e,t,n)}function cM(e,t,n){return jc(oM,e,t,n)}function Up(e){return(e%360+360)%360}function dM(e){const t=sM.exec(e);let n=255,r;if(!t)return;t[5]!==r&&(n=t[6]?fo(+t[5]):lr(+t[5]));const s=Up(+t[2]),o=+t[3]/100,i=+t[4]/100;return t[1]==="hwb"?r=lM(s,o,i):t[1]==="hsv"?r=cM(s,o,i):r=Wc(s,o,i),{r:r[0],g:r[1],b:r[2],a:n}}function uM(e,t){var n=Bc(e);n[0]=Up(n[0]+t),n=Wc(n),e.r=n[0],e.g=n[1],e.b=n[2]}function fM(e){if(!e)return;const t=Bc(e),n=t[0],r=zp(t[1]),s=zp(t[2]);return e.a<255?`hsla(${n}, ${r}%, ${s}%, ${Kn(e.a)})`:`hsl(${n}, ${r}%, ${s}%)`}const Bp={x:"dark",Z:"light",Y:"re",X:"blu",W:"gr",V:"medium",U:"slate",A:"ee",T:"ol",S:"or",B:"ra",C:"lateg",D:"ights",R:"in",Q:"turquois",E:"hi",P:"ro",O:"al",N:"le",M:"de",L:"yello",F:"en",K:"ch",G:"arks",H:"ea",I:"ightg",J:"wh"},jp={OiceXe:"f0f8ff",antiquewEte:"faebd7",aqua:"ffff",aquamarRe:"7fffd4",azuY:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"0",blanKedOmond:"ffebcd",Xe:"ff",XeviTet:"8a2be2",bPwn:"a52a2a",burlywood:"deb887",caMtXe:"5f9ea0",KartYuse:"7fff00",KocTate:"d2691e",cSO:"ff7f50",cSnflowerXe:"6495ed",cSnsilk:"fff8dc",crimson:"dc143c",cyan:"ffff",xXe:"8b",xcyan:"8b8b",xgTMnPd:"b8860b",xWay:"a9a9a9",xgYF:"6400",xgYy:"a9a9a9",xkhaki:"bdb76b",xmagFta:"8b008b",xTivegYF:"556b2f",xSange:"ff8c00",xScEd:"9932cc",xYd:"8b0000",xsOmon:"e9967a",xsHgYF:"8fbc8f",xUXe:"483d8b",xUWay:"2f4f4f",xUgYy:"2f4f4f",xQe:"ced1",xviTet:"9400d3",dAppRk:"ff1493",dApskyXe:"bfff",dimWay:"696969",dimgYy:"696969",dodgerXe:"1e90ff",fiYbrick:"b22222",flSOwEte:"fffaf0",foYstWAn:"228b22",fuKsia:"ff00ff",gaRsbSo:"dcdcdc",ghostwEte:"f8f8ff",gTd:"ffd700",gTMnPd:"daa520",Way:"808080",gYF:"8000",gYFLw:"adff2f",gYy:"808080",honeyMw:"f0fff0",hotpRk:"ff69b4",RdianYd:"cd5c5c",Rdigo:"4b0082",ivSy:"fffff0",khaki:"f0e68c",lavFMr:"e6e6fa",lavFMrXsh:"fff0f5",lawngYF:"7cfc00",NmoncEffon:"fffacd",ZXe:"add8e6",ZcSO:"f08080",Zcyan:"e0ffff",ZgTMnPdLw:"fafad2",ZWay:"d3d3d3",ZgYF:"90ee90",ZgYy:"d3d3d3",ZpRk:"ffb6c1",ZsOmon:"ffa07a",ZsHgYF:"20b2aa",ZskyXe:"87cefa",ZUWay:"778899",ZUgYy:"778899",ZstAlXe:"b0c4de",ZLw:"ffffe0",lime:"ff00",limegYF:"32cd32",lRF:"faf0e6",magFta:"ff00ff",maPon:"800000",VaquamarRe:"66cdaa",VXe:"cd",VScEd:"ba55d3",VpurpN:"9370db",VsHgYF:"3cb371",VUXe:"7b68ee",VsprRggYF:"fa9a",VQe:"48d1cc",VviTetYd:"c71585",midnightXe:"191970",mRtcYam:"f5fffa",mistyPse:"ffe4e1",moccasR:"ffe4b5",navajowEte:"ffdead",navy:"80",Tdlace:"fdf5e6",Tive:"808000",TivedBb:"6b8e23",Sange:"ffa500",SangeYd:"ff4500",ScEd:"da70d6",pOegTMnPd:"eee8aa",pOegYF:"98fb98",pOeQe:"afeeee",pOeviTetYd:"db7093",papayawEp:"ffefd5",pHKpuff:"ffdab9",peru:"cd853f",pRk:"ffc0cb",plum:"dda0dd",powMrXe:"b0e0e6",purpN:"800080",YbeccapurpN:"663399",Yd:"ff0000",Psybrown:"bc8f8f",PyOXe:"4169e1",saddNbPwn:"8b4513",sOmon:"fa8072",sandybPwn:"f4a460",sHgYF:"2e8b57",sHshell:"fff5ee",siFna:"a0522d",silver:"c0c0c0",skyXe:"87ceeb",UXe:"6a5acd",UWay:"708090",UgYy:"708090",snow:"fffafa",sprRggYF:"ff7f",stAlXe:"4682b4",tan:"d2b48c",teO:"8080",tEstN:"d8bfd8",tomato:"ff6347",Qe:"40e0d0",viTet:"ee82ee",JHt:"f5deb3",wEte:"ffffff",wEtesmoke:"f5f5f5",Lw:"ffff00",LwgYF:"9acd32"};function hM(){const e={},t=Object.keys(jp),n=Object.keys(Bp);let r,s,o,i,a;for(r=0;r>16&255,o>>8&255,o&255]}return e}let ea;function gM(e){ea||(ea=hM(),ea.transparent=[0,0,0,0]);const t=ea[e.toLowerCase()];return t&&{r:t[0],g:t[1],b:t[2],a:t.length===4?t[3]:255}}const pM=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function mM(e){const t=pM.exec(e);let n=255,r,s,o;if(t){if(t[7]!==r){const i=+t[7];n=t[8]?fo(i):ar(i*255,0,255)}return r=+t[1],s=+t[3],o=+t[5],r=255&(t[2]?fo(r):ar(r,0,255)),s=255&(t[4]?fo(s):ar(s,0,255)),o=255&(t[6]?fo(o):ar(o,0,255)),{r,g:s,b:o,a:n}}}function bM(e){return e&&(e.a<255?`rgba(${e.r}, ${e.g}, ${e.b}, ${Kn(e.a)})`:`rgb(${e.r}, ${e.g}, ${e.b})`)}const Gc=e=>e<=.0031308?e*12.92:Math.pow(e,1/2.4)*1.055-.055,hs=e=>e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4);function yM(e,t,n){const r=hs(Kn(e.r)),s=hs(Kn(e.g)),o=hs(Kn(e.b));return{r:lr(Gc(r+n*(hs(Kn(t.r))-r))),g:lr(Gc(s+n*(hs(Kn(t.g))-s))),b:lr(Gc(o+n*(hs(Kn(t.b))-o))),a:e.a+n*(t.a-e.a)}}function ta(e,t,n){if(e){let r=Bc(e);r[t]=Math.max(0,Math.min(r[t]+r[t]*n,t===0?360:1)),r=Wc(r),e.r=r[0],e.g=r[1],e.b=r[2]}}function Wp(e,t){return e&&Object.assign(t||{},e)}function Gp(e){var t={r:0,g:0,b:0,a:255};return Array.isArray(e)?e.length>=3&&(t={r:e[0],g:e[1],b:e[2],a:255},e.length>3&&(t.a=lr(e[3]))):(t=Wp(e,{r:0,g:0,b:0,a:1}),t.a=lr(t.a)),t}function vM(e){return e.charAt(0)==="r"?mM(e):dM(e)}class ho{constructor(t){if(t instanceof ho)return t;const n=typeof t;let r;n==="object"?r=Gp(t):n==="string"&&(r=tM(t)||gM(t)||vM(t)),this._rgb=r,this._valid=!!r}get valid(){return this._valid}get rgb(){var t=Wp(this._rgb);return t&&(t.a=Kn(t.a)),t}set rgb(t){this._rgb=Gp(t)}rgbString(){return this._valid?bM(this._rgb):void 0}hexString(){return this._valid?rM(this._rgb):void 0}hslString(){return this._valid?fM(this._rgb):void 0}mix(t,n){if(t){const r=this.rgb,s=t.rgb;let o;const i=n===o?.5:n,a=2*i-1,l=r.a-s.a,c=((a*l===-1?a:(a+l)/(1+a*l))+1)/2;o=1-c,r.r=255&c*r.r+o*s.r+.5,r.g=255&c*r.g+o*s.g+.5,r.b=255&c*r.b+o*s.b+.5,r.a=i*r.a+(1-i)*s.a,this.rgb=r}return this}interpolate(t,n){return t&&(this._rgb=yM(this._rgb,t._rgb,n)),this}clone(){return new ho(this.rgb)}alpha(t){return this._rgb.a=lr(t),this}clearer(t){const n=this._rgb;return n.a*=1-t,this}greyscale(){const t=this._rgb,n=uo(t.r*.3+t.g*.59+t.b*.11);return t.r=t.g=t.b=n,this}opaquer(t){const n=this._rgb;return n.a*=1+t,this}negate(){const t=this._rgb;return t.r=255-t.r,t.g=255-t.g,t.b=255-t.b,this}lighten(t){return ta(this._rgb,2,t),this}darken(t){return ta(this._rgb,2,-t),this}saturate(t){return ta(this._rgb,1,t),this}desaturate(t){return ta(this._rgb,1,-t),this}rotate(t){return uM(this._rgb,t),this}}/*! + */function Eo(e){return e+.5|0}const br=(e,t,n)=>Math.max(Math.min(e,n),t);function Mo(e){return br(Eo(e*2.55),0,255)}function yr(e){return br(Eo(e*255),0,255)}function tr(e){return br(Eo(e/2.55)/100,0,1)}function v0(e){return br(Eo(e*100),0,100)}const Cn={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},cd=[..."0123456789ABCDEF"],tN=e=>cd[e&15],nN=e=>cd[(e&240)>>4]+cd[e&15],ga=e=>(e&240)>>4===(e&15),rN=e=>ga(e.r)&&ga(e.g)&&ga(e.b)&&ga(e.a);function sN(e){var t=e.length,n;return e[0]==="#"&&(t===4||t===5?n={r:255&Cn[e[1]]*17,g:255&Cn[e[2]]*17,b:255&Cn[e[3]]*17,a:t===5?Cn[e[4]]*17:255}:(t===7||t===9)&&(n={r:Cn[e[1]]<<4|Cn[e[2]],g:Cn[e[3]]<<4|Cn[e[4]],b:Cn[e[5]]<<4|Cn[e[6]],a:t===9?Cn[e[7]]<<4|Cn[e[8]]:255})),n}const oN=(e,t)=>e<255?t(e):"";function iN(e){var t=rN(e)?tN:nN;return e?"#"+t(e.r)+t(e.g)+t(e.b)+oN(e.a,t):void 0}const aN=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function x0(e,t,n){const r=t*Math.min(n,1-n),s=(o,i=(o+e/30)%12)=>n-r*Math.max(Math.min(i-3,9-i,1),-1);return[s(0),s(8),s(4)]}function lN(e,t,n){const r=(s,o=(s+e/60)%6)=>n-n*t*Math.max(Math.min(o,4-o,1),0);return[r(5),r(3),r(1)]}function cN(e,t,n){const r=x0(e,1,.5);let s;for(t+n>1&&(s=1/(t+n),t*=s,n*=s),s=0;s<3;s++)r[s]*=1-t-n,r[s]+=t;return r}function dN(e,t,n,r,s){return e===s?(t-n)/r+(t.5?d/(2-o-i):d/(o+i),l=dN(n,r,s,d,o),l=l*60+.5),[l|0,c||0,a]}function ud(e,t,n,r){return(Array.isArray(t)?e(t[0],t[1],t[2]):e(t,n,r)).map(yr)}function fd(e,t,n){return ud(x0,e,t,n)}function uN(e,t,n){return ud(cN,e,t,n)}function fN(e,t,n){return ud(lN,e,t,n)}function w0(e){return(e%360+360)%360}function hN(e){const t=aN.exec(e);let n=255,r;if(!t)return;t[5]!==r&&(n=t[6]?Mo(+t[5]):yr(+t[5]));const s=w0(+t[2]),o=+t[3]/100,i=+t[4]/100;return t[1]==="hwb"?r=uN(s,o,i):t[1]==="hsv"?r=fN(s,o,i):r=fd(s,o,i),{r:r[0],g:r[1],b:r[2],a:n}}function gN(e,t){var n=dd(e);n[0]=w0(n[0]+t),n=fd(n),e.r=n[0],e.g=n[1],e.b=n[2]}function pN(e){if(!e)return;const t=dd(e),n=t[0],r=v0(t[1]),s=v0(t[2]);return e.a<255?`hsla(${n}, ${r}%, ${s}%, ${tr(e.a)})`:`hsl(${n}, ${r}%, ${s}%)`}const k0={x:"dark",Z:"light",Y:"re",X:"blu",W:"gr",V:"medium",U:"slate",A:"ee",T:"ol",S:"or",B:"ra",C:"lateg",D:"ights",R:"in",Q:"turquois",E:"hi",P:"ro",O:"al",N:"le",M:"de",L:"yello",F:"en",K:"ch",G:"arks",H:"ea",I:"ightg",J:"wh"},C0={OiceXe:"f0f8ff",antiquewEte:"faebd7",aqua:"ffff",aquamarRe:"7fffd4",azuY:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"0",blanKedOmond:"ffebcd",Xe:"ff",XeviTet:"8a2be2",bPwn:"a52a2a",burlywood:"deb887",caMtXe:"5f9ea0",KartYuse:"7fff00",KocTate:"d2691e",cSO:"ff7f50",cSnflowerXe:"6495ed",cSnsilk:"fff8dc",crimson:"dc143c",cyan:"ffff",xXe:"8b",xcyan:"8b8b",xgTMnPd:"b8860b",xWay:"a9a9a9",xgYF:"6400",xgYy:"a9a9a9",xkhaki:"bdb76b",xmagFta:"8b008b",xTivegYF:"556b2f",xSange:"ff8c00",xScEd:"9932cc",xYd:"8b0000",xsOmon:"e9967a",xsHgYF:"8fbc8f",xUXe:"483d8b",xUWay:"2f4f4f",xUgYy:"2f4f4f",xQe:"ced1",xviTet:"9400d3",dAppRk:"ff1493",dApskyXe:"bfff",dimWay:"696969",dimgYy:"696969",dodgerXe:"1e90ff",fiYbrick:"b22222",flSOwEte:"fffaf0",foYstWAn:"228b22",fuKsia:"ff00ff",gaRsbSo:"dcdcdc",ghostwEte:"f8f8ff",gTd:"ffd700",gTMnPd:"daa520",Way:"808080",gYF:"8000",gYFLw:"adff2f",gYy:"808080",honeyMw:"f0fff0",hotpRk:"ff69b4",RdianYd:"cd5c5c",Rdigo:"4b0082",ivSy:"fffff0",khaki:"f0e68c",lavFMr:"e6e6fa",lavFMrXsh:"fff0f5",lawngYF:"7cfc00",NmoncEffon:"fffacd",ZXe:"add8e6",ZcSO:"f08080",Zcyan:"e0ffff",ZgTMnPdLw:"fafad2",ZWay:"d3d3d3",ZgYF:"90ee90",ZgYy:"d3d3d3",ZpRk:"ffb6c1",ZsOmon:"ffa07a",ZsHgYF:"20b2aa",ZskyXe:"87cefa",ZUWay:"778899",ZUgYy:"778899",ZstAlXe:"b0c4de",ZLw:"ffffe0",lime:"ff00",limegYF:"32cd32",lRF:"faf0e6",magFta:"ff00ff",maPon:"800000",VaquamarRe:"66cdaa",VXe:"cd",VScEd:"ba55d3",VpurpN:"9370db",VsHgYF:"3cb371",VUXe:"7b68ee",VsprRggYF:"fa9a",VQe:"48d1cc",VviTetYd:"c71585",midnightXe:"191970",mRtcYam:"f5fffa",mistyPse:"ffe4e1",moccasR:"ffe4b5",navajowEte:"ffdead",navy:"80",Tdlace:"fdf5e6",Tive:"808000",TivedBb:"6b8e23",Sange:"ffa500",SangeYd:"ff4500",ScEd:"da70d6",pOegTMnPd:"eee8aa",pOegYF:"98fb98",pOeQe:"afeeee",pOeviTetYd:"db7093",papayawEp:"ffefd5",pHKpuff:"ffdab9",peru:"cd853f",pRk:"ffc0cb",plum:"dda0dd",powMrXe:"b0e0e6",purpN:"800080",YbeccapurpN:"663399",Yd:"ff0000",Psybrown:"bc8f8f",PyOXe:"4169e1",saddNbPwn:"8b4513",sOmon:"fa8072",sandybPwn:"f4a460",sHgYF:"2e8b57",sHshell:"fff5ee",siFna:"a0522d",silver:"c0c0c0",skyXe:"87ceeb",UXe:"6a5acd",UWay:"708090",UgYy:"708090",snow:"fffafa",sprRggYF:"ff7f",stAlXe:"4682b4",tan:"d2b48c",teO:"8080",tEstN:"d8bfd8",tomato:"ff6347",Qe:"40e0d0",viTet:"ee82ee",JHt:"f5deb3",wEte:"ffffff",wEtesmoke:"f5f5f5",Lw:"ffff00",LwgYF:"9acd32"};function mN(){const e={},t=Object.keys(C0),n=Object.keys(k0);let r,s,o,i,a;for(r=0;r>16&255,o>>8&255,o&255]}return e}let pa;function bN(e){pa||(pa=mN(),pa.transparent=[0,0,0,0]);const t=pa[e.toLowerCase()];return t&&{r:t[0],g:t[1],b:t[2],a:t.length===4?t[3]:255}}const yN=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function vN(e){const t=yN.exec(e);let n=255,r,s,o;if(t){if(t[7]!==r){const i=+t[7];n=t[8]?Mo(i):br(i*255,0,255)}return r=+t[1],s=+t[3],o=+t[5],r=255&(t[2]?Mo(r):br(r,0,255)),s=255&(t[4]?Mo(s):br(s,0,255)),o=255&(t[6]?Mo(o):br(o,0,255)),{r,g:s,b:o,a:n}}}function xN(e){return e&&(e.a<255?`rgba(${e.r}, ${e.g}, ${e.b}, ${tr(e.a)})`:`rgb(${e.r}, ${e.g}, ${e.b})`)}const hd=e=>e<=.0031308?e*12.92:Math.pow(e,1/2.4)*1.055-.055,Ms=e=>e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4);function wN(e,t,n){const r=Ms(tr(e.r)),s=Ms(tr(e.g)),o=Ms(tr(e.b));return{r:yr(hd(r+n*(Ms(tr(t.r))-r))),g:yr(hd(s+n*(Ms(tr(t.g))-s))),b:yr(hd(o+n*(Ms(tr(t.b))-o))),a:e.a+n*(t.a-e.a)}}function ma(e,t,n){if(e){let r=dd(e);r[t]=Math.max(0,Math.min(r[t]+r[t]*n,t===0?360:1)),r=fd(r),e.r=r[0],e.g=r[1],e.b=r[2]}}function S0(e,t){return e&&Object.assign(t||{},e)}function _0(e){var t={r:0,g:0,b:0,a:255};return Array.isArray(e)?e.length>=3&&(t={r:e[0],g:e[1],b:e[2],a:255},e.length>3&&(t.a=yr(e[3]))):(t=S0(e,{r:0,g:0,b:0,a:1}),t.a=yr(t.a)),t}function kN(e){return e.charAt(0)==="r"?vN(e):hN(e)}class No{constructor(t){if(t instanceof No)return t;const n=typeof t;let r;n==="object"?r=_0(t):n==="string"&&(r=sN(t)||bN(t)||kN(t)),this._rgb=r,this._valid=!!r}get valid(){return this._valid}get rgb(){var t=S0(this._rgb);return t&&(t.a=tr(t.a)),t}set rgb(t){this._rgb=_0(t)}rgbString(){return this._valid?xN(this._rgb):void 0}hexString(){return this._valid?iN(this._rgb):void 0}hslString(){return this._valid?pN(this._rgb):void 0}mix(t,n){if(t){const r=this.rgb,s=t.rgb;let o;const i=n===o?.5:n,a=2*i-1,l=r.a-s.a,c=((a*l===-1?a:(a+l)/(1+a*l))+1)/2;o=1-c,r.r=255&c*r.r+o*s.r+.5,r.g=255&c*r.g+o*s.g+.5,r.b=255&c*r.b+o*s.b+.5,r.a=i*r.a+(1-i)*s.a,this.rgb=r}return this}interpolate(t,n){return t&&(this._rgb=wN(this._rgb,t._rgb,n)),this}clone(){return new No(this.rgb)}alpha(t){return this._rgb.a=yr(t),this}clearer(t){const n=this._rgb;return n.a*=1-t,this}greyscale(){const t=this._rgb,n=Eo(t.r*.3+t.g*.59+t.b*.11);return t.r=t.g=t.b=n,this}opaquer(t){const n=this._rgb;return n.a*=1+t,this}negate(){const t=this._rgb;return t.r=255-t.r,t.g=255-t.g,t.b=255-t.b,this}lighten(t){return ma(this._rgb,2,t),this}darken(t){return ma(this._rgb,2,-t),this}saturate(t){return ma(this._rgb,1,t),this}desaturate(t){return ma(this._rgb,1,-t),this}rotate(t){return gN(this._rgb,t),this}}/*! * Chart.js v4.5.1 * https://www.chartjs.org * (c) 2025 Chart.js Contributors * Released under the MIT License - */function Xn(){}const xM=(()=>{let e=0;return()=>e++})();function at(e){return e==null}function Mt(e){if(Array.isArray&&Array.isArray(e))return!0;const t=Object.prototype.toString.call(e);return t.slice(0,7)==="[object"&&t.slice(-6)==="Array]"}function Ke(e){return e!==null&&Object.prototype.toString.call(e)==="[object Object]"}function bn(e){return(typeof e=="number"||e instanceof Number)&&isFinite(+e)}function zn(e,t){return bn(e)?e:t}function Xe(e,t){return typeof e>"u"?t:e}const wM=(e,t)=>typeof e=="string"&&e.endsWith("%")?parseFloat(e)/100:+e/t,Yp=(e,t)=>typeof e=="string"&&e.endsWith("%")?parseFloat(e)/100*t:+e;function ut(e,t,n){if(e&&typeof e.call=="function")return e.apply(n,t)}function tt(e,t,n,r){let s,o,i;if(Mt(e))for(o=e.length,s=0;se,x:e=>e.x,y:e=>e.y};function SM(e){const t=e.split("."),n=[];let r="";for(const s of t)r+=s,r.endsWith("\\")?r=r.slice(0,-1)+".":(n.push(r),r="");return n}function _M(e){const t=SM(e);return n=>{for(const r of t){if(r==="")break;n=n&&n[r]}return n}}function Er(e,t){return(Xp[t]||(Xp[t]=_M(t)))(e)}function Yc(e){return e.charAt(0).toUpperCase()+e.slice(1)}const mo=e=>typeof e<"u",cr=e=>typeof e=="function",qp=(e,t)=>{if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0};function EM(e){return e.type==="mouseup"||e.type==="click"||e.type==="contextmenu"}const lt=Math.PI,Ct=2*lt,sa=Number.POSITIVE_INFINITY,MM=lt/180,Nt=lt/2,Mr=lt/4,Zp=lt*2/3,Qp=Math.log10,dr=Math.sign;function oa(e,t,n){return Math.abs(e-t)s-o).pop(),t}function OM(e){return typeof e=="symbol"||typeof e=="object"&&e!==null&&!(Symbol.toPrimitive in e||"toString"in e||"valueOf"in e)}function ia(e){return!OM(e)&&!isNaN(parseFloat(e))&&isFinite(e)}function TM(e,t){const n=Math.round(e);return n-t<=e&&n+t>=e}function AM(e,t,n){let r,s,o;for(r=0,s=e.length;rl&&c=Math.min(t,n)-r&&e<=Math.max(t,n)+r}function Kc(e,t,n){n=n||(i=>e[i]1;)o=s+r>>1,n(o)?s=o:r=o;return{lo:s,hi:r}}const Xc=(e,t,n,r)=>Kc(e,n,r?s=>{const o=e[s][t];return oe[s][t]Kc(e,n,r=>e[r][t]>=n);function $M(e,t,n){let r=0,s=e.length;for(;rr&&e[s-1]>n;)s--;return r>0||s{const r="_onData"+Yc(n),s=e[n];Object.defineProperty(e,n,{configurable:!0,enumerable:!1,value(...o){const i=s.apply(this,o);return e._chartjs.listeners.forEach(a=>{typeof a[r]=="function"&&a[r](...o)}),i}})})}function n0(e,t){const n=e._chartjs;if(!n)return;const r=n.listeners,s=r.indexOf(t);s!==-1&&r.splice(s,1),!(r.length>0)&&(t0.forEach(o=>{delete e[o]}),delete e._chartjs)}function r0(e){const t=new Set(e);return t.size===e.length?e:Array.from(t)}const s0=(function(){return typeof window>"u"?function(e){return e()}:window.requestAnimationFrame})();function o0(e,t){let n=[],r=!1;return function(...s){n=s,r||(r=!0,s0.call(window,()=>{r=!1,e.apply(t,n)}))}}function VM(e,t){let n;return function(...r){return t?(clearTimeout(n),n=setTimeout(e,t,r)):e.apply(this,r),t}}const qc=e=>e==="start"?"left":e==="end"?"right":"center",jt=(e,t,n)=>e==="start"?t:e==="end"?n:(t+n)/2,zM=(e,t,n,r)=>e===(r?"left":"right")?n:e==="center"?(t+n)/2:t,la=e=>e===0||e===1,i0=(e,t,n)=>-(Math.pow(2,10*(e-=1))*Math.sin((e-t)*Ct/n)),a0=(e,t,n)=>Math.pow(2,-10*e)*Math.sin((e-t)*Ct/n)+1,bo={linear:e=>e,easeInQuad:e=>e*e,easeOutQuad:e=>-e*(e-2),easeInOutQuad:e=>(e/=.5)<1?.5*e*e:-.5*(--e*(e-2)-1),easeInCubic:e=>e*e*e,easeOutCubic:e=>(e-=1)*e*e+1,easeInOutCubic:e=>(e/=.5)<1?.5*e*e*e:.5*((e-=2)*e*e+2),easeInQuart:e=>e*e*e*e,easeOutQuart:e=>-((e-=1)*e*e*e-1),easeInOutQuart:e=>(e/=.5)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2),easeInQuint:e=>e*e*e*e*e,easeOutQuint:e=>(e-=1)*e*e*e*e+1,easeInOutQuint:e=>(e/=.5)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2),easeInSine:e=>-Math.cos(e*Nt)+1,easeOutSine:e=>Math.sin(e*Nt),easeInOutSine:e=>-.5*(Math.cos(lt*e)-1),easeInExpo:e=>e===0?0:Math.pow(2,10*(e-1)),easeOutExpo:e=>e===1?1:-Math.pow(2,-10*e)+1,easeInOutExpo:e=>la(e)?e:e<.5?.5*Math.pow(2,10*(e*2-1)):.5*(-Math.pow(2,-10*(e*2-1))+2),easeInCirc:e=>e>=1?e:-(Math.sqrt(1-e*e)-1),easeOutCirc:e=>Math.sqrt(1-(e-=1)*e),easeInOutCirc:e=>(e/=.5)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1),easeInElastic:e=>la(e)?e:i0(e,.075,.3),easeOutElastic:e=>la(e)?e:a0(e,.075,.3),easeInOutElastic(e){return la(e)?e:e<.5?.5*i0(e*2,.1125,.45):.5+.5*a0(e*2-1,.1125,.45)},easeInBack(e){return e*e*((1.70158+1)*e-1.70158)},easeOutBack(e){return(e-=1)*e*((1.70158+1)*e+1.70158)+1},easeInOutBack(e){let t=1.70158;return(e/=.5)<1?.5*(e*e*(((t*=1.525)+1)*e-t)):.5*((e-=2)*e*(((t*=1.525)+1)*e+t)+2)},easeInBounce:e=>1-bo.easeOutBounce(1-e),easeOutBounce(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375},easeInOutBounce:e=>e<.5?bo.easeInBounce(e*2)*.5:bo.easeOutBounce(e*2-1)*.5+.5};function l0(e){if(e&&typeof e=="object"){const t=e.toString();return t==="[object CanvasPattern]"||t==="[object CanvasGradient]"}return!1}function c0(e){return l0(e)?e:new ho(e)}function Zc(e){return l0(e)?e:new ho(e).saturate(.5).darken(.1).hexString()}const HM=["x","y","borderWidth","radius","tension"],UM=["color","borderColor","backgroundColor"];function BM(e){e.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),e.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:t=>t!=="onProgress"&&t!=="onComplete"&&t!=="fn"}),e.set("animations",{colors:{type:"color",properties:UM},numbers:{type:"number",properties:HM}}),e.describe("animations",{_fallback:"animation"}),e.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:t=>t|0}}}})}function jM(e){e.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}const d0=new Map;function WM(e,t){t=t||{};const n=e+JSON.stringify(t);let r=d0.get(n);return r||(r=new Intl.NumberFormat(e,t),d0.set(n,r)),r}function Qc(e,t,n){return WM(t,n).format(e)}const GM={values(e){return Mt(e)?e:""+e},numeric(e,t,n){if(e===0)return"0";const r=this.chart.options.locale;let s,o=e;if(n.length>1){const c=Math.max(Math.abs(n[0].value),Math.abs(n[n.length-1].value));(c<1e-4||c>1e15)&&(s="scientific"),o=YM(e,n)}const i=Qp(Math.abs(o)),a=isNaN(i)?1:Math.max(Math.min(-1*Math.floor(i),20),0),l={notation:s,minimumFractionDigits:a,maximumFractionDigits:a};return Object.assign(l,this.options.ticks.format),Qc(e,r,l)}};function YM(e,t){let n=t.length>3?t[2].value-t[1].value:t[1].value-t[0].value;return Math.abs(n)>=1&&e!==Math.floor(e)&&(n=e-Math.floor(e)),n}var u0={formatters:GM};function KM(e){e.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",clip:!0,grace:0,grid:{display:!0,lineWidth:1,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(t,n)=>n.lineWidth,tickColor:(t,n)=>n.color,offset:!1},border:{display:!0,dash:[],dashOffset:0,width:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:u0.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),e.route("scale.ticks","color","","color"),e.route("scale.grid","color","","borderColor"),e.route("scale.border","color","","borderColor"),e.route("scale.title","color","","color"),e.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&t!=="callback"&&t!=="parser",_indexable:t=>t!=="borderDash"&&t!=="tickBorderDash"&&t!=="dash"}),e.describe("scales",{_fallback:"scale"}),e.describe("scale.ticks",{_scriptable:t=>t!=="backdropPadding"&&t!=="callback",_indexable:t=>t!=="backdropPadding"})}const Or=Object.create(null),Jc=Object.create(null);function yo(e,t){if(!t)return e;const n=t.split(".");for(let r=0,s=n.length;rr.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(r,s)=>Zc(s.backgroundColor),this.hoverBorderColor=(r,s)=>Zc(s.borderColor),this.hoverColor=(r,s)=>Zc(s.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(t),this.apply(n)}set(t,n){return Rc(this,t,n)}get(t){return yo(this,t)}describe(t,n){return Rc(Jc,t,n)}override(t,n){return Rc(Or,t,n)}route(t,n,r,s){const o=yo(this,t),i=yo(this,r),a="_"+n;Object.defineProperties(o,{[a]:{value:o[n],writable:!0},[n]:{enumerable:!0,get(){const l=this[a],c=i[s];return Ke(l)?Object.assign({},c,l):Xe(l,c)},set(l){this[a]=l}}})}apply(t){t.forEach(n=>n(this))}}var xt=new XM({_scriptable:e=>!e.startsWith("on"),_indexable:e=>e!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[BM,jM,KM]);function qM(e){return!e||at(e.size)||at(e.family)?null:(e.style?e.style+" ":"")+(e.weight?e.weight+" ":"")+e.size+"px "+e.family}function f0(e,t,n,r,s){let o=t[s];return o||(o=t[s]=e.measureText(s).width,n.push(s)),o>r&&(r=o),r}function Tr(e,t,n){const r=e.currentDevicePixelRatio,s=n!==0?Math.max(n/2,.5):0;return Math.round((t-s)*r)/r+s}function h0(e,t){!t&&!e||(t=t||e.getContext("2d"),t.save(),t.resetTransform(),t.clearRect(0,0,e.width,e.height),t.restore())}function g0(e,t,n,r){p0(e,t,n,r,null)}function p0(e,t,n,r,s){let o,i,a,l,c,d,u,f;const g=t.pointStyle,m=t.rotation,p=t.radius;let y=(m||0)*MM;if(g&&typeof g=="object"&&(o=g.toString(),o==="[object HTMLImageElement]"||o==="[object HTMLCanvasElement]")){e.save(),e.translate(n,r),e.rotate(y),e.drawImage(g,-g.width/2,-g.height/2,g.width,g.height),e.restore();return}if(!(isNaN(p)||p<=0)){switch(e.beginPath(),g){default:s?e.ellipse(n,r,s/2,p,0,0,Ct):e.arc(n,r,p,0,Ct),e.closePath();break;case"triangle":d=s?s/2:p,e.moveTo(n+Math.sin(y)*d,r-Math.cos(y)*p),y+=Zp,e.lineTo(n+Math.sin(y)*d,r-Math.cos(y)*p),y+=Zp,e.lineTo(n+Math.sin(y)*d,r-Math.cos(y)*p),e.closePath();break;case"rectRounded":c=p*.516,l=p-c,i=Math.cos(y+Mr)*l,u=Math.cos(y+Mr)*(s?s/2-c:l),a=Math.sin(y+Mr)*l,f=Math.sin(y+Mr)*(s?s/2-c:l),e.arc(n-u,r-a,c,y-lt,y-Nt),e.arc(n+f,r-i,c,y-Nt,y),e.arc(n+u,r+a,c,y,y+Nt),e.arc(n-f,r+i,c,y+Nt,y+lt),e.closePath();break;case"rect":if(!m){l=Math.SQRT1_2*p,d=s?s/2:l,e.rect(n-d,r-l,2*d,2*l);break}y+=Mr;case"rectRot":u=Math.cos(y)*(s?s/2:p),i=Math.cos(y)*p,a=Math.sin(y)*p,f=Math.sin(y)*(s?s/2:p),e.moveTo(n-u,r-a),e.lineTo(n+f,r-i),e.lineTo(n+u,r+a),e.lineTo(n-f,r+i),e.closePath();break;case"crossRot":y+=Mr;case"cross":u=Math.cos(y)*(s?s/2:p),i=Math.cos(y)*p,a=Math.sin(y)*p,f=Math.sin(y)*(s?s/2:p),e.moveTo(n-u,r-a),e.lineTo(n+u,r+a),e.moveTo(n+f,r-i),e.lineTo(n-f,r+i);break;case"star":u=Math.cos(y)*(s?s/2:p),i=Math.cos(y)*p,a=Math.sin(y)*p,f=Math.sin(y)*(s?s/2:p),e.moveTo(n-u,r-a),e.lineTo(n+u,r+a),e.moveTo(n+f,r-i),e.lineTo(n-f,r+i),y+=Mr,u=Math.cos(y)*(s?s/2:p),i=Math.cos(y)*p,a=Math.sin(y)*p,f=Math.sin(y)*(s?s/2:p),e.moveTo(n-u,r-a),e.lineTo(n+u,r+a),e.moveTo(n+f,r-i),e.lineTo(n-f,r+i);break;case"line":i=s?s/2:Math.cos(y)*p,a=Math.sin(y)*p,e.moveTo(n-i,r-a),e.lineTo(n+i,r+a);break;case"dash":e.moveTo(n,r),e.lineTo(n+Math.cos(y)*(s?s/2:p),r+Math.sin(y)*p);break;case!1:e.closePath();break}e.fill(),t.borderWidth>0&&e.stroke()}}function m0(e,t,n){return n=n||.5,!t||e&&e.x>t.left-n&&e.xt.top-n&&e.y0&&o.strokeColor!=="";let l,c;for(e.save(),e.font=s.string,ZM(e,o),l=0;l+e||0;function nd(e,t){const n={},r=Ke(t),s=r?Object.keys(t):t,o=Ke(e)?r?i=>Xe(e[i],e[t[i]]):i=>e[i]:()=>e;for(const i of s)n[i]=nN(o(i));return n}function b0(e){return nd(e,{top:"y",right:"x",bottom:"y",left:"x"})}function gs(e){return nd(e,["topLeft","topRight","bottomLeft","bottomRight"])}function yn(e){const t=b0(e);return t.width=t.left+t.right,t.height=t.top+t.bottom,t}function Wt(e,t){e=e||{},t=t||xt.font;let n=Xe(e.size,t.size);typeof n=="string"&&(n=parseInt(n,10));let r=Xe(e.style,t.style);r&&!(""+r).match(eN)&&(console.warn('Invalid font style specified: "'+r+'"'),r=void 0);const s={family:Xe(e.family,t.family),lineHeight:tN(Xe(e.lineHeight,t.lineHeight),n),size:n,style:r,weight:Xe(e.weight,t.weight),string:""};return s.string=qM(s),s}function da(e,t,n,r){let s,o,i;for(s=0,o=e.length;sn&&a===0?0:a+l;return{min:i(r,-Math.abs(o)),max:i(s,o)}}function ps(e,t){return Object.assign(Object.create(e),t)}function rd(e,t=[""],n,r,s=()=>e[0]){const o=n||e;typeof r>"u"&&(r=k0("_fallback",e));const i={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:e,_rootScopes:o,_fallback:r,_getTarget:s,override:a=>rd([a,...e],t,o,r)};return new Proxy(i,{deleteProperty(a,l){return delete a[l],delete a._keys,delete e[0][l],!0},get(a,l){return v0(a,l,()=>uN(l,t,e,a))},getOwnPropertyDescriptor(a,l){return Reflect.getOwnPropertyDescriptor(a._scopes[0],l)},getPrototypeOf(){return Reflect.getPrototypeOf(e[0])},has(a,l){return C0(a).includes(l)},ownKeys(a){return C0(a)},set(a,l,c){const d=a._storage||(a._storage=s());return a[l]=d[l]=c,delete a._keys,!0}})}function ms(e,t,n,r){const s={_cacheable:!1,_proxy:e,_context:t,_subProxy:n,_stack:new Set,_descriptors:y0(e,r),setContext:o=>ms(e,o,n,r),override:o=>ms(e.override(o),t,n,r)};return new Proxy(s,{deleteProperty(o,i){return delete o[i],delete e[i],!0},get(o,i,a){return v0(o,i,()=>oN(o,i,a))},getOwnPropertyDescriptor(o,i){return o._descriptors.allKeys?Reflect.has(e,i)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(e,i)},getPrototypeOf(){return Reflect.getPrototypeOf(e)},has(o,i){return Reflect.has(e,i)},ownKeys(){return Reflect.ownKeys(e)},set(o,i,a){return e[i]=a,delete o[i],!0}})}function y0(e,t={scriptable:!0,indexable:!0}){const{_scriptable:n=t.scriptable,_indexable:r=t.indexable,_allKeys:s=t.allKeys}=e;return{allKeys:s,scriptable:n,indexable:r,isScriptable:cr(n)?n:()=>n,isIndexable:cr(r)?r:()=>r}}const sN=(e,t)=>e?e+Yc(t):t,sd=(e,t)=>Ke(t)&&e!=="adapters"&&(Object.getPrototypeOf(t)===null||t.constructor===Object);function v0(e,t,n){if(Object.prototype.hasOwnProperty.call(e,t)||t==="constructor")return e[t];const r=n();return e[t]=r,r}function oN(e,t,n){const{_proxy:r,_context:s,_subProxy:o,_descriptors:i}=e;let a=r[t];return cr(a)&&i.isScriptable(t)&&(a=iN(t,a,e,n)),Mt(a)&&a.length&&(a=aN(t,a,e,i.isIndexable)),sd(t,a)&&(a=ms(a,s,o&&o[t],i)),a}function iN(e,t,n,r){const{_proxy:s,_context:o,_subProxy:i,_stack:a}=n;if(a.has(e))throw new Error("Recursion detected: "+Array.from(a).join("->")+"->"+e);a.add(e);let l=t(o,i||r);return a.delete(e),sd(e,l)&&(l=od(s._scopes,s,e,l)),l}function aN(e,t,n,r){const{_proxy:s,_context:o,_subProxy:i,_descriptors:a}=n;if(typeof o.index<"u"&&r(e))return t[o.index%t.length];if(Ke(t[0])){const l=t,c=s._scopes.filter(d=>d!==l);t=[];for(const d of l){const u=od(c,s,e,d);t.push(ms(u,o,i&&i[e],a))}}return t}function x0(e,t,n){return cr(e)?e(t,n):e}const lN=(e,t)=>e===!0?t:typeof e=="string"?Er(t,e):void 0;function cN(e,t,n,r,s){for(const o of t){const i=lN(n,o);if(i){e.add(i);const a=x0(i._fallback,n,s);if(typeof a<"u"&&a!==n&&a!==r)return a}else if(i===!1&&typeof r<"u"&&n!==r)return null}return!1}function od(e,t,n,r){const s=t._rootScopes,o=x0(t._fallback,n,r),i=[...e,...s],a=new Set;a.add(r);let l=w0(a,i,n,o||n,r);return l===null||typeof o<"u"&&o!==n&&(l=w0(a,i,o,l,r),l===null)?!1:rd(Array.from(a),[""],s,o,()=>dN(t,n,r))}function w0(e,t,n,r,s){for(;n;)n=cN(e,t,n,r,s);return n}function dN(e,t,n){const r=e._getTarget();t in r||(r[t]={});const s=r[t];return Mt(s)&&Ke(n)?n:s||{}}function uN(e,t,n,r){let s;for(const o of t)if(s=k0(sN(o,e),n),typeof s<"u")return sd(e,s)?od(n,r,e,s):s}function k0(e,t){for(const n of t){if(!n)continue;const r=n[e];if(typeof r<"u")return r}}function C0(e){let t=e._keys;return t||(t=e._keys=fN(e._scopes)),t}function fN(e){const t=new Set;for(const n of e)for(const r of Object.keys(n).filter(s=>!s.startsWith("_")))t.add(r);return Array.from(t)}function id(){return typeof window<"u"&&typeof document<"u"}function ad(e){let t=e.parentNode;return t&&t.toString()==="[object ShadowRoot]"&&(t=t.host),t}function ua(e,t,n){let r;return typeof e=="string"?(r=parseInt(e,10),e.indexOf("%")!==-1&&(r=r/100*t.parentNode[n])):r=e,r}const fa=e=>e.ownerDocument.defaultView.getComputedStyle(e,null);function hN(e,t){return fa(e).getPropertyValue(t)}const gN=["top","right","bottom","left"];function Ar(e,t,n){const r={};n=n?"-"+n:"";for(let s=0;s<4;s++){const o=gN[s];r[o]=parseFloat(e[t+"-"+o+n])||0}return r.width=r.left+r.right,r.height=r.top+r.bottom,r}const pN=(e,t,n)=>(e>0||t>0)&&(!n||!n.shadowRoot);function mN(e,t){const n=e.touches,r=n&&n.length?n[0]:e,{offsetX:s,offsetY:o}=r;let i=!1,a,l;if(pN(s,o,e.target))a=s,l=o;else{const c=t.getBoundingClientRect();a=r.clientX-c.left,l=r.clientY-c.top,i=!0}return{x:a,y:l,box:i}}function Dr(e,t){if("native"in e)return e;const{canvas:n,currentDevicePixelRatio:r}=t,s=fa(n),o=s.boxSizing==="border-box",i=Ar(s,"padding"),a=Ar(s,"border","width"),{x:l,y:c,box:d}=mN(e,n),u=i.left+(d&&a.left),f=i.top+(d&&a.top);let{width:g,height:m}=t;return o&&(g-=i.width+a.width,m-=i.height+a.height),{x:Math.round((l-u)/g*n.width/r),y:Math.round((c-f)/m*n.height/r)}}function bN(e,t,n){let r,s;if(t===void 0||n===void 0){const o=e&&ad(e);if(!o)t=e.clientWidth,n=e.clientHeight;else{const i=o.getBoundingClientRect(),a=fa(o),l=Ar(a,"border","width"),c=Ar(a,"padding");t=i.width-c.width-l.width,n=i.height-c.height-l.height,r=ua(a.maxWidth,o,"clientWidth"),s=ua(a.maxHeight,o,"clientHeight")}}return{width:t,height:n,maxWidth:r||sa,maxHeight:s||sa}}const ur=e=>Math.round(e*10)/10;function yN(e,t,n,r){const s=fa(e),o=Ar(s,"margin"),i=ua(s.maxWidth,e,"clientWidth")||sa,a=ua(s.maxHeight,e,"clientHeight")||sa,l=bN(e,t,n);let{width:c,height:d}=l;if(s.boxSizing==="content-box"){const f=Ar(s,"border","width"),g=Ar(s,"padding");c-=g.width+f.width,d-=g.height+f.height}return c=Math.max(0,c-o.width),d=Math.max(0,r?c/r:d-o.height),c=ur(Math.min(c,i,l.maxWidth)),d=ur(Math.min(d,a,l.maxHeight)),c&&!d&&(d=ur(c/2)),(t!==void 0||n!==void 0)&&r&&l.height&&d>l.height&&(d=l.height,c=ur(Math.floor(d*r))),{width:c,height:d}}function S0(e,t,n){const r=t||1,s=ur(e.height*r),o=ur(e.width*r);e.height=ur(e.height),e.width=ur(e.width);const i=e.canvas;return i.style&&(n||!i.style.height&&!i.style.width)&&(i.style.height=`${e.height}px`,i.style.width=`${e.width}px`),e.currentDevicePixelRatio!==r||i.height!==s||i.width!==o?(e.currentDevicePixelRatio=r,i.height=s,i.width=o,e.ctx.setTransform(r,0,0,r,0,0),!0):!1}const vN=(function(){let e=!1;try{const t={get passive(){return e=!0,!1}};id()&&(window.addEventListener("test",null,t),window.removeEventListener("test",null,t))}catch{}return e})();function _0(e,t){const n=hN(e,t),r=n&&n.match(/^(\d+)(\.\d+)?px$/);return r?+r[1]:void 0}const xN=function(e,t){return{x(n){return e+e+t-n},setWidth(n){t=n},textAlign(n){return n==="center"?n:n==="right"?"left":"right"},xPlus(n,r){return n-r},leftForLtr(n,r){return n-r}}},wN=function(){return{x(e){return e},setWidth(e){},textAlign(e){return e},xPlus(e,t){return e+t},leftForLtr(e,t){return e}}};function bs(e,t,n){return e?xN(t,n):wN()}function E0(e,t){let n,r;(t==="ltr"||t==="rtl")&&(n=e.canvas.style,r=[n.getPropertyValue("direction"),n.getPropertyPriority("direction")],n.setProperty("direction",t,"important"),e.prevTextDirection=r)}function M0(e,t){t!==void 0&&(delete e.prevTextDirection,e.canvas.style.setProperty("direction",t[0],t[1]))}function ha(e,t,n){return e.options.clip?e[n]:t[n]}function kN(e,t){const{xScale:n,yScale:r}=e;return n&&r?{left:ha(n,t,"left"),right:ha(n,t,"right"),top:ha(r,t,"top"),bottom:ha(r,t,"bottom")}:t}function CN(e,t){const n=t._clip;if(n.disabled)return!1;const r=kN(t,e.chartArea);return{left:n.left===!1?0:r.left-(n.left===!0?0:n.left),right:n.right===!1?e.width:r.right+(n.right===!0?0:n.right),top:n.top===!1?0:r.top-(n.top===!0?0:n.top),bottom:n.bottom===!1?e.height:r.bottom+(n.bottom===!0?0:n.bottom)}}/*! + */function nr(){}const CN=(()=>{let e=0;return()=>e++})();function ft(e){return e==null}function Dt(e){if(Array.isArray&&Array.isArray(e))return!0;const t=Object.prototype.toString.call(e);return t.slice(0,7)==="[object"&&t.slice(-6)==="Array]"}function Qe(e){return e!==null&&Object.prototype.toString.call(e)==="[object Object]"}function Sn(e){return(typeof e=="number"||e instanceof Number)&&isFinite(+e)}function Yn(e,t){return Sn(e)?e:t}function Je(e,t){return typeof e>"u"?t:e}const SN=(e,t)=>typeof e=="string"&&e.endsWith("%")?parseFloat(e)/100:+e/t,E0=(e,t)=>typeof e=="string"&&e.endsWith("%")?parseFloat(e)/100*t:+e;function bt(e,t,n){if(e&&typeof e.call=="function")return e.apply(n,t)}function at(e,t,n,r){let s,o,i;if(Dt(e))for(o=e.length,s=0;se,x:e=>e.x,y:e=>e.y};function MN(e){const t=e.split("."),n=[];let r="";for(const s of t)r+=s,r.endsWith("\\")?r=r.slice(0,-1)+".":(n.push(r),r="");return n}function NN(e){const t=MN(e);return n=>{for(const r of t){if(r==="")break;n=n&&n[r]}return n}}function zr(e,t){return(N0[t]||(N0[t]=NN(t)))(e)}function gd(e){return e.charAt(0).toUpperCase()+e.slice(1)}const Ao=e=>typeof e<"u",vr=e=>typeof e=="function",O0=(e,t)=>{if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0};function ON(e){return e.type==="mouseup"||e.type==="click"||e.type==="contextmenu"}const ht=Math.PI,Ot=2*ht,va=Number.POSITIVE_INFINITY,TN=ht/180,It=ht/2,Vr=ht/4,T0=ht*2/3,A0=Math.log10,xr=Math.sign;function xa(e,t,n){return Math.abs(e-t)s-o).pop(),t}function DN(e){return typeof e=="symbol"||typeof e=="object"&&e!==null&&!(Symbol.toPrimitive in e||"toString"in e||"valueOf"in e)}function wa(e){return!DN(e)&&!isNaN(parseFloat(e))&&isFinite(e)}function IN(e,t){const n=Math.round(e);return n-t<=e&&n+t>=e}function LN(e,t,n){let r,s,o;for(r=0,s=e.length;rl&&c=Math.min(t,n)-r&&e<=Math.max(t,n)+r}function pd(e,t,n){n=n||(i=>e[i]1;)o=s+r>>1,n(o)?s=o:r=o;return{lo:s,hi:r}}const md=(e,t,n,r)=>pd(e,n,r?s=>{const o=e[s][t];return oe[s][t]pd(e,n,r=>e[r][t]>=n);function VN(e,t,n){let r=0,s=e.length;for(;rr&&e[s-1]>n;)s--;return r>0||s{const r="_onData"+gd(n),s=e[n];Object.defineProperty(e,n,{configurable:!0,enumerable:!1,value(...o){const i=s.apply(this,o);return e._chartjs.listeners.forEach(a=>{typeof a[r]=="function"&&a[r](...o)}),i}})})}function $0(e,t){const n=e._chartjs;if(!n)return;const r=n.listeners,s=r.indexOf(t);s!==-1&&r.splice(s,1),!(r.length>0)&&(P0.forEach(o=>{delete e[o]}),delete e._chartjs)}function F0(e){const t=new Set(e);return t.size===e.length?e:Array.from(t)}const z0=(function(){return typeof window>"u"?function(e){return e()}:window.requestAnimationFrame})();function V0(e,t){let n=[],r=!1;return function(...s){n=s,r||(r=!0,z0.call(window,()=>{r=!1,e.apply(t,n)}))}}function UN(e,t){let n;return function(...r){return t?(clearTimeout(n),n=setTimeout(e,t,r)):e.apply(this,r),t}}const bd=e=>e==="start"?"left":e==="end"?"right":"center",Jt=(e,t,n)=>e==="start"?t:e==="end"?n:(t+n)/2,BN=(e,t,n,r)=>e===(r?"left":"right")?n:e==="center"?(t+n)/2:t,Ca=e=>e===0||e===1,H0=(e,t,n)=>-(Math.pow(2,10*(e-=1))*Math.sin((e-t)*Ot/n)),U0=(e,t,n)=>Math.pow(2,-10*e)*Math.sin((e-t)*Ot/n)+1,Do={linear:e=>e,easeInQuad:e=>e*e,easeOutQuad:e=>-e*(e-2),easeInOutQuad:e=>(e/=.5)<1?.5*e*e:-.5*(--e*(e-2)-1),easeInCubic:e=>e*e*e,easeOutCubic:e=>(e-=1)*e*e+1,easeInOutCubic:e=>(e/=.5)<1?.5*e*e*e:.5*((e-=2)*e*e+2),easeInQuart:e=>e*e*e*e,easeOutQuart:e=>-((e-=1)*e*e*e-1),easeInOutQuart:e=>(e/=.5)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2),easeInQuint:e=>e*e*e*e*e,easeOutQuint:e=>(e-=1)*e*e*e*e+1,easeInOutQuint:e=>(e/=.5)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2),easeInSine:e=>-Math.cos(e*It)+1,easeOutSine:e=>Math.sin(e*It),easeInOutSine:e=>-.5*(Math.cos(ht*e)-1),easeInExpo:e=>e===0?0:Math.pow(2,10*(e-1)),easeOutExpo:e=>e===1?1:-Math.pow(2,-10*e)+1,easeInOutExpo:e=>Ca(e)?e:e<.5?.5*Math.pow(2,10*(e*2-1)):.5*(-Math.pow(2,-10*(e*2-1))+2),easeInCirc:e=>e>=1?e:-(Math.sqrt(1-e*e)-1),easeOutCirc:e=>Math.sqrt(1-(e-=1)*e),easeInOutCirc:e=>(e/=.5)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1),easeInElastic:e=>Ca(e)?e:H0(e,.075,.3),easeOutElastic:e=>Ca(e)?e:U0(e,.075,.3),easeInOutElastic(e){return Ca(e)?e:e<.5?.5*H0(e*2,.1125,.45):.5+.5*U0(e*2-1,.1125,.45)},easeInBack(e){return e*e*((1.70158+1)*e-1.70158)},easeOutBack(e){return(e-=1)*e*((1.70158+1)*e+1.70158)+1},easeInOutBack(e){let t=1.70158;return(e/=.5)<1?.5*(e*e*(((t*=1.525)+1)*e-t)):.5*((e-=2)*e*(((t*=1.525)+1)*e+t)+2)},easeInBounce:e=>1-Do.easeOutBounce(1-e),easeOutBounce(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375},easeInOutBounce:e=>e<.5?Do.easeInBounce(e*2)*.5:Do.easeOutBounce(e*2-1)*.5+.5};function B0(e){if(e&&typeof e=="object"){const t=e.toString();return t==="[object CanvasPattern]"||t==="[object CanvasGradient]"}return!1}function j0(e){return B0(e)?e:new No(e)}function yd(e){return B0(e)?e:new No(e).saturate(.5).darken(.1).hexString()}const jN=["x","y","borderWidth","radius","tension"],WN=["color","borderColor","backgroundColor"];function GN(e){e.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),e.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:t=>t!=="onProgress"&&t!=="onComplete"&&t!=="fn"}),e.set("animations",{colors:{type:"color",properties:WN},numbers:{type:"number",properties:jN}}),e.describe("animations",{_fallback:"animation"}),e.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:t=>t|0}}}})}function YN(e){e.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}const W0=new Map;function KN(e,t){t=t||{};const n=e+JSON.stringify(t);let r=W0.get(n);return r||(r=new Intl.NumberFormat(e,t),W0.set(n,r)),r}function vd(e,t,n){return KN(t,n).format(e)}const XN={values(e){return Dt(e)?e:""+e},numeric(e,t,n){if(e===0)return"0";const r=this.chart.options.locale;let s,o=e;if(n.length>1){const c=Math.max(Math.abs(n[0].value),Math.abs(n[n.length-1].value));(c<1e-4||c>1e15)&&(s="scientific"),o=qN(e,n)}const i=A0(Math.abs(o)),a=isNaN(i)?1:Math.max(Math.min(-1*Math.floor(i),20),0),l={notation:s,minimumFractionDigits:a,maximumFractionDigits:a};return Object.assign(l,this.options.ticks.format),vd(e,r,l)}};function qN(e,t){let n=t.length>3?t[2].value-t[1].value:t[1].value-t[0].value;return Math.abs(n)>=1&&e!==Math.floor(e)&&(n=e-Math.floor(e)),n}var G0={formatters:XN};function ZN(e){e.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",clip:!0,grace:0,grid:{display:!0,lineWidth:1,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(t,n)=>n.lineWidth,tickColor:(t,n)=>n.color,offset:!1},border:{display:!0,dash:[],dashOffset:0,width:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:G0.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),e.route("scale.ticks","color","","color"),e.route("scale.grid","color","","borderColor"),e.route("scale.border","color","","borderColor"),e.route("scale.title","color","","color"),e.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&t!=="callback"&&t!=="parser",_indexable:t=>t!=="borderDash"&&t!=="tickBorderDash"&&t!=="dash"}),e.describe("scales",{_fallback:"scale"}),e.describe("scale.ticks",{_scriptable:t=>t!=="backdropPadding"&&t!=="callback",_indexable:t=>t!=="backdropPadding"})}const Ur=Object.create(null),xd=Object.create(null);function Io(e,t){if(!t)return e;const n=t.split(".");for(let r=0,s=n.length;rr.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(r,s)=>yd(s.backgroundColor),this.hoverBorderColor=(r,s)=>yd(s.borderColor),this.hoverColor=(r,s)=>yd(s.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(t),this.apply(n)}set(t,n){return wd(this,t,n)}get(t){return Io(this,t)}describe(t,n){return wd(xd,t,n)}override(t,n){return wd(Ur,t,n)}route(t,n,r,s){const o=Io(this,t),i=Io(this,r),a="_"+n;Object.defineProperties(o,{[a]:{value:o[n],writable:!0},[n]:{enumerable:!0,get(){const l=this[a],c=i[s];return Qe(l)?Object.assign({},c,l):Je(l,c)},set(l){this[a]=l}}})}apply(t){t.forEach(n=>n(this))}}var _t=new QN({_scriptable:e=>!e.startsWith("on"),_indexable:e=>e!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[GN,YN,ZN]);function JN(e){return!e||ft(e.size)||ft(e.family)?null:(e.style?e.style+" ":"")+(e.weight?e.weight+" ":"")+e.size+"px "+e.family}function Y0(e,t,n,r,s){let o=t[s];return o||(o=t[s]=e.measureText(s).width,n.push(s)),o>r&&(r=o),r}function Br(e,t,n){const r=e.currentDevicePixelRatio,s=n!==0?Math.max(n/2,.5):0;return Math.round((t-s)*r)/r+s}function K0(e,t){!t&&!e||(t=t||e.getContext("2d"),t.save(),t.resetTransform(),t.clearRect(0,0,e.width,e.height),t.restore())}function X0(e,t,n,r){q0(e,t,n,r,null)}function q0(e,t,n,r,s){let o,i,a,l,c,d,u,f;const g=t.pointStyle,m=t.rotation,p=t.radius;let y=(m||0)*TN;if(g&&typeof g=="object"&&(o=g.toString(),o==="[object HTMLImageElement]"||o==="[object HTMLCanvasElement]")){e.save(),e.translate(n,r),e.rotate(y),e.drawImage(g,-g.width/2,-g.height/2,g.width,g.height),e.restore();return}if(!(isNaN(p)||p<=0)){switch(e.beginPath(),g){default:s?e.ellipse(n,r,s/2,p,0,0,Ot):e.arc(n,r,p,0,Ot),e.closePath();break;case"triangle":d=s?s/2:p,e.moveTo(n+Math.sin(y)*d,r-Math.cos(y)*p),y+=T0,e.lineTo(n+Math.sin(y)*d,r-Math.cos(y)*p),y+=T0,e.lineTo(n+Math.sin(y)*d,r-Math.cos(y)*p),e.closePath();break;case"rectRounded":c=p*.516,l=p-c,i=Math.cos(y+Vr)*l,u=Math.cos(y+Vr)*(s?s/2-c:l),a=Math.sin(y+Vr)*l,f=Math.sin(y+Vr)*(s?s/2-c:l),e.arc(n-u,r-a,c,y-ht,y-It),e.arc(n+f,r-i,c,y-It,y),e.arc(n+u,r+a,c,y,y+It),e.arc(n-f,r+i,c,y+It,y+ht),e.closePath();break;case"rect":if(!m){l=Math.SQRT1_2*p,d=s?s/2:l,e.rect(n-d,r-l,2*d,2*l);break}y+=Vr;case"rectRot":u=Math.cos(y)*(s?s/2:p),i=Math.cos(y)*p,a=Math.sin(y)*p,f=Math.sin(y)*(s?s/2:p),e.moveTo(n-u,r-a),e.lineTo(n+f,r-i),e.lineTo(n+u,r+a),e.lineTo(n-f,r+i),e.closePath();break;case"crossRot":y+=Vr;case"cross":u=Math.cos(y)*(s?s/2:p),i=Math.cos(y)*p,a=Math.sin(y)*p,f=Math.sin(y)*(s?s/2:p),e.moveTo(n-u,r-a),e.lineTo(n+u,r+a),e.moveTo(n+f,r-i),e.lineTo(n-f,r+i);break;case"star":u=Math.cos(y)*(s?s/2:p),i=Math.cos(y)*p,a=Math.sin(y)*p,f=Math.sin(y)*(s?s/2:p),e.moveTo(n-u,r-a),e.lineTo(n+u,r+a),e.moveTo(n+f,r-i),e.lineTo(n-f,r+i),y+=Vr,u=Math.cos(y)*(s?s/2:p),i=Math.cos(y)*p,a=Math.sin(y)*p,f=Math.sin(y)*(s?s/2:p),e.moveTo(n-u,r-a),e.lineTo(n+u,r+a),e.moveTo(n+f,r-i),e.lineTo(n-f,r+i);break;case"line":i=s?s/2:Math.cos(y)*p,a=Math.sin(y)*p,e.moveTo(n-i,r-a),e.lineTo(n+i,r+a);break;case"dash":e.moveTo(n,r),e.lineTo(n+Math.cos(y)*(s?s/2:p),r+Math.sin(y)*p);break;case!1:e.closePath();break}e.fill(),t.borderWidth>0&&e.stroke()}}function Z0(e,t,n){return n=n||.5,!t||e&&e.x>t.left-n&&e.xt.top-n&&e.y0&&o.strokeColor!=="";let l,c;for(e.save(),e.font=s.string,RN(e,o),l=0;l+e||0;function Sd(e,t){const n={},r=Qe(t),s=r?Object.keys(t):t,o=Qe(e)?r?i=>Je(e[i],e[t[i]]):i=>e[i]:()=>e;for(const i of s)n[i]=oO(o(i));return n}function Q0(e){return Sd(e,{top:"y",right:"x",bottom:"y",left:"x"})}function Ns(e){return Sd(e,["topLeft","topRight","bottomLeft","bottomRight"])}function _n(e){const t=Q0(e);return t.width=t.left+t.right,t.height=t.top+t.bottom,t}function Rt(e,t){e=e||{},t=t||_t.font;let n=Je(e.size,t.size);typeof n=="string"&&(n=parseInt(n,10));let r=Je(e.style,t.style);r&&!(""+r).match(rO)&&(console.warn('Invalid font style specified: "'+r+'"'),r=void 0);const s={family:Je(e.family,t.family),lineHeight:sO(Je(e.lineHeight,t.lineHeight),n),size:n,style:r,weight:Je(e.weight,t.weight),string:""};return s.string=JN(s),s}function _a(e,t,n,r){let s,o,i;for(s=0,o=e.length;sn&&a===0?0:a+l;return{min:i(r,-Math.abs(o)),max:i(s,o)}}function Os(e,t){return Object.assign(Object.create(e),t)}function _d(e,t=[""],n,r,s=()=>e[0]){const o=n||e;typeof r>"u"&&(r=nm("_fallback",e));const i={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:e,_rootScopes:o,_fallback:r,_getTarget:s,override:a=>_d([a,...e],t,o,r)};return new Proxy(i,{deleteProperty(a,l){return delete a[l],delete a._keys,delete e[0][l],!0},get(a,l){return R0(a,l,()=>gO(l,t,e,a))},getOwnPropertyDescriptor(a,l){return Reflect.getOwnPropertyDescriptor(a._scopes[0],l)},getPrototypeOf(){return Reflect.getPrototypeOf(e[0])},has(a,l){return rm(a).includes(l)},ownKeys(a){return rm(a)},set(a,l,c){const d=a._storage||(a._storage=s());return a[l]=d[l]=c,delete a._keys,!0}})}function Ts(e,t,n,r){const s={_cacheable:!1,_proxy:e,_context:t,_subProxy:n,_stack:new Set,_descriptors:J0(e,r),setContext:o=>Ts(e,o,n,r),override:o=>Ts(e.override(o),t,n,r)};return new Proxy(s,{deleteProperty(o,i){return delete o[i],delete e[i],!0},get(o,i,a){return R0(o,i,()=>lO(o,i,a))},getOwnPropertyDescriptor(o,i){return o._descriptors.allKeys?Reflect.has(e,i)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(e,i)},getPrototypeOf(){return Reflect.getPrototypeOf(e)},has(o,i){return Reflect.has(e,i)},ownKeys(){return Reflect.ownKeys(e)},set(o,i,a){return e[i]=a,delete o[i],!0}})}function J0(e,t={scriptable:!0,indexable:!0}){const{_scriptable:n=t.scriptable,_indexable:r=t.indexable,_allKeys:s=t.allKeys}=e;return{allKeys:s,scriptable:n,indexable:r,isScriptable:vr(n)?n:()=>n,isIndexable:vr(r)?r:()=>r}}const aO=(e,t)=>e?e+gd(t):t,Ed=(e,t)=>Qe(t)&&e!=="adapters"&&(Object.getPrototypeOf(t)===null||t.constructor===Object);function R0(e,t,n){if(Object.prototype.hasOwnProperty.call(e,t)||t==="constructor")return e[t];const r=n();return e[t]=r,r}function lO(e,t,n){const{_proxy:r,_context:s,_subProxy:o,_descriptors:i}=e;let a=r[t];return vr(a)&&i.isScriptable(t)&&(a=cO(t,a,e,n)),Dt(a)&&a.length&&(a=dO(t,a,e,i.isIndexable)),Ed(t,a)&&(a=Ts(a,s,o&&o[t],i)),a}function cO(e,t,n,r){const{_proxy:s,_context:o,_subProxy:i,_stack:a}=n;if(a.has(e))throw new Error("Recursion detected: "+Array.from(a).join("->")+"->"+e);a.add(e);let l=t(o,i||r);return a.delete(e),Ed(e,l)&&(l=Md(s._scopes,s,e,l)),l}function dO(e,t,n,r){const{_proxy:s,_context:o,_subProxy:i,_descriptors:a}=n;if(typeof o.index<"u"&&r(e))return t[o.index%t.length];if(Qe(t[0])){const l=t,c=s._scopes.filter(d=>d!==l);t=[];for(const d of l){const u=Md(c,s,e,d);t.push(Ts(u,o,i&&i[e],a))}}return t}function em(e,t,n){return vr(e)?e(t,n):e}const uO=(e,t)=>e===!0?t:typeof e=="string"?zr(t,e):void 0;function fO(e,t,n,r,s){for(const o of t){const i=uO(n,o);if(i){e.add(i);const a=em(i._fallback,n,s);if(typeof a<"u"&&a!==n&&a!==r)return a}else if(i===!1&&typeof r<"u"&&n!==r)return null}return!1}function Md(e,t,n,r){const s=t._rootScopes,o=em(t._fallback,n,r),i=[...e,...s],a=new Set;a.add(r);let l=tm(a,i,n,o||n,r);return l===null||typeof o<"u"&&o!==n&&(l=tm(a,i,o,l,r),l===null)?!1:_d(Array.from(a),[""],s,o,()=>hO(t,n,r))}function tm(e,t,n,r,s){for(;n;)n=fO(e,t,n,r,s);return n}function hO(e,t,n){const r=e._getTarget();t in r||(r[t]={});const s=r[t];return Dt(s)&&Qe(n)?n:s||{}}function gO(e,t,n,r){let s;for(const o of t)if(s=nm(aO(o,e),n),typeof s<"u")return Ed(e,s)?Md(n,r,e,s):s}function nm(e,t){for(const n of t){if(!n)continue;const r=n[e];if(typeof r<"u")return r}}function rm(e){let t=e._keys;return t||(t=e._keys=pO(e._scopes)),t}function pO(e){const t=new Set;for(const n of e)for(const r of Object.keys(n).filter(s=>!s.startsWith("_")))t.add(r);return Array.from(t)}function Nd(){return typeof window<"u"&&typeof document<"u"}function Od(e){let t=e.parentNode;return t&&t.toString()==="[object ShadowRoot]"&&(t=t.host),t}function Ea(e,t,n){let r;return typeof e=="string"?(r=parseInt(e,10),e.indexOf("%")!==-1&&(r=r/100*t.parentNode[n])):r=e,r}const Ma=e=>e.ownerDocument.defaultView.getComputedStyle(e,null);function mO(e,t){return Ma(e).getPropertyValue(t)}const bO=["top","right","bottom","left"];function jr(e,t,n){const r={};n=n?"-"+n:"";for(let s=0;s<4;s++){const o=bO[s];r[o]=parseFloat(e[t+"-"+o+n])||0}return r.width=r.left+r.right,r.height=r.top+r.bottom,r}const yO=(e,t,n)=>(e>0||t>0)&&(!n||!n.shadowRoot);function vO(e,t){const n=e.touches,r=n&&n.length?n[0]:e,{offsetX:s,offsetY:o}=r;let i=!1,a,l;if(yO(s,o,e.target))a=s,l=o;else{const c=t.getBoundingClientRect();a=r.clientX-c.left,l=r.clientY-c.top,i=!0}return{x:a,y:l,box:i}}function Wr(e,t){if("native"in e)return e;const{canvas:n,currentDevicePixelRatio:r}=t,s=Ma(n),o=s.boxSizing==="border-box",i=jr(s,"padding"),a=jr(s,"border","width"),{x:l,y:c,box:d}=vO(e,n),u=i.left+(d&&a.left),f=i.top+(d&&a.top);let{width:g,height:m}=t;return o&&(g-=i.width+a.width,m-=i.height+a.height),{x:Math.round((l-u)/g*n.width/r),y:Math.round((c-f)/m*n.height/r)}}function xO(e,t,n){let r,s;if(t===void 0||n===void 0){const o=e&&Od(e);if(!o)t=e.clientWidth,n=e.clientHeight;else{const i=o.getBoundingClientRect(),a=Ma(o),l=jr(a,"border","width"),c=jr(a,"padding");t=i.width-c.width-l.width,n=i.height-c.height-l.height,r=Ea(a.maxWidth,o,"clientWidth"),s=Ea(a.maxHeight,o,"clientHeight")}}return{width:t,height:n,maxWidth:r||va,maxHeight:s||va}}const wr=e=>Math.round(e*10)/10;function wO(e,t,n,r){const s=Ma(e),o=jr(s,"margin"),i=Ea(s.maxWidth,e,"clientWidth")||va,a=Ea(s.maxHeight,e,"clientHeight")||va,l=xO(e,t,n);let{width:c,height:d}=l;if(s.boxSizing==="content-box"){const f=jr(s,"border","width"),g=jr(s,"padding");c-=g.width+f.width,d-=g.height+f.height}return c=Math.max(0,c-o.width),d=Math.max(0,r?c/r:d-o.height),c=wr(Math.min(c,i,l.maxWidth)),d=wr(Math.min(d,a,l.maxHeight)),c&&!d&&(d=wr(c/2)),(t!==void 0||n!==void 0)&&r&&l.height&&d>l.height&&(d=l.height,c=wr(Math.floor(d*r))),{width:c,height:d}}function sm(e,t,n){const r=t||1,s=wr(e.height*r),o=wr(e.width*r);e.height=wr(e.height),e.width=wr(e.width);const i=e.canvas;return i.style&&(n||!i.style.height&&!i.style.width)&&(i.style.height=`${e.height}px`,i.style.width=`${e.width}px`),e.currentDevicePixelRatio!==r||i.height!==s||i.width!==o?(e.currentDevicePixelRatio=r,i.height=s,i.width=o,e.ctx.setTransform(r,0,0,r,0,0),!0):!1}const kO=(function(){let e=!1;try{const t={get passive(){return e=!0,!1}};Nd()&&(window.addEventListener("test",null,t),window.removeEventListener("test",null,t))}catch{}return e})();function om(e,t){const n=mO(e,t),r=n&&n.match(/^(\d+)(\.\d+)?px$/);return r?+r[1]:void 0}const CO=function(e,t){return{x(n){return e+e+t-n},setWidth(n){t=n},textAlign(n){return n==="center"?n:n==="right"?"left":"right"},xPlus(n,r){return n-r},leftForLtr(n,r){return n-r}}},SO=function(){return{x(e){return e},setWidth(e){},textAlign(e){return e},xPlus(e,t){return e+t},leftForLtr(e,t){return e}}};function As(e,t,n){return e?CO(t,n):SO()}function im(e,t){let n,r;(t==="ltr"||t==="rtl")&&(n=e.canvas.style,r=[n.getPropertyValue("direction"),n.getPropertyPriority("direction")],n.setProperty("direction",t,"important"),e.prevTextDirection=r)}function am(e,t){t!==void 0&&(delete e.prevTextDirection,e.canvas.style.setProperty("direction",t[0],t[1]))}function Na(e,t,n){return e.options.clip?e[n]:t[n]}function _O(e,t){const{xScale:n,yScale:r}=e;return n&&r?{left:Na(n,t,"left"),right:Na(n,t,"right"),top:Na(r,t,"top"),bottom:Na(r,t,"bottom")}:t}function EO(e,t){const n=t._clip;if(n.disabled)return!1;const r=_O(t,e.chartArea);return{left:n.left===!1?0:r.left-(n.left===!0?0:n.left),right:n.right===!1?e.width:r.right+(n.right===!0?0:n.right),top:n.top===!1?0:r.top-(n.top===!0?0:n.top),bottom:n.bottom===!1?e.height:r.bottom+(n.bottom===!0?0:n.bottom)}}/*! * Chart.js v4.5.1 * https://www.chartjs.org * (c) 2025 Chart.js Contributors * Released under the MIT License - */class SN{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,n,r,s){const o=n.listeners[s],i=n.duration;o.forEach(a=>a({chart:t,initial:n.initial,numSteps:i,currentStep:Math.min(r-n.start,i)}))}_refresh(){this._request||(this._running=!0,this._request=s0.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let n=0;this._charts.forEach((r,s)=>{if(!r.running||!r.items.length)return;const o=r.items;let i=o.length-1,a=!1,l;for(;i>=0;--i)l=o[i],l._active?(l._total>r.duration&&(r.duration=l._total),l.tick(t),a=!0):(o[i]=o[o.length-1],o.pop());a&&(s.draw(),this._notify(s,r,t,"progress")),o.length||(r.running=!1,this._notify(s,r,t,"complete"),r.initial=!1),n+=o.length}),this._lastDate=t,n===0&&(this._running=!1)}_getAnims(t){const n=this._charts;let r=n.get(t);return r||(r={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},n.set(t,r)),r}listen(t,n,r){this._getAnims(t).listeners[n].push(r)}add(t,n){!n||!n.length||this._getAnims(t).items.push(...n)}has(t){return this._getAnims(t).items.length>0}start(t){const n=this._charts.get(t);n&&(n.running=!0,n.start=Date.now(),n.duration=n.items.reduce((r,s)=>Math.max(r,s._duration),0),this._refresh())}running(t){if(!this._running)return!1;const n=this._charts.get(t);return!(!n||!n.running||!n.items.length)}stop(t){const n=this._charts.get(t);if(!n||!n.items.length)return;const r=n.items;let s=r.length-1;for(;s>=0;--s)r[s].cancel();n.items=[],this._notify(t,n,Date.now(),"complete")}remove(t){return this._charts.delete(t)}}var Zn=new SN;const N0="transparent",_N={boolean(e,t,n){return n>.5?t:e},color(e,t,n){const r=c0(e||N0),s=r.valid&&c0(t||N0);return s&&s.valid?s.mix(r,n).hexString():t},number(e,t,n){return e+(t-e)*n}};class EN{constructor(t,n,r,s){const o=n[r];s=da([t.to,s,o,t.from]);const i=da([t.from,o,s]);this._active=!0,this._fn=t.fn||_N[t.type||typeof i],this._easing=bo[t.easing]||bo.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=n,this._prop=r,this._from=i,this._to=s,this._promises=void 0}active(){return this._active}update(t,n,r){if(this._active){this._notify(!1);const s=this._target[this._prop],o=r-this._start,i=this._duration-o;this._start=r,this._duration=Math.floor(Math.max(i,t.duration)),this._total+=o,this._loop=!!t.loop,this._to=da([t.to,n,s,t.from]),this._from=da([t.from,s,n])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const n=t-this._start,r=this._duration,s=this._prop,o=this._from,i=this._loop,a=this._to;let l;if(this._active=o!==a&&(i||n1?2-l:l,l=this._easing(Math.min(1,Math.max(0,l))),this._target[s]=this._fn(o,a,l)}wait(){const t=this._promises||(this._promises=[]);return new Promise((n,r)=>{t.push({res:n,rej:r})})}_notify(t){const n=t?"res":"rej",r=this._promises||[];for(let s=0;s{const o=t[s];if(!Ke(o))return;const i={};for(const a of n)i[a]=o[a];(Mt(o.properties)&&o.properties||[s]).forEach(a=>{(a===s||!r.has(a))&&r.set(a,i)})})}_animateOptions(t,n){const r=n.options,s=NN(t,r);if(!s)return[];const o=this._createAnimations(s,r);return r.$shared&&MN(t.options.$animations,r).then(()=>{t.options=r},()=>{}),o}_createAnimations(t,n){const r=this._properties,s=[],o=t.$animations||(t.$animations={}),i=Object.keys(n),a=Date.now();let l;for(l=i.length-1;l>=0;--l){const c=i[l];if(c.charAt(0)==="$")continue;if(c==="options"){s.push(...this._animateOptions(t,n));continue}const d=n[c];let u=o[c];const f=r.get(c);if(u)if(f&&u.active()){u.update(f,d,a);continue}else u.cancel();if(!f||!f.duration){t[c]=d;continue}o[c]=u=new EN(f,t,c,d),s.push(u)}return s}update(t,n){if(this._properties.size===0){Object.assign(t,n);return}const r=this._createAnimations(t,n);if(r.length)return Zn.add(this._chart,r),!0}}function MN(e,t){const n=[],r=Object.keys(t);for(let s=0;s0||!n&&o<0)return s.index}return null}function L0(e,t){const{chart:n,_cachedMeta:r}=e,s=n._stacks||(n._stacks={}),{iScale:o,vScale:i,index:a}=r,l=o.axis,c=i.axis,d=DN(o,i,r),u=t.length;let f;for(let g=0;gn[r].axis===t).shift()}function PN(e,t){return ps(e,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}function $N(e,t,n){return ps(e,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:n,index:t,mode:"default",type:"data"})}function xo(e,t){const n=e.controller.index,r=e.vScale&&e.vScale.axis;if(r){t=t||e._parsed;for(const s of t){const o=s._stacks;if(!o||o[r]===void 0||o[r][n]===void 0)return;delete o[r][n],o[r]._visualValues!==void 0&&o[r]._visualValues[n]!==void 0&&delete o[r]._visualValues[n]}}}const dd=e=>e==="reset"||e==="none",P0=(e,t)=>t?e:Object.assign({},e),FN=(e,t,n)=>e&&!t.hidden&&t._stacked&&{keys:A0(n,!0),values:null};class ys{constructor(t,n){this.chart=t,this._ctx=t.ctx,this.index=n,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){const t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=ld(t.vScale,t),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(t){this.index!==t&&xo(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,n=this._cachedMeta,r=this.getDataset(),s=(u,f,g,m)=>u==="x"?f:u==="r"?m:g,o=n.xAxisID=Xe(r.xAxisID,cd(t,"x")),i=n.yAxisID=Xe(r.yAxisID,cd(t,"y")),a=n.rAxisID=Xe(r.rAxisID,cd(t,"r")),l=n.indexAxis,c=n.iAxisID=s(l,o,i,a),d=n.vAxisID=s(l,i,o,a);n.xScale=this.getScaleForId(o),n.yScale=this.getScaleForId(i),n.rScale=this.getScaleForId(a),n.iScale=this.getScaleForId(c),n.vScale=this.getScaleForId(d)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){const n=this._cachedMeta;return t===n.iScale?n.vScale:n.iScale}reset(){this._update("reset")}_destroy(){const t=this._cachedMeta;this._data&&n0(this._data,this),t._stacked&&xo(t)}_dataCheck(){const t=this.getDataset(),n=t.data||(t.data=[]),r=this._data;if(Ke(n)){const s=this._cachedMeta;this._data=AN(n,s)}else if(r!==n){if(r){n0(r,this);const s=this._cachedMeta;xo(s),s._parsed=[]}n&&Object.isExtensible(n)&&FM(n,this),this._syncList=[],this._data=n}}addElements(){const t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){const n=this._cachedMeta,r=this.getDataset();let s=!1;this._dataCheck();const o=n._stacked;n._stacked=ld(n.vScale,n),n.stack!==r.stack&&(s=!0,xo(n),n.stack=r.stack),this._resyncElements(t),(s||o!==n._stacked)&&(L0(this,n._parsed),n._stacked=ld(n.vScale,n))}configure(){const t=this.chart.config,n=t.datasetScopeKeys(this._type),r=t.getOptionScopes(this.getDataset(),n,!0);this.options=t.createResolver(r,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,n){const{_cachedMeta:r,_data:s}=this,{iScale:o,_stacked:i}=r,a=o.axis;let l=t===0&&n===s.length?!0:r._sorted,c=t>0&&r._parsed[t-1],d,u,f;if(this._parsing===!1)r._parsed=s,r._sorted=!0,f=s;else{Mt(s[t])?f=this.parseArrayData(r,s,t,n):Ke(s[t])?f=this.parseObjectData(r,s,t,n):f=this.parsePrimitiveData(r,s,t,n);const g=()=>u[a]===null||c&&u[a]p||u=0;--f)if(!m()){this.updateRangeFromParsed(c,t,g,l);break}}return c}getAllParsedValues(t){const n=this._cachedMeta._parsed,r=[];let s,o,i;for(s=0,o=n.length;s=0&&tthis.getContext(r,s,n),p=c.resolveNamedOptions(f,g,m,u);return p.$shared&&(p.$shared=l,o[i]=Object.freeze(P0(p,l))),p}_resolveAnimations(t,n,r){const s=this.chart,o=this._cachedDataOpts,i=`animation-${n}`,a=o[i];if(a)return a;let l;if(s.options.animation!==!1){const d=this.chart.config,u=d.datasetAnimationScopeKeys(this._type,n),f=d.getOptionScopes(this.getDataset(),u);l=d.createResolver(f,this.getContext(t,r,n))}const c=new O0(s,l&&l.animations);return l&&l._cacheable&&(o[i]=Object.freeze(c)),c}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,n){return!n||dd(t)||this.chart._animationsDisabled}_getSharedOptions(t,n){const r=this.resolveDataElementOptions(t,n),s=this._sharedOptions,o=this.getSharedOptions(r),i=this.includeOptions(n,o)||o!==s;return this.updateSharedOptions(o,n,r),{sharedOptions:o,includeOptions:i}}updateElement(t,n,r,s){dd(s)?Object.assign(t,r):this._resolveAnimations(n,s).update(t,r)}updateSharedOptions(t,n,r){t&&!dd(n)&&this._resolveAnimations(void 0,n).update(t,r)}_setStyle(t,n,r,s){t.active=s;const o=this.getStyle(n,s);this._resolveAnimations(n,r,s).update(t,{options:!s&&this.getSharedOptions(o)||o})}removeHoverStyle(t,n,r){this._setStyle(t,r,"active",!1)}setHoverStyle(t,n,r){this._setStyle(t,r,"active",!0)}_removeDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){const n=this._data,r=this._cachedMeta.data;for(const[a,l,c]of this._syncList)this[a](l,c);this._syncList=[];const s=r.length,o=n.length,i=Math.min(o,s);i&&this.parse(0,i),o>s?this._insertElements(s,o-s,t):o{for(c.length+=n,a=c.length-1;a>=i;a--)c[a]=c[a-n]};for(l(o),a=t;as-o))}return e._cache.$bar}function zN(e){const t=e.iScale,n=VN(t,e.type);let r=t._length,s,o,i,a;const l=()=>{i===32767||i===-32768||(mo(a)&&(r=Math.min(r,Math.abs(i-a)||r)),a=i)};for(s=0,o=n.length;s0?s[e-1]:null,a=eMath.abs(a)&&(l=a,c=i),t[n.axis]=c,t._custom={barStart:l,barEnd:c,start:s,end:o,min:i,max:a}}function $0(e,t,n,r){return Mt(e)?BN(e,t,n,r):t[n.axis]=n.parse(e,r),t}function F0(e,t,n,r){const s=e.iScale,o=e.vScale,i=s.getLabels(),a=s===o,l=[];let c,d,u,f;for(c=n,d=n+r;c=n?1:-1)}function WN(e){let t,n,r,s,o;return e.horizontal?(t=e.base>e.x,n="left",r="right"):(t=e.based.controller.options.grouped),o=r.options.stacked,i=[],a=this._cachedMeta.controller.getParsed(n),l=a&&a[r.axis],c=d=>{const u=d._parsed.find(g=>g[r.axis]===l),f=u&&u[d.vScale.axis];if(at(f)||isNaN(f))return!0};for(const d of s)if(!(n!==void 0&&c(d))&&((o===!1||i.indexOf(d.stack)===-1||o===void 0&&d.stack===void 0)&&i.push(d.stack),d.index===t))break;return i.length||i.push(void 0),i}_getStackCount(t){return this._getStacks(void 0,t).length}_getAxisCount(){return this._getAxis().length}getFirstScaleIdForIndexAxis(){const t=this.chart.scales,n=this.chart.options.indexAxis;return Object.keys(t).filter(r=>t[r].axis===n).shift()}_getAxis(){const t={},n=this.getFirstScaleIdForIndexAxis();for(const r of this.chart.data.datasets)t[Xe(this.chart.options.indexAxis==="x"?r.xAxisID:r.yAxisID,n)]=!0;return Object.keys(t)}_getStackIndex(t,n,r){const s=this._getStacks(t,r),o=n!==void 0?s.indexOf(n):-1;return o===-1?s.length-1:o}_getRuler(){const t=this.options,n=this._cachedMeta,r=n.iScale,s=[];let o,i;for(o=0,i=n.data.length;oaa(x,a,l,!0)?1:Math.max(E,E*n,S,S*n),m=(x,E,S)=>aa(x,a,l,!0)?-1:Math.min(E,E*n,S,S*n),p=g(0,c,u),y=g(Nt,d,f),b=m(lt,c,u),_=m(lt+Nt,d,f);r=(p-b)/2,s=(y-_)/2,o=-(p+b)/2,i=-(y+_)/2}return{ratioX:r,ratioY:s,offsetX:o,offsetY:i}}class wo extends ys{constructor(t,n){super(t,n),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(t,n){const r=this.getDataset().data,s=this._cachedMeta;if(this._parsing===!1)s._parsed=r;else{let o=l=>+r[l];if(Ke(r[t])){const{key:l="value"}=this._parsing;o=c=>+Er(r[c],l)}let i,a;for(i=t,a=t+n;i0&&!isNaN(t)?Ct*(Math.abs(t)/n):0}getLabelAndValue(t){const n=this._cachedMeta,r=this.chart,s=r.data.labels||[],o=Qc(n._parsed[t],r.options.locale);return{label:s[t]||"",value:o}}getMaxBorderWidth(t){let n=0;const r=this.chart;let s,o,i,a,l;if(!t){for(s=0,o=r.data.datasets.length;st!=="spacing",_indexable:t=>t!=="spacing"&&!t.startsWith("borderDash")&&!t.startsWith("hoverBorderDash")}),Pe(wo,"overrides",{aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const n=t.data,{labels:{pointStyle:r,textAlign:s,color:o,useBorderRadius:i,borderRadius:a}}=t.legend.options;return n.labels.length&&n.datasets.length?n.labels.map((l,c)=>{const u=t.getDatasetMeta(0).controller.getStyle(c);return{text:l,fillStyle:u.backgroundColor,fontColor:o,hidden:!t.getDataVisibility(c),lineDash:u.borderDash,lineDashOffset:u.borderDashOffset,lineJoin:u.borderJoinStyle,lineWidth:u.borderWidth,strokeStyle:u.borderColor,textAlign:s,pointStyle:r,borderRadius:i&&(a||u.borderRadius),index:c}}):[]}},onClick(t,n,r){r.chart.toggleDataVisibility(n.index),r.chart.update()}}}});function Ir(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class fd{constructor(t){Pe(this,"options");this.options=t||{}}static override(t){Object.assign(fd.prototype,t)}init(){}formats(){return Ir()}parse(){return Ir()}format(){return Ir()}add(){return Ir()}diff(){return Ir()}startOf(){return Ir()}endOf(){return Ir()}}var qN={_date:fd};function ZN(e,t,n,r){const{controller:s,data:o,_sorted:i}=e,a=s._cachedMeta.iScale,l=e.dataset&&e.dataset.options?e.dataset.options.spanGaps:null;if(a&&t===a.axis&&t!=="r"&&i&&o.length){const c=a._reversePixels?PM:Xc;if(r){if(s._sharedOptions){const d=o[0],u=typeof d.getRange=="function"&&d.getRange(t);if(u){const f=c(o,t,n-u),g=c(o,t,n+u);return{lo:f.lo,hi:g.hi}}}}else{const d=c(o,t,n);if(l){const{vScale:u}=s._cachedMeta,{_parsed:f}=e,g=f.slice(0,d.lo+1).reverse().findIndex(p=>!at(p[u.axis]));d.lo-=Math.max(0,g);const m=f.slice(d.hi).findIndex(p=>!at(p[u.axis]));d.hi+=Math.max(0,m)}return d}}return{lo:0,hi:o.length-1}}function pa(e,t,n,r,s){const o=e.getSortedVisibleDatasetMetas(),i=n[t];for(let a=0,l=o.length;a{l[i]&&l[i](t[n],s)&&(o.push({element:l,datasetIndex:c,index:d}),a=a||l.inRange(t.x,t.y,s))}),r&&!a?[]:o}var eO={modes:{index(e,t,n,r){const s=Dr(t,e),o=n.axis||"x",i=n.includeInvisible||!1,a=n.intersect?hd(e,s,o,r,i):gd(e,s,o,!1,r,i),l=[];return a.length?(e.getSortedVisibleDatasetMetas().forEach(c=>{const d=a[0].index,u=c.data[d];u&&!u.skip&&l.push({element:u,datasetIndex:c.index,index:d})}),l):[]},dataset(e,t,n,r){const s=Dr(t,e),o=n.axis||"xy",i=n.includeInvisible||!1;let a=n.intersect?hd(e,s,o,r,i):gd(e,s,o,!1,r,i);if(a.length>0){const l=a[0].datasetIndex,c=e.getDatasetMeta(l).data;a=[];for(let d=0;dn.pos===t)}function B0(e,t){return e.filter(n=>U0.indexOf(n.pos)===-1&&n.box.axis===t)}function Co(e,t){return e.sort((n,r)=>{const s=t?r:n,o=t?n:r;return s.weight===o.weight?s.index-o.index:s.weight-o.weight})}function tO(e){const t=[];let n,r,s,o,i,a;for(n=0,r=(e||[]).length;nc.box.fullSize),!0),r=Co(ko(t,"left"),!0),s=Co(ko(t,"right")),o=Co(ko(t,"top"),!0),i=Co(ko(t,"bottom")),a=B0(t,"x"),l=B0(t,"y");return{fullSize:n,leftAndTop:r.concat(o),rightAndBottom:s.concat(l).concat(i).concat(a),chartArea:ko(t,"chartArea"),vertical:r.concat(s).concat(l),horizontal:o.concat(i).concat(a)}}function j0(e,t,n,r){return Math.max(e[n],t[n])+Math.max(e[r],t[r])}function W0(e,t){e.top=Math.max(e.top,t.top),e.left=Math.max(e.left,t.left),e.bottom=Math.max(e.bottom,t.bottom),e.right=Math.max(e.right,t.right)}function oO(e,t,n,r){const{pos:s,box:o}=n,i=e.maxPadding;if(!Ke(s)){n.size&&(e[s]-=n.size);const u=r[n.stack]||{size:0,count:1};u.size=Math.max(u.size,n.horizontal?o.height:o.width),n.size=u.size/u.count,e[s]+=n.size}o.getPadding&&W0(i,o.getPadding());const a=Math.max(0,t.outerWidth-j0(i,e,"left","right")),l=Math.max(0,t.outerHeight-j0(i,e,"top","bottom")),c=a!==e.w,d=l!==e.h;return e.w=a,e.h=l,n.horizontal?{same:c,other:d}:{same:d,other:c}}function iO(e){const t=e.maxPadding;function n(r){const s=Math.max(t[r]-e[r],0);return e[r]+=s,s}e.y+=n("top"),e.x+=n("left"),n("right"),n("bottom")}function aO(e,t){const n=t.maxPadding;function r(s){const o={left:0,top:0,right:0,bottom:0};return s.forEach(i=>{o[i]=Math.max(t[i],n[i])}),o}return r(e?["left","right"]:["top","bottom"])}function So(e,t,n,r){const s=[];let o,i,a,l,c,d;for(o=0,i=e.length,c=0;o{typeof p.beforeLayout=="function"&&p.beforeLayout()});const d=l.reduce((p,y)=>y.box.options&&y.box.options.display===!1?p:p+1,0)||1,u=Object.freeze({outerWidth:t,outerHeight:n,padding:s,availableWidth:o,availableHeight:i,vBoxMaxWidth:o/2/d,hBoxMaxHeight:i/2}),f=Object.assign({},s);W0(f,yn(r));const g=Object.assign({maxPadding:f,w:o,h:i,x:s.left,y:s.top},s),m=rO(l.concat(c),u);So(a.fullSize,g,u,m),So(l,g,u,m),So(c,g,u,m)&&So(l,g,u,m),iO(g),G0(a.leftAndTop,g,u,m),g.x+=g.w,g.y+=g.h,G0(a.rightAndBottom,g,u,m),e.chartArea={left:g.left,top:g.top,right:g.left+g.w,bottom:g.top+g.h,height:g.h,width:g.w},tt(a.chartArea,p=>{const y=p.box;Object.assign(y,e.chartArea),y.update(g.w,g.h,{left:0,top:0,right:0,bottom:0})})}};class Y0{acquireContext(t,n){}releaseContext(t){return!1}addEventListener(t,n,r){}removeEventListener(t,n,r){}getDevicePixelRatio(){return 1}getMaximumSize(t,n,r,s){return n=Math.max(0,n||t.width),r=r||t.height,{width:n,height:Math.max(0,s?Math.floor(n/s):r)}}isAttached(t){return!0}updateConfig(t){}}class lO extends Y0{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const ba="$chartjs",cO={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},K0=e=>e===null||e==="";function dO(e,t){const n=e.style,r=e.getAttribute("height"),s=e.getAttribute("width");if(e[ba]={initial:{height:r,width:s,style:{display:n.display,height:n.height,width:n.width}}},n.display=n.display||"block",n.boxSizing=n.boxSizing||"border-box",K0(s)){const o=_0(e,"width");o!==void 0&&(e.width=o)}if(K0(r))if(e.style.height==="")e.height=e.width/(t||2);else{const o=_0(e,"height");o!==void 0&&(e.height=o)}return e}const X0=vN?{passive:!0}:!1;function uO(e,t,n){e&&e.addEventListener(t,n,X0)}function fO(e,t,n){e&&e.canvas&&e.canvas.removeEventListener(t,n,X0)}function hO(e,t){const n=cO[e.type]||e.type,{x:r,y:s}=Dr(e,t);return{type:n,chart:t,native:e,x:r!==void 0?r:null,y:s!==void 0?s:null}}function ya(e,t){for(const n of e)if(n===t||n.contains(t))return!0}function gO(e,t,n){const r=e.canvas,s=new MutationObserver(o=>{let i=!1;for(const a of o)i=i||ya(a.addedNodes,r),i=i&&!ya(a.removedNodes,r);i&&n()});return s.observe(document,{childList:!0,subtree:!0}),s}function pO(e,t,n){const r=e.canvas,s=new MutationObserver(o=>{let i=!1;for(const a of o)i=i||ya(a.removedNodes,r),i=i&&!ya(a.addedNodes,r);i&&n()});return s.observe(document,{childList:!0,subtree:!0}),s}const _o=new Map;let q0=0;function Z0(){const e=window.devicePixelRatio;e!==q0&&(q0=e,_o.forEach((t,n)=>{n.currentDevicePixelRatio!==e&&t()}))}function mO(e,t){_o.size||window.addEventListener("resize",Z0),_o.set(e,t)}function bO(e){_o.delete(e),_o.size||window.removeEventListener("resize",Z0)}function yO(e,t,n){const r=e.canvas,s=r&&ad(r);if(!s)return;const o=o0((a,l)=>{const c=s.clientWidth;n(a,l),c{const l=a[0],c=l.contentRect.width,d=l.contentRect.height;c===0&&d===0||o(c,d)});return i.observe(s),mO(e,o),i}function pd(e,t,n){n&&n.disconnect(),t==="resize"&&bO(e)}function vO(e,t,n){const r=e.canvas,s=o0(o=>{e.ctx!==null&&n(hO(o,e))},e);return uO(r,t,s),s}class xO extends Y0{acquireContext(t,n){const r=t&&t.getContext&&t.getContext("2d");return r&&r.canvas===t?(dO(t,n),r):null}releaseContext(t){const n=t.canvas;if(!n[ba])return!1;const r=n[ba].initial;["height","width"].forEach(o=>{const i=r[o];at(i)?n.removeAttribute(o):n.setAttribute(o,i)});const s=r.style||{};return Object.keys(s).forEach(o=>{n.style[o]=s[o]}),n.width=n.width,delete n[ba],!0}addEventListener(t,n,r){this.removeEventListener(t,n);const s=t.$proxies||(t.$proxies={}),i={attach:gO,detach:pO,resize:yO}[n]||vO;s[n]=i(t,n,r)}removeEventListener(t,n){const r=t.$proxies||(t.$proxies={}),s=r[n];if(!s)return;({attach:pd,detach:pd,resize:pd}[n]||fO)(t,n,s),r[n]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,n,r,s){return yN(t,n,r,s)}isAttached(t){const n=t&&ad(t);return!!(n&&n.isConnected)}}function wO(e){return!id()||typeof OffscreenCanvas<"u"&&e instanceof OffscreenCanvas?lO:xO}let Lr=(Ia=class{constructor(){Pe(this,"x");Pe(this,"y");Pe(this,"active",!1);Pe(this,"options");Pe(this,"$animations")}tooltipPosition(t){const{x:n,y:r}=this.getProps(["x","y"],t);return{x:n,y:r}}hasValue(){return ia(this.x)&&ia(this.y)}getProps(t,n){const r=this.$animations;if(!n||!r)return this;const s={};return t.forEach(o=>{s[o]=r[o]&&r[o].active()?r[o]._to:this[o]}),s}},Pe(Ia,"defaults",{}),Pe(Ia,"defaultRoutes"),Ia);function kO(e,t){const n=e.options.ticks,r=CO(e),s=Math.min(n.maxTicksLimit||r,r),o=n.major.enabled?_O(t):[],i=o.length,a=o[0],l=o[i-1],c=[];if(i>s)return EO(t,c,o,i/s),c;const d=SO(o,t,s);if(i>0){let u,f;const g=i>1?Math.round((l-a)/(i-1)):null;for(va(t,c,d,at(g)?0:a-g,a),u=0,f=i-1;us)return l}return Math.max(s,1)}function _O(e){const t=[];let n,r;for(n=0,r=e.length;ne==="left"?"right":e==="right"?"left":e,Q0=(e,t,n)=>t==="top"||t==="left"?e[t]+n:e[t]-n,J0=(e,t)=>Math.min(t||e,e);function R0(e,t){const n=[],r=e.length/t,s=e.length;let o=0;for(;oi+a)))return l}function TO(e,t){tt(e,n=>{const r=n.gc,s=r.length/2;let o;if(s>t){for(o=0;or?r:n,r=s&&n>r?n:r,{min:zn(n,zn(r,n)),max:zn(r,zn(n,r))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}getLabelItems(t=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(t))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){ut(this.options.beforeUpdate,[this])}update(t,n,r){const{beginAtZero:s,grace:o,ticks:i}=this.options,a=i.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=n,this._margins=r=Object.assign({left:0,right:0,top:0,bottom:0},r),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+r.left+r.right:this.height+r.top+r.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=rN(this,o,s),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const l=a=o||r<=1||!this.isHorizontal()){this.labelRotation=s;return}const d=this._getLabelSizes(),u=d.widest.width,f=d.highest.height,g=nn(this.chart.width-u,0,this.maxWidth);a=t.offset?this.maxWidth/r:g/(r-1),u+6>a&&(a=g/(r-(t.offset?.5:1)),l=this.maxHeight-Eo(t.grid)-n.padding-em(t.title,this.chart.options.font),c=Math.sqrt(u*u+f*f),i=DM(Math.min(Math.asin(nn((d.highest.height+6)/a,-1,1)),Math.asin(nn(l/c,-1,1))-Math.asin(nn(f/c,-1,1)))),i=Math.max(s,Math.min(o,i))),this.labelRotation=i}afterCalculateLabelRotation(){ut(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){ut(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:n,options:{ticks:r,title:s,grid:o}}=this,i=this._isVisible(),a=this.isHorizontal();if(i){const l=em(s,n.options.font);if(a?(t.width=this.maxWidth,t.height=Eo(o)+l):(t.height=this.maxHeight,t.width=Eo(o)+l),r.display&&this.ticks.length){const{first:c,last:d,widest:u,highest:f}=this._getLabelSizes(),g=r.padding*2,m=qn(this.labelRotation),p=Math.cos(m),y=Math.sin(m);if(a){const b=r.mirror?0:y*u.width+p*f.height;t.height=Math.min(this.maxHeight,t.height+b+g)}else{const b=r.mirror?0:p*u.width+y*f.height;t.width=Math.min(this.maxWidth,t.width+b+g)}this._calculatePadding(c,d,y,p)}}this._handleMargins(),a?(this.width=this._length=n.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=n.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,n,r,s){const{ticks:{align:o,padding:i},position:a}=this.options,l=this.labelRotation!==0,c=a!=="top"&&this.axis==="x";if(this.isHorizontal()){const d=this.getPixelForTick(0)-this.left,u=this.right-this.getPixelForTick(this.ticks.length-1);let f=0,g=0;l?c?(f=s*t.width,g=r*n.height):(f=r*t.height,g=s*n.width):o==="start"?g=n.width:o==="end"?f=t.width:o!=="inner"&&(f=t.width/2,g=n.width/2),this.paddingLeft=Math.max((f-d+i)*this.width/(this.width-d),0),this.paddingRight=Math.max((g-u+i)*this.width/(this.width-u),0)}else{let d=n.height/2,u=t.height/2;o==="start"?(d=0,u=t.height):o==="end"&&(d=n.height,u=0),this.paddingTop=d+i,this.paddingBottom=u+i}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){ut(this.options.afterFit,[this])}isHorizontal(){const{axis:t,position:n}=this.options;return n==="top"||n==="bottom"||t==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){this.beforeTickToLabelConversion(),this.generateTickLabels(t);let n,r;for(n=0,r=t.length;n({width:i[k]||0,height:a[k]||0});return{first:C(0),last:C(n-1),widest:C(w),highest:C(N),widths:i,heights:a}}getLabelForValue(t){return t}getPixelForValue(t,n){return NaN}getValueForPixel(t){}getPixelForTick(t){const n=this.ticks;return t<0||t>n.length-1?null:this.getPixelForValue(n[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);const n=this._startPixel+t*this._length;return LM(this._alignToPixels?Tr(this.chart,n,0):n)}getDecimalForPixel(t){const n=(t-this._startPixel)/this._length;return this._reversePixels?1-n:n}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:t,max:n}=this;return t<0&&n<0?n:t>0&&n>0?t:0}getContext(t){const n=this.ticks||[];if(t>=0&&ta*s?a/r:l/s:l*s0}_computeGridLineItems(t){const n=this.axis,r=this.chart,s=this.options,{grid:o,position:i,border:a}=s,l=o.offset,c=this.isHorizontal(),u=this.ticks.length+(l?1:0),f=Eo(o),g=[],m=a.setContext(this.getContext()),p=m.display?m.width:0,y=p/2,b=function(A){return Tr(r,A,p)};let _,x,E,S,w,N,C,k,M,T,L,P;if(i==="top")_=b(this.bottom),N=this.bottom-f,k=_-y,T=b(t.top)+y,P=t.bottom;else if(i==="bottom")_=b(this.top),T=t.top,P=b(t.bottom)-y,N=_+y,k=this.top+f;else if(i==="left")_=b(this.right),w=this.right-f,C=_-y,M=b(t.left)+y,L=t.right;else if(i==="right")_=b(this.left),M=t.left,L=b(t.right)-y,w=_+y,C=this.left+f;else if(n==="x"){if(i==="center")_=b((t.top+t.bottom)/2+.5);else if(Ke(i)){const A=Object.keys(i)[0],O=i[A];_=b(this.chart.scales[A].getPixelForValue(O))}T=t.top,P=t.bottom,N=_+y,k=N+f}else if(n==="y"){if(i==="center")_=b((t.left+t.right)/2);else if(Ke(i)){const A=Object.keys(i)[0],O=i[A];_=b(this.chart.scales[A].getPixelForValue(O))}w=_-y,C=w-f,M=t.left,L=t.right}const F=Xe(s.ticks.maxTicksLimit,u),D=Math.max(1,Math.ceil(u/F));for(x=0;x0&&(K-=G/2);break}j={left:K,top:z,width:G+U.width,height:B+U.height,color:D.backdropColor}}y.push({label:E,font:k,textOffset:L,options:{rotation:p,color:O,strokeColor:V,strokeWidth:H,textAlign:W,textBaseline:P,translation:[S,w],backdrop:j}})}return y}_getXAxisLabelAlignment(){const{position:t,ticks:n}=this.options;if(-qn(this.labelRotation))return t==="top"?"left":"right";let s="center";return n.align==="start"?s="left":n.align==="end"?s="right":n.align==="inner"&&(s="inner"),s}_getYAxisLabelAlignment(t){const{position:n,ticks:{crossAlign:r,mirror:s,padding:o}}=this.options,i=this._getLabelSizes(),a=t+o,l=i.widest.width;let c,d;return n==="left"?s?(d=this.right+o,r==="near"?c="left":r==="center"?(c="center",d+=l/2):(c="right",d+=l)):(d=this.right-a,r==="near"?c="right":r==="center"?(c="center",d-=l/2):(c="left",d=this.left)):n==="right"?s?(d=this.left+o,r==="near"?c="right":r==="center"?(c="center",d-=l/2):(c="left",d-=l)):(d=this.left+a,r==="near"?c="left":r==="center"?(c="center",d+=l/2):(c="right",d=this.right)):c="right",{textAlign:c,x:d}}_computeLabelArea(){if(this.options.ticks.mirror)return;const t=this.chart,n=this.options.position;if(n==="left"||n==="right")return{top:0,left:this.left,bottom:t.height,right:this.right};if(n==="top"||n==="bottom")return{top:this.top,left:0,bottom:this.bottom,right:t.width}}drawBackground(){const{ctx:t,options:{backgroundColor:n},left:r,top:s,width:o,height:i}=this;n&&(t.save(),t.fillStyle=n,t.fillRect(r,s,o,i),t.restore())}getLineWidthForValue(t){const n=this.options.grid;if(!this._isVisible()||!n.display)return 0;const s=this.ticks.findIndex(o=>o.value===t);return s>=0?n.setContext(this.getContext(s)).lineWidth:0}drawGrid(t){const n=this.options.grid,r=this.ctx,s=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let o,i;const a=(l,c,d)=>{!d.width||!d.color||(r.save(),r.lineWidth=d.width,r.strokeStyle=d.color,r.setLineDash(d.borderDash||[]),r.lineDashOffset=d.borderDashOffset,r.beginPath(),r.moveTo(l.x,l.y),r.lineTo(c.x,c.y),r.stroke(),r.restore())};if(n.display)for(o=0,i=s.length;o{this.draw(o)}}]:[{z:r,draw:o=>{this.drawBackground(),this.drawGrid(o),this.drawTitle()}},{z:s,draw:()=>{this.drawBorder()}},{z:n,draw:o=>{this.drawLabels(o)}}]}getMatchingVisibleMetas(t){const n=this.chart.getSortedVisibleDatasetMetas(),r=this.axis+"AxisID",s=[];let o,i;for(o=0,i=n.length;o{const r=n.split("."),s=r.pop(),o=[e].concat(r).join("."),i=t[n].split("."),a=i.pop(),l=i.join(".");xt.route(o,s,l,a)})}function FO(e){return"id"in e&&"defaults"in e}class VO{constructor(){this.controllers=new xa(ys,"datasets",!0),this.elements=new xa(Lr,"elements"),this.plugins=new xa(Object,"plugins"),this.scales=new xa(vs,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,n,r){[...n].forEach(s=>{const o=r||this._getRegistryForType(s);r||o.isForType(s)||o===this.plugins&&s.id?this._exec(t,o,s):tt(s,i=>{const a=r||this._getRegistryForType(i);this._exec(t,a,i)})})}_exec(t,n,r){const s=Yc(t);ut(r["before"+s],[],r),n[t](r),ut(r["after"+s],[],r)}_getRegistryForType(t){for(let n=0;no.filter(a=>!i.some(l=>a.plugin.id===l.plugin.id));this._notify(s(n,r),t,"stop"),this._notify(s(r,n),t,"start")}}function HO(e){const t={},n=[],r=Object.keys(Un.plugins.items);for(let o=0;o1&&tm(e[0].toLowerCase());if(r)return r}throw new Error(`Cannot determine type of '${e}' axis. Please provide 'axis' or 'position' option.`)}function nm(e,t,n){if(n[t+"AxisID"]===e)return{axis:t}}function KO(e,t){if(t.data&&t.data.datasets){const n=t.data.datasets.filter(r=>r.xAxisID===e||r.yAxisID===e);if(n.length)return nm(e,"x",n[0])||nm(e,"y",n[0])}return{}}function XO(e,t){const n=Or[e.type]||{scales:{}},r=t.scales||{},s=md(e.type,t),o=Object.create(null);return Object.keys(r).forEach(i=>{const a=r[i];if(!Ke(a))return console.error(`Invalid scale configuration for scale: ${i}`);if(a._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${i}`);const l=bd(i,a,KO(i,e),xt.scales[a.type]),c=GO(l,s),d=n.scales||{};o[i]=po(Object.create(null),[{axis:l},a,d[l],d[c]])}),e.data.datasets.forEach(i=>{const a=i.type||e.type,l=i.indexAxis||md(a,t),d=(Or[a]||{}).scales||{};Object.keys(d).forEach(u=>{const f=WO(u,l),g=i[f+"AxisID"]||f;o[g]=o[g]||Object.create(null),po(o[g],[{axis:f},r[g],d[u]])})}),Object.keys(o).forEach(i=>{const a=o[i];po(a,[xt.scales[a.type],xt.scale])}),o}function rm(e){const t=e.options||(e.options={});t.plugins=Xe(t.plugins,{}),t.scales=XO(e,t)}function sm(e){return e=e||{},e.datasets=e.datasets||[],e.labels=e.labels||[],e}function qO(e){return e=e||{},e.data=sm(e.data),rm(e),e}const om=new Map,im=new Set;function wa(e,t){let n=om.get(e);return n||(n=t(),om.set(e,n),im.add(n)),n}const Mo=(e,t,n)=>{const r=Er(t,n);r!==void 0&&e.add(r)};class ZO{constructor(t){this._config=qO(t),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(t){this._config.type=t}get data(){return this._config.data}set data(t){this._config.data=sm(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){const t=this._config;this.clearCache(),rm(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return wa(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,n){return wa(`${t}.transition.${n}`,()=>[[`datasets.${t}.transitions.${n}`,`transitions.${n}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,n){return wa(`${t}-${n}`,()=>[[`datasets.${t}.elements.${n}`,`datasets.${t}`,`elements.${n}`,""]])}pluginScopeKeys(t){const n=t.id,r=this.type;return wa(`${r}-plugin-${n}`,()=>[[`plugins.${n}`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,n){const r=this._scopeCache;let s=r.get(t);return(!s||n)&&(s=new Map,r.set(t,s)),s}getOptionScopes(t,n,r){const{options:s,type:o}=this,i=this._cachedScopes(t,r),a=i.get(n);if(a)return a;const l=new Set;n.forEach(d=>{t&&(l.add(t),d.forEach(u=>Mo(l,t,u))),d.forEach(u=>Mo(l,s,u)),d.forEach(u=>Mo(l,Or[o]||{},u)),d.forEach(u=>Mo(l,xt,u)),d.forEach(u=>Mo(l,Jc,u))});const c=Array.from(l);return c.length===0&&c.push(Object.create(null)),im.has(n)&&i.set(n,c),c}chartOptionScopes(){const{options:t,type:n}=this;return[t,Or[n]||{},xt.datasets[n]||{},{type:n},xt,Jc]}resolveNamedOptions(t,n,r,s=[""]){const o={$shared:!0},{resolver:i,subPrefixes:a}=am(this._resolverCache,t,s);let l=i;if(JO(i,n)){o.$shared=!1,r=cr(r)?r():r;const c=this.createResolver(t,r,a);l=ms(i,r,c)}for(const c of n)o[c]=l[c];return o}createResolver(t,n,r=[""],s){const{resolver:o}=am(this._resolverCache,t,r);return Ke(n)?ms(o,n,void 0,s):o}}function am(e,t,n){let r=e.get(t);r||(r=new Map,e.set(t,r));const s=n.join();let o=r.get(s);return o||(o={resolver:rd(t,n),subPrefixes:n.filter(a=>!a.toLowerCase().includes("hover"))},r.set(s,o)),o}const QO=e=>Ke(e)&&Object.getOwnPropertyNames(e).some(t=>cr(e[t]));function JO(e,t){const{isScriptable:n,isIndexable:r}=y0(e);for(const s of t){const o=n(s),i=r(s),a=(i||o)&&e[s];if(o&&(cr(a)||QO(a))||i&&Mt(a))return!0}return!1}var RO="4.5.1";const e5=["top","bottom","left","right","chartArea"];function lm(e,t){return e==="top"||e==="bottom"||e5.indexOf(e)===-1&&t==="x"}function cm(e,t){return function(n,r){return n[e]===r[e]?n[t]-r[t]:n[e]-r[e]}}function dm(e){const t=e.chart,n=t.options.animation;t.notifyPlugins("afterRender"),ut(n&&n.onComplete,[e],t)}function t5(e){const t=e.chart,n=t.options.animation;ut(n&&n.onProgress,[e],t)}function um(e){return id()&&typeof e=="string"?e=document.getElementById(e):e&&e.length&&(e=e[0]),e&&e.canvas&&(e=e.canvas),e}const ka={},fm=e=>{const t=um(e);return Object.values(ka).filter(n=>n.canvas===t).pop()};function n5(e,t,n){const r=Object.keys(e);for(const s of r){const o=+s;if(o>=t){const i=e[s];delete e[s],(n>0||o>t)&&(e[o+n]=i)}}}function r5(e,t,n,r){return!n||e.type==="mouseout"?null:r?t:e}let No=(hr=class{static register(...t){Un.add(...t),hm()}static unregister(...t){Un.remove(...t),hm()}constructor(t,n){const r=this.config=new ZO(n),s=um(t),o=fm(s);if(o)throw new Error("Canvas is already in use. Chart with ID '"+o.id+"' must be destroyed before the canvas with ID '"+o.canvas.id+"' can be reused.");const i=r.createResolver(r.chartOptionScopes(),this.getContext());this.platform=new(r.platform||wO(s)),this.platform.updateConfig(r);const a=this.platform.acquireContext(s,i.aspectRatio),l=a&&a.canvas,c=l&&l.height,d=l&&l.width;if(this.id=xM(),this.ctx=a,this.canvas=l,this.width=d,this.height=c,this._options=i,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new zO,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=VM(u=>this.update(u),i.resizeDelay||0),this._dataChanges=[],ka[this.id]=this,!a||!l){console.error("Failed to create chart: can't acquire context from the given item");return}Zn.listen(this,"complete",dm),Zn.listen(this,"progress",t5),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:n},width:r,height:s,_aspectRatio:o}=this;return at(t)?n&&o?o:s?r/s:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}get registry(){return Un}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():S0(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return h0(this.canvas,this.ctx),this}stop(){return Zn.stop(this),this}resize(t,n){Zn.running(this)?this._resizeBeforeDraw={width:t,height:n}:this._resize(t,n)}_resize(t,n){const r=this.options,s=this.canvas,o=r.maintainAspectRatio&&this.aspectRatio,i=this.platform.getMaximumSize(s,t,n,o),a=r.devicePixelRatio||this.platform.getDevicePixelRatio(),l=this.width?"resize":"attach";this.width=i.width,this.height=i.height,this._aspectRatio=this.aspectRatio,S0(this,a,!0)&&(this.notifyPlugins("resize",{size:i}),ut(r.onResize,[this,i],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){const n=this.options.scales||{};tt(n,(r,s)=>{r.id=s})}buildOrUpdateScales(){const t=this.options,n=t.scales,r=this.scales,s=Object.keys(r).reduce((i,a)=>(i[a]=!1,i),{});let o=[];n&&(o=o.concat(Object.keys(n).map(i=>{const a=n[i],l=bd(i,a),c=l==="r",d=l==="x";return{options:a,dposition:c?"chartArea":d?"bottom":"left",dtype:c?"radialLinear":d?"category":"linear"}}))),tt(o,i=>{const a=i.options,l=a.id,c=bd(l,a),d=Xe(a.type,i.dtype);(a.position===void 0||lm(a.position,c)!==lm(i.dposition))&&(a.position=i.dposition),s[l]=!0;let u=null;if(l in r&&r[l].type===d)u=r[l];else{const f=Un.getScale(d);u=new f({id:l,type:d,ctx:this.ctx,chart:this}),r[u.id]=u}u.init(a,t)}),tt(s,(i,a)=>{i||delete r[a]}),tt(r,i=>{vn.configure(this,i,i.options),vn.addBox(this,i)})}_updateMetasets(){const t=this._metasets,n=this.data.datasets.length,r=t.length;if(t.sort((s,o)=>s.index-o.index),r>n){for(let s=n;sn.length&&delete this._stacks,t.forEach((r,s)=>{n.filter(o=>o===r._dataset).length===0&&this._destroyDatasetMeta(s)})}buildOrUpdateControllers(){const t=[],n=this.data.datasets;let r,s;for(this._removeUnreferencedMetasets(),r=0,s=n.length;r{this.getDatasetMeta(n).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const n=this.config;n.update();const r=this._options=n.createResolver(n.chartOptionScopes(),this.getContext()),s=this._animationsDisabled=!r.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0})===!1)return;const o=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let i=0;for(let c=0,d=this.data.datasets.length;c{c.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(cm("z","_idx"));const{_active:a,_lastEvent:l}=this;l?this._eventHandler(l,!0):a.length&&this._updateHoverStyles(a,a,!0),this.render()}_updateScales(){tt(this.scales,t=>{vn.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,n=new Set(Object.keys(this._listeners)),r=new Set(t.events);(!qp(n,r)||!!this._responsiveListeners!==t.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,n=this._getUniformDataChanges()||[];for(const{method:r,start:s,count:o}of n){const i=r==="_removeElements"?-o:o;n5(t,s,i)}}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const n=this.data.datasets.length,r=o=>new Set(t.filter(i=>i[0]===o).map((i,a)=>a+","+i.splice(1).join(","))),s=r(0);for(let o=1;oo.split(",")).map(o=>({method:o[1],start:+o[2],count:+o[3]}))}_updateLayout(t){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;vn.update(this,this.width,this.height,t);const n=this.chartArea,r=n.width<=0||n.height<=0;this._layers=[],tt(this.boxes,s=>{r&&s.position==="chartArea"||(s.configure&&s.configure(),this._layers.push(...s._layers()))},this),this._layers.forEach((s,o)=>{s._idx=o}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})!==!1){for(let n=0,r=this.data.datasets.length;n=0;--n)this._drawDataset(t[n]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const n=this.ctx,r={meta:t,index:t.index,cancelable:!0},s=CN(this,t);this.notifyPlugins("beforeDatasetDraw",r)!==!1&&(s&&ed(n,s),t.controller.draw(),s&&td(n),r.cancelable=!1,this.notifyPlugins("afterDatasetDraw",r))}isPointInArea(t){return m0(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,n,r,s){const o=eO.modes[n];return typeof o=="function"?o(this,t,r,s):[]}getDatasetMeta(t){const n=this.data.datasets[t],r=this._metasets;let s=r.filter(o=>o&&o._dataset===n).pop();return s||(s={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:n&&n.order||0,index:t,_dataset:n,_parsed:[],_sorted:!1},r.push(s)),s}getContext(){return this.$context||(this.$context=ps(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const n=this.data.datasets[t];if(!n)return!1;const r=this.getDatasetMeta(t);return typeof r.hidden=="boolean"?!r.hidden:!n.hidden}setDatasetVisibility(t,n){const r=this.getDatasetMeta(t);r.hidden=!n}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,n,r){const s=r?"show":"hide",o=this.getDatasetMeta(t),i=o.controller._resolveAnimations(void 0,s);mo(n)?(o.data[n].hidden=!r,this.update()):(this.setDatasetVisibility(t,r),i.update(o,{visible:r}),this.update(a=>a.datasetIndex===t?s:void 0))}hide(t,n){this._updateVisibility(t,n,!1)}show(t,n){this._updateVisibility(t,n,!0)}_destroyDatasetMeta(t){const n=this._metasets[t];n&&n.controller&&n.controller._destroy(),delete this._metasets[t]}_stop(){let t,n;for(this.stop(),Zn.remove(this),t=0,n=this.data.datasets.length;t{n.addEventListener(this,o,i),t[o]=i},s=(o,i,a)=>{o.offsetX=i,o.offsetY=a,this._eventHandler(o)};tt(this.options.events,o=>r(o,s))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,n=this.platform,r=(l,c)=>{n.addEventListener(this,l,c),t[l]=c},s=(l,c)=>{t[l]&&(n.removeEventListener(this,l,c),delete t[l])},o=(l,c)=>{this.canvas&&this.resize(l,c)};let i;const a=()=>{s("attach",a),this.attached=!0,this.resize(),r("resize",o),r("detach",i)};i=()=>{this.attached=!1,s("resize",o),this._stop(),this._resize(0,0),r("attach",a)},n.isAttached(this.canvas)?a():i()}unbindEvents(){tt(this._listeners,(t,n)=>{this.platform.removeEventListener(this,n,t)}),this._listeners={},tt(this._responsiveListeners,(t,n)=>{this.platform.removeEventListener(this,n,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,n,r){const s=r?"set":"remove";let o,i,a,l;for(n==="dataset"&&(o=this.getDatasetMeta(t[0].datasetIndex),o.controller["_"+s+"DatasetHoverStyle"]()),a=0,l=t.length;a{const a=this.getDatasetMeta(o);if(!a)throw new Error("No dataset found at index "+o);return{datasetIndex:o,element:a.data[i],index:i}});!na(r,n)&&(this._active=r,this._lastEvent=null,this._updateHoverStyles(r,n))}notifyPlugins(t,n,r){return this._plugins.notify(this,t,n,r)}isPluginEnabled(t){return this._plugins._cache.filter(n=>n.plugin.id===t).length===1}_updateHoverStyles(t,n,r){const s=this.options.hover,o=(l,c)=>l.filter(d=>!c.some(u=>d.datasetIndex===u.datasetIndex&&d.index===u.index)),i=o(n,t),a=r?t:o(t,n);i.length&&this.updateHoverStyle(i,s.mode,!1),a.length&&s.mode&&this.updateHoverStyle(a,s.mode,!0)}_eventHandler(t,n){const r={event:t,replay:n,cancelable:!0,inChartArea:this.isPointInArea(t)},s=i=>(i.options.events||this.options.events).includes(t.native.type);if(this.notifyPlugins("beforeEvent",r,s)===!1)return;const o=this._handleEvent(t,n,r.inChartArea);return r.cancelable=!1,this.notifyPlugins("afterEvent",r,s),(o||r.changed)&&this.render(),this}_handleEvent(t,n,r){const{_active:s=[],options:o}=this,i=n,a=this._getActiveElements(t,s,r,i),l=EM(t),c=r5(t,this._lastEvent,r,l);r&&(this._lastEvent=null,ut(o.onHover,[t,a,this],this),l&&ut(o.onClick,[t,a,this],this));const d=!na(a,s);return(d||n)&&(this._active=a,this._updateHoverStyles(a,s,n)),this._lastEvent=c,d}_getActiveElements(t,n,r,s){if(t.type==="mouseout")return[];if(!r)return n;const o=this.options.hover;return this.getElementsAtEventForMode(t,o.mode,o,s)}},Pe(hr,"defaults",xt),Pe(hr,"instances",ka),Pe(hr,"overrides",Or),Pe(hr,"registry",Un),Pe(hr,"version",RO),Pe(hr,"getChart",fm),hr);function hm(){return tt(No.instances,e=>e._plugins.invalidate())}function s5(e,t,n){const{startAngle:r,x:s,y:o,outerRadius:i,innerRadius:a,options:l}=t,{borderWidth:c,borderJoinStyle:d}=l,u=Math.min(c/i,Hn(r-n));if(e.beginPath(),e.arc(s,o,i-c/2,r+u/2,n-u/2),a>0){const f=Math.min(c/a,Hn(r-n));e.arc(s,o,a+c/2,n-f/2,r+f/2,!0)}else{const f=Math.min(c/2,i*Hn(r-n));if(d==="round")e.arc(s,o,f,n-lt/2,r+lt/2,!0);else if(d==="bevel"){const g=2*f*f,m=-g*Math.cos(n+lt/2)+s,p=-g*Math.sin(n+lt/2)+o,y=g*Math.cos(r+lt/2)+s,b=g*Math.sin(r+lt/2)+o;e.lineTo(m,p),e.lineTo(y,b)}}e.closePath(),e.moveTo(0,0),e.rect(0,0,e.canvas.width,e.canvas.height),e.clip("evenodd")}function o5(e,t,n){const{startAngle:r,pixelMargin:s,x:o,y:i,outerRadius:a,innerRadius:l}=t;let c=s/a;e.beginPath(),e.arc(o,i,a,r-c,n+c),l>s?(c=s/l,e.arc(o,i,l,n+c,r-c,!0)):e.arc(o,i,s,n+Nt,r-Nt),e.closePath(),e.clip()}function i5(e){return nd(e,["outerStart","outerEnd","innerStart","innerEnd"])}function a5(e,t,n,r){const s=i5(e.options.borderRadius),o=(n-t)/2,i=Math.min(o,r*t/2),a=l=>{const c=(n-Math.min(o,l))*r/2;return nn(l,0,Math.min(o,c))};return{outerStart:a(s.outerStart),outerEnd:a(s.outerEnd),innerStart:nn(s.innerStart,0,i),innerEnd:nn(s.innerEnd,0,i)}}function xs(e,t,n,r){return{x:n+e*Math.cos(t),y:r+e*Math.sin(t)}}function Ca(e,t,n,r,s,o){const{x:i,y:a,startAngle:l,pixelMargin:c,innerRadius:d}=t,u=Math.max(t.outerRadius+r+n-c,0),f=d>0?d+r+n+c:0;let g=0;const m=s-l;if(r){const D=d>0?d-r:0,A=u>0?u-r:0,O=(D+A)/2,V=O!==0?m*O/(O+r):m;g=(m-V)/2}const p=Math.max(.001,m*u-n/lt)/u,y=(m-p)/2,b=l+y+g,_=s-y-g,{outerStart:x,outerEnd:E,innerStart:S,innerEnd:w}=a5(t,f,u,_-b),N=u-x,C=u-E,k=b+x/N,M=_-E/C,T=f+S,L=f+w,P=b+S/T,F=_-w/L;if(e.beginPath(),o){const D=(k+M)/2;if(e.arc(i,a,u,k,D),e.arc(i,a,u,D,M),E>0){const H=xs(C,M,i,a);e.arc(H.x,H.y,E,M,_+Nt)}const A=xs(L,_,i,a);if(e.lineTo(A.x,A.y),w>0){const H=xs(L,F,i,a);e.arc(H.x,H.y,w,_+Nt,F+Math.PI)}const O=(_-w/f+(b+S/f))/2;if(e.arc(i,a,f,_-w/f,O,!0),e.arc(i,a,f,O,b+S/f,!0),S>0){const H=xs(T,P,i,a);e.arc(H.x,H.y,S,P+Math.PI,b-Nt)}const V=xs(N,b,i,a);if(e.lineTo(V.x,V.y),x>0){const H=xs(N,k,i,a);e.arc(H.x,H.y,x,b-Nt,k)}}else{e.moveTo(i,a);const D=Math.cos(k)*u+i,A=Math.sin(k)*u+a;e.lineTo(D,A);const O=Math.cos(M)*u+i,V=Math.sin(M)*u+a;e.lineTo(O,V)}e.closePath()}function l5(e,t,n,r,s){const{fullCircles:o,startAngle:i,circumference:a}=t;let l=t.endAngle;if(o){Ca(e,t,n,r,l,s);for(let c=0;c=lt&&g===0&&d!=="miter"&&s5(e,t,p),o||(Ca(e,t,n,r,p,s),e.stroke())}class Oo extends Lr{constructor(n){super();Pe(this,"circumference");Pe(this,"endAngle");Pe(this,"fullCircles");Pe(this,"innerRadius");Pe(this,"outerRadius");Pe(this,"pixelMargin");Pe(this,"startAngle");this.options=void 0,this.circumference=void 0,this.startAngle=void 0,this.endAngle=void 0,this.innerRadius=void 0,this.outerRadius=void 0,this.pixelMargin=0,this.fullCircles=0,n&&Object.assign(this,n)}inRange(n,r,s){const o=this.getProps(["x","y"],s),{angle:i,distance:a}=e0(o,{x:n,y:r}),{startAngle:l,endAngle:c,innerRadius:d,outerRadius:u,circumference:f}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],s),g=(this.options.spacing+this.options.borderWidth)/2,m=Xe(f,c-l),p=aa(i,l,c)&&l!==c,y=m>=Ct||p,b=Nr(a,d+g,u+g);return y&&b}getCenterPoint(n){const{x:r,y:s,startAngle:o,endAngle:i,innerRadius:a,outerRadius:l}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],n),{offset:c,spacing:d}=this.options,u=(o+i)/2,f=(a+l+d+c)/2;return{x:r+Math.cos(u)*f,y:s+Math.sin(u)*f}}tooltipPosition(n){return this.getCenterPoint(n)}draw(n){const{options:r,circumference:s}=this,o=(r.offset||0)/4,i=(r.spacing||0)/2,a=r.circular;if(this.pixelMargin=r.borderAlign==="inner"?.33:0,this.fullCircles=s>Ct?Math.floor(s/Ct):0,s===0||this.innerRadius<0||this.outerRadius<0)return;n.save();const l=(this.startAngle+this.endAngle)/2;n.translate(Math.cos(l)*o,Math.sin(l)*o);const c=1-Math.sin(Math.min(lt,s||0)),d=o*c;n.fillStyle=r.backgroundColor,n.strokeStyle=r.borderColor,l5(n,this,d,i,a),c5(n,this,d,i,a),n.restore()}}Pe(Oo,"id","arc"),Pe(Oo,"defaults",{borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0,selfJoin:!1}),Pe(Oo,"defaultRoutes",{backgroundColor:"backgroundColor"}),Pe(Oo,"descriptors",{_scriptable:!0,_indexable:n=>n!=="borderDash"});function gm(e,t){const{x:n,y:r,base:s,width:o,height:i}=e.getProps(["x","y","base","width","height"],t);let a,l,c,d,u;return e.horizontal?(u=i/2,a=Math.min(n,s),l=Math.max(n,s),c=r-u,d=r+u):(u=o/2,a=n-u,l=n+u,c=Math.min(r,s),d=Math.max(r,s)),{left:a,top:c,right:l,bottom:d}}function fr(e,t,n,r){return e?0:nn(t,n,r)}function d5(e,t,n){const r=e.options.borderWidth,s=e.borderSkipped,o=b0(r);return{t:fr(s.top,o.top,0,n),r:fr(s.right,o.right,0,t),b:fr(s.bottom,o.bottom,0,n),l:fr(s.left,o.left,0,t)}}function u5(e,t,n){const{enableBorderRadius:r}=e.getProps(["enableBorderRadius"]),s=e.options.borderRadius,o=gs(s),i=Math.min(t,n),a=e.borderSkipped,l=r||Ke(s);return{topLeft:fr(!l||a.top||a.left,o.topLeft,0,i),topRight:fr(!l||a.top||a.right,o.topRight,0,i),bottomLeft:fr(!l||a.bottom||a.left,o.bottomLeft,0,i),bottomRight:fr(!l||a.bottom||a.right,o.bottomRight,0,i)}}function f5(e){const t=gm(e),n=t.right-t.left,r=t.bottom-t.top,s=d5(e,n/2,r/2),o=u5(e,n/2,r/2);return{outer:{x:t.left,y:t.top,w:n,h:r,radius:o},inner:{x:t.left+s.l,y:t.top+s.t,w:n-s.l-s.r,h:r-s.t-s.b,radius:{topLeft:Math.max(0,o.topLeft-Math.max(s.t,s.l)),topRight:Math.max(0,o.topRight-Math.max(s.t,s.r)),bottomLeft:Math.max(0,o.bottomLeft-Math.max(s.b,s.l)),bottomRight:Math.max(0,o.bottomRight-Math.max(s.b,s.r))}}}}function yd(e,t,n,r){const s=t===null,o=n===null,a=e&&!(s&&o)&&gm(e,r);return a&&(s||Nr(t,a.left,a.right))&&(o||Nr(n,a.top,a.bottom))}function h5(e){return e.topLeft||e.topRight||e.bottomLeft||e.bottomRight}function g5(e,t){e.rect(t.x,t.y,t.w,t.h)}function vd(e,t,n={}){const r=e.x!==n.x?-t:0,s=e.y!==n.y?-t:0,o=(e.x+e.w!==n.x+n.w?t:0)-r,i=(e.y+e.h!==n.y+n.h?t:0)-s;return{x:e.x+r,y:e.y+s,w:e.w+o,h:e.h+i,radius:e.radius}}class Sa extends Lr{constructor(t){super(),this.options=void 0,this.horizontal=void 0,this.base=void 0,this.width=void 0,this.height=void 0,this.inflateAmount=void 0,t&&Object.assign(this,t)}draw(t){const{inflateAmount:n,options:{borderColor:r,backgroundColor:s}}=this,{inner:o,outer:i}=f5(this),a=h5(i.radius)?ca:g5;t.save(),(i.w!==o.w||i.h!==o.h)&&(t.beginPath(),a(t,vd(i,n,o)),t.clip(),a(t,vd(o,-n,i)),t.fillStyle=r,t.fill("evenodd")),t.beginPath(),a(t,vd(o,n)),t.fillStyle=s,t.fill(),t.restore()}inRange(t,n,r){return yd(this,t,n,r)}inXRange(t,n){return yd(this,t,null,n)}inYRange(t,n){return yd(this,null,t,n)}getCenterPoint(t){const{x:n,y:r,base:s,horizontal:o}=this.getProps(["x","y","base","horizontal"],t);return{x:o?(n+s)/2:n,y:o?r:(r+s)/2}}getRange(t){return t==="x"?this.width/2:this.height/2}}Pe(Sa,"id","bar"),Pe(Sa,"defaults",{borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0}),Pe(Sa,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"});const pm=(e,t)=>{let{boxHeight:n=t,boxWidth:r=t}=e;return e.usePointStyle&&(n=Math.min(n,t),r=e.pointStyleWidth||Math.min(r,t)),{boxWidth:r,boxHeight:n,itemHeight:Math.max(t,n)}},p5=(e,t)=>e!==null&&t!==null&&e.datasetIndex===t.datasetIndex&&e.index===t.index;class mm extends Lr{constructor(t){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,n,r){this.maxWidth=t,this.maxHeight=n,this._margins=r,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){const t=this.options.labels||{};let n=ut(t.generateLabels,[this.chart],this)||[];t.filter&&(n=n.filter(r=>t.filter(r,this.chart.data))),t.sort&&(n=n.sort((r,s)=>t.sort(r,s,this.chart.data))),this.options.reverse&&n.reverse(),this.legendItems=n}fit(){const{options:t,ctx:n}=this;if(!t.display){this.width=this.height=0;return}const r=t.labels,s=Wt(r.font),o=s.size,i=this._computeTitleHeight(),{boxWidth:a,itemHeight:l}=pm(r,o);let c,d;n.font=s.string,this.isHorizontal()?(c=this.maxWidth,d=this._fitRows(i,o,a,l)+10):(d=this.maxHeight,c=this._fitCols(i,s,a,l)+10),this.width=Math.min(c,t.maxWidth||this.maxWidth),this.height=Math.min(d,t.maxHeight||this.maxHeight)}_fitRows(t,n,r,s){const{ctx:o,maxWidth:i,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],c=this.lineWidths=[0],d=s+a;let u=t;o.textAlign="left",o.textBaseline="middle";let f=-1,g=-d;return this.legendItems.forEach((m,p)=>{const y=r+n/2+o.measureText(m.text).width;(p===0||c[c.length-1]+y+2*a>i)&&(u+=d,c[c.length-(p>0?0:1)]=0,g+=d,f++),l[p]={left:0,top:g,row:f,width:y,height:s},c[c.length-1]+=y+a}),u}_fitCols(t,n,r,s){const{ctx:o,maxHeight:i,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],c=this.columnSizes=[],d=i-t;let u=a,f=0,g=0,m=0,p=0;return this.legendItems.forEach((y,b)=>{const{itemWidth:_,itemHeight:x}=m5(r,n,o,y,s);b>0&&g+x+2*a>d&&(u+=f+a,c.push({width:f,height:g}),m+=f+a,p++,f=g=0),l[b]={left:m,top:g,col:p,width:_,height:x},f=Math.max(f,_),g+=x+a}),u+=f,c.push({width:f,height:g}),u}adjustHitBoxes(){if(!this.options.display)return;const t=this._computeTitleHeight(),{legendHitBoxes:n,options:{align:r,labels:{padding:s},rtl:o}}=this,i=bs(o,this.left,this.width);if(this.isHorizontal()){let a=0,l=jt(r,this.left+s,this.right-this.lineWidths[a]);for(const c of n)a!==c.row&&(a=c.row,l=jt(r,this.left+s,this.right-this.lineWidths[a])),c.top+=this.top+t+s,c.left=i.leftForLtr(i.x(l),c.width),l+=c.width+s}else{let a=0,l=jt(r,this.top+t+s,this.bottom-this.columnSizes[a].height);for(const c of n)c.col!==a&&(a=c.col,l=jt(r,this.top+t+s,this.bottom-this.columnSizes[a].height)),c.top=l,c.left+=this.left+s,c.left=i.leftForLtr(i.x(c.left),c.width),l+=c.height+s}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){const t=this.ctx;ed(t,this),this._draw(),td(t)}}_draw(){const{options:t,columnSizes:n,lineWidths:r,ctx:s}=this,{align:o,labels:i}=t,a=xt.color,l=bs(t.rtl,this.left,this.width),c=Wt(i.font),{padding:d}=i,u=c.size,f=u/2;let g;this.drawTitle(),s.textAlign=l.textAlign("left"),s.textBaseline="middle",s.lineWidth=.5,s.font=c.string;const{boxWidth:m,boxHeight:p,itemHeight:y}=pm(i,u),b=function(w,N,C){if(isNaN(m)||m<=0||isNaN(p)||p<0)return;s.save();const k=Xe(C.lineWidth,1);if(s.fillStyle=Xe(C.fillStyle,a),s.lineCap=Xe(C.lineCap,"butt"),s.lineDashOffset=Xe(C.lineDashOffset,0),s.lineJoin=Xe(C.lineJoin,"miter"),s.lineWidth=k,s.strokeStyle=Xe(C.strokeStyle,a),s.setLineDash(Xe(C.lineDash,[])),i.usePointStyle){const M={radius:p*Math.SQRT2/2,pointStyle:C.pointStyle,rotation:C.rotation,borderWidth:k},T=l.xPlus(w,m/2),L=N+f;p0(s,M,T,L,i.pointStyleWidth&&m)}else{const M=N+Math.max((u-p)/2,0),T=l.leftForLtr(w,m),L=gs(C.borderRadius);s.beginPath(),Object.values(L).some(P=>P!==0)?ca(s,{x:T,y:M,w:m,h:p,radius:L}):s.rect(T,M,m,p),s.fill(),k!==0&&s.stroke()}s.restore()},_=function(w,N,C){vo(s,C.text,w,N+y/2,c,{strikethrough:C.hidden,textAlign:l.textAlign(C.textAlign)})},x=this.isHorizontal(),E=this._computeTitleHeight();x?g={x:jt(o,this.left+d,this.right-r[0]),y:this.top+d+E,line:0}:g={x:this.left+d,y:jt(o,this.top+E+d,this.bottom-n[0].height),line:0},E0(this.ctx,t.textDirection);const S=y+d;this.legendItems.forEach((w,N)=>{s.strokeStyle=w.fontColor,s.fillStyle=w.fontColor;const C=s.measureText(w.text).width,k=l.textAlign(w.textAlign||(w.textAlign=i.textAlign)),M=m+f+C;let T=g.x,L=g.y;l.setWidth(this.width),x?N>0&&T+M+d>this.right&&(L=g.y+=S,g.line++,T=g.x=jt(o,this.left+d,this.right-r[g.line])):N>0&&L+S>this.bottom&&(T=g.x=T+n[g.line].width+d,g.line++,L=g.y=jt(o,this.top+E+d,this.bottom-n[g.line].height));const P=l.x(T);if(b(P,L,w),T=zM(k,T+m+f,x?T+M:this.right,t.rtl),_(l.x(T),L,w),x)g.x+=M+d;else if(typeof w.text!="string"){const F=c.lineHeight;g.y+=bm(w,F)+d}else g.y+=S}),M0(this.ctx,t.textDirection)}drawTitle(){const t=this.options,n=t.title,r=Wt(n.font),s=yn(n.padding);if(!n.display)return;const o=bs(t.rtl,this.left,this.width),i=this.ctx,a=n.position,l=r.size/2,c=s.top+l;let d,u=this.left,f=this.width;if(this.isHorizontal())f=Math.max(...this.lineWidths),d=this.top+c,u=jt(t.align,u,this.right-f);else{const m=this.columnSizes.reduce((p,y)=>Math.max(p,y.height),0);d=c+jt(t.align,this.top,this.bottom-m-t.labels.padding-this._computeTitleHeight())}const g=jt(a,u,u+f);i.textAlign=o.textAlign(qc(a)),i.textBaseline="middle",i.strokeStyle=n.color,i.fillStyle=n.color,i.font=r.string,vo(i,n.text,g,d,r)}_computeTitleHeight(){const t=this.options.title,n=Wt(t.font),r=yn(t.padding);return t.display?n.lineHeight+r.height:0}_getLegendItemAt(t,n){let r,s,o;if(Nr(t,this.left,this.right)&&Nr(n,this.top,this.bottom)){for(o=this.legendHitBoxes,r=0;ro.length>i.length?o:i)),t+n.size/2+r.measureText(s).width}function y5(e,t,n){let r=e;return typeof t.text!="string"&&(r=bm(t,n)),r}function bm(e,t){const n=e.text?e.text.length:0;return t*n}function v5(e,t){return!!((e==="mousemove"||e==="mouseout")&&(t.onHover||t.onLeave)||t.onClick&&(e==="click"||e==="mouseup"))}var ym={id:"legend",_element:mm,start(e,t,n){const r=e.legend=new mm({ctx:e.ctx,options:n,chart:e});vn.configure(e,r,n),vn.addBox(e,r)},stop(e){vn.removeBox(e,e.legend),delete e.legend},beforeUpdate(e,t,n){const r=e.legend;vn.configure(e,r,n),r.options=n},afterUpdate(e){const t=e.legend;t.buildLabels(),t.adjustHitBoxes()},afterEvent(e,t){t.replay||e.legend.handleEvent(t.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(e,t,n){const r=t.datasetIndex,s=n.chart;s.isDatasetVisible(r)?(s.hide(r),t.hidden=!0):(s.show(r),t.hidden=!1)},onHover:null,onLeave:null,labels:{color:e=>e.chart.options.color,boxWidth:40,padding:10,generateLabels(e){const t=e.data.datasets,{labels:{usePointStyle:n,pointStyle:r,textAlign:s,color:o,useBorderRadius:i,borderRadius:a}}=e.legend.options;return e._getSortedDatasetMetas().map(l=>{const c=l.controller.getStyle(n?0:void 0),d=yn(c.borderWidth);return{text:t[l.index].label,fillStyle:c.backgroundColor,fontColor:o,hidden:!l.visible,lineCap:c.borderCapStyle,lineDash:c.borderDash,lineDashOffset:c.borderDashOffset,lineJoin:c.borderJoinStyle,lineWidth:(d.width+d.height)/4,strokeStyle:c.borderColor,pointStyle:r||c.pointStyle,rotation:c.rotation,textAlign:s||c.textAlign,borderRadius:i&&(a||c.borderRadius),datasetIndex:l.index}},this)}},title:{color:e=>e.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:e=>!e.startsWith("on"),labels:{_scriptable:e=>!["generateLabels","filter","sort"].includes(e)}}};class vm extends Lr{constructor(t){super(),this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,n){const r=this.options;if(this.left=0,this.top=0,!r.display){this.width=this.height=this.right=this.bottom=0;return}this.width=this.right=t,this.height=this.bottom=n;const s=Mt(r.text)?r.text.length:1;this._padding=yn(r.padding);const o=s*Wt(r.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=o:this.width=o}isHorizontal(){const t=this.options.position;return t==="top"||t==="bottom"}_drawArgs(t){const{top:n,left:r,bottom:s,right:o,options:i}=this,a=i.align;let l=0,c,d,u;return this.isHorizontal()?(d=jt(a,r,o),u=n+t,c=o-r):(i.position==="left"?(d=r+t,u=jt(a,s,n),l=lt*-.5):(d=o-t,u=jt(a,n,s),l=lt*.5),c=s-n),{titleX:d,titleY:u,maxWidth:c,rotation:l}}draw(){const t=this.ctx,n=this.options;if(!n.display)return;const r=Wt(n.font),o=r.lineHeight/2+this._padding.top,{titleX:i,titleY:a,maxWidth:l,rotation:c}=this._drawArgs(o);vo(t,n.text,0,0,r,{color:n.color,maxWidth:l,rotation:c,textAlign:qc(n.align),textBaseline:"middle",translation:[i,a]})}}function x5(e,t){const n=new vm({ctx:e.ctx,options:t,chart:e});vn.configure(e,n,t),vn.addBox(e,n),e.titleBlock=n}var w5={id:"title",_element:vm,start(e,t,n){x5(e,n)},stop(e){const t=e.titleBlock;vn.removeBox(e,t),delete e.titleBlock},beforeUpdate(e,t,n){const r=e.titleBlock;vn.configure(e,r,n),r.options=n},defaults:{align:"center",display:!1,font:{weight:"bold"},fullSize:!0,padding:10,position:"top",text:"",weight:2e3},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const To={average(e){if(!e.length)return!1;let t,n,r=new Set,s=0,o=0;for(t=0,n=e.length;ta+l)/r.size,y:s/o}},nearest(e,t){if(!e.length)return!1;let n=t.x,r=t.y,s=Number.POSITIVE_INFINITY,o,i,a;for(o=0,i=e.length;oa({chart:t,initial:n.initial,numSteps:i,currentStep:Math.min(r-n.start,i)}))}_refresh(){this._request||(this._running=!0,this._request=z0.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let n=0;this._charts.forEach((r,s)=>{if(!r.running||!r.items.length)return;const o=r.items;let i=o.length-1,a=!1,l;for(;i>=0;--i)l=o[i],l._active?(l._total>r.duration&&(r.duration=l._total),l.tick(t),a=!0):(o[i]=o[o.length-1],o.pop());a&&(s.draw(),this._notify(s,r,t,"progress")),o.length||(r.running=!1,this._notify(s,r,t,"complete"),r.initial=!1),n+=o.length}),this._lastDate=t,n===0&&(this._running=!1)}_getAnims(t){const n=this._charts;let r=n.get(t);return r||(r={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},n.set(t,r)),r}listen(t,n,r){this._getAnims(t).listeners[n].push(r)}add(t,n){!n||!n.length||this._getAnims(t).items.push(...n)}has(t){return this._getAnims(t).items.length>0}start(t){const n=this._charts.get(t);n&&(n.running=!0,n.start=Date.now(),n.duration=n.items.reduce((r,s)=>Math.max(r,s._duration),0),this._refresh())}running(t){if(!this._running)return!1;const n=this._charts.get(t);return!(!n||!n.running||!n.items.length)}stop(t){const n=this._charts.get(t);if(!n||!n.items.length)return;const r=n.items;let s=r.length-1;for(;s>=0;--s)r[s].cancel();n.items=[],this._notify(t,n,Date.now(),"complete")}remove(t){return this._charts.delete(t)}}var sr=new MO;const lm="transparent",NO={boolean(e,t,n){return n>.5?t:e},color(e,t,n){const r=j0(e||lm),s=r.valid&&j0(t||lm);return s&&s.valid?s.mix(r,n).hexString():t},number(e,t,n){return e+(t-e)*n}};class OO{constructor(t,n,r,s){const o=n[r];s=_a([t.to,s,o,t.from]);const i=_a([t.from,o,s]);this._active=!0,this._fn=t.fn||NO[t.type||typeof i],this._easing=Do[t.easing]||Do.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=n,this._prop=r,this._from=i,this._to=s,this._promises=void 0}active(){return this._active}update(t,n,r){if(this._active){this._notify(!1);const s=this._target[this._prop],o=r-this._start,i=this._duration-o;this._start=r,this._duration=Math.floor(Math.max(i,t.duration)),this._total+=o,this._loop=!!t.loop,this._to=_a([t.to,n,s,t.from]),this._from=_a([t.from,s,n])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const n=t-this._start,r=this._duration,s=this._prop,o=this._from,i=this._loop,a=this._to;let l;if(this._active=o!==a&&(i||n1?2-l:l,l=this._easing(Math.min(1,Math.max(0,l))),this._target[s]=this._fn(o,a,l)}wait(){const t=this._promises||(this._promises=[]);return new Promise((n,r)=>{t.push({res:n,rej:r})})}_notify(t){const n=t?"res":"rej",r=this._promises||[];for(let s=0;s{const o=t[s];if(!Qe(o))return;const i={};for(const a of n)i[a]=o[a];(Dt(o.properties)&&o.properties||[s]).forEach(a=>{(a===s||!r.has(a))&&r.set(a,i)})})}_animateOptions(t,n){const r=n.options,s=AO(t,r);if(!s)return[];const o=this._createAnimations(s,r);return r.$shared&&TO(t.options.$animations,r).then(()=>{t.options=r},()=>{}),o}_createAnimations(t,n){const r=this._properties,s=[],o=t.$animations||(t.$animations={}),i=Object.keys(n),a=Date.now();let l;for(l=i.length-1;l>=0;--l){const c=i[l];if(c.charAt(0)==="$")continue;if(c==="options"){s.push(...this._animateOptions(t,n));continue}const d=n[c];let u=o[c];const f=r.get(c);if(u)if(f&&u.active()){u.update(f,d,a);continue}else u.cancel();if(!f||!f.duration){t[c]=d;continue}o[c]=u=new OO(f,t,c,d),s.push(u)}return s}update(t,n){if(this._properties.size===0){Object.assign(t,n);return}const r=this._createAnimations(t,n);if(r.length)return sr.add(this._chart,r),!0}}function TO(e,t){const n=[],r=Object.keys(t);for(let s=0;s0||!n&&o<0)return s.index}return null}function gm(e,t){const{chart:n,_cachedMeta:r}=e,s=n._stacks||(n._stacks={}),{iScale:o,vScale:i,index:a}=r,l=o.axis,c=i.axis,d=PO(o,i,r),u=t.length;let f;for(let g=0;gn[r].axis===t).shift()}function zO(e,t){return Os(e,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}function VO(e,t,n){return Os(e,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:n,index:t,mode:"default",type:"data"})}function Po(e,t){const n=e.controller.index,r=e.vScale&&e.vScale.axis;if(r){t=t||e._parsed;for(const s of t){const o=s._stacks;if(!o||o[r]===void 0||o[r][n]===void 0)return;delete o[r][n],o[r]._visualValues!==void 0&&o[r]._visualValues[n]!==void 0&&delete o[r]._visualValues[n]}}}const Dd=e=>e==="reset"||e==="none",pm=(e,t)=>t?e:Object.assign({},e),HO=(e,t,n)=>e&&!t.hidden&&t._stacked&&{keys:um(n,!0),values:null};class Ds{constructor(t,n){this.chart=t,this._ctx=t.ctx,this.index=n,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){const t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=Td(t.vScale,t),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(t){this.index!==t&&Po(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,n=this._cachedMeta,r=this.getDataset(),s=(u,f,g,m)=>u==="x"?f:u==="r"?m:g,o=n.xAxisID=Je(r.xAxisID,Ad(t,"x")),i=n.yAxisID=Je(r.yAxisID,Ad(t,"y")),a=n.rAxisID=Je(r.rAxisID,Ad(t,"r")),l=n.indexAxis,c=n.iAxisID=s(l,o,i,a),d=n.vAxisID=s(l,i,o,a);n.xScale=this.getScaleForId(o),n.yScale=this.getScaleForId(i),n.rScale=this.getScaleForId(a),n.iScale=this.getScaleForId(c),n.vScale=this.getScaleForId(d)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){const n=this._cachedMeta;return t===n.iScale?n.vScale:n.iScale}reset(){this._update("reset")}_destroy(){const t=this._cachedMeta;this._data&&$0(this._data,this),t._stacked&&Po(t)}_dataCheck(){const t=this.getDataset(),n=t.data||(t.data=[]),r=this._data;if(Qe(n)){const s=this._cachedMeta;this._data=LO(n,s)}else if(r!==n){if(r){$0(r,this);const s=this._cachedMeta;Po(s),s._parsed=[]}n&&Object.isExtensible(n)&&HN(n,this),this._syncList=[],this._data=n}}addElements(){const t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){const n=this._cachedMeta,r=this.getDataset();let s=!1;this._dataCheck();const o=n._stacked;n._stacked=Td(n.vScale,n),n.stack!==r.stack&&(s=!0,Po(n),n.stack=r.stack),this._resyncElements(t),(s||o!==n._stacked)&&(gm(this,n._parsed),n._stacked=Td(n.vScale,n))}configure(){const t=this.chart.config,n=t.datasetScopeKeys(this._type),r=t.getOptionScopes(this.getDataset(),n,!0);this.options=t.createResolver(r,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,n){const{_cachedMeta:r,_data:s}=this,{iScale:o,_stacked:i}=r,a=o.axis;let l=t===0&&n===s.length?!0:r._sorted,c=t>0&&r._parsed[t-1],d,u,f;if(this._parsing===!1)r._parsed=s,r._sorted=!0,f=s;else{Dt(s[t])?f=this.parseArrayData(r,s,t,n):Qe(s[t])?f=this.parseObjectData(r,s,t,n):f=this.parsePrimitiveData(r,s,t,n);const g=()=>u[a]===null||c&&u[a]p||u=0;--f)if(!m()){this.updateRangeFromParsed(c,t,g,l);break}}return c}getAllParsedValues(t){const n=this._cachedMeta._parsed,r=[];let s,o,i;for(s=0,o=n.length;s=0&&tthis.getContext(r,s,n),p=c.resolveNamedOptions(f,g,m,u);return p.$shared&&(p.$shared=l,o[i]=Object.freeze(pm(p,l))),p}_resolveAnimations(t,n,r){const s=this.chart,o=this._cachedDataOpts,i=`animation-${n}`,a=o[i];if(a)return a;let l;if(s.options.animation!==!1){const d=this.chart.config,u=d.datasetAnimationScopeKeys(this._type,n),f=d.getOptionScopes(this.getDataset(),u);l=d.createResolver(f,this.getContext(t,r,n))}const c=new cm(s,l&&l.animations);return l&&l._cacheable&&(o[i]=Object.freeze(c)),c}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,n){return!n||Dd(t)||this.chart._animationsDisabled}_getSharedOptions(t,n){const r=this.resolveDataElementOptions(t,n),s=this._sharedOptions,o=this.getSharedOptions(r),i=this.includeOptions(n,o)||o!==s;return this.updateSharedOptions(o,n,r),{sharedOptions:o,includeOptions:i}}updateElement(t,n,r,s){Dd(s)?Object.assign(t,r):this._resolveAnimations(n,s).update(t,r)}updateSharedOptions(t,n,r){t&&!Dd(n)&&this._resolveAnimations(void 0,n).update(t,r)}_setStyle(t,n,r,s){t.active=s;const o=this.getStyle(n,s);this._resolveAnimations(n,r,s).update(t,{options:!s&&this.getSharedOptions(o)||o})}removeHoverStyle(t,n,r){this._setStyle(t,r,"active",!1)}setHoverStyle(t,n,r){this._setStyle(t,r,"active",!0)}_removeDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){const n=this._data,r=this._cachedMeta.data;for(const[a,l,c]of this._syncList)this[a](l,c);this._syncList=[];const s=r.length,o=n.length,i=Math.min(o,s);i&&this.parse(0,i),o>s?this._insertElements(s,o-s,t):o{for(c.length+=n,a=c.length-1;a>=i;a--)c[a]=c[a-n]};for(l(o),a=t;as-o))}return e._cache.$bar}function BO(e){const t=e.iScale,n=UO(t,e.type);let r=t._length,s,o,i,a;const l=()=>{i===32767||i===-32768||(Ao(a)&&(r=Math.min(r,Math.abs(i-a)||r)),a=i)};for(s=0,o=n.length;s0?s[e-1]:null,a=eMath.abs(a)&&(l=a,c=i),t[n.axis]=c,t._custom={barStart:l,barEnd:c,start:s,end:o,min:i,max:a}}function mm(e,t,n,r){return Dt(e)?GO(e,t,n,r):t[n.axis]=n.parse(e,r),t}function bm(e,t,n,r){const s=e.iScale,o=e.vScale,i=s.getLabels(),a=s===o,l=[];let c,d,u,f;for(c=n,d=n+r;c=n?1:-1)}function KO(e){let t,n,r,s,o;return e.horizontal?(t=e.base>e.x,n="left",r="right"):(t=e.based.controller.options.grouped),o=r.options.stacked,i=[],a=this._cachedMeta.controller.getParsed(n),l=a&&a[r.axis],c=d=>{const u=d._parsed.find(g=>g[r.axis]===l),f=u&&u[d.vScale.axis];if(ft(f)||isNaN(f))return!0};for(const d of s)if(!(n!==void 0&&c(d))&&((o===!1||i.indexOf(d.stack)===-1||o===void 0&&d.stack===void 0)&&i.push(d.stack),d.index===t))break;return i.length||i.push(void 0),i}_getStackCount(t){return this._getStacks(void 0,t).length}_getAxisCount(){return this._getAxis().length}getFirstScaleIdForIndexAxis(){const t=this.chart.scales,n=this.chart.options.indexAxis;return Object.keys(t).filter(r=>t[r].axis===n).shift()}_getAxis(){const t={},n=this.getFirstScaleIdForIndexAxis();for(const r of this.chart.data.datasets)t[Je(this.chart.options.indexAxis==="x"?r.xAxisID:r.yAxisID,n)]=!0;return Object.keys(t)}_getStackIndex(t,n,r){const s=this._getStacks(t,r),o=n!==void 0?s.indexOf(n):-1;return o===-1?s.length-1:o}_getRuler(){const t=this.options,n=this._cachedMeta,r=n.iScale,s=[];let o,i;for(o=0,i=n.data.length;oka(x,a,l,!0)?1:Math.max(M,M*n,S,S*n),m=(x,M,S)=>ka(x,a,l,!0)?-1:Math.min(M,M*n,S,S*n),p=g(0,c,u),y=g(It,d,f),b=m(ht,c,u),_=m(ht+It,d,f);r=(p-b)/2,s=(y-_)/2,o=-(p+b)/2,i=-(y+_)/2}return{ratioX:r,ratioY:s,offsetX:o,offsetY:i}}class $o extends Ds{constructor(t,n){super(t,n),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(t,n){const r=this.getDataset().data,s=this._cachedMeta;if(this._parsing===!1)s._parsed=r;else{let o=l=>+r[l];if(Qe(r[t])){const{key:l="value"}=this._parsing;o=c=>+zr(r[c],l)}let i,a;for(i=t,a=t+n;i0&&!isNaN(t)?Ot*(Math.abs(t)/n):0}getLabelAndValue(t){const n=this._cachedMeta,r=this.chart,s=r.data.labels||[],o=vd(n._parsed[t],r.options.locale);return{label:s[t]||"",value:o}}getMaxBorderWidth(t){let n=0;const r=this.chart;let s,o,i,a,l;if(!t){for(s=0,o=r.data.datasets.length;st!=="spacing",_indexable:t=>t!=="spacing"&&!t.startsWith("borderDash")&&!t.startsWith("hoverBorderDash")}),$e($o,"overrides",{aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const n=t.data,{labels:{pointStyle:r,textAlign:s,color:o,useBorderRadius:i,borderRadius:a}}=t.legend.options;return n.labels.length&&n.datasets.length?n.labels.map((l,c)=>{const u=t.getDatasetMeta(0).controller.getStyle(c);return{text:l,fillStyle:u.backgroundColor,fontColor:o,hidden:!t.getDataVisibility(c),lineDash:u.borderDash,lineDashOffset:u.borderDashOffset,lineJoin:u.borderJoinStyle,lineWidth:u.borderWidth,strokeStyle:u.borderColor,textAlign:s,pointStyle:r,borderRadius:i&&(a||u.borderRadius),index:c}}):[]}},onClick(t,n,r){r.chart.toggleDataVisibility(n.index),r.chart.update()}}}});function Gr(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class Ld{constructor(t){$e(this,"options");this.options=t||{}}static override(t){Object.assign(Ld.prototype,t)}init(){}formats(){return Gr()}parse(){return Gr()}format(){return Gr()}add(){return Gr()}diff(){return Gr()}startOf(){return Gr()}endOf(){return Gr()}}var JO={_date:Ld};function RO(e,t,n,r){const{controller:s,data:o,_sorted:i}=e,a=s._cachedMeta.iScale,l=e.dataset&&e.dataset.options?e.dataset.options.spanGaps:null;if(a&&t===a.axis&&t!=="r"&&i&&o.length){const c=a._reversePixels?zN:md;if(r){if(s._sharedOptions){const d=o[0],u=typeof d.getRange=="function"&&d.getRange(t);if(u){const f=c(o,t,n-u),g=c(o,t,n+u);return{lo:f.lo,hi:g.hi}}}}else{const d=c(o,t,n);if(l){const{vScale:u}=s._cachedMeta,{_parsed:f}=e,g=f.slice(0,d.lo+1).reverse().findIndex(p=>!ft(p[u.axis]));d.lo-=Math.max(0,g);const m=f.slice(d.hi).findIndex(p=>!ft(p[u.axis]));d.hi+=Math.max(0,m)}return d}}return{lo:0,hi:o.length-1}}function Ta(e,t,n,r,s){const o=e.getSortedVisibleDatasetMetas(),i=n[t];for(let a=0,l=o.length;a{l[i]&&l[i](t[n],s)&&(o.push({element:l,datasetIndex:c,index:d}),a=a||l.inRange(t.x,t.y,s))}),r&&!a?[]:o}var rT={modes:{index(e,t,n,r){const s=Wr(t,e),o=n.axis||"x",i=n.includeInvisible||!1,a=n.intersect?Pd(e,s,o,r,i):$d(e,s,o,!1,r,i),l=[];return a.length?(e.getSortedVisibleDatasetMetas().forEach(c=>{const d=a[0].index,u=c.data[d];u&&!u.skip&&l.push({element:u,datasetIndex:c.index,index:d})}),l):[]},dataset(e,t,n,r){const s=Wr(t,e),o=n.axis||"xy",i=n.includeInvisible||!1;let a=n.intersect?Pd(e,s,o,r,i):$d(e,s,o,!1,r,i);if(a.length>0){const l=a[0].datasetIndex,c=e.getDatasetMeta(l).data;a=[];for(let d=0;dn.pos===t)}function km(e,t){return e.filter(n=>wm.indexOf(n.pos)===-1&&n.box.axis===t)}function zo(e,t){return e.sort((n,r)=>{const s=t?r:n,o=t?n:r;return s.weight===o.weight?s.index-o.index:s.weight-o.weight})}function sT(e){const t=[];let n,r,s,o,i,a;for(n=0,r=(e||[]).length;nc.box.fullSize),!0),r=zo(Fo(t,"left"),!0),s=zo(Fo(t,"right")),o=zo(Fo(t,"top"),!0),i=zo(Fo(t,"bottom")),a=km(t,"x"),l=km(t,"y");return{fullSize:n,leftAndTop:r.concat(o),rightAndBottom:s.concat(l).concat(i).concat(a),chartArea:Fo(t,"chartArea"),vertical:r.concat(s).concat(l),horizontal:o.concat(i).concat(a)}}function Cm(e,t,n,r){return Math.max(e[n],t[n])+Math.max(e[r],t[r])}function Sm(e,t){e.top=Math.max(e.top,t.top),e.left=Math.max(e.left,t.left),e.bottom=Math.max(e.bottom,t.bottom),e.right=Math.max(e.right,t.right)}function lT(e,t,n,r){const{pos:s,box:o}=n,i=e.maxPadding;if(!Qe(s)){n.size&&(e[s]-=n.size);const u=r[n.stack]||{size:0,count:1};u.size=Math.max(u.size,n.horizontal?o.height:o.width),n.size=u.size/u.count,e[s]+=n.size}o.getPadding&&Sm(i,o.getPadding());const a=Math.max(0,t.outerWidth-Cm(i,e,"left","right")),l=Math.max(0,t.outerHeight-Cm(i,e,"top","bottom")),c=a!==e.w,d=l!==e.h;return e.w=a,e.h=l,n.horizontal?{same:c,other:d}:{same:d,other:c}}function cT(e){const t=e.maxPadding;function n(r){const s=Math.max(t[r]-e[r],0);return e[r]+=s,s}e.y+=n("top"),e.x+=n("left"),n("right"),n("bottom")}function dT(e,t){const n=t.maxPadding;function r(s){const o={left:0,top:0,right:0,bottom:0};return s.forEach(i=>{o[i]=Math.max(t[i],n[i])}),o}return r(e?["left","right"]:["top","bottom"])}function Vo(e,t,n,r){const s=[];let o,i,a,l,c,d;for(o=0,i=e.length,c=0;o{typeof p.beforeLayout=="function"&&p.beforeLayout()});const d=l.reduce((p,y)=>y.box.options&&y.box.options.display===!1?p:p+1,0)||1,u=Object.freeze({outerWidth:t,outerHeight:n,padding:s,availableWidth:o,availableHeight:i,vBoxMaxWidth:o/2/d,hBoxMaxHeight:i/2}),f=Object.assign({},s);Sm(f,_n(r));const g=Object.assign({maxPadding:f,w:o,h:i,x:s.left,y:s.top},s),m=iT(l.concat(c),u);Vo(a.fullSize,g,u,m),Vo(l,g,u,m),Vo(c,g,u,m)&&Vo(l,g,u,m),cT(g),_m(a.leftAndTop,g,u,m),g.x+=g.w,g.y+=g.h,_m(a.rightAndBottom,g,u,m),e.chartArea={left:g.left,top:g.top,right:g.left+g.w,bottom:g.top+g.h,height:g.h,width:g.w},at(a.chartArea,p=>{const y=p.box;Object.assign(y,e.chartArea),y.update(g.w,g.h,{left:0,top:0,right:0,bottom:0})})}};class Em{acquireContext(t,n){}releaseContext(t){return!1}addEventListener(t,n,r){}removeEventListener(t,n,r){}getDevicePixelRatio(){return 1}getMaximumSize(t,n,r,s){return n=Math.max(0,n||t.width),r=r||t.height,{width:n,height:Math.max(0,s?Math.floor(n/s):r)}}isAttached(t){return!0}updateConfig(t){}}class uT extends Em{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const Da="$chartjs",fT={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},Mm=e=>e===null||e==="";function hT(e,t){const n=e.style,r=e.getAttribute("height"),s=e.getAttribute("width");if(e[Da]={initial:{height:r,width:s,style:{display:n.display,height:n.height,width:n.width}}},n.display=n.display||"block",n.boxSizing=n.boxSizing||"border-box",Mm(s)){const o=om(e,"width");o!==void 0&&(e.width=o)}if(Mm(r))if(e.style.height==="")e.height=e.width/(t||2);else{const o=om(e,"height");o!==void 0&&(e.height=o)}return e}const Nm=kO?{passive:!0}:!1;function gT(e,t,n){e&&e.addEventListener(t,n,Nm)}function pT(e,t,n){e&&e.canvas&&e.canvas.removeEventListener(t,n,Nm)}function mT(e,t){const n=fT[e.type]||e.type,{x:r,y:s}=Wr(e,t);return{type:n,chart:t,native:e,x:r!==void 0?r:null,y:s!==void 0?s:null}}function Ia(e,t){for(const n of e)if(n===t||n.contains(t))return!0}function bT(e,t,n){const r=e.canvas,s=new MutationObserver(o=>{let i=!1;for(const a of o)i=i||Ia(a.addedNodes,r),i=i&&!Ia(a.removedNodes,r);i&&n()});return s.observe(document,{childList:!0,subtree:!0}),s}function yT(e,t,n){const r=e.canvas,s=new MutationObserver(o=>{let i=!1;for(const a of o)i=i||Ia(a.removedNodes,r),i=i&&!Ia(a.addedNodes,r);i&&n()});return s.observe(document,{childList:!0,subtree:!0}),s}const Ho=new Map;let Om=0;function Tm(){const e=window.devicePixelRatio;e!==Om&&(Om=e,Ho.forEach((t,n)=>{n.currentDevicePixelRatio!==e&&t()}))}function vT(e,t){Ho.size||window.addEventListener("resize",Tm),Ho.set(e,t)}function xT(e){Ho.delete(e),Ho.size||window.removeEventListener("resize",Tm)}function wT(e,t,n){const r=e.canvas,s=r&&Od(r);if(!s)return;const o=V0((a,l)=>{const c=s.clientWidth;n(a,l),c{const l=a[0],c=l.contentRect.width,d=l.contentRect.height;c===0&&d===0||o(c,d)});return i.observe(s),vT(e,o),i}function Fd(e,t,n){n&&n.disconnect(),t==="resize"&&xT(e)}function kT(e,t,n){const r=e.canvas,s=V0(o=>{e.ctx!==null&&n(mT(o,e))},e);return gT(r,t,s),s}class CT extends Em{acquireContext(t,n){const r=t&&t.getContext&&t.getContext("2d");return r&&r.canvas===t?(hT(t,n),r):null}releaseContext(t){const n=t.canvas;if(!n[Da])return!1;const r=n[Da].initial;["height","width"].forEach(o=>{const i=r[o];ft(i)?n.removeAttribute(o):n.setAttribute(o,i)});const s=r.style||{};return Object.keys(s).forEach(o=>{n.style[o]=s[o]}),n.width=n.width,delete n[Da],!0}addEventListener(t,n,r){this.removeEventListener(t,n);const s=t.$proxies||(t.$proxies={}),i={attach:bT,detach:yT,resize:wT}[n]||kT;s[n]=i(t,n,r)}removeEventListener(t,n){const r=t.$proxies||(t.$proxies={}),s=r[n];if(!s)return;({attach:Fd,detach:Fd,resize:Fd}[n]||pT)(t,n,s),r[n]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,n,r,s){return wO(t,n,r,s)}isAttached(t){const n=t&&Od(t);return!!(n&&n.isConnected)}}function ST(e){return!Nd()||typeof OffscreenCanvas<"u"&&e instanceof OffscreenCanvas?uT:CT}let Yr=(Xa=class{constructor(){$e(this,"x");$e(this,"y");$e(this,"active",!1);$e(this,"options");$e(this,"$animations")}tooltipPosition(t){const{x:n,y:r}=this.getProps(["x","y"],t);return{x:n,y:r}}hasValue(){return wa(this.x)&&wa(this.y)}getProps(t,n){const r=this.$animations;if(!n||!r)return this;const s={};return t.forEach(o=>{s[o]=r[o]&&r[o].active()?r[o]._to:this[o]}),s}},$e(Xa,"defaults",{}),$e(Xa,"defaultRoutes"),Xa);function _T(e,t){const n=e.options.ticks,r=ET(e),s=Math.min(n.maxTicksLimit||r,r),o=n.major.enabled?NT(t):[],i=o.length,a=o[0],l=o[i-1],c=[];if(i>s)return OT(t,c,o,i/s),c;const d=MT(o,t,s);if(i>0){let u,f;const g=i>1?Math.round((l-a)/(i-1)):null;for(La(t,c,d,ft(g)?0:a-g,a),u=0,f=i-1;us)return l}return Math.max(s,1)}function NT(e){const t=[];let n,r;for(n=0,r=e.length;ne==="left"?"right":e==="right"?"left":e,Am=(e,t,n)=>t==="top"||t==="left"?e[t]+n:e[t]-n,Dm=(e,t)=>Math.min(t||e,e);function Im(e,t){const n=[],r=e.length/t,s=e.length;let o=0;for(;oi+a)))return l}function IT(e,t){at(e,n=>{const r=n.gc,s=r.length/2;let o;if(s>t){for(o=0;or?r:n,r=s&&n>r?n:r,{min:Yn(n,Yn(r,n)),max:Yn(r,Yn(n,r))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}getLabelItems(t=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(t))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){bt(this.options.beforeUpdate,[this])}update(t,n,r){const{beginAtZero:s,grace:o,ticks:i}=this.options,a=i.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=n,this._margins=r=Object.assign({left:0,right:0,top:0,bottom:0},r),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+r.left+r.right:this.height+r.top+r.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=iO(this,o,s),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const l=a=o||r<=1||!this.isHorizontal()){this.labelRotation=s;return}const d=this._getLabelSizes(),u=d.widest.width,f=d.highest.height,g=cn(this.chart.width-u,0,this.maxWidth);a=t.offset?this.maxWidth/r:g/(r-1),u+6>a&&(a=g/(r-(t.offset?.5:1)),l=this.maxHeight-Uo(t.grid)-n.padding-Lm(t.title,this.chart.options.font),c=Math.sqrt(u*u+f*f),i=PN(Math.min(Math.asin(cn((d.highest.height+6)/a,-1,1)),Math.asin(cn(l/c,-1,1))-Math.asin(cn(f/c,-1,1)))),i=Math.max(s,Math.min(o,i))),this.labelRotation=i}afterCalculateLabelRotation(){bt(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){bt(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:n,options:{ticks:r,title:s,grid:o}}=this,i=this._isVisible(),a=this.isHorizontal();if(i){const l=Lm(s,n.options.font);if(a?(t.width=this.maxWidth,t.height=Uo(o)+l):(t.height=this.maxHeight,t.width=Uo(o)+l),r.display&&this.ticks.length){const{first:c,last:d,widest:u,highest:f}=this._getLabelSizes(),g=r.padding*2,m=rr(this.labelRotation),p=Math.cos(m),y=Math.sin(m);if(a){const b=r.mirror?0:y*u.width+p*f.height;t.height=Math.min(this.maxHeight,t.height+b+g)}else{const b=r.mirror?0:p*u.width+y*f.height;t.width=Math.min(this.maxWidth,t.width+b+g)}this._calculatePadding(c,d,y,p)}}this._handleMargins(),a?(this.width=this._length=n.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=n.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,n,r,s){const{ticks:{align:o,padding:i},position:a}=this.options,l=this.labelRotation!==0,c=a!=="top"&&this.axis==="x";if(this.isHorizontal()){const d=this.getPixelForTick(0)-this.left,u=this.right-this.getPixelForTick(this.ticks.length-1);let f=0,g=0;l?c?(f=s*t.width,g=r*n.height):(f=r*t.height,g=s*n.width):o==="start"?g=n.width:o==="end"?f=t.width:o!=="inner"&&(f=t.width/2,g=n.width/2),this.paddingLeft=Math.max((f-d+i)*this.width/(this.width-d),0),this.paddingRight=Math.max((g-u+i)*this.width/(this.width-u),0)}else{let d=n.height/2,u=t.height/2;o==="start"?(d=0,u=t.height):o==="end"&&(d=n.height,u=0),this.paddingTop=d+i,this.paddingBottom=u+i}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){bt(this.options.afterFit,[this])}isHorizontal(){const{axis:t,position:n}=this.options;return n==="top"||n==="bottom"||t==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){this.beforeTickToLabelConversion(),this.generateTickLabels(t);let n,r;for(n=0,r=t.length;n({width:i[w]||0,height:a[w]||0});return{first:C(0),last:C(n-1),widest:C(k),highest:C(N),widths:i,heights:a}}getLabelForValue(t){return t}getPixelForValue(t,n){return NaN}getValueForPixel(t){}getPixelForTick(t){const n=this.ticks;return t<0||t>n.length-1?null:this.getPixelForValue(n[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);const n=this._startPixel+t*this._length;return FN(this._alignToPixels?Br(this.chart,n,0):n)}getDecimalForPixel(t){const n=(t-this._startPixel)/this._length;return this._reversePixels?1-n:n}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:t,max:n}=this;return t<0&&n<0?n:t>0&&n>0?t:0}getContext(t){const n=this.ticks||[];if(t>=0&&ta*s?a/r:l/s:l*s0}_computeGridLineItems(t){const n=this.axis,r=this.chart,s=this.options,{grid:o,position:i,border:a}=s,l=o.offset,c=this.isHorizontal(),u=this.ticks.length+(l?1:0),f=Uo(o),g=[],m=a.setContext(this.getContext()),p=m.display?m.width:0,y=p/2,b=function(D){return Br(r,D,p)};let _,x,M,S,k,N,C,w,E,T,P,L;if(i==="top")_=b(this.bottom),N=this.bottom-f,w=_-y,T=b(t.top)+y,L=t.bottom;else if(i==="bottom")_=b(this.top),T=t.top,L=b(t.bottom)-y,N=_+y,w=this.top+f;else if(i==="left")_=b(this.right),k=this.right-f,C=_-y,E=b(t.left)+y,P=t.right;else if(i==="right")_=b(this.left),E=t.left,P=b(t.right)-y,k=_+y,C=this.left+f;else if(n==="x"){if(i==="center")_=b((t.top+t.bottom)/2+.5);else if(Qe(i)){const D=Object.keys(i)[0],O=i[D];_=b(this.chart.scales[D].getPixelForValue(O))}T=t.top,L=t.bottom,N=_+y,w=N+f}else if(n==="y"){if(i==="center")_=b((t.left+t.right)/2);else if(Qe(i)){const D=Object.keys(i)[0],O=i[D];_=b(this.chart.scales[D].getPixelForValue(O))}k=_-y,C=k-f,E=t.left,P=t.right}const F=Je(s.ticks.maxTicksLimit,u),A=Math.max(1,Math.ceil(u/F));for(x=0;x0&&(X-=G/2);break}Y={left:X,top:V,width:G+B.width,height:W+B.height,color:A.backdropColor}}y.push({label:M,font:w,textOffset:P,options:{rotation:p,color:O,strokeColor:z,strokeWidth:U,textAlign:j,textBaseline:L,translation:[S,k],backdrop:Y}})}return y}_getXAxisLabelAlignment(){const{position:t,ticks:n}=this.options;if(-rr(this.labelRotation))return t==="top"?"left":"right";let s="center";return n.align==="start"?s="left":n.align==="end"?s="right":n.align==="inner"&&(s="inner"),s}_getYAxisLabelAlignment(t){const{position:n,ticks:{crossAlign:r,mirror:s,padding:o}}=this.options,i=this._getLabelSizes(),a=t+o,l=i.widest.width;let c,d;return n==="left"?s?(d=this.right+o,r==="near"?c="left":r==="center"?(c="center",d+=l/2):(c="right",d+=l)):(d=this.right-a,r==="near"?c="right":r==="center"?(c="center",d-=l/2):(c="left",d=this.left)):n==="right"?s?(d=this.left+o,r==="near"?c="right":r==="center"?(c="center",d-=l/2):(c="left",d-=l)):(d=this.left+a,r==="near"?c="left":r==="center"?(c="center",d+=l/2):(c="right",d=this.right)):c="right",{textAlign:c,x:d}}_computeLabelArea(){if(this.options.ticks.mirror)return;const t=this.chart,n=this.options.position;if(n==="left"||n==="right")return{top:0,left:this.left,bottom:t.height,right:this.right};if(n==="top"||n==="bottom")return{top:this.top,left:0,bottom:this.bottom,right:t.width}}drawBackground(){const{ctx:t,options:{backgroundColor:n},left:r,top:s,width:o,height:i}=this;n&&(t.save(),t.fillStyle=n,t.fillRect(r,s,o,i),t.restore())}getLineWidthForValue(t){const n=this.options.grid;if(!this._isVisible()||!n.display)return 0;const s=this.ticks.findIndex(o=>o.value===t);return s>=0?n.setContext(this.getContext(s)).lineWidth:0}drawGrid(t){const n=this.options.grid,r=this.ctx,s=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let o,i;const a=(l,c,d)=>{!d.width||!d.color||(r.save(),r.lineWidth=d.width,r.strokeStyle=d.color,r.setLineDash(d.borderDash||[]),r.lineDashOffset=d.borderDashOffset,r.beginPath(),r.moveTo(l.x,l.y),r.lineTo(c.x,c.y),r.stroke(),r.restore())};if(n.display)for(o=0,i=s.length;o{this.draw(o)}}]:[{z:r,draw:o=>{this.drawBackground(),this.drawGrid(o),this.drawTitle()}},{z:s,draw:()=>{this.drawBorder()}},{z:n,draw:o=>{this.drawLabels(o)}}]}getMatchingVisibleMetas(t){const n=this.chart.getSortedVisibleDatasetMetas(),r=this.axis+"AxisID",s=[];let o,i;for(o=0,i=n.length;o{const r=n.split("."),s=r.pop(),o=[e].concat(r).join("."),i=t[n].split("."),a=i.pop(),l=i.join(".");_t.route(o,s,l,a)})}function HT(e){return"id"in e&&"defaults"in e}class UT{constructor(){this.controllers=new Pa(Ds,"datasets",!0),this.elements=new Pa(Yr,"elements"),this.plugins=new Pa(Object,"plugins"),this.scales=new Pa(Is,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,n,r){[...n].forEach(s=>{const o=r||this._getRegistryForType(s);r||o.isForType(s)||o===this.plugins&&s.id?this._exec(t,o,s):at(s,i=>{const a=r||this._getRegistryForType(i);this._exec(t,a,i)})})}_exec(t,n,r){const s=gd(t);bt(r["before"+s],[],r),n[t](r),bt(r["after"+s],[],r)}_getRegistryForType(t){for(let n=0;no.filter(a=>!i.some(l=>a.plugin.id===l.plugin.id));this._notify(s(n,r),t,"stop"),this._notify(s(r,n),t,"start")}}function jT(e){const t={},n=[],r=Object.keys(Xn.plugins.items);for(let o=0;o1&&Pm(e[0].toLowerCase());if(r)return r}throw new Error(`Cannot determine type of '${e}' axis. Please provide 'axis' or 'position' option.`)}function $m(e,t,n){if(n[t+"AxisID"]===e)return{axis:t}}function ZT(e,t){if(t.data&&t.data.datasets){const n=t.data.datasets.filter(r=>r.xAxisID===e||r.yAxisID===e);if(n.length)return $m(e,"x",n[0])||$m(e,"y",n[0])}return{}}function QT(e,t){const n=Ur[e.type]||{scales:{}},r=t.scales||{},s=zd(e.type,t),o=Object.create(null);return Object.keys(r).forEach(i=>{const a=r[i];if(!Qe(a))return console.error(`Invalid scale configuration for scale: ${i}`);if(a._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${i}`);const l=Vd(i,a,ZT(i,e),_t.scales[a.type]),c=XT(l,s),d=n.scales||{};o[i]=To(Object.create(null),[{axis:l},a,d[l],d[c]])}),e.data.datasets.forEach(i=>{const a=i.type||e.type,l=i.indexAxis||zd(a,t),d=(Ur[a]||{}).scales||{};Object.keys(d).forEach(u=>{const f=KT(u,l),g=i[f+"AxisID"]||f;o[g]=o[g]||Object.create(null),To(o[g],[{axis:f},r[g],d[u]])})}),Object.keys(o).forEach(i=>{const a=o[i];To(a,[_t.scales[a.type],_t.scale])}),o}function Fm(e){const t=e.options||(e.options={});t.plugins=Je(t.plugins,{}),t.scales=QT(e,t)}function zm(e){return e=e||{},e.datasets=e.datasets||[],e.labels=e.labels||[],e}function JT(e){return e=e||{},e.data=zm(e.data),Fm(e),e}const Vm=new Map,Hm=new Set;function $a(e,t){let n=Vm.get(e);return n||(n=t(),Vm.set(e,n),Hm.add(n)),n}const Bo=(e,t,n)=>{const r=zr(t,n);r!==void 0&&e.add(r)};class RT{constructor(t){this._config=JT(t),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(t){this._config.type=t}get data(){return this._config.data}set data(t){this._config.data=zm(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){const t=this._config;this.clearCache(),Fm(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return $a(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,n){return $a(`${t}.transition.${n}`,()=>[[`datasets.${t}.transitions.${n}`,`transitions.${n}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,n){return $a(`${t}-${n}`,()=>[[`datasets.${t}.elements.${n}`,`datasets.${t}`,`elements.${n}`,""]])}pluginScopeKeys(t){const n=t.id,r=this.type;return $a(`${r}-plugin-${n}`,()=>[[`plugins.${n}`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,n){const r=this._scopeCache;let s=r.get(t);return(!s||n)&&(s=new Map,r.set(t,s)),s}getOptionScopes(t,n,r){const{options:s,type:o}=this,i=this._cachedScopes(t,r),a=i.get(n);if(a)return a;const l=new Set;n.forEach(d=>{t&&(l.add(t),d.forEach(u=>Bo(l,t,u))),d.forEach(u=>Bo(l,s,u)),d.forEach(u=>Bo(l,Ur[o]||{},u)),d.forEach(u=>Bo(l,_t,u)),d.forEach(u=>Bo(l,xd,u))});const c=Array.from(l);return c.length===0&&c.push(Object.create(null)),Hm.has(n)&&i.set(n,c),c}chartOptionScopes(){const{options:t,type:n}=this;return[t,Ur[n]||{},_t.datasets[n]||{},{type:n},_t,xd]}resolveNamedOptions(t,n,r,s=[""]){const o={$shared:!0},{resolver:i,subPrefixes:a}=Um(this._resolverCache,t,s);let l=i;if(t5(i,n)){o.$shared=!1,r=vr(r)?r():r;const c=this.createResolver(t,r,a);l=Ts(i,r,c)}for(const c of n)o[c]=l[c];return o}createResolver(t,n,r=[""],s){const{resolver:o}=Um(this._resolverCache,t,r);return Qe(n)?Ts(o,n,void 0,s):o}}function Um(e,t,n){let r=e.get(t);r||(r=new Map,e.set(t,r));const s=n.join();let o=r.get(s);return o||(o={resolver:_d(t,n),subPrefixes:n.filter(a=>!a.toLowerCase().includes("hover"))},r.set(s,o)),o}const e5=e=>Qe(e)&&Object.getOwnPropertyNames(e).some(t=>vr(e[t]));function t5(e,t){const{isScriptable:n,isIndexable:r}=J0(e);for(const s of t){const o=n(s),i=r(s),a=(i||o)&&e[s];if(o&&(vr(a)||e5(a))||i&&Dt(a))return!0}return!1}var n5="4.5.1";const r5=["top","bottom","left","right","chartArea"];function Bm(e,t){return e==="top"||e==="bottom"||r5.indexOf(e)===-1&&t==="x"}function jm(e,t){return function(n,r){return n[e]===r[e]?n[t]-r[t]:n[e]-r[e]}}function Wm(e){const t=e.chart,n=t.options.animation;t.notifyPlugins("afterRender"),bt(n&&n.onComplete,[e],t)}function s5(e){const t=e.chart,n=t.options.animation;bt(n&&n.onProgress,[e],t)}function Gm(e){return Nd()&&typeof e=="string"?e=document.getElementById(e):e&&e.length&&(e=e[0]),e&&e.canvas&&(e=e.canvas),e}const Fa={},Ym=e=>{const t=Gm(e);return Object.values(Fa).filter(n=>n.canvas===t).pop()};function o5(e,t,n){const r=Object.keys(e);for(const s of r){const o=+s;if(o>=t){const i=e[s];delete e[s],(n>0||o>t)&&(e[o+n]=i)}}}function i5(e,t,n,r){return!n||e.type==="mouseout"?null:r?t:e}let jo=(Cr=class{static register(...t){Xn.add(...t),Km()}static unregister(...t){Xn.remove(...t),Km()}constructor(t,n){const r=this.config=new RT(n),s=Gm(t),o=Ym(s);if(o)throw new Error("Canvas is already in use. Chart with ID '"+o.id+"' must be destroyed before the canvas with ID '"+o.canvas.id+"' can be reused.");const i=r.createResolver(r.chartOptionScopes(),this.getContext());this.platform=new(r.platform||ST(s)),this.platform.updateConfig(r);const a=this.platform.acquireContext(s,i.aspectRatio),l=a&&a.canvas,c=l&&l.height,d=l&&l.width;if(this.id=CN(),this.ctx=a,this.canvas=l,this.width=d,this.height=c,this._options=i,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new BT,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=UN(u=>this.update(u),i.resizeDelay||0),this._dataChanges=[],Fa[this.id]=this,!a||!l){console.error("Failed to create chart: can't acquire context from the given item");return}sr.listen(this,"complete",Wm),sr.listen(this,"progress",s5),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:n},width:r,height:s,_aspectRatio:o}=this;return ft(t)?n&&o?o:s?r/s:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}get registry(){return Xn}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():sm(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return K0(this.canvas,this.ctx),this}stop(){return sr.stop(this),this}resize(t,n){sr.running(this)?this._resizeBeforeDraw={width:t,height:n}:this._resize(t,n)}_resize(t,n){const r=this.options,s=this.canvas,o=r.maintainAspectRatio&&this.aspectRatio,i=this.platform.getMaximumSize(s,t,n,o),a=r.devicePixelRatio||this.platform.getDevicePixelRatio(),l=this.width?"resize":"attach";this.width=i.width,this.height=i.height,this._aspectRatio=this.aspectRatio,sm(this,a,!0)&&(this.notifyPlugins("resize",{size:i}),bt(r.onResize,[this,i],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){const n=this.options.scales||{};at(n,(r,s)=>{r.id=s})}buildOrUpdateScales(){const t=this.options,n=t.scales,r=this.scales,s=Object.keys(r).reduce((i,a)=>(i[a]=!1,i),{});let o=[];n&&(o=o.concat(Object.keys(n).map(i=>{const a=n[i],l=Vd(i,a),c=l==="r",d=l==="x";return{options:a,dposition:c?"chartArea":d?"bottom":"left",dtype:c?"radialLinear":d?"category":"linear"}}))),at(o,i=>{const a=i.options,l=a.id,c=Vd(l,a),d=Je(a.type,i.dtype);(a.position===void 0||Bm(a.position,c)!==Bm(i.dposition))&&(a.position=i.dposition),s[l]=!0;let u=null;if(l in r&&r[l].type===d)u=r[l];else{const f=Xn.getScale(d);u=new f({id:l,type:d,ctx:this.ctx,chart:this}),r[u.id]=u}u.init(a,t)}),at(s,(i,a)=>{i||delete r[a]}),at(r,i=>{En.configure(this,i,i.options),En.addBox(this,i)})}_updateMetasets(){const t=this._metasets,n=this.data.datasets.length,r=t.length;if(t.sort((s,o)=>s.index-o.index),r>n){for(let s=n;sn.length&&delete this._stacks,t.forEach((r,s)=>{n.filter(o=>o===r._dataset).length===0&&this._destroyDatasetMeta(s)})}buildOrUpdateControllers(){const t=[],n=this.data.datasets;let r,s;for(this._removeUnreferencedMetasets(),r=0,s=n.length;r{this.getDatasetMeta(n).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const n=this.config;n.update();const r=this._options=n.createResolver(n.chartOptionScopes(),this.getContext()),s=this._animationsDisabled=!r.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0})===!1)return;const o=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let i=0;for(let c=0,d=this.data.datasets.length;c{c.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(jm("z","_idx"));const{_active:a,_lastEvent:l}=this;l?this._eventHandler(l,!0):a.length&&this._updateHoverStyles(a,a,!0),this.render()}_updateScales(){at(this.scales,t=>{En.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,n=new Set(Object.keys(this._listeners)),r=new Set(t.events);(!O0(n,r)||!!this._responsiveListeners!==t.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,n=this._getUniformDataChanges()||[];for(const{method:r,start:s,count:o}of n){const i=r==="_removeElements"?-o:o;o5(t,s,i)}}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const n=this.data.datasets.length,r=o=>new Set(t.filter(i=>i[0]===o).map((i,a)=>a+","+i.splice(1).join(","))),s=r(0);for(let o=1;oo.split(",")).map(o=>({method:o[1],start:+o[2],count:+o[3]}))}_updateLayout(t){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;En.update(this,this.width,this.height,t);const n=this.chartArea,r=n.width<=0||n.height<=0;this._layers=[],at(this.boxes,s=>{r&&s.position==="chartArea"||(s.configure&&s.configure(),this._layers.push(...s._layers()))},this),this._layers.forEach((s,o)=>{s._idx=o}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})!==!1){for(let n=0,r=this.data.datasets.length;n=0;--n)this._drawDataset(t[n]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const n=this.ctx,r={meta:t,index:t.index,cancelable:!0},s=EO(this,t);this.notifyPlugins("beforeDatasetDraw",r)!==!1&&(s&&kd(n,s),t.controller.draw(),s&&Cd(n),r.cancelable=!1,this.notifyPlugins("afterDatasetDraw",r))}isPointInArea(t){return Z0(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,n,r,s){const o=rT.modes[n];return typeof o=="function"?o(this,t,r,s):[]}getDatasetMeta(t){const n=this.data.datasets[t],r=this._metasets;let s=r.filter(o=>o&&o._dataset===n).pop();return s||(s={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:n&&n.order||0,index:t,_dataset:n,_parsed:[],_sorted:!1},r.push(s)),s}getContext(){return this.$context||(this.$context=Os(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const n=this.data.datasets[t];if(!n)return!1;const r=this.getDatasetMeta(t);return typeof r.hidden=="boolean"?!r.hidden:!n.hidden}setDatasetVisibility(t,n){const r=this.getDatasetMeta(t);r.hidden=!n}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,n,r){const s=r?"show":"hide",o=this.getDatasetMeta(t),i=o.controller._resolveAnimations(void 0,s);Ao(n)?(o.data[n].hidden=!r,this.update()):(this.setDatasetVisibility(t,r),i.update(o,{visible:r}),this.update(a=>a.datasetIndex===t?s:void 0))}hide(t,n){this._updateVisibility(t,n,!1)}show(t,n){this._updateVisibility(t,n,!0)}_destroyDatasetMeta(t){const n=this._metasets[t];n&&n.controller&&n.controller._destroy(),delete this._metasets[t]}_stop(){let t,n;for(this.stop(),sr.remove(this),t=0,n=this.data.datasets.length;t{n.addEventListener(this,o,i),t[o]=i},s=(o,i,a)=>{o.offsetX=i,o.offsetY=a,this._eventHandler(o)};at(this.options.events,o=>r(o,s))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,n=this.platform,r=(l,c)=>{n.addEventListener(this,l,c),t[l]=c},s=(l,c)=>{t[l]&&(n.removeEventListener(this,l,c),delete t[l])},o=(l,c)=>{this.canvas&&this.resize(l,c)};let i;const a=()=>{s("attach",a),this.attached=!0,this.resize(),r("resize",o),r("detach",i)};i=()=>{this.attached=!1,s("resize",o),this._stop(),this._resize(0,0),r("attach",a)},n.isAttached(this.canvas)?a():i()}unbindEvents(){at(this._listeners,(t,n)=>{this.platform.removeEventListener(this,n,t)}),this._listeners={},at(this._responsiveListeners,(t,n)=>{this.platform.removeEventListener(this,n,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,n,r){const s=r?"set":"remove";let o,i,a,l;for(n==="dataset"&&(o=this.getDatasetMeta(t[0].datasetIndex),o.controller["_"+s+"DatasetHoverStyle"]()),a=0,l=t.length;a{const a=this.getDatasetMeta(o);if(!a)throw new Error("No dataset found at index "+o);return{datasetIndex:o,element:a.data[i],index:i}});!ba(r,n)&&(this._active=r,this._lastEvent=null,this._updateHoverStyles(r,n))}notifyPlugins(t,n,r){return this._plugins.notify(this,t,n,r)}isPluginEnabled(t){return this._plugins._cache.filter(n=>n.plugin.id===t).length===1}_updateHoverStyles(t,n,r){const s=this.options.hover,o=(l,c)=>l.filter(d=>!c.some(u=>d.datasetIndex===u.datasetIndex&&d.index===u.index)),i=o(n,t),a=r?t:o(t,n);i.length&&this.updateHoverStyle(i,s.mode,!1),a.length&&s.mode&&this.updateHoverStyle(a,s.mode,!0)}_eventHandler(t,n){const r={event:t,replay:n,cancelable:!0,inChartArea:this.isPointInArea(t)},s=i=>(i.options.events||this.options.events).includes(t.native.type);if(this.notifyPlugins("beforeEvent",r,s)===!1)return;const o=this._handleEvent(t,n,r.inChartArea);return r.cancelable=!1,this.notifyPlugins("afterEvent",r,s),(o||r.changed)&&this.render(),this}_handleEvent(t,n,r){const{_active:s=[],options:o}=this,i=n,a=this._getActiveElements(t,s,r,i),l=ON(t),c=i5(t,this._lastEvent,r,l);r&&(this._lastEvent=null,bt(o.onHover,[t,a,this],this),l&&bt(o.onClick,[t,a,this],this));const d=!ba(a,s);return(d||n)&&(this._active=a,this._updateHoverStyles(a,s,n)),this._lastEvent=c,d}_getActiveElements(t,n,r,s){if(t.type==="mouseout")return[];if(!r)return n;const o=this.options.hover;return this.getElementsAtEventForMode(t,o.mode,o,s)}},$e(Cr,"defaults",_t),$e(Cr,"instances",Fa),$e(Cr,"overrides",Ur),$e(Cr,"registry",Xn),$e(Cr,"version",n5),$e(Cr,"getChart",Ym),Cr);function Km(){return at(jo.instances,e=>e._plugins.invalidate())}function a5(e,t,n){const{startAngle:r,x:s,y:o,outerRadius:i,innerRadius:a,options:l}=t,{borderWidth:c,borderJoinStyle:d}=l,u=Math.min(c/i,Kn(r-n));if(e.beginPath(),e.arc(s,o,i-c/2,r+u/2,n-u/2),a>0){const f=Math.min(c/a,Kn(r-n));e.arc(s,o,a+c/2,n-f/2,r+f/2,!0)}else{const f=Math.min(c/2,i*Kn(r-n));if(d==="round")e.arc(s,o,f,n-ht/2,r+ht/2,!0);else if(d==="bevel"){const g=2*f*f,m=-g*Math.cos(n+ht/2)+s,p=-g*Math.sin(n+ht/2)+o,y=g*Math.cos(r+ht/2)+s,b=g*Math.sin(r+ht/2)+o;e.lineTo(m,p),e.lineTo(y,b)}}e.closePath(),e.moveTo(0,0),e.rect(0,0,e.canvas.width,e.canvas.height),e.clip("evenodd")}function l5(e,t,n){const{startAngle:r,pixelMargin:s,x:o,y:i,outerRadius:a,innerRadius:l}=t;let c=s/a;e.beginPath(),e.arc(o,i,a,r-c,n+c),l>s?(c=s/l,e.arc(o,i,l,n+c,r-c,!0)):e.arc(o,i,s,n+It,r-It),e.closePath(),e.clip()}function c5(e){return Sd(e,["outerStart","outerEnd","innerStart","innerEnd"])}function d5(e,t,n,r){const s=c5(e.options.borderRadius),o=(n-t)/2,i=Math.min(o,r*t/2),a=l=>{const c=(n-Math.min(o,l))*r/2;return cn(l,0,Math.min(o,c))};return{outerStart:a(s.outerStart),outerEnd:a(s.outerEnd),innerStart:cn(s.innerStart,0,i),innerEnd:cn(s.innerEnd,0,i)}}function Ls(e,t,n,r){return{x:n+e*Math.cos(t),y:r+e*Math.sin(t)}}function za(e,t,n,r,s,o){const{x:i,y:a,startAngle:l,pixelMargin:c,innerRadius:d}=t,u=Math.max(t.outerRadius+r+n-c,0),f=d>0?d+r+n+c:0;let g=0;const m=s-l;if(r){const A=d>0?d-r:0,D=u>0?u-r:0,O=(A+D)/2,z=O!==0?m*O/(O+r):m;g=(m-z)/2}const p=Math.max(.001,m*u-n/ht)/u,y=(m-p)/2,b=l+y+g,_=s-y-g,{outerStart:x,outerEnd:M,innerStart:S,innerEnd:k}=d5(t,f,u,_-b),N=u-x,C=u-M,w=b+x/N,E=_-M/C,T=f+S,P=f+k,L=b+S/T,F=_-k/P;if(e.beginPath(),o){const A=(w+E)/2;if(e.arc(i,a,u,w,A),e.arc(i,a,u,A,E),M>0){const U=Ls(C,E,i,a);e.arc(U.x,U.y,M,E,_+It)}const D=Ls(P,_,i,a);if(e.lineTo(D.x,D.y),k>0){const U=Ls(P,F,i,a);e.arc(U.x,U.y,k,_+It,F+Math.PI)}const O=(_-k/f+(b+S/f))/2;if(e.arc(i,a,f,_-k/f,O,!0),e.arc(i,a,f,O,b+S/f,!0),S>0){const U=Ls(T,L,i,a);e.arc(U.x,U.y,S,L+Math.PI,b-It)}const z=Ls(N,b,i,a);if(e.lineTo(z.x,z.y),x>0){const U=Ls(N,w,i,a);e.arc(U.x,U.y,x,b-It,w)}}else{e.moveTo(i,a);const A=Math.cos(w)*u+i,D=Math.sin(w)*u+a;e.lineTo(A,D);const O=Math.cos(E)*u+i,z=Math.sin(E)*u+a;e.lineTo(O,z)}e.closePath()}function u5(e,t,n,r,s){const{fullCircles:o,startAngle:i,circumference:a}=t;let l=t.endAngle;if(o){za(e,t,n,r,l,s);for(let c=0;c=ht&&g===0&&d!=="miter"&&a5(e,t,p),o||(za(e,t,n,r,p,s),e.stroke())}class Wo extends Yr{constructor(n){super();$e(this,"circumference");$e(this,"endAngle");$e(this,"fullCircles");$e(this,"innerRadius");$e(this,"outerRadius");$e(this,"pixelMargin");$e(this,"startAngle");this.options=void 0,this.circumference=void 0,this.startAngle=void 0,this.endAngle=void 0,this.innerRadius=void 0,this.outerRadius=void 0,this.pixelMargin=0,this.fullCircles=0,n&&Object.assign(this,n)}inRange(n,r,s){const o=this.getProps(["x","y"],s),{angle:i,distance:a}=L0(o,{x:n,y:r}),{startAngle:l,endAngle:c,innerRadius:d,outerRadius:u,circumference:f}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],s),g=(this.options.spacing+this.options.borderWidth)/2,m=Je(f,c-l),p=ka(i,l,c)&&l!==c,y=m>=Ot||p,b=Hr(a,d+g,u+g);return y&&b}getCenterPoint(n){const{x:r,y:s,startAngle:o,endAngle:i,innerRadius:a,outerRadius:l}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],n),{offset:c,spacing:d}=this.options,u=(o+i)/2,f=(a+l+d+c)/2;return{x:r+Math.cos(u)*f,y:s+Math.sin(u)*f}}tooltipPosition(n){return this.getCenterPoint(n)}draw(n){const{options:r,circumference:s}=this,o=(r.offset||0)/4,i=(r.spacing||0)/2,a=r.circular;if(this.pixelMargin=r.borderAlign==="inner"?.33:0,this.fullCircles=s>Ot?Math.floor(s/Ot):0,s===0||this.innerRadius<0||this.outerRadius<0)return;n.save();const l=(this.startAngle+this.endAngle)/2;n.translate(Math.cos(l)*o,Math.sin(l)*o);const c=1-Math.sin(Math.min(ht,s||0)),d=o*c;n.fillStyle=r.backgroundColor,n.strokeStyle=r.borderColor,u5(n,this,d,i,a),f5(n,this,d,i,a),n.restore()}}$e(Wo,"id","arc"),$e(Wo,"defaults",{borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0,selfJoin:!1}),$e(Wo,"defaultRoutes",{backgroundColor:"backgroundColor"}),$e(Wo,"descriptors",{_scriptable:!0,_indexable:n=>n!=="borderDash"});function Xm(e,t){const{x:n,y:r,base:s,width:o,height:i}=e.getProps(["x","y","base","width","height"],t);let a,l,c,d,u;return e.horizontal?(u=i/2,a=Math.min(n,s),l=Math.max(n,s),c=r-u,d=r+u):(u=o/2,a=n-u,l=n+u,c=Math.min(r,s),d=Math.max(r,s)),{left:a,top:c,right:l,bottom:d}}function kr(e,t,n,r){return e?0:cn(t,n,r)}function h5(e,t,n){const r=e.options.borderWidth,s=e.borderSkipped,o=Q0(r);return{t:kr(s.top,o.top,0,n),r:kr(s.right,o.right,0,t),b:kr(s.bottom,o.bottom,0,n),l:kr(s.left,o.left,0,t)}}function g5(e,t,n){const{enableBorderRadius:r}=e.getProps(["enableBorderRadius"]),s=e.options.borderRadius,o=Ns(s),i=Math.min(t,n),a=e.borderSkipped,l=r||Qe(s);return{topLeft:kr(!l||a.top||a.left,o.topLeft,0,i),topRight:kr(!l||a.top||a.right,o.topRight,0,i),bottomLeft:kr(!l||a.bottom||a.left,o.bottomLeft,0,i),bottomRight:kr(!l||a.bottom||a.right,o.bottomRight,0,i)}}function p5(e){const t=Xm(e),n=t.right-t.left,r=t.bottom-t.top,s=h5(e,n/2,r/2),o=g5(e,n/2,r/2);return{outer:{x:t.left,y:t.top,w:n,h:r,radius:o},inner:{x:t.left+s.l,y:t.top+s.t,w:n-s.l-s.r,h:r-s.t-s.b,radius:{topLeft:Math.max(0,o.topLeft-Math.max(s.t,s.l)),topRight:Math.max(0,o.topRight-Math.max(s.t,s.r)),bottomLeft:Math.max(0,o.bottomLeft-Math.max(s.b,s.l)),bottomRight:Math.max(0,o.bottomRight-Math.max(s.b,s.r))}}}}function Hd(e,t,n,r){const s=t===null,o=n===null,a=e&&!(s&&o)&&Xm(e,r);return a&&(s||Hr(t,a.left,a.right))&&(o||Hr(n,a.top,a.bottom))}function m5(e){return e.topLeft||e.topRight||e.bottomLeft||e.bottomRight}function b5(e,t){e.rect(t.x,t.y,t.w,t.h)}function Ud(e,t,n={}){const r=e.x!==n.x?-t:0,s=e.y!==n.y?-t:0,o=(e.x+e.w!==n.x+n.w?t:0)-r,i=(e.y+e.h!==n.y+n.h?t:0)-s;return{x:e.x+r,y:e.y+s,w:e.w+o,h:e.h+i,radius:e.radius}}class Va extends Yr{constructor(t){super(),this.options=void 0,this.horizontal=void 0,this.base=void 0,this.width=void 0,this.height=void 0,this.inflateAmount=void 0,t&&Object.assign(this,t)}draw(t){const{inflateAmount:n,options:{borderColor:r,backgroundColor:s}}=this,{inner:o,outer:i}=p5(this),a=m5(i.radius)?Sa:b5;t.save(),(i.w!==o.w||i.h!==o.h)&&(t.beginPath(),a(t,Ud(i,n,o)),t.clip(),a(t,Ud(o,-n,i)),t.fillStyle=r,t.fill("evenodd")),t.beginPath(),a(t,Ud(o,n)),t.fillStyle=s,t.fill(),t.restore()}inRange(t,n,r){return Hd(this,t,n,r)}inXRange(t,n){return Hd(this,t,null,n)}inYRange(t,n){return Hd(this,null,t,n)}getCenterPoint(t){const{x:n,y:r,base:s,horizontal:o}=this.getProps(["x","y","base","horizontal"],t);return{x:o?(n+s)/2:n,y:o?r:(r+s)/2}}getRange(t){return t==="x"?this.width/2:this.height/2}}$e(Va,"id","bar"),$e(Va,"defaults",{borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0}),$e(Va,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"});const qm=(e,t)=>{let{boxHeight:n=t,boxWidth:r=t}=e;return e.usePointStyle&&(n=Math.min(n,t),r=e.pointStyleWidth||Math.min(r,t)),{boxWidth:r,boxHeight:n,itemHeight:Math.max(t,n)}},y5=(e,t)=>e!==null&&t!==null&&e.datasetIndex===t.datasetIndex&&e.index===t.index;class Zm extends Yr{constructor(t){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,n,r){this.maxWidth=t,this.maxHeight=n,this._margins=r,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){const t=this.options.labels||{};let n=bt(t.generateLabels,[this.chart],this)||[];t.filter&&(n=n.filter(r=>t.filter(r,this.chart.data))),t.sort&&(n=n.sort((r,s)=>t.sort(r,s,this.chart.data))),this.options.reverse&&n.reverse(),this.legendItems=n}fit(){const{options:t,ctx:n}=this;if(!t.display){this.width=this.height=0;return}const r=t.labels,s=Rt(r.font),o=s.size,i=this._computeTitleHeight(),{boxWidth:a,itemHeight:l}=qm(r,o);let c,d;n.font=s.string,this.isHorizontal()?(c=this.maxWidth,d=this._fitRows(i,o,a,l)+10):(d=this.maxHeight,c=this._fitCols(i,s,a,l)+10),this.width=Math.min(c,t.maxWidth||this.maxWidth),this.height=Math.min(d,t.maxHeight||this.maxHeight)}_fitRows(t,n,r,s){const{ctx:o,maxWidth:i,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],c=this.lineWidths=[0],d=s+a;let u=t;o.textAlign="left",o.textBaseline="middle";let f=-1,g=-d;return this.legendItems.forEach((m,p)=>{const y=r+n/2+o.measureText(m.text).width;(p===0||c[c.length-1]+y+2*a>i)&&(u+=d,c[c.length-(p>0?0:1)]=0,g+=d,f++),l[p]={left:0,top:g,row:f,width:y,height:s},c[c.length-1]+=y+a}),u}_fitCols(t,n,r,s){const{ctx:o,maxHeight:i,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],c=this.columnSizes=[],d=i-t;let u=a,f=0,g=0,m=0,p=0;return this.legendItems.forEach((y,b)=>{const{itemWidth:_,itemHeight:x}=v5(r,n,o,y,s);b>0&&g+x+2*a>d&&(u+=f+a,c.push({width:f,height:g}),m+=f+a,p++,f=g=0),l[b]={left:m,top:g,col:p,width:_,height:x},f=Math.max(f,_),g+=x+a}),u+=f,c.push({width:f,height:g}),u}adjustHitBoxes(){if(!this.options.display)return;const t=this._computeTitleHeight(),{legendHitBoxes:n,options:{align:r,labels:{padding:s},rtl:o}}=this,i=As(o,this.left,this.width);if(this.isHorizontal()){let a=0,l=Jt(r,this.left+s,this.right-this.lineWidths[a]);for(const c of n)a!==c.row&&(a=c.row,l=Jt(r,this.left+s,this.right-this.lineWidths[a])),c.top+=this.top+t+s,c.left=i.leftForLtr(i.x(l),c.width),l+=c.width+s}else{let a=0,l=Jt(r,this.top+t+s,this.bottom-this.columnSizes[a].height);for(const c of n)c.col!==a&&(a=c.col,l=Jt(r,this.top+t+s,this.bottom-this.columnSizes[a].height)),c.top=l,c.left+=this.left+s,c.left=i.leftForLtr(i.x(c.left),c.width),l+=c.height+s}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){const t=this.ctx;kd(t,this),this._draw(),Cd(t)}}_draw(){const{options:t,columnSizes:n,lineWidths:r,ctx:s}=this,{align:o,labels:i}=t,a=_t.color,l=As(t.rtl,this.left,this.width),c=Rt(i.font),{padding:d}=i,u=c.size,f=u/2;let g;this.drawTitle(),s.textAlign=l.textAlign("left"),s.textBaseline="middle",s.lineWidth=.5,s.font=c.string;const{boxWidth:m,boxHeight:p,itemHeight:y}=qm(i,u),b=function(k,N,C){if(isNaN(m)||m<=0||isNaN(p)||p<0)return;s.save();const w=Je(C.lineWidth,1);if(s.fillStyle=Je(C.fillStyle,a),s.lineCap=Je(C.lineCap,"butt"),s.lineDashOffset=Je(C.lineDashOffset,0),s.lineJoin=Je(C.lineJoin,"miter"),s.lineWidth=w,s.strokeStyle=Je(C.strokeStyle,a),s.setLineDash(Je(C.lineDash,[])),i.usePointStyle){const E={radius:p*Math.SQRT2/2,pointStyle:C.pointStyle,rotation:C.rotation,borderWidth:w},T=l.xPlus(k,m/2),P=N+f;q0(s,E,T,P,i.pointStyleWidth&&m)}else{const E=N+Math.max((u-p)/2,0),T=l.leftForLtr(k,m),P=Ns(C.borderRadius);s.beginPath(),Object.values(P).some(L=>L!==0)?Sa(s,{x:T,y:E,w:m,h:p,radius:P}):s.rect(T,E,m,p),s.fill(),w!==0&&s.stroke()}s.restore()},_=function(k,N,C){Lo(s,C.text,k,N+y/2,c,{strikethrough:C.hidden,textAlign:l.textAlign(C.textAlign)})},x=this.isHorizontal(),M=this._computeTitleHeight();x?g={x:Jt(o,this.left+d,this.right-r[0]),y:this.top+d+M,line:0}:g={x:this.left+d,y:Jt(o,this.top+M+d,this.bottom-n[0].height),line:0},im(this.ctx,t.textDirection);const S=y+d;this.legendItems.forEach((k,N)=>{s.strokeStyle=k.fontColor,s.fillStyle=k.fontColor;const C=s.measureText(k.text).width,w=l.textAlign(k.textAlign||(k.textAlign=i.textAlign)),E=m+f+C;let T=g.x,P=g.y;l.setWidth(this.width),x?N>0&&T+E+d>this.right&&(P=g.y+=S,g.line++,T=g.x=Jt(o,this.left+d,this.right-r[g.line])):N>0&&P+S>this.bottom&&(T=g.x=T+n[g.line].width+d,g.line++,P=g.y=Jt(o,this.top+M+d,this.bottom-n[g.line].height));const L=l.x(T);if(b(L,P,k),T=BN(w,T+m+f,x?T+E:this.right,t.rtl),_(l.x(T),P,k),x)g.x+=E+d;else if(typeof k.text!="string"){const F=c.lineHeight;g.y+=Qm(k,F)+d}else g.y+=S}),am(this.ctx,t.textDirection)}drawTitle(){const t=this.options,n=t.title,r=Rt(n.font),s=_n(n.padding);if(!n.display)return;const o=As(t.rtl,this.left,this.width),i=this.ctx,a=n.position,l=r.size/2,c=s.top+l;let d,u=this.left,f=this.width;if(this.isHorizontal())f=Math.max(...this.lineWidths),d=this.top+c,u=Jt(t.align,u,this.right-f);else{const m=this.columnSizes.reduce((p,y)=>Math.max(p,y.height),0);d=c+Jt(t.align,this.top,this.bottom-m-t.labels.padding-this._computeTitleHeight())}const g=Jt(a,u,u+f);i.textAlign=o.textAlign(bd(a)),i.textBaseline="middle",i.strokeStyle=n.color,i.fillStyle=n.color,i.font=r.string,Lo(i,n.text,g,d,r)}_computeTitleHeight(){const t=this.options.title,n=Rt(t.font),r=_n(t.padding);return t.display?n.lineHeight+r.height:0}_getLegendItemAt(t,n){let r,s,o;if(Hr(t,this.left,this.right)&&Hr(n,this.top,this.bottom)){for(o=this.legendHitBoxes,r=0;ro.length>i.length?o:i)),t+n.size/2+r.measureText(s).width}function w5(e,t,n){let r=e;return typeof t.text!="string"&&(r=Qm(t,n)),r}function Qm(e,t){const n=e.text?e.text.length:0;return t*n}function k5(e,t){return!!((e==="mousemove"||e==="mouseout")&&(t.onHover||t.onLeave)||t.onClick&&(e==="click"||e==="mouseup"))}var Jm={id:"legend",_element:Zm,start(e,t,n){const r=e.legend=new Zm({ctx:e.ctx,options:n,chart:e});En.configure(e,r,n),En.addBox(e,r)},stop(e){En.removeBox(e,e.legend),delete e.legend},beforeUpdate(e,t,n){const r=e.legend;En.configure(e,r,n),r.options=n},afterUpdate(e){const t=e.legend;t.buildLabels(),t.adjustHitBoxes()},afterEvent(e,t){t.replay||e.legend.handleEvent(t.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(e,t,n){const r=t.datasetIndex,s=n.chart;s.isDatasetVisible(r)?(s.hide(r),t.hidden=!0):(s.show(r),t.hidden=!1)},onHover:null,onLeave:null,labels:{color:e=>e.chart.options.color,boxWidth:40,padding:10,generateLabels(e){const t=e.data.datasets,{labels:{usePointStyle:n,pointStyle:r,textAlign:s,color:o,useBorderRadius:i,borderRadius:a}}=e.legend.options;return e._getSortedDatasetMetas().map(l=>{const c=l.controller.getStyle(n?0:void 0),d=_n(c.borderWidth);return{text:t[l.index].label,fillStyle:c.backgroundColor,fontColor:o,hidden:!l.visible,lineCap:c.borderCapStyle,lineDash:c.borderDash,lineDashOffset:c.borderDashOffset,lineJoin:c.borderJoinStyle,lineWidth:(d.width+d.height)/4,strokeStyle:c.borderColor,pointStyle:r||c.pointStyle,rotation:c.rotation,textAlign:s||c.textAlign,borderRadius:i&&(a||c.borderRadius),datasetIndex:l.index}},this)}},title:{color:e=>e.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:e=>!e.startsWith("on"),labels:{_scriptable:e=>!["generateLabels","filter","sort"].includes(e)}}};class Rm extends Yr{constructor(t){super(),this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,n){const r=this.options;if(this.left=0,this.top=0,!r.display){this.width=this.height=this.right=this.bottom=0;return}this.width=this.right=t,this.height=this.bottom=n;const s=Dt(r.text)?r.text.length:1;this._padding=_n(r.padding);const o=s*Rt(r.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=o:this.width=o}isHorizontal(){const t=this.options.position;return t==="top"||t==="bottom"}_drawArgs(t){const{top:n,left:r,bottom:s,right:o,options:i}=this,a=i.align;let l=0,c,d,u;return this.isHorizontal()?(d=Jt(a,r,o),u=n+t,c=o-r):(i.position==="left"?(d=r+t,u=Jt(a,s,n),l=ht*-.5):(d=o-t,u=Jt(a,n,s),l=ht*.5),c=s-n),{titleX:d,titleY:u,maxWidth:c,rotation:l}}draw(){const t=this.ctx,n=this.options;if(!n.display)return;const r=Rt(n.font),o=r.lineHeight/2+this._padding.top,{titleX:i,titleY:a,maxWidth:l,rotation:c}=this._drawArgs(o);Lo(t,n.text,0,0,r,{color:n.color,maxWidth:l,rotation:c,textAlign:bd(n.align),textBaseline:"middle",translation:[i,a]})}}function C5(e,t){const n=new Rm({ctx:e.ctx,options:t,chart:e});En.configure(e,n,t),En.addBox(e,n),e.titleBlock=n}var S5={id:"title",_element:Rm,start(e,t,n){C5(e,n)},stop(e){const t=e.titleBlock;En.removeBox(e,t),delete e.titleBlock},beforeUpdate(e,t,n){const r=e.titleBlock;En.configure(e,r,n),r.options=n},defaults:{align:"center",display:!1,font:{weight:"bold"},fullSize:!0,padding:10,position:"top",text:"",weight:2e3},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const Go={average(e){if(!e.length)return!1;let t,n,r=new Set,s=0,o=0;for(t=0,n=e.length;ta+l)/r.size,y:s/o}},nearest(e,t){if(!e.length)return!1;let n=t.x,r=t.y,s=Number.POSITIVE_INFINITY,o,i,a;for(o=0,i=e.length;o-1?e.split(` -`):e}function k5(e,t){const{element:n,datasetIndex:r,index:s}=t,o=e.getDatasetMeta(r).controller,{label:i,value:a}=o.getLabelAndValue(s);return{chart:e,label:i,parsed:o.getParsed(s),raw:e.data.datasets[r].data[s],formattedValue:a,dataset:o.getDataset(),dataIndex:s,datasetIndex:r,element:n}}function xm(e,t){const n=e.chart.ctx,{body:r,footer:s,title:o}=e,{boxWidth:i,boxHeight:a}=t,l=Wt(t.bodyFont),c=Wt(t.titleFont),d=Wt(t.footerFont),u=o.length,f=s.length,g=r.length,m=yn(t.padding);let p=m.height,y=0,b=r.reduce((E,S)=>E+S.before.length+S.lines.length+S.after.length,0);if(b+=e.beforeBody.length+e.afterBody.length,u&&(p+=u*c.lineHeight+(u-1)*t.titleSpacing+t.titleMarginBottom),b){const E=t.displayColors?Math.max(a,l.lineHeight):l.lineHeight;p+=g*E+(b-g)*l.lineHeight+(b-1)*t.bodySpacing}f&&(p+=t.footerMarginTop+f*d.lineHeight+(f-1)*t.footerSpacing);let _=0;const x=function(E){y=Math.max(y,n.measureText(E).width+_)};return n.save(),n.font=c.string,tt(e.title,x),n.font=l.string,tt(e.beforeBody.concat(e.afterBody),x),_=t.displayColors?i+2+t.boxPadding:0,tt(r,E=>{tt(E.before,x),tt(E.lines,x),tt(E.after,x)}),_=0,n.font=d.string,tt(e.footer,x),n.restore(),y+=m.width,{width:y,height:p}}function C5(e,t){const{y:n,height:r}=t;return ne.height-r/2?"bottom":"center"}function S5(e,t,n,r){const{x:s,width:o}=r,i=n.caretSize+n.caretPadding;if(e==="left"&&s+o+i>t.width||e==="right"&&s-o-i<0)return!0}function _5(e,t,n,r){const{x:s,width:o}=n,{width:i,chartArea:{left:a,right:l}}=e;let c="center";return r==="center"?c=s<=(a+l)/2?"left":"right":s<=o/2?c="left":s>=i-o/2&&(c="right"),S5(c,e,t,n)&&(c="center"),c}function wm(e,t,n){const r=n.yAlign||t.yAlign||C5(e,n);return{xAlign:n.xAlign||t.xAlign||_5(e,t,n,r),yAlign:r}}function E5(e,t){let{x:n,width:r}=e;return t==="right"?n-=r:t==="center"&&(n-=r/2),n}function M5(e,t,n){let{y:r,height:s}=e;return t==="top"?r+=n:t==="bottom"?r-=s+n:r-=s/2,r}function km(e,t,n,r){const{caretSize:s,caretPadding:o,cornerRadius:i}=e,{xAlign:a,yAlign:l}=n,c=s+o,{topLeft:d,topRight:u,bottomLeft:f,bottomRight:g}=gs(i);let m=E5(t,a);const p=M5(t,l,c);return l==="center"?a==="left"?m+=c:a==="right"&&(m-=c):a==="left"?m-=Math.max(d,f)+s:a==="right"&&(m+=Math.max(u,g)+s),{x:nn(m,0,r.width-t.width),y:nn(p,0,r.height-t.height)}}function _a(e,t,n){const r=yn(n.padding);return t==="center"?e.x+e.width/2:t==="right"?e.x+e.width-r.right:e.x+r.left}function Cm(e){return Bn([],Qn(e))}function N5(e,t,n){return ps(e,{tooltip:t,tooltipItems:n,type:"tooltip"})}function Sm(e,t){const n=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return n?e.override(n):e}const _m={beforeTitle:Xn,title(e){if(e.length>0){const t=e[0],n=t.chart.data.labels,r=n?n.length:0;if(this&&this.options&&this.options.mode==="dataset")return t.dataset.label||"";if(t.label)return t.label;if(r>0&&t.dataIndex"u"?_m[t].call(n,r):s}class xd extends Lr{constructor(t){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const t=this._cachedAnimations;if(t)return t;const n=this.chart,r=this.options.setContext(this.getContext()),s=r.enabled&&n.options.animation&&r.animations,o=new O0(this.chart,s);return s._cacheable&&(this._cachedAnimations=Object.freeze(o)),o}getContext(){return this.$context||(this.$context=N5(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,n){const{callbacks:r}=n,s=rn(r,"beforeTitle",this,t),o=rn(r,"title",this,t),i=rn(r,"afterTitle",this,t);let a=[];return a=Bn(a,Qn(s)),a=Bn(a,Qn(o)),a=Bn(a,Qn(i)),a}getBeforeBody(t,n){return Cm(rn(n.callbacks,"beforeBody",this,t))}getBody(t,n){const{callbacks:r}=n,s=[];return tt(t,o=>{const i={before:[],lines:[],after:[]},a=Sm(r,o);Bn(i.before,Qn(rn(a,"beforeLabel",this,o))),Bn(i.lines,rn(a,"label",this,o)),Bn(i.after,Qn(rn(a,"afterLabel",this,o))),s.push(i)}),s}getAfterBody(t,n){return Cm(rn(n.callbacks,"afterBody",this,t))}getFooter(t,n){const{callbacks:r}=n,s=rn(r,"beforeFooter",this,t),o=rn(r,"footer",this,t),i=rn(r,"afterFooter",this,t);let a=[];return a=Bn(a,Qn(s)),a=Bn(a,Qn(o)),a=Bn(a,Qn(i)),a}_createItems(t){const n=this._active,r=this.chart.data,s=[],o=[],i=[];let a=[],l,c;for(l=0,c=n.length;lt.filter(d,u,f,r))),t.itemSort&&(a=a.sort((d,u)=>t.itemSort(d,u,r))),tt(a,d=>{const u=Sm(t.callbacks,d);s.push(rn(u,"labelColor",this,d)),o.push(rn(u,"labelPointStyle",this,d)),i.push(rn(u,"labelTextColor",this,d))}),this.labelColors=s,this.labelPointStyles=o,this.labelTextColors=i,this.dataPoints=a,a}update(t,n){const r=this.options.setContext(this.getContext()),s=this._active;let o,i=[];if(!s.length)this.opacity!==0&&(o={opacity:0});else{const a=To[r.position].call(this,s,this._eventPosition);i=this._createItems(r),this.title=this.getTitle(i,r),this.beforeBody=this.getBeforeBody(i,r),this.body=this.getBody(i,r),this.afterBody=this.getAfterBody(i,r),this.footer=this.getFooter(i,r);const l=this._size=xm(this,r),c=Object.assign({},a,l),d=wm(this.chart,r,c),u=km(r,c,d,this.chart);this.xAlign=d.xAlign,this.yAlign=d.yAlign,o={opacity:1,x:u.x,y:u.y,width:l.width,height:l.height,caretX:a.x,caretY:a.y}}this._tooltipItems=i,this.$context=void 0,o&&this._resolveAnimations().update(this,o),t&&r.external&&r.external.call(this,{chart:this.chart,tooltip:this,replay:n})}drawCaret(t,n,r,s){const o=this.getCaretPosition(t,r,s);n.lineTo(o.x1,o.y1),n.lineTo(o.x2,o.y2),n.lineTo(o.x3,o.y3)}getCaretPosition(t,n,r){const{xAlign:s,yAlign:o}=this,{caretSize:i,cornerRadius:a}=r,{topLeft:l,topRight:c,bottomLeft:d,bottomRight:u}=gs(a),{x:f,y:g}=t,{width:m,height:p}=n;let y,b,_,x,E,S;return o==="center"?(E=g+p/2,s==="left"?(y=f,b=y-i,x=E+i,S=E-i):(y=f+m,b=y+i,x=E-i,S=E+i),_=y):(s==="left"?b=f+Math.max(l,d)+i:s==="right"?b=f+m-Math.max(c,u)-i:b=this.caretX,o==="top"?(x=g,E=x-i,y=b-i,_=b+i):(x=g+p,E=x+i,y=b+i,_=b-i),S=x),{x1:y,x2:b,x3:_,y1:x,y2:E,y3:S}}drawTitle(t,n,r){const s=this.title,o=s.length;let i,a,l;if(o){const c=bs(r.rtl,this.x,this.width);for(t.x=_a(this,r.titleAlign,r),n.textAlign=c.textAlign(r.titleAlign),n.textBaseline="middle",i=Wt(r.titleFont),a=r.titleSpacing,n.fillStyle=r.titleColor,n.font=i.string,l=0;l_!==0)?(t.beginPath(),t.fillStyle=o.multiKeyBackground,ca(t,{x:p,y:m,w:c,h:l,radius:b}),t.fill(),t.stroke(),t.fillStyle=i.backgroundColor,t.beginPath(),ca(t,{x:y,y:m+1,w:c-2,h:l-2,radius:b}),t.fill()):(t.fillStyle=o.multiKeyBackground,t.fillRect(p,m,c,l),t.strokeRect(p,m,c,l),t.fillStyle=i.backgroundColor,t.fillRect(y,m+1,c-2,l-2))}t.fillStyle=this.labelTextColors[r]}drawBody(t,n,r){const{body:s}=this,{bodySpacing:o,bodyAlign:i,displayColors:a,boxHeight:l,boxWidth:c,boxPadding:d}=r,u=Wt(r.bodyFont);let f=u.lineHeight,g=0;const m=bs(r.rtl,this.x,this.width),p=function(C){n.fillText(C,m.x(t.x+g),t.y+f/2),t.y+=f+o},y=m.textAlign(i);let b,_,x,E,S,w,N;for(n.textAlign=i,n.textBaseline="middle",n.font=u.string,t.x=_a(this,y,r),n.fillStyle=r.bodyColor,tt(this.beforeBody,p),g=a&&y!=="right"?i==="center"?c/2+d:c+2+d:0,E=0,w=s.length;E0&&n.stroke()}_updateAnimationTarget(t){const n=this.chart,r=this.$animations,s=r&&r.x,o=r&&r.y;if(s||o){const i=To[t.position].call(this,this._active,this._eventPosition);if(!i)return;const a=this._size=xm(this,t),l=Object.assign({},i,this._size),c=wm(n,t,l),d=km(t,l,c,n);(s._to!==d.x||o._to!==d.y)&&(this.xAlign=c.xAlign,this.yAlign=c.yAlign,this.width=a.width,this.height=a.height,this.caretX=i.x,this.caretY=i.y,this._resolveAnimations().update(this,d))}}_willRender(){return!!this.opacity}draw(t){const n=this.options.setContext(this.getContext());let r=this.opacity;if(!r)return;this._updateAnimationTarget(n);const s={width:this.width,height:this.height},o={x:this.x,y:this.y};r=Math.abs(r)<.001?0:r;const i=yn(n.padding),a=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;n.enabled&&a&&(t.save(),t.globalAlpha=r,this.drawBackground(o,t,s,n),E0(t,n.textDirection),o.y+=i.top,this.drawTitle(o,t,n),this.drawBody(o,t,n),this.drawFooter(o,t,n),M0(t,n.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,n){const r=this._active,s=t.map(({datasetIndex:a,index:l})=>{const c=this.chart.getDatasetMeta(a);if(!c)throw new Error("Cannot find a dataset at index "+a);return{datasetIndex:a,element:c.data[l],index:l}}),o=!na(r,s),i=this._positionChanged(s,n);(o||i)&&(this._active=s,this._eventPosition=n,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,n,r=!0){if(n&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const s=this.options,o=this._active||[],i=this._getActiveElements(t,o,n,r),a=this._positionChanged(i,t),l=n||!na(i,o)||a;return l&&(this._active=i,(s.enabled||s.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,n))),l}_getActiveElements(t,n,r,s){const o=this.options;if(t.type==="mouseout")return[];if(!s)return n.filter(a=>this.chart.data.datasets[a.datasetIndex]&&this.chart.getDatasetMeta(a.datasetIndex).controller.getParsed(a.index)!==void 0);const i=this.chart.getElementsAtEventForMode(t,o.mode,o,r);return o.reverse&&i.reverse(),i}_positionChanged(t,n){const{caretX:r,caretY:s,options:o}=this,i=To[o.position].call(this,t,n);return i!==!1&&(r!==i.x||s!==i.y)}}Pe(xd,"positioners",To);var Em={id:"tooltip",_element:xd,positioners:To,afterInit(e,t,n){n&&(e.tooltip=new xd({chart:e,options:n}))},beforeUpdate(e,t,n){e.tooltip&&e.tooltip.initialize(n)},reset(e,t,n){e.tooltip&&e.tooltip.initialize(n)},afterDraw(e){const t=e.tooltip;if(t&&t._willRender()){const n={tooltip:t};if(e.notifyPlugins("beforeTooltipDraw",{...n,cancelable:!0})===!1)return;t.draw(e.ctx),e.notifyPlugins("afterTooltipDraw",n)}},afterEvent(e,t){if(e.tooltip){const n=t.replay;e.tooltip.handleEvent(t.event,n,t.inChartArea)&&(t.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(e,t)=>t.bodyFont.size,boxWidth:(e,t)=>t.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:_m},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:e=>e!=="filter"&&e!=="itemSort"&&e!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]};const O5=(e,t,n,r)=>(typeof t=="string"?(n=e.push(t)-1,r.unshift({index:n,label:t})):isNaN(t)&&(n=null),n);function T5(e,t,n,r){const s=e.indexOf(t);if(s===-1)return O5(e,t,n,r);const o=e.lastIndexOf(t);return s!==o?n:s}const A5=(e,t)=>e===null?null:nn(Math.round(e),0,t);function Mm(e){const t=this.getLabels();return e>=0&&en.length-1?null:this.getPixelForValue(n[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}}Pe(wd,"id","category"),Pe(wd,"defaults",{ticks:{callback:Mm}});function D5(e,t){const n=[],{bounds:s,step:o,min:i,max:a,precision:l,count:c,maxTicks:d,maxDigits:u,includeBounds:f}=e,g=o||1,m=d-1,{min:p,max:y}=t,b=!at(i),_=!at(a),x=!at(c),E=(y-p)/(u+1);let S=Jp((y-p)/m/g)*g,w,N,C,k;if(S<1e-14&&!b&&!_)return[{value:p},{value:y}];k=Math.ceil(y/S)-Math.floor(p/S),k>m&&(S=Jp(k*S/m/g)*g),at(l)||(w=Math.pow(10,l),S=Math.ceil(S*w)/w),s==="ticks"?(N=Math.floor(p/S)*S,C=Math.ceil(y/S)*S):(N=p,C=y),b&&_&&o&&TM((a-i)/o,S/1e3)?(k=Math.round(Math.min((a-i)/S,d)),S=(a-i)/k,N=i,C=a):x?(N=b?i:N,C=_?a:C,k=c-1,S=(C-N)/k):(k=(C-N)/S,oa(k,Math.round(k),S/1e3)?k=Math.round(k):k=Math.ceil(k));const M=Math.max(Rp(S),Rp(N));w=Math.pow(10,at(l)?M:l),N=Math.round(N*w)/w,C=Math.round(C*w)/w;let T=0;for(b&&(f&&N!==i?(n.push({value:i}),Na)break;n.push({value:L})}return _&&f&&C!==a?n.length&&oa(n[n.length-1].value,a,Nm(a,E,e))?n[n.length-1].value=a:n.push({value:a}):(!_||C===a)&&n.push({value:C}),n}function Nm(e,t,{horizontal:n,minRotation:r}){const s=qn(r),o=(n?Math.sin(s):Math.cos(s))||.001,i=.75*t*(""+e).length;return Math.min(t/o,i)}class I5 extends vs{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(t,n){return at(t)||(typeof t=="number"||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const{beginAtZero:t}=this.options,{minDefined:n,maxDefined:r}=this.getUserBounds();let{min:s,max:o}=this;const i=l=>s=n?s:l,a=l=>o=r?o:l;if(t){const l=dr(s),c=dr(o);l<0&&c<0?a(0):l>0&&c>0&&i(0)}if(s===o){let l=o===0?1:Math.abs(o*.05);a(o+l),t||i(s-l)}this.min=s,this.max=o}getTickLimit(){const t=this.options.ticks;let{maxTicksLimit:n,stepSize:r}=t,s;return r?(s=Math.ceil(this.max/r)-Math.floor(this.min/r)+1,s>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${r} would result generating up to ${s} ticks. Limiting to 1000.`),s=1e3)):(s=this.computeTickLimit(),n=n||11),n&&(s=Math.min(n,s)),s}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,n=t.ticks;let r=this.getTickLimit();r=Math.max(2,r);const s={maxTicks:r,bounds:t.bounds,min:t.min,max:t.max,precision:n.precision,step:n.stepSize,count:n.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:n.minRotation||0,includeBounds:n.includeBounds!==!1},o=this._range||this,i=D5(s,o);return t.bounds==="ticks"&&AM(i,this,"value"),t.reverse?(i.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),i}configure(){const t=this.ticks;let n=this.min,r=this.max;if(super.configure(),this.options.offset&&t.length){const s=(r-n)/Math.max(t.length-1,1)/2;n-=s,r+=s}this._startValue=n,this._endValue=r,this._valueRange=r-n}getLabelForValue(t){return Qc(t,this.chart.options.locale,this.options.ticks.format)}}class kd extends I5{determineDataLimits(){const{min:t,max:n}=this.getMinMax(!0);this.min=bn(t)?t:0,this.max=bn(n)?n:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),n=t?this.width:this.height,r=qn(this.options.ticks.minRotation),s=(t?Math.sin(r):Math.cos(r))||.001,o=this._resolveTickFontOptions(0);return Math.ceil(n/Math.min(40,o.lineHeight/s))}getPixelForValue(t){return t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}Pe(kd,"id","linear"),Pe(kd,"defaults",{ticks:{callback:u0.formatters.numeric}});const Ea={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},sn=Object.keys(Ea);function Om(e,t){return e-t}function Tm(e,t){if(at(t))return null;const n=e._adapter,{parser:r,round:s,isoWeekday:o}=e._parseOpts;let i=t;return typeof r=="function"&&(i=r(i)),bn(i)||(i=typeof r=="string"?n.parse(i,r):n.parse(i)),i===null?null:(s&&(i=s==="week"&&(ia(o)||o===!0)?n.startOf(i,"isoWeek",o):n.startOf(i,s)),+i)}function Am(e,t,n,r){const s=sn.length;for(let o=sn.indexOf(e);o=sn.indexOf(n);o--){const i=sn[o];if(Ea[i].common&&e._adapter.diff(s,r,i)>=t-1)return i}return sn[n?sn.indexOf(n):0]}function P5(e){for(let t=sn.indexOf(e)+1,n=sn.length;t=t?n[r]:n[s];e[o]=!0}}function $5(e,t,n,r){const s=e._adapter,o=+s.startOf(t[0].value,r),i=t[t.length-1].value;let a,l;for(a=o;a<=i;a=+s.add(a,1,r))l=n[a],l>=0&&(t[l].major=!0);return t}function Im(e,t,n){const r=[],s={},o=t.length;let i,a;for(i=0;i+t.value))}initOffsets(t=[]){let n=0,r=0,s,o;this.options.offset&&t.length&&(s=this.getDecimalForValue(t[0]),t.length===1?n=1-s:n=(this.getDecimalForValue(t[1])-s)/2,o=this.getDecimalForValue(t[t.length-1]),t.length===1?r=o:r=(o-this.getDecimalForValue(t[t.length-2]))/2);const i=t.length<3?.5:.25;n=nn(n,0,i),r=nn(r,0,i),this._offsets={start:n,end:r,factor:1/(n+1+r)}}_generate(){const t=this._adapter,n=this.min,r=this.max,s=this.options,o=s.time,i=o.unit||Am(o.minUnit,n,r,this._getLabelCapacity(n)),a=Xe(s.ticks.stepSize,1),l=i==="week"?o.isoWeekday:!1,c=ia(l)||l===!0,d={};let u=n,f,g;if(c&&(u=+t.startOf(u,"isoWeek",l)),u=+t.startOf(u,c?"day":i),t.diff(r,n,i)>1e5*a)throw new Error(n+" and "+r+" are too far apart with stepSize of "+a+" "+i);const m=s.ticks.source==="data"&&this.getDataTimestamps();for(f=u,g=0;f+p)}getLabelForValue(t){const n=this._adapter,r=this.options.time;return r.tooltipFormat?n.format(t,r.tooltipFormat):n.format(t,r.displayFormats.datetime)}format(t,n){const s=this.options.time.displayFormats,o=this._unit,i=n||s[o];return this._adapter.format(t,i)}_tickFormatFunction(t,n,r,s){const o=this.options,i=o.ticks.callback;if(i)return ut(i,[t,n,r],this);const a=o.time.displayFormats,l=this._unit,c=this._majorUnit,d=l&&a[l],u=c&&a[c],f=r[n],g=c&&u&&f&&f.major;return this._adapter.format(t,s||(g?u:d))}generateTickLabels(t){let n,r,s;for(n=0,r=t.length;n0?a:1}getDataTimestamps(){let t=this._cache.data||[],n,r;if(t.length)return t;const s=this.getMatchingVisibleMetas();if(this._normalized&&s.length)return this._cache.data=s[0].controller.getAllParsedValues(this);for(n=0,r=s.length;n=e[r].pos&&t<=e[s].pos&&({lo:r,hi:s}=Xc(e,"pos",t)),{pos:o,time:a}=e[r],{pos:i,time:l}=e[s]):(t>=e[r].time&&t<=e[s].time&&({lo:r,hi:s}=Xc(e,"time",t)),{time:o,pos:a}=e[r],{time:i,pos:l}=e[s]);const c=i-o;return c?a+(l-a)*(t-o)/c:a}class Lm extends Ma{constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this._getTimestampsForTable(),n=this._table=this.buildLookupTable(t);this._minPos=Na(n,this.min),this._tableRange=Na(n,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:n,max:r}=this,s=[],o=[];let i,a,l,c,d;for(i=0,a=t.length;i=n&&c<=r&&s.push(c);if(s.length<2)return[{time:n,pos:0},{time:r,pos:1}];for(i=0,a=s.length;is-o)}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;const n=this.getDataTimestamps(),r=this.getLabelTimestamps();return n.length&&r.length?t=this.normalize(n.concat(r)):t=n.length?n:r,t=this._cache.all=t,t}getDecimalForValue(t){return(Na(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const n=this._offsets,r=this.getDecimalForPixel(t)/n.factor-n.end;return Na(this._table,r*this._tableRange+this._minPos,!0)}}Pe(Lm,"id","timeseries"),Pe(Lm,"defaults",Ma.defaults);const Pm="label";function $m(e,t){typeof e=="function"?e(t):e&&(e.current=t)}function F5(e,t){const n=e.options;n&&t&&Object.assign(n,t)}function Fm(e,t){e.labels=t}function Vm(e,t,n=Pm){const r=[];e.datasets=t.map(s=>{const o=e.datasets.find(i=>i[n]===s[n]);return!o||!s.data||r.includes(o)?{...s}:(r.push(o),Object.assign(o,s),o)})}function V5(e,t=Pm){const n={labels:[],datasets:[]};return Fm(n,e.labels),Vm(n,e.datasets,t),n}function z5(e,t){const{height:n=150,width:r=300,redraw:s=!1,datasetIdKey:o,type:i,data:a,options:l,plugins:c=[],fallbackContent:d,updateMode:u,...f}=e,g=v.useRef(null),m=v.useRef(null),p=()=>{g.current&&(m.current=new No(g.current,{type:i,data:V5(a,o),options:l&&{...l},plugins:c}),$m(t,m.current))},y=()=>{$m(t,null),m.current&&(m.current.destroy(),m.current=null)};return v.useEffect(()=>{!s&&m.current&&l&&F5(m.current,l)},[s,l]),v.useEffect(()=>{!s&&m.current&&Fm(m.current.config.data,a.labels)},[s,a.labels]),v.useEffect(()=>{!s&&m.current&&a.datasets&&Vm(m.current.config.data,a.datasets,o)},[s,a.datasets]),v.useEffect(()=>{m.current&&(s?(y(),setTimeout(p)):m.current.update(u))},[s,l,a.labels,a.datasets,u]),v.useEffect(()=>{m.current&&(y(),setTimeout(p))},[i]),v.useEffect(()=>(p(),()=>y()),[]),h.jsx("canvas",{ref:g,role:"img",height:n,width:r,...f,children:d})}const H5=v.forwardRef(z5);function zm(e,t){return No.register(t),v.forwardRef((n,r)=>h.jsx(H5,{...n,ref:r,type:e}))}const U5=zm("bar",ga),B5=zm("doughnut",wo);No.register(wd,kd,Sa,w5,Em,ym);const j5=({labels:e,datasets:t,height:n=200,showLegend:r=!1,showGrid:s=!1,showYGrid:o=!1,showYAxis:i=!1,className:a="",id:l,editorAttrs:c})=>{const d=v.useMemo(()=>({labels:e??[],datasets:(t??[]).map((m,p)=>({label:m.label,data:m.data,backgroundColor:m.backgroundColor||(p===0?"#7C3AED":"#DDD6FE"),borderRadius:m.borderRadius??4,barThickness:16,maxBarThickness:20,yAxisID:m.yAxisID??"y"}))}),[e,t]),u=v.useMemo(()=>(t??[]).some(m=>m.yAxisID==="y1"),[t]),f=v.useMemo(()=>({responsive:!0,maintainAspectRatio:!1,animation:{duration:750,easing:"easeOutQuart"},animations:{x:{duration:0},y:{from:m=>{if(m.type==="data")return m.chart.scales.y.getPixelForValue(0)}}},transitions:{active:{animation:{duration:200}},resize:{animation:{duration:0}}},plugins:{legend:{display:r,position:"top"},tooltip:{backgroundColor:"#1e293b",titleColor:"#fff",bodyColor:"#fff",padding:12,cornerRadius:8}},scales:{x:{grid:{display:s},border:{display:!1},ticks:{color:"#94a3b8",font:{size:11}}},y:{type:"linear",position:"left",grid:{display:o,color:"#e2e8f0"},border:{display:!1},ticks:{display:i,color:"#94a3b8",font:{size:11},padding:8},beginAtZero:!0,grace:"5%"},...u?{y1:{type:"linear",position:"right",grid:{display:!1},border:{display:!1},ticks:{display:i,color:"#94a3b8",font:{size:11},padding:8},beginAtZero:!0,grace:"5%"}}:{}}}),[r,s,o,i,u]),g=typeof n=="number"?n:/^\d+$/.test(String(n))?`${n}px`:n;return h.jsx("div",{className:`bar-chart-container ${a}`,style:{height:g},id:l,...c,children:h.jsx(U5,{data:d,options:f})})},W5=v.memo(j5,(e,t)=>JSON.stringify(e.labels)===JSON.stringify(t.labels)&&JSON.stringify(e.datasets)===JSON.stringify(t.datasets)&&e.height===t.height&&e.showLegend===t.showLegend&&e.showGrid===t.showGrid&&e.showYGrid===t.showYGrid&&e.showYAxis===t.showYAxis&&e.className===t.className&&e.id===t.id&&e.editorAttrs===t.editorAttrs);No.register(Oo,Em,ym);const G5=({data:e,centerLabel:t,centerValue:n,size:r=200,cutout:s="70%",showLegend:o=!1,className:i="",id:a,editorAttrs:l})=>{const c=v.useMemo(()=>({labels:(e??[]).map(f=>f.name),datasets:[{data:(e??[]).map(f=>f.value),backgroundColor:(e??[]).map(f=>f.color),borderWidth:0,hoverOffset:4}]}),[e]),d=v.useMemo(()=>({responsive:!0,maintainAspectRatio:!1,cutout:s,plugins:{legend:{display:o},tooltip:{backgroundColor:"#1e293b",titleColor:"#fff",bodyColor:"#fff",padding:12,cornerRadius:8,callbacks:{label:f=>` $${f.parsed.toLocaleString()}`}}}}),[s,o]),u=typeof r=="number"?r:/^\d+$/.test(String(r))?`${r}px`:r;return h.jsx("div",{className:`donut-chart-wrapper ${i}`,id:a,...l,children:h.jsxs("div",{className:"relative",style:{width:u,height:u},children:[h.jsx(B5,{data:c,options:d}),(t||n)&&h.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center pointer-events-none",children:[t&&h.jsx("span",{className:"text-xs text-slate-500 dark:text-slate-400",children:t}),n&&h.jsx("span",{className:"text-lg font-bold text-slate-900 dark:text-white",children:n})]})]})})},Y5=({id:e,className:t,style:n,children:r,editorAttrs:s})=>h.jsx("div",{id:e,className:t,style:n,...s,children:r}),K5=({children:e,cols:t=1,responsive:n,gap:r,rowGap:s,colGap:o,autoRows:i,autoCols:a,flow:l="row",className:c="",style:d,onClick:u,id:f,editorAttrs:g})=>{const m=["grid"];if(t&&m.push(`grid-cols-${t}`),n&&(n.sm&&m.push(`sm:grid-cols-${n.sm}`),n.md&&m.push(`md:grid-cols-${n.md}`),n.lg&&m.push(`lg:grid-cols-${n.lg}`),n.xl&&m.push(`xl:grid-cols-${n.xl}`),n["2xl"]&&m.push(`2xl:grid-cols-${n["2xl"]}`)),r!==void 0&&r>0&&m.push(`gap-${r}`),s!==void 0&&s>0&&m.push(`gap-y-${s}`),o!==void 0&&o>0&&m.push(`gap-x-${o}`),i){const y={auto:"auto-rows-auto",min:"auto-rows-min",max:"auto-rows-max",fr:"auto-rows-fr"};m.push(y[i])}if(a){const y={auto:"auto-cols-auto",min:"auto-cols-min",max:"auto-cols-max",fr:"auto-cols-fr"};m.push(y[a])}const p={row:"grid-flow-row",col:"grid-flow-col",dense:"grid-flow-dense","row-dense":"grid-flow-row-dense","col-dense":"grid-flow-col-dense"};return m.push(p[l]),c&&m.push(c),h.jsx(I,{className:m.join(" "),style:d,onClick:u,id:f,...g,children:e})},X5=({children:e,direction:t="row",justify:n="start",align:r="stretch",wrap:s="nowrap",gap:o=0,grow:i=!1,shrink:a=!0,className:l="",style:c,onClick:d,id:u,editorAttrs:f})=>{const g=["flex"],m={row:"flex-row","row-reverse":"flex-row-reverse",col:"flex-col","col-reverse":"flex-col-reverse"};g.push(m[t]);const p={wrap:"flex-wrap",nowrap:"flex-nowrap","wrap-reverse":"flex-wrap-reverse"};g.push(p[s]);const y={start:"justify-start",end:"justify-end",center:"justify-center",between:"justify-between",around:"justify-around",evenly:"justify-evenly"};g.push(y[n]);const b={start:"items-start",end:"items-end",center:"items-center",baseline:"items-baseline",stretch:"items-stretch"};return g.push(b[r]),o>0&&g.push(`gap-${o}`),i===!0?g.push("flex-grow"):typeof i=="number"&&i>0&&g.push(`flex-grow-${i}`),a===!1?g.push("shrink-0"):a===!0?g.push("flex-shrink"):typeof a=="number"&&a>0&&g.push(`flex-shrink-${a}`),l&&g.push(l),h.jsx(I,{className:g.join(" "),style:c,onClick:d,id:u,...f,children:e})},q5=({title:e,subtitle:t,children:n,padding:r="none",background:s="none",maxWidth:o,centered:i=!1,border:a=!1,shadow:l="none",rounded:c=!1,className:d="",style:u,onClick:f,id:g,editorAttrs:m})=>{const p=[],y={none:"",sm:"p-2",md:"p-4",lg:"p-6",xl:"p-8"};y[r]&&p.push(y[r]);const b={none:"",white:"bg-white dark:bg-gray-700",gray:"bg-gray-50 dark:bg-gray-800",primary:"bg-blue-50 dark:bg-blue-900/20",secondary:"bg-gray-50 dark:bg-gray-800"};if(s!=="none"&&p.push(b[s]),o){const x={sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg",xl:"max-w-xl","2xl":"max-w-2xl","4xl":"max-w-4xl","6xl":"max-w-6xl","7xl":"max-w-7xl",full:"max-w-full"};p.push(x[o])}i&&p.push("mx-auto"),a&&p.push("border","border-gray-200","dark:border-gray-700");const _={none:"",sm:"shadow-sm",md:"shadow-md",lg:"shadow-lg",xl:"shadow-xl"};return l!=="none"&&p.push(_[l]),c&&p.push("rounded-lg"),d&&p.push(d),h.jsxs(Dd,{className:p.join(" "),style:u,onClick:f,id:g,...m,children:[(e||t)&&h.jsxs("div",{className:"mb-4",children:[e&&h.jsx("h2",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:e}),t&&h.jsx("p",{className:"mt-1 text-sm text-gray-600 dark:text-gray-400",children:t})]}),n]})},Z5=({leftWidth:e="250px",rightWidth:t="300px",leftSlot:n,centerSlot:r,rightSlot:s,className:o="",style:i,id:a,editorAttrs:l})=>{const c=`flex flex-row w-full h-full ${o}`.trim(),d={width:e,flexShrink:0},u={flex:1,minWidth:0},f={width:t,flexShrink:0};return h.jsxs(I,{className:c,style:i,id:a,...l,children:[h.jsx(I,{className:"flex flex-col",style:d,children:n}),h.jsx(I,{className:"flex flex-col",style:u,children:r}),h.jsx(I,{className:"flex flex-col",style:f,children:s})]})},Q5={language:"json",theme:"vs-dark",options:{automaticLayout:!0,minimap:{enabled:!0},scrollBeyondLastLine:!1,fontSize:14,tabSize:2,formatOnPaste:!0,formatOnType:!0,wordWrap:"on",folding:!0,lineNumbers:"on",renderWhitespace:"selection"}},Hm=[{uri:`${window.location.origin}/schemas/layout.json`,fileMatch:["*layout*.json"],schema:{type:"object",properties:{version:{type:"string"},endpoint:{type:"string"},components:{type:"array"}},required:["version","endpoint","components"]}}],J5={"vs/nls":{availableLanguages:{"*":"ko"}}};function R5(e){e.languages.json.jsonDefaults.setDiagnosticsOptions({validate:!0,schemas:Hm,enableSchemaRequest:!0,schemaValidation:"error",schemaRequest:"error"})}const eT={identifier:"sirsoft-admin_basic",vendor:"sirsoft",name:{ko:"Admin Basic",en:"Admin Basic"},version:"1.0.8",license:"MIT",description:{ko:"그누보드7 기본 관리자 템플릿",en:"Gnuboard7 default admin template"},type:"admin",locales:["ko","en"],author:{name:"sirsoft",email:"contact@sirsoft.com",url:"https://sirsoft.com"},release_date:"2026-05-15",g7_version:">=7.0.10",dependencies:{modules:{},plugins:{}},assets:{css:["assets/css/main.css","assets/css/ui-system.css"],js:["dist/components.js"],fonts:["assets/fonts/"],images:["assets/images/"]},components:{basic:["a","button","checkbox","div","form","h1","h2","h3","hr","icon","img","input","label","li","nav","p","section","select","span","svg","table","tbody","td","textarea","th","thead","tr","ul"],composite:["action-menu","admin-footer","admin-header","admin-sidebar","alert-dialog","breadcrumb","card","confirm-dialog","data-grid","dialog","dropdown","empty-state","filter-group","icon-button","loading-spinner","modal","page-header","pagination","product-card","search-bar","stat-card","status-badge","tab-navigation","template-card","toast"],layout:["container","flex","grid","section"]},preview:{thumbnail:"preview/thumbnail.png",screenshots:["preview/screenshot1.png","preview/screenshot2.png"]},error_config:{layouts:{401:"errors/401",403:"errors/403",404:"errors/404",500:"errors/500",503:"errors/503",maintenance:"errors/maintenance"}},github_url:"https://github.com/gnuboard/g7-template-sirsoft-admin_basic",github_changelog_url:"https://github.com/gnuboard/g7-template-sirsoft-admin_basic/blob/main/CHANGELOG.md",externals:[{id:"fontawesome",type:"style",asset:"vendor/font-awesome/6.4.0/css/all.inlined.css"},{id:"pretendard",type:"webfont",asset:"vendor/pretendard/1.3.9/pretendard-variable.css"},{id:"flag-icons",type:"style",asset:"vendor/flag-icons/7.2.3/css/flag-icons.min.css"}]},Jn=window.G7Core?.createLogger?.("Handler:SetTheme")??{log:(...e)=>console.log("[Handler:SetTheme]",...e),warn:(...e)=>console.warn("[Handler:SetTheme]",...e),error:(...e)=>console.error("[Handler:SetTheme]",...e)},Cd=["auto","light","dark"],Um="g7_color_scheme",tT=e=>e==="auto"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":e,Oa=e=>{const t=tT(e);document.documentElement.setAttribute("data-theme",t),t==="dark"?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark")};function nT(){try{const e=localStorage.getItem(Um),t=e&&Cd.includes(e)?e:"auto";Oa(t);try{window.G7Core?.state?.setGlobal?.({theme:t})}catch(n){Jn.warn("Failed to set global theme state:",n)}Jn.log("Initial theme applied:",t)}catch(e){Jn.warn("Failed to load initial theme:",e),Oa("auto")}}async function rT(e,t){const n=e?.target;if(n&&typeof n=="string"&&Cd.includes(n)){Oa(n);try{window.G7Core?.state?.setGlobal?.({theme:n})}catch(r){Jn.warn("Failed to set global theme state:",r)}return}nT()}async function sT(e,t){let n;if(e?.target&&typeof e.target=="string"&&!e.target.includes("{{")&&(n=e.target),!n||typeof n!="string"){Jn.warn("Invalid theme:",n);return}if(!Cd.includes(n)){Jn.warn("Unsupported theme:",n);return}const r=n;try{localStorage.setItem(Um,r)}catch(s){Jn.error("Failed to save theme to localStorage:",s);return}Oa(r);try{window.G7Core?.state?.setGlobal?.({theme:r})}catch(s){Jn.warn("Failed to set global theme state:",s)}Jn.log("Theme changed to:",r)}const ws=window.G7Core?.createLogger?.("Handler:InitMenu")??{log:(...e)=>console.log("[Handler:InitMenu]",...e),warn:(...e)=>console.warn("[Handler:InitMenu]",...e),error:(...e)=>console.error("[Handler:InitMenu]",...e)};function Bm(e,t){for(const n of e){if(n.slug===t)return n;if(n.children&&n.children.length>0){const r=Bm(n.children,t);if(r)return r}}return null}function jm(e){return new URLSearchParams(window.location.search).get(e)}function oT(e){return window.G7Core?.state?.getDataSource?.(e)}function iT(e){const t=[e,e?.data,e?.data?.data];for(const n of t)if(Array.isArray(n)&&n.length>0)return n;return null}async function aT(e,t=30,n=100){for(let r=0;rsetTimeout(o,n))}return null}async function lT(e){const t=window.G7Core;try{const r=(await t?.api?.get?.(`/api/admin/menus/${e.id}`))?.data;if(r&&typeof r=="object"&&r.id===e.id)return r}catch(n){ws.warn("[initMenuFromUrl] Failed to hydrate menu detail:",n)}return e}async function cT(e,t){const n=window.G7Core,r=jm("menu"),s=jm("mode");if(!r){ws.log("[initMenuFromUrl] No menu parameter in URL");return}if(!n?.state?.set){ws.warn("[initMenuFromUrl] G7Core.state.set not available");return}const o=await aT("menus");if(!o){ws.warn("[initMenuFromUrl] menus data not available after waiting");return}const i=Bm(o,r);if(!i){ws.warn("[initMenuFromUrl] Menu not found with slug:",r);return}const a=await lT(i),l=s==="edit"?"edit":"view";n.state.set({selectedMenuId:a.id,selectedMenu:a,panelMode:l}),l==="edit"&&n.state.set({formData:{name:a.name,slug:a.slug,url:a.url,icon:a.icon,parent_id:a.parent_id,extension_type:a.extension_type,extension_identifier:a.extension_identifier,is_active:a.is_active,roles:(a.roles??[]).map(c=>c.id)}}),ws.log("[initMenuFromUrl] Menu initialized from URL:",{slug:r,mode:l,menuId:i.id})}const Zt=window.G7Core?.createLogger?.("Handler:FilterVisibility")??{log:(...e)=>console.log("[Handler:FilterVisibility]",...e),warn:(...e)=>console.warn("[Handler:FilterVisibility]",...e),error:(...e)=>console.error("[Handler:FilterVisibility]",...e)},Ta="g7_filter_visibility_";async function dT(e,t){const{storageKey:n,defaultFilters:r=[],stateKey:s="visibleFilters"}=e?.params||{};if(!n){Zt.warn("[initFilterVisibility] storageKey is required");return}const o=`${Ta}${n}`;try{const i=localStorage.getItem(o);let a;if(i){const l=JSON.parse(i);Array.isArray(l)?(a=l,Zt.log(`[initFilterVisibility] Loaded from localStorage: ${a.join(", ")}`)):(a=r,Zt.warn("[initFilterVisibility] Invalid saved data format, using defaults"))}else a=r,Zt.log(`[initFilterVisibility] No saved data, using defaults: ${r.join(", ")}`);t?.setState&&t.setState({[s]:a})}catch(i){Zt.error("[initFilterVisibility] Failed to load filter visibility:",i),t?.setState&&t.setState({[s]:r})}}async function uT(e,t){const{storageKey:n,filters:r}=e?.params||{};if(!n){Zt.warn("[saveFilterVisibility] storageKey is required");return}if(!Array.isArray(r)){Zt.warn("[saveFilterVisibility] filters must be an array");return}const s=`${Ta}${n}`;try{localStorage.setItem(s,JSON.stringify(r)),Zt.log(`[saveFilterVisibility] Saved to localStorage: ${r.join(", ")}`)}catch(o){Zt.error("[saveFilterVisibility] Failed to save filter visibility:",o)}}async function fT(e,t){const{storageKey:n,filterId:r,stateKey:s="visibleFilters"}=e?.params||{};if(!n||!r){Zt.warn("[toggleFilterVisibility] storageKey and filterId are required");return}const o=t?.state?.[s]||[];let i;o.includes(r)?i=o.filter(l=>l!==r):i=[...o,r],t?.setState&&t.setState({[s]:i});const a=`${Ta}${n}`;try{localStorage.setItem(a,JSON.stringify(i)),Zt.log(`[toggleFilterVisibility] Toggled ${r}: ${i.join(", ")}`)}catch(l){Zt.error("[toggleFilterVisibility] Failed to save:",l)}}async function hT(e,t){const{storageKey:n,defaultFilters:r=[],stateKey:s="visibleFilters"}=e?.params||{};if(!n){Zt.warn("[resetFilterVisibility] storageKey is required");return}const o=`${Ta}${n}`;try{localStorage.setItem(o,JSON.stringify(r)),t?.setState&&t.setState({[s]:r}),Zt.log(`[resetFilterVisibility] Reset to defaults: ${r.join(", ")}`)}catch(i){Zt.error("[resetFilterVisibility] Failed to reset:",i)}}const ks=window.G7Core?.createLogger?.("Handler:MultilingualTag")??{log:(...e)=>console.log("[Handler:MultilingualTag]",...e),warn:(...e)=>console.warn("[Handler:MultilingualTag]",...e),error:(...e)=>console.error("[Handler:MultilingualTag]",...e)};async function gT(e,t){const n=window.G7Core;if(!n){ks.error("G7Core not available");return}const r=n.state?.getGlobal?.()?.multilingualTagEdit;if(!r){ks.warn("No multilingualTagEdit state found"),n.modal?.close?.();return}const{fieldName:s,editingIndex:o,values:i,statePath:a,currentTags:l}=r;if(!Object.values(i||{}).some(g=>typeof g=="string"&&g.trim()!=="")){ks.warn("No values to save"),n.modal?.close?.(),Sd(n);return}const d=Array.isArray(l)?l:[];let u;o==null?u=[...d,i]:u=d.map((g,m)=>m===o?i:g);const f=a||(s?.startsWith("form.")?s:`form.${s}`);n.state?.setParentLocal?.({[f]:u}),n.modal?.close?.(),Sd(n)}async function pT(e,t){const n=window.G7Core;if(!n){ks.error("G7Core not available");return}n.modal?.close?.(),Sd(n)}async function mT(e,t){const n=window.G7Core;if(!n){ks.error("G7Core not available");return}const r=e?.params?.locale;if(!r){ks.warn("No locale specified");return}const s=t?.event;let o="";s?.target?.value!==void 0?o=s.target.value:s?.value!==void 0&&(o=s.value);const a=(n.state?.getGlobal?.()||{}).multilingualTagEdit||{},l={...a.values||{},[r]:o};n.dispatch?.({handler:"setState",params:{target:"global",multilingualTagEdit:{...a,values:l}}})}function Sd(e){e.dispatch?.({handler:"setState",params:{target:"global",multilingualTagEdit:null}})}function Wm(e){const t=e.getFullYear(),n=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0"),s=String(e.getHours()).padStart(2,"0"),o=String(e.getMinutes()).padStart(2,"0"),i=String(e.getSeconds()).padStart(2,"0");return`${t}-${n}-${r}T${s}:${o}:${i}`}function bT(e){const t=new Date,n=new Date(t.getFullYear(),t.getMonth(),t.getDate(),23,59,59),r=Wm(n),s=new Date(t.getFullYear(),t.getMonth(),t.getDate(),0,0,0);switch(e){case"today":break;case"week":s.setDate(s.getDate()-6);break;case"month":s.setMonth(s.getMonth()-1);break;case"3months":s.setMonth(s.getMonth()-3);break;case"6months":s.setMonth(s.getMonth()-6);break;case"1year":s.setFullYear(s.getFullYear()-1);break}return{startDate:Wm(s),endDate:r}}function yT(e){const{preset:t}=e.params||{preset:"today"},{startDate:n,endDate:r}=bT(t);return{startDate:n,endDate:r,preset:t}}const Ao=window.G7Core?.createLogger?.("Handler:Sidebar")??{log:(...e)=>console.log("[Handler:Sidebar]",...e),warn:(...e)=>console.warn("[Handler:Sidebar]",...e),error:(...e)=>console.error("[Handler:Sidebar]",...e)},Gm="g7_admin_sidebar_collapsed";function Ym(){try{return localStorage.getItem(Gm)==="1"}catch{return!1}}function vT(e){try{localStorage.setItem(Gm,e?"1":"0")}catch(t){Ao.error("Failed to save sidebar state to localStorage:",t)}try{window.G7Core?.state?.setGlobal?.({sidebarCollapsed:e})}catch(t){Ao.warn("Failed to set global sidebar state:",t)}}function Km(){const e=Ym();try{window.G7Core?.state?.setGlobal?.({sidebarCollapsed:e})}catch(t){Ao.warn("Failed to restore sidebar state:",t)}Ao.log("Initial sidebar collapsed state restored:",e)}async function xT(e,t){Km()}async function wT(e,t){const r=!(()=>{try{return!!window.G7Core?.state?.getGlobal?.()?.sidebarCollapsed}catch{return Ym()}})();vT(r),Ao.log("Sidebar collapsed toggled to:",r)}const _d=window.G7Core?.createLogger?.("Handler:DownloadAttachment")??{log:(...e)=>console.log("[Handler:DownloadAttachment]",...e),warn:(...e)=>console.warn("[Handler:DownloadAttachment]",...e),error:(...e)=>console.error("[Handler:DownloadAttachment]",...e)};async function kT(e,t){const n=window.G7Core,{url:r,filename:s}=e?.params||{};if(!r){_d.warn("다운로드 URL 이 없어 요청을 건너뜁니다.");return}if(!n?.api?.get){_d.error("G7Core.api.get 이 초기화되지 않아 다운로드를 실행할 수 없습니다.");return}try{const o=await n.api.get(r,{responseType:"blob"});if(o){const i=URL.createObjectURL(o),a=document.createElement("a");a.href=i,a.download=s||"",document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(i)}}catch(o){_d.error("첨부파일 다운로드 실패",o),n?.toast?.error?.(n?.t?.("common.download_failed")??"Download failed")}}const Aa=window.G7Core?.createLogger?.("Handler:DetectAssetUrlMode")??{log:(...e)=>console.log("[Handler:DetectAssetUrlMode]",...e),warn:(...e)=>console.warn("[Handler:DetectAssetUrlMode]",...e),error:(...e)=>console.error("[Handler:DetectAssetUrlMode]",...e)},CT="G7_ASSET_PROBE_OK";async function Xm(e){try{const t=await fetch(e,{cache:"no-store",credentials:"omit"});if(!t.ok)return!1;const n=t.headers.get("content-type")??"";return/javascript|ecmascript/i.test(n)?(await t.text()).includes(CT):!1}catch{return!1}}async function qm(){const[e,t]=await Promise.all([Xm("/api/system/asset-probe.js"),Xm("/api/system/asset-probe")]);return e&&t?"extension":!e&&t?"extensionless":"unavailable"}function ST(){return window.G7Config?.settings?.general?.asset_url_mode??"extension"}async function _T(e){try{const t=await qm();if(t==="unavailable")return;const n=ST();if(t===n)return;window.G7Core?.state?.setGlobal?.({assetUrlModeDrift:{detected:t,stored:n}})}catch(t){Aa.warn("자산 URL 방식 대조 실패 (대시보드 동작에는 영향 없음):",t)}}async function ET(e,t){const n=window.G7Core,r=t?.setState??n?.state?.setLocal,s=o=>{typeof r=="function"?r({asset_url_mode_detect_status:o}):Aa.warn("setState 를 찾지 못해 감지 상태를 폼에 반영하지 못했습니다")};try{s("detecting");const o=await qm();if(o==="unavailable"){s("unavailable");return}typeof r=="function"?r({"general.asset_url_mode":o,asset_url_mode_detect_status:o}):Aa.warn("setState 를 찾지 못해 감지 결과를 폼에 반영하지 못했습니다")}catch(o){Aa.error("자산 URL 방식 감지 실패:",o),s("unavailable")}}const Da={detectAssetUrlMode:ET,checkAssetUrlModeDrift:_T,setTheme:sT,initTheme:rT,scrollToSection:su,initMenuFromUrl:cT,initFilterVisibility:dT,saveFilterVisibility:uT,toggleFilterVisibility:fT,resetFilterVisibility:hT,saveMultilingualTag:gT,cancelMultilingualTag:pT,updateMultilingualTagValue:mT,setDateRange:yT,toggleSidebar:wT,initSidebar:xT,downloadAttachment:kT},Do=window.G7Core?.createLogger?.("Template:sirsoft-admin_basic:IdentityLauncher")??{log:(...e)=>console.log("[Template:sirsoft-admin_basic:IdentityLauncher]",...e),warn:(...e)=>console.warn("[Template:sirsoft-admin_basic:IdentityLauncher]",...e),error:(...e)=>console.error("[Template:sirsoft-admin_basic:IdentityLauncher]",...e)};function MT(){const t=window.G7Core?.api?.getToken?.()??null;return t?{Authorization:`Bearer ${t}`}:{}}function NT(){try{const e=typeof window<"u"?window.localStorage?.getItem("g7_locale"):null;return e?{"Accept-Language":e}:{}}catch{return{}}}async function OT(e,t=null){const n={purpose:e.purpose};e.provider_id&&(n.provider_id=e.provider_id),t&&(n.target=t);const r=e.challenge_start_url||"/api/identity/challenges",s=await fetch(r,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json",Accept:"application/json",...NT(),...MT()},body:JSON.stringify(n)}),o=await s.json().catch(()=>null);if(!s.ok||!o?.success){const a=o?.message??`Challenge 시작 실패 (HTTP ${s.status})`;throw new Error(a)}const i=o.data??o;return{id:i.id,expires_at:i.expires_at,render_hint:i.render_hint??e.render_hint??"text_code",public_payload:i.public_payload,redirect_url:i.redirect_url,max_attempts:typeof i.max_attempts=="number"?i.max_attempts:void 0}}async function TT(e){const t=window.G7Core,n=t?.identity;if(!t?.dispatch||!t?.state||!n)return Do.error("G7Core 또는 G7Core.identity 가 초기화되지 않아 launcher 를 실행할 수 없습니다."),{status:"failed",failureCode:"G7_NOT_READY"};if(e.render_hint==="external_redirect"||e.redirect_url)return n.redirectExternally(e);const r=e.target&&(e.target.email||e.target.phone)?e.target:null;let s;try{s=await OT(e,r)}catch(m){Do.error("Challenge 시작 실패:",m);try{await t.dispatch({handler:"toast",params:{type:"error",message:m instanceof Error?m.message:"본인인증 시작에 실패했습니다."}})}catch{}return{status:"failed",failureCode:"CHALLENGE_START_FAILED",reason:m instanceof Error?m.message:String(m)}}if(s.redirect_url)return n.redirectExternally({...e,render_hint:"external_redirect",redirect_url:s.redirect_url});const o=s.expires_at?new Date(s.expires_at).getTime():0,i=o>0?Math.max(0,Math.floor((o-Date.now())/1e3)):0,a=typeof s.max_attempts=="number"?s.max_attempts:0;t.state.set({identityChallenge:{policy_key:e.policy_key,purpose:e.purpose,provider_id:e.provider_id??null,render_hint:s.render_hint,challenge_id:s.id,expires_at:s.expires_at,public_payload:s.public_payload??{},target:r,code:"",error:null,attempts:0,maxAttempts:a,remainingSeconds:i,resendCooldown:0}});let l=o,c=0;const d=window.setInterval(()=>{const m=l>0?Math.max(0,Math.floor((l-Date.now())/1e3)):0;c=Math.max(0,c-1),t.state.set({identityChallenge:{remainingSeconds:m,resendCooldown:c}})},1e3);let u=null;try{u=t.state.subscribe?.(m=>{const p=m?.identityChallenge?.expires_at;if(typeof p=="string"){const b=new Date(p).getTime();Number.isFinite(b)&&b!==l&&(l=b)}const y=m?.identityChallenge?.resendCooldown;typeof y=="number"&&y>c&&(c=y)})??null}catch{}const f=n.createDeferred();try{await t.dispatch({handler:"openModal",target:"identity-challenge-modal"})}catch(m){return Do.error("openModal 실패 — 풀페이지로 폴백:",m),window.clearInterval(d),u?.(),n.redirectExternally({...e,render_hint:"external_redirect",redirect_url:`/admin/identity/challenge?challenge_id=${encodeURIComponent(s.id)}&return=${encodeURIComponent(window.location.href)}`})}const g=await f;return window.clearInterval(d),u?.(),g}function AT(){const e=window.G7Core?.identity;if(!e?.setLauncher){Do.warn("G7Core.identity 가 아직 초기화되지 않아 launcher 등록을 건너뜁니다. 코어 부트스트랩 순서를 확인하세요.");return}e.setLauncher(TT),Do.log("IDV launcher registered (sirsoft-admin_basic)")}function DT(e){const t=e.icons;return Array.isArray(t)?t.filter(n=>!!n&&typeof n=="object"&&typeof n.value=="string"):[]}function IT(e,t){const n=e.label;return typeof n=="string"?n.startsWith("$t:")?t(n.slice(3)):n:e.value}function LT(e,t,n){if(n==="")return!0;const r=n.toLowerCase();return e.value.toLowerCase().includes(r)||t.toLowerCase().includes(r)?!0:(e.keywords??[]).some(s=>s.toLowerCase().includes(r))}function PT({entry:e}){const t=e.preview;return t?.html?h.jsx("span",{className:"g7le-icon-preview",dangerouslySetInnerHTML:{__html:t.html},style:Md}):t?.className?h.jsx("span",{className:`g7le-icon-preview ${t.className}`,style:Md}):h.jsx("i",{className:`fas fa-${e.value}`,style:Md,"aria-hidden":"true"})}function $T({control:e,value:t,onChange:n,t:r}){const s=DT(e),o=t==null?"":String(t),i=typeof e.iconColumns=="number"?e.iconColumns:6,a=e.iconSearchPlaceholder,l=typeof a=="string"&&a.startsWith("$t:")?r(a.slice(3)):r("layout_editor.icon_picker.search_placeholder"),[c,d]=v.useState("");if(s.length===0)return h.jsx("div",{className:"g7le-widget g7le-widget--icon-picker","data-testid":"g7le-widget-icon-picker",style:Zm,children:h.jsx("input",{type:"text",className:"g7le-widget g7le-widget--icon-free","data-testid":"g7le-widget-icon-picker-free",value:o,placeholder:r("layout_editor.icon_picker.free_input_hint"),onChange:g=>n(g.target.value===""?void 0:g.target.value),style:Qm})});const u=g=>IT(g,r),f=s.filter(g=>LT(g,u(g),c));return h.jsxs("div",{className:"g7le-widget g7le-widget--icon-picker","data-testid":"g7le-widget-icon-picker",style:Zm,children:[h.jsx("input",{type:"text",className:"g7le-widget g7le-widget--icon-search","data-testid":"g7le-widget-icon-picker-search",value:c,placeholder:l,onChange:g=>d(g.target.value),style:Qm}),h.jsxs("div",{className:"g7le-icon-grid","data-testid":"g7le-widget-icon-picker-grid",style:{...FT,gridTemplateColumns:`repeat(${i}, minmax(0, 1fr))`},children:[h.jsx("button",{type:"button","data-testid":"g7le-icon-cell-none",title:r("layout_editor.icon_picker.none"),onClick:()=>n(void 0),"aria-pressed":o==="",style:o===""?Jm:Ed,children:h.jsx("span",{style:VT,children:"—"})}),f.map(g=>{const m=g.value===o;return h.jsx("button",{type:"button","data-testid":`g7le-icon-cell-${g.value}`,title:u(g),"aria-pressed":m,onClick:()=>n(g.value),style:m?Jm:Ed,children:h.jsx(PT,{entry:g})},g.value)})]}),f.length===0&&h.jsx("div",{"data-testid":"g7le-widget-icon-picker-empty",style:zT,children:r("layout_editor.icon_picker.no_results")})]})}const Zm={display:"flex",flexDirection:"column",gap:6,width:"100%"},Qm={padding:"5px 8px",fontSize:12,border:"1px solid #cbd5e1",borderRadius:6,width:"100%"},FT={display:"grid",gap:4,maxHeight:220,overflowY:"auto",padding:2},Ed={display:"flex",alignItems:"center",justifyContent:"center",minHeight:34,padding:4,border:"1px solid #e2e8f0",borderRadius:6,background:"#fff",cursor:"pointer"},Jm={...Ed,border:"2px solid #2563eb",background:"#eff6ff"},Md={display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:16,lineHeight:1},VT={fontSize:10,color:"#475569",fontFamily:"monospace",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:"100%"},zT={fontSize:11,color:"#94a3b8",fontStyle:"italic",padding:"4px 2px"},Rm=130,An=20;function HT(e){const t=e?.arrayProp;return typeof t=="string"&&t?t:"tabs"}function UT(e){let t=0;for(const n of e){const r=typeof n.id=="number"?n.id:Number(n.id);Number.isFinite(r)&&r>t&&(t=r)}return t+1}function BT({node:e,params:t,cellBoxes:n,t:r,onPatchNode:s}){const o=HT(t),i=v.useMemo(()=>{const g=(e.props??{})[o];return typeof g=="string"||!Array.isArray(g)?null:g},[e,o]),a=v.useMemo(()=>{const g=new Map,m=`props.${o}.`;for(const p of n??[]){if(!p.path.startsWith(m))continue;const y=Number(p.path.slice(m.length));Number.isInteger(y)&&g.set(y,{top:p.top,left:p.left,width:p.width,height:p.height})}return g},[n,o]),l=v.useCallback(g=>{const m=e.props??{};s({...e,props:{...m,[o]:g}})},[e,o,s]),c=v.useCallback(g=>{if(!i)return;const p={id:UT(i),label:r("editor.tabnav_inplace.new_tab")},y=i.slice();y.splice(g,0,p),l(y)},[i,l,r]),d=v.useCallback(g=>{if(!i)return;const m=i.slice();m.splice(g,1),l(m)},[i,l]),u=v.useCallback((g,m)=>{if(!i)return;const p=g+m;if(p<0||p>=i.length)return;const y=i.slice(),[b]=y.splice(g,1);y.splice(p,0,b),l(y)},[i,l]);if(!i||a.size===0)return null;const f={position:"absolute",width:An,height:An,display:"flex",alignItems:"center",justifyContent:"center",fontSize:12,lineHeight:1,border:"1px solid rgba(0,0,0,0.15)",borderRadius:4,background:"#ffffff",color:"#1f2937",cursor:"pointer",boxShadow:"0 1px 2px rgba(0,0,0,0.18)",pointerEvents:"auto",padding:0,zIndex:Rm};return h.jsx("div",{className:"g7le-tabnav-inplace","data-testid":"g7le-tabnav-inplace",style:{position:"absolute",inset:0,pointerEvents:"none",zIndex:Rm},children:i.map((g,m)=>{const p=a.get(m);if(!p)return null;const y=p.left+p.width;return h.jsxs("div",{"data-testid":`g7le-tabnav-aff-${m}`,children:[h.jsx("button",{type:"button","data-testid":`g7le-tabnav-remove-${m}`,title:r("editor.tabnav_inplace.remove"),"aria-label":r("editor.tabnav_inplace.remove"),style:{...f,left:y-An/2,top:p.top-An/2,color:"#b91c1c"},onClick:b=>{b.preventDefault(),b.stopPropagation(),d(m)},children:"✕"}),m>0&&h.jsx("button",{type:"button","data-testid":`g7le-tabnav-move-left-${m}`,title:r("editor.tabnav_inplace.move_left"),"aria-label":r("editor.tabnav_inplace.move_left"),style:{...f,left:p.left,top:p.top+p.height-An/2},onClick:b=>{b.preventDefault(),b.stopPropagation(),u(m,-1)},children:"◀"}),m{b.preventDefault(),b.stopPropagation(),u(m,1)},children:"▶"}),m===0&&h.jsx("button",{type:"button","data-testid":"g7le-tabnav-add-0",title:r("editor.tabnav_inplace.add"),"aria-label":r("editor.tabnav_inplace.add"),style:{...f,left:p.left-An,top:p.top+p.height/2-An/2,color:"#15803d"},onClick:b=>{b.preventDefault(),b.stopPropagation(),c(0)},children:"+"}),h.jsx("button",{type:"button","data-testid":`g7le-tabnav-add-${m+1}`,title:r("editor.tabnav_inplace.add"),"aria-label":r("editor.tabnav_inplace.add"),style:{...f,left:y-An/2,top:p.top+p.height/2-An/2,color:"#15803d"},onClick:b=>{b.preventDefault(),b.stopPropagation(),c(m+1)},children:"+"})]},`tab-aff-${g.id}-${m}`)})})}const Nd=window.G7Core?.createLogger?.("Template:sirsoft-admin_basic:EditorWidgets")??{log:(...e)=>console.log("[Template:sirsoft-admin_basic:EditorWidgets]",...e),warn:(...e)=>console.warn("[Template:sirsoft-admin_basic:EditorWidgets]",...e)};function jT(){if(typeof window>"u")return;const e=window.G7Core?.layoutEditor;if(!e?.registerWidget){Nd.warn("G7Core.layoutEditor 미노출 — icon-picker 위젯 등록 보류");return}e.registerWidget("icon-picker",$T),Nd.log("편집기 위젯 'icon-picker' 등록됨(Font Awesome 검색 그리드)"),e.registerCanvasOverlay&&(e.registerCanvasOverlay("tabnav",BT),Nd.log("편집기 캔버스 오버레이 'tabnav' 등록됨(TabNavigation 탭 인플레이스)"))}const Od=window.G7Core?.createLogger?.("Template:sirsoft-admin_basic")??{log:(...e)=>console.log("[Template:sirsoft-admin_basic]",...e),warn:(...e)=>console.warn("[Template:sirsoft-admin_basic]",...e),error:(...e)=>console.error("[Template:sirsoft-admin_basic]",...e)};typeof window<"u"&&(window.G7TemplateHandlers=Da);function eb(){if(typeof window<"u"){let e=0;const t=50,n=()=>{const r=window.G7Core?.getActionDispatcher?.();r?(Object.entries(Da).forEach(([s,o])=>{r.registerHandler(s,o)}),Od.log(`${Object.keys(Da).length} custom handler(s) registered:`,Object.keys(Da)),AT(),Km()):(e++,e<=t?(Od.warn(`ActionDispatcher not found, retrying... (${e}/${t})`),setTimeout(n,100)):Od.error("Failed to register handlers: ActionDispatcher not available after maximum retries"))};document.readyState==="complete"?n():window.addEventListener("load",n)}}return jT(),eb(),R.A=Fr,R.Accordion=ic,R.ActionMenu=Cs,R.AdminFooter=Ey,R.AdminHeader=ky,R.AdminSidebar=wy,R.Alert=hu,R.AlertDialog=fy,R.Badge=Vd,R.BarChart=W5,R.Breadcrumb=cu,R.Button=oe,R.Card=mb,R.CardGrid=qb,R.CategoryTree=XS,R.Checkbox=Cn,R.ChipCheckbox=LE,R.Code=fb,R.CodeEditor=Wv,R.ColumnSelector=Qv,R.ConfirmDialog=au,R.Container=Y5,R.DataGrid=jb,R.Dialog=iu,R.Div=I,R.DonutChart=G5,R.Dropdown=Qb,R.DropdownButton=PE,R.DropdownMenuItem=$E,R.DynamicFieldList=YE,R.EmptyState=yy,R.ExtensionBadge=ah,R.FileInput=Td,R.FileUploader=Op,R.FilterGroup=ty,R.FilterVisibilitySelector=NE,R.Flex=X5,R.Form=Ha,R.FormField=QE,R.Fragment=gb,R.Grid=K5,R.H1=Fa,R.H2=er,R.H3=$r,R.H4=Ad,R.Hr=pb,R.HtmlContent=el,R.HtmlEditor=SE,R.I=gt,R.Icon=re,R.IconButton=cy,R.IconName=de,R.IconSelect=BS,R.ImageGallery=Gi,R.Img=kn,R.Input=wt,R.Label=on,R.LanguageSelector=_y,R.LayoutEditorHeader=Ay,R.LayoutFileList=Dy,R.LayoutHistoryPanel=Yv,R.LayoutWarnings=ME,R.Li=za,R.LoadingSpinner=xy,R.LoginForm=Kv,R.Modal=Bo,R.MultilingualInput=Ga,R.MultilingualLocaleContext=zc,R.MultilingualTabPanel=ZE,R.MultilingualTagInput=Zk,R.Nav=Po,R.NotificationCenter=Cy,R.Ol=ob,R.Optgroup=cb,R.Option=lb,R.P=yt,R.PageHeader=My,R.PageLoading=tx,R.PageTransitionIndicator=Rv,R.Pagination=$o,R.PermissionTree=YS,R.Pre=hb,R.ProductCard=Jb,R.RadioGroup=wE,R.RichSelect=DE,R.SearchBar=ey,R.SearchableDropdown=Qk,R.Section=Dd,R.SectionHeader=Oy,R.SectionLayout=q5,R.Select=Vr,R.SlotContainer=AE,R.SortableMenuItem=Zh,R.SortableMenuList=HS,R.Span=Q,R.StatCard=Rb,R.StatusBadge=Fo,R.Svg=Wn,R.TabNavigation=ny,R.TabNavigationScroll=ay,R.Table=Ua,R.TagInput=Kk,R.TagSelect=Jk,R.Tbody=ja,R.Td=Jt,R.TemplateCard=Ty,R.Textarea=Rn,R.Tfoot=Wa,R.Th=zr,R.Thead=Ba,R.ThemeToggle=qv,R.ThreeColumnLayout=Z5,R.Toast=my,R.Toggle=Ya,R.Tr=tr,R.Ul=Va,R.UnifiedIcon=ub,R.UserProfile=Sy,R.VersionList=Tu,R.configureJSONLanguageService=R5,R.defaultJSONSchemas=Hm,R.executeImageDownload=Lc,R.initTemplate=eb,R.jsonEditorDefaults=Q5,R.monacoInitOptions=J5,R.templateMetadata=eT,R.useCurrentMultilingualLocale=$p,R.useImageGallery=pp,Object.defineProperty(R,Symbol.toStringTag,{value:"Module"}),R})({},ReactJSXRuntime,React,ReactDOM); +`):e}function _5(e,t){const{element:n,datasetIndex:r,index:s}=t,o=e.getDatasetMeta(r).controller,{label:i,value:a}=o.getLabelAndValue(s);return{chart:e,label:i,parsed:o.getParsed(s),raw:e.data.datasets[r].data[s],formattedValue:a,dataset:o.getDataset(),dataIndex:s,datasetIndex:r,element:n}}function eb(e,t){const n=e.chart.ctx,{body:r,footer:s,title:o}=e,{boxWidth:i,boxHeight:a}=t,l=Rt(t.bodyFont),c=Rt(t.titleFont),d=Rt(t.footerFont),u=o.length,f=s.length,g=r.length,m=_n(t.padding);let p=m.height,y=0,b=r.reduce((M,S)=>M+S.before.length+S.lines.length+S.after.length,0);if(b+=e.beforeBody.length+e.afterBody.length,u&&(p+=u*c.lineHeight+(u-1)*t.titleSpacing+t.titleMarginBottom),b){const M=t.displayColors?Math.max(a,l.lineHeight):l.lineHeight;p+=g*M+(b-g)*l.lineHeight+(b-1)*t.bodySpacing}f&&(p+=t.footerMarginTop+f*d.lineHeight+(f-1)*t.footerSpacing);let _=0;const x=function(M){y=Math.max(y,n.measureText(M).width+_)};return n.save(),n.font=c.string,at(e.title,x),n.font=l.string,at(e.beforeBody.concat(e.afterBody),x),_=t.displayColors?i+2+t.boxPadding:0,at(r,M=>{at(M.before,x),at(M.lines,x),at(M.after,x)}),_=0,n.font=d.string,at(e.footer,x),n.restore(),y+=m.width,{width:y,height:p}}function E5(e,t){const{y:n,height:r}=t;return ne.height-r/2?"bottom":"center"}function M5(e,t,n,r){const{x:s,width:o}=r,i=n.caretSize+n.caretPadding;if(e==="left"&&s+o+i>t.width||e==="right"&&s-o-i<0)return!0}function N5(e,t,n,r){const{x:s,width:o}=n,{width:i,chartArea:{left:a,right:l}}=e;let c="center";return r==="center"?c=s<=(a+l)/2?"left":"right":s<=o/2?c="left":s>=i-o/2&&(c="right"),M5(c,e,t,n)&&(c="center"),c}function tb(e,t,n){const r=n.yAlign||t.yAlign||E5(e,n);return{xAlign:n.xAlign||t.xAlign||N5(e,t,n,r),yAlign:r}}function O5(e,t){let{x:n,width:r}=e;return t==="right"?n-=r:t==="center"&&(n-=r/2),n}function T5(e,t,n){let{y:r,height:s}=e;return t==="top"?r+=n:t==="bottom"?r-=s+n:r-=s/2,r}function nb(e,t,n,r){const{caretSize:s,caretPadding:o,cornerRadius:i}=e,{xAlign:a,yAlign:l}=n,c=s+o,{topLeft:d,topRight:u,bottomLeft:f,bottomRight:g}=Ns(i);let m=O5(t,a);const p=T5(t,l,c);return l==="center"?a==="left"?m+=c:a==="right"&&(m-=c):a==="left"?m-=Math.max(d,f)+s:a==="right"&&(m+=Math.max(u,g)+s),{x:cn(m,0,r.width-t.width),y:cn(p,0,r.height-t.height)}}function Ha(e,t,n){const r=_n(n.padding);return t==="center"?e.x+e.width/2:t==="right"?e.x+e.width-r.right:e.x+r.left}function rb(e){return qn([],or(e))}function A5(e,t,n){return Os(e,{tooltip:t,tooltipItems:n,type:"tooltip"})}function sb(e,t){const n=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return n?e.override(n):e}const ob={beforeTitle:nr,title(e){if(e.length>0){const t=e[0],n=t.chart.data.labels,r=n?n.length:0;if(this&&this.options&&this.options.mode==="dataset")return t.dataset.label||"";if(t.label)return t.label;if(r>0&&t.dataIndex"u"?ob[t].call(n,r):s}class Bd extends Yr{constructor(t){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const t=this._cachedAnimations;if(t)return t;const n=this.chart,r=this.options.setContext(this.getContext()),s=r.enabled&&n.options.animation&&r.animations,o=new cm(this.chart,s);return s._cacheable&&(this._cachedAnimations=Object.freeze(o)),o}getContext(){return this.$context||(this.$context=A5(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,n){const{callbacks:r}=n,s=dn(r,"beforeTitle",this,t),o=dn(r,"title",this,t),i=dn(r,"afterTitle",this,t);let a=[];return a=qn(a,or(s)),a=qn(a,or(o)),a=qn(a,or(i)),a}getBeforeBody(t,n){return rb(dn(n.callbacks,"beforeBody",this,t))}getBody(t,n){const{callbacks:r}=n,s=[];return at(t,o=>{const i={before:[],lines:[],after:[]},a=sb(r,o);qn(i.before,or(dn(a,"beforeLabel",this,o))),qn(i.lines,dn(a,"label",this,o)),qn(i.after,or(dn(a,"afterLabel",this,o))),s.push(i)}),s}getAfterBody(t,n){return rb(dn(n.callbacks,"afterBody",this,t))}getFooter(t,n){const{callbacks:r}=n,s=dn(r,"beforeFooter",this,t),o=dn(r,"footer",this,t),i=dn(r,"afterFooter",this,t);let a=[];return a=qn(a,or(s)),a=qn(a,or(o)),a=qn(a,or(i)),a}_createItems(t){const n=this._active,r=this.chart.data,s=[],o=[],i=[];let a=[],l,c;for(l=0,c=n.length;lt.filter(d,u,f,r))),t.itemSort&&(a=a.sort((d,u)=>t.itemSort(d,u,r))),at(a,d=>{const u=sb(t.callbacks,d);s.push(dn(u,"labelColor",this,d)),o.push(dn(u,"labelPointStyle",this,d)),i.push(dn(u,"labelTextColor",this,d))}),this.labelColors=s,this.labelPointStyles=o,this.labelTextColors=i,this.dataPoints=a,a}update(t,n){const r=this.options.setContext(this.getContext()),s=this._active;let o,i=[];if(!s.length)this.opacity!==0&&(o={opacity:0});else{const a=Go[r.position].call(this,s,this._eventPosition);i=this._createItems(r),this.title=this.getTitle(i,r),this.beforeBody=this.getBeforeBody(i,r),this.body=this.getBody(i,r),this.afterBody=this.getAfterBody(i,r),this.footer=this.getFooter(i,r);const l=this._size=eb(this,r),c=Object.assign({},a,l),d=tb(this.chart,r,c),u=nb(r,c,d,this.chart);this.xAlign=d.xAlign,this.yAlign=d.yAlign,o={opacity:1,x:u.x,y:u.y,width:l.width,height:l.height,caretX:a.x,caretY:a.y}}this._tooltipItems=i,this.$context=void 0,o&&this._resolveAnimations().update(this,o),t&&r.external&&r.external.call(this,{chart:this.chart,tooltip:this,replay:n})}drawCaret(t,n,r,s){const o=this.getCaretPosition(t,r,s);n.lineTo(o.x1,o.y1),n.lineTo(o.x2,o.y2),n.lineTo(o.x3,o.y3)}getCaretPosition(t,n,r){const{xAlign:s,yAlign:o}=this,{caretSize:i,cornerRadius:a}=r,{topLeft:l,topRight:c,bottomLeft:d,bottomRight:u}=Ns(a),{x:f,y:g}=t,{width:m,height:p}=n;let y,b,_,x,M,S;return o==="center"?(M=g+p/2,s==="left"?(y=f,b=y-i,x=M+i,S=M-i):(y=f+m,b=y+i,x=M-i,S=M+i),_=y):(s==="left"?b=f+Math.max(l,d)+i:s==="right"?b=f+m-Math.max(c,u)-i:b=this.caretX,o==="top"?(x=g,M=x-i,y=b-i,_=b+i):(x=g+p,M=x+i,y=b+i,_=b-i),S=x),{x1:y,x2:b,x3:_,y1:x,y2:M,y3:S}}drawTitle(t,n,r){const s=this.title,o=s.length;let i,a,l;if(o){const c=As(r.rtl,this.x,this.width);for(t.x=Ha(this,r.titleAlign,r),n.textAlign=c.textAlign(r.titleAlign),n.textBaseline="middle",i=Rt(r.titleFont),a=r.titleSpacing,n.fillStyle=r.titleColor,n.font=i.string,l=0;l_!==0)?(t.beginPath(),t.fillStyle=o.multiKeyBackground,Sa(t,{x:p,y:m,w:c,h:l,radius:b}),t.fill(),t.stroke(),t.fillStyle=i.backgroundColor,t.beginPath(),Sa(t,{x:y,y:m+1,w:c-2,h:l-2,radius:b}),t.fill()):(t.fillStyle=o.multiKeyBackground,t.fillRect(p,m,c,l),t.strokeRect(p,m,c,l),t.fillStyle=i.backgroundColor,t.fillRect(y,m+1,c-2,l-2))}t.fillStyle=this.labelTextColors[r]}drawBody(t,n,r){const{body:s}=this,{bodySpacing:o,bodyAlign:i,displayColors:a,boxHeight:l,boxWidth:c,boxPadding:d}=r,u=Rt(r.bodyFont);let f=u.lineHeight,g=0;const m=As(r.rtl,this.x,this.width),p=function(C){n.fillText(C,m.x(t.x+g),t.y+f/2),t.y+=f+o},y=m.textAlign(i);let b,_,x,M,S,k,N;for(n.textAlign=i,n.textBaseline="middle",n.font=u.string,t.x=Ha(this,y,r),n.fillStyle=r.bodyColor,at(this.beforeBody,p),g=a&&y!=="right"?i==="center"?c/2+d:c+2+d:0,M=0,k=s.length;M0&&n.stroke()}_updateAnimationTarget(t){const n=this.chart,r=this.$animations,s=r&&r.x,o=r&&r.y;if(s||o){const i=Go[t.position].call(this,this._active,this._eventPosition);if(!i)return;const a=this._size=eb(this,t),l=Object.assign({},i,this._size),c=tb(n,t,l),d=nb(t,l,c,n);(s._to!==d.x||o._to!==d.y)&&(this.xAlign=c.xAlign,this.yAlign=c.yAlign,this.width=a.width,this.height=a.height,this.caretX=i.x,this.caretY=i.y,this._resolveAnimations().update(this,d))}}_willRender(){return!!this.opacity}draw(t){const n=this.options.setContext(this.getContext());let r=this.opacity;if(!r)return;this._updateAnimationTarget(n);const s={width:this.width,height:this.height},o={x:this.x,y:this.y};r=Math.abs(r)<.001?0:r;const i=_n(n.padding),a=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;n.enabled&&a&&(t.save(),t.globalAlpha=r,this.drawBackground(o,t,s,n),im(t,n.textDirection),o.y+=i.top,this.drawTitle(o,t,n),this.drawBody(o,t,n),this.drawFooter(o,t,n),am(t,n.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,n){const r=this._active,s=t.map(({datasetIndex:a,index:l})=>{const c=this.chart.getDatasetMeta(a);if(!c)throw new Error("Cannot find a dataset at index "+a);return{datasetIndex:a,element:c.data[l],index:l}}),o=!ba(r,s),i=this._positionChanged(s,n);(o||i)&&(this._active=s,this._eventPosition=n,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,n,r=!0){if(n&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const s=this.options,o=this._active||[],i=this._getActiveElements(t,o,n,r),a=this._positionChanged(i,t),l=n||!ba(i,o)||a;return l&&(this._active=i,(s.enabled||s.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,n))),l}_getActiveElements(t,n,r,s){const o=this.options;if(t.type==="mouseout")return[];if(!s)return n.filter(a=>this.chart.data.datasets[a.datasetIndex]&&this.chart.getDatasetMeta(a.datasetIndex).controller.getParsed(a.index)!==void 0);const i=this.chart.getElementsAtEventForMode(t,o.mode,o,r);return o.reverse&&i.reverse(),i}_positionChanged(t,n){const{caretX:r,caretY:s,options:o}=this,i=Go[o.position].call(this,t,n);return i!==!1&&(r!==i.x||s!==i.y)}}$e(Bd,"positioners",Go);var ib={id:"tooltip",_element:Bd,positioners:Go,afterInit(e,t,n){n&&(e.tooltip=new Bd({chart:e,options:n}))},beforeUpdate(e,t,n){e.tooltip&&e.tooltip.initialize(n)},reset(e,t,n){e.tooltip&&e.tooltip.initialize(n)},afterDraw(e){const t=e.tooltip;if(t&&t._willRender()){const n={tooltip:t};if(e.notifyPlugins("beforeTooltipDraw",{...n,cancelable:!0})===!1)return;t.draw(e.ctx),e.notifyPlugins("afterTooltipDraw",n)}},afterEvent(e,t){if(e.tooltip){const n=t.replay;e.tooltip.handleEvent(t.event,n,t.inChartArea)&&(t.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(e,t)=>t.bodyFont.size,boxWidth:(e,t)=>t.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:ob},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:e=>e!=="filter"&&e!=="itemSort"&&e!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]};const D5=(e,t,n,r)=>(typeof t=="string"?(n=e.push(t)-1,r.unshift({index:n,label:t})):isNaN(t)&&(n=null),n);function I5(e,t,n,r){const s=e.indexOf(t);if(s===-1)return D5(e,t,n,r);const o=e.lastIndexOf(t);return s!==o?n:s}const L5=(e,t)=>e===null?null:cn(Math.round(e),0,t);function ab(e){const t=this.getLabels();return e>=0&&en.length-1?null:this.getPixelForValue(n[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}}$e(jd,"id","category"),$e(jd,"defaults",{ticks:{callback:ab}});function P5(e,t){const n=[],{bounds:s,step:o,min:i,max:a,precision:l,count:c,maxTicks:d,maxDigits:u,includeBounds:f}=e,g=o||1,m=d-1,{min:p,max:y}=t,b=!ft(i),_=!ft(a),x=!ft(c),M=(y-p)/(u+1);let S=D0((y-p)/m/g)*g,k,N,C,w;if(S<1e-14&&!b&&!_)return[{value:p},{value:y}];w=Math.ceil(y/S)-Math.floor(p/S),w>m&&(S=D0(w*S/m/g)*g),ft(l)||(k=Math.pow(10,l),S=Math.ceil(S*k)/k),s==="ticks"?(N=Math.floor(p/S)*S,C=Math.ceil(y/S)*S):(N=p,C=y),b&&_&&o&&IN((a-i)/o,S/1e3)?(w=Math.round(Math.min((a-i)/S,d)),S=(a-i)/w,N=i,C=a):x?(N=b?i:N,C=_?a:C,w=c-1,S=(C-N)/w):(w=(C-N)/S,xa(w,Math.round(w),S/1e3)?w=Math.round(w):w=Math.ceil(w));const E=Math.max(I0(S),I0(N));k=Math.pow(10,ft(l)?E:l),N=Math.round(N*k)/k,C=Math.round(C*k)/k;let T=0;for(b&&(f&&N!==i?(n.push({value:i}),Na)break;n.push({value:P})}return _&&f&&C!==a?n.length&&xa(n[n.length-1].value,a,lb(a,M,e))?n[n.length-1].value=a:n.push({value:a}):(!_||C===a)&&n.push({value:C}),n}function lb(e,t,{horizontal:n,minRotation:r}){const s=rr(r),o=(n?Math.sin(s):Math.cos(s))||.001,i=.75*t*(""+e).length;return Math.min(t/o,i)}class $5 extends Is{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(t,n){return ft(t)||(typeof t=="number"||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const{beginAtZero:t}=this.options,{minDefined:n,maxDefined:r}=this.getUserBounds();let{min:s,max:o}=this;const i=l=>s=n?s:l,a=l=>o=r?o:l;if(t){const l=xr(s),c=xr(o);l<0&&c<0?a(0):l>0&&c>0&&i(0)}if(s===o){let l=o===0?1:Math.abs(o*.05);a(o+l),t||i(s-l)}this.min=s,this.max=o}getTickLimit(){const t=this.options.ticks;let{maxTicksLimit:n,stepSize:r}=t,s;return r?(s=Math.ceil(this.max/r)-Math.floor(this.min/r)+1,s>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${r} would result generating up to ${s} ticks. Limiting to 1000.`),s=1e3)):(s=this.computeTickLimit(),n=n||11),n&&(s=Math.min(n,s)),s}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,n=t.ticks;let r=this.getTickLimit();r=Math.max(2,r);const s={maxTicks:r,bounds:t.bounds,min:t.min,max:t.max,precision:n.precision,step:n.stepSize,count:n.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:n.minRotation||0,includeBounds:n.includeBounds!==!1},o=this._range||this,i=P5(s,o);return t.bounds==="ticks"&&LN(i,this,"value"),t.reverse?(i.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),i}configure(){const t=this.ticks;let n=this.min,r=this.max;if(super.configure(),this.options.offset&&t.length){const s=(r-n)/Math.max(t.length-1,1)/2;n-=s,r+=s}this._startValue=n,this._endValue=r,this._valueRange=r-n}getLabelForValue(t){return vd(t,this.chart.options.locale,this.options.ticks.format)}}class Wd extends $5{determineDataLimits(){const{min:t,max:n}=this.getMinMax(!0);this.min=Sn(t)?t:0,this.max=Sn(n)?n:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),n=t?this.width:this.height,r=rr(this.options.ticks.minRotation),s=(t?Math.sin(r):Math.cos(r))||.001,o=this._resolveTickFontOptions(0);return Math.ceil(n/Math.min(40,o.lineHeight/s))}getPixelForValue(t){return t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}$e(Wd,"id","linear"),$e(Wd,"defaults",{ticks:{callback:G0.formatters.numeric}});const Ua={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},un=Object.keys(Ua);function cb(e,t){return e-t}function db(e,t){if(ft(t))return null;const n=e._adapter,{parser:r,round:s,isoWeekday:o}=e._parseOpts;let i=t;return typeof r=="function"&&(i=r(i)),Sn(i)||(i=typeof r=="string"?n.parse(i,r):n.parse(i)),i===null?null:(s&&(i=s==="week"&&(wa(o)||o===!0)?n.startOf(i,"isoWeek",o):n.startOf(i,s)),+i)}function ub(e,t,n,r){const s=un.length;for(let o=un.indexOf(e);o=un.indexOf(n);o--){const i=un[o];if(Ua[i].common&&e._adapter.diff(s,r,i)>=t-1)return i}return un[n?un.indexOf(n):0]}function z5(e){for(let t=un.indexOf(e)+1,n=un.length;t=t?n[r]:n[s];e[o]=!0}}function V5(e,t,n,r){const s=e._adapter,o=+s.startOf(t[0].value,r),i=t[t.length-1].value;let a,l;for(a=o;a<=i;a=+s.add(a,1,r))l=n[a],l>=0&&(t[l].major=!0);return t}function hb(e,t,n){const r=[],s={},o=t.length;let i,a;for(i=0;i+t.value))}initOffsets(t=[]){let n=0,r=0,s,o;this.options.offset&&t.length&&(s=this.getDecimalForValue(t[0]),t.length===1?n=1-s:n=(this.getDecimalForValue(t[1])-s)/2,o=this.getDecimalForValue(t[t.length-1]),t.length===1?r=o:r=(o-this.getDecimalForValue(t[t.length-2]))/2);const i=t.length<3?.5:.25;n=cn(n,0,i),r=cn(r,0,i),this._offsets={start:n,end:r,factor:1/(n+1+r)}}_generate(){const t=this._adapter,n=this.min,r=this.max,s=this.options,o=s.time,i=o.unit||ub(o.minUnit,n,r,this._getLabelCapacity(n)),a=Je(s.ticks.stepSize,1),l=i==="week"?o.isoWeekday:!1,c=wa(l)||l===!0,d={};let u=n,f,g;if(c&&(u=+t.startOf(u,"isoWeek",l)),u=+t.startOf(u,c?"day":i),t.diff(r,n,i)>1e5*a)throw new Error(n+" and "+r+" are too far apart with stepSize of "+a+" "+i);const m=s.ticks.source==="data"&&this.getDataTimestamps();for(f=u,g=0;f+p)}getLabelForValue(t){const n=this._adapter,r=this.options.time;return r.tooltipFormat?n.format(t,r.tooltipFormat):n.format(t,r.displayFormats.datetime)}format(t,n){const s=this.options.time.displayFormats,o=this._unit,i=n||s[o];return this._adapter.format(t,i)}_tickFormatFunction(t,n,r,s){const o=this.options,i=o.ticks.callback;if(i)return bt(i,[t,n,r],this);const a=o.time.displayFormats,l=this._unit,c=this._majorUnit,d=l&&a[l],u=c&&a[c],f=r[n],g=c&&u&&f&&f.major;return this._adapter.format(t,s||(g?u:d))}generateTickLabels(t){let n,r,s;for(n=0,r=t.length;n0?a:1}getDataTimestamps(){let t=this._cache.data||[],n,r;if(t.length)return t;const s=this.getMatchingVisibleMetas();if(this._normalized&&s.length)return this._cache.data=s[0].controller.getAllParsedValues(this);for(n=0,r=s.length;n=e[r].pos&&t<=e[s].pos&&({lo:r,hi:s}=md(e,"pos",t)),{pos:o,time:a}=e[r],{pos:i,time:l}=e[s]):(t>=e[r].time&&t<=e[s].time&&({lo:r,hi:s}=md(e,"time",t)),{time:o,pos:a}=e[r],{time:i,pos:l}=e[s]);const c=i-o;return c?a+(l-a)*(t-o)/c:a}class gb extends Ba{constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this._getTimestampsForTable(),n=this._table=this.buildLookupTable(t);this._minPos=ja(n,this.min),this._tableRange=ja(n,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:n,max:r}=this,s=[],o=[];let i,a,l,c,d;for(i=0,a=t.length;i=n&&c<=r&&s.push(c);if(s.length<2)return[{time:n,pos:0},{time:r,pos:1}];for(i=0,a=s.length;is-o)}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;const n=this.getDataTimestamps(),r=this.getLabelTimestamps();return n.length&&r.length?t=this.normalize(n.concat(r)):t=n.length?n:r,t=this._cache.all=t,t}getDecimalForValue(t){return(ja(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const n=this._offsets,r=this.getDecimalForPixel(t)/n.factor-n.end;return ja(this._table,r*this._tableRange+this._minPos,!0)}}$e(gb,"id","timeseries"),$e(gb,"defaults",Ba.defaults);const pb="label";function mb(e,t){typeof e=="function"?e(t):e&&(e.current=t)}function H5(e,t){const n=e.options;n&&t&&Object.assign(n,t)}function bb(e,t){e.labels=t}function yb(e,t,n=pb){const r=[];e.datasets=t.map(s=>{const o=e.datasets.find(i=>i[n]===s[n]);return!o||!s.data||r.includes(o)?{...s}:(r.push(o),Object.assign(o,s),o)})}function U5(e,t=pb){const n={labels:[],datasets:[]};return bb(n,e.labels),yb(n,e.datasets,t),n}function B5(e,t){const{height:n=150,width:r=300,redraw:s=!1,datasetIdKey:o,type:i,data:a,options:l,plugins:c=[],fallbackContent:d,updateMode:u,...f}=e,g=v.useRef(null),m=v.useRef(null),p=()=>{g.current&&(m.current=new jo(g.current,{type:i,data:U5(a,o),options:l&&{...l},plugins:c}),mb(t,m.current))},y=()=>{mb(t,null),m.current&&(m.current.destroy(),m.current=null)};return v.useEffect(()=>{!s&&m.current&&l&&H5(m.current,l)},[s,l]),v.useEffect(()=>{!s&&m.current&&bb(m.current.config.data,a.labels)},[s,a.labels]),v.useEffect(()=>{!s&&m.current&&a.datasets&&yb(m.current.config.data,a.datasets,o)},[s,a.datasets]),v.useEffect(()=>{m.current&&(s?(y(),setTimeout(p)):m.current.update(u))},[s,l,a.labels,a.datasets,u]),v.useEffect(()=>{m.current&&(y(),setTimeout(p))},[i]),v.useEffect(()=>(p(),()=>y()),[]),h.jsx("canvas",{ref:g,role:"img",height:n,width:r,...f,children:d})}const j5=v.forwardRef(B5);function vb(e,t){return jo.register(t),v.forwardRef((n,r)=>h.jsx(j5,{...n,ref:r,type:e}))}const W5=vb("bar",Oa),G5=vb("doughnut",$o);jo.register(jd,Wd,Va,S5,ib,Jm);const Y5=({labels:e,datasets:t,height:n=200,showLegend:r=!1,showGrid:s=!1,showYGrid:o=!1,showYAxis:i=!1,className:a="",id:l,editorAttrs:c})=>{const d=v.useMemo(()=>({labels:e??[],datasets:(t??[]).map((m,p)=>({label:m.label,data:m.data,backgroundColor:m.backgroundColor||(p===0?"#7C3AED":"#DDD6FE"),borderRadius:m.borderRadius??4,barThickness:16,maxBarThickness:20,yAxisID:m.yAxisID??"y"}))}),[e,t]),u=v.useMemo(()=>(t??[]).some(m=>m.yAxisID==="y1"),[t]),f=v.useMemo(()=>({responsive:!0,maintainAspectRatio:!1,animation:{duration:750,easing:"easeOutQuart"},animations:{x:{duration:0},y:{from:m=>{if(m.type==="data")return m.chart.scales.y.getPixelForValue(0)}}},transitions:{active:{animation:{duration:200}},resize:{animation:{duration:0}}},plugins:{legend:{display:r,position:"top"},tooltip:{backgroundColor:"#1e293b",titleColor:"#fff",bodyColor:"#fff",padding:12,cornerRadius:8}},scales:{x:{grid:{display:s},border:{display:!1},ticks:{color:"#94a3b8",font:{size:11}}},y:{type:"linear",position:"left",grid:{display:o,color:"#e2e8f0"},border:{display:!1},ticks:{display:i,color:"#94a3b8",font:{size:11},padding:8},beginAtZero:!0,grace:"5%"},...u?{y1:{type:"linear",position:"right",grid:{display:!1},border:{display:!1},ticks:{display:i,color:"#94a3b8",font:{size:11},padding:8},beginAtZero:!0,grace:"5%"}}:{}}}),[r,s,o,i,u]),g=typeof n=="number"?n:/^\d+$/.test(String(n))?`${n}px`:n;return h.jsx("div",{className:`bar-chart-container ${a}`,style:{height:g},id:l,...c,children:h.jsx(W5,{data:d,options:f})})},K5=v.memo(Y5,(e,t)=>JSON.stringify(e.labels)===JSON.stringify(t.labels)&&JSON.stringify(e.datasets)===JSON.stringify(t.datasets)&&e.height===t.height&&e.showLegend===t.showLegend&&e.showGrid===t.showGrid&&e.showYGrid===t.showYGrid&&e.showYAxis===t.showYAxis&&e.className===t.className&&e.id===t.id&&e.editorAttrs===t.editorAttrs);jo.register(Wo,ib,Jm);const X5=({data:e,centerLabel:t,centerValue:n,size:r=200,cutout:s="70%",showLegend:o=!1,className:i="",id:a,editorAttrs:l})=>{const c=v.useMemo(()=>({labels:(e??[]).map(f=>f.name),datasets:[{data:(e??[]).map(f=>f.value),backgroundColor:(e??[]).map(f=>f.color),borderWidth:0,hoverOffset:4}]}),[e]),d=v.useMemo(()=>({responsive:!0,maintainAspectRatio:!1,cutout:s,plugins:{legend:{display:o},tooltip:{backgroundColor:"#1e293b",titleColor:"#fff",bodyColor:"#fff",padding:12,cornerRadius:8,callbacks:{label:f=>` $${f.parsed.toLocaleString()}`}}}}),[s,o]),u=typeof r=="number"?r:/^\d+$/.test(String(r))?`${r}px`:r;return h.jsx("div",{className:`donut-chart-wrapper ${i}`,id:a,...l,children:h.jsxs("div",{className:"relative",style:{width:u,height:u},children:[h.jsx(G5,{data:c,options:d}),(t||n)&&h.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center pointer-events-none",children:[t&&h.jsx("span",{className:"text-xs text-slate-500 dark:text-slate-400",children:t}),n&&h.jsx("span",{className:"text-lg font-bold text-slate-900 dark:text-white",children:n})]})]})})},q5=({id:e,className:t,style:n,children:r,editorAttrs:s})=>h.jsx("div",{id:e,className:t,style:n,...s,children:r}),Z5=({children:e,cols:t=1,responsive:n,gap:r,rowGap:s,colGap:o,autoRows:i,autoCols:a,flow:l="row",className:c="",style:d,onClick:u,id:f,editorAttrs:g})=>{const m=["grid"];if(t&&m.push(`grid-cols-${t}`),n&&(n.sm&&m.push(`sm:grid-cols-${n.sm}`),n.md&&m.push(`md:grid-cols-${n.md}`),n.lg&&m.push(`lg:grid-cols-${n.lg}`),n.xl&&m.push(`xl:grid-cols-${n.xl}`),n["2xl"]&&m.push(`2xl:grid-cols-${n["2xl"]}`)),r!==void 0&&r>0&&m.push(`gap-${r}`),s!==void 0&&s>0&&m.push(`gap-y-${s}`),o!==void 0&&o>0&&m.push(`gap-x-${o}`),i){const y={auto:"auto-rows-auto",min:"auto-rows-min",max:"auto-rows-max",fr:"auto-rows-fr"};m.push(y[i])}if(a){const y={auto:"auto-cols-auto",min:"auto-cols-min",max:"auto-cols-max",fr:"auto-cols-fr"};m.push(y[a])}const p={row:"grid-flow-row",col:"grid-flow-col",dense:"grid-flow-dense","row-dense":"grid-flow-row-dense","col-dense":"grid-flow-col-dense"};return m.push(p[l]),c&&m.push(c),h.jsx(I,{className:m.join(" "),style:d,onClick:u,id:f,...g,children:e})},Q5=({children:e,direction:t="row",justify:n="start",align:r="stretch",wrap:s="nowrap",gap:o=0,grow:i=!1,shrink:a=!0,className:l="",style:c,onClick:d,id:u,editorAttrs:f})=>{const g=["flex"],m={row:"flex-row","row-reverse":"flex-row-reverse",col:"flex-col","col-reverse":"flex-col-reverse"};g.push(m[t]);const p={wrap:"flex-wrap",nowrap:"flex-nowrap","wrap-reverse":"flex-wrap-reverse"};g.push(p[s]);const y={start:"justify-start",end:"justify-end",center:"justify-center",between:"justify-between",around:"justify-around",evenly:"justify-evenly"};g.push(y[n]);const b={start:"items-start",end:"items-end",center:"items-center",baseline:"items-baseline",stretch:"items-stretch"};return g.push(b[r]),o>0&&g.push(`gap-${o}`),i===!0?g.push("flex-grow"):typeof i=="number"&&i>0&&g.push(`flex-grow-${i}`),a===!1?g.push("shrink-0"):a===!0?g.push("flex-shrink"):typeof a=="number"&&a>0&&g.push(`flex-shrink-${a}`),l&&g.push(l),h.jsx(I,{className:g.join(" "),style:c,onClick:d,id:u,...f,children:e})},J5=({title:e,subtitle:t,children:n,padding:r="none",background:s="none",maxWidth:o,centered:i=!1,border:a=!1,shadow:l="none",rounded:c=!1,className:d="",style:u,onClick:f,id:g,editorAttrs:m})=>{const p=[],y={none:"",sm:"p-2",md:"p-4",lg:"p-6",xl:"p-8"};y[r]&&p.push(y[r]);const b={none:"",white:"bg-white dark:bg-gray-700",gray:"bg-gray-50 dark:bg-gray-800",primary:"bg-blue-50 dark:bg-blue-900/20",secondary:"bg-gray-50 dark:bg-gray-800"};if(s!=="none"&&p.push(b[s]),o){const x={sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg",xl:"max-w-xl","2xl":"max-w-2xl","4xl":"max-w-4xl","6xl":"max-w-6xl","7xl":"max-w-7xl",full:"max-w-full"};p.push(x[o])}i&&p.push("mx-auto"),a&&p.push("border","border-gray-200","dark:border-gray-700");const _={none:"",sm:"shadow-sm",md:"shadow-md",lg:"shadow-lg",xl:"shadow-xl"};return l!=="none"&&p.push(_[l]),c&&p.push("rounded-lg"),d&&p.push(d),h.jsxs(iu,{className:p.join(" "),style:u,onClick:f,id:g,...m,children:[(e||t)&&h.jsxs("div",{className:"mb-4",children:[e&&h.jsx("h2",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:e}),t&&h.jsx("p",{className:"mt-1 text-sm text-gray-600 dark:text-gray-400",children:t})]}),n]})},R5=({leftWidth:e="250px",rightWidth:t="300px",leftSlot:n,centerSlot:r,rightSlot:s,className:o="",style:i,id:a,editorAttrs:l})=>{const c=`flex flex-row w-full h-full ${o}`.trim(),d={width:e,flexShrink:0},u={flex:1,minWidth:0},f={width:t,flexShrink:0};return h.jsxs(I,{className:c,style:i,id:a,...l,children:[h.jsx(I,{className:"flex flex-col",style:d,children:n}),h.jsx(I,{className:"flex flex-col",style:u,children:r}),h.jsx(I,{className:"flex flex-col",style:f,children:s})]})},eA={language:"json",theme:"vs-dark",options:{automaticLayout:!0,minimap:{enabled:!0},scrollBeyondLastLine:!1,fontSize:14,tabSize:2,formatOnPaste:!0,formatOnType:!0,wordWrap:"on",folding:!0,lineNumbers:"on",renderWhitespace:"selection"}},xb=[{uri:`${window.location.origin}/schemas/layout.json`,fileMatch:["*layout*.json"],schema:{type:"object",properties:{version:{type:"string"},endpoint:{type:"string"},components:{type:"array"}},required:["version","endpoint","components"]}}],tA={"vs/nls":{availableLanguages:{"*":"ko"}}};function nA(e){e.languages.json.jsonDefaults.setDiagnosticsOptions({validate:!0,schemas:xb,enableSchemaRequest:!0,schemaValidation:"error",schemaRequest:"error"})}const rA={identifier:"sirsoft-admin_basic",vendor:"sirsoft",name:{ko:"Admin Basic",en:"Admin Basic"},version:"1.0.8",license:"MIT",description:{ko:"그누보드7 기본 관리자 템플릿",en:"Gnuboard7 default admin template"},type:"admin",locales:["ko","en"],author:{name:"sirsoft",email:"contact@sirsoft.com",url:"https://sirsoft.com"},release_date:"2026-05-15",g7_version:">=7.0.10",dependencies:{modules:{},plugins:{}},assets:{css:["assets/css/main.css","assets/css/ui-system.css"],js:["dist/components.js"],fonts:["assets/fonts/"],images:["assets/images/"]},components:{basic:["a","button","checkbox","div","form","h1","h2","h3","hr","icon","img","input","label","li","nav","p","section","select","span","svg","table","tbody","td","textarea","th","thead","tr","ul"],composite:["action-menu","admin-footer","admin-header","admin-sidebar","alert-dialog","breadcrumb","card","confirm-dialog","data-grid","dialog","dropdown","empty-state","filter-group","icon-button","loading-spinner","modal","page-header","pagination","product-card","search-bar","stat-card","status-badge","tab-navigation","template-card","toast"],layout:["container","flex","grid","section"]},preview:{thumbnail:"preview/thumbnail.png",screenshots:["preview/screenshot1.png","preview/screenshot2.png"]},error_config:{layouts:{401:"errors/401",403:"errors/403",404:"errors/404",500:"errors/500",503:"errors/503",maintenance:"errors/maintenance"}},github_url:"https://github.com/gnuboard/g7-template-sirsoft-admin_basic",github_changelog_url:"https://github.com/gnuboard/g7-template-sirsoft-admin_basic/blob/main/CHANGELOG.md",externals:[{id:"fontawesome",type:"style",asset:"vendor/font-awesome/6.4.0/css/all.inlined.css"},{id:"pretendard",type:"webfont",asset:"vendor/pretendard/1.3.9/pretendard-variable.css"},{id:"flag-icons",type:"style",asset:"vendor/flag-icons/7.2.3/css/flag-icons.min.css"}]},ir=window.G7Core?.createLogger?.("Handler:SetTheme")??{log:(...e)=>console.log("[Handler:SetTheme]",...e),warn:(...e)=>console.warn("[Handler:SetTheme]",...e),error:(...e)=>console.error("[Handler:SetTheme]",...e)},Gd=["auto","light","dark"],wb="g7_color_scheme",sA=e=>e==="auto"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":e,Wa=e=>{const t=sA(e);document.documentElement.setAttribute("data-theme",t),t==="dark"?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark")};function oA(){try{const e=localStorage.getItem(wb),t=e&&Gd.includes(e)?e:"auto";Wa(t);try{window.G7Core?.state?.setGlobal?.({theme:t})}catch(n){ir.warn("Failed to set global theme state:",n)}ir.log("Initial theme applied:",t)}catch(e){ir.warn("Failed to load initial theme:",e),Wa("auto")}}async function iA(e,t){const n=e?.target;if(n&&typeof n=="string"&&Gd.includes(n)){Wa(n);try{window.G7Core?.state?.setGlobal?.({theme:n})}catch(r){ir.warn("Failed to set global theme state:",r)}return}oA()}async function aA(e,t){let n;if(e?.target&&typeof e.target=="string"&&!e.target.includes("{{")&&(n=e.target),!n||typeof n!="string"){ir.warn("Invalid theme:",n);return}if(!Gd.includes(n)){ir.warn("Unsupported theme:",n);return}const r=n;try{localStorage.setItem(wb,r)}catch(s){ir.error("Failed to save theme to localStorage:",s);return}Wa(r);try{window.G7Core?.state?.setGlobal?.({theme:r})}catch(s){ir.warn("Failed to set global theme state:",s)}ir.log("Theme changed to:",r)}const Ps=window.G7Core?.createLogger?.("Handler:InitMenu")??{log:(...e)=>console.log("[Handler:InitMenu]",...e),warn:(...e)=>console.warn("[Handler:InitMenu]",...e),error:(...e)=>console.error("[Handler:InitMenu]",...e)};function kb(e,t){for(const n of e){if(n.slug===t)return n;if(n.children&&n.children.length>0){const r=kb(n.children,t);if(r)return r}}return null}function Cb(e){return new URLSearchParams(window.location.search).get(e)}function lA(e){return window.G7Core?.state?.getDataSource?.(e)}function cA(e){const t=[e,e?.data,e?.data?.data];for(const n of t)if(Array.isArray(n)&&n.length>0)return n;return null}async function dA(e,t=30,n=100){for(let r=0;rsetTimeout(o,n))}return null}async function uA(e){const t=window.G7Core;try{const r=(await t?.api?.get?.(`/api/admin/menus/${e.id}`))?.data;if(r&&typeof r=="object"&&r.id===e.id)return r}catch(n){Ps.warn("[initMenuFromUrl] Failed to hydrate menu detail:",n)}return e}async function fA(e,t){const n=window.G7Core,r=Cb("menu"),s=Cb("mode");if(!r){Ps.log("[initMenuFromUrl] No menu parameter in URL");return}if(!n?.state?.set){Ps.warn("[initMenuFromUrl] G7Core.state.set not available");return}const o=await dA("menus");if(!o){Ps.warn("[initMenuFromUrl] menus data not available after waiting");return}const i=kb(o,r);if(!i){Ps.warn("[initMenuFromUrl] Menu not found with slug:",r);return}const a=await uA(i),l=s==="edit"?"edit":"view";n.state.set({selectedMenuId:a.id,selectedMenu:a,panelMode:l}),l==="edit"&&n.state.set({formData:{name:a.name,slug:a.slug,url:a.url,icon:a.icon,parent_id:a.parent_id,extension_type:a.extension_type,extension_identifier:a.extension_identifier,is_active:a.is_active,roles:(a.roles??[]).map(c=>c.id)}}),Ps.log("[initMenuFromUrl] Menu initialized from URL:",{slug:r,mode:l,menuId:i.id})}const tn=window.G7Core?.createLogger?.("Handler:FilterVisibility")??{log:(...e)=>console.log("[Handler:FilterVisibility]",...e),warn:(...e)=>console.warn("[Handler:FilterVisibility]",...e),error:(...e)=>console.error("[Handler:FilterVisibility]",...e)},Ga="g7_filter_visibility_";async function hA(e,t){const{storageKey:n,defaultFilters:r=[],stateKey:s="visibleFilters"}=e?.params||{};if(!n){tn.warn("[initFilterVisibility] storageKey is required");return}const o=`${Ga}${n}`;try{const i=localStorage.getItem(o);let a;if(i){const l=JSON.parse(i);Array.isArray(l)?(a=l,tn.log(`[initFilterVisibility] Loaded from localStorage: ${a.join(", ")}`)):(a=r,tn.warn("[initFilterVisibility] Invalid saved data format, using defaults"))}else a=r,tn.log(`[initFilterVisibility] No saved data, using defaults: ${r.join(", ")}`);t?.setState&&t.setState({[s]:a})}catch(i){tn.error("[initFilterVisibility] Failed to load filter visibility:",i),t?.setState&&t.setState({[s]:r})}}async function gA(e,t){const{storageKey:n,filters:r}=e?.params||{};if(!n){tn.warn("[saveFilterVisibility] storageKey is required");return}if(!Array.isArray(r)){tn.warn("[saveFilterVisibility] filters must be an array");return}const s=`${Ga}${n}`;try{localStorage.setItem(s,JSON.stringify(r)),tn.log(`[saveFilterVisibility] Saved to localStorage: ${r.join(", ")}`)}catch(o){tn.error("[saveFilterVisibility] Failed to save filter visibility:",o)}}async function pA(e,t){const{storageKey:n,filterId:r,stateKey:s="visibleFilters"}=e?.params||{};if(!n||!r){tn.warn("[toggleFilterVisibility] storageKey and filterId are required");return}const o=t?.state?.[s]||[];let i;o.includes(r)?i=o.filter(l=>l!==r):i=[...o,r],t?.setState&&t.setState({[s]:i});const a=`${Ga}${n}`;try{localStorage.setItem(a,JSON.stringify(i)),tn.log(`[toggleFilterVisibility] Toggled ${r}: ${i.join(", ")}`)}catch(l){tn.error("[toggleFilterVisibility] Failed to save:",l)}}async function mA(e,t){const{storageKey:n,defaultFilters:r=[],stateKey:s="visibleFilters"}=e?.params||{};if(!n){tn.warn("[resetFilterVisibility] storageKey is required");return}const o=`${Ga}${n}`;try{localStorage.setItem(o,JSON.stringify(r)),t?.setState&&t.setState({[s]:r}),tn.log(`[resetFilterVisibility] Reset to defaults: ${r.join(", ")}`)}catch(i){tn.error("[resetFilterVisibility] Failed to reset:",i)}}const $s=window.G7Core?.createLogger?.("Handler:MultilingualTag")??{log:(...e)=>console.log("[Handler:MultilingualTag]",...e),warn:(...e)=>console.warn("[Handler:MultilingualTag]",...e),error:(...e)=>console.error("[Handler:MultilingualTag]",...e)};async function bA(e,t){const n=window.G7Core;if(!n){$s.error("G7Core not available");return}const r=n.state?.getGlobal?.()?.multilingualTagEdit;if(!r){$s.warn("No multilingualTagEdit state found"),n.modal?.close?.();return}const{fieldName:s,editingIndex:o,values:i,statePath:a,currentTags:l}=r;if(!Object.values(i||{}).some(g=>typeof g=="string"&&g.trim()!=="")){$s.warn("No values to save"),n.modal?.close?.(),Yd(n);return}const d=Array.isArray(l)?l:[];let u;o==null?u=[...d,i]:u=d.map((g,m)=>m===o?i:g);const f=a||(s?.startsWith("form.")?s:`form.${s}`);n.state?.setParentLocal?.({[f]:u}),n.modal?.close?.(),Yd(n)}async function yA(e,t){const n=window.G7Core;if(!n){$s.error("G7Core not available");return}n.modal?.close?.(),Yd(n)}async function vA(e,t){const n=window.G7Core;if(!n){$s.error("G7Core not available");return}const r=e?.params?.locale;if(!r){$s.warn("No locale specified");return}const s=t?.event;let o="";s?.target?.value!==void 0?o=s.target.value:s?.value!==void 0&&(o=s.value);const a=(n.state?.getGlobal?.()||{}).multilingualTagEdit||{},l={...a.values||{},[r]:o};n.dispatch?.({handler:"setState",params:{target:"global",multilingualTagEdit:{...a,values:l}}})}function Yd(e){e.dispatch?.({handler:"setState",params:{target:"global",multilingualTagEdit:null}})}function Sb(e){const t=e.getFullYear(),n=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0"),s=String(e.getHours()).padStart(2,"0"),o=String(e.getMinutes()).padStart(2,"0"),i=String(e.getSeconds()).padStart(2,"0");return`${t}-${n}-${r}T${s}:${o}:${i}`}function xA(e){const t=new Date,n=new Date(t.getFullYear(),t.getMonth(),t.getDate(),23,59,59),r=Sb(n),s=new Date(t.getFullYear(),t.getMonth(),t.getDate(),0,0,0);switch(e){case"today":break;case"week":s.setDate(s.getDate()-6);break;case"month":s.setMonth(s.getMonth()-1);break;case"3months":s.setMonth(s.getMonth()-3);break;case"6months":s.setMonth(s.getMonth()-6);break;case"1year":s.setFullYear(s.getFullYear()-1);break}return{startDate:Sb(s),endDate:r}}function wA(e){const{preset:t}=e.params||{preset:"today"},{startDate:n,endDate:r}=xA(t);return{startDate:n,endDate:r,preset:t}}const Yo=window.G7Core?.createLogger?.("Handler:Sidebar")??{log:(...e)=>console.log("[Handler:Sidebar]",...e),warn:(...e)=>console.warn("[Handler:Sidebar]",...e),error:(...e)=>console.error("[Handler:Sidebar]",...e)},_b="g7_admin_sidebar_collapsed";function Eb(){try{return localStorage.getItem(_b)==="1"}catch{return!1}}function kA(e){try{localStorage.setItem(_b,e?"1":"0")}catch(t){Yo.error("Failed to save sidebar state to localStorage:",t)}try{window.G7Core?.state?.setGlobal?.({sidebarCollapsed:e})}catch(t){Yo.warn("Failed to set global sidebar state:",t)}}function Mb(){const e=Eb();try{window.G7Core?.state?.setGlobal?.({sidebarCollapsed:e})}catch(t){Yo.warn("Failed to restore sidebar state:",t)}Yo.log("Initial sidebar collapsed state restored:",e)}async function CA(e,t){Mb()}async function SA(e,t){const r=!(()=>{try{return!!window.G7Core?.state?.getGlobal?.()?.sidebarCollapsed}catch{return Eb()}})();kA(r),Yo.log("Sidebar collapsed toggled to:",r)}const Kd=window.G7Core?.createLogger?.("Handler:DownloadAttachment")??{log:(...e)=>console.log("[Handler:DownloadAttachment]",...e),warn:(...e)=>console.warn("[Handler:DownloadAttachment]",...e),error:(...e)=>console.error("[Handler:DownloadAttachment]",...e)};async function _A(e,t){const n=window.G7Core,{url:r,filename:s}=e?.params||{};if(!r){Kd.warn("다운로드 URL 이 없어 요청을 건너뜁니다.");return}if(!n?.api?.get){Kd.error("G7Core.api.get 이 초기화되지 않아 다운로드를 실행할 수 없습니다.");return}try{const o=await n.api.get(r,{responseType:"blob"});if(o){const i=URL.createObjectURL(o),a=document.createElement("a");a.href=i,a.download=s||"",document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(i)}}catch(o){Kd.error("첨부파일 다운로드 실패",o),n?.toast?.error?.(n?.t?.("common.download_failed")??"Download failed")}}const Ya=window.G7Core?.createLogger?.("Handler:DetectAssetUrlMode")??{log:(...e)=>console.log("[Handler:DetectAssetUrlMode]",...e),warn:(...e)=>console.warn("[Handler:DetectAssetUrlMode]",...e),error:(...e)=>console.error("[Handler:DetectAssetUrlMode]",...e)},EA="G7_ASSET_PROBE_OK";async function Nb(e){try{const t=await fetch(e,{cache:"no-store",credentials:"omit"});if(!t.ok)return!1;const n=t.headers.get("content-type")??"";return/javascript|ecmascript/i.test(n)?(await t.text()).includes(EA):!1}catch{return!1}}async function Ob(){const[e,t]=await Promise.all([Nb("/api/system/asset-probe.js"),Nb("/api/system/asset-probe")]);return e&&t?"extension":!e&&t?"extensionless":"unavailable"}function MA(){return window.G7Config?.settings?.general?.asset_url_mode??"extension"}async function NA(e){try{const t=await Ob();if(t==="unavailable")return;const n=MA();if(t===n)return;window.G7Core?.state?.setGlobal?.({assetUrlModeDrift:{detected:t,stored:n}})}catch(t){Ya.warn("자산 URL 방식 대조 실패 (대시보드 동작에는 영향 없음):",t)}}async function OA(e,t){const n=window.G7Core,r=t?.setState??n?.state?.setLocal,s=o=>{typeof r=="function"?r({asset_url_mode_detect_status:o}):Ya.warn("setState 를 찾지 못해 감지 상태를 폼에 반영하지 못했습니다")};try{s("detecting");const o=await Ob();if(o==="unavailable"){s("unavailable");return}typeof r=="function"?r({"general.asset_url_mode":o,asset_url_mode_detect_status:o}):Ya.warn("setState 를 찾지 못해 감지 결과를 폼에 반영하지 못했습니다")}catch(o){Ya.error("자산 URL 방식 감지 실패:",o),s("unavailable")}}const Ka={detectAssetUrlMode:OA,checkAssetUrlModeDrift:NA,setTheme:aA,initTheme:iA,scrollToSection:zu,initMenuFromUrl:fA,initFilterVisibility:hA,saveFilterVisibility:gA,toggleFilterVisibility:pA,resetFilterVisibility:mA,saveMultilingualTag:bA,cancelMultilingualTag:yA,updateMultilingualTagValue:vA,setDateRange:wA,toggleSidebar:SA,initSidebar:CA,downloadAttachment:_A},Ko=window.G7Core?.createLogger?.("Template:sirsoft-admin_basic:IdentityLauncher")??{log:(...e)=>console.log("[Template:sirsoft-admin_basic:IdentityLauncher]",...e),warn:(...e)=>console.warn("[Template:sirsoft-admin_basic:IdentityLauncher]",...e),error:(...e)=>console.error("[Template:sirsoft-admin_basic:IdentityLauncher]",...e)};function TA(){const t=window.G7Core?.api?.getToken?.()??null;return t?{Authorization:`Bearer ${t}`}:{}}function AA(){try{const e=typeof window<"u"?window.localStorage?.getItem("g7_locale"):null;return e?{"Accept-Language":e}:{}}catch{return{}}}async function DA(e,t=null){const n={purpose:e.purpose};e.provider_id&&(n.provider_id=e.provider_id),t&&(n.target=t);const r=e.challenge_start_url||"/api/identity/challenges",s=await fetch(r,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json",Accept:"application/json",...AA(),...TA()},body:JSON.stringify(n)}),o=await s.json().catch(()=>null);if(!s.ok||!o?.success){const a=o?.message??`Challenge 시작 실패 (HTTP ${s.status})`;throw new Error(a)}const i=o.data??o;return{id:i.id,expires_at:i.expires_at,render_hint:i.render_hint??e.render_hint??"text_code",public_payload:i.public_payload,redirect_url:i.redirect_url,max_attempts:typeof i.max_attempts=="number"?i.max_attempts:void 0}}async function IA(e){const t=window.G7Core,n=t?.identity;if(!t?.dispatch||!t?.state||!n)return Ko.error("G7Core 또는 G7Core.identity 가 초기화되지 않아 launcher 를 실행할 수 없습니다."),{status:"failed",failureCode:"G7_NOT_READY"};if(e.render_hint==="external_redirect"||e.redirect_url)return n.redirectExternally(e);const r=e.target&&(e.target.email||e.target.phone)?e.target:null;let s;try{s=await DA(e,r)}catch(m){Ko.error("Challenge 시작 실패:",m);try{await t.dispatch({handler:"toast",params:{type:"error",message:m instanceof Error?m.message:"본인인증 시작에 실패했습니다."}})}catch{}return{status:"failed",failureCode:"CHALLENGE_START_FAILED",reason:m instanceof Error?m.message:String(m)}}if(s.redirect_url)return n.redirectExternally({...e,render_hint:"external_redirect",redirect_url:s.redirect_url});const o=s.expires_at?new Date(s.expires_at).getTime():0,i=o>0?Math.max(0,Math.floor((o-Date.now())/1e3)):0,a=typeof s.max_attempts=="number"?s.max_attempts:0;t.state.set({identityChallenge:{policy_key:e.policy_key,purpose:e.purpose,provider_id:e.provider_id??null,render_hint:s.render_hint,challenge_id:s.id,expires_at:s.expires_at,public_payload:s.public_payload??{},target:r,code:"",error:null,attempts:0,maxAttempts:a,remainingSeconds:i,resendCooldown:0}});let l=o,c=0;const d=window.setInterval(()=>{const m=l>0?Math.max(0,Math.floor((l-Date.now())/1e3)):0;c=Math.max(0,c-1),t.state.set({identityChallenge:{remainingSeconds:m,resendCooldown:c}})},1e3);let u=null;try{u=t.state.subscribe?.(m=>{const p=m?.identityChallenge?.expires_at;if(typeof p=="string"){const b=new Date(p).getTime();Number.isFinite(b)&&b!==l&&(l=b)}const y=m?.identityChallenge?.resendCooldown;typeof y=="number"&&y>c&&(c=y)})??null}catch{}const f=n.createDeferred();try{await t.dispatch({handler:"openModal",target:"identity-challenge-modal"})}catch(m){return Ko.error("openModal 실패 — 풀페이지로 폴백:",m),window.clearInterval(d),u?.(),n.redirectExternally({...e,render_hint:"external_redirect",redirect_url:`/admin/identity/challenge?challenge_id=${encodeURIComponent(s.id)}&return=${encodeURIComponent(window.location.href)}`})}const g=await f;return window.clearInterval(d),u?.(),g}function LA(){const e=window.G7Core?.identity;if(!e?.setLauncher){Ko.warn("G7Core.identity 가 아직 초기화되지 않아 launcher 등록을 건너뜁니다. 코어 부트스트랩 순서를 확인하세요.");return}e.setLauncher(IA),Ko.log("IDV launcher registered (sirsoft-admin_basic)")}function PA(e){const t=e.icons;return Array.isArray(t)?t.filter(n=>!!n&&typeof n=="object"&&typeof n.value=="string"):[]}function $A(e,t){const n=e.label;return typeof n=="string"?n.startsWith("$t:")?t(n.slice(3)):n:e.value}function FA(e,t,n){if(n==="")return!0;const r=n.toLowerCase();return e.value.toLowerCase().includes(r)||t.toLowerCase().includes(r)?!0:(e.keywords??[]).some(s=>s.toLowerCase().includes(r))}function zA({entry:e}){const t=e.preview;return t?.html?h.jsx("span",{className:"g7le-icon-preview",dangerouslySetInnerHTML:{__html:t.html},style:qd}):t?.className?h.jsx("span",{className:`g7le-icon-preview ${t.className}`,style:qd}):h.jsx("i",{className:`fas fa-${e.value}`,style:qd,"aria-hidden":"true"})}function VA({control:e,value:t,onChange:n,t:r}){const s=PA(e),o=t==null?"":String(t),i=typeof e.iconColumns=="number"?e.iconColumns:6,a=e.iconSearchPlaceholder,l=typeof a=="string"&&a.startsWith("$t:")?r(a.slice(3)):r("layout_editor.icon_picker.search_placeholder"),[c,d]=v.useState("");if(s.length===0)return h.jsx("div",{className:"g7le-widget g7le-widget--icon-picker","data-testid":"g7le-widget-icon-picker",style:Tb,children:h.jsx("input",{type:"text",className:"g7le-widget g7le-widget--icon-free","data-testid":"g7le-widget-icon-picker-free",value:o,placeholder:r("layout_editor.icon_picker.free_input_hint"),onChange:g=>n(g.target.value===""?void 0:g.target.value),style:Ab})});const u=g=>$A(g,r),f=s.filter(g=>FA(g,u(g),c));return h.jsxs("div",{className:"g7le-widget g7le-widget--icon-picker","data-testid":"g7le-widget-icon-picker",style:Tb,children:[h.jsx("input",{type:"text",className:"g7le-widget g7le-widget--icon-search","data-testid":"g7le-widget-icon-picker-search",value:c,placeholder:l,onChange:g=>d(g.target.value),style:Ab}),h.jsxs("div",{className:"g7le-icon-grid","data-testid":"g7le-widget-icon-picker-grid",style:{...HA,gridTemplateColumns:`repeat(${i}, minmax(0, 1fr))`},children:[h.jsx("button",{type:"button","data-testid":"g7le-icon-cell-none",title:r("layout_editor.icon_picker.none"),onClick:()=>n(void 0),"aria-pressed":o==="",style:o===""?Db:Xd,children:h.jsx("span",{style:UA,children:"—"})}),f.map(g=>{const m=g.value===o;return h.jsx("button",{type:"button","data-testid":`g7le-icon-cell-${g.value}`,title:u(g),"aria-pressed":m,onClick:()=>n(g.value),style:m?Db:Xd,children:h.jsx(zA,{entry:g})},g.value)})]}),f.length===0&&h.jsx("div",{"data-testid":"g7le-widget-icon-picker-empty",style:BA,children:r("layout_editor.icon_picker.no_results")})]})}const Tb={display:"flex",flexDirection:"column",gap:6,width:"100%"},Ab={padding:"5px 8px",fontSize:12,border:"1px solid #cbd5e1",borderRadius:6,width:"100%"},HA={display:"grid",gap:4,maxHeight:220,overflowY:"auto",padding:2},Xd={display:"flex",alignItems:"center",justifyContent:"center",minHeight:34,padding:4,border:"1px solid #e2e8f0",borderRadius:6,background:"#fff",cursor:"pointer"},Db={...Xd,border:"2px solid #2563eb",background:"#eff6ff"},qd={display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:16,lineHeight:1},UA={fontSize:10,color:"#475569",fontFamily:"monospace",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:"100%"},BA={fontSize:11,color:"#94a3b8",fontStyle:"italic",padding:"4px 2px"},Ib=130,Fn=20;function jA(e){const t=e?.arrayProp;return typeof t=="string"&&t?t:"tabs"}function WA(e){let t=0;for(const n of e){const r=typeof n.id=="number"?n.id:Number(n.id);Number.isFinite(r)&&r>t&&(t=r)}return t+1}function GA({node:e,params:t,cellBoxes:n,t:r,onPatchNode:s}){const o=jA(t),i=v.useMemo(()=>{const g=(e.props??{})[o];return typeof g=="string"||!Array.isArray(g)?null:g},[e,o]),a=v.useMemo(()=>{const g=new Map,m=`props.${o}.`;for(const p of n??[]){if(!p.path.startsWith(m))continue;const y=Number(p.path.slice(m.length));Number.isInteger(y)&&g.set(y,{top:p.top,left:p.left,width:p.width,height:p.height})}return g},[n,o]),l=v.useCallback(g=>{const m=e.props??{};s({...e,props:{...m,[o]:g}})},[e,o,s]),c=v.useCallback(g=>{if(!i)return;const p={id:WA(i),label:r("editor.tabnav_inplace.new_tab")},y=i.slice();y.splice(g,0,p),l(y)},[i,l,r]),d=v.useCallback(g=>{if(!i)return;const m=i.slice();m.splice(g,1),l(m)},[i,l]),u=v.useCallback((g,m)=>{if(!i)return;const p=g+m;if(p<0||p>=i.length)return;const y=i.slice(),[b]=y.splice(g,1);y.splice(p,0,b),l(y)},[i,l]);if(!i||a.size===0)return null;const f={position:"absolute",width:Fn,height:Fn,display:"flex",alignItems:"center",justifyContent:"center",fontSize:12,lineHeight:1,border:"1px solid rgba(0,0,0,0.15)",borderRadius:4,background:"#ffffff",color:"#1f2937",cursor:"pointer",boxShadow:"0 1px 2px rgba(0,0,0,0.18)",pointerEvents:"auto",padding:0,zIndex:Ib};return h.jsx("div",{className:"g7le-tabnav-inplace","data-testid":"g7le-tabnav-inplace",style:{position:"absolute",inset:0,pointerEvents:"none",zIndex:Ib},children:i.map((g,m)=>{const p=a.get(m);if(!p)return null;const y=p.left+p.width;return h.jsxs("div",{"data-testid":`g7le-tabnav-aff-${m}`,children:[h.jsx("button",{type:"button","data-testid":`g7le-tabnav-remove-${m}`,title:r("editor.tabnav_inplace.remove"),"aria-label":r("editor.tabnav_inplace.remove"),style:{...f,left:y-Fn/2,top:p.top-Fn/2,color:"#b91c1c"},onClick:b=>{b.preventDefault(),b.stopPropagation(),d(m)},children:"✕"}),m>0&&h.jsx("button",{type:"button","data-testid":`g7le-tabnav-move-left-${m}`,title:r("editor.tabnav_inplace.move_left"),"aria-label":r("editor.tabnav_inplace.move_left"),style:{...f,left:p.left,top:p.top+p.height-Fn/2},onClick:b=>{b.preventDefault(),b.stopPropagation(),u(m,-1)},children:"◀"}),m{b.preventDefault(),b.stopPropagation(),u(m,1)},children:"▶"}),m===0&&h.jsx("button",{type:"button","data-testid":"g7le-tabnav-add-0",title:r("editor.tabnav_inplace.add"),"aria-label":r("editor.tabnav_inplace.add"),style:{...f,left:p.left-Fn,top:p.top+p.height/2-Fn/2,color:"#15803d"},onClick:b=>{b.preventDefault(),b.stopPropagation(),c(0)},children:"+"}),h.jsx("button",{type:"button","data-testid":`g7le-tabnav-add-${m+1}`,title:r("editor.tabnav_inplace.add"),"aria-label":r("editor.tabnav_inplace.add"),style:{...f,left:y-Fn/2,top:p.top+p.height/2-Fn/2,color:"#15803d"},onClick:b=>{b.preventDefault(),b.stopPropagation(),c(m+1)},children:"+"})]},`tab-aff-${g.id}-${m}`)})})}const Zd=window.G7Core?.createLogger?.("Template:sirsoft-admin_basic:EditorWidgets")??{log:(...e)=>console.log("[Template:sirsoft-admin_basic:EditorWidgets]",...e),warn:(...e)=>console.warn("[Template:sirsoft-admin_basic:EditorWidgets]",...e)};function YA(){if(typeof window>"u")return;const e=window.G7Core?.layoutEditor;if(!e?.registerWidget){Zd.warn("G7Core.layoutEditor 미노출 — icon-picker 위젯 등록 보류");return}e.registerWidget("icon-picker",VA),Zd.log("편집기 위젯 'icon-picker' 등록됨(Font Awesome 검색 그리드)"),e.registerCanvasOverlay&&(e.registerCanvasOverlay("tabnav",GA),Zd.log("편집기 캔버스 오버레이 'tabnav' 등록됨(TabNavigation 탭 인플레이스)"))}const Qd=window.G7Core?.createLogger?.("Template:sirsoft-admin_basic")??{log:(...e)=>console.log("[Template:sirsoft-admin_basic]",...e),warn:(...e)=>console.warn("[Template:sirsoft-admin_basic]",...e),error:(...e)=>console.error("[Template:sirsoft-admin_basic]",...e)};typeof window<"u"&&(window.G7TemplateHandlers=Ka);function Lb(){if(typeof window<"u"){let e=0;const t=50,n=()=>{const r=window.G7Core?.getActionDispatcher?.();r?(Object.entries(Ka).forEach(([s,o])=>{r.registerHandler(s,o)}),Qd.log(`${Object.keys(Ka).length} custom handler(s) registered:`,Object.keys(Ka)),LA(),Mb()):(e++,e<=t?(Qd.warn(`ActionDispatcher not found, retrying... (${e}/${t})`),setTimeout(n,100)):Qd.error("Failed to register handlers: ActionDispatcher not available after maximum retries"))};document.readyState==="complete"?n():window.addEventListener("load",n)}}return YA(),Lb(),R.A=qr,R.Accordion=Nc,R.ActionMenu=Vs,R.AdminFooter=Ov,R.AdminHeader=_v,R.AdminSidebar=Sv,R.Alert=Ku,R.AlertDialog=pv,R.Badge=fu,R.BarChart=K5,R.Breadcrumb=ju,R.Button=le,R.Card=sy,R.CardGrid=Jy,R.CategoryTree=Q_,R.Checkbox=On,R.ChipCheckbox=FM,R.Code=ey,R.CodeEditor=Kx,R.ColumnSelector=ew,R.ConfirmDialog=Uu,R.Container=q5,R.DataGrid=Yy,R.Dialog=Hu,R.Div=I,R.DonutChart=X5,R.Dropdown=ev,R.DropdownButton=zM,R.DropdownMenuItem=VM,R.DynamicFieldList=qM,R.EmptyState=wv,R.ExtensionBadge=Uh,R.FileInput=su,R.FileUploader=c0,R.FilterGroup=sv,R.FilterVisibilitySelector=AM,R.Flex=Q5,R.Form=al,R.FormField=eN,R.Fragment=ny,R.Grid=Z5,R.H1=sl,R.H2=cr,R.H3=Xr,R.H4=ou,R.Hr=ry,R.HtmlContent=kl,R.HtmlEditor=MM,R.I=yt,R.Icon=ae,R.IconButton=fv,R.IconName=he,R.IconSelect=G_,R.ImageGallery=ia,R.Img=Nn,R.Input=Et,R.Label=gn,R.LanguageSelector=Nv,R.LayoutEditorHeader=Lv,R.LayoutFileList=Pv,R.LayoutHistoryPanel=qx,R.LayoutWarnings=TM,R.Li=il,R.LoadingSpinner=Cv,R.LoginForm=Zx,R.Modal=ri,R.MultilingualInput=fl,R.MultilingualLocaleContext=ad,R.MultilingualTabPanel=RM,R.MultilingualTagInput=RC,R.Nav=Jo,R.NotificationCenter=Ev,R.Ol=Kb,R.Optgroup=Qb,R.Option=Zb,R.P=kt,R.PageHeader=Tv,R.PageLoading=sw,R.PageTransitionIndicator=nw,R.Pagination=Ro,R.PermissionTree=q_,R.Pre=ty,R.ProductCard=tv,R.RadioGroup=SM,R.RichSelect=PM,R.SearchBar=rv,R.SearchableDropdown=eS,R.Section=iu,R.SectionHeader=Dv,R.SectionLayout=J5,R.Select=Zr,R.SlotContainer=LM,R.SortableMenuItem=Tg,R.SortableMenuList=j_,R.Span=J,R.StatCard=nv,R.StatusBadge=ei,R.Svg=Jn,R.TabNavigation=ov,R.TabNavigationScroll=dv,R.Table=ll,R.TagInput=ZC,R.TagSelect=tS,R.Tbody=dl,R.Td=rn,R.TemplateCard=Iv,R.Textarea=lr,R.Tfoot=ul,R.Th=Qr,R.Thead=cl,R.ThemeToggle=Jx,R.ThreeColumnLayout=R5,R.Toast=vv,R.Toggle=hl,R.Tr=dr,R.Ul=ol,R.UnifiedIcon=Rb,R.UserProfile=Mv,R.VersionList=uf,R.configureJSONLanguageService=nA,R.defaultJSONSchemas=xb,R.executeImageDownload=nd,R.initTemplate=Lb,R.jsonEditorDefaults=eA,R.monacoInitOptions=tA,R.templateMetadata=rA,R.useCurrentMultilingualLocale=m0,R.useImageGallery=qp,Object.defineProperty(R,Symbol.toStringTag,{value:"Module"}),R})({},ReactJSXRuntime,React,ReactDOM); diff --git a/templates/_bundled/sirsoft-admin_basic/package-lock.json b/templates/_bundled/sirsoft-admin_basic/package-lock.json index f495ed24..81c4b2a2 100644 --- a/templates/_bundled/sirsoft-admin_basic/package-lock.json +++ b/templates/_bundled/sirsoft-admin_basic/package-lock.json @@ -16,6 +16,7 @@ "@monaco-editor/react": "^4.7.0", "browser-image-compression": "2.0.2", "chart.js": "^4.5.1", + "dompurify": "^3.3.1", "flag-icons": "7.2.3", "monaco-editor": "0.54.0", "react-chartjs-2": "^5.3.1", @@ -3065,6 +3066,13 @@ "@types/react": "*" } }, + "node_modules/@types/trusted-types": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/@types/trusted-types/-/trusted-types-2.0.7.tgz", + "integrity": "sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw==", + "license": "MIT", + "optional": true + }, "node_modules/@types/whatwg-mimetype": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/@types/whatwg-mimetype/-/whatwg-mimetype-3.0.2.tgz", @@ -3826,10 +3834,13 @@ } }, "node_modules/dompurify": { - "version": "3.1.7", - "resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.1.7.tgz", - "integrity": "sha512-VaTstWtsneJY8xzy7DekmYWEOZcmzIe3Qb3zPd4STve1OBTa+e+WmS1ITQec1fZYXI3HCsOZZiSMpG6oxoWMWQ==", - "license": "(MPL-2.0 OR Apache-2.0)" + "version": "3.4.14", + "resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.4.14.tgz", + "integrity": "sha512-dVoH9z+MY+C9IilgGCk3YfFqjLi3fChm2OiKJMzh6axrJ5qwxqWaZamgmHrpv22CN/KdbZJuGEGgfQoL00LTdg==", + "license": "(MPL-2.0 OR Apache-2.0)", + "optionalDependencies": { + "@types/trusted-types": "^2.0.7" + } }, "node_modules/electron-to-chromium": { "version": "1.5.244", @@ -4788,6 +4799,12 @@ "marked": "14.0.0" } }, + "node_modules/monaco-editor/node_modules/dompurify": { + "version": "3.1.7", + "resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.1.7.tgz", + "integrity": "sha512-VaTstWtsneJY8xzy7DekmYWEOZcmzIe3Qb3zPd4STve1OBTa+e+WmS1ITQec1fZYXI3HCsOZZiSMpG6oxoWMWQ==", + "license": "(MPL-2.0 OR Apache-2.0)" + }, "node_modules/ms": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", diff --git a/templates/_bundled/sirsoft-admin_basic/package.json b/templates/_bundled/sirsoft-admin_basic/package.json index d0bb7c2e..ca46f26d 100644 --- a/templates/_bundled/sirsoft-admin_basic/package.json +++ b/templates/_bundled/sirsoft-admin_basic/package.json @@ -65,6 +65,7 @@ "@monaco-editor/react": "^4.7.0", "browser-image-compression": "2.0.2", "chart.js": "^4.5.1", + "dompurify": "^3.3.1", "flag-icons": "7.2.3", "monaco-editor": "0.54.0", "react-chartjs-2": "^5.3.1", diff --git a/tests/Feature/Api/Admin/PluginSettingsControllerTest.php b/tests/Feature/Api/Admin/PluginSettingsControllerTest.php index 5226bb51..70e17f79 100644 --- a/tests/Feature/Api/Admin/PluginSettingsControllerTest.php +++ b/tests/Feature/Api/Admin/PluginSettingsControllerTest.php @@ -8,6 +8,7 @@ use App\Models\Permission; use App\Models\Plugin; use App\Models\Role; use App\Models\User; +use App\Support\ExtensionStoragePath; use Illuminate\Foundation\Testing\RefreshDatabase; use Illuminate\Support\Facades\File; use Tests\TestCase; @@ -130,7 +131,7 @@ class PluginSettingsControllerTest extends TestCase */ private function createTestSettingsFile(string $identifier, array $settings): void { - $settingsDir = storage_path("app/plugins/{$identifier}/settings"); + $settingsDir = ExtensionStoragePath::plugin($identifier, 'settings'); $settingsPath = $settingsDir.'/setting.json'; if (! File::isDirectory($settingsDir)) { @@ -145,7 +146,7 @@ class PluginSettingsControllerTest extends TestCase */ private function cleanupTestSettings(string $identifier): void { - $pluginDir = storage_path("app/plugins/{$identifier}"); + $pluginDir = ExtensionStoragePath::plugin($identifier); if (File::isDirectory($pluginDir)) { File::deleteDirectory($pluginDir); } @@ -319,12 +320,14 @@ class PluginSettingsControllerTest extends TestCase ->assertJson(['success' => true]); // 파일에서 값 확인 - $settingsPath = storage_path('app/plugins/sirsoft-daum_postcode/settings/setting.json'); - if (File::exists($settingsPath)) { - $savedContent = json_decode(File::get($settingsPath), true); - $this->assertSame('popup', $savedContent['display_mode'] ?? null); - $this->assertSame(640, $savedContent['popup_width'] ?? null); - } + $settingsPath = ExtensionStoragePath::plugin('sirsoft-daum_postcode', 'settings').'/setting.json'; + // 저장이 200 으로 끝났으므로 파일은 반드시 있어야 한다 — `File::exists` 조건 안에 + // 단언을 두면 경로가 어긋났을 때 검사가 조용히 공허해진다. + $this->assertFileExists($settingsPath); + + $savedContent = json_decode(File::get($settingsPath), true); + $this->assertSame('popup', $savedContent['display_mode'] ?? null); + $this->assertSame(640, $savedContent['popup_width'] ?? null); // 정리 $this->cleanupTestSettings('sirsoft-daum_postcode'); @@ -357,12 +360,15 @@ class PluginSettingsControllerTest extends TestCase 'another_unknown' => ['nested' => true], ]); - $settingsPath = storage_path('app/plugins/sirsoft-daum_postcode/settings/setting.json'); - if (File::exists($settingsPath)) { - $savedContent = json_decode(File::get($settingsPath), true); - $this->assertArrayNotHasKey('injected_field', $savedContent); - $this->assertArrayNotHasKey('another_unknown', $savedContent); - } + $settingsPath = ExtensionStoragePath::plugin('sirsoft-daum_postcode', 'settings').'/setting.json'; + // 스키마 밖 키만 담긴 요청은 저장 자체가 일어나지 않을 수 있다. 그 경우에도 단언은 + // 수행한다 — 조건 안에 두면 파일이 없을 때 검사가 0건이 되어 공허하게 통과한다. + $savedContent = File::exists($settingsPath) + ? (json_decode(File::get($settingsPath), true) ?? []) + : []; + + $this->assertArrayNotHasKey('injected_field', $savedContent); + $this->assertArrayNotHasKey('another_unknown', $savedContent); $this->cleanupTestSettings('sirsoft-daum_postcode'); } diff --git a/tests/Feature/Extension/ExtensionTestIsolationTest.php b/tests/Feature/Extension/ExtensionTestIsolationTest.php index 816b0701..5d728ab5 100644 --- a/tests/Feature/Extension/ExtensionTestIsolationTest.php +++ b/tests/Feature/Extension/ExtensionTestIsolationTest.php @@ -81,6 +81,38 @@ class ExtensionTestIsolationTest extends TestCase ); } + /** + * 테스트는 운영 라우트 캐시로 부팅하지 않는다. + * + * 라우트 캐시가 있으면 `RouteServiceProvider::boot()` 이 캐시 로드로 분기해 **라우트 파일이 + * 실행되지 않는다.** 그러면 allowlist 가 라우트 축에서 통째로 무력화되어, core-only 테스트가 + * 굽던 시점에 활성이던 모든 확장의 라우트를 가진 채 부팅한다. + * + * 위의 GDPR 라우트 단언만으로는 이 결함을 안정적으로 잡지 못한다 — GDPR 이 그 머신에 + * 설치돼 있어야만 red 가 되기 때문이다. 여기서는 **메커니즘 자체**를 단언한다. + * + * @effects tests_do_not_boot_with_production_route_cache + */ + public function test_tests_do_not_boot_with_the_production_route_cache(): void + { + $cachedRoutesPath = $this->app->getCachedRoutesPath(); + + // 경로 구분자를 슬래시로 통일해 판정한다 — Windows 는 역슬래시를 섞어 돌려준다. + $normalized = strtr($cachedRoutesPath, '\\', '/'); + + $this->assertStringNotContainsString( + 'bootstrap/cache', + $normalized, + '테스트가 운영 라우트 캐시 경로를 본다 — tests/bootstrap.php 의 APP_ROUTES_CACHE ' + .'리다이렉트가 사라졌다. 라우트 파일이 실행되지 않아 확장 격리가 무력화된다.' + ); + + $this->assertFalse( + $this->app->routesAreCached(), + '테스트가 캐시된 라우트로 부팅했다 — 라우트 파일이 실행되지 않아 allowlist 가 적용되지 않는다.' + ); + } + /** * @effects allowlist_inactive_when_never_configured */ @@ -99,7 +131,7 @@ class ExtensionTestIsolationTest extends TestCase /** * @effects selfExtension_returns_null_for_core_tests */ - public function test_selfExtension_returns_null_for_core_tests(): void + public function test_self_extension_returns_null_for_core_tests(): void { // 본 테스트 클래스는 tests/Feature/ 하위 (코어 테스트) → // selfExtension() 의 modules/plugins 경로 패턴에 매칭되지 않아 null 반환 diff --git a/tests/Feature/Services/ExtensionStaticCacheServiceTest.php b/tests/Feature/Services/ExtensionStaticCacheServiceTest.php index 9faa6e56..f28b9531 100644 --- a/tests/Feature/Services/ExtensionStaticCacheServiceTest.php +++ b/tests/Feature/Services/ExtensionStaticCacheServiceTest.php @@ -6,6 +6,7 @@ use App\Contracts\Repositories\ModuleRepositoryInterface; use App\Contracts\Repositories\PluginRepositoryInterface; use App\Contracts\Repositories\TemplateRepositoryInterface; use App\Enums\ExtensionStatus; +use App\Extension\Helpers\FilePermissionHelper; use App\Models\Module; use App\Models\Plugin; use App\Models\Template; @@ -1204,16 +1205,31 @@ class ExtensionStaticCacheServiceTest extends TestCase ); // ① 디렉토리 생성은 umask 를 무력화하는 명시 chmod 를 거친다. + // + // 정합화 구현은 코어 공통 프리미티브(`FilePermissionHelper::hardenDirectory`)로 옮겼다. + // 검사도 그 위임을 따라가야 한다 — 옮겨간 뒤에도 이 클래스의 소스 리터럴만 보면 실제로 + // 도는 코드가 아닌 **죽은 자리**를 지키게 되어 가드가 공허해진다. $makeDirectory = $this->methodBody($source, 'makeDirectory'); $this->assertNotSame('', $makeDirectory, 'makeDirectory 를 소스에서 찾지 못했다 — 검사가 공허하다'); $this->assertStringContainsString( - '@chmod($dir, self::PUBLISH_DIR_MODE)', + 'FilePermissionHelper::hardenDirectory($dir, self::PUBLISH_DIR_MODE)', $makeDirectory, + '게시 디렉토리 정합화가 공통 프리미티브를 거치지 않는다 — umask/소유권 규율이 이 클래스에서 갈라진다' + ); + + $helperSource = (string) file_get_contents( + (new \ReflectionClass(FilePermissionHelper::class))->getFileName() + ); + $harden = $this->methodBody($helperSource, 'hardenDirectory'); + $this->assertNotSame('', $harden, 'hardenDirectory 를 소스에서 찾지 못했다 — 검사가 공허하다'); + $this->assertStringContainsString( + '@chmod($path, $mode)', + $harden, 'ensureDirectoryExists 의 mode 는 umask 로 깎인다 — 명시 chmod 가 없으면 0755 로 굳는다' ); $this->assertStringContainsString( - 'FilePermissionHelper::inheritOwnershipFromParent($dir)', - $makeDirectory + 'static::inheritOwnershipFromParent($path)', + $harden ); // ② 정합화는 root 갈래와 항상-실행 갈래를 모두 갖는다. diff --git a/tests/Unit/Extension/ExtensionVendorAutoloadInTestsTest.php b/tests/Unit/Extension/ExtensionVendorAutoloadInTestsTest.php new file mode 100644 index 00000000..9f3b8135 --- /dev/null +++ b/tests/Unit/Extension/ExtensionVendorAutoloadInTestsTest.php @@ -0,0 +1,177 @@ +discoverExtensionVendorClassmaps() as $classmapFile) { + foreach (require $classmapFile as $fqcn => $path) { + // 확장 자기 심볼은 애초에 등록 대상이 아니고, Composer 자신의 클래스는 루트 오토로더가 + // 이미 들고 있어 우리 등록이 없어도 통과한다 — 표본으로 쓰면 공허한 단언이 된다. + if ($this->isExtensionOwnSymbol($fqcn) || str_starts_with($fqcn, 'Composer\\')) { + continue; + } + + $sampled[] = $fqcn; + + if (! class_exists($fqcn) && ! interface_exists($fqcn) && ! trait_exists($fqcn)) { + $unloadable[] = $fqcn; + } + + // 확장마다 대표 1건만 본다 — 맵 전체를 로드하면 스위트가 느려지고, + // 오토로더가 걸렸는지 여부는 대표 1건으로 판정된다. + break; + } + } + + $this->assertSame( + [], + $unloadable, + '확장 vendor 의 제3자 클래스가 테스트 프로세스에서 오토로드되지 않았습니다 — ' + .'tests/bootstrap.php 의 확장 vendor 등록을 확인하세요. 표본: ' + .implode(', ', $sampled) + ); + } + + /** + * 확장 자기 네임스페이스가 vendor 오토로더에 하이재킹되지 않는다. + * + * 확장 vendor 의 Composer 오토로더는 확장 자신의 PSR-4 를 **활성** 디렉토리로 매핑하고 + * 자신을 prepend 로 등록한다. 그것을 그대로 쓰면 `tests/bootstrap.php` 가 앞서 prepend 한 + * `_bundled` 등록을 이겨서, 테스트가 `_bundled` 가 아니라 활성 디렉토리 사본을 검증하게 + * 된다 — `_bundled` 에서만 작업한다는 규율이 오류 없이 깨지는 형태다. + */ + #[Test] + public function bundled_extension_classes_are_not_hijacked_to_the_active_directory(): void + { + $hijacked = []; + + foreach (glob(base_path('modules/_bundled/*/module.php')) ?: [] as $manifest) { + $identifier = basename(dirname($manifest)); + $class = $this->extensionEntryClass('Modules', $identifier); + + if ($class === null || ! class_exists($class)) { + continue; + } + + $file = (new \ReflectionClass($class))->getFileName(); + + if ($file !== false && ! str_contains(str_replace('\\', '/', $file), '/modules/_bundled/')) { + $hijacked[$identifier] = $file; + } + } + + $this->assertSame( + [], + $hijacked, + '_bundled 확장의 클래스가 활성 디렉토리에서 로드되었습니다 — 확장 vendor 오토로더가 ' + .'자기 PSR-4 를 등록하고 있습니다.' + ); + } + + /** + * 등록된 Composer 로더 목록의 첫 항목이 루트 vendor 로 남는다. + * + * Composer 로더는 `vendorDir` 를 가지면 `ClassLoader::getRegisteredLoaders()` 맨 앞에 + * 자신을 넣는데, `Illuminate\Foundation\Testing\TestCase::createApplication()` 이 + * `Application::inferBasePath()` 로 그 첫 항목에서 base path 를 유추한다. 확장 vendor 의 + * 로더가 그 자리를 차지하면 이후 테스트의 앱 부팅이 `modules/{id}/bootstrap/app.php` 를 + * 찾다 실패한다. (운영 진입점은 basePath 를 명시 전달하므로 영향이 없다.) + */ + #[Test] + public function registered_loader_list_still_points_at_the_project_root(): void + { + $registered = array_keys(ClassLoader::getRegisteredLoaders()); + + $this->assertNotEmpty($registered, '등록된 Composer 로더가 없습니다.'); + + $this->assertSame( + realpath(base_path('vendor')), + realpath($registered[0]), + 'Composer 로더 목록의 첫 항목이 루트 vendor 가 아닙니다 — 확장 vendor 로더가 ' + .'vendorDir 를 갖고 등록되어 Application::inferBasePath() 를 오염시킵니다.' + ); + } + + /** + * 확장(모듈/플러그인)의 vendor classmap 파일 경로를 모읍니다. + * + * @return array classmap 파일 절대 경로 목록 + */ + private function discoverExtensionVendorClassmaps(): array + { + $found = []; + + foreach (['modules', 'plugins'] as $type) { + foreach ([$type, $type.'/_bundled'] as $dir) { + foreach (glob(base_path($dir.'/*/vendor/composer/autoload_classmap.php')) ?: [] as $file) { + $found[] = $file; + } + } + } + + return $found; + } + + /** + * 확장 자신의 네임스페이스에 속하는 심볼인지 판정합니다. + * + * @param string $symbol FQCN 또는 PSR-4 접두사 + * @return bool 확장 자기 심볼이면 true + */ + private function isExtensionOwnSymbol(string $symbol): bool + { + return str_starts_with($symbol, 'Modules\\') || str_starts_with($symbol, 'Plugins\\'); + } + + /** + * 확장 식별자로부터 진입 클래스 FQCN 을 조립합니다. + * + * @param string $root 네임스페이스 루트 (Modules|Plugins) + * @param string $identifier 확장 식별자 (vendor-name) + * @return string|null FQCN. 식별자 형식이 아니면 null + */ + private function extensionEntryClass(string $root, string $identifier): ?string + { + $parts = explode('-', $identifier); + + if (count($parts) < 2) { + return null; + } + + $vendor = ucfirst($parts[0]); + $name = str_replace('_', '', ucwords($parts[1], '_')); + $entry = $root === 'Modules' ? 'Module' : 'Plugin'; + + return $root.'\\'.$vendor.'\\'.$name.'\\'.$entry; + } +} diff --git a/tests/Unit/Extension/PluginManagerSettingsTest.php b/tests/Unit/Extension/PluginManagerSettingsTest.php index 47856eb1..262c256d 100644 --- a/tests/Unit/Extension/PluginManagerSettingsTest.php +++ b/tests/Unit/Extension/PluginManagerSettingsTest.php @@ -3,6 +3,7 @@ namespace Tests\Unit\Extension; use App\Extension\PluginManager; +use App\Support\ExtensionStoragePath; use Illuminate\Support\Facades\File; use Illuminate\Support\Facades\Log; use Mockery; @@ -26,7 +27,7 @@ class PluginManagerSettingsTest extends TestCase { parent::setUp(); - $this->testSettingsDir = storage_path('app/plugins/test-init-plugin/settings'); + $this->testSettingsDir = ExtensionStoragePath::plugin('test-init-plugin', 'settings'); $this->testDefaultsDir = sys_get_temp_dir().'/g7_test_defaults_'.uniqid(); // 테스트용 디렉토리 정리 diff --git a/tests/Unit/Extension/SettingsMigratorTest.php b/tests/Unit/Extension/SettingsMigratorTest.php index 247576b8..5842ac5a 100644 --- a/tests/Unit/Extension/SettingsMigratorTest.php +++ b/tests/Unit/Extension/SettingsMigratorTest.php @@ -3,6 +3,7 @@ namespace Tests\Unit\Extension; use App\Extension\Helpers\SettingsMigrator; +use App\Support\ExtensionStoragePath; use Illuminate\Support\Facades\File; use Tests\TestCase; @@ -18,8 +19,8 @@ class SettingsMigratorTest extends TestCase { parent::setUp(); - $this->moduleSettingsDir = storage_path('app/modules/test-migrator-mod/settings'); - $this->pluginSettingsDir = storage_path('app/plugins/test-migrator-plug/settings'); + $this->moduleSettingsDir = ExtensionStoragePath::module('test-migrator-mod', 'settings'); + $this->pluginSettingsDir = ExtensionStoragePath::plugin('test-migrator-plug', 'settings'); $this->moduleDir = base_path('modules/test-migrator-mod'); // 모듈 설정 디렉토리 및 파일 생성 @@ -59,12 +60,12 @@ class SettingsMigratorTest extends TestCase protected function tearDown(): void { - if (File::isDirectory(storage_path('app/modules/test-migrator-mod'))) { - File::deleteDirectory(storage_path('app/modules/test-migrator-mod')); + if (File::isDirectory(ExtensionStoragePath::module('test-migrator-mod'))) { + File::deleteDirectory(ExtensionStoragePath::module('test-migrator-mod')); } - if (File::isDirectory(storage_path('app/plugins/test-migrator-plug'))) { - File::deleteDirectory(storage_path('app/plugins/test-migrator-plug')); + if (File::isDirectory(ExtensionStoragePath::plugin('test-migrator-plug'))) { + File::deleteDirectory(ExtensionStoragePath::plugin('test-migrator-plug')); } if (File::isDirectory($this->moduleDir)) { diff --git a/tests/Unit/Helpers/FilePermissionHelperWritableDirectoryTest.php b/tests/Unit/Helpers/FilePermissionHelperWritableDirectoryTest.php new file mode 100644 index 00000000..8112e200 --- /dev/null +++ b/tests/Unit/Helpers/FilePermissionHelperWritableDirectoryTest.php @@ -0,0 +1,186 @@ +root = storage_path('framework/testing/writable-dir-'.getmypid()); + File::deleteDirectory($this->root); + File::ensureDirectoryExists($this->root); + } + + protected function tearDown(): void + { + File::deleteDirectory($this->root); + + parent::tearDown(); + } + + /** + * PHP 경고를 `ErrorException` 으로 승격시키는 핸들러 아래에서 콜백을 실행합니다. + * + * `Illuminate\Foundation\Bootstrap\HandleExceptions::handleError()` 와 **동형**이어야 한다 — + * 그 핸들러는 `error_reporting() & $level` 을 확인하므로 `@` 로 억제된 진단은 승격시키지 + * 않는다. 이 검사를 빠뜨리면 억제를 존중하는 올바른 코드까지 실패로 보고해, 실제 운영에서는 + * 나지 않는 500 을 있다고 말하게 된다. + * + * 따라서 이 헬퍼가 잡아내는 것은 정확히 하나다 — **억제되지 않은 경고가 새어 나가는가.** + * `File::makeDirectory(..., force: true)` 를 `ensureDirectoryExists()` 로 되돌리면 여기서 걸린다. + * + * @param \Closure $callback 실행할 콜백 + * @return mixed 콜백 반환값 + */ + private function withWarningsAsExceptions(\Closure $callback): mixed + { + set_error_handler(static function (int $level, string $message, string $file = '', int $line = 0): bool { + if (error_reporting() & $level) { + throw new \ErrorException($message, 0, $level, $file, $line); + } + + return true; + }); + + try { + return $callback(); + } finally { + restore_error_handler(); + } + } + + /** + * 없는 디렉토리를 만들고 쓰기 가능으로 판정합니다. + */ + public function test_creates_missing_directory_and_reports_writable(): void + { + $target = $this->root.'/created/deeply/nested'; + + $this->assertFalse(is_dir($target)); + + $result = FilePermissionHelper::ensureWritableDirectory($target, 0775, $failure); + + $this->assertTrue($result); + $this->assertNull($failure); + $this->assertDirectoryExists($target); + $this->assertTrue(is_writable($target)); + } + + /** + * 이미 있는 쓰기 가능 디렉토리는 그대로 통과합니다 (재생성하지 않음). + */ + public function test_returns_true_for_existing_writable_directory(): void + { + $target = $this->root.'/existing'; + File::ensureDirectoryExists($target); + File::put($target.'/keep.txt', 'keep'); + + $this->assertTrue(FilePermissionHelper::ensureWritableDirectory($target, 0775, $failure)); + $this->assertNull($failure); + + // 내용이 보존됐다 = 지우고 다시 만들지 않았다. + $this->assertFileExists($target.'/keep.txt'); + } + + /** + * 같은 이름의 파일이 자리를 차지하면 경고 없이 실패 사유를 돌려줍니다. + */ + public function test_reports_occupied_by_file_without_raising_warning(): void + { + $target = $this->root.'/occupied'; + File::put($target, 'not a directory'); + + $failure = null; + $result = $this->withWarningsAsExceptions( + function () use ($target, &$failure) { + return FilePermissionHelper::ensureWritableDirectory($target, 0775, $failure); + } + ); + + $this->assertFalse($result); + $this->assertSame('occupied_by_file', $failure['reason']); + $this->assertSame($target, $failure['path']); + } + + /** + * 경로 중간이 파일이라 생성이 불가능해도 경고 없이 실패 사유를 돌려줍니다. + * + * 상위(`$this->root`)는 쓰기 가능하므로 `ancestor_not_writable` 로 걸러지지 않고 실제 + * `mkdir` 까지 가서 실패하는 경로다 — 억제되지 않은 `mkdir` 이었다면 여기서 경고가 난다. + */ + public function test_reports_create_failed_when_a_path_segment_is_a_file(): void + { + $blocker = $this->root.'/blocker'; + File::put($blocker, 'file in the middle of the path'); + + $target = $blocker.'/sub/cache'; + + $failure = null; + $result = $this->withWarningsAsExceptions( + function () use ($target, &$failure) { + return FilePermissionHelper::ensureWritableDirectory($target, 0775, $failure); + } + ); + + $this->assertFalse($result); + $this->assertSame('create_failed', $failure['reason']); + $this->assertSame($target, $failure['path']); + $this->assertDirectoryDoesNotExist($target); + } + + /** + * 실재하는 최근접 상위를 찾아 올라갑니다. + */ + public function test_nearest_existing_ancestor_walks_up_to_first_existing_directory(): void + { + $this->assertSame( + rtrim($this->root, '/\\'), + rtrim((string) FilePermissionHelper::nearestExistingAncestor($this->root.'/a/b/c'), '/\\') + ); + + $existing = $this->root.'/present'; + File::ensureDirectoryExists($existing); + + $this->assertSame( + rtrim($existing, '/\\'), + rtrim((string) FilePermissionHelper::nearestExistingAncestor($existing.'/child'), '/\\') + ); + } + + /** + * 정합화는 대상이 없어도 예외·경고를 내지 않습니다. + * + * `hardenDirectory()` 는 `@` 억제 chmod 와 소유권 상속만 수행하므로, 경합으로 대상이 + * 사라진 상황에서도 호출자에게 실패를 던지지 않아야 한다. + */ + public function test_harden_directory_is_silent_when_target_is_absent(): void + { + $missing = $this->root.'/vanished'; + + $this->withWarningsAsExceptions(function () use ($missing): void { + FilePermissionHelper::hardenDirectory($missing, 0775); + }); + + $this->assertDirectoryDoesNotExist($missing); + } +} diff --git a/tests/Unit/Services/ModuleSettingsServiceTest.php b/tests/Unit/Services/ModuleSettingsServiceTest.php index cd76e353..1c2a54d0 100644 --- a/tests/Unit/Services/ModuleSettingsServiceTest.php +++ b/tests/Unit/Services/ModuleSettingsServiceTest.php @@ -2,11 +2,11 @@ namespace Tests\Unit\Services; -use App\Contracts\Extension\ModuleInterface; use App\Extension\ModuleManager; use App\Extension\TemplateManager; use App\Services\LayoutService; use App\Services\ModuleSettingsService; +use App\Support\ExtensionStoragePath; use Illuminate\Support\Facades\Crypt; use Illuminate\Support\Facades\File; use Mockery; @@ -48,7 +48,7 @@ class ModuleSettingsServiceTest extends TestCase ); // 테스트용 설정 디렉토리 경로 - $this->testSettingsDir = storage_path('app/modules'); + $this->testSettingsDir = dirname(ExtensionStoragePath::module('placeholder')); } // ======================================================================== diff --git a/tests/Unit/Services/PluginSettingsServiceTest.php b/tests/Unit/Services/PluginSettingsServiceTest.php index 9f0a8ad0..3a6fb72b 100644 --- a/tests/Unit/Services/PluginSettingsServiceTest.php +++ b/tests/Unit/Services/PluginSettingsServiceTest.php @@ -6,6 +6,7 @@ use App\Extension\PluginManager; use App\Extension\TemplateManager; use App\Services\LayoutService; use App\Services\PluginSettingsService; +use App\Support\ExtensionStoragePath; use Illuminate\Support\Facades\Crypt; use Mockery; use Tests\Helpers\MocksExtensions; @@ -46,7 +47,7 @@ class PluginSettingsServiceTest extends TestCase ); // 테스트용 설정 디렉토리 경로 - $this->testSettingsDir = storage_path('app/plugins'); + $this->testSettingsDir = dirname(ExtensionStoragePath::plugin('placeholder')); } // ======================================================================== diff --git a/tests/bootstrap.php b/tests/bootstrap.php index c6f44f01..880bb2ca 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -1,5 +1,7 @@ str_starts_with($symbol, 'Modules\\') + || str_starts_with($symbol, 'Plugins\\'); + +foreach (['modules', 'plugins'] as $extensionType) { + foreach ([__DIR__.'/../'.$extensionType, __DIR__.'/../'.$extensionType.'/_bundled'] as $searchDir) { + if (! is_dir($searchDir)) { + continue; + } + + foreach (scandir($searchDir) ?: [] as $entry) { + if ($entry === '.' || $entry === '..' || $entry === '_bundled' || $entry === '_pending') { + continue; + } + + $vendorDir = $searchDir.'/'.$entry.'/vendor'; + $classmapFile = $vendorDir.'/composer/autoload_classmap.php'; + + if (! is_dir($vendorDir) || ! file_exists($classmapFile)) { + continue; + } + + // 먼저 발견한 것(활성 디렉토리)이 이긴다 — 같은 클래스를 뒤에서 덮어쓰지 않는다. + foreach (require $classmapFile as $fqcn => $path) { + if (! $isExtensionOwnSymbol($fqcn) && ! isset($extensionVendorClassMap[$fqcn])) { + $extensionVendorClassMap[$fqcn] = $path; + } + } + + $psr4File = $vendorDir.'/composer/autoload_psr4.php'; + if (file_exists($psr4File)) { + foreach (require $psr4File as $prefix => $paths) { + if (! $isExtensionOwnSymbol($prefix)) { + $extensionVendorLoader->addPsr4($prefix, $paths); + } + } + } + + // 패키지가 요구하는 부트스트랩 파일(HTMLPurifier 의 HTMLPURIFIER_PREFIX 정의 등). + // vendor 디렉토리 바깥의 항목(확장 자신의 helpers)은 제외한다. + $filesFile = $vendorDir.'/composer/autoload_files.php'; + if (file_exists($filesFile)) { + $vendorReal = realpath($vendorDir) ?: $vendorDir; + + foreach (require $filesFile as $file) { + if (str_starts_with(realpath($file) ?: $file, $vendorReal)) { + $extensionVendorFiles[] = $file; + } + } + } + } + } +} + +if ($extensionVendorClassMap !== []) { + $extensionVendorLoader->addClassMap($extensionVendorClassMap); +} + +// vendorDir 를 주지 않았으므로 register() 가 registeredLoaders 를 건드리지 않는다. +$extensionVendorLoader->register(); + +foreach ($extensionVendorFiles as $extensionVendorFile) { + require_once $extensionVendorFile; +} + // 모듈/플러그인 테스트 네임스페이스 등록 (tests/ 디렉토리) $modulesDir = __DIR__.'/../modules'; if (is_dir($modulesDir)) { diff --git a/tests/scenarios/extension-test-isolation.yaml b/tests/scenarios/extension-test-isolation.yaml index 52cd9b1b..f7861e97 100644 --- a/tests/scenarios/extension-test-isolation.yaml +++ b/tests/scenarios/extension-test-isolation.yaml @@ -67,6 +67,7 @@ effects: - allowlisted_plugin_middleware_is_registered_in_web_group - selfExtension_returns_null_for_core_tests - production_env_keeps_full_extension_loading + - tests_do_not_boot_with_production_route_cache test_files: - tests/Unit/Extension/ExtensionTestAllowlistTest.php