zidan-select 2.4.0 → 2.4.1

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.
package/README.md CHANGED
@@ -26,30 +26,31 @@ two separate stylesheets.
26
26
  Load **one** build per page. A subset is not an add-on: never load it together with the full
27
27
  bundle.
28
28
 
29
- | Build | JavaScript (CDN) | CSS (CDN) |
30
- | --- | --- | --- |
31
- | Full — every control | [zidan-form.js](https://cdn.jsdelivr.net/npm/zidan-select@2.4.0/zidan-form.js) | [plugin-core.css](https://cdn.jsdelivr.net/npm/zidan-select@2.4.0/plugin-core.css) + [plugin-theme.css](https://cdn.jsdelivr.net/npm/zidan-select@2.4.0/plugin-theme.css) |
32
- | Select-only — ≈104 kB | [zidan-select.js](https://cdn.jsdelivr.net/npm/zidan-select@2.4.0/dist/select/zidan-select.js) | [plugin-select-core.css](https://cdn.jsdelivr.net/npm/zidan-select@2.4.0/dist/select/plugin-select-core.css) + [plugin-select-theme.css](https://cdn.jsdelivr.net/npm/zidan-select@2.4.0/dist/select/plugin-select-theme.css) |
33
- | File-only — ≈82 kB | [zidan-file.js](https://cdn.jsdelivr.net/npm/zidan-select@2.4.0/dist/file/zidan-file.js) | [plugin-file-core.css](https://cdn.jsdelivr.net/npm/zidan-select@2.4.0/dist/file/plugin-file-core.css) + [plugin-file-theme.css](https://cdn.jsdelivr.net/npm/zidan-select@2.4.0/dist/file/plugin-file-theme.css) |
29
+ | Build | JavaScript size | JavaScript (CDN) | CSS (CDN) |
30
+ | --- | --- | --- | --- |
31
+ | Full — every control | ≈224 kB raw · ≈131 kB minified | [zidan-form.js](https://cdn.jsdelivr.net/npm/zidan-select@2.4.1/zidan-form.js) | [plugin-core.css](https://cdn.jsdelivr.net/npm/zidan-select@2.4.1/plugin-core.css) + [plugin-theme.css](https://cdn.jsdelivr.net/npm/zidan-select@2.4.1/plugin-theme.css) |
32
+ | Select-only | ≈114 kB raw · ≈68 kB minified | [zidan-select.js](https://cdn.jsdelivr.net/npm/zidan-select@2.4.1/dist/select/zidan-select.js) | [plugin-select-core.css](https://cdn.jsdelivr.net/npm/zidan-select@2.4.1/dist/select/plugin-select-core.css) + [plugin-select-theme.css](https://cdn.jsdelivr.net/npm/zidan-select@2.4.1/dist/select/plugin-select-theme.css) |
33
+ | File-only | ≈86 kB raw · ≈50 kB minified | [zidan-file.js](https://cdn.jsdelivr.net/npm/zidan-select@2.4.1/dist/file/zidan-file.js) | [plugin-file-core.css](https://cdn.jsdelivr.net/npm/zidan-select@2.4.1/dist/file/plugin-file-core.css) + [plugin-file-theme.css](https://cdn.jsdelivr.net/npm/zidan-select@2.4.1/dist/file/plugin-file-theme.css) |
34
34
 
35
35
  Copyable snippets, ESM files and per-file sizes live in
36
36
  [Select-only and file-only builds](#select-only-and-file-only-builds); the
37
37
  [live demo](https://akhtar1985.github.io/zidan-select/#builds) shows all three side by side.
38
38
 
39
39
  **Build a field visually:** the [field playground](https://akhtar1985.github.io/zidan-select/playground.html)
40
- toggles every option for one control, previews it live and copies the matching HTML attributes or
41
- vanilla JavaScript.
40
+ exposes the main options for one control, previews them live and copies supported HTML attributes
41
+ or the equivalent vanilla JavaScript; the [API lab](https://akhtar1985.github.io/zidan-select/#lab)
42
+ covers the complete option, callback, method and event inventory.
42
43
 
43
44
  ### Minified CDN URLs
44
45
 
45
- jsDelivr minifies these on request from the published sources, so the `.min` files always match
46
- the pinned version:
46
+ These are real minified files shipped in the npm package, so jsDelivr and unpkg serve the
47
+ same pinned bytes:
47
48
 
48
49
  | Build | JS (min) | CSS (min) |
49
50
  | --- | --- | --- |
50
- | Full | [zidan-form.min.js](https://cdn.jsdelivr.net/npm/zidan-select@2.4.0/dist/zidan-form.min.js) | [plugin-core.min.css](https://cdn.jsdelivr.net/npm/zidan-select@2.4.0/dist/plugin-core.min.css) + [plugin-theme.min.css](https://cdn.jsdelivr.net/npm/zidan-select@2.4.0/dist/plugin-theme.min.css) |
51
- | Select-only | [zidan-select.min.js](https://cdn.jsdelivr.net/npm/zidan-select@2.4.0/dist/select/zidan-select.min.js) | [plugin-select-core.min.css](https://cdn.jsdelivr.net/npm/zidan-select@2.4.0/dist/select/plugin-select-core.min.css) + [plugin-select-theme.min.css](https://cdn.jsdelivr.net/npm/zidan-select@2.4.0/dist/select/plugin-select-theme.min.css) |
52
- | File-only | [zidan-file.min.js](https://cdn.jsdelivr.net/npm/zidan-select@2.4.0/dist/file/zidan-file.min.js) | [plugin-file-core.min.css](https://cdn.jsdelivr.net/npm/zidan-select@2.4.0/dist/file/plugin-file-core.min.css) + [plugin-file-theme.min.css](https://cdn.jsdelivr.net/npm/zidan-select@2.4.0/dist/file/plugin-file-theme.min.css) |
51
+ | Full | [zidan-form.min.js](https://cdn.jsdelivr.net/npm/zidan-select@2.4.1/dist/zidan-form.min.js) — ≈131 kB | [plugin-core.min.css](https://cdn.jsdelivr.net/npm/zidan-select@2.4.1/dist/plugin-core.min.css) — ≈31 kB + [plugin-theme.min.css](https://cdn.jsdelivr.net/npm/zidan-select@2.4.1/dist/plugin-theme.min.css) — ≈39 kB |
52
+ | Select-only | [zidan-select.min.js](https://cdn.jsdelivr.net/npm/zidan-select@2.4.1/dist/select/zidan-select.min.js) — ≈68 kB | [plugin-select-core.min.css](https://cdn.jsdelivr.net/npm/zidan-select@2.4.1/dist/select/plugin-select-core.min.css) — ≈9 kB + [plugin-select-theme.min.css](https://cdn.jsdelivr.net/npm/zidan-select@2.4.1/dist/select/plugin-select-theme.min.css) — ≈27 kB |
53
+ | File-only | [zidan-file.min.js](https://cdn.jsdelivr.net/npm/zidan-select@2.4.1/dist/file/zidan-file.min.js) — ≈50 kB | [plugin-file-core.min.css](https://cdn.jsdelivr.net/npm/zidan-select@2.4.1/dist/file/plugin-file-core.min.css) — ≈7 kB + [plugin-file-theme.min.css](https://cdn.jsdelivr.net/npm/zidan-select@2.4.1/dist/file/plugin-file-theme.min.css) — ≈29 kB |
53
54
 
54
55
  - **One file of JS** — `zidan-form.js` (classic script, UMD-ish) + `zidan-form.mjs` (ESM wrapper).
55
56
  - **Split CSS** — `plugin-core.css` (structure only) and `plugin-theme.css` (tokens, presets, skins).
@@ -240,13 +241,13 @@ override presets.
240
241
 
241
242
  Copyable URLs for the published files (pin the version in production):
242
243
 
243
- - `zidan-form.js` — <https://cdn.jsdelivr.net/npm/zidan-select@2.4.0/zidan-form.js>
244
- - `zidan-form.min.js` — <https://cdn.jsdelivr.net/npm/zidan-select@2.4.0/dist/zidan-form.min.js>
245
- - `zidan-form.mjs` — <https://cdn.jsdelivr.net/npm/zidan-select@2.4.0/zidan-form.mjs>
246
- - `plugin-core.css` — <https://cdn.jsdelivr.net/npm/zidan-select@2.4.0/plugin-core.css>
247
- - `plugin-core.min.css` — <https://cdn.jsdelivr.net/npm/zidan-select@2.4.0/dist/plugin-core.min.css>
248
- - `plugin-theme.css` — <https://cdn.jsdelivr.net/npm/zidan-select@2.4.0/plugin-theme.css>
249
- - `plugin-theme.min.css` — <https://cdn.jsdelivr.net/npm/zidan-select@2.4.0/dist/plugin-theme.min.css>
244
+ - `zidan-form.js` — <https://cdn.jsdelivr.net/npm/zidan-select@2.4.1/zidan-form.js>
245
+ - `zidan-form.min.js` — <https://cdn.jsdelivr.net/npm/zidan-select@2.4.1/dist/zidan-form.min.js>
246
+ - `zidan-form.mjs` — <https://cdn.jsdelivr.net/npm/zidan-select@2.4.1/zidan-form.mjs>
247
+ - `plugin-core.css` — <https://cdn.jsdelivr.net/npm/zidan-select@2.4.1/plugin-core.css>
248
+ - `plugin-core.min.css` — <https://cdn.jsdelivr.net/npm/zidan-select@2.4.1/dist/plugin-core.min.css>
249
+ - `plugin-theme.css` — <https://cdn.jsdelivr.net/npm/zidan-select@2.4.1/plugin-theme.css>
250
+ - `plugin-theme.min.css` — <https://cdn.jsdelivr.net/npm/zidan-select@2.4.1/dist/plugin-theme.min.css>
250
251
  - npm package — <https://www.npmjs.com/package/zidan-select>
251
252
  - Source — <https://github.com/akhtar1985/zidan-select>
252
253
 
@@ -267,27 +268,28 @@ exactly like the full build.
267
268
 
268
269
  Copyable CDN URLs (pin the version):
269
270
 
270
- - `zidan-select.js` — <https://cdn.jsdelivr.net/npm/zidan-select@2.4.0/dist/select/zidan-select.js>
271
- - `zidan-select.min.js` — <https://cdn.jsdelivr.net/npm/zidan-select@2.4.0/dist/select/zidan-select.min.js>
272
- - `zidan-select.mjs` — <https://cdn.jsdelivr.net/npm/zidan-select@2.4.0/dist/select/zidan-select.mjs>
273
- - `plugin-select-core.css` — <https://cdn.jsdelivr.net/npm/zidan-select@2.4.0/dist/select/plugin-select-core.css>
274
- - `plugin-select-core.min.css` — <https://cdn.jsdelivr.net/npm/zidan-select@2.4.0/dist/select/plugin-select-core.min.css>
275
- - `plugin-select-theme.css` — <https://cdn.jsdelivr.net/npm/zidan-select@2.4.0/dist/select/plugin-select-theme.css>
276
- - `plugin-select-theme.min.css` — <https://cdn.jsdelivr.net/npm/zidan-select@2.4.0/dist/select/plugin-select-theme.min.css>
277
- - `zidan-file.js` — <https://cdn.jsdelivr.net/npm/zidan-select@2.4.0/dist/file/zidan-file.js>
278
- - `zidan-file.min.js` — <https://cdn.jsdelivr.net/npm/zidan-select@2.4.0/dist/file/zidan-file.min.js>
279
- - `zidan-file.mjs` — <https://cdn.jsdelivr.net/npm/zidan-select@2.4.0/dist/file/zidan-file.mjs>
280
- - `plugin-file-core.css` — <https://cdn.jsdelivr.net/npm/zidan-select@2.4.0/dist/file/plugin-file-core.css>
281
- - `plugin-file-core.min.css` — <https://cdn.jsdelivr.net/npm/zidan-select@2.4.0/dist/file/plugin-file-core.min.css>
282
- - `plugin-file-theme.css` — <https://cdn.jsdelivr.net/npm/zidan-select@2.4.0/dist/file/plugin-file-theme.css>
283
- - `plugin-file-theme.min.css` — <https://cdn.jsdelivr.net/npm/zidan-select@2.4.0/dist/file/plugin-file-theme.min.css>
284
-
285
- Select / combobox / tags only (≈104 kB JS, ≈12 kB core CSS, ≈32 kB theme CSS):
271
+ - `zidan-select.js` — <https://cdn.jsdelivr.net/npm/zidan-select@2.4.1/dist/select/zidan-select.js>
272
+ - `zidan-select.min.js` — <https://cdn.jsdelivr.net/npm/zidan-select@2.4.1/dist/select/zidan-select.min.js>
273
+ - `zidan-select.mjs` — <https://cdn.jsdelivr.net/npm/zidan-select@2.4.1/dist/select/zidan-select.mjs>
274
+ - `plugin-select-core.css` — <https://cdn.jsdelivr.net/npm/zidan-select@2.4.1/dist/select/plugin-select-core.css>
275
+ - `plugin-select-core.min.css` — <https://cdn.jsdelivr.net/npm/zidan-select@2.4.1/dist/select/plugin-select-core.min.css>
276
+ - `plugin-select-theme.css` — <https://cdn.jsdelivr.net/npm/zidan-select@2.4.1/dist/select/plugin-select-theme.css>
277
+ - `plugin-select-theme.min.css` — <https://cdn.jsdelivr.net/npm/zidan-select@2.4.1/dist/select/plugin-select-theme.min.css>
278
+ - `zidan-file.js` — <https://cdn.jsdelivr.net/npm/zidan-select@2.4.1/dist/file/zidan-file.js>
279
+ - `zidan-file.min.js` — <https://cdn.jsdelivr.net/npm/zidan-select@2.4.1/dist/file/zidan-file.min.js>
280
+ - `zidan-file.mjs` — <https://cdn.jsdelivr.net/npm/zidan-select@2.4.1/dist/file/zidan-file.mjs>
281
+ - `plugin-file-core.css` — <https://cdn.jsdelivr.net/npm/zidan-select@2.4.1/dist/file/plugin-file-core.css>
282
+ - `plugin-file-core.min.css` — <https://cdn.jsdelivr.net/npm/zidan-select@2.4.1/dist/file/plugin-file-core.min.css>
283
+ - `plugin-file-theme.css` — <https://cdn.jsdelivr.net/npm/zidan-select@2.4.1/dist/file/plugin-file-theme.css>
284
+ - `plugin-file-theme.min.css` — <https://cdn.jsdelivr.net/npm/zidan-select@2.4.1/dist/file/plugin-file-theme.min.css>
285
+
286
+ Select / combobox / tags only (≈114 kB raw / ≈68 kB minified JS, ≈12 → 9 kB core CSS,
287
+ ≈32 → 27 kB theme CSS):
286
288
 
287
289
  ```html
288
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/zidan-select@2.4.0/dist/select/plugin-select-core.css">
289
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/zidan-select@2.4.0/dist/select/plugin-select-theme.css">
290
- <script src="https://cdn.jsdelivr.net/npm/zidan-select@2.4.0/dist/select/zidan-select.js"></script>
290
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/zidan-select@2.4.1/dist/select/plugin-select-core.css">
291
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/zidan-select@2.4.1/dist/select/plugin-select-theme.css">
292
+ <script src="https://cdn.jsdelivr.net/npm/zidan-select@2.4.1/dist/select/zidan-select.js"></script>
291
293
  <script>
292
294
  // auto-init covers [data-zidan-select], class="zidan-select", zidan-form scopes
293
295
  // and ZIDAN_FORM_CONFIG targets; JS-only options:
@@ -295,14 +297,15 @@ Select / combobox / tags only (≈104 kB JS, ≈12 kB core CSS, ≈32 kB theme C
295
297
  </script>
296
298
  ```
297
299
 
298
- File upload only (≈82 kB JS, ≈9 kB core CSS, ≈34 kB theme CSS):
300
+ File upload only (≈86 kB raw / ≈50 kB minified JS, ≈10 → 7 kB core CSS,
301
+ ≈34 → 29 kB theme CSS):
299
302
 
300
303
  ```html
301
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/zidan-select@2.4.0/dist/file/plugin-file-core.css">
302
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/zidan-select@2.4.0/dist/file/plugin-file-theme.css">
303
- <script src="https://cdn.jsdelivr.net/npm/zidan-select@2.4.0/dist/file/zidan-file.js"></script>
304
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/zidan-select@2.4.1/dist/file/plugin-file-core.css">
305
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/zidan-select@2.4.1/dist/file/plugin-file-theme.css">
306
+ <script src="https://cdn.jsdelivr.net/npm/zidan-select@2.4.1/dist/file/zidan-file.js"></script>
304
307
  <script>
305
- zidanField('#upload', { variant: 'dropzone', upload: '/api/files' });
308
+ zidanField('#upload', { variant: 'dropzone', uploadUrl: '/api/files' });
306
309
  </script>
307
310
  ```
308
311
 
@@ -433,7 +436,7 @@ argument to `zidanSelect()`:
433
436
  </select>
434
437
 
435
438
  <!-- select-only build; use zidan-form.js for every control -->
436
- <script src="https://cdn.jsdelivr.net/npm/zidan-select@2.4.0/dist/select/zidan-select.js"></script>
439
+ <script src="https://cdn.jsdelivr.net/npm/zidan-select@2.4.1/dist/select/zidan-select.js"></script>
437
440
  <script>
438
441
  const picker = zidanSelect('#mymov', {
439
442
  mode: 'combobox', // 'select' | 'combobox' | 'tags'
@@ -659,6 +662,8 @@ and `range`. `data-zidan-validation-icon="true"` adds check/alert glyphs.
659
662
 
660
663
  Modes: `stacked`, `split`, `inline`. Press and hold repeats (configurable delay/interval);
661
664
  min, max and step are respected. Methods: `stepUp()`, `stepDown()`, `setStepper()`.
665
+ `setStepper()` changes the source attribute; destroy and reinitialise the field to add or remove
666
+ the generated buttons.
662
667
 
663
668
  ### Phone formatting
664
669
 
@@ -787,9 +792,10 @@ Three behaviours that are easy to miss:
787
792
  or hide the options. Open the list with a click, `Space`, `Enter` or `↓`.
788
793
  - Tags with `allowFreeText: false` accept only values that already exist in the options or
789
794
  `suggestions`; anything else is rejected with `"…" is not in the list.`
790
- - `setValidation('invalid')` (and `data-zidan-validation="invalid"`) is pinned: it survives
791
- `update()`, `refresh()`, `setValue()` and async re-checks until the user edits the control or
792
- you call `setValidation(null)`.
795
+ - `setValidation('invalid')` (and `data-zidan-validation="invalid"`) is pinned against
796
+ `update()`, `refresh()` and internal validity mirrors. User input/change/blur or
797
+ `setValidation(null)` releases it; programmatic value helpers that dispatch `change`, and
798
+ applying a non-empty select value, also clear it.
793
799
 
794
800
  ---
795
801
 
@@ -1122,7 +1128,7 @@ npm run build # dist/ (+ local .min files when esbuild is installed)
1122
1128
  | --- | --- |
1123
1129
  | `scripts/serve.mjs` | No-dependency demo server on port 4173 (`PORT=8080 npm run dev`). |
1124
1130
  | `scripts/build.mjs` | Cleans `dist/`, copies the four assets, writes `dist/zidan-form.cjs`, emits the select-only and file-only bundles with declarations, and minifies every JS/CSS output with esbuild. |
1125
- | `scripts/test.mjs` | Verifies syntax, that core CSS carries no colour literals, that all presets/adapters exist, the public API is exported, the build artifacts ship, and the playground, README, demo and cookbook stay wired to each other — then runs 19 jsdom behaviour suites. |
1131
+ | `scripts/test.mjs` | Verifies syntax, that core CSS carries no colour literals, that all presets/adapters exist, the public API is exported, the build artifacts ship, and the playground, README, demo and cookbook stay wired to each other — then runs 42 jsdom behaviour suites. |
1126
1132
  | `scripts/dom/run.mjs` | jsdom suites for select, fields, uploads, async validation, pagination, RTL, teardown, and the select-only/file-only/minified bundles. |
1127
1133
  | `scripts/exa-search.mjs` | Exa web search for docs and release research: `npm run search -- "your question"` (`--num 10` for more results). Reads `EXA_API_KEY`; copy `.env.example` to `.env` (git-ignored) and add a key from https://dashboard.exa.ai/api-keys. |
1128
1134
  | `scripts/release.mjs` | One-command release: `npm run release -- patch --note "what changed"` bumps every version site, rolls `CHANGELOG.md`, runs the checks, commits and tags `vX.Y.Z`. |
@@ -1149,8 +1155,11 @@ and `VERSION`, both CSS banners, the README CDN URLs, the demo pages and the doc
1149
1155
  Pushing the tag runs [`.github/workflows/release.yml`](https://github.com/akhtar1985/zidan-select/blob/main/.github/workflows/release.yml), which
1150
1156
  publishes to npm through **trusted publishing** (OIDC) with `--provenance` — no token and no local
1151
1157
  `npm login`, and every tarball carries a provenance attestation. Prereleases go to the `next`
1152
- dist-tag. The workflow refuses a tag that disagrees with `package.json` and refuses to republish a
1153
- version that already exists on the registry. History lives in [`CHANGELOG.md`](https://github.com/akhtar1985/zidan-select/blob/main/CHANGELOG.md).
1158
+ dist-tag, and creates the matching **GitHub Release** for the tag using that version's
1159
+ [`CHANGELOG.md`](https://github.com/akhtar1985/zidan-select/blob/main/CHANGELOG.md) section as the
1160
+ body (generated notes only when the section is missing). The workflow refuses a tag that
1161
+ disagrees with `package.json` and refuses to republish a version that already exists on the
1162
+ registry. History lives in [`CHANGELOG.md`](https://github.com/akhtar1985/zidan-select/blob/main/CHANGELOG.md).
1154
1163
 
1155
1164
  GitHub Pages serves the repo root: the demo is `index.html` (no build needed), docs live in
1156
1165
  `docs/`. Release notes should list theme/layout additions and any token renames.
@@ -1174,7 +1183,7 @@ Full checklist, folder tree and release automation notes: [`docs/build.md`](http
1174
1183
 
1175
1184
  ## What's new in 2.1–2.3
1176
1185
 
1177
- **2.4.0** adds the capabilities that were previously the library's biggest gaps:
1186
+ **2.4.1** adds the capabilities that were previously the library's biggest gaps:
1178
1187
 
1179
1188
  - **Async validation** — `validate` and `validateDate` may return a Promise. Fields get a
1180
1189
  `.zs-field--pending` spinner and `aria-busy`, block form submission through native validity,
@@ -1192,7 +1201,7 @@ Full checklist, folder tree and release automation notes: [`docs/build.md`](http
1192
1201
  declarations for `zidan-select` and `zidan-file`, wired into the exports map.
1193
1202
  - **Self-hosted minified bundles** — `npm run build` now emits `.min.js` and `.min.css`
1194
1203
  for all three builds, so you can ship from your own CDN with the same files npm exports.
1195
- - **Automated behaviour tests** — `npm test` builds the subsets and runs 19 jsdom suites
1204
+ - **Automated behaviour tests** — `npm test` builds the subsets and runs 42 jsdom suites
1196
1205
  covering select, fields, uploads, async validation, pagination, RTL, teardown and both
1197
1206
  subset bundles (including their minified copies).
1198
1207
 
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * ZidanForm File-only v2.4.0 — plugin-file-core.css
2
+ * ZidanForm File-only v2.4.1 — plugin-file-core.css
3
3
  * Structure for the file upload control only.
4
4
  * Pairs with zidan-file.js and plugin-file-theme.css.
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * ZidanForm File-only v2.4.0 — plugin-file-core.css
2
+ * ZidanForm File-only v2.4.1 — plugin-file-core.css
3
3
  * Structure for the file upload control only.
4
4
  * Pairs with zidan-file.js and plugin-file-theme.css.
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * ZidanForm File-only v2.4.0 — plugin-file-theme.css
2
+ * ZidanForm File-only v2.4.1 — plugin-file-theme.css
3
3
  * Tokens, 5 preset themes, field layouts and framework adapters.
4
4
  * Pairs with zidan-file.js and plugin-file-core.css.
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * ZidanForm File-only v2.4.0 — plugin-file-theme.css
2
+ * ZidanForm File-only v2.4.1 — plugin-file-theme.css
3
3
  * Tokens, 5 preset themes, field layouts and framework adapters.
4
4
  * Pairs with zidan-file.js and plugin-file-core.css.
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /**
2
- * ZidanForm File-only v2.4.0 — type definitions.
2
+ * ZidanForm File-only v2.4.1 — type definitions.
3
3
  * https://github.com/akhtar1985/zidan-select
4
4
  */
5
5
  export {
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * ZidanForm File-only v2.4.0
2
+ * ZidanForm File-only v2.4.1
3
3
  * Zero-dependency drag & drop file upload with variants, previews, limits and progress.
4
4
  * Pairs with plugin-file-core.css and plugin-file-theme.css.
5
5
  *
@@ -29,7 +29,7 @@
29
29
  })(typeof window !== 'undefined' ? window : this, function (global) {
30
30
  'use strict';
31
31
 
32
- var VERSION = '2.4.0';
32
+ var VERSION = '2.4.1';
33
33
 
34
34
  // Loading the file twice (classic script + module wrapper, or two bundles)
35
35
  // must not replace the classes and orphan the live instances.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * ZidanForm File-only v2.4.0
2
+ * ZidanForm File-only v2.4.1
3
3
  * Zero-dependency drag & drop file upload with variants, previews, limits and progress.
4
4
  * Pairs with plugin-file-core.css and plugin-file-theme.css.
5
5
  *
@@ -8,4 +8,4 @@
8
8
  * MIT License © akhtar1985
9
9
  *
10
10
  * Classic <script> adds window.ZidanForm plus window.zidanField / initZidanForms.
11
- */(function(p,T){"use strict";var l=T(p);typeof window!="undefined"&&(window.ZidanForm=l.ZidanForm,l.ZidanSelect&&(window.ZidanSelect=l.ZidanSelect,window.zidanSelect=l.zidanSelect,window.initZidanSelects=l.initZidanSelects),l.zidanField&&(window.zidanField=l.zidanField),l.initZidanForms&&(window.initZidanForms=l.initZidanForms),l.registerIcon&&(window.registerZidanIcon=l.registerIcon)),typeof module!="undefined"&&module.exports&&(module.exports=l)})(typeof window!="undefined"?window:this,function(p){"use strict";var T="2.4.0";if(p&&p.ZidanForm&&p.ZidanForm.__zidanFormGuard===T)return p.ZidanForm.api;var l=typeof document!="undefined"?document:null,zt=["classic-clean","floating-label","soft-pill","bordered-brutalist","glass-elevated"],H=["auto","none","vanilla","bootstrap","tailwind","bulma","foundation"],W=["default","modern","minimal","dark","glass"],J=["stacked","inline","card","compact","floating","outlined"],Ct=["checkbox","radio","radio-group","file","input","textarea"],at="[data-zidan], [data-zidan-checkbox], [data-zidan-switch], [data-zidan-radio], [data-zidan-radio-group], [data-zidan-file], [data-zidan-input], [data-zidan-textarea], .zidan-field",Q="[data-zidan-select], .zidan-select",wt="[data-zidan-form], .zidan-form",xt=["default","thin","fancy","hover","hidden"],Ft="zidan:",nt=0;function Tt(t){return nt+=1,(t||"zs")+"-"+nt.toString(36)+Math.random().toString(36).slice(2,6)}function Mt(t,e){return!!(t&&t.classList&&t.classList.contains(e))}function st(t,e){return!t||!e||e.split(/\s+/).forEach(function(i){i&&t.classList.add(i)}),t}function v(t,e,i,r){var a=l.createElement(t);return e&&(a.className=e),i&&Object.keys(i).forEach(function(n){var s=i[n];s==null||s===!1||(n==="text"?a.textContent=String(s):a.setAttribute(n,s===!0?"":String(s)))}),r!=null&&(a.textContent=String(r)),a}function $(t){return t==null||t===""?[]:Array.isArray(t)?t.slice():[t]}function tt(t){return!!(t&&(typeof t=="object"||typeof t=="function")&&typeof t.then=="function")}function Lt(t){if(!t)return!1;var e=t.closest?t.closest("[dir]"):null,i=e?e.getAttribute("dir"):"";if(!i&&l&&l.documentElement&&(i=l.documentElement.getAttribute("dir")||""),i)return String(i).toLowerCase()==="rtl";try{return!!(p.getComputedStyle&&p.getComputedStyle(t).direction==="rtl")}catch{return!1}}function y(t){return!!(t&&typeof t=="object"&&t.nodeType===1)}function kt(t,e){if(t==null||t==="")return e;var i=String(t).toLowerCase();return!(i==="false"||i==="0"||i==="no"||i==="off")}function I(){for(var t={},e=0;e<arguments.length;e++)(function(i){!i||typeof i!="object"||Object.keys(i).forEach(function(r){i[r]!==void 0&&(t[r]=i[r])})})(arguments[e]);return t}function Zt(t){if(!t||!t.getAttribute)return null;var e=t.getAttribute("data-zidan-options");if(!e)return null;try{var i=JSON.parse(e);return i&&typeof i=="object"&&!Array.isArray(i)?i:null}catch(r){return typeof console!="undefined"&&console.warn&&console.warn("[ZidanForm] ignoring invalid data-zidan-options JSON on",t,r),null}}function Ot(t,e,i){return Math.min(i,Math.max(e,t))}function N(t,e){return String(t).replace(/\{(\w+)\}/g,function(i,r){return e&&e[r]!==void 0&&e[r]!==null?String(e[r]):i})}var ot={text:'<path d="M4 7h16M4 12h10M4 17h13"/>',mail:'<rect x="3" y="5" width="18" height="14" rx="2"/><path d="m3 7 9 6 9-6"/>',phone:'<path d="M22 16.9v3a2 2 0 0 1-2.2 2 19.8 19.8 0 0 1-8.6-3.1 19.5 19.5 0 0 1-6-6A19.8 19.8 0 0 1 2.1 4.2 2 2 0 0 1 4.1 2h3a2 2 0 0 1 2 1.7c.1 1 .4 1.9.7 2.8a2 2 0 0 1-.5 2.1L8.1 9.9a16 16 0 0 0 6 6l1.3-1.2a2 2 0 0 1 2.1-.5c.9.3 1.8.6 2.8.7a2 2 0 0 1 1.7 2Z"/>',user:'<circle cx="12" cy="8" r="4"/><path d="M4 21a8 8 0 0 1 16 0"/>',lock:'<rect x="4" y="10" width="16" height="11" rx="2"/><path d="M8 10V7a4 4 0 0 1 8 0v3"/>',search:'<circle cx="11" cy="11" r="7"/><path d="m20 20-3.5-3.5"/>',calendar:'<rect x="3" y="5" width="18" height="16" rx="2"/><path d="M16 3v4M8 3v4M3 11h18"/>',clock:'<circle cx="12" cy="12" r="9"/><path d="M12 7v5l3 2"/>',link:'<path d="M10 13a5 5 0 0 0 7 0l3-3a5 5 0 0 0-7-7l-1.5 1.5"/><path d="M14 11a5 5 0 0 0-7 0l-3 3a5 5 0 0 0 7 7l1.5-1.5"/>',hash:'<path d="M4 9h16M4 15h16M10 3 8 21M16 3l-2 18"/>',palette:'<path d="M12 3a9 9 0 0 0 0 18h1.5a2.5 2.5 0 0 0 0-5H12a2 2 0 0 1 0-4h4a5 5 0 0 0 0-10Z"/><circle cx="8.5" cy="8.5" r="1"/><circle cx="8" cy="14" r="1"/>',sliders:'<path d="M4 7h16M4 17h16"/><circle cx="9" cy="7" r="2.5"/><circle cx="15" cy="17" r="2.5"/>',file:'<path d="M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z"/><path d="M14 3v5h5"/>',upload:'<path d="M12 16V4"/><path d="m7 9 5-5 5 5"/><path d="M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2"/>',eye:'<path d="M2 12s3.5-6 10-6 10 6 10 6-3.5 6-10 6-10-6-10-6Z"/><circle cx="12" cy="12" r="3"/>',"eye-off":'<path d="m3 3 18 18"/><path d="M10.6 6.2A9.9 9.9 0 0 1 12 6c6.5 0 10 6 10 6a17 17 0 0 1-3.1 3.6"/><path d="M6.4 6.7C3.5 8.4 2 12 2 12s3.5 6 10 6c1.7 0 3.2-.4 4.5-1"/><path d="M9.9 9.9a3 3 0 0 0 4.2 4.2"/>',check:'<path d="m4 12.5 5 5L20 6.5"/>',x:'<path d="M6 6l12 12M18 6 6 18"/>',plus:'<path d="M12 5v14M5 12h14"/>',minus:'<path d="M5 12h14"/>',"chevron-down":'<path d="m6 9 6 6 6-6"/>',"chevron-up":'<path d="m6 15 6-6 6 6"/>',"chevron-left":'<path d="m15 6-6 6 6 6"/>',"chevron-right":'<path d="m9 6 6 6-6 6"/>',alert:'<path d="M12 9v4"/><path d="M12 17h.01"/><path d="M10.3 3.9 2.6 17.4A2 2 0 0 0 4.3 20h15.4a2 2 0 0 0 1.7-2.6L13.7 3.9a2 2 0 0 0-3.4 0Z"/>',info:'<circle cx="12" cy="12" r="9"/><path d="M12 11v5"/><path d="M12 8h.01"/>',globe:'<circle cx="12" cy="12" r="9"/><path d="M3 12h18"/><path d="M12 3a15 15 0 0 1 0 18 15 15 0 0 1 0-18Z"/>',"map-pin":'<path d="M20 10c0 6-8 12-8 12S4 16 4 10a8 8 0 1 1 16 0Z"/><circle cx="12" cy="10" r="3"/>',image:'<rect x="3" y="3" width="18" height="18" rx="2"/><circle cx="8.5" cy="8.5" r="1.5"/><path d="m21 15-5-5L5 21"/>',refresh:'<path d="M20 11a8 8 0 0 0-14.9-3.9L3 10"/><path d="M3 5v5h5"/><path d="M4 13a8 8 0 0 0 14.9 3.9L21 14"/><path d="M21 19v-5h-5"/>',trash:'<path d="M4 7h16"/><path d="M9 7V4h6v3"/><path d="M6 7l1 13h10l1-13"/><path d="M10 11v5M14 11v5"/>'},O={};Object.keys(ot).forEach(function(t){O[t]=ot[t]});var Ut="http://www.w3.org/2000/svg",Vt={svg:1,g:1,path:1,circle:1,rect:1,line:1,polyline:1,polygon:1,ellipse:1,title:1,defs:1,clipPath:1,clippath:1,mask:1};function It(t){if(typeof t!="string"||!t.trim())return"";var e;try{if(typeof p.DOMParser=="undefined")return"";e=new p.DOMParser().parseFromString(t,"image/svg+xml")}catch{return""}if(!e||!e.documentElement)return"";var i=e.documentElement;if(String(i.nodeName).toLowerCase()!=="svg"||e.getElementsByTagName("parsererror").length)return"";var r=function(a){Array.prototype.slice.call(a.children||[]).forEach(function(n){var s=String(n.nodeName);if(s!==s.toLowerCase()&&(s=s.toLowerCase()),!Vt[s]){n.parentNode.removeChild(n);return}Array.prototype.slice.call(n.attributes||[]).forEach(function(o){var u=String(o.name).toLowerCase();u.indexOf("on")===0&&n.removeAttribute(o.name),(u==="href"||u==="xlink:href")&&!/^#/.test(o.value)&&n.removeAttribute(o.name),/url\s*\(\s*['"]?\s*(?:https?:|\/\/)/i.test(o.value)&&n.removeAttribute(o.name)}),r(n)})};return r(i),i.outerHTML}function j(t){var e=t;return/^\s*</.test(e)&&!/^\s*<svg/i.test(e)?e='<svg xmlns="'+Ut+'" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">'+e+"</svg>":/^\s*<svg/i.test(e)||(e=""),It(e)}function Nt(t,e){var i="",r="";if(typeof t=="string"&&t?(r=t,/^\s*</.test(t)?i=j(t)||j('<path d="M4 12h16"/>'):O[t]&&(i=j(O[t])||"")):t&&typeof t=="object"&&t.name&&(r=t.name,i=j(O[t.name]||"")),!i)return null;var a=l.createElement("span");e&&(a.className=e),a.setAttribute("data-zs-icon",r||"custom");try{a.innerHTML=i}catch{return null}var n=a.firstChild;return n&&(n.setAttribute("focusable","false"),n.setAttribute("aria-hidden","true"),n.setAttribute("width","18"),n.setAttribute("height","18")),a}var Pt={text:"text",email:"mail",password:"lock",number:"hash",tel:"phone",url:"link",search:"search",date:"calendar",time:"clock","datetime-local":"calendar",month:"calendar",week:"calendar",range:"sliders",color:"palette"};function Jt(t){return Pt[t]||""}function lt(t,e){return typeof ZidanSelect!="undefined"&&(!t||typeof e!="string")?ZidanSelect:(t&&typeof e=="string"&&(O[String(t)]=e),typeof ZidanSelect!="undefined"?ZidanSelect:h)}function C(t,e,i,r,a){if(e&&e[i]!==void 0&&e[i]!==null)return e[i];if(t&&r&&t.getAttribute){var n=t.getAttribute("data-zidan-"+r);if(n!==null&&n!=="")return n}return a}function P(t,e,i,r,a){if(e&&e[i]!==void 0&&e[i]!==null)return!!e[i];if(t&&r&&t.getAttribute){var n=t.getAttribute("data-zidan-"+r);if(n!==null)return kt(n,a)}return a}function Rt(t,e,i,r,a){var n=C(t,e,i,r,a);if(n==null||n==="")return a;var s=parseFloat(n);return isFinite(s)?s:a}function Qt(t,e,i,r,a){var n=C(t,e,i,r,null);return n==null||n===""?a:Array.isArray(n)?n.slice():String(n).split(",").map(function(s){return s.trim()}).filter(Boolean)}var M={required:"This field is required.",email:"Enter a valid email address.",url:"Enter a valid URL.",pattern:"The value does not match the expected format.",min:"Value must be at least {min}.",max:"Value must be at most {max}.",step:"Value must be a multiple of {step}.",minlength:"Use at least {minlength} characters.",maxlength:"Use at most {maxlength} characters.",badInput:"Enter a valid value.",phone:"Enter a valid phone number for {country}.",integer:"Enter a whole number.",date:"Enter a valid date.",weekend:"Weekends are not available \u2014 pick a weekday.",dateDisabled:"This date is not available.",fileType:"This file type is not allowed.",fileSize:"This file is too large.",fileCount:"Too many files.",pending:"Checking\u2026",generic:"Please check this field."};function Dt(t,e){if(!t||!t.validity||t.validity.valid)return"";var i=t.validity,r=e||M,a=String(t.type||"").toLowerCase(),n="",s={min:t.getAttribute("min"),max:t.getAttribute("max"),step:t.getAttribute("step")};return i.valueMissing?n="required":i.typeMismatch?n=a==="email"?"email":a==="url"?"url":"generic":i.patternMismatch?n="pattern":i.rangeUnderflow?n="min":i.rangeOverflow?n="max":i.stepMismatch?n="step":i.tooShort?(n="minlength",s.minlength=t.getAttribute("minlength")):i.tooLong?(n="maxlength",s.maxlength=t.getAttribute("maxlength")):(i.badInput||i.customError)&&(n="badInput"),n?N(r[n]||M[n]||r.generic,s):t.validationMessage||r.generic}var dt=["valueMissing","typeMismatch","patternMismatch","rangeUnderflow","rangeOverflow","stepMismatch","tooShort","tooLong","badInput","fileMissing"];function Bt(t){var e=t&&t.validity;if(!e)return!1;for(var i=0;i<dt.length;i+=1)if(e[dt[i]])return!0;return!1}function et(t,e){for(var i=t;i&&i.nodeType===1;){for(var r=0;r<e.length;r+=1){var a=i.getAttribute(e[r]);if(a)return a}i=i.parentElement}return""}function L(t,e,i){var r=String(t||"").toLowerCase();return e.indexOf(r)===-1?i:r}function $t(t){if(Array.isArray(t))return t.slice();if(typeof t=="string"){var e=t.trim();if(e.charAt(0)==="[")try{var i=JSON.parse(e);if(Array.isArray(i))return i}catch{}else if(e.indexOf(",")!==-1)return e.split(",").map(function(r){return Number(r.trim())}).filter(function(r){return isFinite(r)})}return t}function qt(t,e){var i=e||{},r=i.theme||et(t,["data-zidan-theme","data-zs-theme"]);!r&&l&&(r=l.documentElement.getAttribute("data-zs-theme")||"");var a=i.framework||et(t,["data-zidan-framework","data-zs-framework"]);!a&&l&&(a=l.documentElement.getAttribute("data-zs-framework")||"");var n=i.layout||et(t,["data-zidan-layout","data-zs-layout"]);return{theme:L(r,W,"default"),framework:L(a,H,"none"),layout:n?String(n).toLowerCase():""}}function te(t,e){var i=null;function r(){var a=arguments;clearTimeout(i),i=setTimeout(function(){i=null,t.apply(null,a)},e)}return r.cancel=function(){clearTimeout(i),i=null},r}var Ht=["valid","invalid"],ut=["default","switch","card","button","minimal"],ft=["ios","material","square","labeled","icon"],ct=["stacked","inline","card","button","tile"],R=["dropzone","button","avatar","gallery","compact"],ht=["default","gradient","stepped","minimal"],ee=["always","active","never"],ie=["top","bottom"];function re(t,e){var i="";return Array.prototype.slice.call(t.childNodes).forEach(function(r){r===e||r.nodeType!==3||(i+=r.nodeValue)}),i.replace(/\s+/g," ").trim()}function ae(t,e){return Array.prototype.slice.call(t.childNodes).forEach(function(i){i.nodeType===3&&i.nodeValue.trim()&&e.appendChild(i)}),e}function f(t,e,i){if(!l)throw new Error("ZidanForm requires a DOM environment.");if(!y(t))throw new Error("ZidanForm: target element not found.");this.el=t,this.kind=i,this.opts=e||{},this.opts.messages=Object.assign({},M,this.opts.messages||{}),this.id=t.id||(t.id=Tt("zf")),this.root=null,this.touched=!1,this.validation=null,this.errorMessage=null,this.errorEl=null,this.pending=!1,this._asyncToken=0,this._asyncController=null,this.destroyed=!1,this._listeners=[],this._cleanups=[],this._describedByBefore=[],this.formEl=t.form||(t.closest?t.closest("form"):null);var r=qt(t,this.opts);this.theme=r.theme,this.framework=r.framework,this.layout=this.opts.layout||r.layout}f.prototype.on=function(t,e,i,r){return!t||!t.addEventListener?this:(t.addEventListener(e,i,r),this._listeners.push([t,e,i,r]),this)},f.prototype.emit=function(t,e){if(!this.root)return this;var i=e||{};i.instance=this,i.kind=this.kind;try{this.root.dispatchEvent(new CustomEvent(Ft+t,{detail:i,bubbles:!0}))}catch{}return this},f.prototype.call=function(t,e){var i=this.opts[t];if(typeof i=="function")try{return i(e)}catch(r){this.emit("error",{error:r,callback:t})}},f.prototype._scope=function(t){var e=v("div","zs-field");return e.id=this.id+"-field",e.setAttribute("data-zs-kind",t),e.classList.add("zs-field--"+t),Lt(this.el)&&e.setAttribute("dir","rtl"),this._applyScope(e),this.root=e,e},f.prototype._applyScope=function(t){return t.setAttribute("data-zs-theme",this.theme),t.setAttribute("data-zs-framework",this.framework),this.layout&&t.setAttribute("data-zs-layout",this.layout),t},f.prototype.setTheme=function(t){return this.theme=L(t,W,this.theme),this.root&&this.root.setAttribute("data-zs-theme",this.theme),this},f.prototype.setFramework=function(t){return this.framework=L(t,H,this.framework),this.root&&this.root.setAttribute("data-zs-framework",this.framework),this},f.prototype.setLayout=function(t){return this.layout=L(t,J,this.layout||"stacked"),this.root&&this.root.setAttribute("data-zs-layout",this.layout),this},f.prototype.validationTargets=function(){return[this.el]},f.prototype._customError=function(){return""},f.prototype._messageFor=function(t){var e=Dt(t,this.opts.messages);return e||(t&&t.validationMessage?t.validationMessage:this.opts.messages.generic||M.generic)},f.prototype._nativeError=function(){for(var t=this.validationTargets(),e=0;e<t.length;e+=1){var i=t[e];if(Bt(i))return this._messageFor(i)}return""},f.prototype._asyncSignal=function(){return this._asyncController?this._asyncController.signal:void 0},f.prototype._asyncContext=function(){return{signal:this._asyncSignal(),field:this,instance:this}},f.prototype._setCustomValidity=function(){},f.prototype._abortAsync=function(){if(this._asyncToken+=1,this._asyncController){try{this._asyncController.abort()}catch{}this._asyncController=null}},f.prototype._evaluate=function(){this._abortAsync(),typeof AbortController!="undefined"&&(this._asyncController=new AbortController);var t=this._customError?this._customError():"";if(tt(t))return{pending:t};if(this._asyncController=null,t)return{error:typeof t=="string"?t:this.opts.messages.generic,custom:!0};var e=this._nativeError();return e?{error:e,custom:!1}:{}},f.prototype._applyValidity=function(t,e,i){return this._setCustomValidity(t&&i?t:""),t?(e?this.setError(t):this.setValidation("invalid",!0),this):(this.errorMessage&&this.setError(null),this.validation==="invalid"&&!this._presetValidation&&this.setValidation(null,!0),this)},f.prototype._setPending=function(t){return t=!!t,this.pending=t,this.root&&(this.root.classList.toggle("zs-field--pending",t),t?this.root.setAttribute("data-zs-validation","pending"):this.root.getAttribute("data-zs-validation")==="pending"&&this.root.removeAttribute("data-zs-validation")),this.validationTargets().forEach(function(e){!e||!e.setAttribute||(t?e.setAttribute("aria-busy","true"):e.removeAttribute("aria-busy"))},this),t?(this.errorMessage&&this.setError(null),this._setCustomValidity(this.opts.messages.pending||M.pending)):this._setCustomValidity(""),this},f.prototype._runAsync=function(t){var e=this;if(e.destroyed)return Promise.resolve(!1);var i=e._asyncToken;return e._setPending(!0),Promise.resolve(t).then(function(r){if(e.destroyed||i!==e._asyncToken)return!1;e._asyncController=null,e._setPending(!1);var a="";return r===!1?a=e.opts.messages.generic:typeof r=="string"?a=r:r instanceof Error&&(a=r.message||e.opts.messages.generic),e._applyValidity(a,e.touched||e.opts.alwaysValidate||!!a,!0),!a&&e.opts.showValidState&&e.setValidation("valid"),e.emit("async-validation",{valid:!a,message:a}),!a},function(r){if(e.destroyed||i!==e._asyncToken||r&&r.name==="AbortError")return!1;e._asyncController=null,e._setPending(!1);var a=r&&(r.message||r.error)||e.opts.messages.generic;return typeof a!="string"&&(a=e.opts.messages.generic),e._applyValidity(a,!0,!0),e.emit("async-validation",{valid:!1,message:a,error:r}),!1})},f.prototype.checkAsync=function(){var t=this._evaluate();return t.pending?this._runAsync(t.pending):Promise.resolve(!t.error)},f.prototype._trackDescribedBy=function(t){if(!(!t||!t.getAttribute)){for(var e=0;e<this._describedByBefore.length;e+=1)if(this._describedByBefore[e][0]===t)return;this._describedByBefore.push([t,t.getAttribute("aria-describedby")])}},f.prototype._addDescribedBy=function(t,e){if(!(!t||!t.getAttribute||!e)){this._trackDescribedBy(t);var i=(t.getAttribute("aria-describedby")||"").split(/\s+/).filter(Boolean);i.indexOf(e)===-1&&i.push(e),t.setAttribute("aria-describedby",i.join(" "))}},f.prototype._syncDescribedBy=function(){if(!(!this.el||!this.el.getAttribute)){var t=this.id+"-error",e=this.root&&this.root.querySelector?this.root.querySelector(".zs-field__hint[id]"):null,i=e?e.id:"",r=this.validationTargets();r.forEach(function(a){if(!(!a||!a.getAttribute)){this._trackDescribedBy(a);var n=(a.getAttribute("aria-describedby")||"").split(/\s+/).filter(Boolean),s=n.filter(function(o){return o!==t&&o!==i});i&&s.push(i),this.errorMessage&&s.push(t),s.length?a.setAttribute("aria-describedby",s.join(" ")):a.removeAttribute("aria-describedby")}},this)}},f.prototype._renderError=function(){this.root&&(this.errorEl||(this.errorEl=v("p","zs-field__error",{id:this.id+"-error",role:"status","aria-live":"polite"}),this.root.appendChild(this.errorEl)),this.errorEl.textContent=this.errorMessage||"",this.errorEl.hidden=!this.errorMessage,this._syncDescribedBy())},f.prototype.setError=function(t){this.errorMessage=t||null,this.errorMessage?this.validation="invalid":this.validation==="invalid"&&(this.validation=null);var e=!!this.errorMessage||this.validation==="invalid";return this.root&&(this.root.classList.toggle("zs-field--invalid",e),this.root.classList.toggle("zs-field--valid",this.validation==="valid"&&!this.errorMessage),e||this.validation?this.root.setAttribute("data-zs-validation",e?"invalid":this.validation):this.root.removeAttribute("data-zs-validation")),this._renderError(),this.validationTargets().forEach(function(i){!i||!i.setAttribute||(e?i.setAttribute("aria-invalid","true"):this.validation==="valid"?i.setAttribute("aria-invalid","false"):i.removeAttribute("aria-invalid"))},this),this.emit("validation",{state:e?"invalid":this.validation,message:this.errorMessage}),this.call("onValidation",{state:e?"invalid":this.validation,message:this.errorMessage,instance:this}),this},f.prototype.clearError=function(){return this.setError(null)},f.prototype._bindValidity=function(){var t=this;this.validationTargets().forEach(function(i){t.on(i,"invalid",function(){t.touched=!0;var r=t._evaluate();if(r.pending){t._runAsync(r.pending);return}r.error?t.setError(r.error):t.setValidation("invalid")}),t.on(i,"blur",function(){t.touched=!0,t._presetValidation=!1,t._mirrorValidity()}),t.on(i,"input",function(){t._presetValidation=!1,t._mirrorValidity()}),t.on(i,"change",function(){t._presetValidation=!1,t._mirrorValidity()})}),this.on(this.formEl,"reset",function(){p.setTimeout(function(){t.destroyed||(t._abortAsync(),t.touched=!1,t.errorMessage=null,t._setPending(!1),t.errorEl&&(t.errorEl.textContent="",t.errorEl.hidden=!0),t.setValidation(null),t.update())},0)});var e=this.opts.validation||this.el.getAttribute("data-zidan-validation")||this.el.getAttribute("data-zs-validation");(e==="valid"||e==="invalid")&&this.setValidation(e),this._syncDescribedBy()},f.prototype._mirrorValidity=function(){var t=this._evaluate();return t.pending?(this._runAsync(t.pending),this):(this.pending&&this._setPending(!1),this._applyValidity(t.error||"",this.touched||this.opts.alwaysValidate,t.custom),this)},f.prototype.validate=function(){this.touched=!0;var t=this._evaluate();return t.pending?this._runAsync(t.pending):(this.pending&&this._setPending(!1),t.error?(this._applyValidity(t.error,!0,t.custom),!1):(this._applyValidity("",!0,!1),this.opts.showValidState&&this.setValidation("valid"),!0))},f.prototype.setValidation=function(t,e){this.validation=Ht.indexOf(t)===-1?null:t,e||(this._presetValidation=this.validation==="invalid");var i=this.validation==="invalid"||!!this.errorMessage;return this.root&&(this.root.classList.toggle("zs-field--invalid",i),this.root.classList.toggle("zs-field--valid",this.validation==="valid"&&!this.errorMessage),i?this.root.setAttribute("data-zs-validation","invalid"):this.validation?this.root.setAttribute("data-zs-validation",this.validation):this.root.removeAttribute("data-zs-validation")),this.validationTargets().forEach(function(r){!r||!r.setAttribute||(i?r.setAttribute("aria-invalid","true"):this.validation==="valid"?r.setAttribute("aria-invalid","false"):r.removeAttribute("aria-invalid"))},this),this.emit("validation",{state:i?"invalid":this.validation,message:this.errorMessage}),this.call("onValidation",{state:i?"invalid":this.validation,message:this.errorMessage,instance:this}),this},f.prototype.getValidation=function(){return this.validation},f.prototype.isPending=function(){return this.pending},f.prototype.getValue=function(){var t=this.el;return t?this.kind==="file"?this.getFiles?this.getFiles():Array.prototype.slice.call(t.files||[]):t.type==="checkbox"?!!t.checked:t.multiple&&t.options?Array.prototype.filter.call(t.options,function(e){return e.selected}).map(function(e){return e.value}):t.value:null},f.prototype.setValue=function(t){var e=this.el;if(!e)return this;if(this.kind==="file"){var i=t==null?[]:Array.isArray(t)?t:[t];return i.length?(this.addFiles&&this.addFiles(i),this):this.clear?this.clear():this}if(e.type==="checkbox")return this.setChecked?this.setChecked(!!t):(e.checked=!!t,e.dispatchEvent(new Event("change",{bubbles:!0})),this.update());if(e.multiple&&e.options){var r=(Array.isArray(t)?t:[t]).map(String);Array.prototype.forEach.call(e.options,function(a){a.selected=r.indexOf(a.value)!==-1})}else e.value=t==null?"":String(t);return e.dispatchEvent(new Event("change",{bubbles:!0})),this.update()},f.prototype.update=function(){return this._sync&&this._sync(),this._mirrorValidity(),this},f.prototype.refresh=function(){return this.update()},f.prototype.destroy=function(){return this.destroyed?this:(this.destroyed=!0,this._abortAsync(),this._listeners.forEach(function(t){t[0].removeEventListener(t[1],t[2],t[3])}),this._listeners.length=0,this._teardown&&this._teardown(),this._cleanups.forEach(function(t){t()}),this._cleanups.length=0,this.emit("destroy",{}),this.root&&this.root!==this.el&&this.root.parentNode&&this.root.parentNode.removeChild(this.root),this._describedByBefore.forEach(function(t){var e=t[0];!e||!e.getAttribute||(t[1]===null||t[1]===void 0?e.removeAttribute("aria-describedby"):e.setAttribute("aria-describedby",t[1]))}),this._describedByBefore=[],this.el.__zidanField===this&&delete this.el.__zidanField,h._unregister(this),this)};function G(t){return!t&&t!==0?"":t<1024?t+" B":t<1024*1024?(t/1024).toFixed(t<10240?1:0)+" KB":(t/(1024*1024)).toFixed(1)+" MB"}function pt(t){var e=/\.([a-z0-9]+)$/i.exec(String(t||""));return e?"."+e[1].toLowerCase():""}function jt(t,e){return e?String(e).split(",").some(function(i){var r=i.trim().toLowerCase();return r?r.indexOf(".")===0?pt(t.name)===r:r.indexOf("/*")!==-1?String(t.type).toLowerCase().indexOf(r.split("/")[0]+"/")===0:String(t.type).toLowerCase()===r:!1}):!0}function w(t){return[t.name,t.size,t.lastModified||0,t.type||""].join("|")}function Gt(t,e){return t&&typeof t=="string"?t:t&&t.message?t.message:t&&t.status?"Upload failed (HTTP "+t.status+").":e||"Upload failed."}function d(t,e){if(!(this instanceof d))return new d(t,e);if(!/^file$/i.test(t.type))throw new Error('ZidanFileUpload: expected an <input type="file">.');f.call(this,t,e,"file");var i=this,r=t,a=this.opts,n=L(C(r,a,"fileVariant","file-variant",C(r,a,"variant","variant","dropzone")),R,"dropzone"),s=r.parentNode,o=this._scope("file");o.setAttribute("data-zs-file-variant",n),s.insertBefore(o,r);var u=v("label","zs-file-drop zs-file-drop--"+n);u.setAttribute("for",this.id);var _=v("span","zs-file-avatar",{hidden:!0}),E=l.createElement("img");E.alt="",_.appendChild(E);var z=v("span","zs-file-icon",{"aria-hidden":"true"}),c=C(r,a,"uploadIcon","upload-icon",C(r,a,"icon","icon","upload")),D=Nt(c,"zs-file-icon-svg");D&&z.appendChild(D);var X=a.title||r.getAttribute("data-zidan-title")||(n==="avatar"?"Upload an image":n==="gallery"?"Add images":"Choose a file"),S=v("span","zs-file-drop-title",null,X),b=v("span","zs-file-drop-hint",null,a.dropHint||r.getAttribute("data-zidan-drop-hint")||(r.multiple?"or drop files here \u2014 multiple allowed":"or drop it here"));u.appendChild(_),u.appendChild(z),u.appendChild(S),u.appendChild(b),u.appendChild(r),o.appendChild(u);var k=v("ul","zs-file-list");o.appendChild(k);var x=v("div","zs-file-meta-row"),B=v("span","zs-file-status",{role:"status","aria-live":"polite"}),F=v("button","zs-file-clear",{type:"button"});F.textContent=a.clearLabel||"Clear all",F.hidden=!0,x.appendChild(B),x.appendChild(F),o.appendChild(x);var q=a.accept||r.accept;q&&(b.textContent=b.textContent+" \xB7 "+q),this.variant=n,this.drop=u,this.list=k,this.status=B,this.clearBtn=F,this.titleEl=S,this.hintEl=b,this._fallbackTitle=X,this.avatarEl=_,this.avatarImg=E,this.uploadHandler=typeof a.upload=="function"?a.upload:typeof a.uploadHandler=="function"?a.uploadHandler:null,this.uploadUrl=C(r,a,"uploadUrl","upload-url",""),this.uploadField=C(r,a,"uploadField","upload-field","file"),this.withCredentials=P(r,a,"withCredentials","with-credentials",!1),this.uploadHeaders=a.uploadHeaders||a.headers||null,this.simulateUpload=P(r,a,"simulateUpload","simulate-upload",!1),this.simulateDuration=Math.max(120,Rt(r,a,"simulateDuration","simulate-duration",900)),this.autoUpload=P(r,a,"autoUpload","auto-upload",!0),this.showFileMeta=P(r,a,"showFileMeta","show-file-meta",!0),this.showPreview=P(r,a,"showPreview","preview",!0),this.hasUploader=!!(this.uploadHandler||this.uploadUrl||this.simulateUpload),o.setAttribute("data-zs-upload",this.hasUploader?"true":"false"),this._uploads=Object.create(null),this._active=Object.create(null),this._urls=[],this._renderQueued=!1,this.fileError="",this._restoreInput=function(){var m=o.parentNode||s;m.insertBefore(r,o.parentNode?o:null),r.classList.remove("zs-native-input","zs-file-input")},st(r,"zs-native-input"),st(r,"zs-file-input"),this.on(r,"change",function(){var m=i._validate();i._render(),i.emit("change",{files:i.getFiles()}),i.call("onChange",{files:i.getFiles(),instance:i}),m&&i.autoUpload&&i.hasUploader&&i.uploadAll()});var Z=0;["dragenter","dragover"].forEach(function(m){i.on(u,m,function(A){A.preventDefault(),m==="dragenter"&&(Z+=1),u.classList.add("zs-file-drop--over")})}),i.on(u,"dragleave",function(){Z=Math.max(0,Z-1),Z||u.classList.remove("zs-file-drop--over")}),i.on(u,"drop",function(m){if(m.preventDefault(),Z=0,u.classList.remove("zs-file-drop--over"),!(!m.dataTransfer||!m.dataTransfer.files||!m.dataTransfer.files.length)){var A=Array.prototype.slice.call(m.dataTransfer.files);r.multiple||(A=A.slice(0,1)),i.addFiles(A)}}),i.on(F,"click",function(){i.clear()}),i.on(k,"click",function(m){var A=m.target&&m.target.closest?m.target.closest("button"):null;if(!(!A||!k.contains(A))){var Et=A.closest(".zs-file-item"),St=Et?parseInt(Et.getAttribute("data-zs-file-index"),10):-1,K=St>=0?i.getFiles()[St]:null;K&&(m.preventDefault(),m.stopPropagation(),A.classList.contains("zs-file-cancel")?i.cancelUpload(K):A.classList.contains("zs-file-retry")?i.retryUpload(K):A.classList.contains("zs-file-remove")&&i.removeFile(K))}}),this._bindValidity(),this.on(this.formEl,"reset",function(){p.setTimeout(function(){i.destroyed||(i.cancelAll(),i._uploads=Object.create(null),i.fileError="",r.setCustomValidity&&r.setCustomValidity(""),i._render())},0)}),r.__zidanField=this,this._render(),this.emit("init",{}),h._register(this)}d.prototype=Object.create(f.prototype),d.prototype.constructor=d,d.prototype.getFiles=function(){return this.el.files?Array.prototype.slice.call(this.el.files):[]},d.prototype.getUploadState=function(){var t=this;return this.getFiles().map(function(e){var i=t._stateFor(e,!1)||{status:"idle",progress:0,error:"",result:null};return{file:e,name:e.name,size:e.size,status:i.status,progress:i.progress,error:i.error,result:i.result}})},d.prototype._stateFor=function(t,e){var i=w(t),r=this._uploads[i];return!r&&e&&(r=this._uploads[i]={status:"idle",progress:0,error:"",result:null}),r},d.prototype._setFiles=function(t){try{var e=typeof DataTransfer!="undefined"?DataTransfer:p.DataTransfer;if(!e)return!1;var i=new e;return t.forEach(function(r){i.items.add(r)}),this.el.files=i.files,!0}catch{return!1}},d.prototype._applyFiles=function(t,e){if(!this._setFiles(t))return this.emit("error",{error:new Error("This browser cannot assign files programmatically."),action:"setFiles"}),this;if(e)try{this.el.dispatchEvent(new Event("change",{bubbles:!0}))}catch{}else this._validate(),this._render();return this},d.prototype.addFiles=function(t){var e=t&&t.length!==void 0?Array.prototype.slice.call(t):$(t);if(!e.length)return this;var i=this.el.multiple?this.getFiles():[],r=Object.create(null),a=i.concat(e).filter(function(n){var s=w(n);return r[s]?!1:(r[s]=!0,!0)});if(this.el.multiple||(a=a.slice(0,1)),!this._setFiles(a))return this.emit("error",{error:new Error("This browser cannot assign files programmatically."),action:"addFiles"}),this;try{this.el.dispatchEvent(new Event("change",{bubbles:!0}))}catch{}return this},d.prototype.replaceFiles=function(t){return this._applyFiles(t&&t.length!==void 0?Array.prototype.slice.call(t):$(t),!0)},d.prototype.removeFile=function(t){var e=this.getFiles(),i=typeof t=="number"?t:e.indexOf(t);if(i===-1||!e[i])return this;var r=e[i];this.cancelUpload(r),delete this._uploads[w(r)];var a=e.slice();return a.splice(i,1),this._setFiles(a),this._validate(),this._render(),this.emit("change",{files:a}),this.emit("remove",{file:r,index:i}),this.call("onChange",{files:a,instance:this}),this.call("onRemove",{file:r,index:i,instance:this}),this},d.prototype.clear=function(){return this.cancelAll(),this._uploads=Object.create(null),this.fileError="",this.el.value="",this.el.setCustomValidity&&this.el.setCustomValidity(""),this._validate(),this._render(),this.emit("change",{files:[]}),this.emit("clear",{}),this.call("onChange",{files:[],instance:this}),this},d.prototype._limits=function(){var t=this.el,e=this.opts,i=parseInt(e.maxFiles||t.getAttribute("data-zidan-max-files"),10),r=parseInt(e.maxSize||t.getAttribute("data-zidan-max-size"),10);if(!(r>0)){var a=e.maxSizeMB;if((a==null||a==="")&&(a=t.getAttribute("data-zidan-max-size-mb")),a!=null&&a!==""){var n=parseFloat(a);n>0&&(r=Math.round(n*1024*1024))}}return{maxFiles:i>0?i:0,maxSize:r>0?r:0,accept:e.accept||t.accept||""}},d.prototype._setCustomValidity=function(t){this.el&&this.el.setCustomValidity&&this.el.setCustomValidity(t||"")},d.prototype._customError=function(){if(this.fileError)return this.fileError;if(typeof this.opts.validate=="function"){var t=this.opts.validate(this.getFiles(),this,this._asyncContext());if(t===!1)return this.opts.messages.generic;if(typeof t=="string"&&t||tt(t))return t}return""},d.prototype._validate=function(){var t=this.el,e=this.opts.messages,i=this._limits(),r=this.getFiles(),a="";if(i.maxFiles&&r.length>i.maxFiles&&(a=N(e.fileCount,{max:i.maxFiles}),r=r.slice(0,i.maxFiles),this._setFiles(r)),!a&&i.maxSize){for(var n=0;n<r.length;n+=1)if(r[n].size>i.maxSize){a=N(e.fileSize,{name:r[n].name,size:G(r[n].size),limit:G(i.maxSize)});break}}if(!a&&i.accept){for(var s=0;s<r.length;s+=1)if(!jt(r[s],i.accept)){a=N(e.fileType,{name:r[s].name,accept:i.accept});break}}this.fileError=a,t.setCustomValidity&&t.setCustomValidity(this.pending?e.pending||M.pending:a||"");var o=a||this._nativeError();return o?this.setError(o):this.errorMessage&&this.setError(null),this.root.classList.toggle("zs-field--filled",r.length>0),this.drop.classList.toggle("zs-file-drop--invalid",!!o),this._renderStatus(),!o},d.prototype._sync=function(){this._render()},d.prototype._queueRender=function(){var t=this;if(!(this._renderQueued||this.destroyed)){this._renderQueued=!0;var e=function(){t._renderQueued=!1,t.destroyed||t._render()};p.requestAnimationFrame?p.requestAnimationFrame(e):p.setTimeout(e,32)}},d.prototype._renderStatus=function(){var t=this.getFiles(),e=this.getUploadState(),i=t.reduce(function(u,_){return u+_.size},0),r=e.filter(function(u){return u.status==="uploading"}),a=e.filter(function(u){return u.status==="error"}),n=e.filter(function(u){return u.status==="done"}),s="";if(this.fileError)s=this.fileError;else if(t.length)if(s=t.length+(t.length===1?" file selected":" files selected")+" \xB7 "+G(i),r.length){var o=Math.round(r.reduce(function(u,_){return u+_.progress},0)/r.length);s+=" \xB7 Uploading "+o+"%"}else a.length?s+=" \xB7 "+a.length+" failed":n.length===t.length&&this.hasUploader&&(s+=" \xB7 Uploaded");this.status.textContent=s,this.status.classList.toggle("zs-file-status--error",!!this.fileError),this.status.classList.toggle("zs-file-status--success",!this.fileError&&t.length>0&&n.length===t.length&&this.hasUploader)},d.prototype._render=function(){var t=this,e=this.getFiles(),i=this.opts;this.list.textContent="",this._revokeLater(this._urls),this._urls=[],this.list.hidden=e.length===0,this.clearBtn.hidden=e.length===0,this.root.classList.toggle("zs-field--filled",e.length>0),this.drop.classList.toggle("zs-file-drop--has-files",e.length>0);var r=this.showPreview?e.filter(function(n){return/^image\//.test(n.type)})[0]:null;if(r){var a=URL.createObjectURL(r);this._urls.push(a),this.avatarImg.src=a,this.avatarEl.hidden=!1,this.drop.classList.add("zs-file-drop--has-preview"),this.titleEl.textContent=i.replaceTitle||"Change image"}else this.avatarImg.removeAttribute("src"),this.avatarEl.hidden=!0,this.drop.classList.remove("zs-file-drop--has-preview"),this.titleEl.textContent=this._fallbackTitle;e.forEach(function(n,s){var o=t._stateFor(n,!1)||{status:"idle",progress:0,error:"",result:null},u=v("li","zs-file-item");u.setAttribute("data-zs-upload-state",o.status),u.setAttribute("data-zs-file-index",String(s));var _=v("span","zs-file-thumb");if(/^image\//.test(n.type)){var E=URL.createObjectURL(n);t._urls.push(E);var z=l.createElement("img");z.src=E,z.alt="",_.appendChild(z)}else _.textContent=(pt(n.name)||"file").replace(".","").slice(0,4).toUpperCase();var c=v("span","zs-file-info"),D=v("span","zs-file-name",null,n.name);if(c.appendChild(D),t.showFileMeta){var X=G(n.size)+(n.type?" \xB7 "+n.type:"");c.appendChild(v("span","zs-file-size",null,X))}if(t.hasUploader){var S=v("span","zs-file-upload-state");if(o.status==="uploading"){S.textContent=N(i.progressTemplate||"Uploading {percent}%",{percent:o.progress});var b=v("span","zs-file-progress");b.setAttribute("role","progressbar"),b.setAttribute("aria-valuemin","0"),b.setAttribute("aria-valuemax","100"),b.setAttribute("aria-valuenow",String(o.progress)),b.setAttribute("aria-label","Upload progress for "+n.name);var k=v("span","zs-file-progress-bar");k.style.width=o.progress+"%",b.appendChild(k),S.appendChild(b)}else o.status==="done"?S.textContent=i.uploadedLabel||"Uploaded":o.status==="error"?S.textContent=(i.failedLabel||"Upload failed")+(o.error?" \u2014 "+o.error:""):o.status==="canceled"&&(S.textContent=i.canceledLabel||"Upload canceled");S.textContent&&c.appendChild(S)}var x=v("span","zs-file-actions");if(o.status==="uploading"){var B=v("button","zs-file-cancel",{type:"button","aria-label":"Cancel upload of "+n.name});B.textContent=i.cancelLabel||"Cancel",x.appendChild(B)}else if(o.status==="error"||o.status==="canceled"){var F=v("button","zs-file-retry",{type:"button","aria-label":"Retry upload of "+n.name});F.textContent=i.retryLabel||"Retry",x.appendChild(F)}var q=v("button","zs-file-remove",{type:"button","aria-label":"Remove "+n.name});if(q.textContent="\xD7",x.appendChild(q),u.appendChild(_),u.appendChild(c),u.appendChild(x),t.list.appendChild(u),typeof i.renderFile=="function")try{i.renderFile(u,{file:n,index:s,state:o,field:t})}catch(Z){t.emit("error",{error:Z,callback:"renderFile"})}}),this._renderStatus()},d.prototype.setVariant=function(t){var e=L(t,R,this.variant);return e===this.variant?this:(this.variant=e,R.forEach(function(i){this.drop.classList.remove("zs-file-drop--"+i)},this),this.drop.classList.add("zs-file-drop--"+e),this.root.setAttribute("data-zs-file-variant",e),this._render(),this)},d.prototype.setUploader=function(t){return typeof t=="function"?(this.uploadHandler=t,this.uploadUrl=""):(this.uploadHandler=null,this.uploadUrl=t?String(t):""),this.hasUploader=!!(this.uploadHandler||this.uploadUrl||this.simulateUpload),this.root.setAttribute("data-zs-upload",this.hasUploader?"true":"false"),this._render(),this},d.prototype._formData=function(t){var e=new FormData;e.append(this.uploadField,t,t.name);var i=typeof this.opts.uploadData=="function"?this.opts.uploadData(t,this):this.opts.uploadData;return i&&typeof i=="object"&&Object.keys(i).forEach(function(r){var a=i[r];a!=null&&e.append(r,a)}),e},d.prototype.uploadAll=function(){var t=this;if(!this.hasUploader)return this;if(!this._validate())return this;var e=this.validate();return tt(e)?e.then(function(i){return i&&!t.destroyed&&t.getFiles().forEach(function(r){t.uploadFile(r)}),i}):e?(this.getFiles().forEach(function(i){t.uploadFile(i)}),this):this},d.prototype.uploadFile=function(t){var e=this,i=w(t),r=this._stateFor(t,!0);if(r.status==="uploading"||r.status==="done")return this;if(r.status="uploading",r.progress=0,r.error="",r.result=null,this._queueRender(),this.emit("upload-start",{file:t,name:t.name,size:t.size}),this.call("onUploadStart",{file:t,name:t.name,size:t.size,instance:this}),this.uploadHandler){var a=typeof AbortController!="undefined"?new AbortController:null;this._active[i]={type:"handler",abort:function(){a&&a.abort()}};var n={file:t,field:this,formData:this._formData(t),signal:a?a.signal:null,onProgress:function(c){e._setProgress(t,c)},complete:function(c){e._finish(t,c)},fail:function(c){e._fail(t,c)}},s;try{s=this.uploadHandler(t,n)}catch(c){return this._fail(t,c),this}return s&&typeof s.then=="function"?s.then(function(c){e._finish(t,c)},function(c){c&&(c.name==="AbortError"||c.aborted)?e._canceledUpload(t):e._fail(t,c)}):s!==void 0&&this._finish(t,s),this}if(this.uploadUrl){var o=new p.XMLHttpRequest;this._active[i]={type:"xhr",abort:function(){try{o.abort()}catch{}}},o.open("POST",this.uploadUrl,!0),this.withCredentials&&(o.withCredentials=!0);var u=typeof this.uploadHeaders=="function"?this.uploadHeaders(t,this):this.uploadHeaders;return u&&typeof u=="object"&&Object.keys(u).forEach(function(c){o.setRequestHeader(c,u[c])}),o.upload.onprogress=function(c){c.lengthComputable&&e._setProgress(t,Math.min(99,Math.round(c.loaded/c.total*100)))},o.onload=function(){if(o.status>=200&&o.status<300){var c=o.responseText;try{c=JSON.parse(c)}catch{}e._finish(t,c)}else e._fail(t,{status:o.status,message:"Upload failed (HTTP "+o.status+")."})},o.onerror=function(){e._fail(t,{message:"Network error while uploading."})},o.onabort=function(){e._canceledUpload(t)},o.send(this._formData(t)),this}if(this.simulateUpload){var _=Date.now(),E=null,z=function(){if(!(!e._uploads[i]||r.status!=="uploading")){var c=Math.min(99,Math.round((Date.now()-_)/e.simulateDuration*100));e._setProgress(t,c),c>=99?(delete e._active[i],e._finish(t,{simulated:!0})):E=p.setTimeout(z,40)}};return this._active[i]={type:"simulation",abort:function(){E&&p.clearTimeout(E)}},E=p.setTimeout(z,40),this}return r.status="idle",this._queueRender(),this},d.prototype._setProgress=function(t,e){var i=this._stateFor(t,!1);if(!(!i||i.status!=="uploading")){var r=Ot(Math.round(Number(e)||0),0,99);r!==i.progress&&(i.progress=r,this._queueRender(),this.emit("upload-progress",{file:t,progress:r,name:t.name}),this.call("onUploadProgress",{file:t,progress:r,name:t.name,instance:this}))}},d.prototype._finish=function(t,e){var i=this._stateFor(t,!1);!i||i.status!=="uploading"||(delete this._active[w(t)],i.status="done",i.progress=100,i.result=e===void 0?null:e,this._queueRender(),this.emit("upload-success",{file:t,name:t.name,result:i.result}),this.call("onUploadSuccess",{file:t,name:t.name,result:i.result,instance:this}),this.call("onUpload",{file:t,name:t.name,result:i.result,instance:this}))},d.prototype._fail=function(t,e){var i=this._stateFor(t,!1);!i||i.status!=="uploading"||(delete this._active[w(t)],i.status="error",i.error=Gt(e,this.opts.messages.upload||"Upload failed."),this._queueRender(),this.emit("upload-error",{file:t,name:t.name,error:e,message:i.error}),this.call("onUploadError",{file:t,name:t.name,error:e,message:i.error,instance:this}))},d.prototype._canceledUpload=function(t){var e=this._stateFor(t,!1);!e||e.status!=="uploading"||(delete this._active[w(t)],e.status="canceled",e.progress=0,e.error="",this._queueRender(),this.emit("upload-cancel",{file:t,name:t.name}),this.call("onUploadCancel",{file:t,name:t.name,instance:this}))},d.prototype.cancelUpload=function(t){var e=w(t),i=this._active[e];if(i){try{i.abort()}catch{}delete this._active[e]}return this._canceledUpload(t),this},d.prototype.cancelAll=function(){var t=this;return Object.keys(this._active).forEach(function(e){try{t._active[e].abort()}catch{}delete t._active[e]}),this},d.prototype.retryUpload=function(t){var e=this._stateFor(t,!1);return e?(e.status="idle",e.progress=0,e.error="",this.uploadFile(t)):this},d.prototype._revokeLater=function(t){!t||!t.length||p.setTimeout(function(){t.forEach(function(e){try{URL.revokeObjectURL(e)}catch{}})},800)},d.prototype._teardown=function(){this.cancelAll(),this._uploads=Object.create(null),this._revokeLater(this._urls),this._urls=[],this._restoreInput&&this._restoreInput()};function U(t){if(!y(t))return null;var e=String(t.getAttribute("data-zidan")||"").toLowerCase();if(Ct.indexOf(e)!==-1)return e;if(t.hasAttribute("data-zidan-radio-group"))return"radio-group";if(t.hasAttribute("data-zidan-radio"))return"radio";if(t.hasAttribute("data-zidan-checkbox")||t.hasAttribute("data-zidan-switch"))return"checkbox";if(t.hasAttribute("data-zidan-file"))return"file";if(t.hasAttribute("data-zidan-textarea"))return"textarea";if(t.hasAttribute("data-zidan-input"))return"input";var i=String(t.type||"").toLowerCase();if(i==="checkbox")return"checkbox";if(i==="radio")return"radio";if(i==="file")return"file";if(Mt(t,"zidan-field")){if(t.tagName==="FIELDSET")return t.querySelector('input[type="radio"]')?"radio-group":null;if(t.tagName==="TEXTAREA")return"textarea";if(t.tagName!=="INPUT"||i==="radio")return null;if(typeof TEXT_TYPES!="undefined"&&TEXT_TYPES.indexOf(i)!==-1)return"input"}return null}function Y(t,e,i){var r=I(Zt(t),i);if(t.__zidanField&&!r.force)return t.__zidanField;switch(e){case"checkbox":return typeof ZidanCheckbox!="undefined"?new ZidanCheckbox(t,r):null;case"radio":case"radio-group":return typeof ZidanRadioGroup!="undefined"?new ZidanRadioGroup(t,r):null;case"file":return typeof d!="undefined"?new d(t,r):null;case"input":case"textarea":return typeof ZidanTextField!="undefined"?new ZidanTextField(t,r):null;default:return null}}function vt(t,e){var i=[];typeof t=="string"?i=Array.prototype.slice.call(l.querySelectorAll(t)):y(t)?i=[t]:t&&typeof t.length=="number"&&(i=Array.prototype.slice.call(t));var r=[];return i.forEach(function(a){if(!a.__zidanField){var n=U(a)||_t(a);if(n){if(n==="radio"||n==="radio-group"){if(/^INPUT$/i.test(a.tagName)&&(a=a.closest?a.closest("fieldset, [data-zidan-radio-group]"):null,!a))return;n="radio-group"}var s=Y(a,n,e||{});s&&r.push(s)}}}),r.length===1?r[0]:r}function mt(t,e){var i=[];return t.forEach(function(r){if(!(!y(r)||r.__zidanField)){var a=U(r);if(a){if(a==="radio"||a==="radio-group"){if(/^INPUT$/i.test(r.tagName)&&(r=r.closest?r.closest("fieldset, [data-zidan-radio-group]"):null,!r))return;a="radio-group"}var n=Y(r,a,e||{});n&&i.push(n)}}}),i}function V(t,e){var i=t||l;if(!i||!i.querySelectorAll)return[];var r=Array.prototype.slice.call(i.querySelectorAll(at));return y(i)&&i.matches&&i.matches(at)&&r.unshift(i),mt(r,e)}var h={version:T,__zidanFormGuard:T,themes:W,frameworks:H.slice(),fieldLayouts:J,fields:[],_register:function(t){h.fields.indexOf(t)===-1&&h.fields.push(t)},_unregister:function(t){var e=h.fields.indexOf(t);e!==-1&&h.fields.splice(e,1)},get:function(t){var e=typeof t=="string"?l.querySelector(t):t;return y(e)&&e.__zidanField||null},init:function(t,e){return V(t||l,e||{})},field:vt,refresh:function(t){return V(t||l,{}),h.fields.slice().forEach(function(e){e.update()}),h.fields.slice()},destroyAll:function(){return h.fields.slice().forEach(function(t){t.destroy()}),h.fields=[],typeof ZidanSelect!="undefined"&&ZidanSelect.destroyAll&&ZidanSelect.destroyAll(),h},observe:function(t,e){var i=t||l.body;if(!i||!p.MutationObserver)return null;var r=new p.MutationObserver(function(a){a.forEach(function(n){Array.prototype.slice.call(n.addedNodes).forEach(function(s){y(s)&&(U(s)&&Y(s,U(s)==="radio"?"radio-group":U(s),e||{}),s.querySelectorAll&&V(s,e||{}))})}),h.fields.slice().forEach(function(n){n.el.isConnected||n.destroy()}),typeof ZidanSelect!="undefined"&&ZidanSelect.instances.slice().forEach(function(n){n.el.isConnected||n.destroy()})});return r.observe(i,{childList:!0,subtree:!0}),r}};h.api=null,h.registerIcon=lt,h.icons=O,typeof PHONE_COUNTRIES!="undefined"&&(h.phoneCountries=PHONE_COUNTRIES,h.phoneFormats=PHONE_FORMATS.slice(),h.formatPhone=formatPhone,h.detectPhoneCountry=detectPhoneCountry),h.messages=M,h.variants={},typeof ut!="undefined"&&(h.variants.checkbox=ut.slice()),typeof ft!="undefined"&&(h.variants.switch=ft.slice()),typeof ct!="undefined"&&(h.variants.radio=ct.slice()),typeof R!="undefined"&&(h.variants.file=R.slice()),typeof ht!="undefined"&&(h.variants.range=ht.slice()),typeof STEPPER_MODES!="undefined"&&(h.stepperModes=STEPPER_MODES.slice()),h.fieldLayouts=J.slice(),typeof ZidanSelect!="undefined"&&(ZidanSelect.version=T,ZidanSelect.__zidanSelectGuard=T,ZidanSelect.layouts=zt.slice(),ZidanSelect.frameworks=H.slice(),ZidanSelect.scrollbars=xt.slice(),ZidanSelect.defaults=DEFAULTS,ZidanSelect.cacheLimit=50,ZidanSelect.get=function(t){var e=typeof t=="string"?l.querySelector(t):t;return y(e)&&e.__zidanSelect||null},ZidanSelect.instances=[],ZidanSelect.destroyAll=function(){ZidanSelect.instances.slice().forEach(function(t){t.destroy()}),ZidanSelect.instances=[]});function Yt(t,e){var i=[];typeof t=="string"?i=Array.prototype.slice.call(l.querySelectorAll(t)):t&&typeof t.length=="number"&&!y(t)&&t!==p?i=Array.prototype.slice.call(t):y(t)&&(i=[t]);var r=i.map(function(a){var n=new ZidanSelect(a,e||{});return ZidanSelect.instances.push(n),n});return r.length===1?r[0]:r}function it(t,e){return t.filter(function(i){return y(i)&&!i.__zidanSelect}).map(function(i){return ZidanSelect.instances.push(new ZidanSelect(i,e||{})),i.__zidanSelect})}function yt(t,e){var i=t||l;if(!i||!i.querySelectorAll)return[];var r=Array.prototype.slice.call(i.querySelectorAll(Q));return y(i)&&i.matches&&i.matches(Q)&&r.unshift(i),it(r,e)}function rt(t,e){$(t).forEach(function(i){i&&(typeof i=="string"?e(i,null):i.selector&&e(String(i.selector),i.options||null))})}function gt(t,e){rt(t,function(i,r){it(Array.prototype.slice.call(l.querySelectorAll(i)),I(e,r))})}function Xt(t,e){rt(t,function(i,r){var a=I(e,r);Array.prototype.slice.call(l.querySelectorAll(i)).forEach(function(n){if(!(!y(n)||n.__zidanField)){var s=U(n)||_t(n);s&&(s==="radio"&&(s="radio-group"),Y(n,s,a))}})})}function _t(t){return typeof TEXT_TYPES=="undefined"||!y(t)?null:t.tagName==="TEXTAREA"?"textarea":t.tagName!=="INPUT"?null:TEXT_TYPES.indexOf(String(t.type).toLowerCase())!==-1?"input":null}function Kt(t,e){if(typeof ZidanSelect=="undefined")return[];var i=Q+", select",r=Array.prototype.slice.call(t.querySelectorAll(i));return y(t)&&t.matches&&t.matches(i)&&r.unshift(t),it(r,e)}function bt(t,e,i){y(t)&&(Kt(t,e),typeof d!="undefined"&&mt(Array.prototype.slice.call(t.querySelectorAll('input[type="file"]')),i),(typeof ZidanCheckbox!="undefined"||typeof ZidanRadioGroup!="undefined"||typeof d!="undefined"||typeof ZidanTextField!="undefined")&&V(t,i))}function Wt(t,e,i){Array.prototype.slice.call(l.querySelectorAll(wt)).forEach(function(r){bt(r,e,i)}),rt(t,function(r,a){Array.prototype.slice.call(l.querySelectorAll(r)).forEach(function(n){bt(n,I(e,a),I(i,a))})})}function At(){if(l){var t=p.ZIDAN_FORM_CONFIG||p.ZIDAN_SELECT_CONFIG||{};if(t.autoInit!==!1&&!(p.ZidanSelect&&p.ZidanSelect.autoInit===!1)&&l.documentElement.getAttribute("data-zidan-auto-init")!=="false"){var e=typeof ZidanSelect!="undefined",i=typeof ZidanCheckbox!="undefined"||typeof ZidanRadioGroup!="undefined"||typeof d!="undefined"||typeof ZidanTextField!="undefined",r=t.options||{},a=t.fieldOptions||t.fields||{};e&&(t.selector?gt(t.selector,r):gt(t.targets||t.selectors,r)),i&&Xt(t.fieldTargets,a),Wt(t.formTargets,r,a),e&&!t.selector&&yt(l,r),i&&V(l,a)}}}l&&(l.readyState==="loading"?l.addEventListener("DOMContentLoaded",At):setTimeout(At,0));var g={ZidanForm:h,registerIcon:lt};return typeof ZidanSelect!="undefined"&&(g.ZidanSelect=ZidanSelect,g.zidanSelect=Yt,g.initZidanSelects=yt),(typeof ZidanCheckbox!="undefined"||typeof ZidanRadioGroup!="undefined"||typeof d!="undefined"||typeof ZidanTextField!="undefined")&&(g.zidanField=vt,g.initZidanForms=V),typeof ZidanCheckbox!="undefined"&&(g.ZidanCheckbox=ZidanCheckbox),typeof ZidanRadioGroup!="undefined"&&(g.ZidanRadioGroup=ZidanRadioGroup),typeof d!="undefined"&&(g.ZidanFileUpload=d),typeof ZidanTextField!="undefined"&&(g.ZidanTextField=ZidanTextField),typeof formatPhone=="function"&&(g.formatPhone=formatPhone,g.detectPhoneCountry=detectPhoneCountry),h.api=g,g});
11
+ */(function(p,T){"use strict";var l=T(p);typeof window!="undefined"&&(window.ZidanForm=l.ZidanForm,l.ZidanSelect&&(window.ZidanSelect=l.ZidanSelect,window.zidanSelect=l.zidanSelect,window.initZidanSelects=l.initZidanSelects),l.zidanField&&(window.zidanField=l.zidanField),l.initZidanForms&&(window.initZidanForms=l.initZidanForms),l.registerIcon&&(window.registerZidanIcon=l.registerIcon)),typeof module!="undefined"&&module.exports&&(module.exports=l)})(typeof window!="undefined"?window:this,function(p){"use strict";var T="2.4.1";if(p&&p.ZidanForm&&p.ZidanForm.__zidanFormGuard===T)return p.ZidanForm.api;var l=typeof document!="undefined"?document:null,zt=["classic-clean","floating-label","soft-pill","bordered-brutalist","glass-elevated"],H=["auto","none","vanilla","bootstrap","tailwind","bulma","foundation"],W=["default","modern","minimal","dark","glass"],J=["stacked","inline","card","compact","floating","outlined"],Ct=["checkbox","radio","radio-group","file","input","textarea"],at="[data-zidan], [data-zidan-checkbox], [data-zidan-switch], [data-zidan-radio], [data-zidan-radio-group], [data-zidan-file], [data-zidan-input], [data-zidan-textarea], .zidan-field",Q="[data-zidan-select], .zidan-select",wt="[data-zidan-form], .zidan-form",xt=["default","thin","fancy","hover","hidden"],Ft="zidan:",nt=0;function Tt(t){return nt+=1,(t||"zs")+"-"+nt.toString(36)+Math.random().toString(36).slice(2,6)}function Mt(t,e){return!!(t&&t.classList&&t.classList.contains(e))}function st(t,e){return!t||!e||e.split(/\s+/).forEach(function(i){i&&t.classList.add(i)}),t}function v(t,e,i,r){var a=l.createElement(t);return e&&(a.className=e),i&&Object.keys(i).forEach(function(n){var s=i[n];s==null||s===!1||(n==="text"?a.textContent=String(s):a.setAttribute(n,s===!0?"":String(s)))}),r!=null&&(a.textContent=String(r)),a}function $(t){return t==null||t===""?[]:Array.isArray(t)?t.slice():[t]}function tt(t){return!!(t&&(typeof t=="object"||typeof t=="function")&&typeof t.then=="function")}function Lt(t){if(!t)return!1;var e=t.closest?t.closest("[dir]"):null,i=e?e.getAttribute("dir"):"";if(!i&&l&&l.documentElement&&(i=l.documentElement.getAttribute("dir")||""),i)return String(i).toLowerCase()==="rtl";try{return!!(p.getComputedStyle&&p.getComputedStyle(t).direction==="rtl")}catch{return!1}}function y(t){return!!(t&&typeof t=="object"&&t.nodeType===1)}function kt(t,e){if(t==null||t==="")return e;var i=String(t).toLowerCase();return!(i==="false"||i==="0"||i==="no"||i==="off")}function I(){for(var t={},e=0;e<arguments.length;e++)(function(i){!i||typeof i!="object"||Object.keys(i).forEach(function(r){i[r]!==void 0&&(t[r]=i[r])})})(arguments[e]);return t}function Zt(t){if(!t||!t.getAttribute)return null;var e=t.getAttribute("data-zidan-options");if(!e)return null;try{var i=JSON.parse(e);return i&&typeof i=="object"&&!Array.isArray(i)?i:null}catch(r){return typeof console!="undefined"&&console.warn&&console.warn("[ZidanForm] ignoring invalid data-zidan-options JSON on",t,r),null}}function Ot(t,e,i){return Math.min(i,Math.max(e,t))}function N(t,e){return String(t).replace(/\{(\w+)\}/g,function(i,r){return e&&e[r]!==void 0&&e[r]!==null?String(e[r]):i})}var ot={text:'<path d="M4 7h16M4 12h10M4 17h13"/>',mail:'<rect x="3" y="5" width="18" height="14" rx="2"/><path d="m3 7 9 6 9-6"/>',phone:'<path d="M22 16.9v3a2 2 0 0 1-2.2 2 19.8 19.8 0 0 1-8.6-3.1 19.5 19.5 0 0 1-6-6A19.8 19.8 0 0 1 2.1 4.2 2 2 0 0 1 4.1 2h3a2 2 0 0 1 2 1.7c.1 1 .4 1.9.7 2.8a2 2 0 0 1-.5 2.1L8.1 9.9a16 16 0 0 0 6 6l1.3-1.2a2 2 0 0 1 2.1-.5c.9.3 1.8.6 2.8.7a2 2 0 0 1 1.7 2Z"/>',user:'<circle cx="12" cy="8" r="4"/><path d="M4 21a8 8 0 0 1 16 0"/>',lock:'<rect x="4" y="10" width="16" height="11" rx="2"/><path d="M8 10V7a4 4 0 0 1 8 0v3"/>',search:'<circle cx="11" cy="11" r="7"/><path d="m20 20-3.5-3.5"/>',calendar:'<rect x="3" y="5" width="18" height="16" rx="2"/><path d="M16 3v4M8 3v4M3 11h18"/>',clock:'<circle cx="12" cy="12" r="9"/><path d="M12 7v5l3 2"/>',link:'<path d="M10 13a5 5 0 0 0 7 0l3-3a5 5 0 0 0-7-7l-1.5 1.5"/><path d="M14 11a5 5 0 0 0-7 0l-3 3a5 5 0 0 0 7 7l1.5-1.5"/>',hash:'<path d="M4 9h16M4 15h16M10 3 8 21M16 3l-2 18"/>',palette:'<path d="M12 3a9 9 0 0 0 0 18h1.5a2.5 2.5 0 0 0 0-5H12a2 2 0 0 1 0-4h4a5 5 0 0 0 0-10Z"/><circle cx="8.5" cy="8.5" r="1"/><circle cx="8" cy="14" r="1"/>',sliders:'<path d="M4 7h16M4 17h16"/><circle cx="9" cy="7" r="2.5"/><circle cx="15" cy="17" r="2.5"/>',file:'<path d="M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z"/><path d="M14 3v5h5"/>',upload:'<path d="M12 16V4"/><path d="m7 9 5-5 5 5"/><path d="M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2"/>',eye:'<path d="M2 12s3.5-6 10-6 10 6 10 6-3.5 6-10 6-10-6-10-6Z"/><circle cx="12" cy="12" r="3"/>',"eye-off":'<path d="m3 3 18 18"/><path d="M10.6 6.2A9.9 9.9 0 0 1 12 6c6.5 0 10 6 10 6a17 17 0 0 1-3.1 3.6"/><path d="M6.4 6.7C3.5 8.4 2 12 2 12s3.5 6 10 6c1.7 0 3.2-.4 4.5-1"/><path d="M9.9 9.9a3 3 0 0 0 4.2 4.2"/>',check:'<path d="m4 12.5 5 5L20 6.5"/>',x:'<path d="M6 6l12 12M18 6 6 18"/>',plus:'<path d="M12 5v14M5 12h14"/>',minus:'<path d="M5 12h14"/>',"chevron-down":'<path d="m6 9 6 6 6-6"/>',"chevron-up":'<path d="m6 15 6-6 6 6"/>',"chevron-left":'<path d="m15 6-6 6 6 6"/>',"chevron-right":'<path d="m9 6 6 6-6 6"/>',alert:'<path d="M12 9v4"/><path d="M12 17h.01"/><path d="M10.3 3.9 2.6 17.4A2 2 0 0 0 4.3 20h15.4a2 2 0 0 0 1.7-2.6L13.7 3.9a2 2 0 0 0-3.4 0Z"/>',info:'<circle cx="12" cy="12" r="9"/><path d="M12 11v5"/><path d="M12 8h.01"/>',globe:'<circle cx="12" cy="12" r="9"/><path d="M3 12h18"/><path d="M12 3a15 15 0 0 1 0 18 15 15 0 0 1 0-18Z"/>',"map-pin":'<path d="M20 10c0 6-8 12-8 12S4 16 4 10a8 8 0 1 1 16 0Z"/><circle cx="12" cy="10" r="3"/>',image:'<rect x="3" y="3" width="18" height="18" rx="2"/><circle cx="8.5" cy="8.5" r="1.5"/><path d="m21 15-5-5L5 21"/>',refresh:'<path d="M20 11a8 8 0 0 0-14.9-3.9L3 10"/><path d="M3 5v5h5"/><path d="M4 13a8 8 0 0 0 14.9 3.9L21 14"/><path d="M21 19v-5h-5"/>',trash:'<path d="M4 7h16"/><path d="M9 7V4h6v3"/><path d="M6 7l1 13h10l1-13"/><path d="M10 11v5M14 11v5"/>'},O={};Object.keys(ot).forEach(function(t){O[t]=ot[t]});var Ut="http://www.w3.org/2000/svg",Vt={svg:1,g:1,path:1,circle:1,rect:1,line:1,polyline:1,polygon:1,ellipse:1,title:1,defs:1,clipPath:1,clippath:1,mask:1};function It(t){if(typeof t!="string"||!t.trim())return"";var e;try{if(typeof p.DOMParser=="undefined")return"";e=new p.DOMParser().parseFromString(t,"image/svg+xml")}catch{return""}if(!e||!e.documentElement)return"";var i=e.documentElement;if(String(i.nodeName).toLowerCase()!=="svg"||e.getElementsByTagName("parsererror").length)return"";var r=function(a){Array.prototype.slice.call(a.children||[]).forEach(function(n){var s=String(n.nodeName);if(s!==s.toLowerCase()&&(s=s.toLowerCase()),!Vt[s]){n.parentNode.removeChild(n);return}Array.prototype.slice.call(n.attributes||[]).forEach(function(o){var u=String(o.name).toLowerCase();u.indexOf("on")===0&&n.removeAttribute(o.name),(u==="href"||u==="xlink:href")&&!/^#/.test(o.value)&&n.removeAttribute(o.name),/url\s*\(\s*['"]?\s*(?:https?:|\/\/)/i.test(o.value)&&n.removeAttribute(o.name)}),r(n)})};return r(i),i.outerHTML}function j(t){var e=t;return/^\s*</.test(e)&&!/^\s*<svg/i.test(e)?e='<svg xmlns="'+Ut+'" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">'+e+"</svg>":/^\s*<svg/i.test(e)||(e=""),It(e)}function Nt(t,e){var i="",r="";if(typeof t=="string"&&t?(r=t,/^\s*</.test(t)?i=j(t)||j('<path d="M4 12h16"/>'):O[t]&&(i=j(O[t])||"")):t&&typeof t=="object"&&t.name&&(r=t.name,i=j(O[t.name]||"")),!i)return null;var a=l.createElement("span");e&&(a.className=e),a.setAttribute("data-zs-icon",r||"custom");try{a.innerHTML=i}catch{return null}var n=a.firstChild;return n&&(n.setAttribute("focusable","false"),n.setAttribute("aria-hidden","true"),n.setAttribute("width","18"),n.setAttribute("height","18")),a}var Pt={text:"text",email:"mail",password:"lock",number:"hash",tel:"phone",url:"link",search:"search",date:"calendar",time:"clock","datetime-local":"calendar",month:"calendar",week:"calendar",range:"sliders",color:"palette"};function Jt(t){return Pt[t]||""}function lt(t,e){return typeof ZidanSelect!="undefined"&&(!t||typeof e!="string")?ZidanSelect:(t&&typeof e=="string"&&(O[String(t)]=e),typeof ZidanSelect!="undefined"?ZidanSelect:h)}function C(t,e,i,r,a){if(e&&e[i]!==void 0&&e[i]!==null)return e[i];if(t&&r&&t.getAttribute){var n=t.getAttribute("data-zidan-"+r);if(n!==null&&n!=="")return n}return a}function P(t,e,i,r,a){if(e&&e[i]!==void 0&&e[i]!==null)return!!e[i];if(t&&r&&t.getAttribute){var n=t.getAttribute("data-zidan-"+r);if(n!==null)return kt(n,a)}return a}function Rt(t,e,i,r,a){var n=C(t,e,i,r,a);if(n==null||n==="")return a;var s=parseFloat(n);return isFinite(s)?s:a}function Qt(t,e,i,r,a){var n=C(t,e,i,r,null);return n==null||n===""?a:Array.isArray(n)?n.slice():String(n).split(",").map(function(s){return s.trim()}).filter(Boolean)}var M={required:"This field is required.",email:"Enter a valid email address.",url:"Enter a valid URL.",pattern:"The value does not match the expected format.",min:"Value must be at least {min}.",max:"Value must be at most {max}.",step:"Value must be a multiple of {step}.",minlength:"Use at least {minlength} characters.",maxlength:"Use at most {maxlength} characters.",badInput:"Enter a valid value.",phone:"Enter a valid phone number for {country}.",integer:"Enter a whole number.",date:"Enter a valid date.",weekend:"Weekends are not available \u2014 pick a weekday.",dateDisabled:"This date is not available.",fileType:"This file type is not allowed.",fileSize:"This file is too large.",fileCount:"Too many files.",pending:"Checking\u2026",generic:"Please check this field."};function Dt(t,e){if(!t||!t.validity||t.validity.valid)return"";var i=t.validity,r=e||M,a=String(t.type||"").toLowerCase(),n="",s={min:t.getAttribute("min"),max:t.getAttribute("max"),step:t.getAttribute("step")};return i.valueMissing?n="required":i.typeMismatch?n=a==="email"?"email":a==="url"?"url":"generic":i.patternMismatch?n="pattern":i.rangeUnderflow?n="min":i.rangeOverflow?n="max":i.stepMismatch?n="step":i.tooShort?(n="minlength",s.minlength=t.getAttribute("minlength")):i.tooLong?(n="maxlength",s.maxlength=t.getAttribute("maxlength")):(i.badInput||i.customError)&&(n="badInput"),n?N(r[n]||M[n]||r.generic,s):t.validationMessage||r.generic}var dt=["valueMissing","typeMismatch","patternMismatch","rangeUnderflow","rangeOverflow","stepMismatch","tooShort","tooLong","badInput","fileMissing"];function Bt(t){var e=t&&t.validity;if(!e)return!1;for(var i=0;i<dt.length;i+=1)if(e[dt[i]])return!0;return!1}function et(t,e){for(var i=t;i&&i.nodeType===1;){for(var r=0;r<e.length;r+=1){var a=i.getAttribute(e[r]);if(a)return a}i=i.parentElement}return""}function L(t,e,i){var r=String(t||"").toLowerCase();return e.indexOf(r)===-1?i:r}function $t(t){if(Array.isArray(t))return t.slice();if(typeof t=="string"){var e=t.trim();if(e.charAt(0)==="[")try{var i=JSON.parse(e);if(Array.isArray(i))return i}catch{}else if(e.indexOf(",")!==-1)return e.split(",").map(function(r){return Number(r.trim())}).filter(function(r){return isFinite(r)})}return t}function qt(t,e){var i=e||{},r=i.theme||et(t,["data-zidan-theme","data-zs-theme"]);!r&&l&&(r=l.documentElement.getAttribute("data-zs-theme")||"");var a=i.framework||et(t,["data-zidan-framework","data-zs-framework"]);!a&&l&&(a=l.documentElement.getAttribute("data-zs-framework")||"");var n=i.layout||et(t,["data-zidan-layout","data-zs-layout"]);return{theme:L(r,W,"default"),framework:L(a,H,"none"),layout:n?String(n).toLowerCase():""}}function te(t,e){var i=null;function r(){var a=arguments;clearTimeout(i),i=setTimeout(function(){i=null,t.apply(null,a)},e)}return r.cancel=function(){clearTimeout(i),i=null},r}var Ht=["valid","invalid"],ut=["default","switch","card","button","minimal"],ft=["ios","material","square","labeled","icon"],ct=["stacked","inline","card","button","tile"],R=["dropzone","button","avatar","gallery","compact"],ht=["default","gradient","stepped","minimal"],ee=["always","active","never"],ie=["top","bottom"];function re(t,e){var i="";return Array.prototype.slice.call(t.childNodes).forEach(function(r){r===e||r.nodeType!==3||(i+=r.nodeValue)}),i.replace(/\s+/g," ").trim()}function ae(t,e){return Array.prototype.slice.call(t.childNodes).forEach(function(i){i.nodeType===3&&i.nodeValue.trim()&&e.appendChild(i)}),e}function f(t,e,i){if(!l)throw new Error("ZidanForm requires a DOM environment.");if(!y(t))throw new Error("ZidanForm: target element not found.");this.el=t,this.kind=i,this.opts=e||{},this.opts.messages=Object.assign({},M,this.opts.messages||{}),this.id=t.id||(t.id=Tt("zf")),this.root=null,this.touched=!1,this.validation=null,this.errorMessage=null,this.errorEl=null,this.pending=!1,this._asyncToken=0,this._asyncController=null,this.destroyed=!1,this._listeners=[],this._cleanups=[],this._describedByBefore=[],this.formEl=t.form||(t.closest?t.closest("form"):null);var r=qt(t,this.opts);this.theme=r.theme,this.framework=r.framework,this.layout=this.opts.layout||r.layout}f.prototype.on=function(t,e,i,r){return!t||!t.addEventListener?this:(t.addEventListener(e,i,r),this._listeners.push([t,e,i,r]),this)},f.prototype.emit=function(t,e){if(!this.root)return this;var i=e||{};i.instance=this,i.kind=this.kind;try{this.root.dispatchEvent(new CustomEvent(Ft+t,{detail:i,bubbles:!0}))}catch{}return this},f.prototype.call=function(t,e){var i=this.opts[t];if(typeof i=="function")try{return i(e)}catch(r){this.emit("error",{error:r,callback:t})}},f.prototype._scope=function(t){var e=v("div","zs-field");return e.id=this.id+"-field",e.setAttribute("data-zs-kind",t),e.classList.add("zs-field--"+t),Lt(this.el)&&e.setAttribute("dir","rtl"),this._applyScope(e),this.root=e,e},f.prototype._applyScope=function(t){return t.setAttribute("data-zs-theme",this.theme),t.setAttribute("data-zs-framework",this.framework),this.layout&&t.setAttribute("data-zs-layout",this.layout),t},f.prototype.setTheme=function(t){return this.theme=L(t,W,this.theme),this.root&&this.root.setAttribute("data-zs-theme",this.theme),this},f.prototype.setFramework=function(t){return this.framework=L(t,H,this.framework),this.root&&this.root.setAttribute("data-zs-framework",this.framework),this},f.prototype.setLayout=function(t){return this.layout=L(t,J,this.layout||"stacked"),this.root&&this.root.setAttribute("data-zs-layout",this.layout),this},f.prototype.validationTargets=function(){return[this.el]},f.prototype._customError=function(){return""},f.prototype._messageFor=function(t){var e=Dt(t,this.opts.messages);return e||(t&&t.validationMessage?t.validationMessage:this.opts.messages.generic||M.generic)},f.prototype._nativeError=function(){for(var t=this.validationTargets(),e=0;e<t.length;e+=1){var i=t[e];if(Bt(i))return this._messageFor(i)}return""},f.prototype._asyncSignal=function(){return this._asyncController?this._asyncController.signal:void 0},f.prototype._asyncContext=function(){return{signal:this._asyncSignal(),field:this,instance:this}},f.prototype._setCustomValidity=function(){},f.prototype._abortAsync=function(){if(this._asyncToken+=1,this._asyncController){try{this._asyncController.abort()}catch{}this._asyncController=null}},f.prototype._evaluate=function(){this._abortAsync(),typeof AbortController!="undefined"&&(this._asyncController=new AbortController);var t=this._customError?this._customError():"";if(tt(t))return{pending:t};if(this._asyncController=null,t)return{error:typeof t=="string"?t:this.opts.messages.generic,custom:!0};var e=this._nativeError();return e?{error:e,custom:!1}:{}},f.prototype._applyValidity=function(t,e,i){return this._setCustomValidity(t&&i?t:""),t?(e?this.setError(t):this.setValidation("invalid",!0),this):(this.errorMessage&&this.setError(null),this.validation==="invalid"&&!this._presetValidation&&this.setValidation(null,!0),this)},f.prototype._setPending=function(t){return t=!!t,this.pending=t,this.root&&(this.root.classList.toggle("zs-field--pending",t),t?this.root.setAttribute("data-zs-validation","pending"):this.root.getAttribute("data-zs-validation")==="pending"&&this.root.removeAttribute("data-zs-validation")),this.validationTargets().forEach(function(e){!e||!e.setAttribute||(t?e.setAttribute("aria-busy","true"):e.removeAttribute("aria-busy"))},this),t?(this.errorMessage&&this.setError(null),this._setCustomValidity(this.opts.messages.pending||M.pending)):this._setCustomValidity(""),this},f.prototype._runAsync=function(t){var e=this;if(e.destroyed)return Promise.resolve(!1);var i=e._asyncToken;return e._setPending(!0),Promise.resolve(t).then(function(r){if(e.destroyed||i!==e._asyncToken)return!1;e._asyncController=null,e._setPending(!1);var a="";return r===!1?a=e.opts.messages.generic:typeof r=="string"?a=r:r instanceof Error&&(a=r.message||e.opts.messages.generic),e._applyValidity(a,e.touched||e.opts.alwaysValidate||!!a,!0),!a&&e.opts.showValidState&&e.setValidation("valid"),e.emit("async-validation",{valid:!a,message:a}),!a},function(r){if(e.destroyed||i!==e._asyncToken||r&&r.name==="AbortError")return!1;e._asyncController=null,e._setPending(!1);var a=r&&(r.message||r.error)||e.opts.messages.generic;return typeof a!="string"&&(a=e.opts.messages.generic),e._applyValidity(a,!0,!0),e.emit("async-validation",{valid:!1,message:a,error:r}),!1})},f.prototype.checkAsync=function(){var t=this._evaluate();return t.pending?this._runAsync(t.pending):Promise.resolve(!t.error)},f.prototype._trackDescribedBy=function(t){if(!(!t||!t.getAttribute)){for(var e=0;e<this._describedByBefore.length;e+=1)if(this._describedByBefore[e][0]===t)return;this._describedByBefore.push([t,t.getAttribute("aria-describedby")])}},f.prototype._addDescribedBy=function(t,e){if(!(!t||!t.getAttribute||!e)){this._trackDescribedBy(t);var i=(t.getAttribute("aria-describedby")||"").split(/\s+/).filter(Boolean);i.indexOf(e)===-1&&i.push(e),t.setAttribute("aria-describedby",i.join(" "))}},f.prototype._syncDescribedBy=function(){if(!(!this.el||!this.el.getAttribute)){var t=this.id+"-error",e=this.root&&this.root.querySelector?this.root.querySelector(".zs-field__hint[id]"):null,i=e?e.id:"",r=this.validationTargets();r.forEach(function(a){if(!(!a||!a.getAttribute)){this._trackDescribedBy(a);var n=(a.getAttribute("aria-describedby")||"").split(/\s+/).filter(Boolean),s=n.filter(function(o){return o!==t&&o!==i});i&&s.push(i),this.errorMessage&&s.push(t),s.length?a.setAttribute("aria-describedby",s.join(" ")):a.removeAttribute("aria-describedby")}},this)}},f.prototype._renderError=function(){this.root&&(this.errorEl||(this.errorEl=v("p","zs-field__error",{id:this.id+"-error",role:"status","aria-live":"polite"}),this.root.appendChild(this.errorEl)),this.errorEl.textContent=this.errorMessage||"",this.errorEl.hidden=!this.errorMessage,this._syncDescribedBy())},f.prototype.setError=function(t){this.errorMessage=t||null,this.errorMessage?this.validation="invalid":this.validation==="invalid"&&(this.validation=null);var e=!!this.errorMessage||this.validation==="invalid";return this.root&&(this.root.classList.toggle("zs-field--invalid",e),this.root.classList.toggle("zs-field--valid",this.validation==="valid"&&!this.errorMessage),e||this.validation?this.root.setAttribute("data-zs-validation",e?"invalid":this.validation):this.root.removeAttribute("data-zs-validation")),this._renderError(),this.validationTargets().forEach(function(i){!i||!i.setAttribute||(e?i.setAttribute("aria-invalid","true"):this.validation==="valid"?i.setAttribute("aria-invalid","false"):i.removeAttribute("aria-invalid"))},this),this.emit("validation",{state:e?"invalid":this.validation,message:this.errorMessage}),this.call("onValidation",{state:e?"invalid":this.validation,message:this.errorMessage,instance:this}),this},f.prototype.clearError=function(){return this.setError(null)},f.prototype._bindValidity=function(){var t=this;this.validationTargets().forEach(function(i){t.on(i,"invalid",function(){t.touched=!0;var r=t._evaluate();if(r.pending){t._runAsync(r.pending);return}r.error?t.setError(r.error):t.setValidation("invalid")}),t.on(i,"blur",function(){t.touched=!0,t._presetValidation=!1,t._mirrorValidity()}),t.on(i,"input",function(){t._presetValidation=!1,t._mirrorValidity()}),t.on(i,"change",function(){t._presetValidation=!1,t._mirrorValidity()})}),this.on(this.formEl,"reset",function(){p.setTimeout(function(){t.destroyed||(t._abortAsync(),t.touched=!1,t.errorMessage=null,t._setPending(!1),t.errorEl&&(t.errorEl.textContent="",t.errorEl.hidden=!0),t.setValidation(null),t.update())},0)});var e=this.opts.validation||this.el.getAttribute("data-zidan-validation")||this.el.getAttribute("data-zs-validation");(e==="valid"||e==="invalid")&&this.setValidation(e),this._syncDescribedBy()},f.prototype._mirrorValidity=function(){var t=this._evaluate();return t.pending?(this._runAsync(t.pending),this):(this.pending&&this._setPending(!1),this._applyValidity(t.error||"",this.touched||this.opts.alwaysValidate,t.custom),this)},f.prototype.validate=function(){this.touched=!0;var t=this._evaluate();return t.pending?this._runAsync(t.pending):(this.pending&&this._setPending(!1),t.error?(this._applyValidity(t.error,!0,t.custom),!1):(this._applyValidity("",!0,!1),this.opts.showValidState&&this.setValidation("valid"),!0))},f.prototype.setValidation=function(t,e){this.validation=Ht.indexOf(t)===-1?null:t,e||(this._presetValidation=this.validation==="invalid");var i=this.validation==="invalid"||!!this.errorMessage;return this.root&&(this.root.classList.toggle("zs-field--invalid",i),this.root.classList.toggle("zs-field--valid",this.validation==="valid"&&!this.errorMessage),i?this.root.setAttribute("data-zs-validation","invalid"):this.validation?this.root.setAttribute("data-zs-validation",this.validation):this.root.removeAttribute("data-zs-validation")),this.validationTargets().forEach(function(r){!r||!r.setAttribute||(i?r.setAttribute("aria-invalid","true"):this.validation==="valid"?r.setAttribute("aria-invalid","false"):r.removeAttribute("aria-invalid"))},this),this.emit("validation",{state:i?"invalid":this.validation,message:this.errorMessage}),this.call("onValidation",{state:i?"invalid":this.validation,message:this.errorMessage,instance:this}),this},f.prototype.getValidation=function(){return this.validation},f.prototype.isPending=function(){return this.pending},f.prototype.getValue=function(){var t=this.el;return t?this.kind==="file"?this.getFiles?this.getFiles():Array.prototype.slice.call(t.files||[]):t.type==="checkbox"?!!t.checked:t.multiple&&t.options?Array.prototype.filter.call(t.options,function(e){return e.selected}).map(function(e){return e.value}):t.value:null},f.prototype.setValue=function(t){var e=this.el;if(!e)return this;if(this.kind==="file"){var i=t==null?[]:Array.isArray(t)?t:[t];return i.length?(this.addFiles&&this.addFiles(i),this):this.clear?this.clear():this}if(e.type==="checkbox")return this.setChecked?this.setChecked(!!t):(e.checked=!!t,e.dispatchEvent(new Event("change",{bubbles:!0})),this.update());if(e.multiple&&e.options){var r=(Array.isArray(t)?t:[t]).map(String);Array.prototype.forEach.call(e.options,function(a){a.selected=r.indexOf(a.value)!==-1})}else e.value=t==null?"":String(t);return e.dispatchEvent(new Event("change",{bubbles:!0})),this.update()},f.prototype.update=function(){return this._sync&&this._sync(),this._mirrorValidity(),this},f.prototype.refresh=function(){return this.update()},f.prototype.destroy=function(){return this.destroyed?this:(this.destroyed=!0,this._abortAsync(),this._listeners.forEach(function(t){t[0].removeEventListener(t[1],t[2],t[3])}),this._listeners.length=0,this._teardown&&this._teardown(),this._cleanups.forEach(function(t){t()}),this._cleanups.length=0,this.emit("destroy",{}),this.root&&this.root!==this.el&&this.root.parentNode&&this.root.parentNode.removeChild(this.root),this._describedByBefore.forEach(function(t){var e=t[0];!e||!e.getAttribute||(t[1]===null||t[1]===void 0?e.removeAttribute("aria-describedby"):e.setAttribute("aria-describedby",t[1]))}),this._describedByBefore=[],this.el.__zidanField===this&&delete this.el.__zidanField,h._unregister(this),this)};function G(t){return!t&&t!==0?"":t<1024?t+" B":t<1024*1024?(t/1024).toFixed(t<10240?1:0)+" KB":(t/(1024*1024)).toFixed(1)+" MB"}function pt(t){var e=/\.([a-z0-9]+)$/i.exec(String(t||""));return e?"."+e[1].toLowerCase():""}function jt(t,e){return e?String(e).split(",").some(function(i){var r=i.trim().toLowerCase();return r?r.indexOf(".")===0?pt(t.name)===r:r.indexOf("/*")!==-1?String(t.type).toLowerCase().indexOf(r.split("/")[0]+"/")===0:String(t.type).toLowerCase()===r:!1}):!0}function w(t){return[t.name,t.size,t.lastModified||0,t.type||""].join("|")}function Gt(t,e){return t&&typeof t=="string"?t:t&&t.message?t.message:t&&t.status?"Upload failed (HTTP "+t.status+").":e||"Upload failed."}function d(t,e){if(!(this instanceof d))return new d(t,e);if(!/^file$/i.test(t.type))throw new Error('ZidanFileUpload: expected an <input type="file">.');f.call(this,t,e,"file");var i=this,r=t,a=this.opts,n=L(C(r,a,"fileVariant","file-variant",C(r,a,"variant","variant","dropzone")),R,"dropzone"),s=r.parentNode,o=this._scope("file");o.setAttribute("data-zs-file-variant",n),s.insertBefore(o,r);var u=v("label","zs-file-drop zs-file-drop--"+n);u.setAttribute("for",this.id);var _=v("span","zs-file-avatar",{hidden:!0}),E=l.createElement("img");E.alt="",_.appendChild(E);var z=v("span","zs-file-icon",{"aria-hidden":"true"}),c=C(r,a,"uploadIcon","upload-icon",C(r,a,"icon","icon","upload")),D=Nt(c,"zs-file-icon-svg");D&&z.appendChild(D);var X=a.title||r.getAttribute("data-zidan-title")||(n==="avatar"?"Upload an image":n==="gallery"?"Add images":"Choose a file"),S=v("span","zs-file-drop-title",null,X),b=v("span","zs-file-drop-hint",null,a.dropHint||r.getAttribute("data-zidan-drop-hint")||(r.multiple?"or drop files here \u2014 multiple allowed":"or drop it here"));u.appendChild(_),u.appendChild(z),u.appendChild(S),u.appendChild(b),u.appendChild(r),o.appendChild(u);var k=v("ul","zs-file-list");o.appendChild(k);var x=v("div","zs-file-meta-row"),B=v("span","zs-file-status",{role:"status","aria-live":"polite"}),F=v("button","zs-file-clear",{type:"button"});F.textContent=a.clearLabel||"Clear all",F.hidden=!0,x.appendChild(B),x.appendChild(F),o.appendChild(x);var q=a.accept||r.accept;q&&(b.textContent=b.textContent+" \xB7 "+q),this.variant=n,this.drop=u,this.list=k,this.status=B,this.clearBtn=F,this.titleEl=S,this.hintEl=b,this._fallbackTitle=X,this.avatarEl=_,this.avatarImg=E,this.uploadHandler=typeof a.upload=="function"?a.upload:typeof a.uploadHandler=="function"?a.uploadHandler:null,this.uploadUrl=C(r,a,"uploadUrl","upload-url",""),this.uploadField=C(r,a,"uploadField","upload-field","file"),this.withCredentials=P(r,a,"withCredentials","with-credentials",!1),this.uploadHeaders=a.uploadHeaders||a.headers||null,this.simulateUpload=P(r,a,"simulateUpload","simulate-upload",!1),this.simulateDuration=Math.max(120,Rt(r,a,"simulateDuration","simulate-duration",900)),this.autoUpload=P(r,a,"autoUpload","auto-upload",!0),this.showFileMeta=P(r,a,"showFileMeta","show-file-meta",!0),this.showPreview=P(r,a,"showPreview","preview",!0),this.hasUploader=!!(this.uploadHandler||this.uploadUrl||this.simulateUpload),o.setAttribute("data-zs-upload",this.hasUploader?"true":"false"),this._uploads=Object.create(null),this._active=Object.create(null),this._urls=[],this._renderQueued=!1,this.fileError="",this._restoreInput=function(){var m=o.parentNode||s;m.insertBefore(r,o.parentNode?o:null),r.classList.remove("zs-native-input","zs-file-input")},st(r,"zs-native-input"),st(r,"zs-file-input"),this.on(r,"change",function(){var m=i._validate();i._render(),i.emit("change",{files:i.getFiles()}),i.call("onChange",{files:i.getFiles(),instance:i}),m&&i.autoUpload&&i.hasUploader&&i.uploadAll()});var Z=0;["dragenter","dragover"].forEach(function(m){i.on(u,m,function(A){A.preventDefault(),m==="dragenter"&&(Z+=1),u.classList.add("zs-file-drop--over")})}),i.on(u,"dragleave",function(){Z=Math.max(0,Z-1),Z||u.classList.remove("zs-file-drop--over")}),i.on(u,"drop",function(m){if(m.preventDefault(),Z=0,u.classList.remove("zs-file-drop--over"),!(!m.dataTransfer||!m.dataTransfer.files||!m.dataTransfer.files.length)){var A=Array.prototype.slice.call(m.dataTransfer.files);r.multiple||(A=A.slice(0,1)),i.addFiles(A)}}),i.on(F,"click",function(){i.clear()}),i.on(k,"click",function(m){var A=m.target&&m.target.closest?m.target.closest("button"):null;if(!(!A||!k.contains(A))){var Et=A.closest(".zs-file-item"),St=Et?parseInt(Et.getAttribute("data-zs-file-index"),10):-1,K=St>=0?i.getFiles()[St]:null;K&&(m.preventDefault(),m.stopPropagation(),A.classList.contains("zs-file-cancel")?i.cancelUpload(K):A.classList.contains("zs-file-retry")?i.retryUpload(K):A.classList.contains("zs-file-remove")&&i.removeFile(K))}}),this._bindValidity(),this.on(this.formEl,"reset",function(){p.setTimeout(function(){i.destroyed||(i.cancelAll(),i._uploads=Object.create(null),i.fileError="",r.setCustomValidity&&r.setCustomValidity(""),i._render())},0)}),r.__zidanField=this,this._render(),this.emit("init",{}),h._register(this)}d.prototype=Object.create(f.prototype),d.prototype.constructor=d,d.prototype.getFiles=function(){return this.el.files?Array.prototype.slice.call(this.el.files):[]},d.prototype.getUploadState=function(){var t=this;return this.getFiles().map(function(e){var i=t._stateFor(e,!1)||{status:"idle",progress:0,error:"",result:null};return{file:e,name:e.name,size:e.size,status:i.status,progress:i.progress,error:i.error,result:i.result}})},d.prototype._stateFor=function(t,e){var i=w(t),r=this._uploads[i];return!r&&e&&(r=this._uploads[i]={status:"idle",progress:0,error:"",result:null}),r},d.prototype._setFiles=function(t){try{var e=typeof DataTransfer!="undefined"?DataTransfer:p.DataTransfer;if(!e)return!1;var i=new e;return t.forEach(function(r){i.items.add(r)}),this.el.files=i.files,!0}catch{return!1}},d.prototype._applyFiles=function(t,e){if(!this._setFiles(t))return this.emit("error",{error:new Error("This browser cannot assign files programmatically."),action:"setFiles"}),this;if(e)try{this.el.dispatchEvent(new Event("change",{bubbles:!0}))}catch{}else this._validate(),this._render();return this},d.prototype.addFiles=function(t){var e=t&&t.length!==void 0?Array.prototype.slice.call(t):$(t);if(!e.length)return this;var i=this.el.multiple?this.getFiles():[],r=Object.create(null),a=i.concat(e).filter(function(n){var s=w(n);return r[s]?!1:(r[s]=!0,!0)});if(this.el.multiple||(a=a.slice(0,1)),!this._setFiles(a))return this.emit("error",{error:new Error("This browser cannot assign files programmatically."),action:"addFiles"}),this;try{this.el.dispatchEvent(new Event("change",{bubbles:!0}))}catch{}return this},d.prototype.replaceFiles=function(t){return this._applyFiles(t&&t.length!==void 0?Array.prototype.slice.call(t):$(t),!0)},d.prototype.removeFile=function(t){var e=this.getFiles(),i=typeof t=="number"?t:e.indexOf(t);if(i===-1||!e[i])return this;var r=e[i];this.cancelUpload(r),delete this._uploads[w(r)];var a=e.slice();return a.splice(i,1),this._setFiles(a),this._validate(),this._render(),this.emit("change",{files:a}),this.emit("remove",{file:r,index:i}),this.call("onChange",{files:a,instance:this}),this.call("onRemove",{file:r,index:i,instance:this}),this},d.prototype.clear=function(){return this.cancelAll(),this._uploads=Object.create(null),this.fileError="",this.el.value="",this.el.setCustomValidity&&this.el.setCustomValidity(""),this._validate(),this._render(),this.emit("change",{files:[]}),this.emit("clear",{}),this.call("onChange",{files:[],instance:this}),this},d.prototype._limits=function(){var t=this.el,e=this.opts,i=parseInt(e.maxFiles||t.getAttribute("data-zidan-max-files"),10),r=parseInt(e.maxSize||t.getAttribute("data-zidan-max-size"),10);if(!(r>0)){var a=e.maxSizeMB;if((a==null||a==="")&&(a=t.getAttribute("data-zidan-max-size-mb")),a!=null&&a!==""){var n=parseFloat(a);n>0&&(r=Math.round(n*1024*1024))}}return{maxFiles:i>0?i:0,maxSize:r>0?r:0,accept:e.accept||t.accept||""}},d.prototype._setCustomValidity=function(t){this.el&&this.el.setCustomValidity&&this.el.setCustomValidity(t||"")},d.prototype._customError=function(){if(this.fileError)return this.fileError;if(typeof this.opts.validate=="function"){var t=this.opts.validate(this.getFiles(),this,this._asyncContext());if(t===!1)return this.opts.messages.generic;if(typeof t=="string"&&t||tt(t))return t}return""},d.prototype._validate=function(){var t=this.el,e=this.opts.messages,i=this._limits(),r=this.getFiles(),a="";if(i.maxFiles&&r.length>i.maxFiles&&(a=N(e.fileCount,{max:i.maxFiles}),r=r.slice(0,i.maxFiles),this._setFiles(r)),!a&&i.maxSize){for(var n=0;n<r.length;n+=1)if(r[n].size>i.maxSize){a=N(e.fileSize,{name:r[n].name,size:G(r[n].size),limit:G(i.maxSize)});break}}if(!a&&i.accept){for(var s=0;s<r.length;s+=1)if(!jt(r[s],i.accept)){a=N(e.fileType,{name:r[s].name,accept:i.accept});break}}this.fileError=a,t.setCustomValidity&&t.setCustomValidity(this.pending?e.pending||M.pending:a||"");var o=a||this._nativeError();return o?this.setError(o):this.errorMessage&&this.setError(null),this.root.classList.toggle("zs-field--filled",r.length>0),this.drop.classList.toggle("zs-file-drop--invalid",!!o),this._renderStatus(),!o},d.prototype._sync=function(){this._render()},d.prototype._queueRender=function(){var t=this;if(!(this._renderQueued||this.destroyed)){this._renderQueued=!0;var e=function(){t._renderQueued=!1,t.destroyed||t._render()};p.requestAnimationFrame?p.requestAnimationFrame(e):p.setTimeout(e,32)}},d.prototype._renderStatus=function(){var t=this.getFiles(),e=this.getUploadState(),i=t.reduce(function(u,_){return u+_.size},0),r=e.filter(function(u){return u.status==="uploading"}),a=e.filter(function(u){return u.status==="error"}),n=e.filter(function(u){return u.status==="done"}),s="";if(this.fileError)s=this.fileError;else if(t.length)if(s=t.length+(t.length===1?" file selected":" files selected")+" \xB7 "+G(i),r.length){var o=Math.round(r.reduce(function(u,_){return u+_.progress},0)/r.length);s+=" \xB7 Uploading "+o+"%"}else a.length?s+=" \xB7 "+a.length+" failed":n.length===t.length&&this.hasUploader&&(s+=" \xB7 Uploaded");this.status.textContent=s,this.status.classList.toggle("zs-file-status--error",!!this.fileError),this.status.classList.toggle("zs-file-status--success",!this.fileError&&t.length>0&&n.length===t.length&&this.hasUploader)},d.prototype._render=function(){var t=this,e=this.getFiles(),i=this.opts;this.list.textContent="",this._revokeLater(this._urls),this._urls=[],this.list.hidden=e.length===0,this.clearBtn.hidden=e.length===0,this.root.classList.toggle("zs-field--filled",e.length>0),this.drop.classList.toggle("zs-file-drop--has-files",e.length>0);var r=this.showPreview?e.filter(function(n){return/^image\//.test(n.type)})[0]:null;if(r){var a=URL.createObjectURL(r);this._urls.push(a),this.avatarImg.src=a,this.avatarEl.hidden=!1,this.drop.classList.add("zs-file-drop--has-preview"),this.titleEl.textContent=i.replaceTitle||"Change image"}else this.avatarImg.removeAttribute("src"),this.avatarEl.hidden=!0,this.drop.classList.remove("zs-file-drop--has-preview"),this.titleEl.textContent=this._fallbackTitle;e.forEach(function(n,s){var o=t._stateFor(n,!1)||{status:"idle",progress:0,error:"",result:null},u=v("li","zs-file-item");u.setAttribute("data-zs-upload-state",o.status),u.setAttribute("data-zs-file-index",String(s));var _=v("span","zs-file-thumb");if(/^image\//.test(n.type)){var E=URL.createObjectURL(n);t._urls.push(E);var z=l.createElement("img");z.src=E,z.alt="",_.appendChild(z)}else _.textContent=(pt(n.name)||"file").replace(".","").slice(0,4).toUpperCase();var c=v("span","zs-file-info"),D=v("span","zs-file-name",null,n.name);if(c.appendChild(D),t.showFileMeta){var X=G(n.size)+(n.type?" \xB7 "+n.type:"");c.appendChild(v("span","zs-file-size",null,X))}if(t.hasUploader){var S=v("span","zs-file-upload-state");if(o.status==="uploading"){S.textContent=N(i.progressTemplate||"Uploading {percent}%",{percent:o.progress});var b=v("span","zs-file-progress");b.setAttribute("role","progressbar"),b.setAttribute("aria-valuemin","0"),b.setAttribute("aria-valuemax","100"),b.setAttribute("aria-valuenow",String(o.progress)),b.setAttribute("aria-label","Upload progress for "+n.name);var k=v("span","zs-file-progress-bar");k.style.width=o.progress+"%",b.appendChild(k),S.appendChild(b)}else o.status==="done"?S.textContent=i.uploadedLabel||"Uploaded":o.status==="error"?S.textContent=(i.failedLabel||"Upload failed")+(o.error?" \u2014 "+o.error:""):o.status==="canceled"&&(S.textContent=i.canceledLabel||"Upload canceled");S.textContent&&c.appendChild(S)}var x=v("span","zs-file-actions");if(o.status==="uploading"){var B=v("button","zs-file-cancel",{type:"button","aria-label":"Cancel upload of "+n.name});B.textContent=i.cancelLabel||"Cancel",x.appendChild(B)}else if(o.status==="error"||o.status==="canceled"){var F=v("button","zs-file-retry",{type:"button","aria-label":"Retry upload of "+n.name});F.textContent=i.retryLabel||"Retry",x.appendChild(F)}var q=v("button","zs-file-remove",{type:"button","aria-label":"Remove "+n.name});if(q.textContent="\xD7",x.appendChild(q),u.appendChild(_),u.appendChild(c),u.appendChild(x),t.list.appendChild(u),typeof i.renderFile=="function")try{i.renderFile(u,{file:n,index:s,state:o,field:t})}catch(Z){t.emit("error",{error:Z,callback:"renderFile"})}}),this._renderStatus()},d.prototype.setVariant=function(t){var e=L(t,R,this.variant);return e===this.variant?this:(this.variant=e,R.forEach(function(i){this.drop.classList.remove("zs-file-drop--"+i)},this),this.drop.classList.add("zs-file-drop--"+e),this.root.setAttribute("data-zs-file-variant",e),this._render(),this)},d.prototype.setUploader=function(t){return typeof t=="function"?(this.uploadHandler=t,this.uploadUrl=""):(this.uploadHandler=null,this.uploadUrl=t?String(t):""),this.hasUploader=!!(this.uploadHandler||this.uploadUrl||this.simulateUpload),this.root.setAttribute("data-zs-upload",this.hasUploader?"true":"false"),this._render(),this},d.prototype._formData=function(t){var e=new FormData;e.append(this.uploadField,t,t.name);var i=typeof this.opts.uploadData=="function"?this.opts.uploadData(t,this):this.opts.uploadData;return i&&typeof i=="object"&&Object.keys(i).forEach(function(r){var a=i[r];a!=null&&e.append(r,a)}),e},d.prototype.uploadAll=function(){var t=this;if(!this.hasUploader)return this;if(!this._validate())return this;var e=this.validate();return tt(e)?e.then(function(i){return i&&!t.destroyed&&t.getFiles().forEach(function(r){t.uploadFile(r)}),i}):e?(this.getFiles().forEach(function(i){t.uploadFile(i)}),this):this},d.prototype.uploadFile=function(t){var e=this,i=w(t),r=this._stateFor(t,!0);if(r.status==="uploading"||r.status==="done")return this;if(r.status="uploading",r.progress=0,r.error="",r.result=null,this._queueRender(),this.emit("upload-start",{file:t,name:t.name,size:t.size}),this.call("onUploadStart",{file:t,name:t.name,size:t.size,instance:this}),this.uploadHandler){var a=typeof AbortController!="undefined"?new AbortController:null;this._active[i]={type:"handler",abort:function(){a&&a.abort()}};var n={file:t,field:this,formData:this._formData(t),signal:a?a.signal:null,onProgress:function(c){e._setProgress(t,c)},complete:function(c){e._finish(t,c)},fail:function(c){e._fail(t,c)}},s;try{s=this.uploadHandler(t,n)}catch(c){return this._fail(t,c),this}return s&&typeof s.then=="function"?s.then(function(c){e._finish(t,c)},function(c){c&&(c.name==="AbortError"||c.aborted)?e._canceledUpload(t):e._fail(t,c)}):s!==void 0&&this._finish(t,s),this}if(this.uploadUrl){var o=new p.XMLHttpRequest;this._active[i]={type:"xhr",abort:function(){try{o.abort()}catch{}}},o.open("POST",this.uploadUrl,!0),this.withCredentials&&(o.withCredentials=!0);var u=typeof this.uploadHeaders=="function"?this.uploadHeaders(t,this):this.uploadHeaders;return u&&typeof u=="object"&&Object.keys(u).forEach(function(c){o.setRequestHeader(c,u[c])}),o.upload.onprogress=function(c){c.lengthComputable&&e._setProgress(t,Math.min(99,Math.round(c.loaded/c.total*100)))},o.onload=function(){if(o.status>=200&&o.status<300){var c=o.responseText;try{c=JSON.parse(c)}catch{}e._finish(t,c)}else e._fail(t,{status:o.status,message:"Upload failed (HTTP "+o.status+")."})},o.onerror=function(){e._fail(t,{message:"Network error while uploading."})},o.onabort=function(){e._canceledUpload(t)},o.send(this._formData(t)),this}if(this.simulateUpload){var _=Date.now(),E=null,z=function(){if(!(!e._uploads[i]||r.status!=="uploading")){var c=Math.min(99,Math.round((Date.now()-_)/e.simulateDuration*100));e._setProgress(t,c),c>=99?(delete e._active[i],e._finish(t,{simulated:!0})):E=p.setTimeout(z,40)}};return this._active[i]={type:"simulation",abort:function(){E&&p.clearTimeout(E)}},E=p.setTimeout(z,40),this}return r.status="idle",this._queueRender(),this},d.prototype._setProgress=function(t,e){var i=this._stateFor(t,!1);if(!(!i||i.status!=="uploading")){var r=Ot(Math.round(Number(e)||0),0,99);r!==i.progress&&(i.progress=r,this._queueRender(),this.emit("upload-progress",{file:t,progress:r,name:t.name}),this.call("onUploadProgress",{file:t,progress:r,name:t.name,instance:this}))}},d.prototype._finish=function(t,e){var i=this._stateFor(t,!1);!i||i.status!=="uploading"||(delete this._active[w(t)],i.status="done",i.progress=100,i.result=e===void 0?null:e,this._queueRender(),this.emit("upload-success",{file:t,name:t.name,result:i.result}),this.call("onUploadSuccess",{file:t,name:t.name,result:i.result,instance:this}),this.call("onUpload",{file:t,name:t.name,result:i.result,instance:this}))},d.prototype._fail=function(t,e){var i=this._stateFor(t,!1);!i||i.status!=="uploading"||(delete this._active[w(t)],i.status="error",i.error=Gt(e,this.opts.messages.upload||"Upload failed."),this._queueRender(),this.emit("upload-error",{file:t,name:t.name,error:e,message:i.error}),this.call("onUploadError",{file:t,name:t.name,error:e,message:i.error,instance:this}))},d.prototype._canceledUpload=function(t){var e=this._stateFor(t,!1);!e||e.status!=="uploading"||(delete this._active[w(t)],e.status="canceled",e.progress=0,e.error="",this._queueRender(),this.emit("upload-cancel",{file:t,name:t.name}),this.call("onUploadCancel",{file:t,name:t.name,instance:this}))},d.prototype.cancelUpload=function(t){var e=w(t),i=this._active[e];if(i){try{i.abort()}catch{}delete this._active[e]}return this._canceledUpload(t),this},d.prototype.cancelAll=function(){var t=this;return Object.keys(this._active).forEach(function(e){try{t._active[e].abort()}catch{}delete t._active[e]}),this},d.prototype.retryUpload=function(t){var e=this._stateFor(t,!1);return e?(e.status="idle",e.progress=0,e.error="",this.uploadFile(t)):this},d.prototype._revokeLater=function(t){!t||!t.length||p.setTimeout(function(){t.forEach(function(e){try{URL.revokeObjectURL(e)}catch{}})},800)},d.prototype._teardown=function(){this.cancelAll(),this._uploads=Object.create(null),this._revokeLater(this._urls),this._urls=[],this._restoreInput&&this._restoreInput()};function U(t){if(!y(t))return null;var e=String(t.getAttribute("data-zidan")||"").toLowerCase();if(Ct.indexOf(e)!==-1)return e;if(t.hasAttribute("data-zidan-radio-group"))return"radio-group";if(t.hasAttribute("data-zidan-radio"))return"radio";if(t.hasAttribute("data-zidan-checkbox")||t.hasAttribute("data-zidan-switch"))return"checkbox";if(t.hasAttribute("data-zidan-file"))return"file";if(t.hasAttribute("data-zidan-textarea"))return"textarea";if(t.hasAttribute("data-zidan-input"))return"input";var i=String(t.type||"").toLowerCase();if(i==="checkbox")return"checkbox";if(i==="radio")return"radio";if(i==="file")return"file";if(Mt(t,"zidan-field")){if(t.tagName==="FIELDSET")return t.querySelector('input[type="radio"]')?"radio-group":null;if(t.tagName==="TEXTAREA")return"textarea";if(t.tagName!=="INPUT"||i==="radio")return null;if(typeof TEXT_TYPES!="undefined"&&TEXT_TYPES.indexOf(i)!==-1)return"input"}return null}function Y(t,e,i){var r=I(Zt(t),i);if(t.__zidanField&&!r.force)return t.__zidanField;switch(e){case"checkbox":return typeof ZidanCheckbox!="undefined"?new ZidanCheckbox(t,r):null;case"radio":case"radio-group":return typeof ZidanRadioGroup!="undefined"?new ZidanRadioGroup(t,r):null;case"file":return typeof d!="undefined"?new d(t,r):null;case"input":case"textarea":return typeof ZidanTextField!="undefined"?new ZidanTextField(t,r):null;default:return null}}function vt(t,e){var i=[];typeof t=="string"?i=Array.prototype.slice.call(l.querySelectorAll(t)):y(t)?i=[t]:t&&typeof t.length=="number"&&(i=Array.prototype.slice.call(t));var r=[];return i.forEach(function(a){if(!a.__zidanField){var n=U(a)||_t(a);if(n){if(n==="radio"||n==="radio-group"){if(/^INPUT$/i.test(a.tagName)&&(a=a.closest?a.closest("fieldset, [data-zidan-radio-group]"):null,!a))return;n="radio-group"}var s=Y(a,n,e||{});s&&r.push(s)}}}),r.length===1?r[0]:r}function mt(t,e){var i=[];return t.forEach(function(r){if(!(!y(r)||r.__zidanField)){var a=U(r);if(a){if(a==="radio"||a==="radio-group"){if(/^INPUT$/i.test(r.tagName)&&(r=r.closest?r.closest("fieldset, [data-zidan-radio-group]"):null,!r))return;a="radio-group"}var n=Y(r,a,e||{});n&&i.push(n)}}}),i}function V(t,e){var i=t||l;if(!i||!i.querySelectorAll)return[];var r=Array.prototype.slice.call(i.querySelectorAll(at));return y(i)&&i.matches&&i.matches(at)&&r.unshift(i),mt(r,e)}var h={version:T,__zidanFormGuard:T,themes:W,frameworks:H.slice(),fieldLayouts:J,fields:[],_register:function(t){h.fields.indexOf(t)===-1&&h.fields.push(t)},_unregister:function(t){var e=h.fields.indexOf(t);e!==-1&&h.fields.splice(e,1)},get:function(t){var e=typeof t=="string"?l.querySelector(t):t;return y(e)&&e.__zidanField||null},init:function(t,e){return V(t||l,e||{})},field:vt,refresh:function(t){return V(t||l,{}),h.fields.slice().forEach(function(e){e.update()}),h.fields.slice()},destroyAll:function(){return h.fields.slice().forEach(function(t){t.destroy()}),h.fields=[],typeof ZidanSelect!="undefined"&&ZidanSelect.destroyAll&&ZidanSelect.destroyAll(),h},observe:function(t,e){var i=t||l.body;if(!i||!p.MutationObserver)return null;var r=new p.MutationObserver(function(a){a.forEach(function(n){Array.prototype.slice.call(n.addedNodes).forEach(function(s){y(s)&&(U(s)&&Y(s,U(s)==="radio"?"radio-group":U(s),e||{}),s.querySelectorAll&&V(s,e||{}))})}),h.fields.slice().forEach(function(n){n.el.isConnected||n.destroy()}),typeof ZidanSelect!="undefined"&&ZidanSelect.instances.slice().forEach(function(n){n.el.isConnected||n.destroy()})});return r.observe(i,{childList:!0,subtree:!0}),r}};h.api=null,h.registerIcon=lt,h.icons=O,typeof PHONE_COUNTRIES!="undefined"&&(h.phoneCountries=PHONE_COUNTRIES,h.phoneFormats=PHONE_FORMATS.slice(),h.formatPhone=formatPhone,h.detectPhoneCountry=detectPhoneCountry),h.messages=M,h.variants={},typeof ut!="undefined"&&(h.variants.checkbox=ut.slice()),typeof ft!="undefined"&&(h.variants.switch=ft.slice()),typeof ct!="undefined"&&(h.variants.radio=ct.slice()),typeof R!="undefined"&&(h.variants.file=R.slice()),typeof ht!="undefined"&&(h.variants.range=ht.slice()),typeof STEPPER_MODES!="undefined"&&(h.stepperModes=STEPPER_MODES.slice()),h.fieldLayouts=J.slice(),typeof ZidanSelect!="undefined"&&(ZidanSelect.version=T,ZidanSelect.__zidanSelectGuard=T,ZidanSelect.layouts=zt.slice(),ZidanSelect.frameworks=H.slice(),ZidanSelect.scrollbars=xt.slice(),ZidanSelect.defaults=DEFAULTS,ZidanSelect.cacheLimit=50,ZidanSelect.get=function(t){var e=typeof t=="string"?l.querySelector(t):t;return y(e)&&e.__zidanSelect||null},ZidanSelect.instances=[],ZidanSelect.destroyAll=function(){ZidanSelect.instances.slice().forEach(function(t){t.destroy()}),ZidanSelect.instances=[]});function Yt(t,e){var i=[];typeof t=="string"?i=Array.prototype.slice.call(l.querySelectorAll(t)):t&&typeof t.length=="number"&&!y(t)&&t!==p?i=Array.prototype.slice.call(t):y(t)&&(i=[t]);var r=i.map(function(a){var n=new ZidanSelect(a,e||{});return ZidanSelect.instances.push(n),n});return r.length===1?r[0]:r}function it(t,e){return t.filter(function(i){return y(i)&&!i.__zidanSelect}).map(function(i){return ZidanSelect.instances.push(new ZidanSelect(i,e||{})),i.__zidanSelect})}function yt(t,e){var i=t||l;if(!i||!i.querySelectorAll)return[];var r=Array.prototype.slice.call(i.querySelectorAll(Q));return y(i)&&i.matches&&i.matches(Q)&&r.unshift(i),it(r,e)}function rt(t,e){$(t).forEach(function(i){i&&(typeof i=="string"?e(i,null):i.selector&&e(String(i.selector),i.options||null))})}function gt(t,e){rt(t,function(i,r){it(Array.prototype.slice.call(l.querySelectorAll(i)),I(e,r))})}function Xt(t,e){rt(t,function(i,r){var a=I(e,r);Array.prototype.slice.call(l.querySelectorAll(i)).forEach(function(n){if(!(!y(n)||n.__zidanField)){var s=U(n)||_t(n);s&&(s==="radio"&&(s="radio-group"),Y(n,s,a))}})})}function _t(t){return typeof TEXT_TYPES=="undefined"||!y(t)?null:t.tagName==="TEXTAREA"?"textarea":t.tagName!=="INPUT"?null:TEXT_TYPES.indexOf(String(t.type).toLowerCase())!==-1?"input":null}function Kt(t,e){if(typeof ZidanSelect=="undefined")return[];var i=Q+", select",r=Array.prototype.slice.call(t.querySelectorAll(i));return y(t)&&t.matches&&t.matches(i)&&r.unshift(t),it(r,e)}function bt(t,e,i){y(t)&&(Kt(t,e),typeof d!="undefined"&&mt(Array.prototype.slice.call(t.querySelectorAll('input[type="file"]')),i),(typeof ZidanCheckbox!="undefined"||typeof ZidanRadioGroup!="undefined"||typeof d!="undefined"||typeof ZidanTextField!="undefined")&&V(t,i))}function Wt(t,e,i){Array.prototype.slice.call(l.querySelectorAll(wt)).forEach(function(r){bt(r,e,i)}),rt(t,function(r,a){Array.prototype.slice.call(l.querySelectorAll(r)).forEach(function(n){bt(n,I(e,a),I(i,a))})})}function At(){if(l){var t=p.ZIDAN_FORM_CONFIG||p.ZIDAN_SELECT_CONFIG||{};if(t.autoInit!==!1&&!(p.ZidanSelect&&p.ZidanSelect.autoInit===!1)&&l.documentElement.getAttribute("data-zidan-auto-init")!=="false"){var e=typeof ZidanSelect!="undefined",i=typeof ZidanCheckbox!="undefined"||typeof ZidanRadioGroup!="undefined"||typeof d!="undefined"||typeof ZidanTextField!="undefined",r=t.options||{},a=t.fieldOptions||t.fields||{};e&&(t.selector?gt(t.selector,r):gt(t.targets||t.selectors,r)),i&&Xt(t.fieldTargets,a),Wt(t.formTargets,r,a),e&&!t.selector&&yt(l,r),i&&V(l,a)}}}l&&(l.readyState==="loading"?l.addEventListener("DOMContentLoaded",At):setTimeout(At,0));var g={ZidanForm:h,registerIcon:lt};return typeof ZidanSelect!="undefined"&&(g.ZidanSelect=ZidanSelect,g.zidanSelect=Yt,g.initZidanSelects=yt),(typeof ZidanCheckbox!="undefined"||typeof ZidanRadioGroup!="undefined"||typeof d!="undefined"||typeof ZidanTextField!="undefined")&&(g.zidanField=vt,g.initZidanForms=V),typeof ZidanCheckbox!="undefined"&&(g.ZidanCheckbox=ZidanCheckbox),typeof ZidanRadioGroup!="undefined"&&(g.ZidanRadioGroup=ZidanRadioGroup),typeof d!="undefined"&&(g.ZidanFileUpload=d),typeof ZidanTextField!="undefined"&&(g.ZidanTextField=ZidanTextField),typeof formatPhone=="function"&&(g.formatPhone=formatPhone,g.detectPhoneCountry=detectPhoneCountry),h.api=g,g});
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * ZidanForm v2.4.0 — plugin-core.css
2
+ * ZidanForm v2.4.1 — plugin-core.css
3
3
  * Structure and mechanics only: layout, positioning, visibility, focus
4
4
  * plumbing and accessible native-input handling. No colours, borders colours,
5
5
  * shadows or decorative skin — load plugin-theme.css (or your own theme) for
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * ZidanForm v2.4.0 — plugin-core.css
2
+ * ZidanForm v2.4.1 — plugin-core.css
3
3
  * Structure and mechanics only: layout, positioning, visibility, focus
4
4
  * plumbing and accessible native-input handling. No colours, borders colours,
5
5
  * shadows or decorative skin — load plugin-theme.css (or your own theme) for
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * ZidanForm v2.4.0 — plugin-theme.css
2
+ * ZidanForm v2.4.1 — plugin-theme.css
3
3
  * Design tokens, paint, state colours, preset themes (default, modern,
4
4
  * minimal, dark, glass), the five select layouts and framework adapters
5
5
  * (bootstrap, tailwind, bulma, foundation).