domma-js 0.27.2 → 0.27.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,130 @@
1
+ /**
2
+ * Domma Flags Module - TypeScript Declarations
3
+ * Nation flags as inline SVG, keyed by ISO 3166-1 alpha-2 code.
4
+ *
5
+ * Opt-in module: load domma-flags.min.js after domma.min.js.
6
+ * Exposes the FL global and Domma.flags / Domma.FL.
7
+ */
8
+
9
+ export type FlagRegion = 'europe' | 'americas' | 'africa' | 'asia' | 'oceania' | string;
10
+
11
+ export type FlagShape = 'rect' | 'rounded' | 'square' | 'circle';
12
+
13
+ /** A single overlay primitive used to compose a flag. */
14
+ export interface FlagOverlay {
15
+ type: 'rect' | 'circle' | 'ellipse' | 'line' | 'path' | 'star' | 'crescent' | 'group';
16
+ fill?: string;
17
+ stroke?: string;
18
+ strokeWidth?: number;
19
+ [key: string]: unknown;
20
+ }
21
+
22
+ /** A flag definition — either raw SVG markup or a compact descriptor. */
23
+ export interface FlagDefinition {
24
+ /** Country name */
25
+ name: string;
26
+ /** Region group (defaults to 'custom' when registered) */
27
+ region?: FlagRegion;
28
+ /** Raw inner SVG markup (60×40 canvas) */
29
+ svg?: string;
30
+ /** Solid background colour */
31
+ bg?: string;
32
+ /** Stripe descriptor */
33
+ stripes?: {
34
+ dir?: 'h' | 'v';
35
+ colors: string[];
36
+ weights?: number[];
37
+ };
38
+ /** Nordic (offset) cross descriptor */
39
+ cross?: {
40
+ bg: string;
41
+ colour: string;
42
+ border?: string;
43
+ thickness?: number;
44
+ };
45
+ /** Overlay primitives drawn on top */
46
+ overlays?: FlagOverlay[];
47
+ }
48
+
49
+ /** Options for rendering a flag. */
50
+ export interface FlagRenderOptions {
51
+ /** Height in px; width follows the 3:2 aspect (default 24) */
52
+ size?: number;
53
+ /** Explicit width override */
54
+ width?: number;
55
+ /** Explicit height override */
56
+ height?: number;
57
+ /** Output shape (default 'rect') */
58
+ shape?: FlagShape;
59
+ /** Add a hairline border; pass a colour string to customise */
60
+ border?: boolean | string;
61
+ /** Extra CSS classes */
62
+ class?: string;
63
+ /** Accessible title (defaults to the country name) */
64
+ title?: string;
65
+ /** Additional SVG attributes */
66
+ attrs?: Record<string, string>;
67
+ }
68
+
69
+ export interface FlagInjectOptions extends FlagRenderOptions {
70
+ /** Where to place the flag relative to the target (default 'prepend') */
71
+ position?: 'prepend' | 'append' | 'replace';
72
+ }
73
+
74
+ export interface FlagRegionMeta {
75
+ name: string;
76
+ description?: string;
77
+ codes: string[];
78
+ }
79
+
80
+ /** The flag registry (FL / Domma.flags). */
81
+ export interface Flags {
82
+ /** Render a flag as an SVG element. */
83
+ render(code: string, options?: FlagRenderOptions): SVGElement | null;
84
+
85
+ /** Get a flag as an HTML string. */
86
+ html(code: string, options?: FlagRenderOptions): string;
87
+
88
+ /** Inject a flag into a target element or selector. */
89
+ inject(target: string | HTMLElement, code: string, options?: FlagInjectOptions): SVGElement | null;
90
+
91
+ /** Replace all [data-flag] elements within a container with SVGs. */
92
+ scan(container?: HTMLElement | string): number;
93
+
94
+ /** Register (or override) a flag. */
95
+ register(code: string, definition: FlagDefinition): Flags;
96
+
97
+ /** Remove a registered flag. */
98
+ unregister(code: string): boolean;
99
+
100
+ /** Whether a flag exists. */
101
+ has(code: string): boolean;
102
+
103
+ /** Get a flag definition. */
104
+ get(code: string): FlagDefinition | null;
105
+
106
+ /** Get the country name for a code. */
107
+ name(code: string): string | null;
108
+
109
+ /** List flag codes, optionally filtered by region. */
110
+ list(region?: FlagRegion): string[];
111
+
112
+ /** List all regions with metadata. */
113
+ listRegions(): Record<string, FlagRegionMeta>;
114
+
115
+ /** Total number of flags. */
116
+ count(): number;
117
+
118
+ /** Search flags by code or country name. */
119
+ search(query: string): string[];
120
+ }
121
+
122
+ export const flags: Flags;
123
+
124
+ declare global {
125
+ /**
126
+ * FL - Domma Flags (opt-in module)
127
+ * Nation flags as inline SVG, keyed by ISO 3166-1 alpha-2 code.
128
+ */
129
+ const FL: Flags;
130
+ }
@@ -18,6 +18,7 @@ export * from './storage';
18
18
  export * from './http';
19
19
  export * from './theme';
20
20
  export * from './icons';
21
+ export * from './flags';
21
22
 
22
23
  // Import types for the main Domma object
23
24
  import {dom, DommaCollection} from './dom';
@@ -31,6 +32,7 @@ import {Storage, storage} from './storage';
31
32
  import {Http, http} from './http';
32
33
  import {Theme, theme} from './theme';
33
34
  import {Icons, icons} from './icons';
35
+ import {Flags} from './flags';
34
36
 
35
37
  // ============================================
36
38
  // Main Domma Interface
@@ -81,6 +83,12 @@ export interface DommaStatic {
81
83
  /** Icon library */
82
84
  icons: Icons;
83
85
 
86
+ /** Nation flags (opt-in module — present when domma-flags is loaded) */
87
+ flags?: Flags;
88
+
89
+ /** Alias for {@link DommaStatic.flags} (opt-in module) */
90
+ FL?: Flags;
91
+
84
92
  // ============================================
85
93
  // ConfigEngine Methods ($.setup, $.config, etc.)
86
94
  // ============================================
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "domma-js",
3
- "version": "0.27.2",
3
+ "version": "0.27.4",
4
4
  "description": "Dynamic Object Manipulation & Modeling API - A complete front-end toolkit.",
5
5
  "main": "public/dist/domma.min.js",
6
6
  "module": "public/dist/domma.esm.js",
@@ -22,6 +22,8 @@
22
22
  "public/dist/grid.css",
23
23
  "public/dist/syntax.css",
24
24
  "public/dist/domma-syntax.min.js",
25
+ "public/dist/domma-flags.min.js",
26
+ "public/dist/domma-flags.esm.js",
25
27
  "public/dist/themes/",
26
28
  "assets/types/",
27
29
  "LICENSE",
@@ -1,8 +1,8 @@
1
1
  /*!
2
- * Domma Complete CSS Bundle v0.27.2
2
+ * Domma Complete CSS Bundle v0.27.4
3
3
  * Dynamic Object Manipulation & Modeling API
4
4
  * (c) 2026 Darryl Waterhouse & DCBW-IT
5
- * Built: 2026-06-12T14:31:25.476Z
5
+ * Built: 2026-06-14T20:51:31.774Z
6
6
  */
7
7
 
8
8
  /* ============================================
@@ -11,11 +11,11 @@
11
11
  ============================================ */
12
12
 
13
13
  /*!
14
- * Domma Core CSS v0.27.2
14
+ * Domma Core CSS v0.27.4
15
15
  * Dynamic Object Manipulation & Modeling API
16
16
  * (c) 2026 Darryl Waterhouse & DCBW-IT
17
- * Built: 2026-06-12T14:31:25.341Z
18
- * Commit: f8dcf15
17
+ * Built: 2026-06-14T20:51:31.637Z
18
+ * Commit: f33c102
19
19
  */
20
20
 
21
21
  /**
@@ -4829,11 +4829,11 @@ body.dm-cloaked.dm-ready {
4829
4829
  ============================================ */
4830
4830
 
4831
4831
  /*!
4832
- * Domma Grid CSS v0.27.2
4832
+ * Domma Grid CSS v0.27.4
4833
4833
  * Dynamic Object Manipulation & Modeling API
4834
4834
  * (c) 2026 Darryl Waterhouse & DCBW-IT
4835
- * Built: 2026-06-12T14:31:25.344Z
4836
- * Commit: f8dcf15
4835
+ * Built: 2026-06-14T20:51:31.641Z
4836
+ * Commit: f33c102
4837
4837
  */
4838
4838
 
4839
4839
  /**
@@ -5454,11 +5454,11 @@ body.dm-cloaked.dm-ready {
5454
5454
  ============================================ */
5455
5455
 
5456
5456
  /*!
5457
- * Domma Elements CSS v0.27.2
5457
+ * Domma Elements CSS v0.27.4
5458
5458
  * Dynamic Object Manipulation & Modeling API
5459
5459
  * (c) 2026 Darryl Waterhouse & DCBW-IT
5460
- * Built: 2026-06-12T14:31:25.349Z
5461
- * Commit: f8dcf15
5460
+ * Built: 2026-06-14T20:51:31.646Z
5461
+ * Commit: f33c102
5462
5462
  */
5463
5463
 
5464
5464
  /**
@@ -8059,6 +8059,19 @@ code {
8059
8059
  border-color: var(--dm-border-dark, var(--dm-border));
8060
8060
  }
8061
8061
 
8062
+ /* Collision classes toggled by Navbar._positionMenu() to keep menus on-screen:
8063
+ a flyout that overruns the right edge opens to the left of its parent instead,
8064
+ and a top-level menu near the right edge right-aligns under its toggle. */
8065
+ .navbar-dropdown-submenu.navbar-dropdown-flip-x {
8066
+ left: auto;
8067
+ right: 100%;
8068
+ margin: 0 0.25rem 0 0;
8069
+ }
8070
+ .navbar-dropdown-menu.navbar-dropdown-flip-end {
8071
+ left: auto;
8072
+ right: 0;
8073
+ }
8074
+
8062
8075
  /* On mobile the nested menu stacks and indents instead of flying out */
8063
8076
  @media (max-width: 992px) {
8064
8077
  .navbar-dropdown-submenu {
@@ -13400,11 +13413,11 @@ code {
13400
13413
  ============================================ */
13401
13414
 
13402
13415
  /*!
13403
- * Domma Themes v0.27.2
13416
+ * Domma Themes v0.27.4
13404
13417
  * Dynamic Object Manipulation & Modeling API
13405
13418
  * (c) 2026 Darryl Waterhouse & DCBW-IT
13406
- * Built: 2026-06-12T14:31:25.329Z
13407
- * Commit: f8dcf15
13419
+ * Built: 2026-06-14T20:51:31.625Z
13420
+ * Commit: f33c102
13408
13421
  */
13409
13422
 
13410
13423
  /**
@@ -1,8 +1,8 @@
1
1
  /*!
2
- * Domma Data-Focused CSS Bundle v0.27.2
2
+ * Domma Data-Focused CSS Bundle v0.27.4
3
3
  * Dynamic Object Manipulation & Modeling API
4
4
  * (c) 2026 Darryl Waterhouse & DCBW-IT
5
- * Built: 2026-06-12T14:31:25.473Z
5
+ * Built: 2026-06-14T20:51:31.772Z
6
6
  */
7
7
 
8
8
  /* ============================================
@@ -11,11 +11,11 @@
11
11
  ============================================ */
12
12
 
13
13
  /*!
14
- * Domma Core CSS v0.27.2
14
+ * Domma Core CSS v0.27.4
15
15
  * Dynamic Object Manipulation & Modeling API
16
16
  * (c) 2026 Darryl Waterhouse & DCBW-IT
17
- * Built: 2026-06-12T14:31:25.341Z
18
- * Commit: f8dcf15
17
+ * Built: 2026-06-14T20:51:31.637Z
18
+ * Commit: f33c102
19
19
  */
20
20
 
21
21
  /**
@@ -4829,11 +4829,11 @@ body.dm-cloaked.dm-ready {
4829
4829
  ============================================ */
4830
4830
 
4831
4831
  /*!
4832
- * Domma Grid CSS v0.27.2
4832
+ * Domma Grid CSS v0.27.4
4833
4833
  * Dynamic Object Manipulation & Modeling API
4834
4834
  * (c) 2026 Darryl Waterhouse & DCBW-IT
4835
- * Built: 2026-06-12T14:31:25.344Z
4836
- * Commit: f8dcf15
4835
+ * Built: 2026-06-14T20:51:31.641Z
4836
+ * Commit: f33c102
4837
4837
  */
4838
4838
 
4839
4839
  /**
@@ -5454,11 +5454,11 @@ body.dm-cloaked.dm-ready {
5454
5454
  ============================================ */
5455
5455
 
5456
5456
  /*!
5457
- * Domma Elements CSS v0.27.2
5457
+ * Domma Elements CSS v0.27.4
5458
5458
  * Dynamic Object Manipulation & Modeling API
5459
5459
  * (c) 2026 Darryl Waterhouse & DCBW-IT
5460
- * Built: 2026-06-12T14:31:25.349Z
5461
- * Commit: f8dcf15
5460
+ * Built: 2026-06-14T20:51:31.646Z
5461
+ * Commit: f33c102
5462
5462
  */
5463
5463
 
5464
5464
  /**
@@ -8059,6 +8059,19 @@ code {
8059
8059
  border-color: var(--dm-border-dark, var(--dm-border));
8060
8060
  }
8061
8061
 
8062
+ /* Collision classes toggled by Navbar._positionMenu() to keep menus on-screen:
8063
+ a flyout that overruns the right edge opens to the left of its parent instead,
8064
+ and a top-level menu near the right edge right-aligns under its toggle. */
8065
+ .navbar-dropdown-submenu.navbar-dropdown-flip-x {
8066
+ left: auto;
8067
+ right: 100%;
8068
+ margin: 0 0.25rem 0 0;
8069
+ }
8070
+ .navbar-dropdown-menu.navbar-dropdown-flip-end {
8071
+ left: auto;
8072
+ right: 0;
8073
+ }
8074
+
8062
8075
  /* On mobile the nested menu stacks and indents instead of flying out */
8063
8076
  @media (max-width: 992px) {
8064
8077
  .navbar-dropdown-submenu {
@@ -13400,11 +13413,11 @@ code {
13400
13413
  ============================================ */
13401
13414
 
13402
13415
  /*!
13403
- * Domma Themes v0.27.2
13416
+ * Domma Themes v0.27.4
13404
13417
  * Dynamic Object Manipulation & Modeling API
13405
13418
  * (c) 2026 Darryl Waterhouse & DCBW-IT
13406
- * Built: 2026-06-12T14:31:25.329Z
13407
- * Commit: f8dcf15
13419
+ * Built: 2026-06-14T20:51:31.625Z
13420
+ * Commit: f33c102
13408
13421
  */
13409
13422
 
13410
13423
  /**
@@ -1,8 +1,8 @@
1
1
  /*!
2
- * Domma Essentials CSS Bundle v0.27.2
2
+ * Domma Essentials CSS Bundle v0.27.4
3
3
  * Dynamic Object Manipulation & Modeling API
4
4
  * (c) 2026 Darryl Waterhouse & DCBW-IT
5
- * Built: 2026-06-12T14:31:25.467Z
5
+ * Built: 2026-06-14T20:51:31.765Z
6
6
  */
7
7
 
8
8
  /* ============================================
@@ -11,11 +11,11 @@
11
11
  ============================================ */
12
12
 
13
13
  /*!
14
- * Domma Core CSS v0.27.2
14
+ * Domma Core CSS v0.27.4
15
15
  * Dynamic Object Manipulation & Modeling API
16
16
  * (c) 2026 Darryl Waterhouse & DCBW-IT
17
- * Built: 2026-06-12T14:31:25.341Z
18
- * Commit: f8dcf15
17
+ * Built: 2026-06-14T20:51:31.637Z
18
+ * Commit: f33c102
19
19
  */
20
20
 
21
21
  /**
@@ -4829,11 +4829,11 @@ body.dm-cloaked.dm-ready {
4829
4829
  ============================================ */
4830
4830
 
4831
4831
  /*!
4832
- * Domma Grid CSS v0.27.2
4832
+ * Domma Grid CSS v0.27.4
4833
4833
  * Dynamic Object Manipulation & Modeling API
4834
4834
  * (c) 2026 Darryl Waterhouse & DCBW-IT
4835
- * Built: 2026-06-12T14:31:25.344Z
4836
- * Commit: f8dcf15
4835
+ * Built: 2026-06-14T20:51:31.641Z
4836
+ * Commit: f33c102
4837
4837
  */
4838
4838
 
4839
4839
  /**
@@ -5454,11 +5454,11 @@ body.dm-cloaked.dm-ready {
5454
5454
  ============================================ */
5455
5455
 
5456
5456
  /*!
5457
- * Domma Elements CSS v0.27.2
5457
+ * Domma Elements CSS v0.27.4
5458
5458
  * Dynamic Object Manipulation & Modeling API
5459
5459
  * (c) 2026 Darryl Waterhouse & DCBW-IT
5460
- * Built: 2026-06-12T14:31:25.349Z
5461
- * Commit: f8dcf15
5460
+ * Built: 2026-06-14T20:51:31.646Z
5461
+ * Commit: f33c102
5462
5462
  */
5463
5463
 
5464
5464
  /**
@@ -8059,6 +8059,19 @@ code {
8059
8059
  border-color: var(--dm-border-dark, var(--dm-border));
8060
8060
  }
8061
8061
 
8062
+ /* Collision classes toggled by Navbar._positionMenu() to keep menus on-screen:
8063
+ a flyout that overruns the right edge opens to the left of its parent instead,
8064
+ and a top-level menu near the right edge right-aligns under its toggle. */
8065
+ .navbar-dropdown-submenu.navbar-dropdown-flip-x {
8066
+ left: auto;
8067
+ right: 100%;
8068
+ margin: 0 0.25rem 0 0;
8069
+ }
8070
+ .navbar-dropdown-menu.navbar-dropdown-flip-end {
8071
+ left: auto;
8072
+ right: 0;
8073
+ }
8074
+
8062
8075
  /* On mobile the nested menu stacks and indents instead of flying out */
8063
8076
  @media (max-width: 992px) {
8064
8077
  .navbar-dropdown-submenu {
@@ -13400,11 +13413,11 @@ code {
13400
13413
  ============================================ */
13401
13414
 
13402
13415
  /*!
13403
- * Domma Themes v0.27.2
13416
+ * Domma Themes v0.27.4
13404
13417
  * Dynamic Object Manipulation & Modeling API
13405
13418
  * (c) 2026 Darryl Waterhouse & DCBW-IT
13406
- * Built: 2026-06-12T14:31:25.329Z
13407
- * Commit: f8dcf15
13419
+ * Built: 2026-06-14T20:51:31.625Z
13420
+ * Commit: f33c102
13408
13421
  */
13409
13422
 
13410
13423
  /**
@@ -1,8 +1,8 @@
1
1
  /*!
2
- * Domma Full CSS Bundle v0.27.2
2
+ * Domma Full CSS Bundle v0.27.4
3
3
  * Dynamic Object Manipulation & Modeling API
4
4
  * (c) 2026 Darryl Waterhouse & DCBW-IT
5
- * Built: 2026-06-12T14:31:25.470Z
5
+ * Built: 2026-06-14T20:51:31.769Z
6
6
  */
7
7
 
8
8
  /* ============================================
@@ -11,11 +11,11 @@
11
11
  ============================================ */
12
12
 
13
13
  /*!
14
- * Domma Core CSS v0.27.2
14
+ * Domma Core CSS v0.27.4
15
15
  * Dynamic Object Manipulation & Modeling API
16
16
  * (c) 2026 Darryl Waterhouse & DCBW-IT
17
- * Built: 2026-06-12T14:31:25.341Z
18
- * Commit: f8dcf15
17
+ * Built: 2026-06-14T20:51:31.637Z
18
+ * Commit: f33c102
19
19
  */
20
20
 
21
21
  /**
@@ -4829,11 +4829,11 @@ body.dm-cloaked.dm-ready {
4829
4829
  ============================================ */
4830
4830
 
4831
4831
  /*!
4832
- * Domma Grid CSS v0.27.2
4832
+ * Domma Grid CSS v0.27.4
4833
4833
  * Dynamic Object Manipulation & Modeling API
4834
4834
  * (c) 2026 Darryl Waterhouse & DCBW-IT
4835
- * Built: 2026-06-12T14:31:25.344Z
4836
- * Commit: f8dcf15
4835
+ * Built: 2026-06-14T20:51:31.641Z
4836
+ * Commit: f33c102
4837
4837
  */
4838
4838
 
4839
4839
  /**
@@ -5454,11 +5454,11 @@ body.dm-cloaked.dm-ready {
5454
5454
  ============================================ */
5455
5455
 
5456
5456
  /*!
5457
- * Domma Elements CSS v0.27.2
5457
+ * Domma Elements CSS v0.27.4
5458
5458
  * Dynamic Object Manipulation & Modeling API
5459
5459
  * (c) 2026 Darryl Waterhouse & DCBW-IT
5460
- * Built: 2026-06-12T14:31:25.349Z
5461
- * Commit: f8dcf15
5460
+ * Built: 2026-06-14T20:51:31.646Z
5461
+ * Commit: f33c102
5462
5462
  */
5463
5463
 
5464
5464
  /**
@@ -8059,6 +8059,19 @@ code {
8059
8059
  border-color: var(--dm-border-dark, var(--dm-border));
8060
8060
  }
8061
8061
 
8062
+ /* Collision classes toggled by Navbar._positionMenu() to keep menus on-screen:
8063
+ a flyout that overruns the right edge opens to the left of its parent instead,
8064
+ and a top-level menu near the right edge right-aligns under its toggle. */
8065
+ .navbar-dropdown-submenu.navbar-dropdown-flip-x {
8066
+ left: auto;
8067
+ right: 100%;
8068
+ margin: 0 0.25rem 0 0;
8069
+ }
8070
+ .navbar-dropdown-menu.navbar-dropdown-flip-end {
8071
+ left: auto;
8072
+ right: 0;
8073
+ }
8074
+
8062
8075
  /* On mobile the nested menu stacks and indents instead of flying out */
8063
8076
  @media (max-width: 992px) {
8064
8077
  .navbar-dropdown-submenu {
@@ -13400,11 +13413,11 @@ code {
13400
13413
  ============================================ */
13401
13414
 
13402
13415
  /*!
13403
- * Domma Themes v0.27.2
13416
+ * Domma Themes v0.27.4
13404
13417
  * Dynamic Object Manipulation & Modeling API
13405
13418
  * (c) 2026 Darryl Waterhouse & DCBW-IT
13406
- * Built: 2026-06-12T14:31:25.329Z
13407
- * Commit: f8dcf15
13419
+ * Built: 2026-06-14T20:51:31.625Z
13420
+ * Commit: f33c102
13408
13421
  */
13409
13422
 
13410
13423
  /**
@@ -1,8 +1,8 @@
1
1
  /*!
2
- * Domma Minimal CSS Bundle v0.27.2
2
+ * Domma Minimal CSS Bundle v0.27.4
3
3
  * Dynamic Object Manipulation & Modeling API
4
4
  * (c) 2026 Darryl Waterhouse & DCBW-IT
5
- * Built: 2026-06-12T14:31:25.466Z
5
+ * Built: 2026-06-14T20:51:31.764Z
6
6
  */
7
7
 
8
8
  /* ============================================
@@ -11,11 +11,11 @@
11
11
  ============================================ */
12
12
 
13
13
  /*!
14
- * Domma Core CSS v0.27.2
14
+ * Domma Core CSS v0.27.4
15
15
  * Dynamic Object Manipulation & Modeling API
16
16
  * (c) 2026 Darryl Waterhouse & DCBW-IT
17
- * Built: 2026-06-12T14:31:25.341Z
18
- * Commit: f8dcf15
17
+ * Built: 2026-06-14T20:51:31.637Z
18
+ * Commit: f33c102
19
19
  */
20
20
 
21
21
  /**
@@ -4829,11 +4829,11 @@ body.dm-cloaked.dm-ready {
4829
4829
  ============================================ */
4830
4830
 
4831
4831
  /*!
4832
- * Domma Grid CSS v0.27.2
4832
+ * Domma Grid CSS v0.27.4
4833
4833
  * Dynamic Object Manipulation & Modeling API
4834
4834
  * (c) 2026 Darryl Waterhouse & DCBW-IT
4835
- * Built: 2026-06-12T14:31:25.344Z
4836
- * Commit: f8dcf15
4835
+ * Built: 2026-06-14T20:51:31.641Z
4836
+ * Commit: f33c102
4837
4837
  */
4838
4838
 
4839
4839
  /**
@@ -0,0 +1,10 @@
1
+ /*!
2
+ * Domma Flags v0.27.4
3
+ * Nation flags as inline SVG (opt-in module)
4
+ * (c) 2026 Darryl Waterhouse & DCBW-IT
5
+ * Built: 2026-06-14T20:51:23.716Z
6
+ * Commit: f33c102
7
+ *
8
+ * Requires: domma.min.js
9
+ */
10
+ const e={gb:{name:"United Kingdom",svg:'<rect width="60" height="40" fill="#012169"/><path d="M0,0 60,40 M60,0 0,40" stroke="#fff" stroke-width="8"/><path d="M0,0 60,40 M60,0 0,40" stroke="#C8102E" stroke-width="4"/><path d="M30,0 V40 M0,20 H60" stroke="#fff" stroke-width="13"/><path d="M30,0 V40 M0,20 H60" stroke="#C8102E" stroke-width="8"/>'},fr:{name:"France",stripes:{dir:"v",colors:["#0055A4","#FFFFFF","#EF4135"]}},de:{name:"Germany",stripes:{dir:"h",colors:["#000000","#DD0000","#FFCE00"]}},it:{name:"Italy",stripes:{dir:"v",colors:["#009246","#FFFFFF","#CE2B37"]}},es:{name:"Spain",stripes:{dir:"h",colors:["#AA151B","#F1BF00","#AA151B"],weights:[1,2,1]}},pt:{name:"Portugal",stripes:{dir:"v",colors:["#006600","#FF0000"],weights:[2,3]},overlays:[{type:"circle",cx:24,cy:20,r:5,fill:"#FFE936",stroke:"#006600",strokeWidth:1},{type:"circle",cx:24,cy:20,r:2.4,fill:"#FF0000"}]},nl:{name:"Netherlands",stripes:{dir:"h",colors:["#AE1C28","#FFFFFF","#21468B"]}},be:{name:"Belgium",stripes:{dir:"v",colors:["#000000","#FAE042","#ED2939"]}},ie:{name:"Ireland",stripes:{dir:"v",colors:["#169B62","#FFFFFF","#FF883E"]}},ch:{name:"Switzerland",bg:"#FF0000",overlays:[{type:"rect",x:27,y:11,w:6,h:18,fill:"#fff"},{type:"rect",x:21,y:17,w:18,h:6,fill:"#fff"}]},at:{name:"Austria",stripes:{dir:"h",colors:["#ED2939","#FFFFFF","#ED2939"]}},se:{name:"Sweden",cross:{bg:"#006AA7",colour:"#FECC00"}},no:{name:"Norway",cross:{bg:"#BA0C2F",border:"#FFFFFF",colour:"#00205B"}},dk:{name:"Denmark",cross:{bg:"#C60C30",colour:"#FFFFFF"}},fi:{name:"Finland",cross:{bg:"#FFFFFF",colour:"#003580"}},is:{name:"Iceland",cross:{bg:"#02529C",border:"#FFFFFF",colour:"#DC1E35"}},pl:{name:"Poland",stripes:{dir:"h",colors:["#FFFFFF","#DC143C"]}},ua:{name:"Ukraine",stripes:{dir:"h",colors:["#0057B7","#FFD700"]}},gr:{name:"Greece",stripes:{dir:"h",colors:["#0D5EAF","#fff","#0D5EAF","#fff","#0D5EAF","#fff","#0D5EAF","#fff","#0D5EAF"]},overlays:[{type:"rect",x:0,y:0,w:22.22,h:22.22,fill:"#0D5EAF"},{type:"rect",x:8.9,y:0,w:4.44,h:22.22,fill:"#fff"},{type:"rect",x:0,y:8.9,w:22.22,h:4.44,fill:"#fff"}]},hr:{name:"Croatia",stripes:{dir:"h",colors:["#FF0000","#FFFFFF","#171796"]}},ru:{name:"Russia",stripes:{dir:"h",colors:["#FFFFFF","#0039A6","#D52B1E"]}},cz:{name:"Czechia",stripes:{dir:"h",colors:["#FFFFFF","#D7141A"]},overlays:[{type:"path",d:"M0,0 L30,20 L0,40 Z",fill:"#11457E"}]}},t={us:{name:"United States",svg:'<rect width="60" height="40" fill="#fff"/><g fill="#B22234"><rect y="0" width="60" height="3.08"/><rect y="6.15" width="60" height="3.08"/><rect y="12.31" width="60" height="3.08"/><rect y="18.46" width="60" height="3.08"/><rect y="24.62" width="60" height="3.08"/><rect y="30.77" width="60" height="3.08"/><rect y="36.92" width="60" height="3.08"/></g><rect width="24" height="21.54" fill="#3C3B6E"/><g fill="#fff"><circle cx="3" cy="3" r="0.9"/><circle cx="7" cy="3" r="0.9"/><circle cx="11" cy="3" r="0.9"/><circle cx="15" cy="3" r="0.9"/><circle cx="19" cy="3" r="0.9"/><circle cx="5" cy="6" r="0.9"/><circle cx="9" cy="6" r="0.9"/><circle cx="13" cy="6" r="0.9"/><circle cx="17" cy="6" r="0.9"/><circle cx="21" cy="6" r="0.9"/><circle cx="3" cy="9" r="0.9"/><circle cx="7" cy="9" r="0.9"/><circle cx="11" cy="9" r="0.9"/><circle cx="15" cy="9" r="0.9"/><circle cx="19" cy="9" r="0.9"/><circle cx="5" cy="12" r="0.9"/><circle cx="9" cy="12" r="0.9"/><circle cx="13" cy="12" r="0.9"/><circle cx="17" cy="12" r="0.9"/><circle cx="21" cy="12" r="0.9"/><circle cx="3" cy="15" r="0.9"/><circle cx="7" cy="15" r="0.9"/><circle cx="11" cy="15" r="0.9"/><circle cx="15" cy="15" r="0.9"/><circle cx="19" cy="15" r="0.9"/><circle cx="5" cy="18" r="0.9"/><circle cx="9" cy="18" r="0.9"/><circle cx="13" cy="18" r="0.9"/><circle cx="17" cy="18" r="0.9"/><circle cx="21" cy="18" r="0.9"/></g>'},ca:{name:"Canada",stripes:{dir:"v",colors:["#FF0000","#FFFFFF","#FF0000"],weights:[1,2,1]},overlays:[{type:"path",fill:"#FF0000",d:"M30 8 l1.6 3.4 3.6-0.8-1.2 2.6 2.4 1-2 1.8 3.4 1-3.4 1 0.5 1.2-3.1-0.4 0.4 4-1.6-2.4-1.6 2.4 0.4-4-3.1 0.4 0.5-1.2-3.4-1 3.4-1-2-1.8 2.4-1-1.2-2.6 3.6 0.8z"}]},br:{name:"Brazil",bg:"#009C3B",overlays:[{type:"path",d:"M30,5 L53,20 L30,35 L7,20 Z",fill:"#FFDF00"},{type:"circle",cx:30,cy:20,r:9,fill:"#002776"},{type:"path",d:"M21.5,17.5 A12,12 0 0 1 38.5,21",fill:"none",stroke:"#fff",strokeWidth:1.6},{type:"star",cx:27,cy:18,r:1.1,fill:"#fff"},{type:"star",cx:33,cy:17,r:1.1,fill:"#fff"},{type:"star",cx:30,cy:23,r:1.1,fill:"#fff"},{type:"star",cx:35,cy:22,r:1.1,fill:"#fff"},{type:"star",cx:25,cy:22,r:1.1,fill:"#fff"}]},ar:{name:"Argentina",stripes:{dir:"h",colors:["#74ACDF","#FFFFFF","#74ACDF"]},overlays:[{type:"circle",cx:30,cy:20,r:3.4,fill:"#F6B40E",stroke:"#85340A",strokeWidth:.4}]},mx:{name:"Mexico",stripes:{dir:"v",colors:["#006847","#FFFFFF","#CE1126"]},overlays:[{type:"circle",cx:30,cy:20,r:3.2,fill:"#8C9A5B"}]},cl:{name:"Chile",overlays:[{type:"rect",x:0,y:0,w:60,h:20,fill:"#fff"},{type:"rect",x:0,y:20,w:60,h:20,fill:"#D52B1E"},{type:"rect",x:0,y:0,w:20,h:20,fill:"#0039A6"},{type:"star",cx:10,cy:10,r:6,fill:"#fff"}]},co:{name:"Colombia",stripes:{dir:"h",colors:["#FCD116","#003893","#CE1126"],weights:[2,1,1]}},pe:{name:"Peru",stripes:{dir:"v",colors:["#D91023","#FFFFFF","#D91023"]}},uy:{name:"Uruguay",stripes:{dir:"h",colors:["#fff","#0038A8","#fff","#0038A8","#fff","#0038A8","#fff","#0038A8","#fff"]},overlays:[{type:"rect",x:0,y:0,w:20,h:17.78,fill:"#fff"},{type:"circle",cx:10,cy:8.9,r:4.5,fill:"#FCD116",stroke:"#7B3F00",strokeWidth:.5}]}},r={za:{name:"South Africa",svg:'<rect width="60" height="40" fill="#fff"/><path d="M0,0 H22 L40,20 L22,40 H0 Z" fill="#002395"/><path d="M0,0 L26,20 L0,40 Z" fill="#000"/><rect x="0" y="0" width="60" height="13.3" fill="#DE3831"/><rect x="0" y="26.7" width="60" height="13.3" fill="#002395"/><path d="M0,0 L26,20 L0,40" fill="none" stroke="#FFB915" stroke-width="3"/><path d="M0,3 L21,20 L0,37" fill="none" stroke="#007749" stroke-width="6"/><path d="M-1,13.3 H60 M-1,26.7 H60" stroke="#fff" stroke-width="0"/><rect x="26" y="14.8" width="34" height="10.4" fill="#007749"/><path d="M0,6 L18,20 L0,34" fill="none" stroke="#fff" stroke-width="1.5"/>'},ng:{name:"Nigeria",stripes:{dir:"v",colors:["#008751","#FFFFFF","#008751"]}},gh:{name:"Ghana",stripes:{dir:"h",colors:["#CE1126","#FCD116","#006B3F"]},overlays:[{type:"star",cx:30,cy:20,r:5,fill:"#000"}]},eg:{name:"Egypt",stripes:{dir:"h",colors:["#CE1126","#FFFFFF","#000000"]},overlays:[{type:"path",d:"M30,17 l1.2,2.6 2.8-0.4-2,2 0.7,2.8-2.7-1.4-2.7,1.4 0.7-2.8-2-2 2.8,0.4z",fill:"#C09300"}]},ma:{name:"Morocco",bg:"#C1272D",overlays:[{type:"star",cx:30,cy:20,r:8,fill:"none",stroke:"#006233",strokeWidth:1.6}]},sn:{name:"Senegal",stripes:{dir:"v",colors:["#00853F","#FDEF42","#E31B23"]},overlays:[{type:"star",cx:30,cy:20,r:4.5,fill:"#00853F"}]},ci:{name:"Ivory Coast",stripes:{dir:"v",colors:["#F77F00","#FFFFFF","#009E60"]}},cm:{name:"Cameroon",stripes:{dir:"v",colors:["#007A5E","#CE1126","#FCD116"]},overlays:[{type:"star",cx:30,cy:20,r:4,fill:"#FCD116"}]},dz:{name:"Algeria",overlays:[{type:"rect",x:0,y:0,w:30,h:40,fill:"#006233"},{type:"rect",x:30,y:0,w:30,h:40,fill:"#fff"},{type:"crescent",cx:28,cy:20,r:7,off:3,fill:"#D21034"},{type:"star",cx:36,cy:20,r:4,fill:"#D21034"}]},tn:{name:"Tunisia",bg:"#E70013",overlays:[{type:"circle",cx:30,cy:20,r:9,fill:"#fff"},{type:"crescent",cx:31,cy:20,r:5.5,off:2.6,fill:"#E70013"},{type:"star",cx:33,cy:20,r:3,fill:"#E70013"}]},ke:{name:"Kenya",stripes:{dir:"h",colors:["#000000","#fff","#BB0000","#fff","#006600"],weights:[12,1,12,1,12]},overlays:[{type:"line",x1:24,y1:8,x2:36,y2:32,stroke:"#000",strokeWidth:1},{type:"line",x1:36,y1:8,x2:24,y2:32,stroke:"#000",strokeWidth:1},{type:"ellipse",cx:30,cy:20,rx:4,ry:8,fill:"#fff"},{type:"ellipse",cx:30,cy:20,rx:2.6,ry:6.4,fill:"#BB0000"}]}},i={jp:{name:"Japan",bg:"#FFFFFF",overlays:[{type:"circle",cx:30,cy:20,r:10,fill:"#BC002D"}]},cn:{name:"China",bg:"#DE2910",overlays:[{type:"star",cx:12,cy:11,r:6,fill:"#FFDE00"},{type:"star",cx:22,cy:5,r:2,fill:"#FFDE00"},{type:"star",cx:26,cy:9,r:2,fill:"#FFDE00"},{type:"star",cx:26,cy:15,r:2,fill:"#FFDE00"},{type:"star",cx:22,cy:19,r:2,fill:"#FFDE00"}]},kr:{name:"South Korea",bg:"#FFFFFF",overlays:[{type:"path",d:"M30,13 a7,7 0 0 1 0,14 a3.5,3.5 0 0 1 0,-7 a3.5,3.5 0 0 0 0,-7 Z",fill:"#CD2E3A"},{type:"path",d:"M30,13 a7,7 0 0 0 0,14 a3.5,3.5 0 0 0 0,-7 a3.5,3.5 0 0 1 0,-7 Z",fill:"#0047A0"},{type:"circle",cx:30,cy:16.5,r:3.5,fill:"#CD2E3A"},{type:"circle",cx:30,cy:23.5,r:3.5,fill:"#0047A0"},{type:"group",children:[{type:"rect",x:9,y:8,w:7,h:1.3,fill:"#000"},{type:"rect",x:9,y:10.4,w:7,h:1.3,fill:"#000"},{type:"rect",x:9,y:12.8,w:7,h:1.3,fill:"#000"}]},{type:"group",children:[{type:"rect",x:44,y:8,w:7,h:1.3,fill:"#000"},{type:"rect",x:44,y:10.4,w:7,h:1.3,fill:"#000"},{type:"rect",x:44,y:12.8,w:7,h:1.3,fill:"#000"}]}]},in:{name:"India",stripes:{dir:"h",colors:["#FF9933","#FFFFFF","#138808"]},overlays:[{type:"circle",cx:30,cy:20,r:5,fill:"none",stroke:"#000080",strokeWidth:.8},{type:"circle",cx:30,cy:20,r:1,fill:"#000080"},{type:"path",d:"M30,15 V25 M25,20 H35 M26.5,16.5 L33.5,23.5 M33.5,16.5 L26.5,23.5",stroke:"#000080",strokeWidth:.5}]},sa:{name:"Saudi Arabia",bg:"#006C35",overlays:[{type:"rect",x:10,y:26,w:40,h:1.6,fill:"#fff"},{type:"path",d:"M10,26.8 l4,-2 v4 z",fill:"#fff"},{type:"rect",x:14,y:14,w:32,h:5,fill:"none"}]},ae:{name:"United Arab Emirates",overlays:[{type:"rect",x:0,y:0,w:60,h:13.33,fill:"#00732F"},{type:"rect",x:0,y:13.33,w:60,h:13.33,fill:"#fff"},{type:"rect",x:0,y:26.66,w:60,h:13.34,fill:"#000"},{type:"rect",x:0,y:0,w:15,h:40,fill:"#FF0000"}]},qa:{name:"Qatar",bg:"#FFFFFF",overlays:[{type:"path",d:"M22,0 H60 V40 H22 L27,36 L22,32 L27,28 L22,24 L27,20 L22,16 L27,12 L22,8 L27,4 Z",fill:"#8A1538"}]},id:{name:"Indonesia",stripes:{dir:"h",colors:["#FF0000","#FFFFFF"]}},th:{name:"Thailand",stripes:{dir:"h",colors:["#A51931","#F4F5F8","#2D2A4A","#F4F5F8","#A51931"],weights:[1,1,2,1,1]}},vn:{name:"Vietnam",bg:"#DA251D",overlays:[{type:"star",cx:30,cy:20,r:9,fill:"#FFFF00"}]},tr:{name:"Turkey",bg:"#E30A17",overlays:[{type:"crescent",cx:24,cy:20,r:8,off:3.2,fill:"#fff"},{type:"star",cx:35,cy:20,r:4,rotation:-54,fill:"#fff"}]},il:{name:"Israel",bg:"#FFFFFF",overlays:[{type:"rect",x:0,y:4,w:60,h:4,fill:"#0038B8"},{type:"rect",x:0,y:32,w:60,h:4,fill:"#0038B8"},{type:"path",d:"M30,13 L33.5,19 H26.5 Z",fill:"none",stroke:"#0038B8",strokeWidth:1},{type:"path",d:"M30,27 L33.5,21 H26.5 Z",fill:"none",stroke:"#0038B8",strokeWidth:1}]}},l='<g transform="scale(0.5)"><rect width="60" height="40" fill="#012169"/><path d="M0,0 60,40 M60,0 0,40" stroke="#fff" stroke-width="8"/><path d="M0,0 60,40 M60,0 0,40" stroke="#C8102E" stroke-width="4"/><path d="M30,0 V40 M0,20 H60" stroke="#fff" stroke-width="13"/><path d="M30,0 V40 M0,20 H60" stroke="#C8102E" stroke-width="8"/></g>',c={au:{name:"Australia",svg:'<rect width="60" height="40" fill="#012169"/>'+l+'<path fill="#fff" d="M15,25 l1.3,3.9 4.1,0 -3.3,2.4 1.3,3.9 -3.4,-2.4 -3.4,2.4 1.3,-3.9 -3.3,-2.4 4.1,0 Z"/><g fill="#fff"><path d="M47,7 l0.9,2.7 2.8,0 -2.3,1.7 0.9,2.7 -2.3,-1.7 -2.3,1.7 0.9,-2.7 -2.3,-1.7 2.8,0 Z"/><path d="M40,19 l0.9,2.7 2.8,0 -2.3,1.7 0.9,2.7 -2.3,-1.7 -2.3,1.7 0.9,-2.7 -2.3,-1.7 2.8,0 Z"/><path d="M47,31 l0.9,2.7 2.8,0 -2.3,1.7 0.9,2.7 -2.3,-1.7 -2.3,1.7 0.9,-2.7 -2.3,-1.7 2.8,0 Z"/><path d="M54,18 l0.9,2.7 2.8,0 -2.3,1.7 0.9,2.7 -2.3,-1.7 -2.3,1.7 0.9,-2.7 -2.3,-1.7 2.8,0 Z"/><circle cx="49" cy="24" r="1.2"/></g>'},nz:{name:"New Zealand",svg:'<rect width="60" height="40" fill="#00247D"/>'+l+'<g><path fill="#fff" d="M47,7 l1,2.9 3,0 -2.5,1.9 1,2.9 -2.5,-1.8 -2.5,1.8 1,-2.9 -2.5,-1.9 3,0 Z"/><path fill="#CC142B" d="M47,8.5 l0.6,1.9 2,0 -1.6,1.2 0.6,1.9 -1.6,-1.2 -1.6,1.2 0.6,-1.9 -1.6,-1.2 2,0 Z"/><path fill="#fff" d="M41,20 l1,2.9 3,0 -2.5,1.9 1,2.9 -2.5,-1.8 -2.5,1.8 1,-2.9 -2.5,-1.9 3,0 Z"/><path fill="#CC142B" d="M41,21.5 l0.6,1.9 2,0 -1.6,1.2 0.6,1.9 -1.6,-1.2 -1.6,1.2 0.6,-1.9 -1.6,-1.2 2,0 Z"/><path fill="#fff" d="M53,18 l1,2.9 3,0 -2.5,1.9 1,2.9 -2.5,-1.8 -2.5,1.8 1,-2.9 -2.5,-1.9 3,0 Z"/><path fill="#CC142B" d="M53,19.5 l0.6,1.9 2,0 -1.6,1.2 0.6,1.9 -1.6,-1.2 -1.6,1.2 0.6,-1.9 -1.6,-1.2 2,0 Z"/><path fill="#fff" d="M47,32 l1,2.9 3,0 -2.5,1.9 1,2.9 -2.5,-1.8 -2.5,1.8 1,-2.9 -2.5,-1.9 3,0 Z"/><path fill="#CC142B" d="M47,33.5 l0.6,1.9 2,0 -1.6,1.2 0.6,1.9 -1.6,-1.2 -1.6,1.2 0.6,-1.9 -1.6,-1.2 2,0 Z"/></g>'}},s={...e,...t,...r,...i,...c},a={europe:{name:"Europe",description:"European nations",codes:Object.keys(e)},americas:{name:"Americas",description:"North, Central & South America",codes:Object.keys(t)},africa:{name:"Africa",description:"African nations",codes:Object.keys(r)},asia:{name:"Asia & Middle East",description:"Asian and Middle Eastern nations",codes:Object.keys(i)},oceania:{name:"Oceania",description:"Australia, New Zealand & the Pacific",codes:Object.keys(c)}};let o=0;function n(e){return String(e).replace(/"/g,"&quot;")}function f(e){const t=void 0!==e.fill?` fill="${n(e.fill)}"`:"",r=e.stroke?` stroke="${n(e.stroke)}"`:"",i=void 0!==e.strokeWidth?` stroke-width="${e.strokeWidth}"`:"",l=r+i+(r&&!e.fill?' fill="none"':"");switch(e.type){case"rect":return`<rect x="${e.x}" y="${e.y}" width="${e.w}" height="${e.h}"${e.rx?` rx="${e.rx}"`:""}${t}${l}/>`;case"circle":return`<circle cx="${e.cx}" cy="${e.cy}" r="${e.r}"${t}${l}/>`;case"ellipse":return`<ellipse cx="${e.cx}" cy="${e.cy}" rx="${e.rx}" ry="${e.ry}"${t}${l}/>`;case"line":return`<line x1="${e.x1}" y1="${e.y1}" x2="${e.x2}" y2="${e.y2}"${r}${i}/>`;case"path":return`<path d="${e.d}"${t}${l}/>`;case"star":return`<path d="${function(e,t,r,i=5,l=.382,c=-90){const s=r*l,a=Math.PI/i,o=c*Math.PI/180;let n="";for(let l=0;l<2*i;l++){const i=l%2==0?r:s,c=o+l*a;n+=(0===l?"M":"L")+(e+i*Math.cos(c)).toFixed(2)+","+(t+i*Math.sin(c)).toFixed(2)}return n+"Z"}(e.cx,e.cy,e.r,e.points||5,e.innerRatio||.382,void 0===e.rotation?-90:e.rotation)}"${t||' fill="#fff"'}${l}/>`;case"crescent":return`<path d="${function(e,t,r,i=.45*r){const l=Math.sqrt(i*i+r*r),c=(t-r).toFixed(2),s=(t+r).toFixed(2),a=e.toFixed(2);return`M${a},${c} A${r},${r} 0 1 0 ${a},${s} A${l.toFixed(2)},${l.toFixed(2)} 0 0 1 ${a},${c}Z`}(e.cx,e.cy,e.r,e.off)}"${t||' fill="#fff"'}${l}/>`;case"group":return`<g${e.transform?` transform="${n(e.transform)}"`:""}>${(e.children||[]).map(f).join("")}</g>`;default:return""}}function h(e){if(e.svg)return e.svg;let t="";return e.stripes&&(t+=function({dir:e="h",colors:t=[],weights:r=null}){const i=r?r.reduce((e,t)=>e+t,0):t.length;let l=0,c="";return t.forEach((t,s)=>{const a=r?r[s]:1;if("v"===e){const e=60*a/i;c+=`<rect x="${(60*l/i).toFixed(3)}" y="0" width="${e.toFixed(3)}" height="40" fill="${n(t)}"/>`}else{const e=40*a/i;c+=`<rect x="0" y="${(40*l/i).toFixed(3)}" width="60" height="${e.toFixed(3)}" fill="${n(t)}"/>`}l+=a}),c}(e.stripes)),e.cross&&(t+=function({bg:e,colour:t,border:r=null,thickness:i=8}){const l=i,c=20-l/2;let s=`<rect x="0" y="0" width="60" height="40" fill="${n(e)}"/>`;if(r){const e=2;s+=`<rect x="${16-e}" y="0" width="${l+2*e}" height="40" fill="${n(r)}"/>`,s+=`<rect x="0" y="${c-e}" width="60" height="${l+2*e}" fill="${n(r)}"/>`}return s+=`<rect x="16" y="0" width="${l}" height="40" fill="${n(t)}"/>`,s+=`<rect x="0" y="${c}" width="60" height="${l}" fill="${n(t)}"/>`,s}(e.cross)),!e.bg||e.stripes||e.cross||(t=`<rect x="0" y="0" width="60" height="40" fill="${n(e.bg)}"/>`+t),e.overlays&&(t+=e.overlays.map(f).join("")),t}class d{constructor(){this._flags={...s},this._regions={...a},this._cache={}}_markup(e){if(void 0!==this._cache[e])return this._cache[e];const t=this._flags[e],r=t?h(t):null;return this._cache[e]=r,r}render(e,t={}){e=String(e||"").toLowerCase();const r=this._flags[e];if(!r)return console.warn(`Flag "${e}" not found`),null;const{size:i=24,width:l=null,height:c=null,shape:s="rect",border:a=!1,class:f="",title:h=null,attrs:d={}}=t,y="square"===s||"circle"===s,F=c||i,p=l||(y?F:1.5*F),g=document.createElementNS("http://www.w3.org/2000/svg","svg");g.setAttribute("viewBox",y?"10 0 40 40":"0 0 60 40"),g.setAttribute("width",p),g.setAttribute("height",F),g.setAttribute("role","img");const x=h||r.name||e.toUpperCase();g.setAttribute("aria-label",x);const u=["dm-flag",`dm-flag-${s}`];f&&u.push(f),g.setAttribute("class",u.join(" ")),Object.entries(d).forEach(([e,t])=>g.setAttribute(e,t));const w="dm-flag-clip-"+ ++o;let m=`<title>${n(x)}</title>`;const $=this._markup(e)||"";if("circle"===s){if(m+=`<defs><clipPath id="${w}"><circle cx="30" cy="20" r="20"/></clipPath></defs>`,m+=`<g clip-path="url(#${w})">${$}</g>`,a){m+=`<circle cx="30" cy="20" r="19.25" fill="none" stroke="${n("string"==typeof a?a:"rgba(0,0,0,0.15)")}" stroke-width="1.5"/>`}}else if("rounded"===s){if(m+=`<defs><clipPath id="${w}"><rect x="0" y="0" width="60" height="40" rx="6"/></clipPath></defs>`,m+=`<g clip-path="url(#${w})">${$}</g>`,a){m+=`<rect x="0.75" y="0.75" width="58.5" height="38.5" rx="5.25" fill="none" stroke="${n("string"==typeof a?a:"rgba(0,0,0,0.15)")}" stroke-width="1.5"/>`}}else if(m+=$,a){const e="string"==typeof a?a:"rgba(0,0,0,0.15)",t=y?{x:10.5,y:.5,w:39,h:39}:{x:.5,y:.5,w:59,h:39};m+=`<rect x="${t.x}" y="${t.y}" width="${t.w}" height="${t.h}" fill="none" stroke="${n(e)}" stroke-width="1"/>`}return g.innerHTML=m,g}html(e,t={}){const r=this.render(e,t);if(!r)return"";const i=document.createElement("div");return i.appendChild(r),i.innerHTML}inject(e,t,r={}){const{position:i="prepend",...l}=r,c="string"==typeof e?document.querySelector(e):e;if(!c)return console.warn(`Target element not found: ${e}`),null;const s=this.render(t,l);return s?("append"===i?c.appendChild(s):"replace"===i?(c.innerHTML="",c.appendChild(s)):c.insertBefore(s,c.firstChild),s):null}scan(e=document){const t="string"==typeof e?document.querySelector(e):e;if(!t)return 0;const r=t.querySelectorAll("[data-flag]:not([data-flag-processed])");let i=0;return r.forEach(e=>{if("svg"===e.tagName.toLowerCase()||e.querySelector("svg"))return;const t=e.dataset.flag,r=parseInt(e.dataset.flagSize,10)||24,l=e.dataset.flagShape||"rect",c=e.dataset.flagClass||"",s=void 0!==e.dataset.flagBorder&&(""===e.dataset.flagBorder||"true"===e.dataset.flagBorder||e.dataset.flagBorder),a=e.dataset.flagTitle||null,o=this.render(t,{size:r,shape:l,class:c,border:s,title:a});o?(e.className&&o.classList.add(...e.className.split(" ").filter(Boolean)),o.setAttribute("data-flag",t),o.setAttribute("data-flag-processed","true"),e.replaceWith(o),i++):e.setAttribute("data-flag-processed","true")}),i}register(e,t){if(!e||!t)return console.warn("Invalid flag registration: code and definition required"),this;e=String(e).toLowerCase(),this._flags[e]=t,delete this._cache[e];const r=t.region||"custom";return this._regions[r]||(this._regions[r]={name:r.charAt(0).toUpperCase()+r.slice(1),codes:[]}),this._regions[r].codes.includes(e)||this._regions[r].codes.push(e),this}unregister(e){return e=String(e||"").toLowerCase(),!!this._flags[e]&&(delete this._flags[e],delete this._cache[e],Object.values(this._regions).forEach(t=>{const r=t.codes.indexOf(e);r>-1&&t.codes.splice(r,1)}),!0)}has(e){return!!this._flags[String(e||"").toLowerCase()]}get(e){return this._flags[String(e||"").toLowerCase()]||null}name(e){const t=this.get(e);return t?t.name:null}list(e=null){return e&&this._regions[e]?[...this._regions[e].codes]:Object.keys(this._flags)}listRegions(){return{...this._regions}}count(){return Object.keys(this._flags).length}search(e){const t=String(e||"").toLowerCase().trim();return t?Object.keys(this._flags).filter(e=>e.includes(t)||(this._flags[e].name||"").toLowerCase().includes(t)):[]}}const y=new d;"undefined"!=typeof window&&window.Domma&&(window.Domma.flags=y,window.Domma.FL=y),"undefined"!=typeof window&&(window.FL=y);export{d as FlagRegistry,y as default,y as flags};