From 63c3117edb7402c0c6375432b874092a651db49b Mon Sep 17 00:00:00 2001 From: Kevin Morris Date: Sun, 1 Nov 2026 19:17:30 -0500 Subject: [PATCH 01/78] test: keep the iframe source payload in an about:blank fragment so WebKit survives it --- test/suite/iframe-transport.test.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/suite/iframe-transport.test.js b/test/suite/iframe-transport.test.js index 9442e5f..932398c 100644 --- a/test/suite/iframe-transport.test.js +++ b/test/suite/iframe-transport.test.js @@ -664,7 +664,8 @@ describe("form", function () { it("should set the iframe source as an attribute, not HTML", async function () { window.iframePayload = 0; - const iframeSrc = 'about:blank">'; + // WebKit's browser process crashes on any other about: URL, so the payload sits in a fragment. + const iframeSrc = 'about:blank#">'; const $form = createIframeForm("ajax/iframe-text.html"); const seen = await submitAndAbort($form, { iframeSrc: iframeSrc }); From 033828c77a686b145432c67ed20cdf915907cc74 Mon Sep 17 00:00:00 2001 From: Kevin Morris Date: Sun, 1 Nov 2026 19:18:08 -0500 Subject: [PATCH 02/78] build: run the suite on WebKit as well as Chromium Coverage stays on Chromium; npm test runs suite-webkit in a second Vitest run. --- .github/workflows/ci.yml | 16 +++++++++++----- package.json | 2 +- vitest.config.mjs | 11 +++++++---- 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1e67ca3..5b75833 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -66,15 +66,15 @@ jobs: with: path: ~/.cache/ms-playwright key: playwright-${{ runner.os }}-${{ steps.playwright.outputs.version }} - - name: Install Chromium + - name: Install Chromium and WebKit if: env.CODE == 'true' run: | start=$(date +%s) - trap 'printf "%s\t%s\n" "Install Chromium" "$(($(date +%s) - start))" >> "$TIMINGS"' EXIT - npx playwright install chromium + trap 'printf "%s\t%s\n" "Install Chromium and WebKit" "$(($(date +%s) - start))" >> "$TIMINGS"' EXIT + npx playwright install --with-deps chromium webkit - name: Check the test script matches the CI steps run: | - expected="npm run lint && npm run format:check && npm run build && vitest run --coverage" + expected="npm run lint && npm run format:check && npm run build && vitest run --coverage --project !suite-webkit && vitest run --project suite-webkit" actual=$(node -p "require('./package.json').scripts.test") if [ "$actual" != "$expected" ]; then echo "package.json test script has drifted from the CI steps." @@ -103,7 +103,13 @@ jobs: run: | start=$(date +%s) trap 'printf "%s\t%s\n" "vitest run --coverage" "$(($(date +%s) - start))" >> "$TIMINGS"' EXIT - npx vitest run --coverage --reporter=default --reporter=json --outputFile.json=vitest-report.json + npx vitest run --coverage --project !suite-webkit --reporter=default --reporter=json --outputFile.json=vitest-report.json + - name: vitest run --project suite-webkit + if: env.CODE == 'true' + run: | + start=$(date +%s) + trap 'printf "%s\t%s\n" "vitest run --project suite-webkit" "$(($(date +%s) - start))" >> "$TIMINGS"' EXIT + npx vitest run --project suite-webkit - name: Check committed dist matches the build if: env.CODE == 'true' run: | diff --git a/package.json b/package.json index a83fc72..f3e720f 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,7 @@ "format": "prettier --write .", "format:check": "prettier --check .", "metrics": "node scripts/code-metrics.mjs", - "test": "npm run lint && npm run format:check && npm run build && vitest run --coverage" + "test": "npm run lint && npm run format:check && npm run build && vitest run --coverage --project !suite-webkit && vitest run --project suite-webkit" }, "dependencies": { "jquery": ">=1.7.2" diff --git a/vitest.config.mjs b/vitest.config.mjs index 98b573f..1d608b3 100644 --- a/vitest.config.mjs +++ b/vitest.config.mjs @@ -80,11 +80,14 @@ const jqueryAsModule = { }, }; -const browser = () => ({ +// The suite runs on Chromium and WebKit, as instances named suite-chromium and suite-webkit. +// Firefox is not listed: Playwright's Firefox build does not start on the maintainer's macOS. +// V8 coverage only exists in Chromium, so npm test runs suite-webkit in a second run. +const browser = (names, project) => ({ enabled: true, headless: true, provider: playwright(), - instances: [{ browser: "chromium" }], + instances: names.map((name) => ({ browser: name, name: project && `${project}-${name}` })), }); export default defineConfig({ @@ -110,7 +113,7 @@ export default defineConfig({ globals: true, include: ["test/suite/**/*.test.js"], setupFiles: ["test/setup.js"], - browser: browser(), + browser: browser(["chromium", "webkit"], "suite"), }, }, { @@ -118,7 +121,7 @@ export default defineConfig({ test: { name: "surfaces", include: ["test/surfaces/browser.test.js"], - browser: browser(), + browser: browser(["chromium"]), }, }, { From 139b77b5376f8a1889b518d014e8739893bc390b Mon Sep 17 00:00:00 2001 From: Kevin Morris Date: Sun, 1 Nov 2026 19:19:05 -0500 Subject: [PATCH 03/78] ci: run the jQuery matrix on WebKit as well as Chromium --- .github/workflows/ci.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5b75833..947ce97 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -136,13 +136,15 @@ jobs: # Branch protection requires each matrix check by name, so a docs-only PR skips the steps, not the # job: a job skipped by `if` reports one unexpanded "jQuery ${{ matrix.jquery }}" check instead. jquery: - name: jQuery ${{ matrix.jquery }} + name: jQuery ${{ matrix.jquery }} on ${{ matrix.browser }} needs: changes runs-on: ubuntu-latest timeout-minutes: 10 strategy: fail-fast: false matrix: + browser: [chromium, webkit] + jquery: ["1.7.2", "3.7.1", "4.0.0"] include: - { jquery: "1.7.2", file: ".jquery/jquery-1.7.2.js" } - { jquery: "3.7.1", file: "node_modules/jquery/dist/jquery.js" } @@ -168,14 +170,14 @@ jobs: uses: actions/cache@v6 with: path: ~/.cache/ms-playwright - key: playwright-${{ runner.os }}-${{ steps.playwright.outputs.version }} - - run: npx playwright install chromium + key: playwright-${{ runner.os }}-${{ steps.playwright.outputs.version }}-${{ matrix.browser }} + - run: npx playwright install --with-deps ${{ matrix.browser }} if: env.CODE == 'true' - name: Fetch jQuery 1.7.2 if: env.CODE == 'true' && matrix.jquery == '1.7.2' run: scripts/fetch-jquery.sh 1.7.2 - name: Run the suite on jQuery ${{ matrix.jquery }} if: env.CODE == 'true' - run: npx vitest run --project suite + run: npx vitest run --project suite-${{ matrix.browser }} env: JQUERY_FILE: ${{ matrix.file }} From 85de738af0c8d7bbfe72b694f2cb543c9eb6da82 Mon Sep 17 00:00:00 2001 From: Kevin Morris Date: Sun, 1 Nov 2026 19:31:46 -0500 Subject: [PATCH 04/78] build: add a test:firefox script that runs the suite on Firefox in Playwright's Linux image --- package.json | 3 ++- scripts/test-firefox.sh | 19 +++++++++++++++++++ vitest.config.mjs | 10 ++++++++-- 3 files changed, 29 insertions(+), 3 deletions(-) create mode 100755 scripts/test-firefox.sh diff --git a/package.json b/package.json index f3e720f..e5b591d 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,8 @@ "format": "prettier --write .", "format:check": "prettier --check .", "metrics": "node scripts/code-metrics.mjs", - "test": "npm run lint && npm run format:check && npm run build && vitest run --coverage --project !suite-webkit && vitest run --project suite-webkit" + "test": "npm run lint && npm run format:check && npm run build && vitest run --coverage --project !suite-webkit && vitest run --project suite-webkit", + "test:firefox": "scripts/test-firefox.sh" }, "dependencies": { "jquery": ">=1.7.2" diff --git a/scripts/test-firefox.sh b/scripts/test-firefox.sh new file mode 100755 index 0000000..a281679 --- /dev/null +++ b/scripts/test-firefox.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash +# Run the suite on Firefox in Playwright's Linux image (its Firefox build does not start on macOS 27). +# Usage: [JQUERY_FILE=.jquery/jquery-1.7.2.js] scripts/test-firefox.sh +# The container gets its own node_modules volume; the host's stays untouched. +set -euo pipefail + +image="mcr.microsoft.com/playwright:v1.64.1-noble" +node_major=$(cat .nvmrc) + +exec docker run --rm --init --ipc=host \ + -v "$PWD":/work -v /work/node_modules -w /work \ + -e JQUERY_FILE="${JQUERY_FILE:-}" -e JQUERY_FORM_FIREFOX=1 \ + "$image" bash -euo pipefail -c " + (cd /tmp && npx --yes n $node_major >/dev/null) + hash -r + npm ci --no-audit --no-fund >/dev/null + npx playwright install firefox >/dev/null + npx vitest run --project suite-firefox + " diff --git a/vitest.config.mjs b/vitest.config.mjs index 1d608b3..06d9963 100644 --- a/vitest.config.mjs +++ b/vitest.config.mjs @@ -81,8 +81,14 @@ const jqueryAsModule = { }; // The suite runs on Chromium and WebKit, as instances named suite-chromium and suite-webkit. -// Firefox is not listed: Playwright's Firefox build does not start on the maintainer's macOS. +// suite-firefox is added only with JQUERY_FORM_FIREFOX=1 (scripts/test-firefox.sh runs it in Docker): +// Playwright's Firefox build does not start on the maintainer's macOS, so npm test leaves it out. // V8 coverage only exists in Chromium, so npm test runs suite-webkit in a second run. +const suiteBrowsers = ["chromium", "webkit"]; +if (process.env.JQUERY_FORM_FIREFOX === "1") { + suiteBrowsers.push("firefox"); +} + const browser = (names, project) => ({ enabled: true, headless: true, @@ -113,7 +119,7 @@ export default defineConfig({ globals: true, include: ["test/suite/**/*.test.js"], setupFiles: ["test/setup.js"], - browser: browser(["chromium", "webkit"], "suite"), + browser: browser(suiteBrowsers, "suite"), }, }, { From 1ea076a7a844c568c94955df82fd4e28ccffc78c Mon Sep 17 00:00:00 2001 From: Kevin Morris Date: Sun, 1 Nov 2026 19:31:47 -0500 Subject: [PATCH 05/78] ci: run the jQuery matrix on Firefox as well as Chromium and WebKit --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 947ce97..b8b11a9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -143,7 +143,7 @@ jobs: strategy: fail-fast: false matrix: - browser: [chromium, webkit] + browser: [chromium, webkit, firefox] jquery: ["1.7.2", "3.7.1", "4.0.0"] include: - { jquery: "1.7.2", file: ".jquery/jquery-1.7.2.js" } @@ -181,3 +181,4 @@ jobs: run: npx vitest run --project suite-${{ matrix.browser }} env: JQUERY_FILE: ${{ matrix.file }} + JQUERY_FORM_FIREFOX: ${{ matrix.browser == 'firefox' && '1' || '' }} From 9549f51df8b3835d2f3fe84eb5a9d07f1d9e8322 Mon Sep 17 00:00:00 2001 From: Kevin Morris Date: Sun, 1 Nov 2026 19:33:55 -0500 Subject: [PATCH 06/78] build: generalize the Firefox script into test:docker with cached Node and node_modules volumes --- package.json | 3 ++- scripts/test-docker.sh | 34 ++++++++++++++++++++++++++++++++++ scripts/test-firefox.sh | 19 ------------------- vitest.config.mjs | 2 +- 4 files changed, 37 insertions(+), 21 deletions(-) create mode 100755 scripts/test-docker.sh delete mode 100755 scripts/test-firefox.sh diff --git a/package.json b/package.json index e5b591d..99a1abd 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,8 @@ "format:check": "prettier --check .", "metrics": "node scripts/code-metrics.mjs", "test": "npm run lint && npm run format:check && npm run build && vitest run --coverage --project !suite-webkit && vitest run --project suite-webkit", - "test:firefox": "scripts/test-firefox.sh" + "test:docker": "scripts/test-docker.sh", + "test:firefox": "scripts/test-docker.sh --project suite-firefox" }, "dependencies": { "jquery": ">=1.7.2" diff --git a/scripts/test-docker.sh b/scripts/test-docker.sh new file mode 100755 index 0000000..82603cc --- /dev/null +++ b/scripts/test-docker.sh @@ -0,0 +1,34 @@ +#!/usr/bin/env bash +# Run Vitest in Playwright's Linux image (its Firefox build does not start on macOS 27). +# Usage: [JQUERY_FILE=.jquery/jquery-1.7.2.js] scripts/test-docker.sh [vitest args...] +# Defaults to the suite on Chromium, WebKit and Firefox. Node and node_modules are cached in named +# volumes (jquery-form-node, jquery-form-node-modules-); the host's node_modules stays untouched. +set -euo pipefail + +playwright=$(sed -n 's/^ *"playwright": "\([0-9.]*\)".*/\1/p' package.json) +image="mcr.microsoft.com/playwright:v$playwright-noble" +node_major=$(cat .nvmrc) +lock_hash=$(shasum -a 256 package-lock.json | cut -c1-12) + +if [ $# -eq 0 ]; then + set -- --project suite-chromium --project suite-webkit --project suite-firefox +fi + +exec docker run --rm --init --ipc=host \ + -v "$PWD":/work -w /work \ + -v jquery-form-node:/opt/node \ + -v "jquery-form-node-modules-$lock_hash":/work/node_modules \ + -e N_PREFIX=/opt/node -e PATH="/opt/node/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" \ + -e JQUERY_FILE="${JQUERY_FILE:-}" -e JQUERY_FORM_FIREFOX=1 \ + "$image" bash -euo pipefail -c ' + if ! node --version 2>/dev/null | grep -q "^v'"$node_major"'\."; then + (cd /tmp && npx --yes n '"$node_major"' >/dev/null) + hash -r + fi + if [ ! -f node_modules/.installed ]; then + npm ci --no-audit --no-fund >/dev/null + touch node_modules/.installed + fi + npx playwright install chromium webkit firefox >/dev/null + npx vitest run "$@" + ' bash "$@" diff --git a/scripts/test-firefox.sh b/scripts/test-firefox.sh deleted file mode 100755 index a281679..0000000 --- a/scripts/test-firefox.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/env bash -# Run the suite on Firefox in Playwright's Linux image (its Firefox build does not start on macOS 27). -# Usage: [JQUERY_FILE=.jquery/jquery-1.7.2.js] scripts/test-firefox.sh -# The container gets its own node_modules volume; the host's stays untouched. -set -euo pipefail - -image="mcr.microsoft.com/playwright:v1.64.1-noble" -node_major=$(cat .nvmrc) - -exec docker run --rm --init --ipc=host \ - -v "$PWD":/work -v /work/node_modules -w /work \ - -e JQUERY_FILE="${JQUERY_FILE:-}" -e JQUERY_FORM_FIREFOX=1 \ - "$image" bash -euo pipefail -c " - (cd /tmp && npx --yes n $node_major >/dev/null) - hash -r - npm ci --no-audit --no-fund >/dev/null - npx playwright install firefox >/dev/null - npx vitest run --project suite-firefox - " diff --git a/vitest.config.mjs b/vitest.config.mjs index 06d9963..55b57e8 100644 --- a/vitest.config.mjs +++ b/vitest.config.mjs @@ -81,7 +81,7 @@ const jqueryAsModule = { }; // The suite runs on Chromium and WebKit, as instances named suite-chromium and suite-webkit. -// suite-firefox is added only with JQUERY_FORM_FIREFOX=1 (scripts/test-firefox.sh runs it in Docker): +// suite-firefox is added only with JQUERY_FORM_FIREFOX=1 (scripts/test-docker.sh runs it in Docker): // Playwright's Firefox build does not start on the maintainer's macOS, so npm test leaves it out. // V8 coverage only exists in Chromium, so npm test runs suite-webkit in a second run. const suiteBrowsers = ["chromium", "webkit"]; From 7a85f061236cdebd8fcb80d73674d890026bdff6 Mon Sep 17 00:00:00 2001 From: Kevin Morris Date: Sun, 1 Nov 2026 19:33:55 -0500 Subject: [PATCH 07/78] docs: explain running the tests in Docker --- CONTRIBUTING.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 098294a..0f28409 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -73,6 +73,23 @@ jQuery Form uses [Node.js](https://nodejs.org/), [Rollup](https://rollupjs.org/) Edit `src/jquery.form.js` (an ES module), never `dist/`. `npm test` rebuilds `dist/`; commit the rebuilt files with your change, since CI fails if they differ from the build. +### Running tests in Docker + +Playwright's Firefox build does not start on some macOS versions, and `npm test` covers only Chromium and WebKit. To run the suite on Firefox (or on all three browsers under Linux), use Docker. The scripts use the Playwright image that matches the `playwright` version in `package.json` and leave your local `node_modules` untouched: + +```shell +npm run test:firefox # the suite on Firefox +npm run test:docker # the suite on Chromium, WebKit and Firefox +``` + +`scripts/test-docker.sh` passes any arguments on to `vitest run`. To test another jQuery build, set `JQUERY_FILE`, e.g. `JQUERY_FILE=.jquery/jquery-1.7.2.js npm run test:firefox` (fetch it first with `scripts/fetch-jquery.sh 1.7.2`). + +Node and `node_modules` are cached in Docker volumes (`jquery-form-node`, and `jquery-form-node-modules-` for each `package-lock.json`). To clear them: + +```shell +docker volume rm jquery-form-node $(docker volume ls -q --filter name=jquery-form-node-modules-) +``` + ### Git blame Repo-wide formatting commits are listed in [`.git-blame-ignore-revs`](.git-blame-ignore-revs). To skip them in `git blame`: From 42fd0422f6a28cd6dadcd35c4f6031744988c747 Mon Sep 17 00:00:00 2001 From: Kevin Morris Date: Sun, 1 Nov 2026 19:56:47 -0500 Subject: [PATCH 08/78] test: compare formToArray and formSerialize with FormData on seeded random forms Known differences are a named allowlist; any other difference fails with its seed. --- test/suite/serialization-oracle.test.js | 586 ++++++++++++++++++++++++ 1 file changed, 586 insertions(+) create mode 100644 test/suite/serialization-oracle.test.js diff --git a/test/suite/serialization-oracle.test.js b/test/suite/serialization-oracle.test.js new file mode 100644 index 0000000..cdcc405 --- /dev/null +++ b/test/suite/serialization-oracle.test.js @@ -0,0 +1,586 @@ +import { afterEach, assert, describe, it } from "vitest"; + +// Serialization oracle: random forms from fixed seeds, serialized by the plugin and by the +// browser's own FormData. Every difference must match a named class in KNOWN_DIFFERENCES. + +const SEEDS = [ + 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765, 10946, 17711, + 28657, 46368, 75025, 121393, 196418, 317811, 514229, 832040, 1346269, 2178309, 3524578, 5702887, + 9227465, 14930352, 24157817, 39088169, 63245986, 102334155, 165580141, 7, 11, 17, 19, 23, 29, 31, + 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 97, 101, 103, +]; + +// mulberry32: a small seeded generator, so a failing seed replays the same form. +function prng(seed) { + let state = seed >>> 0; + + const next = function () { + state = (state + 0x6d2b79f5) >>> 0; + let t = state; + t = Math.imul(t ^ (t >>> 15), t | 1); + t ^= t + Math.imul(t ^ (t >>> 7), t | 61); + return ((t ^ (t >>> 14)) >>> 0) / 4294967296; + }; + + return { + chance: (p) => next() < p, + int: (n) => Math.floor(next() * n), + pick: (list) => list[Math.floor(next() * list.length)], + }; +} + +const NAMES = ["a", "b", "c", "a b", "ΓΌ", "名前", "a[]", "a.b", "x=y", "&", "πŸ˜€"]; +// Lone surrogates: rare, since formSerialize cannot encode them (class USV-THROW). +const LONE = ["q\uD800", "lone\uDC00"]; +const VALUES = [ + "", + "1", + "value", + " spaced out ", + "a&b=c", + "100%", + "1+1", + "Γ©", + "ζ—₯本θͺž", + "πŸ˜€", + "!'()*~", + "#ff0000", + "2024-02-29", + "42", + "x@example.com", +]; +const LINE_VALUES = ["one\rtwo", "one\ntwo", "one\r\ntwo", "\r\n\n\r"]; +const TEXT_TYPES = [ + "text", + "hidden", + "password", + "search", + "email", + "number", + "range", + "date", + "color", +]; +const FILE_NAMES = ["a.txt", "b c.txt", "ΓΌ.txt", "ζ—₯本.txt"]; + +// Builds one random form (and its outside controls) inside `container`. +function generateForm(seed, container) { + const rand = prng(seed); + const formId = "oracle-" + seed; + const counters = { file: 0, dir: 0, out: 0 }; + const outsideNames = []; + const form = document.createElement("form"); + form.id = formId; + const other = document.createElement("form"); + other.id = formId + "-other"; + + // Outside controls get their own names (out-N), so the semantic order class can find them. + function name(outside) { + if (outside) { + const outsideName = "out-" + counters.out++; + outsideNames.push(outsideName); + return outsideName; + } + return rand.chance(0.02) ? rand.pick(LONE) : rand.pick(NAMES); + } + + function value() { + return rand.chance(0.02) ? rand.pick(LONE) : rand.pick(VALUES); + } + + function input(type, outside) { + const el = document.createElement("input"); + el.type = type; + if (rand.chance(0.85)) { + el.name = name(outside); + } + return el; + } + + const makers = [ + function (outside) { + const el = input(rand.pick(TEXT_TYPES), outside); + if (rand.chance(0.8)) { + el.setAttribute("value", value()); + } + if (el.type === "hidden" && rand.chance(0.3)) { + el.value = rand.pick(LINE_VALUES); + } + if ((el.type === "text" || el.type === "search") && rand.chance(0.2)) { + el.setAttribute("dirname", "dir-" + counters.dir++); + } + return el; + }, + function (outside) { + const el = input(rand.pick(["checkbox", "radio"]), outside); + if (rand.chance(0.6)) { + el.setAttribute("value", value()); + } + el.checked = rand.chance(0.6); + return el; + }, + function (outside) { + const el = document.createElement("select"); + el.name = name(outside); + el.multiple = rand.chance(0.4); + let parent = el; + const count = rand.int(5); + for (let i = 0; i < count; i++) { + if (rand.chance(0.2)) { + parent = document.createElement("optgroup"); + parent.label = "g" + i; + parent.disabled = rand.chance(0.5); + el.appendChild(parent); + } + const option = document.createElement("option"); + option.text = rand.pick([" one ", "two", "ζ—₯本", ""]); + if (rand.chance(0.6)) { + option.value = value(); + } + option.disabled = rand.chance(0.2); + parent.appendChild(option); + option.selected = rand.chance(0.4); + } + if (rand.chance(0.2)) { + el.selectedIndex = -1; + } + return el; + }, + function (outside) { + const el = document.createElement("textarea"); + el.name = name(outside); + el.value = rand.pick(LINE_VALUES.concat(VALUES)); + if (rand.chance(0.2)) { + el.setAttribute("dirname", "dir-" + counters.dir++); + } + return el; + }, + function (outside) { + const el = document.createElement("input"); + el.type = "file"; + el.name = "file-" + counters.file++; + if (outside) { + outsideNames.push(el.name); + } + const count = rand.int(3); + if (count) { + el.multiple = count > 1; + const transfer = new DataTransfer(); + for (let i = 0; i < count; i++) { + transfer.items.add(new File(["x"], rand.pick(FILE_NAMES), { type: "text/plain" })); + } + el.files = transfer.files; + } + return el; + }, + function (outside) { + const kind = rand.pick(["submit", "image", "button", "reset", "button-element"]); + let el; + if (kind === "button-element") { + el = document.createElement("button"); + el.type = rand.pick(["submit", "button", "reset", ""]); + if (rand.chance(0.9)) { + el.name = name(outside); + } + } else { + el = input(kind, outside); + } + if (rand.chance(0.7)) { + el.setAttribute("value", value()); + } + return el; + }, + function (outside) { + const el = input("hidden", outside); + if (!outside) { + el.name = "_charset_"; + } + el.setAttribute("value", value()); + return el; + }, + function (outside) { + const el = document.createElement(rand.pick(["output", "fieldset"])); + el.setAttribute("name", name(outside)); + el.textContent = "x"; + return el; + }, + ]; + + function control(outside) { + const el = rand.pick(makers)(outside); + el.disabled = el.disabled || rand.chance(0.1); + return el; + } + + // Fills a parent with controls, sometimes nested in a fieldset with a first legend. + function fill(parent, depth) { + const count = 1 + rand.int(6); + for (let i = 0; i < count; i++) { + if (depth < 2 && rand.chance(0.15)) { + const fieldset = document.createElement("fieldset"); + fieldset.disabled = rand.chance(0.5); + if (rand.chance(0.6)) { + const legend = document.createElement("legend"); + legend.appendChild(control(false)); + fieldset.appendChild(legend); + } + fill(fieldset, depth + 1); + parent.appendChild(fieldset); + continue; + } + const el = control(false); + if (rand.chance(0.08)) { + el.setAttribute("form", rand.pick([other.id, "oracle-nowhere", formId])); + } + parent.appendChild(el); + } + } + + fill(form, 0); + if (rand.chance(0.5)) { + form.appendChild(makers[5](false)); + } + + const before = rand.int(3); + const after = rand.int(3); + for (let i = 0; i < before; i++) { + const el = control(true); + el.setAttribute("form", formId); + container.appendChild(el); + } + container.appendChild(form); + container.appendChild(other); + for (let i = 0; i < after; i++) { + const el = control(true); + el.setAttribute("form", formId); + container.appendChild(el); + } + + // The submitter: one of the form's submit buttons, when it has any. + const submitters = Array.prototype.filter.call( + document.querySelectorAll("input, button"), + (el) => el.form === form && (el.type === "submit" || el.type === "image") + ); + const submitter = submitters.length && rand.chance(0.85) ? rand.pick(submitters) : null; + + return { form: form, submitter: submitter, outsideNames: outsideNames }; +} + +// [name, kind, value]: kind "file" holds the file name, kind "text" a string. +function pluginEntries(fields) { + return fields.map(function (field) { + if (field.value instanceof File) { + return [field.name, "file", field.value.name]; + } + if (field.type === "file") { + return [field.name, "file", ""]; + } + return [field.name, "text", String(field.value)]; + }); +} + +function nativeEntries(formData) { + return Array.from(formData.entries()).map(function (entry) { + return entry[1] instanceof File + ? [entry[0], "file", entry[1].name] + : [entry[0], "text", entry[1]]; + }); +} + +function toWellFormed(text) { + return text.replace( + /[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(^|[^\uD800-\uDBFF])[\uDC00-\uDFFF]/g, + function (match, lead) { + return typeof lead === "string" ? lead + "\uFFFD" : "\uFFFD"; + } + ); +} + +function isImage(el) { + return !!el && el.tagName === "INPUT" && el.type === "image"; +} + +// Known differences between the plugin and FormData. Each has an ID; `normalize` maps +// { plugin, native } entry lists to lists where that class no longer differs. +const KNOWN_DIFFERENCES = [ + { + id: "USV", + description: "FormData replaces lone surrogates in names and values with U+FFFD", + normalize: (pair) => ({ + plugin: pair.plugin.map((e) => [toWellFormed(e[0]), e[1], toWellFormed(e[2])]), + native: pair.native, + }), + }, + { + id: "CRLF", + description: "the plugin sends line breaks as CRLF; FormData keeps them as the value has them", + normalize: (pair) => { + const lines = (e) => [e[0], e[1], e[1] === "text" ? e[2].replace(/\r\n|\r|\n/g, "\n") : e[2]]; + return { plugin: pair.plugin.map(lines), native: pair.native.map(lines) }; + }, + }, + { + id: "CHARSET", + description: "FormData sends a hidden _charset_ control's value as the document encoding", + normalize: (pair) => ({ + plugin: pair.plugin.map((e) => (e[0] === "_charset_" ? [e[0], e[1], "UTF-8"] : e)), + native: pair.native, + }), + }, + { + id: "DIRNAME", + description: "FormData adds a dirname field for text inputs and textareas; the plugin does not", + normalize: (pair) => ({ + plugin: pair.plugin, + native: pair.native.filter((e) => !/^dir-\d+$/.test(e[0])), + }), + }, + { + id: "SUBMIT-LABEL", + description: + 'FormData sends the default label of an input submitter without a value; the plugin sends ""', + normalize: (pair, ctx) => { + const sub = ctx.submitter; + if (!sub || sub.tagName !== "INPUT" || sub.type !== "submit" || sub.hasAttribute("value")) { + return pair; + } + return { + plugin: pair.plugin, + native: pair.native.map((e) => + e[0] === sub.name && /^Submit( Query)?$/.test(e[2]) ? [e[0], e[1], ""] : e + ), + }; + }, + }, + { + id: "IMG-VALUE", + description: "the plugin sends a clicked image button's name=value before its coordinates", + normalize: (pair, ctx) => { + if (!isImage(ctx.submitter) || !ctx.submitter.name) { + return pair; + } + const n = ctx.submitter.name; + return { + plugin: pair.plugin.filter( + (e, i) => !(e[0] === n && pair.plugin[i + 1] && pair.plugin[i + 1][0] === n + ".x") + ), + native: pair.native, + }; + }, + }, + { + id: "IMG-UNNAMED", + description: "FormData sends x and y for an unnamed image submitter; the plugin sends nothing", + normalize: (pair, ctx) => { + if (!isImage(ctx.submitter) || ctx.submitter.name || ctx.submitter.disabled) { + return pair; + } + return { + plugin: pair.plugin, + native: pair.native.filter((e) => e[0] !== "x" && e[0] !== "y"), + }; + }, + }, + { + id: "IMG-ORDER", + description: "without semantic, the plugin appends the clicked image's fields last", + normalize: (pair, ctx) => { + if (ctx.semantic || !isImage(ctx.submitter) || !ctx.submitter.name) { + return pair; + } + const n = ctx.submitter.name; + const last = (list) => { + const coords = list.filter((e) => e[0] === n + ".x" || e[0] === n + ".y"); + return list.filter((e) => coords.indexOf(e) < 0).concat(coords); + }; + return { plugin: last(pair.plugin), native: last(pair.native) }; + }, + }, + { + id: "SEM-ORDER", + description: "with semantic, the plugin sends outside controls (form=id) after the form's own", + normalize: (pair, ctx) => { + if (!ctx.semantic) { + return pair; + } + const outsideLast = (list) => { + const outside = list.filter( + (e) => ctx.outsideNames.indexOf(e[0].replace(/\.[xy]$/, "")) >= 0 + ); + return list.filter((e) => outside.indexOf(e) < 0).concat(outside); + }; + return { plugin: pair.plugin, native: outsideLast(pair.native) }; + }, + }, +]; + +// Known exceptions: the plugin throws where FormData serializes. Each has an ID and a matcher. +const KNOWN_THROWS = [ + { + id: "USV-THROW", + description: "formSerialize throws URIError on a lone surrogate (jQuery.param encodes it)", + matches: (error, ctx) => + error instanceof URIError && + pluginEntries($(ctx.form).formToArray()).some( + (e) => toWellFormed(e[0] + e[2]) !== e[0] + e[2] + ), + }, +]; + +// Runs the plugin; an exception passes only when a known class matches it (null then). +function attempt(act, ctx) { + try { + return act(); + } catch (error) { + const known = KNOWN_THROWS.filter((k) => k.matches(error, ctx)); + assert.ok(known.length, "seed " + ctx.seed + " (" + ctx.comparison + "), unlisted " + error); + return null; + } +} + +function formatEntries(list) { + return list.map((e) => JSON.stringify(e)).join("\n "); +} + +// Applies every known class; fails with the seed and both lists when a difference remains. +function assertSameEntries(plugin, native, ctx) { + let pair = { plugin: plugin, native: native }; + KNOWN_DIFFERENCES.forEach(function (known) { + pair = known.normalize(pair, ctx); + }); + + assert.deepEqual( + pair.plugin, + pair.native, + "seed " + + ctx.seed + + " (" + + ctx.comparison + + "), unlisted difference\nform: " + + ctx.html + + "\nplugin:\n " + + formatEntries(plugin) + + "\nnative:\n " + + formatEntries(native) + ); +} + +function canonicalQuery(query) { + if (!query) { + return []; + } + return query.split("&").map(function (pair) { + const parts = pair.split("="); + const decode = (part) => decodeURIComponent((part || "").replace(/\+/g, " ")); + return [decode(parts[0]), "text", decode(parts.slice(1).join("="))]; + }); +} + +let submitterArgumentSupported = null; + +// FormData(form, submitter) arrived after FormData(form); older engines ignore the argument. +function supportsSubmitterArgument() { + if (submitterArgumentSupported === null) { + const form = document.createElement("form"); + const button = document.createElement("button"); + button.name = "probe"; + form.appendChild(button); + try { + submitterArgumentSupported = new FormData(form, button).has("probe"); + } catch { + submitterArgumentSupported = false; + } + } + return submitterArgumentSupported; +} + +describe("serialization oracle", function () { + let container; + + function arrange(seed) { + container = document.createElement("div"); + document.body.appendChild(container); + const generated = generateForm(seed, container); + return Object.assign(generated, { seed: seed, html: container.innerHTML }); + } + + function setSubmitter(form, submitter) { + form.clk = submitter; + form.clk_x = isImage(submitter) ? 0 : undefined; + form.clk_y = isImage(submitter) ? 0 : undefined; + } + + afterEach(function () { + container.remove(); + }); + + SEEDS.forEach(function (seed) { + describe("when the form of seed " + seed + " is serialized", function () { + it("formToArray should send what FormData collects", function () { + const g = arrange(seed); + + const plugin = pluginEntries($(g.form).formToArray()); + const native = nativeEntries(new FormData(g.form)); + + assertSameEntries( + plugin, + native, + Object.assign(g, { submitter: null, comparison: "formToArray" }) + ); + }); + + it("formSerialize should send what URLSearchParams builds from FormData, files aside", function () { + const g = arrange(seed); + const isFileField = (e) => /^file-\d+$/.test(e[0]); + + const ctx = Object.assign(g, { submitter: null, comparison: "formSerialize" }); + + const query = attempt(() => $(g.form).formSerialize(), ctx); + if (query === null) { + return; + } + const plugin = canonicalQuery(query).filter((e) => !isFileField(e)); + const native = nativeEntries(new FormData(g.form)).filter((e) => !isFileField(e)); + const reference = canonicalQuery( + new URLSearchParams(native.map((e) => [e[0], e[2]])).toString() + ); + + assertSameEntries(plugin, reference, ctx); + }); + + it("formToArray with a submitter should send what FormData collects with it", function (ctx) { + const g = arrange(seed); + if (!g.submitter || !supportsSubmitterArgument()) { + ctx.skip(); + } + setSubmitter(g.form, g.submitter); + + const plugin = pluginEntries($(g.form).formToArray()); + const native = nativeEntries(new FormData(g.form, g.submitter)); + + assertSameEntries( + plugin, + native, + Object.assign(g, { comparison: "formToArray, submitter" }) + ); + }); + + it("formToArray with semantic should send what FormData collects with the submitter", function () { + const g = arrange(seed); + const submitter = supportsSubmitterArgument() ? g.submitter : null; + setSubmitter(g.form, submitter); + + const plugin = pluginEntries($(g.form).formToArray(true)); + const native = nativeEntries( + submitter ? new FormData(g.form, submitter) : new FormData(g.form) + ); + + assertSameEntries( + plugin, + native, + Object.assign(g, { submitter: submitter, semantic: true, comparison: "semantic" }) + ); + }); + }); + }); +}); From c27558befd8c6c58d889cc1150441a9f6bf61dda Mon Sep 17 00:00:00 2001 From: Kevin Morris Date: Sun, 1 Nov 2026 20:02:29 -0500 Subject: [PATCH 09/78] fix: send lone surrogates as U+FFFD instead of throwing URIError --- dist/jquery.form.js | 22 ++++++++++++++++++---- dist/jquery.form.min.js | 2 +- dist/jquery.form.min.js.map | 2 +- dist/jquery.form.mjs | 22 ++++++++++++++++++---- docs/research/4x-behavior-changes.md | 4 ++++ src/jquery.form.js | 2 +- src/successful-controls.js | 20 +++++++++++++++++--- test/suite/serialization-oracle.test.js | 14 ++------------ test/suite/serialization.test.js | 18 ++++++++++++++++++ test/suite/submission.test.js | 11 +++++++++++ 10 files changed, 91 insertions(+), 26 deletions(-) diff --git a/dist/jquery.form.js b/dist/jquery.form.js index 04b8254..46dd12e 100644 --- a/dist/jquery.form.js +++ b/dist/jquery.form.js @@ -696,11 +696,25 @@ function valueOf(el) { /** * The fields as a urlencoded body sends them: a selected file as its name. */ +// A lone surrogate becomes U+FFFD, as in a native submission; jQuery.param would throw. +var loneSurrogate = /[\uD800-\uDBFF](?![\uDC00-\uDFFF])|([^\uD800-\uDBFF]|^)([\uDC00-\uDFFF])/g; + +function wellFormed(value) { + return typeof value === "string" + ? value.replace(loneSurrogate, function (match, before) { + return (before || "") + "\uFFFD"; + }) + : value; +} + function urlencodedFields(fields) { return jQuery.map(fields, function (field) { - return field.type === "file" && typeof field.value !== "string" - ? { name: field.name, value: field.value.name } - : field; + var value = + field.type === "file" && typeof field.value !== "string" ? field.value.name : field.value; + var name = wellFormed(field.name); + value = wellFormed(value); + + return name === field.name && value === field.value ? field : { name: name, value: value }; }); } @@ -2394,7 +2408,7 @@ function createSubmission(feature, forms, serialization) { }); // hand off to jQuery.param for proper encoding - return $.param(a); + return $.param(urlencodedFields(a)); }; /** diff --git a/dist/jquery.form.min.js b/dist/jquery.form.min.js index 6a5c91c..7372515 100644 --- a/dist/jquery.form.min.js +++ b/dist/jquery.form.min.js @@ -19,5 +19,5 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. */ -!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof module&&module.exports?module.exports=function(t,r){return void 0===r&&(r="undefined"!=typeof window?require("jquery"):require("jquery")(t)),e(r),r}:e(jQuery)}(function(e){"use strict";var t=["HTMLFormElement","HTMLElement","Element","Node"],r=document.createElement("form");function n(e){for(var r=0;r=0)return r;return null}var l="jqFormSubmitter";function f(e,t,r){try{e[t]=r}catch(e){}}function d(e,t){var r=e[t],n=a(e,"elements");return n&&r&&n.namedItem(t)===r?void 0:r}function p(t,r,n,a){e.data(t,l,{el:r,x:n,y:a}),f(t,"clk",r),"image"===r.type&&(f(t,"clk_x",n),f(t,"clk_y",a)),setTimeout(function(){e.data(t,l,null),f(t,"clk",null),f(t,"clk_x",null),f(t,"clk_y",null)},100)}function m(t){var r=c(t.target,["button","input"]);if(r&&("submit"===r.type||"image"===r.type)){var n=r.form;if(n){var a="image"===r.type?function(t,r){if(void 0!==t.offsetX)return[t.offsetX,t.offsetY];if("function"==typeof e.fn.offset){var n=e(r).offset();return[t.pageX-n.left,t.pageY-n.top]}return[t.pageX-r.offsetLeft,t.pageY-r.offsetTop]}(t,r):[];p(n,r,a[0],a[1])}}}function v(t){if(!t)return null;var r=e.data(t,l);if(r)return r;var n=d(t,"clk");return n?{el:n,x:d(t,"clk_x"),y:d(t,"clk_y")}:null}function h(){if(e.fn.ajaxSubmit.debug){var t="[jquery.form] "+Array.prototype.join.call(arguments,"");window.console&&window.console.log?window.console.log(t):window.opera&&window.opera.postError&&window.opera.postError(t)}}var g={};function y(t,r){e.fn.ajaxSubmit.debug&&!g[t]&&(g[t]=!0,window.console&&"function"==typeof window.console.warn&&window.console.warn("[jquery.form] "+r+" (removed in 5.0)"))}function b(e){(function(e){var t=String(e).split("."),r=Number(t[0]);return r<3||3===r&&Number(t[1])<5})(e)&&y("jquery","support for jQuery "+e+" is deprecated, 5.0 needs jQuery 3.5 or later")}function x(e,t,r,n){if("string"!=typeof e&&!1!==e)return e;var a={url:e,data:t,dataType:r};return"function"==typeof n&&(a.success=n),a}function j(e,t,r,n){return"function"==typeof e?{success:e}:void 0===(e=x(e,t,r,n))?{}:!1===e.url||""===e.url?function(e){var t={};for(var r in e)"url"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}(e):e}function w(e,t){for(var r=0;r"'),e(function(){e(n.s,n.c).ajaxForm(r)}),t):(h("terminating; zero elements found by selector"+(e.isReady?"":" (DOM not ready)")),t)}(this,t))}function L(t){return"string"==typeof t?(D(t),this):(t!==A&&(q={},e(document).off("submit.form-plugin click.form-plugin")),this.off("submit.form-plugin click.form-plugin"))}function M(t,r){if(!u(t))return e(t).attr(r);var n=o(t,"getAttribute",r);return null===n?void 0:n}var N=/\r\n|\r|\n/g,C=/\r/g,I=/^(?:fieldset|object|output)$/;function $(e){return"function"==typeof e.matches?e.matches(":disabled"):!!e.disabled}function P(t){if("select"===i(t))return function(e){var t=e.selectedIndex;if(t<0)return null;for(var r=[],n=e.options,a="select-one"===e.type,o=a?t+1:n.length,i=a?t:0;i=0,o=a?e.responseXML:e.responseText;return a&&"parsererror"===o.documentElement.nodeName&&J.error&&J.error("parsererror"),r&&r.dataFilter&&(o=r.dataFilter(o,t)),"string"==typeof o&&(("json"===t||!t)&&n.indexOf("json")>=0?o=JSON.parse(o):"script"===t&&J.globalEval(o)),o}(t,s,r)}catch(e){i="parsererror",t.error=o=e||i}}catch(e){h("error caught: ",e),i="error",t.error=o=e}return{status:i,data:a,errMsg:o}}var re=e;function ne(e,t){var r,n,a,o=re.Deferred(),i={aborted:0,responseText:null,responseXML:null,status:0,statusText:"n/a",getAllResponseHeaders:function(){},getResponseHeader:function(){},setRequestHeader:function(){},abort:function(e){s(e,[i,"aborted",e])}};function u(){return i.aborted||a}function s(n,a,s){var c=s||("timeout"===n?"timeout":"aborted");u()||(h("aborting upload... "+c),i.aborted=1,t.stop(),i.error=c,e.error&&e.error.call(e.context,i,c,n),o.reject.apply(o,a),r&&re.event.trigger("ajaxError",[i,e,c]),l(c))}function c(){r&&re.event.trigger("ajaxComplete",[i,e]),r&&! --re.active&&re.event.trigger("ajaxStop")}function l(r){e.complete&&e.complete.call(e.context,i,r),c(),clearTimeout(n),setTimeout(function(){t.release(),i.responseXML=null},100)}function f(t){var n=t.status,u=t.errMsg;if(i.aborted)h("upload aborted");else if(i.status&&!(i.status>=200&&i.status<300||304===i.status)&&(n="error"),a=!0,"success"!==n)void 0===u&&(u=i.statusText),e.error&&e.error.call(e.context,i,n,u),o.reject(i,"error",u),r&&re.event.trigger("ajaxError",[i,e,u]),l(n);else{var s=function(t){var n;try{e.success.call(e.context,t,"success",i)}catch(e){n={error:e}}return o.resolve(i.responseText,"success",i),r&&re.event.trigger("ajaxSuccess",[i,e,t]),n}(t.data);if(l(n),s)throw s.error}}return o.abort=function(e){i.abort(e)},{xhr:i,deferred:o,start:function(){return(r=e.global)&&0===re.active++&&re.event.trigger("ajaxStart"),e.beforeSend&&!1===e.beforeSend.call(e.context,i,e)?(u()||(a=!0,o.reject(),r&&re.event.trigger("ajaxError",[i,e,"canceled"]),c()),!1):!i.aborted&&(r&&re.event.trigger("ajaxSend",[i,e]),!i.aborted)},done:u,abort:s,settle:f,fail:function(e){f({status:"error",errMsg:e})},startTimer:function(t){e.timeout&&(n=setTimeout(t,e.timeout))},stopTimer:function(){clearTimeout(n),n=void 0}}}var ae=e;function oe(e,t){var r=0;function n(e){var n=e.form,i=e.method,u=w(ae.extend(!0,{},ae.ajaxSettings,e.options),[ae.ajaxSettings,e.options]);u.context=u.context||u;var s=a(n,"ownerDocument"),l=ae(c(n,["body"])),f=function(e,t,r){var n,a;if(e.iframeTarget)(a=(n=ae(e.iframeTarget,r)).attr("name"))?t=a:(n.attr("name",t),n.each(function(){!function(e,t){try{e.contentWindow&&(e.contentWindow.name=t)}catch(e){}}(this,t)}));else{var o=r.createElement("iframe");o.setAttribute("name",t),o.setAttribute("src",e.iframeSrc),(n=ae(o)).css({position:"absolute",top:"-1000px",left:"-1000px"})}return{$io:n,id:t}}(u,"jqFormIO"+(new Date).getTime()+r++,s),d=f.$io,p=d[0],m=ne(u,function(e,t){return{stop:function(){try{t[0].contentWindow.document.execCommand&&t[0].contentWindow.document.execCommand("Stop")}catch(e){}t.attr("src",e.iframeSrc)},release:function(){e.iframeTarget?t.attr("src",e.iframeSrc):t.remove()}}}(u,d)),v=50;if(!m.start())return m.deferred;function g(){try{var e=Z(p).readyState;h("state = "+e),e&&"uninitialized"===e.toLowerCase()&&setTimeout(g,50)}catch(e){h("Server abort: ",e," (",e.name,")"),x(2),m.stopTimer()}}function y(){var r=function(e){var t={};return Q.each(V,function(r,n){t[n]=o(e,"hasAttribute",n)?o(e,"getAttribute",n):null}),t}(n);!function(e,t,r,n,a){var o="multipart/form-data";G(e,"target",t),!r||/post/i.test(r)?G(e,"method","POST"):_(r)&&!_(a.property(e,"method"))&&G(e,"method","GET"),G(e,"action",n.url),n.skipEncodingOverride||r&&!/post/i.test(r)||(G(e,"encoding",o),G(e,"enctype",o))}(n,f.id,i,u,t),m.startTimer(function(){x(1)});var a=[];try{!function(e,t,r,n,a){function o(r,n){var o=t.createElement("input");o.type="hidden",o.name=r,a.push(Q(o).val(n).appendTo(e)[0])}if(r)for(var i in r)if(B.call(r,i))if(Q.isPlainObject(r[i])&&B.call(r[i],"name")&&B.call(r[i],"value"))o(r[i].name,r[i].value);else{var u={};u[i]=r[i];for(var s=U(u,n),c=0;c=0?"&":"?")+t+e.url.slice(a.length),e.data=null}else e.data=t}(t,a.param(X(v),p),g),{form:c,$form:e,fields:v,controls:h,options:t,method:l,traditional:p}))},deliver:function(e){var t=e.$form,r=e.options,n=[];if(r.resetForm&&n.push(function(){t.resetForm()}),r.clearForm&&n.push(function(){t.clearForm(r.includeHidden)}),!r.dataType&&r.target){var o=l(r.success);n.push(function(e,t,n){var i=arguments,u=r.replaceTarget?"replaceWith":"html",s=a(r.target);"string"==typeof e?s[u](e):h("target: the response was parsed by jQuery, so it is not inserted"),s.length||f(o,this,i),s.each(function(){f(o,this,i)})})}else a.merge(n,l(r.success));if(r.success=function(e,a,o){for(var i=r.context||this,u=0,s=n.length;u0,u=/^[\t\n\f\r ]*multipart\/form-data[\t\n\f\r ]*$/i,s=u.test(r.attribute(n[0],"enctype"))||u.test(r.attribute(n[0],"encoding")),c=t.fileapi&&t.formdata;h("fileAPI :"+c);var l=(i||s)&&!c,f=(i||s)&&c?"formdata":"ajax";if(!1!==o.iframe&&(o.iframe||l)&&(f="iframe"),"iframe"!==f||o.iframe||y("iframe","choosing the iframe transport automatically without FormData is deprecated, set iframe: true"),"ajax"!==f&&"json"===o.requestFormat)throw new Error('jquery.form: requestFormat "json" cannot send files or use the iframe transport');return f}}}!function(e){var t={};t.fileapi=void 0!==e('').get(0).files,t.formdata=void 0!==window.FormData;var r=!!e.fn.prop;var n={attribute:M,property:function(e,t){var n=r?e[t]:void 0;return"string"==typeof n?n:M(e,t)}},a=R(t),u=ie(t,n,a),s={iframe:oe(r,n),formdata:z,ajax:W};e.fn.attr2=function(){if(y("attr2","attr2 is deprecated, use .prop() or .attr()"),!r)return this.attr.apply(this,arguments);var e=this.prop.apply(this,arguments);return e&&e.jquery||"string"==typeof e?e:this.attr.apply(this,arguments)},e.fn.ajaxSubmit=function(t,r,n,a){if(b(e.fn.jquery),!this.length)return h("ajaxSubmit: skipping submit process - no element selected"),this;if(!e.ajax)throw new Error("jquery.form: ajaxSubmit needs the full jQuery build; this jQuery has no $.ajax");var o=u.prepare(this,j(t,r,n,a));if(!o)return this;u.deliver(o);var i=s[u.chooseTransport(o)](o);this.removeData("jqxhr").data("jqxhr",i);for(var c=0;c=0)return r;return null}var l="jqFormSubmitter";function f(e,t,r){try{e[t]=r}catch(e){}}function d(e,t){var r=e[t],n=a(e,"elements");return n&&r&&n.namedItem(t)===r?void 0:r}function p(t,r,n,a){e.data(t,l,{el:r,x:n,y:a}),f(t,"clk",r),"image"===r.type&&(f(t,"clk_x",n),f(t,"clk_y",a)),setTimeout(function(){e.data(t,l,null),f(t,"clk",null),f(t,"clk_x",null),f(t,"clk_y",null)},100)}function m(t){var r=c(t.target,["button","input"]);if(r&&("submit"===r.type||"image"===r.type)){var n=r.form;if(n){var a="image"===r.type?function(t,r){if(void 0!==t.offsetX)return[t.offsetX,t.offsetY];if("function"==typeof e.fn.offset){var n=e(r).offset();return[t.pageX-n.left,t.pageY-n.top]}return[t.pageX-r.offsetLeft,t.pageY-r.offsetTop]}(t,r):[];p(n,r,a[0],a[1])}}}function v(t){if(!t)return null;var r=e.data(t,l);if(r)return r;var n=d(t,"clk");return n?{el:n,x:d(t,"clk_x"),y:d(t,"clk_y")}:null}function h(){if(e.fn.ajaxSubmit.debug){var t="[jquery.form] "+Array.prototype.join.call(arguments,"");window.console&&window.console.log?window.console.log(t):window.opera&&window.opera.postError&&window.opera.postError(t)}}var g={};function y(t,r){e.fn.ajaxSubmit.debug&&!g[t]&&(g[t]=!0,window.console&&"function"==typeof window.console.warn&&window.console.warn("[jquery.form] "+r+" (removed in 5.0)"))}function b(e){(function(e){var t=String(e).split("."),r=Number(t[0]);return r<3||3===r&&Number(t[1])<5})(e)&&y("jquery","support for jQuery "+e+" is deprecated, 5.0 needs jQuery 3.5 or later")}function x(e,t,r,n){if("string"!=typeof e&&!1!==e)return e;var a={url:e,data:t,dataType:r};return"function"==typeof n&&(a.success=n),a}function j(e,t,r,n){return"function"==typeof e?{success:e}:void 0===(e=x(e,t,r,n))?{}:!1===e.url||""===e.url?function(e){var t={};for(var r in e)"url"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}(e):e}function w(e,t){for(var r=0;r"'),e(function(){e(n.s,n.c).ajaxForm(r)}),t):(h("terminating; zero elements found by selector"+(e.isReady?"":" (DOM not ready)")),t)}(this,t))}function L(t){return"string"==typeof t?(q(t),this):(t!==A&&(k={},e(document).off("submit.form-plugin click.form-plugin")),this.off("submit.form-plugin click.form-plugin"))}function M(t,r){if(!u(t))return e(t).attr(r);var n=o(t,"getAttribute",r);return null===n?void 0:n}var C=/\r\n|\r|\n/g,N=/\r/g,I=/^(?:fieldset|object|output)$/;function $(e){return"function"==typeof e.matches?e.matches(":disabled"):!!e.disabled}function P(t){if("select"===i(t))return function(e){var t=e.selectedIndex;if(t<0)return null;for(var r=[],n=e.options,a="select-one"===e.type,o=a?t+1:n.length,i=a?t:0;i=0,o=a?e.responseXML:e.responseText;return a&&"parsererror"===o.documentElement.nodeName&&ee.error&&ee.error("parsererror"),r&&r.dataFilter&&(o=r.dataFilter(o,t)),"string"==typeof o&&(("json"===t||!t)&&n.indexOf("json")>=0?o=JSON.parse(o):"script"===t&&ee.globalEval(o)),o}(t,s,r)}catch(e){i="parsererror",t.error=o=e||i}}catch(e){h("error caught: ",e),i="error",t.error=o=e}return{status:i,data:a,errMsg:o}}var ae=e;function oe(e,t){var r,n,a,o=ae.Deferred(),i={aborted:0,responseText:null,responseXML:null,status:0,statusText:"n/a",getAllResponseHeaders:function(){},getResponseHeader:function(){},setRequestHeader:function(){},abort:function(e){s(e,[i,"aborted",e])}};function u(){return i.aborted||a}function s(n,a,s){var c=s||("timeout"===n?"timeout":"aborted");u()||(h("aborting upload... "+c),i.aborted=1,t.stop(),i.error=c,e.error&&e.error.call(e.context,i,c,n),o.reject.apply(o,a),r&&ae.event.trigger("ajaxError",[i,e,c]),l(c))}function c(){r&&ae.event.trigger("ajaxComplete",[i,e]),r&&! --ae.active&&ae.event.trigger("ajaxStop")}function l(r){e.complete&&e.complete.call(e.context,i,r),c(),clearTimeout(n),setTimeout(function(){t.release(),i.responseXML=null},100)}function f(t){var n=t.status,u=t.errMsg;if(i.aborted)h("upload aborted");else if(i.status&&!(i.status>=200&&i.status<300||304===i.status)&&(n="error"),a=!0,"success"!==n)void 0===u&&(u=i.statusText),e.error&&e.error.call(e.context,i,n,u),o.reject(i,"error",u),r&&ae.event.trigger("ajaxError",[i,e,u]),l(n);else{var s=function(t){var n;try{e.success.call(e.context,t,"success",i)}catch(e){n={error:e}}return o.resolve(i.responseText,"success",i),r&&ae.event.trigger("ajaxSuccess",[i,e,t]),n}(t.data);if(l(n),s)throw s.error}}return o.abort=function(e){i.abort(e)},{xhr:i,deferred:o,start:function(){return(r=e.global)&&0===ae.active++&&ae.event.trigger("ajaxStart"),e.beforeSend&&!1===e.beforeSend.call(e.context,i,e)?(u()||(a=!0,o.reject(),r&&ae.event.trigger("ajaxError",[i,e,"canceled"]),c()),!1):!i.aborted&&(r&&ae.event.trigger("ajaxSend",[i,e]),!i.aborted)},done:u,abort:s,settle:f,fail:function(e){f({status:"error",errMsg:e})},startTimer:function(t){e.timeout&&(n=setTimeout(t,e.timeout))},stopTimer:function(){clearTimeout(n),n=void 0}}}var ie=e;function ue(e,t){var r=0;function n(e){var n=e.form,i=e.method,u=w(ie.extend(!0,{},ie.ajaxSettings,e.options),[ie.ajaxSettings,e.options]);u.context=u.context||u;var s=a(n,"ownerDocument"),l=ie(c(n,["body"])),f=function(e,t,r){var n,a;if(e.iframeTarget)(a=(n=ie(e.iframeTarget,r)).attr("name"))?t=a:(n.attr("name",t),n.each(function(){!function(e,t){try{e.contentWindow&&(e.contentWindow.name=t)}catch(e){}}(this,t)}));else{var o=r.createElement("iframe");o.setAttribute("name",t),o.setAttribute("src",e.iframeSrc),(n=ie(o)).css({position:"absolute",top:"-1000px",left:"-1000px"})}return{$io:n,id:t}}(u,"jqFormIO"+(new Date).getTime()+r++,s),d=f.$io,p=d[0],m=oe(u,function(e,t){return{stop:function(){try{t[0].contentWindow.document.execCommand&&t[0].contentWindow.document.execCommand("Stop")}catch(e){}t.attr("src",e.iframeSrc)},release:function(){e.iframeTarget?t.attr("src",e.iframeSrc):t.remove()}}}(u,d)),v=50;if(!m.start())return m.deferred;function g(){try{var e=te(p).readyState;h("state = "+e),e&&"uninitialized"===e.toLowerCase()&&setTimeout(g,50)}catch(e){h("Server abort: ",e," (",e.name,")"),x(2),m.stopTimer()}}function y(){var r=function(e){var t={};return V.each(_,function(r,n){t[n]=o(e,"hasAttribute",n)?o(e,"getAttribute",n):null}),t}(n);!function(e,t,r,n,a){var o="multipart/form-data";Z(e,"target",t),!r||/post/i.test(r)?Z(e,"method","POST"):Y(r)&&!Y(a.property(e,"method"))&&Z(e,"method","GET"),Z(e,"action",n.url),n.skipEncodingOverride||r&&!/post/i.test(r)||(Z(e,"encoding",o),Z(e,"enctype",o))}(n,f.id,i,u,t),m.startTimer(function(){x(1)});var a=[];try{!function(e,t,r,n,a){function o(r,n){var o=t.createElement("input");o.type="hidden",o.name=r,a.push(V(o).val(n).appendTo(e)[0])}if(r)for(var i in r)if(K.call(r,i))if(V.isPlainObject(r[i])&&K.call(r[i],"name")&&K.call(r[i],"value"))o(r[i].name,r[i].value);else{var u={};u[i]=r[i];for(var s=W(u,n),c=0;c=0?"&":"?")+t+e.url.slice(a.length),e.data=null}else e.data=t}(t,a.param(H(v),p),g),{form:c,$form:e,fields:v,controls:h,options:t,method:l,traditional:p}))},deliver:function(e){var t=e.$form,r=e.options,n=[];if(r.resetForm&&n.push(function(){t.resetForm()}),r.clearForm&&n.push(function(){t.clearForm(r.includeHidden)}),!r.dataType&&r.target){var o=l(r.success);n.push(function(e,t,n){var i=arguments,u=r.replaceTarget?"replaceWith":"html",s=a(r.target);"string"==typeof e?s[u](e):h("target: the response was parsed by jQuery, so it is not inserted"),s.length||f(o,this,i),s.each(function(){f(o,this,i)})})}else a.merge(n,l(r.success));if(r.success=function(e,a,o){for(var i=r.context||this,u=0,s=n.length;u0,u=/^[\t\n\f\r ]*multipart\/form-data[\t\n\f\r ]*$/i,s=u.test(r.attribute(n[0],"enctype"))||u.test(r.attribute(n[0],"encoding")),c=t.fileapi&&t.formdata;h("fileAPI :"+c);var l=(i||s)&&!c,f=(i||s)&&c?"formdata":"ajax";if(!1!==o.iframe&&(o.iframe||l)&&(f="iframe"),"iframe"!==f||o.iframe||y("iframe","choosing the iframe transport automatically without FormData is deprecated, set iframe: true"),"ajax"!==f&&"json"===o.requestFormat)throw new Error('jquery.form: requestFormat "json" cannot send files or use the iframe transport');return f}}}!function(e){var t={};t.fileapi=void 0!==e('').get(0).files,t.formdata=void 0!==window.FormData;var r=!!e.fn.prop;var n={attribute:M,property:function(e,t){var n=r?e[t]:void 0;return"string"==typeof n?n:M(e,t)}},a=U(t),u=se(t,n,a),s={iframe:ue(r,n),formdata:B,ajax:Q};e.fn.attr2=function(){if(y("attr2","attr2 is deprecated, use .prop() or .attr()"),!r)return this.attr.apply(this,arguments);var e=this.prop.apply(this,arguments);return e&&e.jquery||"string"==typeof e?e:this.attr.apply(this,arguments)},e.fn.ajaxSubmit=function(t,r,n,a){if(b(e.fn.jquery),!this.length)return h("ajaxSubmit: skipping submit process - no element selected"),this;if(!e.ajax)throw new Error("jquery.form: ajaxSubmit needs the full jQuery build; this jQuery has no $.ajax");var o=u.prepare(this,j(t,r,n,a));if(!o)return this;u.deliver(o);var i=s[u.chooseTransport(o)](o);this.removeData("jqxhr").data("jqxhr",i);for(var c=0;c= 0) {\n return node;\n }\n }\n\n return null;\n}\n","import { closestByTag, formMember } from \"./form-members.js\";\nimport jQuery from \"jquery\";\n\n// The submitter: the button that submitted a form, captured from ajaxForm's clicks. It is kept in\n// a private store and cleared shortly after the click. The form's clk, clk_x and clk_y properties\n// are still written for pages that read them, and read when the store has none.\n\nvar storeKey = \"jqFormSubmitter\";\n\n// Writes a property on the form; a control with that name makes it read-only.\nfunction setExpando(form, name, value) {\n try {\n form[name] = value;\n } catch (ignore) {\n // the control keeps the name; the store has the submitter\n }\n}\n\n// A property the page set on the form, never a control of the form with that name.\nfunction expando(form, name) {\n var value = form[name];\n var els = formMember(form, \"elements\");\n\n return els && value && els.namedItem(name) === value ? undefined : value;\n}\n\n// Records a submitter for a form until the click window ends.\nfunction record(form, el, x, y) {\n jQuery.data(form, storeKey, { el: el, x: x, y: y });\n setExpando(form, \"clk\", el);\n\n if (el.type === \"image\") {\n setExpando(form, \"clk_x\", x);\n setExpando(form, \"clk_y\", y);\n }\n\n // clear form vars\n setTimeout(function () {\n jQuery.data(form, storeKey, null);\n setExpando(form, \"clk\", null);\n setExpando(form, \"clk_x\", null);\n setExpando(form, \"clk_y\", null);\n }, 100);\n}\n\n// The clicked point of an image button, relative to the image.\nfunction imagePoint(e, target) {\n if (typeof e.offsetX !== \"undefined\") {\n return [e.offsetX, e.offsetY];\n }\n\n if (typeof jQuery.fn.offset === \"function\") {\n var offset = jQuery(target).offset();\n\n return [e.pageX - offset.left, e.pageY - offset.top];\n }\n\n return [e.pageX - target.offsetLeft, e.pageY - target.offsetTop];\n}\n\n/**\n * Records the submit or image button a click event reached, for the form it belongs to.\n */\nexport function captureSubmitter(e) {\n // the clicked control, or the button around the clicked content (ex: a span within a button)\n var target = closestByTag(e.target, [\"button\", \"input\"]);\n\n // the type property, unlike the attribute, is \"submit\" for a button without a type (#588)\n if (!target || (target.type !== \"submit\" && target.type !== \"image\")) {\n return;\n }\n\n var form = target.form;\n\n if (!form) {\n // a submit control that belongs to no form\n return;\n }\n\n var point = target.type === \"image\" ? imagePoint(e, target) : [];\n\n record(form, target, point[0], point[1]);\n}\n\n/**\n * Records the submitter a submit event names (SubmitEvent.submitter), when no click was captured.\n * An image submitter gets the point 0,0, as native submission sends it without a click.\n */\nexport function captureEventSubmitter(e, form) {\n var el = e.originalEvent && e.originalEvent.submitter;\n\n if (el && !submitterOf(form)) {\n record(form, el, 0, 0);\n }\n}\n\n/**\n * The form's submitter as { el, x, y } (x and y for an image button), or null.\n */\nexport function submitterOf(form) {\n if (!form) {\n return null;\n }\n\n var stored = jQuery.data(form, storeKey);\n\n if (stored) {\n return stored;\n }\n\n var el = expando(form, \"clk\");\n\n return el ? { el: el, x: expando(form, \"clk_x\"), y: expando(form, \"clk_y\") } : null;\n}\n\n/**\n * The submitter's fields for a post that adds them itself (the iframe upload), as name β†’ value.\n */\nexport function submitterFields(form) {\n var fields = {};\n var sub = submitterOf(form);\n var el = sub && sub.el;\n\n if (el && el.name && !el.disabled) {\n fields[el.name] = el.value;\n if (el.type === \"image\") {\n fields[el.name + \".x\"] = sub.x;\n fields[el.name + \".y\"] = sub.y;\n }\n }\n\n return fields;\n}\n\n/**\n * The form's submitter element, or null.\n */\nexport function submitterElement(form) {\n var sub = submitterOf(form);\n\n return sub ? sub.el : null;\n}\n","import jQuery from \"jquery\";\n\n// Debug logging, switched on by $.fn.ajaxSubmit.debug. The flag is read on every call, so it can\n// be turned on after the plugin loads.\nexport function log() {\n if (!jQuery.fn.ajaxSubmit.debug) {\n return;\n }\n\n var msg = \"[jquery.form] \" + Array.prototype.join.call(arguments, \"\");\n\n if (window.console && window.console.log) {\n window.console.log(msg);\n } else if (window.opera && window.opera.postError) {\n window.opera.postError(msg);\n }\n}\n\nvar warned = {};\n\n/**\n * A deprecation warning: console.warn, only while debug is on, once per id per page. The message\n * names the replacement; the warning adds that the feature is removed in 5.0.\n */\nexport function deprecate(id, message) {\n if (!jQuery.fn.ajaxSubmit.debug || warned[id]) {\n return;\n }\n\n warned[id] = true;\n\n if (window.console && typeof window.console.warn === \"function\") {\n window.console.warn(\"[jquery.form] \" + message + \" (removed in 5.0)\");\n }\n}\n\n// Forgets which deprecations have warned (for tests).\nexport function resetDeprecations() {\n warned = {};\n}\n\n// True for a jQuery version string older than 3.5.\nexport function beforeJQuery35(version) {\n var parts = String(version).split(\".\");\n var major = Number(parts[0]);\n\n return major < 3 || (major === 3 && Number(parts[1]) < 5);\n}\n\n// 5.0 needs jQuery 3.5 or later: warned on the first ajaxSubmit or ajaxForm, given jQuery's version.\nexport function deprecateOldJQuery(version) {\n if (beforeJQuery35(version)) {\n deprecate(\n \"jquery\",\n \"support for jQuery \" + version + \" is deprecated, 5.0 needs jQuery 3.5 or later\"\n );\n }\n}\n","// The arguments ajaxSubmit and ajaxForm accept in place of an options object.\n\n/**\n * Turns the (url, data, dataType, success) shorthand into options. A url of false is kept as\n * the url; anything else is returned as given.\n */\nexport function shorthandOptions(options, data, dataType, onSuccess) {\n if (typeof options !== \"string\" && options !== false) {\n return options;\n }\n\n var result = { url: options, data: data, dataType: dataType };\n\n if (typeof onSuccess === \"function\") {\n result.success = onSuccess;\n }\n\n return result;\n}\n\n// A copy of options without its url, so the form action is used.\nfunction withoutUrl(options) {\n var result = {};\n\n for (var key in options) {\n if (key !== \"url\" && Object.prototype.hasOwnProperty.call(options, key)) {\n result[key] = options[key];\n }\n }\n\n return result;\n}\n\n/**\n * The options ajaxSubmit starts from: a function is the success callback, the shorthand is\n * expanded, and no options at all is an empty object. A url of false or \"\" means the form action.\n */\nexport function submitOptions(options, data, dataType, onSuccess) {\n if (typeof options === \"function\") {\n return { success: options };\n }\n\n options = shorthandOptions(options, data, dataType, onSuccess);\n\n if (typeof options === \"undefined\") {\n return {};\n }\n\n return options.url === false || options.url === \"\" ? withoutUrl(options) : options;\n}\n\n/**\n * jQuery treats `context` as a flat option: after a deep merge, the settings get back the\n * caller's own object from the last source that has one, so `this` in callbacks is that object.\n */\nexport function keepContext(settings, sources) {\n for (var i = 0; i < sources.length; i++) {\n if (sources[i].context !== undefined) {\n settings.context = sources[i].context;\n }\n }\n\n return settings;\n}\n","import { assertRealParent, closestByTag, formMember, isElement } from \"./form-members.js\";\nimport { captureEventSubmitter, captureSubmitter } from \"./submitter.js\";\nimport { deprecate, deprecateOldJQuery, log } from \"./diagnostics.js\";\nimport jQuery from \"jquery\";\nimport { shorthandOptions } from \"./options.js\";\n\n// ajaxForm binding: the submit and click handlers that send a form through ajaxSubmit. The\n// handlers look up $.fn.ajaxSubmit when they run, so a replacement installed later is used.\n\n// Sends the submit event's form with ajaxSubmit, unless an earlier handler cancelled it.\nfunction submitWith(e, options) {\n if (!e.isDefaultPrevented()) {\n // if event has been canceled, don't proceed\n e.preventDefault();\n // the form is found through the real tree: a control named nodeType misleads jQuery's closest\n var form = closestByTag(e.target, [\"form\"]);\n\n // a button outside the form (form attribute), or requestSubmit(button), sends no click here\n captureEventSubmitter(e, form);\n jQuery(form).ajaxSubmit(options); // #365\n }\n}\n\nfunction doAjaxSubmit(e) {\n submitWith(e, e.data);\n}\n\nfunction captureSubmittingElement(e) {\n /* jshint validthis:true */\n assertRealParent(this);\n captureSubmitter(e);\n}\n\n// An empty selection: queued until the DOM is ready (old jQuery keeps the selector), or dropped.\nfunction bindLater($sel, options) {\n var o = { s: $sel.selector, c: $sel.context };\n\n if (!jQuery.isReady && o.s) {\n log(\"DOM not ready, queuing ajaxForm\");\n deprecate(\n \"queue\",\n \"queuing ajaxForm until the DOM is ready is deprecated, call ajaxForm inside $(fn) \" +\n 'or use delegation: \"\"'\n );\n jQuery(function () {\n jQuery(o.s, o.c).ajaxForm(options);\n });\n\n return $sel;\n }\n\n // is your DOM ready? http://docs.jquery.com/Tutorials:Introducing_$(document).ready()\n log(\"terminating; zero elements found by selector\" + (jQuery.isReady ? \"\" : \" (DOM not ready)\"));\n\n return $sel;\n}\n\n// delegation: true on jQuery 3 and later, where the selection has no selector: always warned,\n// debug or not, once per ajaxForm call.\nfunction warnUnscoped() {\n var console = window.console || {};\n\n if (typeof console.warn === \"function\") {\n console.warn(\n \"[jquery.form] delegation: true binds every form on the page on jQuery 3 and later; \" +\n 'pass a selector instead, e.g. delegation: \"form.ajax\"'\n );\n }\n}\n\nfunction bindDelegated($sel, options) {\n if ($sel.selector === undefined) {\n warnUnscoped();\n }\n\n jQuery(document)\n .off(\"submit.form-plugin\", $sel.selector, doAjaxSubmit)\n .off(\"click.form-plugin\", $sel.selector, captureSubmittingElement)\n .on(\"submit.form-plugin\", $sel.selector, options, doAjaxSubmit)\n .on(\"click.form-plugin\", $sel.selector, options, captureSubmittingElement);\n\n return $sel;\n}\n\n// The element itself or its nearest ancestor that matches the selector. The walk never reads a\n// parentNode a control can hide (jQuery's delegated walk does, and cycles on such a form).\nfunction closestMatch(el, selector) {\n if (!isElement(el)) {\n return null;\n }\n\n if (window.Element && Element.prototype.closest) {\n return Element.prototype.closest.call(el, selector);\n }\n\n for (var node = el; node && isElement(node); node = formMember(node, \"parentNode\")) {\n if (jQuery(node).is(selector)) {\n return node;\n }\n }\n\n return null;\n}\n\n// The document handlers bound for each delegation selector, keyed by \"s\" + selector.\nvar delegated = {};\n\nfunction unbindSelector(selector) {\n var handlers = delegated[\"s\" + selector];\n\n if (handlers) {\n jQuery(document)\n .off(\"submit.form-plugin\", handlers.submit)\n .off(\"click.form-plugin\", handlers.click);\n delete delegated[\"s\" + selector];\n }\n}\n\n// delegation: \"\": one handler pair on the document, scoped to the selector.\nfunction bindSelector($sel, selector, options) {\n if (!selector) {\n throw new Error(\"jquery.form: delegation needs a selector, or true\");\n }\n\n var handlers = {\n submit: function (e) {\n if (closestMatch(e.target, selector)) {\n submitWith(e, options);\n }\n },\n click: function (e) {\n if (closestMatch(e.target, selector)) {\n captureSubmitter(e);\n }\n },\n };\n\n unbindSelector(selector);\n delegated[\"s\" + selector] = handlers;\n jQuery(document)\n .on(\"submit.form-plugin\", handlers.submit)\n .on(\"click.form-plugin\", handlers.click);\n\n return $sel;\n}\n\n// Passed by ajaxForm's own rebind: unbind the selection only, never the document handlers.\nvar selectionOnly = {};\n\n/**\n * ajaxForm() binds the selected forms so a submit is sent with ajaxSubmit, with the clicked\n * submit button (and image coordinates) included. The options work as for ajaxSubmit.\n */\nexport function ajaxForm(options, data, dataType, onSuccess) {\n deprecateOldJQuery(jQuery.fn.jquery);\n options = shorthandOptions(options, data, dataType, onSuccess) || {};\n\n if (typeof options.delegation === \"string\") {\n return bindSelector(this, options.delegation, options);\n }\n\n options.delegation = options.delegation && typeof jQuery.fn.on === \"function\";\n\n if (!options.delegation && this.length === 0) {\n return bindLater(this, options);\n }\n\n if (options.delegation) {\n return bindDelegated(this, options);\n }\n\n if (options.beforeFormUnbind) {\n options.beforeFormUnbind(this, options);\n }\n\n return this.ajaxFormUnbind(selectionOnly)\n .on(\"submit.form-plugin\", options, doAjaxSubmit)\n .on(\"click.form-plugin\", options, captureSubmittingElement);\n}\n\n/**\n * ajaxFormUnbind() removes the handlers ajaxForm bound on the selection and every delegated\n * binding on the document. ajaxFormUnbind(selector) removes only that delegation selector.\n */\nexport function ajaxFormUnbind(selector) {\n if (typeof selector === \"string\") {\n unbindSelector(selector);\n\n return this;\n }\n\n if (selector !== selectionOnly) {\n delegated = {};\n jQuery(document).off(\"submit.form-plugin click.form-plugin\");\n }\n\n return this.off(\"submit.form-plugin click.form-plugin\");\n}\n","import { callFormMethod, isElement } from \"./form-members.js\";\nimport jQuery from \"jquery\";\n\n/**\n * An attribute of a form, or undefined when it is absent, as jQuery's attr returns it. The\n * subject may also be the document or a plain object, read through jQuery.\n */\nexport function formAttribute(form, name) {\n if (!isElement(form)) {\n return jQuery(form).attr(name);\n }\n\n var value = callFormMethod(form, \"getAttribute\", name);\n\n return value === null ? undefined : value;\n}\n","import { callFormMethod, formMember, isElement, tagName } from \"./form-members.js\";\nimport { formAttribute } from \"./form-attributes.js\";\nimport jQuery from \"jquery\";\nimport { submitterOf } from \"./submitter.js\";\n\n// Successful controls: which controls of a form are sent, and as which name/value fields\n// (https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#constructing-the-form-data-set).\n\n// Line breaks, sent as CRLF\nvar rLineBreak = /\\r\\n|\\r|\\n/g;\nvar rCR = /\\r/g;\n\n// Listed form elements that are never submitted.\nvar rUnsubmittable = /^(?:fieldset|object|output)$/;\n\n/**\n * Whether a control or option is disabled, also through a disabled fieldset or optgroup. Without\n * selector matching, only its own disabled property is read.\n */\nfunction isDisabled(el) {\n return typeof el.matches === \"function\" ? el.matches(\":disabled\") : !!el.disabled;\n}\n\n/**\n * The successful-control rule: whether a control is sent. `submitter` is the button that\n * submitted the control's form; other submit and image buttons of a form are not sent.\n */\nexport function isSuccessful(el, submitter) {\n var t = el.type;\n\n if (!el.name || isDisabled(el) || t === \"reset\" || t === \"button\") {\n return false;\n }\n\n if (t === \"checkbox\" || t === \"radio\") {\n return !!el.checked;\n }\n\n if (t === \"submit\" || t === \"image\") {\n return !el.form || submitter === el;\n }\n\n return tagName(el) !== \"select\" || el.selectedIndex !== -1;\n}\n\n// The value of a select: the selected option's value for one, a list for several.\nfunction selectValue(el) {\n var index = el.selectedIndex;\n\n if (index < 0) {\n return null;\n }\n\n var a = [],\n ops = el.options;\n var one = el.type === \"select-one\";\n var max = one ? index + 1 : ops.length;\n\n for (var i = one ? index : 0; i < max; i++) {\n var op = ops[i];\n\n if (op.selected && !isDisabled(op)) {\n var v = op.value;\n\n if (!v) {\n // extra pain for IE...\n v =\n op.attributes && op.attributes.value && !op.attributes.value.specified\n ? op.text\n : op.value;\n }\n\n if (one) {\n return v;\n }\n\n a.push(v);\n }\n }\n\n return a;\n}\n\n/**\n * The value of a control, whether or not it is successful: a list for a multiple select, null\n * for a select with nothing selected, otherwise a string with CRLF line breaks (a lone CR or LF\n * included).\n */\nexport function valueOf(el) {\n if (tagName(el) === \"select\") {\n return selectValue(el);\n }\n\n var v = jQuery(el).val();\n var raw = el.value;\n\n // jQuery before 4.0 drops carriage returns from .val(); read them from the value itself\n if (typeof raw === \"string\" && raw.replace(rCR, \"\") === v) {\n v = raw;\n }\n\n return v.replace(rLineBreak, \"\\r\\n\");\n}\n\n/**\n * The fields as a urlencoded body sends them: a selected file as its name.\n */\nexport function urlencodedFields(fields) {\n return jQuery.map(fields, function (field) {\n return field.type === \"file\" && typeof field.value !== \"string\"\n ? { name: field.name, value: field.value.name }\n : field;\n });\n}\n\n/**\n * The serialization steps. `feature` holds what the entry detected at load (fileapi).\n */\nexport function createSuccessfulControls(feature) {\n var $ = jQuery;\n\n // #386; inputs that name the form in their form attribute, other than the candidates found.\n // A form only gets the ones it owns.\n function outsideControls(formId, els, owner) {\n // hat tip @thet; the id is compared, never built into a selector\n return $(\":input[form]\")\n .filter(function () {\n return (\n this.getAttribute(\"form\") === formId &&\n (!owner || this.form === owner) &&\n $.inArray(this, els) < 0\n );\n })\n .get();\n }\n\n // A descendant of a form is a candidate unless it is a control another form owns.\n function ownedBy(els, owner) {\n return $.grep(els, function (el) {\n return typeof el.form === \"undefined\" || el.form === owner;\n });\n }\n\n /**\n * The candidate controls of a form, in order: its elements, or every descendant it owns in\n * semantic mode, then the outside controls it owns that name it.\n */\n function controlsOf(form, semantic) {\n var formId = formAttribute(form, \"id\");\n var els = formMember(form, \"elements\");\n\n if (semantic || typeof els === \"undefined\") {\n // the document is not an element; it has its own getElementsByTagName\n els = isElement(form)\n ? callFormMethod(form, \"getElementsByTagName\", \"*\")\n : form.getElementsByTagName(\"*\");\n }\n\n els = $.makeArray(els);\n\n // the subject may also be a fieldset, the document or another container\n var owner = tagName(form) === \"form\" ? form : null;\n\n if (semantic && owner) {\n els = ownedBy(els, owner);\n }\n\n // FinesseRus: in non-IE browsers outside fields are already included in form.elements.\n if (formId && (semantic || /(Edge|Trident)\\//.test(navigator.userAgent))) {\n els = els.concat(outsideControls(formId, els, owner));\n }\n\n return els;\n }\n\n // The fields of a control's value, or null when the control is not sent.\n function fieldsOf(el) {\n var n = el.name;\n // read at call time, so a page that replaces $.fieldValue changes what is sent\n var v = $.fieldValue(el, true);\n\n if (v && v.constructor === Array) {\n return $.map(v, function (value) {\n return { name: n, value: value };\n });\n }\n\n if (feature.fileapi && el.type === \"file\") {\n var files = el.files;\n\n // #180: an empty field when no file is selected\n return files.length\n ? $.map(files, function (file) {\n return { name: n, value: file, type: el.type };\n })\n : [{ name: n, value: \"\", type: el.type }];\n }\n\n if (v === null || typeof v === \"undefined\") {\n return null;\n }\n\n return [{ name: n, value: v, type: el.type, required: el.required }];\n }\n\n // The clicked image's value and coordinates.\n function imageFields(sub, input, type) {\n var n = input.name;\n var value = { name: n, value: $(input).val() };\n\n if (type) {\n value.type = type;\n }\n\n return [value, { name: n + \".x\", value: sub.x }, { name: n + \".y\", value: sub.y }];\n }\n\n // Adds one candidate control's fields, and the control when it has a value to send.\n function addCandidate(collected, form, el, semantic) {\n if (!el.name || isDisabled(el) || rUnsubmittable.test(tagName(el))) {\n return;\n }\n\n var sub = semantic && el.type === \"image\" && submitterOf(form);\n\n if (sub) {\n // handle image inputs on the fly when semantic == true\n if (sub.el === el) {\n collected.fields.push.apply(collected.fields, imageFields(sub, el, el.type));\n }\n\n return;\n }\n\n var own = fieldsOf(el);\n\n if (own) {\n collected.controls.push(el);\n collected.fields.push.apply(collected.fields, own);\n }\n }\n\n // input type=='image' are not found in elements array! handle it here\n function addClickedImage(collected, form) {\n var sub = submitterOf(form);\n var input = sub && $(sub.el)[0];\n\n if (input && input.name && !isDisabled(input) && input.type === \"image\") {\n collected.fields.push.apply(collected.fields, imageFields(sub, input));\n }\n }\n\n /**\n * The fields of a form, as formToArray returns them, and the controls they came from.\n */\n function collect(form, semantic, filtering) {\n var collected = { fields: [], controls: [] };\n\n if (!form) {\n return collected;\n }\n\n var els = controlsOf(form, semantic);\n\n if (typeof filtering === \"function\") {\n els = $.map(els, filtering);\n }\n\n for (var i = 0; i < els.length; i++) {\n addCandidate(collected, form, els[i], semantic);\n }\n\n if (!semantic) {\n addClickedImage(collected, form);\n }\n\n return collected;\n }\n\n return {\n controlsOf: controlsOf,\n fieldsOf: fieldsOf,\n collect: collect,\n };\n}\n","import jQuery from \"jquery\";\nimport { keepContext } from \"./options.js\";\n\n// The XMLHttpRequest transports: $.ajax with the encoded fields, or FormData for file uploads.\nvar $ = jQuery;\n\n// utility fn for deep serialization: [name, value] pairs, as $.param encodes them\nexport function deepSerialize(extraData, traditional) {\n var param = $.param(extraData, traditional);\n var serialized = param ? param.split(\"&\") : [];\n var len = serialized.length;\n var result = [];\n var i, part;\n\n for (i = 0; i < len; i++) {\n // #252; undo param space replacement\n serialized[i] = serialized[i].replace(/\\+/g, \" \");\n part = serialized[i].split(\"=\");\n // #278; use array instead of object storage, favoring array serializations\n result.push([decodeURIComponent(part[0]), decodeURIComponent(part[1])]);\n }\n\n return result;\n}\n\n/**\n * Posts the fields and extraData as FormData, for files with the File API.\n * XMLHttpRequest Level 2 file uploads (big hat tip to francois2metz)\n */\nexport function sendFormData(submission) {\n var options = submission.options;\n var a = submission.fields;\n\n var formdata = new FormData();\n\n for (var i = 0; i < a.length; i++) {\n formdata.append(a[i].name, a[i].value);\n }\n\n if (options.extraData) {\n var serializedData = deepSerialize(options.extraData, submission.traditional);\n\n for (i = 0; i < serializedData.length; i++) {\n formdata.append(serializedData[i][0], serializedData[i][1]);\n }\n }\n\n options.data = null;\n\n var s = $.extend(true, {}, $.ajaxSettings, options, {\n contentType: false,\n processData: false,\n cache: false,\n type: submission.method || \"POST\",\n });\n\n keepContext(s, [$.ajaxSettings, options]);\n\n if (options.uploadProgress) {\n // workaround because jqXHR does not expose upload property: wraps the xhr factory, the\n // caller's or jQuery's\n var createXhr = s.xhr;\n\n s.xhr = function () {\n var xhr = createXhr.call(this);\n\n if (xhr.upload) {\n xhr.upload.addEventListener(\n \"progress\",\n function (event) {\n var percent = 0;\n // event.position is the deprecated name, read only when loaded is missing\n var position = event.loaded !== undefined ? event.loaded : event.position;\n var total = event.total;\n\n if (event.lengthComputable) {\n percent = Math.ceil((position / total) * 100);\n }\n\n options.uploadProgress(event, position, total, percent);\n },\n false\n );\n }\n\n return xhr;\n };\n }\n\n s.data = null;\n\n var beforeSend = s.beforeSend;\n\n s.beforeSend = function (xhr, o) {\n // Send FormData() provided by user\n if (options.formData) {\n o.data = options.formData;\n } else {\n o.data = formdata;\n }\n\n // a veto (false) cancels the upload, as on the other transports\n return beforeSend ? beforeSend.call(this, xhr, o) : undefined;\n };\n\n return $.ajax(s);\n}\n\n/**\n * Sends the encoded fields with $.ajax.\n */\nexport function sendAjax(submission) {\n return $.ajax(submission.options);\n}\n","import { callFormMethod } from \"./form-members.js\";\nimport { deepSerialize } from \"./xhr-transport.js\";\nimport jQuery from \"jquery\";\nimport { submitterFields } from \"./submitter.js\";\n\n// The iframe form post: the extra fields (submitter, CSRF, data), the form attributes set while\n// posting and restored after, and the native submit.\nvar $ = jQuery;\n\n// The form attributes an iframe upload changes while it posts.\nvar uploadAttributes = [\"action\", \"target\", \"method\", \"enctype\", \"encoding\"];\n\n// Called through the prototype: an extraData key or a form field may be named hasOwnProperty.\nvar hasOwn = Object.prototype.hasOwnProperty;\n\nfunction isGet(method) {\n return /^get$/i.test(method);\n}\n\n// Resolves both URLs through anchors, as jQuery does for crossDomain, so IE's anchor quirks\n// apply to both sides of the comparison.\nfunction isSameOrigin(url) {\n var origin = document.createElement(\"a\");\n var target = document.createElement(\"a\");\n\n origin.href = window.location.href;\n target.href = url;\n // IE fills in the host of a relative URL only once the resolved href is assigned back\n target.href = target.href; // eslint-disable-line no-self-assign\n\n return origin.protocol + \"//\" + origin.host === target.protocol + \"//\" + target.host;\n}\n\n/** Adds the clicked submitter (and an image's coordinates) to s.extraData. */\nexport function addSubmitterFields(s, form) {\n // add submitting element to data if we know it\n var fields = submitterFields(form);\n\n for (var n in fields) {\n s.extraData = s.extraData || {};\n s.extraData[n] = fields[n];\n }\n}\n\n/** Adds the page's CSRF token to s.extraData when the form is posted to the page's origin. */\nexport function addCsrfField(s, form, method, forms) {\n // Rails CSRF hack (thanks to Yvan Barthelemy); like jquery-ujs, only for the page's origin and\n // only when the form is posted, since a get form would put the token in the url\n var csrf_token = $(\"meta[name=csrf-token]\").attr(\"content\");\n var csrf_param = $(\"meta[name=csrf-param]\").attr(\"content\");\n var posts =\n !isGet(method) &&\n (!method || /post/i.test(method) || /post/i.test(forms.property(form, \"method\")));\n\n if (csrf_param && csrf_token && posts && isSameOrigin(s.url)) {\n s.extraData = s.extraData || {};\n s.extraData[csrf_param] = csrf_token;\n }\n}\n\nfunction setFormAttribute(form, name, value) {\n callFormMethod(form, \"setAttribute\", name, value);\n}\n\n/** The raw attributes the upload changes, null when absent, to put back exactly (#380). */\nexport function saveAttributes(form) {\n var saved = {};\n\n $.each(uploadAttributes, function (i, name) {\n saved[name] = callFormMethod(form, \"hasAttribute\", name)\n ? callFormMethod(form, \"getAttribute\", name)\n : null;\n });\n\n return saved;\n}\n\n/** Puts back the attributes saveAttributes recorded, removing those that were absent. */\nexport function restoreAttributes(form, saved) {\n $.each(uploadAttributes, function (i, name) {\n if (saved[name] === null) {\n callFormMethod(form, \"removeAttribute\", name);\n } else {\n setFormAttribute(form, name, saved[name]);\n }\n });\n}\n\n/** Points the form at the frame `target` with the upload's url, method and encoding. */\nexport function setUploadAttributes(form, target, method, s, forms) {\n var mp = \"multipart/form-data\";\n\n // update form attrs in IE friendly way\n setFormAttribute(form, \"target\", target);\n if (!method || /post/i.test(method)) {\n setFormAttribute(form, \"method\", \"POST\");\n } else if (isGet(method) && !isGet(forms.property(form, \"method\"))) {\n // a form posts natively only with GET or POST; other verbs keep the form's own method\n setFormAttribute(form, \"method\", \"GET\");\n }\n setFormAttribute(form, \"action\", s.url);\n\n // ie borks in some cases when setting encoding\n if (!s.skipEncodingOverride && (!method || /post/i.test(method))) {\n setFormAttribute(form, \"encoding\", mp);\n setFormAttribute(form, \"enctype\", mp);\n }\n}\n\n/** Appends a hidden input per extraData field to the form; each input is pushed onto `added`. */\nexport function addExtraInputs(form, ownerDocument, extraData, traditional, added) {\n // Builds the input with DOM properties: a name is never parsed as HTML.\n function addHiddenInput(name, value) {\n var input = ownerDocument.createElement(\"input\");\n\n input.type = \"hidden\";\n input.name = name;\n added.push($(input).val(value).appendTo(form)[0]);\n }\n\n if (extraData) {\n for (var n in extraData) {\n if (hasOwn.call(extraData, n)) {\n // if using the $.param format that allows for multiple values with the same name\n if (\n $.isPlainObject(extraData[n]) &&\n hasOwn.call(extraData[n], \"name\") &&\n hasOwn.call(extraData[n], \"value\")\n ) {\n addHiddenInput(extraData[n].name, extraData[n].value);\n } else {\n // arrays and objects become one field per value, as $.param sends them (#597)\n var single = {};\n\n single[n] = extraData[n];\n var fields = deepSerialize(single, traditional);\n\n for (var f = 0; f < fields.length; f++) {\n addHiddenInput(fields[f][0], fields[f][1]);\n }\n }\n }\n }\n }\n}\n\n/** Submits the form natively, even when a control named submit hides the method. */\nexport function submitForm(form) {\n try {\n form.submit();\n } catch (err) {\n // just in case form has element with name/id of 'submit'\n callFormMethod(form, \"submit\");\n }\n}\n","import jQuery from \"jquery\";\nimport { log } from \"./diagnostics.js\";\n\n// The iframe response reader: turns the frame's document into the mock xhr's text, XML, status\n// and dataType, then parses it as $.ajax would (dataFilter, JSON, script).\nvar $ = jQuery;\n\n/** The frame's document, or null when the browser denies access to it. */\nexport function getDoc(frame) {\n /* it looks like contentWindow or contentDocument do not\n * carry the protocol property in ie8, when running under ssl\n * frame.document is the only valid response document, since\n * the protocol is know but not on the other two objects. strange?\n * \"Same origin policy\" http://en.wikipedia.org/wiki/Same_origin_policy\n */\n\n var doc = null;\n\n // IE8 cascading access check\n try {\n if (frame.contentWindow) {\n doc = frame.contentWindow.document;\n }\n } catch (err) {\n // IE8 access denied under ssl & missing protocol\n log(\"cannot get iframe.contentWindow document: \" + err);\n }\n\n if (doc) {\n // successful getting content\n return doc;\n }\n\n try {\n // simply checking may throw in ie8 under ssl or mismatched protocol\n doc = frame.contentDocument ? frame.contentDocument : frame.document;\n } catch (err) {\n // last attempt\n log(\"cannot get iframe.contentDocument: \" + err);\n doc = frame.document;\n }\n\n return doc;\n}\n\n/** Parses the response text or XML for the given (lowercase) dataType. */\nexport function httpData(xhr, type, s) {\n // mostly lifted from jq1.4.4\n\n var ct = xhr.getResponseHeader(\"content-type\") || \"\",\n xml = (type === \"xml\" || !type) && ct.indexOf(\"xml\") >= 0,\n data = xml ? xhr.responseXML : xhr.responseText;\n\n if (xml && data.documentElement.nodeName === \"parsererror\") {\n if ($.error) {\n $.error(\"parsererror\");\n }\n }\n if (s && s.dataFilter) {\n data = s.dataFilter(data, type);\n }\n if (typeof data === \"string\") {\n if ((type === \"json\" || !type) && ct.indexOf(\"json\") >= 0) {\n data = JSON.parse(data);\n } else if (type === \"script\") {\n $.globalEval(data);\n }\n }\n\n return data;\n}\n\n// Copies the status and statusText attributes of an element onto the mock xhr.\nfunction readStatus(xhr, el) {\n // support for XHR 'status' & 'statusText' emulation :\n xhr.status = Number(el.getAttribute(\"status\")) || xhr.status;\n xhr.statusText = el.getAttribute(\"statusText\") || xhr.statusText;\n}\n\n// Fills the mock xhr from the document itself.\nfunction readDocument(doc, xhr, s, isXml) {\n var docRoot = doc.body ? doc.body : doc.documentElement;\n\n xhr.responseText = docRoot ? docRoot.innerHTML : null;\n xhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc;\n if (isXml) {\n s.dataType = \"xml\";\n }\n xhr.getResponseHeader = function (header) {\n // the dataType in lowercase, as $.ajax reads it\n var headers = { \"content-type\": s.dataType && s.dataType.toLowerCase() };\n\n return headers[header.toLowerCase()];\n };\n if (docRoot) {\n readStatus(xhr, docRoot);\n }\n}\n\n// A response embedded in a textarea, or text wrapped in pre or body, replaces responseText.\nfunction readEmbedded(doc, xhr, dt, s) {\n var scr = /(json|script|text)/.test(dt);\n\n if (!scr && !s.textarea) {\n return;\n }\n // see if user embedded response in textarea\n var ta = doc.getElementsByTagName(\"textarea\")[0];\n\n if (ta) {\n xhr.responseText = ta.value;\n readStatus(xhr, ta);\n } else if (scr) {\n // account for browsers injecting pre around json response\n var pre = doc.getElementsByTagName(\"pre\")[0];\n var b = doc.getElementsByTagName(\"body\")[0];\n\n if (pre) {\n xhr.responseText = pre.textContent ? pre.textContent : pre.innerText;\n } else if (b) {\n xhr.responseText = b.textContent ? b.textContent : b.innerText;\n }\n }\n}\n\n/**\n * Reads and parses the response document into the mock xhr. Returns {status, data, errMsg}, or\n * null when `retry()` asks to read the document again later (Opera's untraversable DOM).\n */\nexport function readResponse(doc, xhr, s, retry) {\n var status = \"success\",\n data,\n errMsg;\n\n try {\n var isXml = /^xml$/i.test(s.dataType) || doc.XMLDocument || $.isXMLDoc(doc);\n\n log(\"isXml=\" + isXml);\n\n if (!isXml && window.opera && (doc.body === null || !doc.body.innerHTML)) {\n // in some browsers (Opera) the iframe DOM is not always traversable when\n // the onload callback fires, so we loop a bit to accommodate\n if (retry()) {\n return null;\n }\n // let this fall through because server response could be an empty document\n }\n\n readDocument(doc, xhr, s, isXml);\n\n var dt = (s.dataType || \"\").toLowerCase();\n\n readEmbedded(doc, xhr, dt, s);\n\n try {\n data = httpData(xhr, dt, s);\n } catch (err) {\n status = \"parsererror\";\n xhr.error = errMsg = err || status;\n }\n } catch (err) {\n log(\"error caught: \", err);\n status = \"error\";\n xhr.error = errMsg = err;\n }\n\n return { status: status, data: data, errMsg: errMsg };\n}\n","import jQuery from \"jquery\";\nimport { log } from \"./diagnostics.js\";\n\n// The iframe upload's lifecycle: the mock xhr and the Deferred, the global ajax events, the\n// beforeSend veto, the timeout, abort and settling.\nvar $ = jQuery;\n\n/**\n * Creates the lifecycle of one upload with the merged settings `s`. `frame.stop()` stops the\n * frame's load and `frame.release()` removes or resets the frame after the upload.\n */\nexport function createLifecycle(s, frame) {\n var g,\n timeoutHandle,\n callbackProcessed,\n deferred = $.Deferred();\n\n var xhr = {\n // mock object\n aborted: 0,\n responseText: null,\n responseXML: null,\n status: 0,\n statusText: \"n/a\",\n getAllResponseHeaders: function () {},\n getResponseHeader: function () {},\n setRequestHeader: function () {},\n abort: function (status) {\n abort(status, [xhr, \"aborted\", status]);\n },\n };\n\n // #341\n deferred.abort = function (status) {\n xhr.abort(status);\n };\n\n function done() {\n return xhr.aborted || callbackProcessed;\n }\n\n // Completes an aborted upload once and rejects the Deferred with `rejection`.\n // `textStatus` replaces the default \"timeout\"/\"aborted\" text status.\n function abort(status, rejection, textStatus) {\n var e = textStatus || (status === \"timeout\" ? \"timeout\" : \"aborted\");\n\n if (done()) {\n return;\n }\n\n log(\"aborting upload... \" + e);\n xhr.aborted = 1;\n frame.stop();\n xhr.error = e;\n if (s.error) {\n s.error.call(s.context, xhr, e, status);\n }\n deferred.reject.apply(deferred, rejection);\n\n if (g) {\n $.event.trigger(\"ajaxError\", [xhr, s, e]);\n }\n\n complete(e);\n }\n\n // The global events that end every upload, cancelled ones included.\n function endGlobalEvents() {\n if (g) {\n $.event.trigger(\"ajaxComplete\", [xhr, s]);\n }\n\n if (g && !--$.active) {\n $.event.trigger(\"ajaxStop\");\n }\n }\n\n // The steps every finished or aborted upload ends with, in $.ajax order.\n function complete(status) {\n if (s.complete) {\n s.complete.call(s.context, xhr, status);\n }\n\n endGlobalEvents();\n clearTimeout(timeoutHandle);\n\n // clean up\n setTimeout(function () {\n frame.release();\n xhr.responseXML = null;\n }, 100);\n }\n\n // A beforeSend veto ends the upload as $.ajax cancels a request: no callbacks, the global\n // events end with ajaxError \"canceled\".\n function cancel() {\n if (done()) {\n return;\n }\n\n callbackProcessed = true;\n deferred.reject();\n if (g) {\n $.event.trigger(\"ajaxError\", [xhr, s, \"canceled\"]);\n }\n endGlobalEvents();\n }\n\n // Fires the start events and beforeSend; false when the upload must not be posted.\n function start() {\n g = s.global;\n // trigger ajax global events so that activity/block indicators work like normal\n if (g && $.active++ === 0) {\n $.event.trigger(\"ajaxStart\");\n }\n\n if (s.beforeSend && s.beforeSend.call(s.context, xhr, s) === false) {\n cancel();\n\n return false;\n }\n\n if (xhr.aborted) {\n // abort() in beforeSend already completed the upload\n return false;\n }\n\n if (g) {\n $.event.trigger(\"ajaxSend\", [xhr, s]);\n }\n\n // an ajaxSend handler may abort too\n return !xhr.aborted;\n }\n\n // Resolves the upload; returns {error} when the success callback threw.\n function succeed(data) {\n var failure;\n\n try {\n s.success.call(s.context, data, \"success\", xhr);\n } catch (err) {\n failure = { error: err };\n }\n\n deferred.resolve(xhr.responseText, \"success\", xhr);\n\n if (g) {\n $.event.trigger(\"ajaxSuccess\", [xhr, s, data]);\n }\n\n return failure;\n }\n\n // Settles the upload with the response reader's {status, data, errMsg}.\n function settle(result) {\n var status = result.status,\n errMsg = result.errMsg;\n\n if (xhr.aborted) {\n // abort() completed the upload while its response was processed\n log(\"upload aborted\");\n\n return;\n }\n\n // an emulated HTTP error status wins, as in $.ajax; a parse error is kept otherwise\n if (xhr.status && !((xhr.status >= 200 && xhr.status < 300) || xhr.status === 304)) {\n status = \"error\";\n }\n\n callbackProcessed = true;\n\n // ordering of these callbacks/triggers is odd, but that's how $.ajax does it\n if (status === \"success\") {\n var failure = succeed(result.data);\n\n complete(status);\n if (failure) {\n // the upload is settled; the success callback's exception still reaches the console\n throw failure.error;\n }\n\n return;\n }\n\n if (typeof errMsg === \"undefined\") {\n errMsg = xhr.statusText;\n }\n if (s.error) {\n s.error.call(s.context, xhr, status, errMsg);\n }\n deferred.reject(xhr, \"error\", errMsg);\n if (g) {\n $.event.trigger(\"ajaxError\", [xhr, s, errMsg]);\n }\n\n complete(status);\n }\n\n return {\n xhr: xhr,\n deferred: deferred,\n start: start,\n done: done,\n abort: abort,\n settle: settle,\n // Settles an upload that failed with an exception (ignored once aborted).\n fail: function (err) {\n settle({ status: \"error\", errMsg: err });\n },\n // Runs `onTimeout` after s.timeout, when set.\n startTimer: function (onTimeout) {\n if (s.timeout) {\n timeoutHandle = setTimeout(onTimeout, s.timeout);\n }\n },\n stopTimer: function () {\n clearTimeout(timeoutHandle);\n timeoutHandle = undefined;\n },\n };\n}\n","import {\n addCsrfField,\n addExtraInputs,\n addSubmitterFields,\n restoreAttributes,\n saveAttributes,\n setUploadAttributes,\n submitForm,\n} from \"./iframe-post.js\";\nimport { closestByTag, formMember } from \"./form-members.js\";\nimport { deprecate, log } from \"./diagnostics.js\";\nimport { getDoc, readResponse } from \"./iframe-response.js\";\nimport { createLifecycle } from \"./iframe-lifecycle.js\";\nimport jQuery from \"jquery\";\nimport { keepContext } from \"./options.js\";\n\n// The iframe transport: posts the form itself into a hidden frame and reads the response from it,\n// for file uploads without the File API or when the iframe option asks for it.\nvar $ = jQuery;\n\n/**\n * The iframe send step. `hasProp` is what the entry detected at load; `forms.property` reads a\n * form property as attr2 does.\n */\nexport function createIframeTransport(hasProp, forms) {\n var CLIENT_TIMEOUT_ABORT = 1;\n var SERVER_ABORT = 2;\n // tells apart the frames of uploads that start in the same millisecond\n var frameCount = 0;\n\n // ensure that every serialized input is still enabled\n function enableControls(elements) {\n for (var i = 0; i < elements.length; i++) {\n var el = $(elements[i]);\n\n if (hasProp) {\n el.prop(\"disabled\", false);\n } else {\n el.removeAttr(\"disabled\");\n }\n }\n }\n\n // Names the frame's window, when the page may: a cross-origin or sandboxed frame refuses.\n function nameWindow(frame, name) {\n try {\n if (frame.contentWindow) {\n frame.contentWindow.name = name;\n }\n } catch (ignore) {}\n }\n\n // The frame the form posts into: the iframeTarget, named `id` when it has no name, or a new\n // hidden frame named `id`. Returns the frame and the name the form targets.\n function createFrame(s, id, ownerDocument) {\n var $io, n;\n\n if (s.iframeTarget) {\n $io = $(s.iframeTarget, ownerDocument);\n n = $io.attr(\"name\");\n if (!n) {\n $io.attr(\"name\", id);\n // a frame already in the page keeps the browsing context name it was inserted with\n $io.each(function () {\n nameWindow(this, id);\n });\n } else {\n id = n;\n }\n } else {\n var io = ownerDocument.createElement(\"iframe\");\n\n io.setAttribute(\"name\", id);\n io.setAttribute(\"src\", s.iframeSrc);\n $io = $(io);\n $io.css({ position: \"absolute\", top: \"-1000px\", left: \"-1000px\" });\n }\n\n return { $io: $io, id: id };\n }\n\n // The frame hooks the lifecycle calls: stop a load in progress, and release after the upload.\n function frameHooks(s, $io) {\n return {\n stop: function () {\n try {\n // #214, #257\n if ($io[0].contentWindow.document.execCommand) {\n $io[0].contentWindow.document.execCommand(\"Stop\");\n }\n } catch (ignore) {}\n\n $io.attr(\"src\", s.iframeSrc); // abort op in progress\n },\n release: function () {\n if (!s.iframeTarget) {\n $io.remove();\n } else {\n // adding else to clean up existing iframe response.\n $io.attr(\"src\", s.iframeSrc);\n }\n },\n };\n }\n\n function listen(io, cb) {\n if (io.attachEvent) {\n io.attachEvent(\"onload\", cb);\n } else {\n io.addEventListener(\"load\", cb, false);\n }\n }\n\n function unlisten(io, cb) {\n if (io.detachEvent) {\n io.detachEvent(\"onload\", cb);\n } else {\n io.removeEventListener(\"load\", cb, false);\n }\n }\n\n // private function for handling file uploads (hat tip to YAHOO!)\n function fileUploadIframe(submission) {\n var form = submission.form,\n method = submission.method;\n\n var s = keepContext($.extend(true, {}, $.ajaxSettings, submission.options), [\n $.ajaxSettings,\n submission.options,\n ]);\n\n s.context = s.context || s;\n var ownerDocument = formMember(form, \"ownerDocument\");\n var $body = $(closestByTag(form, [\"body\"]));\n var frame = createFrame(s, \"jqFormIO\" + new Date().getTime() + frameCount++, ownerDocument);\n var $io = frame.$io,\n io = $io[0];\n var life = createLifecycle(s, frameHooks(s, $io));\n var domCheckCount = 50;\n\n if (!life.start()) {\n return life.deferred;\n }\n\n addSubmitterFields(s, form);\n addCsrfField(s, form, method, forms);\n\n // look for server aborts\n function checkState() {\n try {\n var state = getDoc(io).readyState;\n\n log(\"state = \" + state);\n if (state && state.toLowerCase() === \"uninitialized\") {\n setTimeout(checkState, 50);\n }\n } catch (e) {\n log(\"Server abort: \", e, \" (\", e.name, \")\");\n cb(SERVER_ABORT);\n life.stopTimer();\n }\n }\n\n // take a breath so that pending repaints get some cpu time before the upload starts\n function doSubmit() {\n var saved = saveAttributes(form);\n\n setUploadAttributes(form, frame.id, method, s, forms);\n\n // support timout\n life.startTimer(function () {\n cb(CLIENT_TIMEOUT_ABORT);\n });\n\n // add \"extra\" data to form if provided in options\n var extraInputs = [];\n\n try {\n addExtraInputs(form, ownerDocument, s.extraData, submission.traditional, extraInputs);\n\n if (!s.iframeTarget) {\n // add iframe to doc and submit the form\n $io.appendTo($body);\n }\n\n // A connected form posting into a frame outside the document opens a new window.\n var root = ownerDocument.documentElement;\n\n if (io && $.contains(root, form) && !$.contains(root, io)) {\n var notInDocument = \"jquery.form: the upload frame is not in the document\";\n\n life.abort(notInDocument, [life.xhr, \"error\", notInDocument], \"error\");\n\n return;\n }\n\n listen(io, cb);\n setTimeout(checkState, 15);\n submitForm(form);\n } finally {\n // reset attrs and remove \"extra\" input elements\n restoreAttributes(form, saved);\n $(extraInputs).remove();\n }\n }\n\n // Reads the next document by Opera's rules: false once the retries are used up.\n function retry() {\n if (--domCheckCount) {\n log(\"requeing onLoad callback, DOM not available\");\n setTimeout(cb, 250);\n\n return true;\n }\n\n return false;\n }\n\n function cb(e) {\n if (life.done()) {\n return;\n }\n\n var doc = getDoc(io);\n\n if (!doc) {\n log(\"cannot access response document\");\n e = SERVER_ABORT;\n }\n if (e === CLIENT_TIMEOUT_ABORT) {\n life.abort(\"timeout\", [life.xhr, \"timeout\"]);\n\n return;\n }\n if (e === SERVER_ABORT) {\n life.abort(\"server abort\", [life.xhr, \"error\", \"server abort\"]);\n\n return;\n }\n\n if (doc.location.href === s.iframeSrc) {\n // response not received yet\n return;\n }\n\n unlisten(io, cb);\n\n var result = readResponse(doc, life.xhr, s, retry);\n\n if (result) {\n life.settle(result);\n }\n }\n\n // An exception while posting settles the upload with \"error\" and the exception.\n function post() {\n if (life.done()) {\n // aborted before the delayed post\n return;\n }\n\n try {\n doSubmit();\n } catch (err) {\n log(\"upload failed: \", err);\n life.fail(err);\n }\n }\n\n if (s.forceSync) {\n post();\n } else {\n setTimeout(post, 10); // this lets dom updates render\n }\n\n return life.deferred;\n }\n\n return function sendIframe(submission) {\n var jqxhr;\n\n // now, while the controls are still listed: ajaxSubmit clears the list when it returns,\n // before a closeKeepAlive request completes\n enableControls(submission.controls);\n\n // hack to fix Safari hang (thanks to Tim Molendijk for this)\n // see: http://groups.google.com/group/jquery-dev/browse_thread/thread/36395b7ab510dd5d\n if (submission.options.closeKeepAlive) {\n deprecate(\"closeKeepAlive\", \"closeKeepAlive works around a Safari 3/4 bug and is deprecated\");\n $.get(submission.options.closeKeepAlive, function () {\n jqxhr = fileUploadIframe(submission);\n });\n } else {\n jqxhr = fileUploadIframe(submission);\n }\n\n return jqxhr;\n };\n}\n","import { deprecate, log } from \"./diagnostics.js\";\nimport { assertRealParent } from \"./form-members.js\";\nimport jQuery from \"jquery\";\nimport { keepContext } from \"./options.js\";\nimport { urlencodedFields } from \"./successful-controls.js\";\n\n// A Submission is one ajaxSubmit call once its vetoes have passed:\n// { form, $form, fields, controls, options, method, traditional }. `options` is the object the\n// callbacks and events receive; later steps change it in place.\n\n/**\n * The submission steps. `feature` holds what the entry detected at load (fileapi, formdata), and\n * `forms` reads form attributes and attr2-style properties (attribute, property), and\n * `serialization` collects the form's fields and controls.\n */\nexport function createSubmission(feature, forms, serialization) {\n var $ = jQuery;\n\n function refuse(message) {\n log(message);\n\n return null;\n }\n\n // The options merged over the form's action, the method, and the ajax defaults.\n function withDefaults(form, options, method) {\n var action = options.url || forms.property(form, \"action\");\n var url = typeof action === \"string\" ? action.trim() : \"\";\n\n // clean url (don't include hash value); an action that is only a fragment means this page\n url = url.split(\"#\")[0] || window.location.href.split(\"#\")[0];\n // IE requires javascript:false in https, but this breaks chrome >83 and goes against spec.\n // Instead of using javascript:false always, let's only apply it for IE.\n var isMsie = /(MSIE|Trident)/.test(navigator.userAgent || \"\");\n var iframeSrc = isMsie && /^https/i.test(document.URL) ? \"javascript:false\" : \"about:blank\"; // eslint-disable-line no-script-url\n\n var merged = $.extend(\n true,\n {\n url: url,\n success: $.ajaxSettings.success,\n type: method || $.ajaxSettings.type,\n iframeSrc: iframeSrc,\n },\n options\n );\n\n return keepContext(merged, [options]);\n }\n\n /**\n * The one method every transport sends, read after the hooks: `method` wins over `type`, and\n * `type` is set to it. Undefined when only the ajax default applies, so each transport keeps\n * its own default.\n */\n function resolveMethod(options, defaultType) {\n var resolved = options.method || options.type;\n\n options.type = resolved;\n\n return resolved === defaultType && !options.method ? undefined : resolved;\n }\n\n // The data option, kept as extraData and encoded, or undefined without one.\n function extraQuery(fields, options, traditional) {\n if (!options.data) {\n return undefined;\n }\n\n var optionsData = typeof options.data === \"function\" ? options.data(fields) : options.data;\n\n if (typeof optionsData === \"string\") {\n if (options.requestFormat === \"json\") {\n throw new Error(\n 'jquery.form: requestFormat \"json\" needs object data; a string data option is a query string'\n );\n }\n\n // a query string: sent as-is when urlencoded, as its own fields otherwise\n options.extraData = queryPairs(optionsData);\n\n return optionsData;\n }\n\n options.extraData = optionsData;\n\n return $.param(optionsData, traditional);\n }\n\n // Sets a key as an own data property, so a name like __proto__ is an ordinary key.\n function defineKey(object, key, value) {\n Object.defineProperty(object, key, {\n value: value,\n enumerable: true,\n writable: true,\n configurable: true,\n });\n }\n\n /**\n * requestFormat \"json\" (#545): the fields as an object (a repeated name gives an array), merged\n * with object data, sent as a JSON body. Based on the idea in PR #557 by zhangciwu.\n */\n function jsonBody(options, fields) {\n if (/^get$/i.test(options.type)) {\n throw new Error('jquery.form: requestFormat \"json\" needs a method with a body, such as POST');\n }\n\n var body = {};\n var own = Object.prototype.hasOwnProperty;\n\n for (var i = 0; i < fields.length; i++) {\n var name = fields[i].name;\n\n if (!own.call(body, name)) {\n defineKey(body, name, fields[i].value);\n } else if (Array.isArray(body[name])) {\n body[name].push(fields[i].value);\n } else {\n defineKey(body, name, [body[name], fields[i].value]);\n }\n }\n\n var extra = options.extraData;\n\n for (var key in extra) {\n if (own.call(extra, key)) {\n defineKey(body, key, extra[key]);\n }\n }\n\n options.data = JSON.stringify(body);\n options.contentType = \"application/json; charset=UTF-8\";\n }\n\n // The fields of a query string, as the { name, value } list $.param takes.\n function queryPairs(query) {\n var pairs = [];\n var parts = query.split(\"&\");\n\n for (var i = 0; i < parts.length; i++) {\n if (parts[i]) {\n var at = parts[i].indexOf(\"=\");\n var name = at < 0 ? parts[i] : parts[i].slice(0, at);\n var value = at < 0 ? \"\" : parts[i].slice(at + 1);\n\n pairs.push({ name: decodeQuery(name), value: decodeQuery(value) });\n }\n }\n\n return pairs;\n }\n\n function decodeQuery(text) {\n return decodeURIComponent(text.replace(/\\+/g, \" \"));\n }\n\n // Puts the encoded fields in the url for a get, and in the data otherwise.\n function encode(options, q, qx) {\n if (qx) {\n q = q ? q + \"&\" + qx : qx;\n }\n\n if (options.type.toUpperCase() === \"GET\") {\n // the query goes before any fragment in the url option\n var hashAt = options.url.indexOf(\"#\");\n var base = hashAt < 0 ? options.url : options.url.slice(0, hashAt);\n\n options.url =\n base + (base.indexOf(\"?\") >= 0 ? \"&\" : \"?\") + q + options.url.slice(base.length);\n options.data = null; // data is null for 'get'\n } else {\n options.data = q; // data is the query string for 'post'\n }\n }\n\n // A callback option as a list: an array as given, one function, or none.\n function callbackList(callback) {\n if (Array.isArray(callback)) {\n return callback;\n }\n\n return callback ? [callback] : [];\n }\n\n // Calls each callback in order with the same this and arguments.\n function callEach(callbacks, context, args) {\n for (var i = 0; i < callbacks.length; i++) {\n callbacks[i].apply(context, args);\n }\n }\n\n /**\n * Resolves the options, serializes the form, and runs the vetoes: the Submission, or null when\n * an event or callback stopped it.\n */\n function prepare($set, options) {\n $set.each(function () {\n assertRealParent(this);\n });\n\n var form = $set[0];\n var method = options.method || options.type || forms.property(form, \"method\");\n\n options = withDefaults(form, options, method);\n\n // the ajax default type, when neither the caller nor the form gave a method\n var defaultType = method ? undefined : options.type;\n\n // hook for manipulating the form data before it is extracted;\n // convenient for use with rich editors like tinyMCE or FCKEditor\n var veto = {};\n\n $set.trigger(\"form-pre-serialize\", [$set, options, veto]);\n if (veto.veto) {\n return refuse(\"ajaxSubmit: submit vetoed via form-pre-serialize trigger\");\n }\n\n // provide opportunity to alter form data before it is serialized\n if (options.beforeSerialize && options.beforeSerialize($set, options) === false) {\n return refuse(\"ajaxSubmit: submit aborted via beforeSerialize callback\");\n }\n\n var traditional = options.traditional;\n\n if (typeof traditional === \"undefined\") {\n traditional = $.ajaxSettings.traditional;\n }\n\n var collected = serialization.collect($set[0], options.semantic, options.filtering);\n var fields = collected.fields;\n var controls = collected.controls;\n var qx = extraQuery(fields, options, traditional);\n\n // give pre-submit callback an opportunity to abort the submit\n if (options.beforeSubmit && options.beforeSubmit(fields, $set, options) === false) {\n return refuse(\"ajaxSubmit: submit aborted via beforeSubmit callback\");\n }\n\n // fire vetoable 'validate' event\n $set.trigger(\"form-submit-validate\", [fields, $set, options, veto]);\n if (veto.veto) {\n return refuse(\"ajaxSubmit: submit vetoed via form-submit-validate trigger\");\n }\n\n method = resolveMethod(options, defaultType);\n\n if (options.requestFormat === \"json\") {\n jsonBody(options, fields);\n } else {\n encode(options, $.param(urlencodedFields(fields), traditional), qx);\n }\n\n return {\n form: form,\n $form: $set,\n fields: fields,\n controls: controls,\n options: options,\n method: method,\n traditional: traditional,\n };\n }\n\n /**\n * Wraps success, error and complete (a function or an array of them, as $.ajax takes) so each\n * also receives the form, and adds the resetForm,\n * clearForm and target steps before the success callbacks.\n */\n function deliver(submission) {\n var $set = submission.$form;\n var options = submission.options;\n var callbacks = [];\n\n if (options.resetForm) {\n callbacks.push(function () {\n $set.resetForm();\n });\n }\n\n if (options.clearForm) {\n callbacks.push(function () {\n $set.clearForm(options.includeHidden);\n });\n }\n\n // perform a load on the target only if dataType is not provided\n if (!options.dataType && options.target) {\n var successes = callbackList(options.success);\n\n callbacks.push(function (data, textStatus, jqXHR) {\n var successArguments = arguments,\n fn = options.replaceTarget ? \"replaceWith\" : \"html\",\n $target = $(options.target);\n\n // Only a string response is inserted. jQuery has already parsed a JSON or XML response,\n // and inserting it would parse each of its strings as HTML.\n if (typeof data === \"string\") {\n $target[fn](data);\n } else {\n log(\"target: the response was parsed by jQuery, so it is not inserted\");\n }\n\n if (!$target.length) {\n // nothing to fill: success still runs once, with the normal context\n callEach(successes, this, successArguments);\n }\n\n $target.each(function () {\n callEach(successes, this, successArguments);\n });\n });\n } else {\n $.merge(callbacks, callbackList(options.success));\n }\n\n options.success = function (data, status, xhr) {\n // jQuery 1.4+ passes xhr as 3rd arg\n var context = options.context || this; // jQuery 1.4+ supports scope context\n\n for (var i = 0, max = callbacks.length; i < max; i++) {\n callbacks[i].apply(context, [data, status, xhr || $set, $set]);\n }\n };\n\n if (options.error) {\n var errors = callbackList(options.error);\n\n options.error = function (xhr, status, error) {\n callEach(errors, options.context || this, [xhr, status, error, $set]);\n };\n }\n\n if (options.complete) {\n var completes = callbackList(options.complete);\n\n options.complete = function (xhr, status) {\n callEach(completes, options.context || this, [xhr, status, $set]);\n };\n }\n }\n\n /**\n * The transport for a submission: \"iframe\" for files without the File API or when forced,\n * \"formdata\" for files with it, \"ajax\" otherwise.\n */\n function chooseTransport(submission) {\n var $set = submission.$form;\n var options = submission.options;\n\n // [value] (issue #113), also see comment:\n // https://github.com/malsup/form/commit/588306aedba1de01388032d5f42a60159eea9228#commitcomment-2180219\n // and the file inputs outside the form that belong to it through their form attribute\n var fileInputs = $(\"input[type=file]:enabled\", $set)\n .add($(submission.controls).filter(\"input[type=file]\"))\n .filter(function () {\n return $(this).val() !== \"\";\n });\n var hasFileInputs = fileInputs.length > 0;\n // compared as the browser does: ASCII case-insensitive, without surrounding whitespace\n var mp = /^[\\t\\n\\f\\r ]*multipart\\/form-data[\\t\\n\\f\\r ]*$/i;\n var multipart =\n mp.test(forms.attribute($set[0], \"enctype\")) || mp.test(forms.attribute($set[0], \"encoding\"));\n var fileAPI = feature.fileapi && feature.formdata;\n\n log(\"fileAPI :\" + fileAPI);\n\n var shouldUseFrame = (hasFileInputs || multipart) && !fileAPI;\n\n var transport = (hasFileInputs || multipart) && fileAPI ? \"formdata\" : \"ajax\";\n\n // options.iframe allows user to force iframe mode\n // 06-NOV-09: now defaulting to iframe mode if file input is detected\n if (options.iframe !== false && (options.iframe || shouldUseFrame)) {\n transport = \"iframe\";\n }\n\n if (transport === \"iframe\" && !options.iframe) {\n deprecate(\n \"iframe\",\n \"choosing the iframe transport automatically without FormData is deprecated, set iframe: true\"\n );\n }\n\n if (transport !== \"ajax\" && options.requestFormat === \"json\") {\n throw new Error(\n 'jquery.form: requestFormat \"json\" cannot send files or use the iframe transport'\n );\n }\n\n return transport;\n }\n\n return { prepare: prepare, deliver: deliver, chooseTransport: chooseTransport };\n}\n","/*!\n * jQuery Form Plugin\n * version: 4.5.0\n * Requires jQuery v1.7.2 or later\n * Project repository: https://github.com/jquery-form/form\n\n * Copyright 2017 Kevin Morris\n * Copyright 2006 M. Alsup\n\n * Dual licensed under the LGPL-2.1+ or MIT licenses\n * https://github.com/jquery-form/form#license\n\n * This library is free software; you can redistribute it and/or\n * modify it under the terms of the GNU Lesser General Public\n * License as published by the Free Software Foundation; either\n * version 2.1 of the License, or (at your option) any later version.\n * This library is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n */\nimport { ajaxForm, ajaxFormUnbind } from \"./ajax-form.js\";\nimport { callFormMethod, tagName } from \"./form-members.js\";\nimport {\n createSuccessfulControls,\n isSuccessful,\n urlencodedFields,\n valueOf,\n} from \"./successful-controls.js\";\nimport { deprecate, deprecateOldJQuery, log } from \"./diagnostics.js\";\nimport { sendAjax, sendFormData } from \"./xhr-transport.js\";\nimport { createIframeTransport } from \"./iframe-transport.js\";\nimport { createSubmission } from \"./submission.js\";\nimport { formAttribute } from \"./form-attributes.js\";\nimport jQuery from \"jquery\";\nimport { submitOptions } from \"./options.js\";\nimport { submitterElement } from \"./submitter.js\";\n\n(function ($) {\n \"use strict\";\n\n /*\n\t\tUsage Note:\n\t\t-----------\n\t\tDo not use both ajaxSubmit and ajaxForm on the same form. These\n\t\tfunctions are mutually exclusive. Use ajaxSubmit if you want\n\t\tto bind your own submit handler to the form. For example,\n\n\t\t$(document).ready(function() {\n\t\t\t$('#myForm').on('submit', function(e) {\n\t\t\t\te.preventDefault(); // <-- important\n\t\t\t\t$(this).ajaxSubmit({\n\t\t\t\t\ttarget: '#output'\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\n\t\tUse ajaxForm when you want the plugin to manage all the event binding\n\t\tfor you. For example,\n\n\t\t$(document).ready(function() {\n\t\t\t$('#myForm').ajaxForm({\n\t\t\t\ttarget: '#output'\n\t\t\t});\n\t\t});\n\n\t\tYou can also use ajaxForm with delegation (requires jQuery v1.7+), so the\n\t\tform does not have to exist when you invoke ajaxForm:\n\n\t\t$('#myForm').ajaxForm({\n\t\t\tdelegation: true,\n\t\t\ttarget: '#output'\n\t\t});\n\n\t\tWhen using ajaxForm, the ajaxSubmit function will be invoked for you\n\t\tat the appropriate time.\n\t*/\n\n /**\n * Feature detection\n */\n var feature = {};\n\n feature.fileapi = $('').get(0).files !== undefined;\n feature.formdata = typeof window.FormData !== \"undefined\";\n\n var hasProp = !!$.fn.prop;\n // What attr2 returns for a form: the property when it is a string, otherwise the attribute. The\n // property is read plainly on purpose: a control named like it shadows it, and then the raw\n // attribute is used.\n function formProperty(form, name) {\n var value = hasProp ? form[name] : undefined;\n\n return typeof value === \"string\" ? value : formAttribute(form, name);\n }\n\n var forms = { attribute: formAttribute, property: formProperty };\n var serialization = createSuccessfulControls(feature);\n var steps = createSubmission(feature, forms, serialization);\n var transports = {\n iframe: createIframeTransport(hasProp, forms),\n formdata: sendFormData,\n ajax: sendAjax,\n };\n\n // attr2 uses prop when it can but checks the return type for\n // an expected string. This accounts for the case where a form\n // contains inputs with names like \"action\" or \"method\"; in those\n // cases \"prop\" returns the element\n $.fn.attr2 = function () {\n deprecate(\"attr2\", \"attr2 is deprecated, use .prop() or .attr()\");\n\n if (!hasProp) {\n return this.attr.apply(this, arguments);\n }\n\n var val = this.prop.apply(this, arguments);\n\n if ((val && val.jquery) || typeof val === \"string\") {\n return val;\n }\n\n return this.attr.apply(this, arguments);\n };\n\n /**\n * ajaxSubmit() provides a mechanism for immediately submitting\n * an HTML form using AJAX.\n *\n * @param\t{object|string}\toptions\t\tjquery.form.js parameters or custom url for submission\n * @param\t{object}\t\tdata\t\textraData\n * @param\t{string}\t\tdataType\tajax dataType\n * @param\t{function}\t\tonSuccess\tajax success callback function\n */\n $.fn.ajaxSubmit = function (options, data, dataType, onSuccess) {\n deprecateOldJQuery($.fn.jquery);\n\n // fast fail if nothing selected (http://dev.jquery.com/ticket/2752)\n if (!this.length) {\n log(\"ajaxSubmit: skipping submit process - no element selected\");\n\n return this;\n }\n\n // #541: jQuery's slim build has no $.ajax\n if (!$.ajax) {\n throw new Error(\n \"jquery.form: ajaxSubmit needs the full jQuery build; this jQuery has no $.ajax\"\n );\n }\n\n var submission = steps.prepare(this, submitOptions(options, data, dataType, onSuccess));\n\n if (!submission) {\n return this;\n }\n\n steps.deliver(submission);\n\n var jqxhr = transports[steps.chooseTransport(submission)](submission);\n\n this.removeData(\"jqxhr\").data(\"jqxhr\", jqxhr);\n\n // clear element array\n for (var k = 0; k < submission.controls.length; k++) {\n submission.controls[k] = null;\n }\n\n // fire 'notify' event\n this.trigger(\"form-submit-notify\", [this, submission.options]);\n\n return this;\n };\n\n $.fn.ajaxForm = ajaxForm;\n $.fn.ajaxFormUnbind = ajaxFormUnbind;\n\n /**\n * formToArray() gathers form element data into an array of objects that can\n * be passed to any of the following ajax functions: $.get, $.post, or load.\n * Each object in the array has both a 'name' and 'value' property. An example of\n * an array for a simple login form might be:\n *\n * [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ]\n *\n * It is this array that is passed to pre-submit callback functions provided to the\n * ajaxSubmit() and ajaxForm() methods.\n */\n $.fn.formToArray = function (semantic, elements, filtering) {\n var collected = serialization.collect(this[0], semantic, filtering);\n\n if (elements) {\n elements.push.apply(elements, collected.controls);\n }\n\n return collected.fields;\n };\n\n /**\n * Serializes form data into a 'submittable' string. This method will return a string\n * in the format: name1=value1&name2=value2\n */\n $.fn.formSerialize = function (semantic) {\n // hand off to jQuery.param for proper encoding\n return $.param(urlencodedFields(this.formToArray(semantic)));\n };\n\n /**\n * Serializes all field elements in the jQuery object into a query string.\n * This method will return a string in the format: name1=value1&name2=value2\n */\n $.fn.fieldSerialize = function (successful) {\n var a = [];\n\n this.each(function () {\n var n = this.name;\n\n // a form is not a field, though it may have a name\n if (!n || tagName(this) === \"form\") {\n return;\n }\n\n var v = $.fieldValue(this, successful);\n\n if (v && v.constructor === Array) {\n for (var i = 0, max = v.length; i < max; i++) {\n a.push({ name: n, value: v[i] });\n }\n } else if (v !== null && typeof v !== \"undefined\") {\n a.push({ name: this.name, value: v });\n }\n });\n\n // hand off to jQuery.param for proper encoding\n return $.param(a);\n };\n\n /**\n * Returns the value(s) of the element in the matched set. For example, consider the following form:\n *\n *\t
\n *\t\t\n *\t\t\n *\t\t\n *\t\t\n *\t\t\n *\t\t\n *\t
\n *\n *\tvar v = $('input[type=text]').fieldValue();\n *\t// if no values are entered into the text inputs\n *\tv === ['','']\n *\t// if values entered into the text inputs are 'foo' and 'bar'\n *\tv === ['foo','bar']\n *\n *\tvar v = $('input[type=checkbox]').fieldValue();\n *\t// if neither checkbox is checked\n *\tv === undefined\n *\t// if both checkboxes are checked\n *\tv === ['B1', 'B2']\n *\n *\tvar v = $('input[type=radio]').fieldValue();\n *\t// if neither radio is checked\n *\tv === undefined\n *\t// if first radio is checked\n *\tv === ['C1']\n *\n * The successful argument controls whether or not the field element must be 'successful'\n * (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls).\n * The default value of the successful argument is true. If this value is false the value(s)\n * for each element is returned.\n *\n * Note: This method *always* returns an array. If no valid value can be determined the\n *\tarray will be empty, otherwise it will contain one or more values.\n */\n $.fn.fieldValue = function (successful) {\n for (var val = [], i = 0, max = this.length; i < max; i++) {\n var el = this[i];\n var v = $.fieldValue(el, successful);\n\n if (v === null || typeof v === \"undefined\" || (v.constructor === Array && !v.length)) {\n continue;\n }\n\n if (v.constructor === Array) {\n $.merge(val, v);\n } else {\n val.push(v);\n }\n }\n\n return val;\n };\n\n /**\n * Returns the value of the field element.\n */\n $.fieldValue = function (el, successful) {\n var required = typeof successful === \"undefined\" || successful;\n\n if (required && !isSuccessful(el, submitterElement(el.form))) {\n return null;\n }\n\n return valueOf(el);\n };\n\n /**\n * Clears the form data. Takes the following actions on the form's input fields:\n * - input text fields will have their 'value' property set to the empty string\n * - select elements will have their 'selectedIndex' property set to -1\n * - checkbox and radio inputs will have their 'checked' property set to false\n * - inputs of type submit, button, reset, and hidden will *not* be effected\n * - button elements will *not* be effected\n */\n $.fn.clearForm = function (includeHidden) {\n return this.each(function () {\n $(\"input,select,textarea\", this).clearFields(includeHidden);\n });\n };\n\n /**\n * Clears the selected form elements.\n */\n $.fn.clearInputs = function (includeHidden) {\n deprecate(\"clearInputs\", \"clearInputs is deprecated, use clearFields\");\n\n return this.clearFields(includeHidden);\n };\n\n $.fn.clearFields = function (includeHidden) {\n var re =\n /^(?:color|date|datetime|datetime-local|email|month|number|password|range|search|tel|text|time|url|week)$/i; // 'hidden' is not in this list\n\n return this.each(function () {\n var t = this.type,\n tag = tagName(this);\n\n if (re.test(t) || tag === \"textarea\") {\n this.value = \"\";\n } else if (t === \"checkbox\" || t === \"radio\") {\n this.checked = false;\n } else if (tag === \"select\") {\n this.selectedIndex = -1;\n } else if (t === \"file\") {\n if (/MSIE/.test(navigator.userAgent)) {\n $(this).replaceWith($(this).clone(true));\n } else {\n $(this).val(\"\");\n }\n } else if (includeHidden) {\n // includeHidden can be the value true, or it can be a selector string\n // indicating a special test; for example:\n // $('#myForm').clearForm('.special:hidden')\n // the above would clean hidden inputs that have the class of 'special'\n if (\n (includeHidden === true && /hidden/.test(t)) ||\n (typeof includeHidden === \"string\" && $(this).is(includeHidden))\n ) {\n this.value = \"\";\n }\n }\n });\n };\n\n /**\n * Resets the form data or individual elements. Takes the following actions\n * on the selected tags:\n * - all fields within form elements will be reset to their original value\n * - input / textarea / select fields will be reset to their original value\n * - option / optgroup fields (for multi-selects) will defaulted individually\n * - non-multiple options will find the right select to default\n * - label elements will be searched against its 'for' attribute\n * - all others will be searched for appropriate children to default\n */\n $.fn.resetForm = function () {\n return this.each(function () {\n var el = $(this);\n var tag = tagName(this);\n\n switch (tag) {\n case \"input\":\n this.checked = this.defaultChecked;\n\n // as the native reset: types whose value is the value attribute keep it\n if (this.type === \"file\") {\n // a file input cannot take its value attribute; the native reset empties it\n this.value = \"\";\n } else if (!/^(?:checkbox|radio|hidden|submit|reset|button|image)$/.test(this.type)) {\n this.value = this.defaultValue;\n }\n\n return true;\n\n case \"textarea\":\n this.value = this.defaultValue;\n\n return true;\n\n case \"option\":\n case \"optgroup\":\n var select = el.parents(\"select\");\n\n if (select.length && select[0].multiple) {\n if (tag === \"option\") {\n this.selected = this.defaultSelected;\n } else {\n el.find(\"option\").resetForm();\n }\n } else {\n select.resetForm();\n }\n\n return true;\n\n case \"select\":\n // in order, as the native reset: of several default options, a single select keeps the last\n el.find(\"option\").each(function () {\n this.selected = this.defaultSelected;\n });\n\n return true;\n\n case \"label\":\n // The control whose id the for attribute names, and the controls inside the label. The\n // filter keeps a for that names an ancestor from resetting the label again.\n var forEl = this.htmlFor && this.ownerDocument.getElementById(this.htmlFor);\n\n el.find(\"input,select,textarea\").add(forEl).filter(\"input,select,textarea\").resetForm();\n\n return true;\n\n case \"form\":\n // through the prototype: a control named reset shadows the method\n callFormMethod(this, \"reset\");\n\n return true;\n\n default:\n el.find(\"form,input,label,select,textarea\").resetForm();\n\n return true;\n }\n });\n };\n\n /**\n * Enables or disables any matching elements.\n */\n $.fn.enable = function (b) {\n if (typeof b === \"undefined\") {\n b = true;\n }\n\n return this.each(function () {\n this.disabled = !b;\n });\n };\n\n /**\n * Checks/unchecks any matching checkboxes or radio buttons and\n * selects/deselects and matching option elements.\n */\n $.fn.selected = function (select) {\n if (typeof select === \"undefined\") {\n select = true;\n }\n\n return this.each(function () {\n var t = this.type;\n\n if (t === \"checkbox\" || t === \"radio\") {\n this.checked = select;\n } else if (tagName(this) === \"option\") {\n var $sel = $(this).parent(\"select\");\n\n if (select && $sel[0] && $sel[0].type === \"select-one\") {\n // deselect all other options\n $sel.find(\"option\").selected(false);\n }\n\n this.selected = select;\n }\n });\n };\n\n // expose debug var\n $.fn.ajaxSubmit.debug = false;\n})(jQuery);\n\nexport default jQuery;\n"],"names":["owners","plainForm","document","createElement","findDescriptor","name","i","length","owner","window","descriptor","Object","getOwnPropertyDescriptor","prototype","formMember","form","get","call","e","callFormMethod","value","apply","Array","slice","arguments","tagName","el","toLowerCase","isElement","node","assertRealParent","parentNode","Error","closestByTag","names","indexOf","storeKey","setExpando","ignore","expando","els","namedItem","undefined","record","x","y","jQuery","data","type","setTimeout","captureSubmitter","target","point","offsetX","offsetY","fn","offset","pageX","left","pageY","top","offsetLeft","offsetTop","imagePoint","submitterOf","stored","log","ajaxSubmit","debug","msg","join","console","opera","postError","warned","deprecate","id","message","warn","deprecateOldJQuery","version","parts","String","split","major","Number","beforeJQuery35","shorthandOptions","options","dataType","onSuccess","result","url","success","submitOptions","key","hasOwnProperty","withoutUrl","keepContext","settings","sources","context","submitWith","isDefaultPrevented","preventDefault","originalEvent","submitter","captureEventSubmitter","doAjaxSubmit","captureSubmittingElement","this","bindDelegated","$sel","selector","off","on","closestMatch","Element","closest","is","delegated","unbindSelector","handlers","submit","click","selectionOnly","ajaxForm","jquery","delegation","bindSelector","beforeFormUnbind","ajaxFormUnbind","o","s","c","isReady","bindLater","formAttribute","attr","rLineBreak","rCR","rUnsubmittable","isDisabled","matches","disabled","valueOf","index","selectedIndex","a","ops","one","max","op","selected","v","attributes","specified","text","push","selectValue","val","raw","replace","urlencodedFields","fields","map","field","createSuccessfulControls","feature","$","controlsOf","semantic","formId","getElementsByTagName","makeArray","grep","ownedBy","test","navigator","userAgent","concat","filter","getAttribute","inArray","outsideControls","fieldsOf","n","fieldValue","constructor","fileapi","files","file","required","imageFields","sub","input","addCandidate","collected","own","controls","collect","filtering","addClickedImage","deepSerialize","extraData","traditional","part","param","serialized","len","decodeURIComponent","sendFormData","submission","formdata","FormData","append","serializedData","extend","ajaxSettings","contentType","processData","cache","method","uploadProgress","createXhr","xhr","upload","addEventListener","event","percent","position","loaded","total","lengthComputable","Math","ceil","beforeSend","formData","ajax","sendAjax","uploadAttributes","hasOwn","isGet","addSubmitterFields","submitterFields","addCsrfField","forms","origin","csrf_token","csrf_param","posts","property","href","location","protocol","host","setFormAttribute","getDoc","frame","doc","contentWindow","err","contentDocument","readStatus","status","statusText","readResponse","retry","errMsg","isXml","XMLDocument","isXMLDoc","body","innerHTML","docRoot","documentElement","responseText","responseXML","getResponseHeader","header","readDocument","dt","scr","textarea","ta","pre","b","textContent","innerText","readEmbedded","ct","xml","nodeName","error","dataFilter","JSON","parse","globalEval","httpData","createLifecycle","g","timeoutHandle","callbackProcessed","deferred","Deferred","aborted","getAllResponseHeaders","setRequestHeader","abort","done","rejection","textStatus","stop","reject","trigger","complete","endGlobalEvents","active","clearTimeout","release","settle","failure","resolve","succeed","start","global","fail","startTimer","onTimeout","timeout","stopTimer","createIframeTransport","hasProp","frameCount","fileUploadIframe","ownerDocument","$body","$io","iframeTarget","each","nameWindow","io","setAttribute","iframeSrc","css","createFrame","Date","getTime","life","execCommand","remove","frameHooks","domCheckCount","checkState","state","readyState","cb","doSubmit","saved","saveAttributes","mp","skipEncodingOverride","setUploadAttributes","extraInputs","added","addHiddenInput","appendTo","isPlainObject","single","f","addExtraInputs","root","contains","notInDocument","attachEvent","listen","submitForm","restoreAttributes","detachEvent","removeEventListener","unlisten","post","forceSync","jqxhr","elements","prop","removeAttr","enableControls","closeKeepAlive","createSubmission","serialization","refuse","extraQuery","optionsData","requestFormat","query","pairs","at","decodeQuery","queryPairs","defineKey","object","defineProperty","enumerable","writable","configurable","callbackList","callback","isArray","callEach","callbacks","args","prepare","$set","action","trim","URL","withDefaults","defaultType","veto","beforeSerialize","qx","beforeSubmit","resolved","resolveMethod","extra","stringify","jsonBody","q","toUpperCase","hashAt","base","encode","$form","deliver","resetForm","clearForm","includeHidden","successes","jqXHR","successArguments","replaceTarget","$target","merge","errors","completes","chooseTransport","hasFileInputs","add","multipart","attribute","fileAPI","shouldUseFrame","transport","iframe","steps","transports","attr2","removeData","k","formToArray","formSerialize","fieldSerialize","successful","t","checked","isSuccessful","clearFields","clearInputs","re","tag","replaceWith","clone","defaultChecked","defaultValue","select","parents","multi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tBlW,KAAKmW,QAAUU,OACV,GAAsB,WAAlBlc,EAAQqF,MAAoB,CACrC,IAAIE,EAAOyD,EAAE3D,MAAMsX,OAAO,UAEtBT,GAAU3W,EAAK,IAAuB,eAAjBA,EAAK,GAAGhE,MAE/BgE,EAAK+W,KAAK,UAAUtU,UAAS,GAG/B3C,KAAK2C,SAAWkU,CAClB,CACF,EACF,EAGAlT,EAAElH,GAAGY,WAAWC,OAAQ,CACzB,CAlcD,CAkcGtB"} \ No newline at end of file +{"version":3,"file":"jquery.form.min.js","sources":["../src/form-members.js","../src/submitter.js","../src/diagnostics.js","../src/options.js","../src/ajax-form.js","../src/form-attributes.js","../src/successful-controls.js","../src/xhr-transport.js","../src/iframe-post.js","../src/iframe-response.js","../src/iframe-lifecycle.js","../src/iframe-transport.js","../src/submission.js","../src/jquery.form.js"],"sourcesContent":["// Form members: the properties and methods the plugin reads or calls on a form. A control named\n// like a member (elements, setAttribute) shadows that member on the form itself, so members are\n// read through the DOM prototypes, which a control cannot shadow.\n\n// The prototype chain of a form, nearest first. Looked up on every call: old browsers have no\n// DOM prototypes, and tests remove them.\nvar owners = [\"HTMLFormElement\", \"HTMLElement\", \"Element\", \"Node\"];\n\n// A form no control can shadow, for methods when the DOM has no prototypes to read them from.\nvar plainForm = document.createElement(\"form\");\n\nfunction findDescriptor(name) {\n for (var i = 0; i < owners.length; i++) {\n var owner = window[owners[i]];\n var descriptor = owner && Object.getOwnPropertyDescriptor(owner.prototype, name);\n\n if (descriptor) {\n return descriptor;\n }\n }\n\n return null;\n}\n\n/**\n * Reads a member of a form through its prototype getter.\n * Falls back to the plain property without DOM prototypes, or on an element the getter does not\n * accept (such as a fieldset for `elements`).\n */\nexport function formMember(form, name) {\n var descriptor = findDescriptor(name);\n\n try {\n return descriptor.get.call(form);\n } catch (e) {\n return form[name];\n }\n}\n\n/**\n * Calls a method of a form through its prototype, or through an unshadowed form without DOM\n * prototypes.\n */\nexport function callFormMethod(form, name) {\n var descriptor = findDescriptor(name);\n var method = descriptor ? descriptor.value : plainForm[name];\n\n return method.apply(form, Array.prototype.slice.call(arguments, 2));\n}\n\n// Nodes such as the document and text nodes have no tag name (#600).\nexport function tagName(el) {\n var name = formMember(el, \"tagName\");\n\n return typeof name === \"string\" ? name.toLowerCase() : \"\";\n}\n\n// Elements only: the subject of formToArray may also be the document or a plain object.\nexport function isElement(node) {\n return formMember(node, \"nodeType\") === 1;\n}\n\n// A control named parentNode makes every parentNode walk (jQuery's trigger and closest among\n// them) cycle between the form and the control.\nexport function assertRealParent(el) {\n if (el.parentNode !== formMember(el, \"parentNode\")) {\n throw new Error(\n 'jquery.form: a form control named \"parentNode\" hides the form\\'s parentNode; rename the control'\n );\n }\n}\n\n// The element itself or its nearest ancestor with one of the tag names, through the real tree.\nexport function closestByTag(el, names) {\n for (var node = el; node; node = formMember(node, \"parentNode\")) {\n if (names.indexOf(tagName(node)) >= 0) {\n return node;\n }\n }\n\n return null;\n}\n","import { closestByTag, formMember } from \"./form-members.js\";\nimport jQuery from \"jquery\";\n\n// The submitter: the button that submitted a form, captured from ajaxForm's clicks. It is kept in\n// a private store and cleared shortly after the click. The form's clk, clk_x and clk_y properties\n// are still written for pages that read them, and read when the store has none.\n\nvar storeKey = \"jqFormSubmitter\";\n\n// Writes a property on the form; a control with that name makes it read-only.\nfunction setExpando(form, name, value) {\n try {\n form[name] = value;\n } catch (ignore) {\n // the control keeps the name; the store has the submitter\n }\n}\n\n// A property the page set on the form, never a control of the form with that name.\nfunction expando(form, name) {\n var value = form[name];\n var els = formMember(form, \"elements\");\n\n return els && value && els.namedItem(name) === value ? undefined : value;\n}\n\n// Records a submitter for a form until the click window ends.\nfunction record(form, el, x, y) {\n jQuery.data(form, storeKey, { el: el, x: x, y: y });\n setExpando(form, \"clk\", el);\n\n if (el.type === \"image\") {\n setExpando(form, \"clk_x\", x);\n setExpando(form, \"clk_y\", y);\n }\n\n // clear form vars\n setTimeout(function () {\n jQuery.data(form, storeKey, null);\n setExpando(form, \"clk\", null);\n setExpando(form, \"clk_x\", null);\n setExpando(form, \"clk_y\", null);\n }, 100);\n}\n\n// The clicked point of an image button, relative to the image.\nfunction imagePoint(e, target) {\n if (typeof e.offsetX !== \"undefined\") {\n return [e.offsetX, e.offsetY];\n }\n\n if (typeof jQuery.fn.offset === \"function\") {\n var offset = jQuery(target).offset();\n\n return [e.pageX - offset.left, e.pageY - offset.top];\n }\n\n return [e.pageX - target.offsetLeft, e.pageY - target.offsetTop];\n}\n\n/**\n * Records the submit or image button a click event reached, for the form it belongs to.\n */\nexport function captureSubmitter(e) {\n // the clicked control, or the button around the clicked content (ex: a span within a button)\n var target = closestByTag(e.target, [\"button\", \"input\"]);\n\n // the type property, unlike the attribute, is \"submit\" for a button without a type (#588)\n if (!target || (target.type !== \"submit\" && target.type !== \"image\")) {\n return;\n }\n\n var form = target.form;\n\n if (!form) {\n // a submit control that belongs to no form\n return;\n }\n\n var point = target.type === \"image\" ? imagePoint(e, target) : [];\n\n record(form, target, point[0], point[1]);\n}\n\n/**\n * Records the submitter a submit event names (SubmitEvent.submitter), when no click was captured.\n * An image submitter gets the point 0,0, as native submission sends it without a click.\n */\nexport function captureEventSubmitter(e, form) {\n var el = e.originalEvent && e.originalEvent.submitter;\n\n if (el && !submitterOf(form)) {\n record(form, el, 0, 0);\n }\n}\n\n/**\n * The form's submitter as { el, x, y } (x and y for an image button), or null.\n */\nexport function submitterOf(form) {\n if (!form) {\n return null;\n }\n\n var stored = jQuery.data(form, storeKey);\n\n if (stored) {\n return stored;\n }\n\n var el = expando(form, \"clk\");\n\n return el ? { el: el, x: expando(form, \"clk_x\"), y: expando(form, \"clk_y\") } : null;\n}\n\n/**\n * The submitter's fields for a post that adds them itself (the iframe upload), as name β†’ value.\n */\nexport function submitterFields(form) {\n var fields = {};\n var sub = submitterOf(form);\n var el = sub && sub.el;\n\n if (el && el.name && !el.disabled) {\n fields[el.name] = el.value;\n if (el.type === \"image\") {\n fields[el.name + \".x\"] = sub.x;\n fields[el.name + \".y\"] = sub.y;\n }\n }\n\n return fields;\n}\n\n/**\n * The form's submitter element, or null.\n */\nexport function submitterElement(form) {\n var sub = submitterOf(form);\n\n return sub ? sub.el : null;\n}\n","import jQuery from \"jquery\";\n\n// Debug logging, switched on by $.fn.ajaxSubmit.debug. The flag is read on every call, so it can\n// be turned on after the plugin loads.\nexport function log() {\n if (!jQuery.fn.ajaxSubmit.debug) {\n return;\n }\n\n var msg = \"[jquery.form] \" + Array.prototype.join.call(arguments, \"\");\n\n if (window.console && window.console.log) {\n window.console.log(msg);\n } else if (window.opera && window.opera.postError) {\n window.opera.postError(msg);\n }\n}\n\nvar warned = {};\n\n/**\n * A deprecation warning: console.warn, only while debug is on, once per id per page. The message\n * names the replacement; the warning adds that the feature is removed in 5.0.\n */\nexport function deprecate(id, message) {\n if (!jQuery.fn.ajaxSubmit.debug || warned[id]) {\n return;\n }\n\n warned[id] = true;\n\n if (window.console && typeof window.console.warn === \"function\") {\n window.console.warn(\"[jquery.form] \" + message + \" (removed in 5.0)\");\n }\n}\n\n// Forgets which deprecations have warned (for tests).\nexport function resetDeprecations() {\n warned = {};\n}\n\n// True for a jQuery version string older than 3.5.\nexport function beforeJQuery35(version) {\n var parts = String(version).split(\".\");\n var major = Number(parts[0]);\n\n return major < 3 || (major === 3 && Number(parts[1]) < 5);\n}\n\n// 5.0 needs jQuery 3.5 or later: warned on the first ajaxSubmit or ajaxForm, given jQuery's version.\nexport function deprecateOldJQuery(version) {\n if (beforeJQuery35(version)) {\n deprecate(\n \"jquery\",\n \"support for jQuery \" + version + \" is deprecated, 5.0 needs jQuery 3.5 or later\"\n );\n }\n}\n","// The arguments ajaxSubmit and ajaxForm accept in place of an options object.\n\n/**\n * Turns the (url, data, dataType, success) shorthand into options. A url of false is kept as\n * the url; anything else is returned as given.\n */\nexport function shorthandOptions(options, data, dataType, onSuccess) {\n if (typeof options !== \"string\" && options !== false) {\n return options;\n }\n\n var result = { url: options, data: data, dataType: dataType };\n\n if (typeof onSuccess === \"function\") {\n result.success = onSuccess;\n }\n\n return result;\n}\n\n// A copy of options without its url, so the form action is used.\nfunction withoutUrl(options) {\n var result = {};\n\n for (var key in options) {\n if (key !== \"url\" && Object.prototype.hasOwnProperty.call(options, key)) {\n result[key] = options[key];\n }\n }\n\n return result;\n}\n\n/**\n * The options ajaxSubmit starts from: a function is the success callback, the shorthand is\n * expanded, and no options at all is an empty object. A url of false or \"\" means the form action.\n */\nexport function submitOptions(options, data, dataType, onSuccess) {\n if (typeof options === \"function\") {\n return { success: options };\n }\n\n options = shorthandOptions(options, data, dataType, onSuccess);\n\n if (typeof options === \"undefined\") {\n return {};\n }\n\n return options.url === false || options.url === \"\" ? withoutUrl(options) : options;\n}\n\n/**\n * jQuery treats `context` as a flat option: after a deep merge, the settings get back the\n * caller's own object from the last source that has one, so `this` in callbacks is that object.\n */\nexport function keepContext(settings, sources) {\n for (var i = 0; i < sources.length; i++) {\n if (sources[i].context !== undefined) {\n settings.context = sources[i].context;\n }\n }\n\n return settings;\n}\n","import { assertRealParent, closestByTag, formMember, isElement } from \"./form-members.js\";\nimport { captureEventSubmitter, captureSubmitter } from \"./submitter.js\";\nimport { deprecate, deprecateOldJQuery, log } from \"./diagnostics.js\";\nimport jQuery from \"jquery\";\nimport { shorthandOptions } from \"./options.js\";\n\n// ajaxForm binding: the submit and click handlers that send a form through ajaxSubmit. The\n// handlers look up $.fn.ajaxSubmit when they run, so a replacement installed later is used.\n\n// Sends the submit event's form with ajaxSubmit, unless an earlier handler cancelled it.\nfunction submitWith(e, options) {\n if (!e.isDefaultPrevented()) {\n // if event has been canceled, don't proceed\n e.preventDefault();\n // the form is found through the real tree: a control named nodeType misleads jQuery's closest\n var form = closestByTag(e.target, [\"form\"]);\n\n // a button outside the form (form attribute), or requestSubmit(button), sends no click here\n captureEventSubmitter(e, form);\n jQuery(form).ajaxSubmit(options); // #365\n }\n}\n\nfunction doAjaxSubmit(e) {\n submitWith(e, e.data);\n}\n\nfunction captureSubmittingElement(e) {\n /* jshint validthis:true */\n assertRealParent(this);\n captureSubmitter(e);\n}\n\n// An empty selection: queued until the DOM is ready (old jQuery keeps the selector), or dropped.\nfunction bindLater($sel, options) {\n var o = { s: $sel.selector, c: $sel.context };\n\n if (!jQuery.isReady && o.s) {\n log(\"DOM not ready, queuing ajaxForm\");\n deprecate(\n \"queue\",\n \"queuing ajaxForm until the DOM is ready is deprecated, call ajaxForm inside $(fn) \" +\n 'or use delegation: \"\"'\n );\n jQuery(function () {\n jQuery(o.s, o.c).ajaxForm(options);\n });\n\n return $sel;\n }\n\n // is your DOM ready? http://docs.jquery.com/Tutorials:Introducing_$(document).ready()\n log(\"terminating; zero elements found by selector\" + (jQuery.isReady ? \"\" : \" (DOM not ready)\"));\n\n return $sel;\n}\n\n// delegation: true on jQuery 3 and later, where the selection has no selector: always warned,\n// debug or not, once per ajaxForm call.\nfunction warnUnscoped() {\n var console = window.console || {};\n\n if (typeof console.warn === \"function\") {\n console.warn(\n \"[jquery.form] delegation: true binds every form on the page on jQuery 3 and later; \" +\n 'pass a selector instead, e.g. delegation: \"form.ajax\"'\n );\n }\n}\n\nfunction bindDelegated($sel, options) {\n if ($sel.selector === undefined) {\n warnUnscoped();\n }\n\n jQuery(document)\n .off(\"submit.form-plugin\", $sel.selector, doAjaxSubmit)\n .off(\"click.form-plugin\", $sel.selector, captureSubmittingElement)\n .on(\"submit.form-plugin\", $sel.selector, options, doAjaxSubmit)\n .on(\"click.form-plugin\", $sel.selector, options, captureSubmittingElement);\n\n return $sel;\n}\n\n// The element itself or its nearest ancestor that matches the selector. The walk never reads a\n// parentNode a control can hide (jQuery's delegated walk does, and cycles on such a form).\nfunction closestMatch(el, selector) {\n if (!isElement(el)) {\n return null;\n }\n\n if (window.Element && Element.prototype.closest) {\n return Element.prototype.closest.call(el, selector);\n }\n\n for (var node = el; node && isElement(node); node = formMember(node, \"parentNode\")) {\n if (jQuery(node).is(selector)) {\n return node;\n }\n }\n\n return null;\n}\n\n// The document handlers bound for each delegation selector, keyed by \"s\" + selector.\nvar delegated = {};\n\nfunction unbindSelector(selector) {\n var handlers = delegated[\"s\" + selector];\n\n if (handlers) {\n jQuery(document)\n .off(\"submit.form-plugin\", handlers.submit)\n .off(\"click.form-plugin\", handlers.click);\n delete delegated[\"s\" + selector];\n }\n}\n\n// delegation: \"\": one handler pair on the document, scoped to the selector.\nfunction bindSelector($sel, selector, options) {\n if (!selector) {\n throw new Error(\"jquery.form: delegation needs a selector, or true\");\n }\n\n var handlers = {\n submit: function (e) {\n if (closestMatch(e.target, selector)) {\n submitWith(e, options);\n }\n },\n click: function (e) {\n if (closestMatch(e.target, selector)) {\n captureSubmitter(e);\n }\n },\n };\n\n unbindSelector(selector);\n delegated[\"s\" + selector] = handlers;\n jQuery(document)\n .on(\"submit.form-plugin\", handlers.submit)\n .on(\"click.form-plugin\", handlers.click);\n\n return $sel;\n}\n\n// Passed by ajaxForm's own rebind: unbind the selection only, never the document handlers.\nvar selectionOnly = {};\n\n/**\n * ajaxForm() binds the selected forms so a submit is sent with ajaxSubmit, with the clicked\n * submit button (and image coordinates) included. The options work as for ajaxSubmit.\n */\nexport function ajaxForm(options, data, dataType, onSuccess) {\n deprecateOldJQuery(jQuery.fn.jquery);\n options = shorthandOptions(options, data, dataType, onSuccess) || {};\n\n if (typeof options.delegation === \"string\") {\n return bindSelector(this, options.delegation, options);\n }\n\n options.delegation = options.delegation && typeof jQuery.fn.on === \"function\";\n\n if (!options.delegation && this.length === 0) {\n return bindLater(this, options);\n }\n\n if (options.delegation) {\n return bindDelegated(this, options);\n }\n\n if (options.beforeFormUnbind) {\n options.beforeFormUnbind(this, options);\n }\n\n return this.ajaxFormUnbind(selectionOnly)\n .on(\"submit.form-plugin\", options, doAjaxSubmit)\n .on(\"click.form-plugin\", options, captureSubmittingElement);\n}\n\n/**\n * ajaxFormUnbind() removes the handlers ajaxForm bound on the selection and every delegated\n * binding on the document. ajaxFormUnbind(selector) removes only that delegation selector.\n */\nexport function ajaxFormUnbind(selector) {\n if (typeof selector === \"string\") {\n unbindSelector(selector);\n\n return this;\n }\n\n if (selector !== selectionOnly) {\n delegated = {};\n jQuery(document).off(\"submit.form-plugin click.form-plugin\");\n }\n\n return this.off(\"submit.form-plugin click.form-plugin\");\n}\n","import { callFormMethod, isElement } from \"./form-members.js\";\nimport jQuery from \"jquery\";\n\n/**\n * An attribute of a form, or undefined when it is absent, as jQuery's attr returns it. The\n * subject may also be the document or a plain object, read through jQuery.\n */\nexport function formAttribute(form, name) {\n if (!isElement(form)) {\n return jQuery(form).attr(name);\n }\n\n var value = callFormMethod(form, \"getAttribute\", name);\n\n return value === null ? undefined : value;\n}\n","import { callFormMethod, formMember, isElement, tagName } from \"./form-members.js\";\nimport { formAttribute } from \"./form-attributes.js\";\nimport jQuery from \"jquery\";\nimport { submitterOf } from \"./submitter.js\";\n\n// Successful controls: which controls of a form are sent, and as which name/value fields\n// (https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#constructing-the-form-data-set).\n\n// Line breaks, sent as CRLF\nvar rLineBreak = /\\r\\n|\\r|\\n/g;\nvar rCR = /\\r/g;\n\n// Listed form elements that are never submitted.\nvar rUnsubmittable = /^(?:fieldset|object|output)$/;\n\n/**\n * Whether a control or option is disabled, also through a disabled fieldset or optgroup. Without\n * selector matching, only its own disabled property is read.\n */\nfunction isDisabled(el) {\n return typeof el.matches === \"function\" ? el.matches(\":disabled\") : !!el.disabled;\n}\n\n/**\n * The successful-control rule: whether a control is sent. `submitter` is the button that\n * submitted the control's form; other submit and image buttons of a form are not sent.\n */\nexport function isSuccessful(el, submitter) {\n var t = el.type;\n\n if (!el.name || isDisabled(el) || t === \"reset\" || t === \"button\") {\n return false;\n }\n\n if (t === \"checkbox\" || t === \"radio\") {\n return !!el.checked;\n }\n\n if (t === \"submit\" || t === \"image\") {\n return !el.form || submitter === el;\n }\n\n return tagName(el) !== \"select\" || el.selectedIndex !== -1;\n}\n\n// The value of a select: the selected option's value for one, a list for several.\nfunction selectValue(el) {\n var index = el.selectedIndex;\n\n if (index < 0) {\n return null;\n }\n\n var a = [],\n ops = el.options;\n var one = el.type === \"select-one\";\n var max = one ? index + 1 : ops.length;\n\n for (var i = one ? index : 0; i < max; i++) {\n var op = ops[i];\n\n if (op.selected && !isDisabled(op)) {\n var v = op.value;\n\n if (!v) {\n // extra pain for IE...\n v =\n op.attributes && op.attributes.value && !op.attributes.value.specified\n ? op.text\n : op.value;\n }\n\n if (one) {\n return v;\n }\n\n a.push(v);\n }\n }\n\n return a;\n}\n\n/**\n * The value of a control, whether or not it is successful: a list for a multiple select, null\n * for a select with nothing selected, otherwise a string with CRLF line breaks (a lone CR or LF\n * included).\n */\nexport function valueOf(el) {\n if (tagName(el) === \"select\") {\n return selectValue(el);\n }\n\n var v = jQuery(el).val();\n var raw = el.value;\n\n // jQuery before 4.0 drops carriage returns from .val(); read them from the value itself\n if (typeof raw === \"string\" && raw.replace(rCR, \"\") === v) {\n v = raw;\n }\n\n return v.replace(rLineBreak, \"\\r\\n\");\n}\n\n/**\n * The fields as a urlencoded body sends them: a selected file as its name.\n */\n// A lone surrogate becomes U+FFFD, as in a native submission; jQuery.param would throw.\nvar loneSurrogate = /[\\uD800-\\uDBFF](?![\\uDC00-\\uDFFF])|([^\\uD800-\\uDBFF]|^)([\\uDC00-\\uDFFF])/g;\n\nfunction wellFormed(value) {\n return typeof value === \"string\"\n ? value.replace(loneSurrogate, function (match, before) {\n return (before || \"\") + \"\\uFFFD\";\n })\n : value;\n}\n\nexport function urlencodedFields(fields) {\n return jQuery.map(fields, function (field) {\n var value =\n field.type === \"file\" && typeof field.value !== \"string\" ? field.value.name : field.value;\n var name = wellFormed(field.name);\n value = wellFormed(value);\n\n return name === field.name && value === field.value ? field : { name: name, value: value };\n });\n}\n\n/**\n * The serialization steps. `feature` holds what the entry detected at load (fileapi).\n */\nexport function createSuccessfulControls(feature) {\n var $ = jQuery;\n\n // #386; inputs that name the form in their form attribute, other than the candidates found.\n // A form only gets the ones it owns.\n function outsideControls(formId, els, owner) {\n // hat tip @thet; the id is compared, never built into a selector\n return $(\":input[form]\")\n .filter(function () {\n return (\n this.getAttribute(\"form\") === formId &&\n (!owner || this.form === owner) &&\n $.inArray(this, els) < 0\n );\n })\n .get();\n }\n\n // A descendant of a form is a candidate unless it is a control another form owns.\n function ownedBy(els, owner) {\n return $.grep(els, function (el) {\n return typeof el.form === \"undefined\" || el.form === owner;\n });\n }\n\n /**\n * The candidate controls of a form, in order: its elements, or every descendant it owns in\n * semantic mode, then the outside controls it owns that name it.\n */\n function controlsOf(form, semantic) {\n var formId = formAttribute(form, \"id\");\n var els = formMember(form, \"elements\");\n\n if (semantic || typeof els === \"undefined\") {\n // the document is not an element; it has its own getElementsByTagName\n els = isElement(form)\n ? callFormMethod(form, \"getElementsByTagName\", \"*\")\n : form.getElementsByTagName(\"*\");\n }\n\n els = $.makeArray(els);\n\n // the subject may also be a fieldset, the document or another container\n var owner = tagName(form) === \"form\" ? form : null;\n\n if (semantic && owner) {\n els = ownedBy(els, owner);\n }\n\n // FinesseRus: in non-IE browsers outside fields are already included in form.elements.\n if (formId && (semantic || /(Edge|Trident)\\//.test(navigator.userAgent))) {\n els = els.concat(outsideControls(formId, els, owner));\n }\n\n return els;\n }\n\n // The fields of a control's value, or null when the control is not sent.\n function fieldsOf(el) {\n var n = el.name;\n // read at call time, so a page that replaces $.fieldValue changes what is sent\n var v = $.fieldValue(el, true);\n\n if (v && v.constructor === Array) {\n return $.map(v, function (value) {\n return { name: n, value: value };\n });\n }\n\n if (feature.fileapi && el.type === \"file\") {\n var files = el.files;\n\n // #180: an empty field when no file is selected\n return files.length\n ? $.map(files, function (file) {\n return { name: n, value: file, type: el.type };\n })\n : [{ name: n, value: \"\", type: el.type }];\n }\n\n if (v === null || typeof v === \"undefined\") {\n return null;\n }\n\n return [{ name: n, value: v, type: el.type, required: el.required }];\n }\n\n // The clicked image's value and coordinates.\n function imageFields(sub, input, type) {\n var n = input.name;\n var value = { name: n, value: $(input).val() };\n\n if (type) {\n value.type = type;\n }\n\n return [value, { name: n + \".x\", value: sub.x }, { name: n + \".y\", value: sub.y }];\n }\n\n // Adds one candidate control's fields, and the control when it has a value to send.\n function addCandidate(collected, form, el, semantic) {\n if (!el.name || isDisabled(el) || rUnsubmittable.test(tagName(el))) {\n return;\n }\n\n var sub = semantic && el.type === \"image\" && submitterOf(form);\n\n if (sub) {\n // handle image inputs on the fly when semantic == true\n if (sub.el === el) {\n collected.fields.push.apply(collected.fields, imageFields(sub, el, el.type));\n }\n\n return;\n }\n\n var own = fieldsOf(el);\n\n if (own) {\n collected.controls.push(el);\n collected.fields.push.apply(collected.fields, own);\n }\n }\n\n // input type=='image' are not found in elements array! handle it here\n function addClickedImage(collected, form) {\n var sub = submitterOf(form);\n var input = sub && $(sub.el)[0];\n\n if (input && input.name && !isDisabled(input) && input.type === \"image\") {\n collected.fields.push.apply(collected.fields, imageFields(sub, input));\n }\n }\n\n /**\n * The fields of a form, as formToArray returns them, and the controls they came from.\n */\n function collect(form, semantic, filtering) {\n var collected = { fields: [], controls: [] };\n\n if (!form) {\n return collected;\n }\n\n var els = controlsOf(form, semantic);\n\n if (typeof filtering === \"function\") {\n els = $.map(els, filtering);\n }\n\n for (var i = 0; i < els.length; i++) {\n addCandidate(collected, form, els[i], semantic);\n }\n\n if (!semantic) {\n addClickedImage(collected, form);\n }\n\n return collected;\n }\n\n return {\n controlsOf: controlsOf,\n fieldsOf: fieldsOf,\n collect: collect,\n };\n}\n","import jQuery from \"jquery\";\nimport { keepContext } from \"./options.js\";\n\n// The XMLHttpRequest transports: $.ajax with the encoded fields, or FormData for file uploads.\nvar $ = jQuery;\n\n// utility fn for deep serialization: [name, value] pairs, as $.param encodes them\nexport function deepSerialize(extraData, traditional) {\n var param = $.param(extraData, traditional);\n var serialized = param ? param.split(\"&\") : [];\n var len = serialized.length;\n var result = [];\n var i, part;\n\n for (i = 0; i < len; i++) {\n // #252; undo param space replacement\n serialized[i] = serialized[i].replace(/\\+/g, \" \");\n part = serialized[i].split(\"=\");\n // #278; use array instead of object storage, favoring array serializations\n result.push([decodeURIComponent(part[0]), decodeURIComponent(part[1])]);\n }\n\n return result;\n}\n\n/**\n * Posts the fields and extraData as FormData, for files with the File API.\n * XMLHttpRequest Level 2 file uploads (big hat tip to francois2metz)\n */\nexport function sendFormData(submission) {\n var options = submission.options;\n var a = submission.fields;\n\n var formdata = new FormData();\n\n for (var i = 0; i < a.length; i++) {\n formdata.append(a[i].name, a[i].value);\n }\n\n if (options.extraData) {\n var serializedData = deepSerialize(options.extraData, submission.traditional);\n\n for (i = 0; i < serializedData.length; i++) {\n formdata.append(serializedData[i][0], serializedData[i][1]);\n }\n }\n\n options.data = null;\n\n var s = $.extend(true, {}, $.ajaxSettings, options, {\n contentType: false,\n processData: false,\n cache: false,\n type: submission.method || \"POST\",\n });\n\n keepContext(s, [$.ajaxSettings, options]);\n\n if (options.uploadProgress) {\n // workaround because jqXHR does not expose upload property: wraps the xhr factory, the\n // caller's or jQuery's\n var createXhr = s.xhr;\n\n s.xhr = function () {\n var xhr = createXhr.call(this);\n\n if (xhr.upload) {\n xhr.upload.addEventListener(\n \"progress\",\n function (event) {\n var percent = 0;\n // event.position is the deprecated name, read only when loaded is missing\n var position = event.loaded !== undefined ? event.loaded : event.position;\n var total = event.total;\n\n if (event.lengthComputable) {\n percent = Math.ceil((position / total) * 100);\n }\n\n options.uploadProgress(event, position, total, percent);\n },\n false\n );\n }\n\n return xhr;\n };\n }\n\n s.data = null;\n\n var beforeSend = s.beforeSend;\n\n s.beforeSend = function (xhr, o) {\n // Send FormData() provided by user\n if (options.formData) {\n o.data = options.formData;\n } else {\n o.data = formdata;\n }\n\n // a veto (false) cancels the upload, as on the other transports\n return beforeSend ? beforeSend.call(this, xhr, o) : undefined;\n };\n\n return $.ajax(s);\n}\n\n/**\n * Sends the encoded fields with $.ajax.\n */\nexport function sendAjax(submission) {\n return $.ajax(submission.options);\n}\n","import { callFormMethod } from \"./form-members.js\";\nimport { deepSerialize } from \"./xhr-transport.js\";\nimport jQuery from \"jquery\";\nimport { submitterFields } from \"./submitter.js\";\n\n// The iframe form post: the extra fields (submitter, CSRF, data), the form attributes set while\n// posting and restored after, and the native submit.\nvar $ = jQuery;\n\n// The form attributes an iframe upload changes while it posts.\nvar uploadAttributes = [\"action\", \"target\", \"method\", \"enctype\", \"encoding\"];\n\n// Called through the prototype: an extraData key or a form field may be named hasOwnProperty.\nvar hasOwn = Object.prototype.hasOwnProperty;\n\nfunction isGet(method) {\n return /^get$/i.test(method);\n}\n\n// Resolves both URLs through anchors, as jQuery does for crossDomain, so IE's anchor quirks\n// apply to both sides of the comparison.\nfunction isSameOrigin(url) {\n var origin = document.createElement(\"a\");\n var target = document.createElement(\"a\");\n\n origin.href = window.location.href;\n target.href = url;\n // IE fills in the host of a relative URL only once the resolved href is assigned back\n target.href = target.href; // eslint-disable-line no-self-assign\n\n return origin.protocol + \"//\" + origin.host === target.protocol + \"//\" + target.host;\n}\n\n/** Adds the clicked submitter (and an image's coordinates) to s.extraData. */\nexport function addSubmitterFields(s, form) {\n // add submitting element to data if we know it\n var fields = submitterFields(form);\n\n for (var n in fields) {\n s.extraData = s.extraData || {};\n s.extraData[n] = fields[n];\n }\n}\n\n/** Adds the page's CSRF token to s.extraData when the form is posted to the page's origin. */\nexport function addCsrfField(s, form, method, forms) {\n // Rails CSRF hack (thanks to Yvan Barthelemy); like jquery-ujs, only for the page's origin and\n // only when the form is posted, since a get form would put the token in the url\n var csrf_token = $(\"meta[name=csrf-token]\").attr(\"content\");\n var csrf_param = $(\"meta[name=csrf-param]\").attr(\"content\");\n var posts =\n !isGet(method) &&\n (!method || /post/i.test(method) || /post/i.test(forms.property(form, \"method\")));\n\n if (csrf_param && csrf_token && posts && isSameOrigin(s.url)) {\n s.extraData = s.extraData || {};\n s.extraData[csrf_param] = csrf_token;\n }\n}\n\nfunction setFormAttribute(form, name, value) {\n callFormMethod(form, \"setAttribute\", name, value);\n}\n\n/** The raw attributes the upload changes, null when absent, to put back exactly (#380). */\nexport function saveAttributes(form) {\n var saved = {};\n\n $.each(uploadAttributes, function (i, name) {\n saved[name] = callFormMethod(form, \"hasAttribute\", name)\n ? callFormMethod(form, \"getAttribute\", name)\n : null;\n });\n\n return saved;\n}\n\n/** Puts back the attributes saveAttributes recorded, removing those that were absent. */\nexport function restoreAttributes(form, saved) {\n $.each(uploadAttributes, function (i, name) {\n if (saved[name] === null) {\n callFormMethod(form, \"removeAttribute\", name);\n } else {\n setFormAttribute(form, name, saved[name]);\n }\n });\n}\n\n/** Points the form at the frame `target` with the upload's url, method and encoding. */\nexport function setUploadAttributes(form, target, method, s, forms) {\n var mp = \"multipart/form-data\";\n\n // update form attrs in IE friendly way\n setFormAttribute(form, \"target\", target);\n if (!method || /post/i.test(method)) {\n setFormAttribute(form, \"method\", \"POST\");\n } else if (isGet(method) && !isGet(forms.property(form, \"method\"))) {\n // a form posts natively only with GET or POST; other verbs keep the form's own method\n setFormAttribute(form, \"method\", \"GET\");\n }\n setFormAttribute(form, \"action\", s.url);\n\n // ie borks in some cases when setting encoding\n if (!s.skipEncodingOverride && (!method || /post/i.test(method))) {\n setFormAttribute(form, \"encoding\", mp);\n setFormAttribute(form, \"enctype\", mp);\n }\n}\n\n/** Appends a hidden input per extraData field to the form; each input is pushed onto `added`. */\nexport function addExtraInputs(form, ownerDocument, extraData, traditional, added) {\n // Builds the input with DOM properties: a name is never parsed as HTML.\n function addHiddenInput(name, value) {\n var input = ownerDocument.createElement(\"input\");\n\n input.type = \"hidden\";\n input.name = name;\n added.push($(input).val(value).appendTo(form)[0]);\n }\n\n if (extraData) {\n for (var n in extraData) {\n if (hasOwn.call(extraData, n)) {\n // if using the $.param format that allows for multiple values with the same name\n if (\n $.isPlainObject(extraData[n]) &&\n hasOwn.call(extraData[n], \"name\") &&\n hasOwn.call(extraData[n], \"value\")\n ) {\n addHiddenInput(extraData[n].name, extraData[n].value);\n } else {\n // arrays and objects become one field per value, as $.param sends them (#597)\n var single = {};\n\n single[n] = extraData[n];\n var fields = deepSerialize(single, traditional);\n\n for (var f = 0; f < fields.length; f++) {\n addHiddenInput(fields[f][0], fields[f][1]);\n }\n }\n }\n }\n }\n}\n\n/** Submits the form natively, even when a control named submit hides the method. */\nexport function submitForm(form) {\n try {\n form.submit();\n } catch (err) {\n // just in case form has element with name/id of 'submit'\n callFormMethod(form, \"submit\");\n }\n}\n","import jQuery from \"jquery\";\nimport { log } from \"./diagnostics.js\";\n\n// The iframe response reader: turns the frame's document into the mock xhr's text, XML, status\n// and dataType, then parses it as $.ajax would (dataFilter, JSON, script).\nvar $ = jQuery;\n\n/** The frame's document, or null when the browser denies access to it. */\nexport function getDoc(frame) {\n /* it looks like contentWindow or contentDocument do not\n * carry the protocol property in ie8, when running under ssl\n * frame.document is the only valid response document, since\n * the protocol is know but not on the other two objects. strange?\n * \"Same origin policy\" http://en.wikipedia.org/wiki/Same_origin_policy\n */\n\n var doc = null;\n\n // IE8 cascading access check\n try {\n if (frame.contentWindow) {\n doc = frame.contentWindow.document;\n }\n } catch (err) {\n // IE8 access denied under ssl & missing protocol\n log(\"cannot get iframe.contentWindow document: \" + err);\n }\n\n if (doc) {\n // successful getting content\n return doc;\n }\n\n try {\n // simply checking may throw in ie8 under ssl or mismatched protocol\n doc = frame.contentDocument ? frame.contentDocument : frame.document;\n } catch (err) {\n // last attempt\n log(\"cannot get iframe.contentDocument: \" + err);\n doc = frame.document;\n }\n\n return doc;\n}\n\n/** Parses the response text or XML for the given (lowercase) dataType. */\nexport function httpData(xhr, type, s) {\n // mostly lifted from jq1.4.4\n\n var ct = xhr.getResponseHeader(\"content-type\") || \"\",\n xml = (type === \"xml\" || !type) && ct.indexOf(\"xml\") >= 0,\n data = xml ? xhr.responseXML : xhr.responseText;\n\n if (xml && data.documentElement.nodeName === \"parsererror\") {\n if ($.error) {\n $.error(\"parsererror\");\n }\n }\n if (s && s.dataFilter) {\n data = s.dataFilter(data, type);\n }\n if (typeof data === \"string\") {\n if ((type === \"json\" || !type) && ct.indexOf(\"json\") >= 0) {\n data = JSON.parse(data);\n } else if (type === \"script\") {\n $.globalEval(data);\n }\n }\n\n return data;\n}\n\n// Copies the status and statusText attributes of an element onto the mock xhr.\nfunction readStatus(xhr, el) {\n // support for XHR 'status' & 'statusText' emulation :\n xhr.status = Number(el.getAttribute(\"status\")) || xhr.status;\n xhr.statusText = el.getAttribute(\"statusText\") || xhr.statusText;\n}\n\n// Fills the mock xhr from the document itself.\nfunction readDocument(doc, xhr, s, isXml) {\n var docRoot = doc.body ? doc.body : doc.documentElement;\n\n xhr.responseText = docRoot ? docRoot.innerHTML : null;\n xhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc;\n if (isXml) {\n s.dataType = \"xml\";\n }\n xhr.getResponseHeader = function (header) {\n // the dataType in lowercase, as $.ajax reads it\n var headers = { \"content-type\": s.dataType && s.dataType.toLowerCase() };\n\n return headers[header.toLowerCase()];\n };\n if (docRoot) {\n readStatus(xhr, docRoot);\n }\n}\n\n// A response embedded in a textarea, or text wrapped in pre or body, replaces responseText.\nfunction readEmbedded(doc, xhr, dt, s) {\n var scr = /(json|script|text)/.test(dt);\n\n if (!scr && !s.textarea) {\n return;\n }\n // see if user embedded response in textarea\n var ta = doc.getElementsByTagName(\"textarea\")[0];\n\n if (ta) {\n xhr.responseText = ta.value;\n readStatus(xhr, ta);\n } else if (scr) {\n // account for browsers injecting pre around json response\n var pre = doc.getElementsByTagName(\"pre\")[0];\n var b = doc.getElementsByTagName(\"body\")[0];\n\n if (pre) {\n xhr.responseText = pre.textContent ? pre.textContent : pre.innerText;\n } else if (b) {\n xhr.responseText = b.textContent ? b.textContent : b.innerText;\n }\n }\n}\n\n/**\n * Reads and parses the response document into the mock xhr. Returns {status, data, errMsg}, or\n * null when `retry()` asks to read the document again later (Opera's untraversable DOM).\n */\nexport function readResponse(doc, xhr, s, retry) {\n var status = \"success\",\n data,\n errMsg;\n\n try {\n var isXml = /^xml$/i.test(s.dataType) || doc.XMLDocument || $.isXMLDoc(doc);\n\n log(\"isXml=\" + isXml);\n\n if (!isXml && window.opera && (doc.body === null || !doc.body.innerHTML)) {\n // in some browsers (Opera) the iframe DOM is not always traversable when\n // the onload callback fires, so we loop a bit to accommodate\n if (retry()) {\n return null;\n }\n // let this fall through because server response could be an empty document\n }\n\n readDocument(doc, xhr, s, isXml);\n\n var dt = (s.dataType || \"\").toLowerCase();\n\n readEmbedded(doc, xhr, dt, s);\n\n try {\n data = httpData(xhr, dt, s);\n } catch (err) {\n status = \"parsererror\";\n xhr.error = errMsg = err || status;\n }\n } catch (err) {\n log(\"error caught: \", err);\n status = \"error\";\n xhr.error = errMsg = err;\n }\n\n return { status: status, data: data, errMsg: errMsg };\n}\n","import jQuery from \"jquery\";\nimport { log } from \"./diagnostics.js\";\n\n// The iframe upload's lifecycle: the mock xhr and the Deferred, the global ajax events, the\n// beforeSend veto, the timeout, abort and settling.\nvar $ = jQuery;\n\n/**\n * Creates the lifecycle of one upload with the merged settings `s`. `frame.stop()` stops the\n * frame's load and `frame.release()` removes or resets the frame after the upload.\n */\nexport function createLifecycle(s, frame) {\n var g,\n timeoutHandle,\n callbackProcessed,\n deferred = $.Deferred();\n\n var xhr = {\n // mock object\n aborted: 0,\n responseText: null,\n responseXML: null,\n status: 0,\n statusText: \"n/a\",\n getAllResponseHeaders: function () {},\n getResponseHeader: function () {},\n setRequestHeader: function () {},\n abort: function (status) {\n abort(status, [xhr, \"aborted\", status]);\n },\n };\n\n // #341\n deferred.abort = function (status) {\n xhr.abort(status);\n };\n\n function done() {\n return xhr.aborted || callbackProcessed;\n }\n\n // Completes an aborted upload once and rejects the Deferred with `rejection`.\n // `textStatus` replaces the default \"timeout\"/\"aborted\" text status.\n function abort(status, rejection, textStatus) {\n var e = textStatus || (status === \"timeout\" ? \"timeout\" : \"aborted\");\n\n if (done()) {\n return;\n }\n\n log(\"aborting upload... \" + e);\n xhr.aborted = 1;\n frame.stop();\n xhr.error = e;\n if (s.error) {\n s.error.call(s.context, xhr, e, status);\n }\n deferred.reject.apply(deferred, rejection);\n\n if (g) {\n $.event.trigger(\"ajaxError\", [xhr, s, e]);\n }\n\n complete(e);\n }\n\n // The global events that end every upload, cancelled ones included.\n function endGlobalEvents() {\n if (g) {\n $.event.trigger(\"ajaxComplete\", [xhr, s]);\n }\n\n if (g && !--$.active) {\n $.event.trigger(\"ajaxStop\");\n }\n }\n\n // The steps every finished or aborted upload ends with, in $.ajax order.\n function complete(status) {\n if (s.complete) {\n s.complete.call(s.context, xhr, status);\n }\n\n endGlobalEvents();\n clearTimeout(timeoutHandle);\n\n // clean up\n setTimeout(function () {\n frame.release();\n xhr.responseXML = null;\n }, 100);\n }\n\n // A beforeSend veto ends the upload as $.ajax cancels a request: no callbacks, the global\n // events end with ajaxError \"canceled\".\n function cancel() {\n if (done()) {\n return;\n }\n\n callbackProcessed = true;\n deferred.reject();\n if (g) {\n $.event.trigger(\"ajaxError\", [xhr, s, \"canceled\"]);\n }\n endGlobalEvents();\n }\n\n // Fires the start events and beforeSend; false when the upload must not be posted.\n function start() {\n g = s.global;\n // trigger ajax global events so that activity/block indicators work like normal\n if (g && $.active++ === 0) {\n $.event.trigger(\"ajaxStart\");\n }\n\n if (s.beforeSend && s.beforeSend.call(s.context, xhr, s) === false) {\n cancel();\n\n return false;\n }\n\n if (xhr.aborted) {\n // abort() in beforeSend already completed the upload\n return false;\n }\n\n if (g) {\n $.event.trigger(\"ajaxSend\", [xhr, s]);\n }\n\n // an ajaxSend handler may abort too\n return !xhr.aborted;\n }\n\n // Resolves the upload; returns {error} when the success callback threw.\n function succeed(data) {\n var failure;\n\n try {\n s.success.call(s.context, data, \"success\", xhr);\n } catch (err) {\n failure = { error: err };\n }\n\n deferred.resolve(xhr.responseText, \"success\", xhr);\n\n if (g) {\n $.event.trigger(\"ajaxSuccess\", [xhr, s, data]);\n }\n\n return failure;\n }\n\n // Settles the upload with the response reader's {status, data, errMsg}.\n function settle(result) {\n var status = result.status,\n errMsg = result.errMsg;\n\n if (xhr.aborted) {\n // abort() completed the upload while its response was processed\n log(\"upload aborted\");\n\n return;\n }\n\n // an emulated HTTP error status wins, as in $.ajax; a parse error is kept otherwise\n if (xhr.status && !((xhr.status >= 200 && xhr.status < 300) || xhr.status === 304)) {\n status = \"error\";\n }\n\n callbackProcessed = true;\n\n // ordering of these callbacks/triggers is odd, but that's how $.ajax does it\n if (status === \"success\") {\n var failure = succeed(result.data);\n\n complete(status);\n if (failure) {\n // the upload is settled; the success callback's exception still reaches the console\n throw failure.error;\n }\n\n return;\n }\n\n if (typeof errMsg === \"undefined\") {\n errMsg = xhr.statusText;\n }\n if (s.error) {\n s.error.call(s.context, xhr, status, errMsg);\n }\n deferred.reject(xhr, \"error\", errMsg);\n if (g) {\n $.event.trigger(\"ajaxError\", [xhr, s, errMsg]);\n }\n\n complete(status);\n }\n\n return {\n xhr: xhr,\n deferred: deferred,\n start: start,\n done: done,\n abort: abort,\n settle: settle,\n // Settles an upload that failed with an exception (ignored once aborted).\n fail: function (err) {\n settle({ status: \"error\", errMsg: err });\n },\n // Runs `onTimeout` after s.timeout, when set.\n startTimer: function (onTimeout) {\n if (s.timeout) {\n timeoutHandle = setTimeout(onTimeout, s.timeout);\n }\n },\n stopTimer: function () {\n clearTimeout(timeoutHandle);\n timeoutHandle = undefined;\n },\n };\n}\n","import {\n addCsrfField,\n addExtraInputs,\n addSubmitterFields,\n restoreAttributes,\n saveAttributes,\n setUploadAttributes,\n submitForm,\n} from \"./iframe-post.js\";\nimport { closestByTag, formMember } from \"./form-members.js\";\nimport { deprecate, log } from \"./diagnostics.js\";\nimport { getDoc, readResponse } from \"./iframe-response.js\";\nimport { createLifecycle } from \"./iframe-lifecycle.js\";\nimport jQuery from \"jquery\";\nimport { keepContext } from \"./options.js\";\n\n// The iframe transport: posts the form itself into a hidden frame and reads the response from it,\n// for file uploads without the File API or when the iframe option asks for it.\nvar $ = jQuery;\n\n/**\n * The iframe send step. `hasProp` is what the entry detected at load; `forms.property` reads a\n * form property as attr2 does.\n */\nexport function createIframeTransport(hasProp, forms) {\n var CLIENT_TIMEOUT_ABORT = 1;\n var SERVER_ABORT = 2;\n // tells apart the frames of uploads that start in the same millisecond\n var frameCount = 0;\n\n // ensure that every serialized input is still enabled\n function enableControls(elements) {\n for (var i = 0; i < elements.length; i++) {\n var el = $(elements[i]);\n\n if (hasProp) {\n el.prop(\"disabled\", false);\n } else {\n el.removeAttr(\"disabled\");\n }\n }\n }\n\n // Names the frame's window, when the page may: a cross-origin or sandboxed frame refuses.\n function nameWindow(frame, name) {\n try {\n if (frame.contentWindow) {\n frame.contentWindow.name = name;\n }\n } catch (ignore) {}\n }\n\n // The frame the form posts into: the iframeTarget, named `id` when it has no name, or a new\n // hidden frame named `id`. Returns the frame and the name the form targets.\n function createFrame(s, id, ownerDocument) {\n var $io, n;\n\n if (s.iframeTarget) {\n $io = $(s.iframeTarget, ownerDocument);\n n = $io.attr(\"name\");\n if (!n) {\n $io.attr(\"name\", id);\n // a frame already in the page keeps the browsing context name it was inserted with\n $io.each(function () {\n nameWindow(this, id);\n });\n } else {\n id = n;\n }\n } else {\n var io = ownerDocument.createElement(\"iframe\");\n\n io.setAttribute(\"name\", id);\n io.setAttribute(\"src\", s.iframeSrc);\n $io = $(io);\n $io.css({ position: \"absolute\", top: \"-1000px\", left: \"-1000px\" });\n }\n\n return { $io: $io, id: id };\n }\n\n // The frame hooks the lifecycle calls: stop a load in progress, and release after the upload.\n function frameHooks(s, $io) {\n return {\n stop: function () {\n try {\n // #214, #257\n if ($io[0].contentWindow.document.execCommand) {\n $io[0].contentWindow.document.execCommand(\"Stop\");\n }\n } catch (ignore) {}\n\n $io.attr(\"src\", s.iframeSrc); // abort op in progress\n },\n release: function () {\n if (!s.iframeTarget) {\n $io.remove();\n } else {\n // adding else to clean up existing iframe response.\n $io.attr(\"src\", s.iframeSrc);\n }\n },\n };\n }\n\n function listen(io, cb) {\n if (io.attachEvent) {\n io.attachEvent(\"onload\", cb);\n } else {\n io.addEventListener(\"load\", cb, false);\n }\n }\n\n function unlisten(io, cb) {\n if (io.detachEvent) {\n io.detachEvent(\"onload\", cb);\n } else {\n io.removeEventListener(\"load\", cb, false);\n }\n }\n\n // private function for handling file uploads (hat tip to YAHOO!)\n function fileUploadIframe(submission) {\n var form = submission.form,\n method = submission.method;\n\n var s = keepContext($.extend(true, {}, $.ajaxSettings, submission.options), [\n $.ajaxSettings,\n submission.options,\n ]);\n\n s.context = s.context || s;\n var ownerDocument = formMember(form, \"ownerDocument\");\n var $body = $(closestByTag(form, [\"body\"]));\n var frame = createFrame(s, \"jqFormIO\" + new Date().getTime() + frameCount++, ownerDocument);\n var $io = frame.$io,\n io = $io[0];\n var life = createLifecycle(s, frameHooks(s, $io));\n var domCheckCount = 50;\n\n if (!life.start()) {\n return life.deferred;\n }\n\n addSubmitterFields(s, form);\n addCsrfField(s, form, method, forms);\n\n // look for server aborts\n function checkState() {\n try {\n var state = getDoc(io).readyState;\n\n log(\"state = \" + state);\n if (state && state.toLowerCase() === \"uninitialized\") {\n setTimeout(checkState, 50);\n }\n } catch (e) {\n log(\"Server abort: \", e, \" (\", e.name, \")\");\n cb(SERVER_ABORT);\n life.stopTimer();\n }\n }\n\n // take a breath so that pending repaints get some cpu time before the upload starts\n function doSubmit() {\n var saved = saveAttributes(form);\n\n setUploadAttributes(form, frame.id, method, s, forms);\n\n // support timout\n life.startTimer(function () {\n cb(CLIENT_TIMEOUT_ABORT);\n });\n\n // add \"extra\" data to form if provided in options\n var extraInputs = [];\n\n try {\n addExtraInputs(form, ownerDocument, s.extraData, submission.traditional, extraInputs);\n\n if (!s.iframeTarget) {\n // add iframe to doc and submit the form\n $io.appendTo($body);\n }\n\n // A connected form posting into a frame outside the document opens a new window.\n var root = ownerDocument.documentElement;\n\n if (io && $.contains(root, form) && !$.contains(root, io)) {\n var notInDocument = \"jquery.form: the upload frame is not in the document\";\n\n life.abort(notInDocument, [life.xhr, \"error\", notInDocument], \"error\");\n\n return;\n }\n\n listen(io, cb);\n setTimeout(checkState, 15);\n submitForm(form);\n } finally {\n // reset attrs and remove \"extra\" input elements\n restoreAttributes(form, saved);\n $(extraInputs).remove();\n }\n }\n\n // Reads the next document by Opera's rules: false once the retries are used up.\n function retry() {\n if (--domCheckCount) {\n log(\"requeing onLoad callback, DOM not available\");\n setTimeout(cb, 250);\n\n return true;\n }\n\n return false;\n }\n\n function cb(e) {\n if (life.done()) {\n return;\n }\n\n var doc = getDoc(io);\n\n if (!doc) {\n log(\"cannot access response document\");\n e = SERVER_ABORT;\n }\n if (e === CLIENT_TIMEOUT_ABORT) {\n life.abort(\"timeout\", [life.xhr, \"timeout\"]);\n\n return;\n }\n if (e === SERVER_ABORT) {\n life.abort(\"server abort\", [life.xhr, \"error\", \"server abort\"]);\n\n return;\n }\n\n if (doc.location.href === s.iframeSrc) {\n // response not received yet\n return;\n }\n\n unlisten(io, cb);\n\n var result = readResponse(doc, life.xhr, s, retry);\n\n if (result) {\n life.settle(result);\n }\n }\n\n // An exception while posting settles the upload with \"error\" and the exception.\n function post() {\n if (life.done()) {\n // aborted before the delayed post\n return;\n }\n\n try {\n doSubmit();\n } catch (err) {\n log(\"upload failed: \", err);\n life.fail(err);\n }\n }\n\n if (s.forceSync) {\n post();\n } else {\n setTimeout(post, 10); // this lets dom updates render\n }\n\n return life.deferred;\n }\n\n return function sendIframe(submission) {\n var jqxhr;\n\n // now, while the controls are still listed: ajaxSubmit clears the list when it returns,\n // before a closeKeepAlive request completes\n enableControls(submission.controls);\n\n // hack to fix Safari hang (thanks to Tim Molendijk for this)\n // see: http://groups.google.com/group/jquery-dev/browse_thread/thread/36395b7ab510dd5d\n if (submission.options.closeKeepAlive) {\n deprecate(\"closeKeepAlive\", \"closeKeepAlive works around a Safari 3/4 bug and is deprecated\");\n $.get(submission.options.closeKeepAlive, function () {\n jqxhr = fileUploadIframe(submission);\n });\n } else {\n jqxhr = fileUploadIframe(submission);\n }\n\n return jqxhr;\n };\n}\n","import { deprecate, log } from \"./diagnostics.js\";\nimport { assertRealParent } from \"./form-members.js\";\nimport jQuery from \"jquery\";\nimport { keepContext } from \"./options.js\";\nimport { urlencodedFields } from \"./successful-controls.js\";\n\n// A Submission is one ajaxSubmit call once its vetoes have passed:\n// { form, $form, fields, controls, options, method, traditional }. `options` is the object the\n// callbacks and events receive; later steps change it in place.\n\n/**\n * The submission steps. `feature` holds what the entry detected at load (fileapi, formdata), and\n * `forms` reads form attributes and attr2-style properties (attribute, property), and\n * `serialization` collects the form's fields and controls.\n */\nexport function createSubmission(feature, forms, serialization) {\n var $ = jQuery;\n\n function refuse(message) {\n log(message);\n\n return null;\n }\n\n // The options merged over the form's action, the method, and the ajax defaults.\n function withDefaults(form, options, method) {\n var action = options.url || forms.property(form, \"action\");\n var url = typeof action === \"string\" ? action.trim() : \"\";\n\n // clean url (don't include hash value); an action that is only a fragment means this page\n url = url.split(\"#\")[0] || window.location.href.split(\"#\")[0];\n // IE requires javascript:false in https, but this breaks chrome >83 and goes against spec.\n // Instead of using javascript:false always, let's only apply it for IE.\n var isMsie = /(MSIE|Trident)/.test(navigator.userAgent || \"\");\n var iframeSrc = isMsie && /^https/i.test(document.URL) ? \"javascript:false\" : \"about:blank\"; // eslint-disable-line no-script-url\n\n var merged = $.extend(\n true,\n {\n url: url,\n success: $.ajaxSettings.success,\n type: method || $.ajaxSettings.type,\n iframeSrc: iframeSrc,\n },\n options\n );\n\n return keepContext(merged, [options]);\n }\n\n /**\n * The one method every transport sends, read after the hooks: `method` wins over `type`, and\n * `type` is set to it. Undefined when only the ajax default applies, so each transport keeps\n * its own default.\n */\n function resolveMethod(options, defaultType) {\n var resolved = options.method || options.type;\n\n options.type = resolved;\n\n return resolved === defaultType && !options.method ? undefined : resolved;\n }\n\n // The data option, kept as extraData and encoded, or undefined without one.\n function extraQuery(fields, options, traditional) {\n if (!options.data) {\n return undefined;\n }\n\n var optionsData = typeof options.data === \"function\" ? options.data(fields) : options.data;\n\n if (typeof optionsData === \"string\") {\n if (options.requestFormat === \"json\") {\n throw new Error(\n 'jquery.form: requestFormat \"json\" needs object data; a string data option is a query string'\n );\n }\n\n // a query string: sent as-is when urlencoded, as its own fields otherwise\n options.extraData = queryPairs(optionsData);\n\n return optionsData;\n }\n\n options.extraData = optionsData;\n\n return $.param(optionsData, traditional);\n }\n\n // Sets a key as an own data property, so a name like __proto__ is an ordinary key.\n function defineKey(object, key, value) {\n Object.defineProperty(object, key, {\n value: value,\n enumerable: true,\n writable: true,\n configurable: true,\n });\n }\n\n /**\n * requestFormat \"json\" (#545): the fields as an object (a repeated name gives an array), merged\n * with object data, sent as a JSON body. Based on the idea in PR #557 by zhangciwu.\n */\n function jsonBody(options, fields) {\n if (/^get$/i.test(options.type)) {\n throw new Error('jquery.form: requestFormat \"json\" needs a method with a body, such as POST');\n }\n\n var body = {};\n var own = Object.prototype.hasOwnProperty;\n\n for (var i = 0; i < fields.length; i++) {\n var name = fields[i].name;\n\n if (!own.call(body, name)) {\n defineKey(body, name, fields[i].value);\n } else if (Array.isArray(body[name])) {\n body[name].push(fields[i].value);\n } else {\n defineKey(body, name, [body[name], fields[i].value]);\n }\n }\n\n var extra = options.extraData;\n\n for (var key in extra) {\n if (own.call(extra, key)) {\n defineKey(body, key, extra[key]);\n }\n }\n\n options.data = JSON.stringify(body);\n options.contentType = \"application/json; charset=UTF-8\";\n }\n\n // The fields of a query string, as the { name, value } list $.param takes.\n function queryPairs(query) {\n var pairs = [];\n var parts = query.split(\"&\");\n\n for (var i = 0; i < parts.length; i++) {\n if (parts[i]) {\n var at = parts[i].indexOf(\"=\");\n var name = at < 0 ? parts[i] : parts[i].slice(0, at);\n var value = at < 0 ? \"\" : parts[i].slice(at + 1);\n\n pairs.push({ name: decodeQuery(name), value: decodeQuery(value) });\n }\n }\n\n return pairs;\n }\n\n function decodeQuery(text) {\n return decodeURIComponent(text.replace(/\\+/g, \" \"));\n }\n\n // Puts the encoded fields in the url for a get, and in the data otherwise.\n function encode(options, q, qx) {\n if (qx) {\n q = q ? q + \"&\" + qx : qx;\n }\n\n if (options.type.toUpperCase() === \"GET\") {\n // the query goes before any fragment in the url option\n var hashAt = options.url.indexOf(\"#\");\n var base = hashAt < 0 ? options.url : options.url.slice(0, hashAt);\n\n options.url =\n base + (base.indexOf(\"?\") >= 0 ? \"&\" : \"?\") + q + options.url.slice(base.length);\n options.data = null; // data is null for 'get'\n } else {\n options.data = q; // data is the query string for 'post'\n }\n }\n\n // A callback option as a list: an array as given, one function, or none.\n function callbackList(callback) {\n if (Array.isArray(callback)) {\n return callback;\n }\n\n return callback ? [callback] : [];\n }\n\n // Calls each callback in order with the same this and arguments.\n function callEach(callbacks, context, args) {\n for (var i = 0; i < callbacks.length; i++) {\n callbacks[i].apply(context, args);\n }\n }\n\n /**\n * Resolves the options, serializes the form, and runs the vetoes: the Submission, or null when\n * an event or callback stopped it.\n */\n function prepare($set, options) {\n $set.each(function () {\n assertRealParent(this);\n });\n\n var form = $set[0];\n var method = options.method || options.type || forms.property(form, \"method\");\n\n options = withDefaults(form, options, method);\n\n // the ajax default type, when neither the caller nor the form gave a method\n var defaultType = method ? undefined : options.type;\n\n // hook for manipulating the form data before it is extracted;\n // convenient for use with rich editors like tinyMCE or FCKEditor\n var veto = {};\n\n $set.trigger(\"form-pre-serialize\", [$set, options, veto]);\n if (veto.veto) {\n return refuse(\"ajaxSubmit: submit vetoed via form-pre-serialize trigger\");\n }\n\n // provide opportunity to alter form data before it is serialized\n if (options.beforeSerialize && options.beforeSerialize($set, options) === false) {\n return refuse(\"ajaxSubmit: submit aborted via beforeSerialize callback\");\n }\n\n var traditional = options.traditional;\n\n if (typeof traditional === \"undefined\") {\n traditional = $.ajaxSettings.traditional;\n }\n\n var collected = serialization.collect($set[0], options.semantic, options.filtering);\n var fields = collected.fields;\n var controls = collected.controls;\n var qx = extraQuery(fields, options, traditional);\n\n // give pre-submit callback an opportunity to abort the submit\n if (options.beforeSubmit && options.beforeSubmit(fields, $set, options) === false) {\n return refuse(\"ajaxSubmit: submit aborted via beforeSubmit callback\");\n }\n\n // fire vetoable 'validate' event\n $set.trigger(\"form-submit-validate\", [fields, $set, options, veto]);\n if (veto.veto) {\n return refuse(\"ajaxSubmit: submit vetoed via form-submit-validate trigger\");\n }\n\n method = resolveMethod(options, defaultType);\n\n if (options.requestFormat === \"json\") {\n jsonBody(options, fields);\n } else {\n encode(options, $.param(urlencodedFields(fields), traditional), qx);\n }\n\n return {\n form: form,\n $form: $set,\n fields: fields,\n controls: controls,\n options: options,\n method: method,\n traditional: traditional,\n };\n }\n\n /**\n * Wraps success, error and complete (a function or an array of them, as $.ajax takes) so each\n * also receives the form, and adds the resetForm,\n * clearForm and target steps before the success callbacks.\n */\n function deliver(submission) {\n var $set = submission.$form;\n var options = submission.options;\n var callbacks = [];\n\n if (options.resetForm) {\n callbacks.push(function () {\n $set.resetForm();\n });\n }\n\n if (options.clearForm) {\n callbacks.push(function () {\n $set.clearForm(options.includeHidden);\n });\n }\n\n // perform a load on the target only if dataType is not provided\n if (!options.dataType && options.target) {\n var successes = callbackList(options.success);\n\n callbacks.push(function (data, textStatus, jqXHR) {\n var successArguments = arguments,\n fn = options.replaceTarget ? \"replaceWith\" : \"html\",\n $target = $(options.target);\n\n // Only a string response is inserted. jQuery has already parsed a JSON or XML response,\n // and inserting it would parse each of its strings as HTML.\n if (typeof data === \"string\") {\n $target[fn](data);\n } else {\n log(\"target: the response was parsed by jQuery, so it is not inserted\");\n }\n\n if (!$target.length) {\n // nothing to fill: success still runs once, with the normal context\n callEach(successes, this, successArguments);\n }\n\n $target.each(function () {\n callEach(successes, this, successArguments);\n });\n });\n } else {\n $.merge(callbacks, callbackList(options.success));\n }\n\n options.success = function (data, status, xhr) {\n // jQuery 1.4+ passes xhr as 3rd arg\n var context = options.context || this; // jQuery 1.4+ supports scope context\n\n for (var i = 0, max = callbacks.length; i < max; i++) {\n callbacks[i].apply(context, [data, status, xhr || $set, $set]);\n }\n };\n\n if (options.error) {\n var errors = callbackList(options.error);\n\n options.error = function (xhr, status, error) {\n callEach(errors, options.context || this, [xhr, status, error, $set]);\n };\n }\n\n if (options.complete) {\n var completes = callbackList(options.complete);\n\n options.complete = function (xhr, status) {\n callEach(completes, options.context || this, [xhr, status, $set]);\n };\n }\n }\n\n /**\n * The transport for a submission: \"iframe\" for files without the File API or when forced,\n * \"formdata\" for files with it, \"ajax\" otherwise.\n */\n function chooseTransport(submission) {\n var $set = submission.$form;\n var options = submission.options;\n\n // [value] (issue #113), also see comment:\n // https://github.com/malsup/form/commit/588306aedba1de01388032d5f42a60159eea9228#commitcomment-2180219\n // and the file inputs outside the form that belong to it through their form attribute\n var fileInputs = $(\"input[type=file]:enabled\", $set)\n .add($(submission.controls).filter(\"input[type=file]\"))\n .filter(function () {\n return $(this).val() !== \"\";\n });\n var hasFileInputs = fileInputs.length > 0;\n // compared as the browser does: ASCII case-insensitive, without surrounding whitespace\n var mp = /^[\\t\\n\\f\\r ]*multipart\\/form-data[\\t\\n\\f\\r ]*$/i;\n var multipart =\n mp.test(forms.attribute($set[0], \"enctype\")) || mp.test(forms.attribute($set[0], \"encoding\"));\n var fileAPI = feature.fileapi && feature.formdata;\n\n log(\"fileAPI :\" + fileAPI);\n\n var shouldUseFrame = (hasFileInputs || multipart) && !fileAPI;\n\n var transport = (hasFileInputs || multipart) && fileAPI ? \"formdata\" : \"ajax\";\n\n // options.iframe allows user to force iframe mode\n // 06-NOV-09: now defaulting to iframe mode if file input is detected\n if (options.iframe !== false && (options.iframe || shouldUseFrame)) {\n transport = \"iframe\";\n }\n\n if (transport === \"iframe\" && !options.iframe) {\n deprecate(\n \"iframe\",\n \"choosing the iframe transport automatically without FormData is deprecated, set iframe: true\"\n );\n }\n\n if (transport !== \"ajax\" && options.requestFormat === \"json\") {\n throw new Error(\n 'jquery.form: requestFormat \"json\" cannot send files or use the iframe transport'\n );\n }\n\n return transport;\n }\n\n return { prepare: prepare, deliver: deliver, chooseTransport: chooseTransport };\n}\n","/*!\n * jQuery Form Plugin\n * version: 4.5.0\n * Requires jQuery v1.7.2 or later\n * Project repository: https://github.com/jquery-form/form\n\n * Copyright 2017 Kevin Morris\n * Copyright 2006 M. Alsup\n\n * Dual licensed under the LGPL-2.1+ or MIT licenses\n * https://github.com/jquery-form/form#license\n\n * This library is free software; you can redistribute it and/or\n * modify it under the terms of the GNU Lesser General Public\n * License as published by the Free Software Foundation; either\n * version 2.1 of the License, or (at your option) any later version.\n * This library is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n */\nimport { ajaxForm, ajaxFormUnbind } from \"./ajax-form.js\";\nimport { callFormMethod, tagName } from \"./form-members.js\";\nimport {\n createSuccessfulControls,\n isSuccessful,\n urlencodedFields,\n valueOf,\n} from \"./successful-controls.js\";\nimport { deprecate, deprecateOldJQuery, log } from \"./diagnostics.js\";\nimport { sendAjax, sendFormData } from \"./xhr-transport.js\";\nimport { createIframeTransport } from \"./iframe-transport.js\";\nimport { createSubmission } from \"./submission.js\";\nimport { formAttribute } from \"./form-attributes.js\";\nimport jQuery from \"jquery\";\nimport { submitOptions } from \"./options.js\";\nimport { submitterElement } from \"./submitter.js\";\n\n(function ($) {\n \"use strict\";\n\n /*\n\t\tUsage Note:\n\t\t-----------\n\t\tDo not use both ajaxSubmit and ajaxForm on the same form. These\n\t\tfunctions are mutually exclusive. Use ajaxSubmit if you want\n\t\tto bind your own submit handler to the form. For example,\n\n\t\t$(document).ready(function() {\n\t\t\t$('#myForm').on('submit', function(e) {\n\t\t\t\te.preventDefault(); // <-- important\n\t\t\t\t$(this).ajaxSubmit({\n\t\t\t\t\ttarget: '#output'\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\n\t\tUse ajaxForm when you want the plugin to manage all the event binding\n\t\tfor you. For example,\n\n\t\t$(document).ready(function() {\n\t\t\t$('#myForm').ajaxForm({\n\t\t\t\ttarget: '#output'\n\t\t\t});\n\t\t});\n\n\t\tYou can also use ajaxForm with delegation (requires jQuery v1.7+), so the\n\t\tform does not have to exist when you invoke ajaxForm:\n\n\t\t$('#myForm').ajaxForm({\n\t\t\tdelegation: true,\n\t\t\ttarget: '#output'\n\t\t});\n\n\t\tWhen using ajaxForm, the ajaxSubmit function will be invoked for you\n\t\tat the appropriate time.\n\t*/\n\n /**\n * Feature detection\n */\n var feature = {};\n\n feature.fileapi = $('').get(0).files !== undefined;\n feature.formdata = typeof window.FormData !== \"undefined\";\n\n var hasProp = !!$.fn.prop;\n // What attr2 returns for a form: the property when it is a string, otherwise the attribute. The\n // property is read plainly on purpose: a control named like it shadows it, and then the raw\n // attribute is used.\n function formProperty(form, name) {\n var value = hasProp ? form[name] : undefined;\n\n return typeof value === \"string\" ? value : formAttribute(form, name);\n }\n\n var forms = { attribute: formAttribute, property: formProperty };\n var serialization = createSuccessfulControls(feature);\n var steps = createSubmission(feature, forms, serialization);\n var transports = {\n iframe: createIframeTransport(hasProp, forms),\n formdata: sendFormData,\n ajax: sendAjax,\n };\n\n // attr2 uses prop when it can but checks the return type for\n // an expected string. This accounts for the case where a form\n // contains inputs with names like \"action\" or \"method\"; in those\n // cases \"prop\" returns the element\n $.fn.attr2 = function () {\n deprecate(\"attr2\", \"attr2 is deprecated, use .prop() or .attr()\");\n\n if (!hasProp) {\n return this.attr.apply(this, arguments);\n }\n\n var val = this.prop.apply(this, arguments);\n\n if ((val && val.jquery) || typeof val === \"string\") {\n return val;\n }\n\n return this.attr.apply(this, arguments);\n };\n\n /**\n * ajaxSubmit() provides a mechanism for immediately submitting\n * an HTML form using AJAX.\n *\n * @param\t{object|string}\toptions\t\tjquery.form.js parameters or custom url for submission\n * @param\t{object}\t\tdata\t\textraData\n * @param\t{string}\t\tdataType\tajax dataType\n * @param\t{function}\t\tonSuccess\tajax success callback function\n */\n $.fn.ajaxSubmit = function (options, data, dataType, onSuccess) {\n deprecateOldJQuery($.fn.jquery);\n\n // fast fail if nothing selected (http://dev.jquery.com/ticket/2752)\n if (!this.length) {\n log(\"ajaxSubmit: skipping submit process - no element selected\");\n\n return this;\n }\n\n // #541: jQuery's slim build has no $.ajax\n if (!$.ajax) {\n throw new Error(\n \"jquery.form: ajaxSubmit needs the full jQuery build; this jQuery has no $.ajax\"\n );\n }\n\n var submission = steps.prepare(this, submitOptions(options, data, dataType, onSuccess));\n\n if (!submission) {\n return this;\n }\n\n steps.deliver(submission);\n\n var jqxhr = transports[steps.chooseTransport(submission)](submission);\n\n this.removeData(\"jqxhr\").data(\"jqxhr\", jqxhr);\n\n // clear element array\n for (var k = 0; k < submission.controls.length; k++) {\n submission.controls[k] = null;\n }\n\n // fire 'notify' event\n this.trigger(\"form-submit-notify\", [this, submission.options]);\n\n return this;\n };\n\n $.fn.ajaxForm = ajaxForm;\n $.fn.ajaxFormUnbind = ajaxFormUnbind;\n\n /**\n * formToArray() gathers form element data into an array of objects that can\n * be passed to any of the following ajax functions: $.get, $.post, or load.\n * Each object in the array has both a 'name' and 'value' property. An example of\n * an array for a simple login form might be:\n *\n * [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ]\n *\n * It is this array that is passed to pre-submit callback functions provided to the\n * ajaxSubmit() and ajaxForm() methods.\n */\n $.fn.formToArray = function (semantic, elements, filtering) {\n var collected = serialization.collect(this[0], semantic, filtering);\n\n if (elements) {\n elements.push.apply(elements, collected.controls);\n }\n\n return collected.fields;\n };\n\n /**\n * Serializes form data into a 'submittable' string. This method will return a string\n * in the format: name1=value1&name2=value2\n */\n $.fn.formSerialize = function (semantic) {\n // hand off to jQuery.param for proper encoding\n return $.param(urlencodedFields(this.formToArray(semantic)));\n };\n\n /**\n * Serializes all field elements in the jQuery object into a query string.\n * This method will return a string in the format: name1=value1&name2=value2\n */\n $.fn.fieldSerialize = function (successful) {\n var a = [];\n\n this.each(function () {\n var n = this.name;\n\n // a form is not a field, though it may have a name\n if (!n || tagName(this) === \"form\") {\n return;\n }\n\n var v = $.fieldValue(this, successful);\n\n if (v && v.constructor === Array) {\n for (var i = 0, max = v.length; i < max; i++) {\n a.push({ name: n, value: v[i] });\n }\n } else if (v !== null && typeof v !== \"undefined\") {\n a.push({ name: this.name, value: v });\n }\n });\n\n // hand off to jQuery.param for proper encoding\n return $.param(urlencodedFields(a));\n };\n\n /**\n * Returns the value(s) of the element in the matched set. For example, consider the following form:\n *\n *\t
\n *\t\t\n *\t\t\n *\t\t\n *\t\t\n *\t\t\n *\t\t\n *\t
\n *\n *\tvar v = $('input[type=text]').fieldValue();\n *\t// if no values are entered into the text inputs\n *\tv === ['','']\n *\t// if values entered into the text inputs are 'foo' and 'bar'\n *\tv === ['foo','bar']\n *\n *\tvar v = $('input[type=checkbox]').fieldValue();\n *\t// if neither checkbox is checked\n *\tv === undefined\n *\t// if both checkboxes are checked\n *\tv === ['B1', 'B2']\n *\n *\tvar v = $('input[type=radio]').fieldValue();\n *\t// if neither radio is checked\n *\tv === undefined\n *\t// if first radio is checked\n *\tv === ['C1']\n *\n * The successful argument controls whether or not the field element must be 'successful'\n * (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls).\n * The default value of the successful argument is true. If this value is false the value(s)\n * for each element is returned.\n *\n * Note: This method *always* returns an array. If no valid value can be determined the\n *\tarray will be empty, otherwise it will contain one or more values.\n */\n $.fn.fieldValue = function (successful) {\n for (var val = [], i = 0, max = this.length; i < max; i++) {\n var el = this[i];\n var v = $.fieldValue(el, successful);\n\n if (v === null || typeof v === \"undefined\" || (v.constructor === Array && !v.length)) {\n continue;\n }\n\n if (v.constructor === Array) {\n $.merge(val, v);\n } else {\n val.push(v);\n }\n }\n\n return val;\n };\n\n /**\n * Returns the value of the field element.\n */\n $.fieldValue = function (el, successful) {\n var required = typeof successful === \"undefined\" || successful;\n\n if (required && !isSuccessful(el, submitterElement(el.form))) {\n return null;\n }\n\n return valueOf(el);\n };\n\n /**\n * Clears the form data. Takes the following actions on the form's input fields:\n * - input text fields will have their 'value' property set to the empty string\n * - select elements will have their 'selectedIndex' property set to -1\n * - checkbox and radio inputs will have their 'checked' property set to false\n * - inputs of type submit, button, reset, and hidden will *not* be effected\n * - button elements will *not* be effected\n */\n $.fn.clearForm = function (includeHidden) {\n return this.each(function () {\n $(\"input,select,textarea\", this).clearFields(includeHidden);\n });\n };\n\n /**\n * Clears the selected form elements.\n */\n $.fn.clearInputs = function (includeHidden) {\n deprecate(\"clearInputs\", \"clearInputs is deprecated, use clearFields\");\n\n return this.clearFields(includeHidden);\n };\n\n $.fn.clearFields = function (includeHidden) {\n var re =\n /^(?:color|date|datetime|datetime-local|email|month|number|password|range|search|tel|text|time|url|week)$/i; // 'hidden' is not in this list\n\n return this.each(function () {\n var t = this.type,\n tag = tagName(this);\n\n if (re.test(t) || tag === \"textarea\") {\n this.value = \"\";\n } else if (t === \"checkbox\" || t === \"radio\") {\n this.checked = false;\n } else if (tag === \"select\") {\n this.selectedIndex = -1;\n } else if (t === \"file\") {\n if (/MSIE/.test(navigator.userAgent)) {\n $(this).replaceWith($(this).clone(true));\n } else {\n $(this).val(\"\");\n }\n } else if (includeHidden) {\n // includeHidden can be the value true, or it can be a selector string\n // indicating a special test; for example:\n // $('#myForm').clearForm('.special:hidden')\n // the above would clean hidden inputs that have the class of 'special'\n if (\n (includeHidden === true && /hidden/.test(t)) ||\n (typeof includeHidden === \"string\" && $(this).is(includeHidden))\n ) {\n this.value = \"\";\n }\n }\n });\n };\n\n /**\n * Resets the form data or individual elements. Takes the following actions\n * on the selected tags:\n * - all fields within form elements will be reset to their original value\n * - input / textarea / select fields will be reset to their original value\n * - option / optgroup fields (for multi-selects) will defaulted individually\n * - non-multiple options will find the right select to default\n * - label elements will be searched against its 'for' attribute\n * - all others will be searched for appropriate children to default\n */\n $.fn.resetForm = function () {\n return this.each(function () {\n var el = $(this);\n var tag = tagName(this);\n\n switch (tag) {\n case \"input\":\n this.checked = this.defaultChecked;\n\n // as the native reset: types whose value is the value attribute keep it\n if (this.type === \"file\") {\n // a file input cannot take its value attribute; the native reset empties it\n this.value = \"\";\n } else if (!/^(?:checkbox|radio|hidden|submit|reset|button|image)$/.test(this.type)) {\n this.value = this.defaultValue;\n }\n\n return true;\n\n case \"textarea\":\n this.value = this.defaultValue;\n\n return true;\n\n case \"option\":\n case \"optgroup\":\n var select = el.parents(\"select\");\n\n if (select.length && select[0].multiple) {\n if (tag === \"option\") {\n this.selected = this.defaultSelected;\n } else {\n el.find(\"option\").resetForm();\n }\n } else {\n select.resetForm();\n }\n\n return true;\n\n case \"select\":\n // in order, as the native reset: of several default options, a single select keeps the last\n el.find(\"option\").each(function () {\n this.selected = this.defaultSelected;\n });\n\n return true;\n\n case \"label\":\n // The control whose id the for attribute names, and the controls inside the label. The\n // filter keeps a for that names an ancestor from resetting the label again.\n var forEl = this.htmlFor && this.ownerDocument.getElementById(this.htmlFor);\n\n el.find(\"input,select,textarea\").add(forEl).filter(\"input,select,textarea\").resetForm();\n\n return true;\n\n case \"form\":\n // through the prototype: a control named reset shadows the method\n callFormMethod(this, \"reset\");\n\n return true;\n\n default:\n el.find(\"form,input,label,select,textarea\").resetForm();\n\n return true;\n }\n });\n };\n\n /**\n * Enables or disables any matching elements.\n */\n $.fn.enable = function (b) {\n if (typeof b === \"undefined\") {\n b = true;\n }\n\n return this.each(function () {\n this.disabled = !b;\n });\n };\n\n /**\n * Checks/unchecks any matching checkboxes or radio buttons and\n * selects/deselects and matching option elements.\n */\n $.fn.selected = function (select) {\n if (typeof select === \"undefined\") {\n select = true;\n }\n\n return this.each(function () {\n var t = this.type;\n\n if (t === \"checkbox\" || t === \"radio\") {\n this.checked = select;\n } else if (tagName(this) === \"option\") {\n var $sel = $(this).parent(\"select\");\n\n if (select && $sel[0] && $sel[0].type === \"select-one\") {\n // deselect all other options\n $sel.find(\"option\").selected(false);\n }\n\n this.selected = select;\n }\n });\n };\n\n // expose debug var\n $.fn.ajaxSubmit.debug = false;\n})(jQuery);\n\nexport default jQuery;\n"],"names":["owners","plainForm","document","createElement","findDescriptor","name","i","length","owner","window","descriptor","Object","getOwnPropertyDescriptor","prototype","formMember","form","get","call","e","callFormMethod","value","apply","Array","slice","arguments","tagName","el","toLowerCase","isElement","node","assertRealParent","parentNode","Error","closestByTag","names","indexOf","storeKey","setExpando","ignore","expando","els","namedItem","undefined","record","x","y","jQuery","data","type","setTimeout","captureSubmitter","target","point","offsetX","offsetY","fn","offset","pageX","left","pageY","top","offsetLeft","offsetTop","imagePoint","submitterOf","stored","log","ajaxSubmit","debug","msg","join","console","opera","postError","warned","deprecate","id","message","warn","deprecateOldJQuery","version","parts","String","split","major","Number","beforeJQuery35","shorthandOptions","options","dataType","onSuccess","result","url","success","submitOptions","key","hasOwnProperty","withoutUrl","keepContext","settings","sources","context","submitWith","isDefaultPrevented","preventDefault","originalEvent","submitter","captureEventSubmitter","doAjaxSubmit","captureSubmittingElement","this","bindDelegated","$sel","selector","off","on","closestMatch","Element","closest","is","delegated","unbindSelector","handlers","submit","click","selectionOnly","ajaxForm","jquery","delegation","bindSelector","beforeFormUnbind","ajaxFormUnbind","o","s","c","isReady","bindLater","formAttribute","attr","rLineBreak","rCR","rUnsubmittable","isDisabled","matches","disabled","valueOf","index","selectedIndex","a","ops","one","max","op","selected","v","attributes","specified","text","push","selectValue","val","raw","replace","loneSurrogate","wellFormed","match","before","urlencodedFields","fields","map","field","createSuccessfulControls","feature","$","controlsOf","semantic","formId","getElementsByTagName","makeArray","grep","ownedBy","test","navigator","userAgent","concat","filter","getAttribute","inArray","outsideControls","fieldsOf","n","fieldValue","constructor","fileapi","files","file","required","imageFields","sub","input","addCandidate","collected","own","controls","collect","filtering","addClickedImage","deepSerialize","extraData","traditional","part","param","serialized","len","decodeURIComponent","sendFormData","submission","formdata","FormData","append","serializedData","extend","ajaxSettings","contentType","processData","cache","method","uploadProgress","createXhr","xhr","upload","addEventListener","event","percent","position","loaded","total","lengthComputable","Math","ceil","beforeSend","formData","ajax","sendAjax","uploadAttributes","hasOwn","isGet","addSubmitterFields","submitterFields","addCsrfField","forms","origin","csrf_token","csrf_param","posts","property","href","location","protocol","host","setFormAttribute","getDoc","frame","doc","contentWindow","err","contentDocument","readStatus","status","statusText","readResponse","retry","errMsg","isXml","XMLDocument","isXMLDoc","body","innerHTML","docRoot","documentElement","responseText","responseXML","getResponseHeader","header","readDocument","dt","scr","textarea","ta","pre","b","textContent","innerText","readEmbedded","ct","xml","nodeName","error","dataFilter","JSON","parse","globalEval","httpData","createLifecycle","g","timeoutHandle","callbackProcessed","deferred","Deferred","aborted","getAllResponseHeaders","setRequestHeader","abort","done","rejection","textStatus","stop","reject","trigger","complete","endGlobalEvents","active","clearTimeout","release","settle","failure","resolve","succeed","start","global","fail","startTimer","onTimeout","timeout","stopTimer","createIframeTransport","hasProp","frameCount","fileUploadIframe","ownerDocument","$body","$io","iframeTarget","each","nameWindow","io","setAttribute","iframeSrc","css","createFrame","Date","getTime","life","execCommand","remove","frameHooks","domCheckCount","checkState","state","readyState","cb","doSubmit","saved","saveAttributes","mp","skipEncodingOverride","setUploadAttributes","extraInputs","added","addHiddenInput","appendTo","isPlainObject","single","f","addExtraInputs","root","contains","notInDocument","attachEvent","listen","submitForm","restoreAttributes","detachEvent","removeEventListener","unlisten","post","forceSync","jqxhr","elements","prop","removeAttr","enableControls","closeKeepAlive","createSubmission","serialization","refuse","extraQuery","optionsData","requestFormat","query","pairs","at","decodeQuery","queryPairs","defineKey","object","defineProperty","enumerable","writable","configurable","callbackList","callback","isArray","callEach","callbacks","args","prepare","$set","action","trim","URL","withDefaults","defaultType","veto","beforeSerialize","qx","beforeSubmit","resolved","resolveMethod","extra","stringify","jsonBody","q","toUpperCase","hashAt","base","encode","$form","deliver","resetForm","clearForm","includeHidden","successes","jqXHR","successArguments","replaceTarget","$target","merge","errors","completes","chooseTransport","hasFileInputs","add","multipart","attribute","fileAPI","shouldUseFrame","transport","iframe","steps","transports","attr2","removeData","k","formToArray","formSerialize","fieldSerialize","successful","t","checked","isSuccessful","clearFields","clearInputs","re","tag","replaceWith","clone","defaultChecked","defaultValue","select","parents","multiple","defaultSelected","find","forEl","htmlFor","getElementById","enable","parent"],"m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1Q,EAAEtH,GAAGgb,OAAS,SAAUrM,GAKtB,YAJiB,IAANA,IACTA,GAAI,GAGCpL,KAAKyO,KAAK,WACfzO,KAAKkC,UAAYkJ,CACnB,EACF,EAMArH,EAAEtH,GAAGkG,SAAW,SAAUsU,GAKxB,YAJsB,IAAXA,IACTA,GAAS,GAGJjX,KAAKyO,KAAK,WACf,IAAI6H,EAAItW,KAAK9D,KAEb,GAAU,aAANoa,GAA0B,UAANA,EACtBtW,KAAKuW,QAAUU,OACV,GAAsB,WAAlBtc,EAAQqF,MAAoB,CACrC,IAAIE,EAAO6D,EAAE/D,MAAM0X,OAAO,UAEtBT,GAAU/W,EAAK,IAAuB,eAAjBA,EAAK,GAAGhE,MAE/BgE,EAAKmX,KAAK,UAAU1U,UAAS,GAG/B3C,KAAK2C,SAAWsU,CAClB,CACF,EACF,EAGAlT,EAAEtH,GAAGY,WAAWC,OAAQ,CACzB,CAlcD,CAkcGtB"} \ No newline at end of file diff --git a/dist/jquery.form.mjs b/dist/jquery.form.mjs index 954b874..52938ed 100644 --- a/dist/jquery.form.mjs +++ b/dist/jquery.form.mjs @@ -672,11 +672,25 @@ function valueOf(el) { /** * The fields as a urlencoded body sends them: a selected file as its name. */ +// A lone surrogate becomes U+FFFD, as in a native submission; jQuery.param would throw. +var loneSurrogate = /[\uD800-\uDBFF](?![\uDC00-\uDFFF])|([^\uD800-\uDBFF]|^)([\uDC00-\uDFFF])/g; + +function wellFormed(value) { + return typeof value === "string" + ? value.replace(loneSurrogate, function (match, before) { + return (before || "") + "\uFFFD"; + }) + : value; +} + function urlencodedFields(fields) { return jQuery.map(fields, function (field) { - return field.type === "file" && typeof field.value !== "string" - ? { name: field.name, value: field.value.name } - : field; + var value = + field.type === "file" && typeof field.value !== "string" ? field.value.name : field.value; + var name = wellFormed(field.name); + value = wellFormed(value); + + return name === field.name && value === field.value ? field : { name: name, value: value }; }); } @@ -2370,7 +2384,7 @@ function createSubmission(feature, forms, serialization) { }); // hand off to jQuery.param for proper encoding - return $.param(a); + return $.param(urlencodedFields(a)); }; /** diff --git a/docs/research/4x-behavior-changes.md b/docs/research/4x-behavior-changes.md index 75a01b7..6390e79 100644 --- a/docs/research/4x-behavior-changes.md +++ b/docs/research/4x-behavior-changes.md @@ -112,6 +112,10 @@ Collected as the modernization proceeds. Each entry is a change a consumer could - **Deprecation warnings under `debug`.** With `$.fn.ajaxSubmit.debug = true`, the plugin logs one `console.warn` per page for each feature 5.0 removes: `clearInputs` (use `clearFields`), `$.fn.attr2` (use `.prop()` or `.attr()`), `ajaxForm` queued until the DOM is ready on an empty selection (call it inside `$(fn)` or use `delegation: ""`), the iframe transport chosen automatically without `FormData` (set `iframe: true`), and jQuery before 3.5 (5.0 needs 3.5 or later). Nothing is logged with `debug` off. `clearInputs` is now a separate function that calls `clearFields`. `enable` and `selected` are kept. +## Phase 13 + +- **A lone surrogate is sent as U+FFFD.** `formSerialize`, `fieldSerialize` and a urlencoded `ajaxSubmit` body threw `URIError` when a name or value held an unpaired UTF-16 surrogate. Each one is now replaced with U+FFFD, as a native form submission and `FormData` do. + ## Known behavior, not changed - **`dataType: "script"` on jQuery 4** delivers `undefined` to `success`; jQuery 4 loads async script requests through a script tag. The script still runs. This comes from jQuery, not the plugin. diff --git a/src/jquery.form.js b/src/jquery.form.js index 51c777a..c3be119 100644 --- a/src/jquery.form.js +++ b/src/jquery.form.js @@ -232,7 +232,7 @@ import { submitterElement } from "./submitter.js"; }); // hand off to jQuery.param for proper encoding - return $.param(a); + return $.param(urlencodedFields(a)); }; /** diff --git a/src/successful-controls.js b/src/successful-controls.js index 998d277..768ec72 100644 --- a/src/successful-controls.js +++ b/src/successful-controls.js @@ -105,11 +105,25 @@ export function valueOf(el) { /** * The fields as a urlencoded body sends them: a selected file as its name. */ +// A lone surrogate becomes U+FFFD, as in a native submission; jQuery.param would throw. +var loneSurrogate = /[\uD800-\uDBFF](?![\uDC00-\uDFFF])|([^\uD800-\uDBFF]|^)([\uDC00-\uDFFF])/g; + +function wellFormed(value) { + return typeof value === "string" + ? value.replace(loneSurrogate, function (match, before) { + return (before || "") + "\uFFFD"; + }) + : value; +} + export function urlencodedFields(fields) { return jQuery.map(fields, function (field) { - return field.type === "file" && typeof field.value !== "string" - ? { name: field.name, value: field.value.name } - : field; + var value = + field.type === "file" && typeof field.value !== "string" ? field.value.name : field.value; + var name = wellFormed(field.name); + value = wellFormed(value); + + return name === field.name && value === field.value ? field : { name: name, value: value }; }); } diff --git a/test/suite/serialization-oracle.test.js b/test/suite/serialization-oracle.test.js index cdcc405..32124b7 100644 --- a/test/suite/serialization-oracle.test.js +++ b/test/suite/serialization-oracle.test.js @@ -30,7 +30,7 @@ function prng(seed) { } const NAMES = ["a", "b", "c", "a b", "ΓΌ", "名前", "a[]", "a.b", "x=y", "&", "πŸ˜€"]; -// Lone surrogates: rare, since formSerialize cannot encode them (class USV-THROW). +// Lone surrogates: rare; FormData and the plugin both send them as U+FFFD (class USV). const LONE = ["q\uD800", "lone\uDC00"]; const VALUES = [ "", @@ -415,17 +415,7 @@ const KNOWN_DIFFERENCES = [ ]; // Known exceptions: the plugin throws where FormData serializes. Each has an ID and a matcher. -const KNOWN_THROWS = [ - { - id: "USV-THROW", - description: "formSerialize throws URIError on a lone surrogate (jQuery.param encodes it)", - matches: (error, ctx) => - error instanceof URIError && - pluginEntries($(ctx.form).formToArray()).some( - (e) => toWellFormed(e[0] + e[2]) !== e[0] + e[2] - ), - }, -]; +const KNOWN_THROWS = []; // Runs the plugin; an exception passes only when a known class matches it (null then). function attempt(act, ctx) { diff --git a/test/suite/serialization.test.js b/test/suite/serialization.test.js index 0b6fbd5..d34d8dc 100644 --- a/test/suite/serialization.test.js +++ b/test/suite/serialization.test.js @@ -1125,6 +1125,16 @@ describe("form", function () { }); describe("formSerialize", function () { + it("should encode a lone surrogate as U+FFFD like a native submission", function () { + const $form = $('
'); + $form.find("[name=q]").val("a\uD800b\uDC00"); + $form.find("[name=ok]").attr("name", "n\uDBFF"); + + const s = $form.formSerialize(); + + assert.equal(s, "q=a%EF%BF%BDb%EF%BF%BD&n%EF%BF%BD=1"); + }); + it("should produce one query-string pair per successful field", function () { const $form = $("#form1"); @@ -1421,6 +1431,14 @@ describe("form", function () { }); describe("fieldSerialize", function () { + it("should encode a lone surrogate as U+FFFD like a native submission", function () { + const $input = $('').val("\uDC00x\uD800"); + + const s = $input.fieldSerialize(); + + assert.equal(s, "q=%EF%BF%BDx%EF%BF%BD"); + }); + // Shared Assert step: the serialized pairs match `expected`, in order. function assertPairs(serialized, expected) { const result = serialized.split("&"); diff --git a/test/suite/submission.test.js b/test/suite/submission.test.js index b0dcc61..e5fd13d 100644 --- a/test/suite/submission.test.js +++ b/test/suite/submission.test.js @@ -1522,6 +1522,17 @@ describe("form", function () { assert.strictEqual(settings.data, "b=changed&c=3"); }); + it("should send a lone surrogate as U+FFFD in a urlencoded body", function () { + const $form = makeForm( + '
' + ); + $form.find("input").val("x\uD800"); + + const settings = submitWith($form, [{}]); + + assert.strictEqual(settings.data, "a=x%EF%BF%BD"); + }); + it("should pass the same veto object to both veto events", function () { const $form = makeForm('
'); const seen = {}; From 4afd31bc0c832932b7606f94ef83b7af560d350d Mon Sep 17 00:00:00 2001 From: Kevin Morris Date: Sun, 1 Nov 2026 21:18:46 -0500 Subject: [PATCH 10/78] test: share the oracle's seeded forms and known differences in a module --- eslint.config.mjs | 4 + test/shared/oracle-forms.js | 456 +++++++++++++++++++++++ test/suite/serialization-oracle.test.js | 463 +----------------------- 3 files changed, 474 insertions(+), 449 deletions(-) create mode 100644 test/shared/oracle-forms.js diff --git a/eslint.config.mjs b/eslint.config.mjs index 3059bb5..54fd77d 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -96,6 +96,10 @@ export default [ globals: { ...globals.browser, $: "readonly", jQuery: "readonly" }, }, }, + { + files: ["test/shared/**/*.js"], + languageOptions: { sourceType: "module", globals: globals.browser }, + }, { files: ["test/setup.js", "test/surfaces/browser.test.js"], languageOptions: { globals: globals.browser }, diff --git a/test/shared/oracle-forms.js b/test/shared/oracle-forms.js new file mode 100644 index 0000000..6531603 --- /dev/null +++ b/test/shared/oracle-forms.js @@ -0,0 +1,456 @@ +// Seeded random forms and the known differences between the plugin and native form submission. +// Shared by the serialization oracle (test/suite) and the end-to-end tests (test/e2e), which loads +// this file in the page as a module: browser globals only, no imports. + +export const SEEDS = [ + 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765, 10946, 17711, + 28657, 46368, 75025, 121393, 196418, 317811, 514229, 832040, 1346269, 2178309, 3524578, 5702887, + 9227465, 14930352, 24157817, 39088169, 63245986, 102334155, 165580141, 7, 11, 17, 19, 23, 29, 31, + 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 97, 101, 103, +]; + +// mulberry32: a small seeded generator, so a failing seed replays the same form. +export function prng(seed) { + let state = seed >>> 0; + + const next = function () { + state = (state + 0x6d2b79f5) >>> 0; + let t = state; + t = Math.imul(t ^ (t >>> 15), t | 1); + t ^= t + Math.imul(t ^ (t >>> 7), t | 61); + return ((t ^ (t >>> 14)) >>> 0) / 4294967296; + }; + + return { + chance: (p) => next() < p, + int: (n) => Math.floor(next() * n), + pick: (list) => list[Math.floor(next() * list.length)], + }; +} + +const NAMES = ["a", "b", "c", "a b", "ΓΌ", "名前", "a[]", "a.b", "x=y", "&", "πŸ˜€"]; +// Lone surrogates: rare; FormData and the plugin both send them as U+FFFD (class USV). +const LONE = ["q\uD800", "lone\uDC00"]; +const VALUES = [ + "", + "1", + "value", + " spaced out ", + "a&b=c", + "100%", + "1+1", + "Γ©", + "ζ—₯本θͺž", + "πŸ˜€", + "!'()*~", + "#ff0000", + "2024-02-29", + "42", + "x@example.com", +]; +const LINE_VALUES = ["one\rtwo", "one\ntwo", "one\r\ntwo", "\r\n\n\r"]; +const TEXT_TYPES = [ + "text", + "hidden", + "password", + "search", + "email", + "number", + "range", + "date", + "color", +]; +const FILE_NAMES = ["a.txt", "b c.txt", "ΓΌ.txt", "ζ—₯本.txt"]; + +// Builds one random form (and its outside controls) inside `container`. +export function generateForm(seed, container) { + const rand = prng(seed); + const formId = "oracle-" + seed; + const counters = { file: 0, dir: 0, out: 0 }; + const outsideNames = []; + const form = document.createElement("form"); + form.id = formId; + const other = document.createElement("form"); + other.id = formId + "-other"; + + // Outside controls get their own names (out-N), so the semantic order class can find them. + function name(outside) { + if (outside) { + const outsideName = "out-" + counters.out++; + outsideNames.push(outsideName); + return outsideName; + } + return rand.chance(0.02) ? rand.pick(LONE) : rand.pick(NAMES); + } + + function value() { + return rand.chance(0.02) ? rand.pick(LONE) : rand.pick(VALUES); + } + + function input(type, outside) { + const el = document.createElement("input"); + el.type = type; + if (rand.chance(0.85)) { + el.name = name(outside); + } + return el; + } + + const makers = [ + function (outside) { + const el = input(rand.pick(TEXT_TYPES), outside); + if (rand.chance(0.8)) { + el.setAttribute("value", value()); + } + if (el.type === "hidden" && rand.chance(0.3)) { + el.value = rand.pick(LINE_VALUES); + } + if ((el.type === "text" || el.type === "search") && rand.chance(0.2)) { + el.setAttribute("dirname", "dir-" + counters.dir++); + } + return el; + }, + function (outside) { + const el = input(rand.pick(["checkbox", "radio"]), outside); + if (rand.chance(0.6)) { + el.setAttribute("value", value()); + } + el.checked = rand.chance(0.6); + return el; + }, + function (outside) { + const el = document.createElement("select"); + el.name = name(outside); + el.multiple = rand.chance(0.4); + let parent = el; + const count = rand.int(5); + for (let i = 0; i < count; i++) { + if (rand.chance(0.2)) { + parent = document.createElement("optgroup"); + parent.label = "g" + i; + parent.disabled = rand.chance(0.5); + el.appendChild(parent); + } + const option = document.createElement("option"); + option.text = rand.pick([" one ", "two", "ζ—₯本", ""]); + if (rand.chance(0.6)) { + option.value = value(); + } + option.disabled = rand.chance(0.2); + parent.appendChild(option); + option.selected = rand.chance(0.4); + } + if (rand.chance(0.2)) { + el.selectedIndex = -1; + } + return el; + }, + function (outside) { + const el = document.createElement("textarea"); + el.name = name(outside); + el.value = rand.pick(LINE_VALUES.concat(VALUES)); + if (rand.chance(0.2)) { + el.setAttribute("dirname", "dir-" + counters.dir++); + } + return el; + }, + function (outside) { + const el = document.createElement("input"); + el.type = "file"; + el.name = "file-" + counters.file++; + if (outside) { + outsideNames.push(el.name); + } + const count = rand.int(3); + if (count) { + el.multiple = count > 1; + const transfer = new DataTransfer(); + for (let i = 0; i < count; i++) { + transfer.items.add(new File(["x"], rand.pick(FILE_NAMES), { type: "text/plain" })); + } + el.files = transfer.files; + } + return el; + }, + function (outside) { + const kind = rand.pick(["submit", "image", "button", "reset", "button-element"]); + let el; + if (kind === "button-element") { + el = document.createElement("button"); + el.type = rand.pick(["submit", "button", "reset", ""]); + if (rand.chance(0.9)) { + el.name = name(outside); + } + } else { + el = input(kind, outside); + } + if (rand.chance(0.7)) { + el.setAttribute("value", value()); + } + return el; + }, + function (outside) { + const el = input("hidden", outside); + if (!outside) { + el.name = "_charset_"; + } + el.setAttribute("value", value()); + return el; + }, + function (outside) { + const el = document.createElement(rand.pick(["output", "fieldset"])); + el.setAttribute("name", name(outside)); + el.textContent = "x"; + return el; + }, + ]; + + function control(outside) { + const el = rand.pick(makers)(outside); + el.disabled = el.disabled || rand.chance(0.1); + return el; + } + + // Fills a parent with controls, sometimes nested in a fieldset with a first legend. + function fill(parent, depth) { + const count = 1 + rand.int(6); + for (let i = 0; i < count; i++) { + if (depth < 2 && rand.chance(0.15)) { + const fieldset = document.createElement("fieldset"); + fieldset.disabled = rand.chance(0.5); + if (rand.chance(0.6)) { + const legend = document.createElement("legend"); + legend.appendChild(control(false)); + fieldset.appendChild(legend); + } + fill(fieldset, depth + 1); + parent.appendChild(fieldset); + continue; + } + const el = control(false); + if (rand.chance(0.08)) { + el.setAttribute("form", rand.pick([other.id, "oracle-nowhere", formId])); + } + parent.appendChild(el); + } + } + + fill(form, 0); + if (rand.chance(0.5)) { + form.appendChild(makers[5](false)); + } + + const before = rand.int(3); + const after = rand.int(3); + for (let i = 0; i < before; i++) { + const el = control(true); + el.setAttribute("form", formId); + container.appendChild(el); + } + container.appendChild(form); + container.appendChild(other); + for (let i = 0; i < after; i++) { + const el = control(true); + el.setAttribute("form", formId); + container.appendChild(el); + } + + // The submitter: one of the form's submit buttons, when it has any. + const submitters = Array.prototype.filter.call( + document.querySelectorAll("input, button"), + (el) => el.form === form && (el.type === "submit" || el.type === "image") + ); + const submitter = submitters.length && rand.chance(0.85) ? rand.pick(submitters) : null; + + return { form: form, submitter: submitter, outsideNames: outsideNames }; +} + +// [name, kind, value]: kind "file" holds the file name, kind "text" a string. +export function pluginEntries(fields) { + return fields.map(function (field) { + if (field.value instanceof File) { + return [field.name, "file", field.value.name]; + } + if (field.type === "file") { + return [field.name, "file", ""]; + } + return [field.name, "text", String(field.value)]; + }); +} + +export function nativeEntries(formData) { + return Array.from(formData.entries()).map(function (entry) { + return entry[1] instanceof File + ? [entry[0], "file", entry[1].name] + : [entry[0], "text", entry[1]]; + }); +} + +export function toWellFormed(text) { + return text.replace( + /[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(^|[^\uD800-\uDBFF])[\uDC00-\uDFFF]/g, + function (match, lead) { + return typeof lead === "string" ? lead + "\uFFFD" : "\uFFFD"; + } + ); +} + +export function isImage(el) { + return !!el && el.tagName === "INPUT" && el.type === "image"; +} + +// Known differences between the plugin and FormData. Each has an ID; `normalize` maps +// { plugin, native } entry lists to lists where that class no longer differs. +export const KNOWN_DIFFERENCES = [ + { + id: "USV", + description: "FormData replaces lone surrogates in names and values with U+FFFD", + normalize: (pair) => ({ + plugin: pair.plugin.map((e) => [toWellFormed(e[0]), e[1], toWellFormed(e[2])]), + native: pair.native, + }), + }, + { + id: "CRLF", + description: "the plugin sends line breaks as CRLF; FormData keeps them as the value has them", + normalize: (pair) => { + const lines = (e) => [e[0], e[1], e[1] === "text" ? e[2].replace(/\r\n|\r|\n/g, "\n") : e[2]]; + return { plugin: pair.plugin.map(lines), native: pair.native.map(lines) }; + }, + }, + { + id: "CHARSET", + description: "FormData sends a hidden _charset_ control's value as the document encoding", + normalize: (pair) => ({ + plugin: pair.plugin.map((e) => (e[0] === "_charset_" ? [e[0], e[1], "UTF-8"] : e)), + native: pair.native, + }), + }, + { + id: "DIRNAME", + description: "FormData adds a dirname field for text inputs and textareas; the plugin does not", + normalize: (pair) => ({ + plugin: pair.plugin, + native: pair.native.filter((e) => !/^dir-\d+$/.test(e[0])), + }), + }, + { + id: "SUBMIT-LABEL", + description: + 'FormData sends the default label of an input submitter without a value; the plugin sends ""', + normalize: (pair, ctx) => { + const sub = ctx.submitter; + if (!sub || sub.tagName !== "INPUT" || sub.type !== "submit" || sub.hasAttribute("value")) { + return pair; + } + return { + plugin: pair.plugin, + native: pair.native.map((e) => + e[0] === sub.name && /^Submit( Query)?$/.test(e[2]) ? [e[0], e[1], ""] : e + ), + }; + }, + }, + { + id: "IMG-VALUE", + description: "the plugin sends a clicked image button's name=value before its coordinates", + normalize: (pair, ctx) => { + if (!isImage(ctx.submitter) || !ctx.submitter.name) { + return pair; + } + const n = ctx.submitter.name; + return { + plugin: pair.plugin.filter( + (e, i) => !(e[0] === n && pair.plugin[i + 1] && pair.plugin[i + 1][0] === n + ".x") + ), + native: pair.native, + }; + }, + }, + { + id: "IMG-UNNAMED", + description: "FormData sends x and y for an unnamed image submitter; the plugin sends nothing", + normalize: (pair, ctx) => { + if (!isImage(ctx.submitter) || ctx.submitter.name || ctx.submitter.disabled) { + return pair; + } + return { + plugin: pair.plugin, + native: pair.native.filter((e) => e[0] !== "x" && e[0] !== "y"), + }; + }, + }, + { + id: "IMG-ORDER", + description: "without semantic, the plugin appends the clicked image's fields last", + normalize: (pair, ctx) => { + if (ctx.semantic || !isImage(ctx.submitter) || !ctx.submitter.name) { + return pair; + } + const n = ctx.submitter.name; + const last = (list) => { + const coords = list.filter((e) => e[0] === n + ".x" || e[0] === n + ".y"); + return list.filter((e) => coords.indexOf(e) < 0).concat(coords); + }; + return { plugin: last(pair.plugin), native: last(pair.native) }; + }, + }, + { + id: "SEM-ORDER", + description: "with semantic, the plugin sends outside controls (form=id) after the form's own", + normalize: (pair, ctx) => { + if (!ctx.semantic) { + return pair; + } + const outsideLast = (list) => { + const outside = list.filter( + (e) => ctx.outsideNames.indexOf(e[0].replace(/\.[xy]$/, "")) >= 0 + ); + return list.filter((e) => outside.indexOf(e) < 0).concat(outside); + }; + return { plugin: pair.plugin, native: outsideLast(pair.native) }; + }, + }, +]; + +// Applies every known class to { plugin, native } entry lists. +export function applyKnownDifferences(plugin, native, ctx) { + let pair = { plugin: plugin, native: native }; + KNOWN_DIFFERENCES.forEach(function (known) { + pair = known.normalize(pair, ctx); + }); + return pair; +} + +export function formatEntries(list) { + return list.map((e) => JSON.stringify(e)).join("\n "); +} + +export function canonicalQuery(query) { + if (!query) { + return []; + } + return query.split("&").map(function (pair) { + const parts = pair.split("="); + const decode = (part) => decodeURIComponent((part || "").replace(/\+/g, " ")); + return [decode(parts[0]), "text", decode(parts.slice(1).join("="))]; + }); +} + +let submitterArgumentSupported = null; + +// FormData(form, submitter) arrived after FormData(form); older engines ignore the argument. +export function supportsSubmitterArgument() { + if (submitterArgumentSupported === null) { + const form = document.createElement("form"); + const button = document.createElement("button"); + button.name = "probe"; + form.appendChild(button); + try { + submitterArgumentSupported = new FormData(form, button).has("probe"); + } catch { + submitterArgumentSupported = false; + } + } + return submitterArgumentSupported; +} diff --git a/test/suite/serialization-oracle.test.js b/test/suite/serialization-oracle.test.js index 32124b7..bb04b12 100644 --- a/test/suite/serialization-oracle.test.js +++ b/test/suite/serialization-oracle.test.js @@ -1,418 +1,19 @@ import { afterEach, assert, describe, it } from "vitest"; +import { + SEEDS, + applyKnownDifferences, + canonicalQuery, + formatEntries, + generateForm, + isImage, + nativeEntries, + pluginEntries, + supportsSubmitterArgument, +} from "../shared/oracle-forms.js"; // Serialization oracle: random forms from fixed seeds, serialized by the plugin and by the -// browser's own FormData. Every difference must match a named class in KNOWN_DIFFERENCES. - -const SEEDS = [ - 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765, 10946, 17711, - 28657, 46368, 75025, 121393, 196418, 317811, 514229, 832040, 1346269, 2178309, 3524578, 5702887, - 9227465, 14930352, 24157817, 39088169, 63245986, 102334155, 165580141, 7, 11, 17, 19, 23, 29, 31, - 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 97, 101, 103, -]; - -// mulberry32: a small seeded generator, so a failing seed replays the same form. -function prng(seed) { - let state = seed >>> 0; - - const next = function () { - state = (state + 0x6d2b79f5) >>> 0; - let t = state; - t = Math.imul(t ^ (t >>> 15), t | 1); - t ^= t + Math.imul(t ^ (t >>> 7), t | 61); - return ((t ^ (t >>> 14)) >>> 0) / 4294967296; - }; - - return { - chance: (p) => next() < p, - int: (n) => Math.floor(next() * n), - pick: (list) => list[Math.floor(next() * list.length)], - }; -} - -const NAMES = ["a", "b", "c", "a b", "ΓΌ", "名前", "a[]", "a.b", "x=y", "&", "πŸ˜€"]; -// Lone surrogates: rare; FormData and the plugin both send them as U+FFFD (class USV). -const LONE = ["q\uD800", "lone\uDC00"]; -const VALUES = [ - "", - "1", - "value", - " spaced out ", - "a&b=c", - "100%", - "1+1", - "Γ©", - "ζ—₯本θͺž", - "πŸ˜€", - "!'()*~", - "#ff0000", - "2024-02-29", - "42", - "x@example.com", -]; -const LINE_VALUES = ["one\rtwo", "one\ntwo", "one\r\ntwo", "\r\n\n\r"]; -const TEXT_TYPES = [ - "text", - "hidden", - "password", - "search", - "email", - "number", - "range", - "date", - "color", -]; -const FILE_NAMES = ["a.txt", "b c.txt", "ΓΌ.txt", "ζ—₯本.txt"]; - -// Builds one random form (and its outside controls) inside `container`. -function generateForm(seed, container) { - const rand = prng(seed); - const formId = "oracle-" + seed; - const counters = { file: 0, dir: 0, out: 0 }; - const outsideNames = []; - const form = document.createElement("form"); - form.id = formId; - const other = document.createElement("form"); - other.id = formId + "-other"; - - // Outside controls get their own names (out-N), so the semantic order class can find them. - function name(outside) { - if (outside) { - const outsideName = "out-" + counters.out++; - outsideNames.push(outsideName); - return outsideName; - } - return rand.chance(0.02) ? rand.pick(LONE) : rand.pick(NAMES); - } - - function value() { - return rand.chance(0.02) ? rand.pick(LONE) : rand.pick(VALUES); - } - - function input(type, outside) { - const el = document.createElement("input"); - el.type = type; - if (rand.chance(0.85)) { - el.name = name(outside); - } - return el; - } - - const makers = [ - function (outside) { - const el = input(rand.pick(TEXT_TYPES), outside); - if (rand.chance(0.8)) { - el.setAttribute("value", value()); - } - if (el.type === "hidden" && rand.chance(0.3)) { - el.value = rand.pick(LINE_VALUES); - } - if ((el.type === "text" || el.type === "search") && rand.chance(0.2)) { - el.setAttribute("dirname", "dir-" + counters.dir++); - } - return el; - }, - function (outside) { - const el = input(rand.pick(["checkbox", "radio"]), outside); - if (rand.chance(0.6)) { - el.setAttribute("value", value()); - } - el.checked = rand.chance(0.6); - return el; - }, - function (outside) { - const el = document.createElement("select"); - el.name = name(outside); - el.multiple = rand.chance(0.4); - let parent = el; - const count = rand.int(5); - for (let i = 0; i < count; i++) { - if (rand.chance(0.2)) { - parent = document.createElement("optgroup"); - parent.label = "g" + i; - parent.disabled = rand.chance(0.5); - el.appendChild(parent); - } - const option = document.createElement("option"); - option.text = rand.pick([" one ", "two", "ζ—₯本", ""]); - if (rand.chance(0.6)) { - option.value = value(); - } - option.disabled = rand.chance(0.2); - parent.appendChild(option); - option.selected = rand.chance(0.4); - } - if (rand.chance(0.2)) { - el.selectedIndex = -1; - } - return el; - }, - function (outside) { - const el = document.createElement("textarea"); - el.name = name(outside); - el.value = rand.pick(LINE_VALUES.concat(VALUES)); - if (rand.chance(0.2)) { - el.setAttribute("dirname", "dir-" + counters.dir++); - } - return el; - }, - function (outside) { - const el = document.createElement("input"); - el.type = "file"; - el.name = "file-" + counters.file++; - if (outside) { - outsideNames.push(el.name); - } - const count = rand.int(3); - if (count) { - el.multiple = count > 1; - const transfer = new DataTransfer(); - for (let i = 0; i < count; i++) { - transfer.items.add(new File(["x"], rand.pick(FILE_NAMES), { type: "text/plain" })); - } - el.files = transfer.files; - } - return el; - }, - function (outside) { - const kind = rand.pick(["submit", "image", "button", "reset", "button-element"]); - let el; - if (kind === "button-element") { - el = document.createElement("button"); - el.type = rand.pick(["submit", "button", "reset", ""]); - if (rand.chance(0.9)) { - el.name = name(outside); - } - } else { - el = input(kind, outside); - } - if (rand.chance(0.7)) { - el.setAttribute("value", value()); - } - return el; - }, - function (outside) { - const el = input("hidden", outside); - if (!outside) { - el.name = "_charset_"; - } - el.setAttribute("value", value()); - return el; - }, - function (outside) { - const el = document.createElement(rand.pick(["output", "fieldset"])); - el.setAttribute("name", name(outside)); - el.textContent = "x"; - return el; - }, - ]; - - function control(outside) { - const el = rand.pick(makers)(outside); - el.disabled = el.disabled || rand.chance(0.1); - return el; - } - - // Fills a parent with controls, sometimes nested in a fieldset with a first legend. - function fill(parent, depth) { - const count = 1 + rand.int(6); - for (let i = 0; i < count; i++) { - if (depth < 2 && rand.chance(0.15)) { - const fieldset = document.createElement("fieldset"); - fieldset.disabled = rand.chance(0.5); - if (rand.chance(0.6)) { - const legend = document.createElement("legend"); - legend.appendChild(control(false)); - fieldset.appendChild(legend); - } - fill(fieldset, depth + 1); - parent.appendChild(fieldset); - continue; - } - const el = control(false); - if (rand.chance(0.08)) { - el.setAttribute("form", rand.pick([other.id, "oracle-nowhere", formId])); - } - parent.appendChild(el); - } - } - - fill(form, 0); - if (rand.chance(0.5)) { - form.appendChild(makers[5](false)); - } - - const before = rand.int(3); - const after = rand.int(3); - for (let i = 0; i < before; i++) { - const el = control(true); - el.setAttribute("form", formId); - container.appendChild(el); - } - container.appendChild(form); - container.appendChild(other); - for (let i = 0; i < after; i++) { - const el = control(true); - el.setAttribute("form", formId); - container.appendChild(el); - } - - // The submitter: one of the form's submit buttons, when it has any. - const submitters = Array.prototype.filter.call( - document.querySelectorAll("input, button"), - (el) => el.form === form && (el.type === "submit" || el.type === "image") - ); - const submitter = submitters.length && rand.chance(0.85) ? rand.pick(submitters) : null; - - return { form: form, submitter: submitter, outsideNames: outsideNames }; -} - -// [name, kind, value]: kind "file" holds the file name, kind "text" a string. -function pluginEntries(fields) { - return fields.map(function (field) { - if (field.value instanceof File) { - return [field.name, "file", field.value.name]; - } - if (field.type === "file") { - return [field.name, "file", ""]; - } - return [field.name, "text", String(field.value)]; - }); -} - -function nativeEntries(formData) { - return Array.from(formData.entries()).map(function (entry) { - return entry[1] instanceof File - ? [entry[0], "file", entry[1].name] - : [entry[0], "text", entry[1]]; - }); -} - -function toWellFormed(text) { - return text.replace( - /[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(^|[^\uD800-\uDBFF])[\uDC00-\uDFFF]/g, - function (match, lead) { - return typeof lead === "string" ? lead + "\uFFFD" : "\uFFFD"; - } - ); -} - -function isImage(el) { - return !!el && el.tagName === "INPUT" && el.type === "image"; -} - -// Known differences between the plugin and FormData. Each has an ID; `normalize` maps -// { plugin, native } entry lists to lists where that class no longer differs. -const KNOWN_DIFFERENCES = [ - { - id: "USV", - description: "FormData replaces lone surrogates in names and values with U+FFFD", - normalize: (pair) => ({ - plugin: pair.plugin.map((e) => [toWellFormed(e[0]), e[1], toWellFormed(e[2])]), - native: pair.native, - }), - }, - { - id: "CRLF", - description: "the plugin sends line breaks as CRLF; FormData keeps them as the value has them", - normalize: (pair) => { - const lines = (e) => [e[0], e[1], e[1] === "text" ? e[2].replace(/\r\n|\r|\n/g, "\n") : e[2]]; - return { plugin: pair.plugin.map(lines), native: pair.native.map(lines) }; - }, - }, - { - id: "CHARSET", - description: "FormData sends a hidden _charset_ control's value as the document encoding", - normalize: (pair) => ({ - plugin: pair.plugin.map((e) => (e[0] === "_charset_" ? [e[0], e[1], "UTF-8"] : e)), - native: pair.native, - }), - }, - { - id: "DIRNAME", - description: "FormData adds a dirname field for text inputs and textareas; the plugin does not", - normalize: (pair) => ({ - plugin: pair.plugin, - native: pair.native.filter((e) => !/^dir-\d+$/.test(e[0])), - }), - }, - { - id: "SUBMIT-LABEL", - description: - 'FormData sends the default label of an input submitter without a value; the plugin sends ""', - normalize: (pair, ctx) => { - const sub = ctx.submitter; - if (!sub || sub.tagName !== "INPUT" || sub.type !== "submit" || sub.hasAttribute("value")) { - return pair; - } - return { - plugin: pair.plugin, - native: pair.native.map((e) => - e[0] === sub.name && /^Submit( Query)?$/.test(e[2]) ? [e[0], e[1], ""] : e - ), - }; - }, - }, - { - id: "IMG-VALUE", - description: "the plugin sends a clicked image button's name=value before its coordinates", - normalize: (pair, ctx) => { - if (!isImage(ctx.submitter) || !ctx.submitter.name) { - return pair; - } - const n = ctx.submitter.name; - return { - plugin: pair.plugin.filter( - (e, i) => !(e[0] === n && pair.plugin[i + 1] && pair.plugin[i + 1][0] === n + ".x") - ), - native: pair.native, - }; - }, - }, - { - id: "IMG-UNNAMED", - description: "FormData sends x and y for an unnamed image submitter; the plugin sends nothing", - normalize: (pair, ctx) => { - if (!isImage(ctx.submitter) || ctx.submitter.name || ctx.submitter.disabled) { - return pair; - } - return { - plugin: pair.plugin, - native: pair.native.filter((e) => e[0] !== "x" && e[0] !== "y"), - }; - }, - }, - { - id: "IMG-ORDER", - description: "without semantic, the plugin appends the clicked image's fields last", - normalize: (pair, ctx) => { - if (ctx.semantic || !isImage(ctx.submitter) || !ctx.submitter.name) { - return pair; - } - const n = ctx.submitter.name; - const last = (list) => { - const coords = list.filter((e) => e[0] === n + ".x" || e[0] === n + ".y"); - return list.filter((e) => coords.indexOf(e) < 0).concat(coords); - }; - return { plugin: last(pair.plugin), native: last(pair.native) }; - }, - }, - { - id: "SEM-ORDER", - description: "with semantic, the plugin sends outside controls (form=id) after the form's own", - normalize: (pair, ctx) => { - if (!ctx.semantic) { - return pair; - } - const outsideLast = (list) => { - const outside = list.filter( - (e) => ctx.outsideNames.indexOf(e[0].replace(/\.[xy]$/, "")) >= 0 - ); - return list.filter((e) => outside.indexOf(e) < 0).concat(outside); - }; - return { plugin: pair.plugin, native: outsideLast(pair.native) }; - }, - }, -]; +// browser's own FormData. Every difference must match a named class in KNOWN_DIFFERENCES +// (test/shared/oracle-forms.js). // Known exceptions: the plugin throws where FormData serializes. Each has an ID and a matcher. const KNOWN_THROWS = []; @@ -428,16 +29,9 @@ function attempt(act, ctx) { } } -function formatEntries(list) { - return list.map((e) => JSON.stringify(e)).join("\n "); -} - // Applies every known class; fails with the seed and both lists when a difference remains. function assertSameEntries(plugin, native, ctx) { - let pair = { plugin: plugin, native: native }; - KNOWN_DIFFERENCES.forEach(function (known) { - pair = known.normalize(pair, ctx); - }); + const pair = applyKnownDifferences(plugin, native, ctx); assert.deepEqual( pair.plugin, @@ -455,35 +49,6 @@ function assertSameEntries(plugin, native, ctx) { ); } -function canonicalQuery(query) { - if (!query) { - return []; - } - return query.split("&").map(function (pair) { - const parts = pair.split("="); - const decode = (part) => decodeURIComponent((part || "").replace(/\+/g, " ")); - return [decode(parts[0]), "text", decode(parts.slice(1).join("="))]; - }); -} - -let submitterArgumentSupported = null; - -// FormData(form, submitter) arrived after FormData(form); older engines ignore the argument. -function supportsSubmitterArgument() { - if (submitterArgumentSupported === null) { - const form = document.createElement("form"); - const button = document.createElement("button"); - button.name = "probe"; - form.appendChild(button); - try { - submitterArgumentSupported = new FormData(form, button).has("probe"); - } catch { - submitterArgumentSupported = false; - } - } - return submitterArgumentSupported; -} - describe("serialization oracle", function () { let container; From 665e808efd2f260df78050525d056f69ddcb460e Mon Sep 17 00:00:00 2001 From: Kevin Morris Date: Sun, 1 Nov 2026 21:18:46 -0500 Subject: [PATCH 11/78] build: add Playwright Test and a recording server for end-to-end tests npm run test:e2e runs them; scripts/test-docker.sh --e2e runs them in Docker with Firefox. --- .gitignore | 2 + .prettierignore | 2 + eslint.config.mjs | 18 +++++- package-lock.json | 17 +++++ package.json | 3 + playwright.config.mjs | 25 ++++++++ scripts/test-docker.sh | 14 ++-- test/e2e/server.mjs | 141 +++++++++++++++++++++++++++++++++++++++++ 8 files changed, 216 insertions(+), 6 deletions(-) create mode 100644 playwright.config.mjs create mode 100644 test/e2e/server.mjs diff --git a/.gitignore b/.gitignore index f739e41..a44b6ec 100644 --- a/.gitignore +++ b/.gitignore @@ -231,4 +231,6 @@ $RECYCLE.BIN/ ### Build and test output ### coverage/ .vitest/ +test-results/ +playwright-report/ .jquery/ diff --git a/.prettierignore b/.prettierignore index fcd7019..438cd77 100644 --- a/.prettierignore +++ b/.prettierignore @@ -10,3 +10,5 @@ package-lock.json prototype/ test/ajax/ test/img/ +playwright-report/ +test-results/ diff --git a/eslint.config.mjs b/eslint.config.mjs index 54fd77d..776f624 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -78,7 +78,16 @@ const sourceRules = { }; export default [ - { ignores: [".jquery/**", "dist/**", "coverage/**", "test/ajax/**"] }, + { + ignores: [ + ".jquery/**", + "dist/**", + "coverage/**", + "test/ajax/**", + "test-results/**", + "playwright-report/**", + ], + }, js.configs.recommended, { files: ["src/**/*.js"], @@ -97,9 +106,14 @@ export default [ }, }, { - files: ["test/shared/**/*.js"], + files: ["test/shared/**/*.js", "test/e2e/harness.js"], languageOptions: { sourceType: "module", globals: globals.browser }, }, + { + // Node files whose page.evaluate callbacks run in the browser. + files: ["test/e2e/**/*.mjs"], + languageOptions: { globals: { ...globals.node, ...globals.browser } }, + }, { files: ["test/setup.js", "test/surfaces/browser.test.js"], languageOptions: { globals: globals.browser }, diff --git a/package-lock.json b/package-lock.json index db5727b..e8fa5dd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,6 +13,7 @@ }, "devDependencies": { "@eslint/js": "10.0.1", + "@playwright/test": "1.64.1", "@rollup/plugin-terser": "1.0.2", "@vitest/browser-playwright": "5.0.5", "@vitest/coverage-v8": "5.0.5", @@ -426,6 +427,22 @@ "url": "https://github.com/sponsors/oxc-project" } }, + "node_modules/@playwright/test": { + "version": "1.64.1", + "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.64.1.tgz", + "integrity": "sha512-IaYGml/nSOiZWROfPtuIL7neuu9qDOZ3TNvNljUIrhDMxiGTgPjzj/g9p9RxpS2tSepPDRY+UwAaEeiKtUvIAg==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "playwright": "1.64.1" + }, + "bin": { + "playwright": "cli.js" + }, + "engines": { + "node": ">=20" + } + }, "node_modules/@polka/url": { "version": "1.0.0-next.29", "resolved": "https://registry.npmjs.org/@polka/url/-/url-1.0.0-next.29.tgz", diff --git a/package.json b/package.json index 99a1abd..57fd16d 100644 --- a/package.json +++ b/package.json @@ -46,6 +46,8 @@ "metrics": "node scripts/code-metrics.mjs", "test": "npm run lint && npm run format:check && npm run build && vitest run --coverage --project !suite-webkit && vitest run --project suite-webkit", "test:docker": "scripts/test-docker.sh", + "test:e2e": "playwright test", + "test:e2e:docker": "scripts/test-docker.sh --e2e", "test:firefox": "scripts/test-docker.sh --project suite-firefox" }, "dependencies": { @@ -53,6 +55,7 @@ }, "devDependencies": { "@eslint/js": "10.0.1", + "@playwright/test": "1.64.1", "@rollup/plugin-terser": "1.0.2", "@vitest/browser-playwright": "5.0.5", "@vitest/coverage-v8": "5.0.5", diff --git a/playwright.config.mjs b/playwright.config.mjs new file mode 100644 index 0000000..53081e4 --- /dev/null +++ b/playwright.config.mjs @@ -0,0 +1,25 @@ +import { defineConfig } from "@playwright/test"; + +// End-to-end tests (npm run test:e2e): the built plugin in a real page, posting to the test server +// in test/e2e/server.mjs. JQUERY_FILE picks the jQuery build, JQUERY_FORM_DIST the plugin build. +// Firefox runs only with JQUERY_FORM_FIREFOX=1 (scripts/test-docker.sh --e2e runs it in Docker). +const port = Number(process.env.E2E_PORT || 4310); +const browsers = ["chromium", "webkit"]; +if (process.env.JQUERY_FORM_FIREFOX === "1") { + browsers.push("firefox"); +} + +export default defineConfig({ + testDir: "test/e2e", + testMatch: "*.spec.mjs", + fullyParallel: true, + forbidOnly: !!process.env.CI, + reporter: process.env.CI ? [["list"], ["github"]] : "list", + use: { baseURL: `http://127.0.0.1:${port}` }, + projects: browsers.map((name) => ({ name, use: { browserName: name } })), + webServer: { + command: "node test/e2e/server.mjs", + url: `http://127.0.0.1:${port}/page`, + reuseExistingServer: false, + }, +}); diff --git a/scripts/test-docker.sh b/scripts/test-docker.sh index 82603cc..57f1394 100755 --- a/scripts/test-docker.sh +++ b/scripts/test-docker.sh @@ -1,7 +1,9 @@ #!/usr/bin/env bash # Run Vitest in Playwright's Linux image (its Firefox build does not start on macOS 27). # Usage: [JQUERY_FILE=.jquery/jquery-1.7.2.js] scripts/test-docker.sh [vitest args...] -# Defaults to the suite on Chromium, WebKit and Firefox. Node and node_modules are cached in named +# [JQUERY_FILE=...] scripts/test-docker.sh --e2e [playwright test args...] +# Defaults to the suite on Chromium, WebKit and Firefox; --e2e runs the end-to-end tests +# (npm run test:e2e) instead, on all three browsers unless --project is given. Node and node_modules are cached in named # volumes (jquery-form-node, jquery-form-node-modules-); the host's node_modules stays untouched. set -euo pipefail @@ -10,7 +12,11 @@ image="mcr.microsoft.com/playwright:v$playwright-noble" node_major=$(cat .nvmrc) lock_hash=$(shasum -a 256 package-lock.json | cut -c1-12) -if [ $# -eq 0 ]; then +runner="vitest run" +if [ "${1:-}" = "--e2e" ]; then + shift + runner="playwright test" +elif [ $# -eq 0 ]; then set -- --project suite-chromium --project suite-webkit --project suite-firefox fi @@ -19,7 +25,7 @@ exec docker run --rm --init --ipc=host \ -v jquery-form-node:/opt/node \ -v "jquery-form-node-modules-$lock_hash":/work/node_modules \ -e N_PREFIX=/opt/node -e PATH="/opt/node/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" \ - -e JQUERY_FILE="${JQUERY_FILE:-}" -e JQUERY_FORM_FIREFOX=1 \ + -e JQUERY_FILE="${JQUERY_FILE:-}" -e JQUERY_FORM_FIREFOX=1 -e RUNNER="$runner" \ "$image" bash -euo pipefail -c ' if ! node --version 2>/dev/null | grep -q "^v'"$node_major"'\."; then (cd /tmp && npx --yes n '"$node_major"' >/dev/null) @@ -30,5 +36,5 @@ exec docker run --rm --init --ipc=host \ touch node_modules/.installed fi npx playwright install chromium webkit firefox >/dev/null - npx vitest run "$@" + npx $RUNNER "$@" ' bash "$@" diff --git a/test/e2e/server.mjs b/test/e2e/server.mjs new file mode 100644 index 0000000..663f570 --- /dev/null +++ b/test/e2e/server.mjs @@ -0,0 +1,141 @@ +// End-to-end test server: serves the built plugin, jQuery and the fixture page, records every +// request under /r/ (method, url, headers, raw body and the parsed fields) and answers it with a +// named response. No framework: bodies are parsed with the platform's Request#formData(). +// +// Environment: E2E_PORT (default 4310), JQUERY_FILE (classic jQuery build, default jQuery 3), +// JQUERY_FORM_DIST (directory holding jquery.form.js, default dist). +import { createServer } from "node:http"; +import { readFile } from "node:fs/promises"; +import { resolve } from "node:path"; + +const root = resolve(import.meta.dirname, "../.."); +const port = Number(process.env.E2E_PORT || 4310); +const jqueryFile = resolve(root, process.env.JQUERY_FILE || "node_modules/jquery/dist/jquery.js"); +const distDir = resolve(root, process.env.JQUERY_FORM_DIST || "dist"); + +const files = { + "/jquery.js": [jqueryFile, "text/javascript"], + "/jquery.form.js": [resolve(distDir, "jquery.form.js"), "text/javascript"], + "/oracle-forms.js": [resolve(root, "test/shared/oracle-forms.js"), "text/javascript"], + "/harness.js": [resolve(root, "test/e2e/harness.js"), "text/javascript"], +}; + +const page = ` + + + + jquery-form e2e + + + + + + +
+ + +`; + +// Named responses: /r//[/...]. +const responses = { + ok: [200, "text/plain; charset=utf-8", "ok"], + json: [200, "application/json; charset=utf-8", '{"ok":true,"text":"ΓΌ"}'], + xml: [200, "application/xml; charset=utf-8", 'ΓΌ'], + html: [200, "text/html; charset=utf-8", '

ΓΌ

'], + script: [ + 200, + "text/javascript; charset=utf-8", + "window.e2eScriptRuns = (window.e2eScriptRuns || 0) + 1;", + ], + text: [200, "text/plain; charset=utf-8", "plain ΓΌ"], + "textarea-json": [200, "text/html; charset=utf-8", ''], + "status-404": [404, "text/plain; charset=utf-8", "missing"], + "status-500": [500, "text/plain; charset=utf-8", "broken"], +}; + +// Recorded requests by test id. +const recorded = new Map(); + +async function parseFields(method, url, headers, body) { + const type = headers["content-type"] || ""; + if (!/^(multipart\/form-data|application\/x-www-form-urlencoded)/i.test(type)) { + return null; + } + const request = new Request(url, { method, headers: { "content-type": type }, body }); + const fields = []; + for (const [name, value] of await request.formData()) { + if (typeof value === "string") { + fields.push({ name, kind: "text", value }); + } else { + const bytes = Buffer.from(await value.arrayBuffer()); + fields.push({ + name, + kind: "file", + value: value.name, + type: value.type, + base64: bytes.toString("base64"), + }); + } + } + return fields; +} + +async function record(req, url, body) { + const [, id, name] = url.pathname.split("/").slice(1); + const entry = { + method: req.method, + url: url.pathname + url.search, + headers: req.headers, + base64: body.toString("base64"), + query: Array.from(url.searchParams, ([n, value]) => ({ name: n, kind: "text", value })), + fields: body.length ? await parseFields(req.method, url, req.headers, body) : null, + }; + if (!recorded.has(id)) { + recorded.set(id, []); + } + recorded.get(id).push(entry); + return responses[name] || responses.ok; +} + +function send(res, status, type, body) { + res.writeHead(status, { "Content-Type": type, "Cache-Control": "no-store" }); + res.end(body); +} + +const server = createServer(async (req, res) => { + try { + const url = new URL(req.url, `http://${req.headers.host}`); + const chunks = []; + for await (const chunk of req) { + chunks.push(chunk); + } + const body = Buffer.concat(chunks); + + if (url.pathname.startsWith("/r/")) { + const [status, type, text] = await record(req, url, body); + return send(res, status, type, text); + } + if (url.pathname === "/requests") { + return send( + res, + 200, + "application/json", + JSON.stringify(recorded.get(url.searchParams.get("id")) || []) + ); + } + if (url.pathname === "/" || url.pathname === "/page") { + return send(res, 200, "text/html; charset=utf-8", page); + } + if (files[url.pathname]) { + const [file, type] = files[url.pathname]; + return send(res, 200, type, await readFile(file)); + } + return send(res, 404, "text/plain", "not found"); + } catch (error) { + return send(res, 500, "text/plain", String(error && error.stack)); + } +}); + +server.listen(port, "127.0.0.1", () => { + console.log(`e2e server on http://127.0.0.1:${port}`); +}); From ac3be02b2ba0a0324327dccbea70873a8e669699 Mon Sep 17 00:00:00 2001 From: Kevin Morris Date: Sun, 1 Nov 2026 21:18:46 -0500 Subject: [PATCH 12/78] test: compare the plugin's requests with native submits end to end --- test/e2e/harness.js | 213 +++++++++++++++++++++++++ test/e2e/helpers.mjs | 82 ++++++++++ test/e2e/requests.spec.mjs | 281 +++++++++++++++++++++++++++++++++ test/e2e/responses.spec.mjs | 132 ++++++++++++++++ test/e2e/seeded-forms.spec.mjs | 72 +++++++++ 5 files changed, 780 insertions(+) create mode 100644 test/e2e/harness.js create mode 100644 test/e2e/helpers.mjs create mode 100644 test/e2e/requests.spec.mjs create mode 100644 test/e2e/responses.spec.mjs create mode 100644 test/e2e/seeded-forms.spec.mjs diff --git a/test/e2e/harness.js b/test/e2e/harness.js new file mode 100644 index 0000000..e4f3f5e --- /dev/null +++ b/test/e2e/harness.js @@ -0,0 +1,213 @@ +// In-page side of the end-to-end tests: builds forms, submits them natively and through the +// plugin, and applies the known differences (test/shared/oracle-forms.js). Exposed as window.e2e. +import { applyKnownDifferences, generateForm, isImage } from "/oracle-forms.js"; + +const $ = window.jQuery; +let current = null; + +function fixture() { + const container = document.getElementById("fixture"); + container.textContent = ""; + return container; +} + +// Sets the form's attributes; a null value removes one. +function setAttributes(form, attributes) { + Object.keys(attributes || {}).forEach(function (name) { + if (attributes[name] === null) { + form.removeAttribute(name); + } else { + form.setAttribute(name, attributes[name]); + } + }); +} + +function describeData(data) { + if (data && typeof data === "object" && data.nodeType === 9) { + return { xml: data.documentElement.nodeName, text: data.documentElement.textContent }; + } + return data === undefined ? { undefined: true } : data; +} + +function isDisabled(el) { + return el.disabled || (typeof el.matches === "function" && el.matches(":disabled")); +} + +// The fields a submitter adds: its name, and name.x/name.y for an image. +function submitterNames(el) { + return isImage(el) ? [el.name, el.name + ".x", el.name + ".y"] : [el.name]; +} + +// Differences that only show on the wire. `ctx.transport` is what the plugin sent: +// { plugin: "urlencoded" | "multipart", native: same, iframe: boolean }. +const E2E_DIFFERENCES = [ + { + id: "FILES-MULTIPART", + description: + "a file input makes the plugin post multipart where a urlencoded form posts file names", + normalize: (pair, ctx) => { + if (ctx.transport.plugin !== "multipart" || ctx.transport.native !== "urlencoded") { + return pair; + } + return { + plugin: pair.plugin.map((e) => (e[1] === "file" ? [e[0], "text", e[2]] : e)), + native: pair.native, + }; + }, + }, + { + id: "EMPTY-FILE", + description: + "a FormData upload sends an empty file input as an empty text field, native as an empty file", + normalize: (pair, ctx) => { + if (ctx.transport.iframe || ctx.transport.plugin !== "multipart") { + return pair; + } + return { + plugin: pair.plugin, + native: pair.native.map((e) => (e[1] === "file" && e[2] === "" ? [e[0], "text", ""] : e)), + }; + }, + }, + { + id: "IFRAME-SUBMITTER", + description: + "an iframe upload appends the submitter's fields after the form's, also for a disabled submitter", + normalize: (pair, ctx) => { + const sub = ctx.submitter; + if (!ctx.transport.iframe || !sub || !sub.name) { + return pair; + } + // The extra inputs go at the end of the form, before outside controls that follow it. + const names = submitterNames(sub); + let plugin = pair.plugin; + names.forEach(function (n) { + const index = plugin.map((e) => e[0] === n).lastIndexOf(true); + plugin = plugin.filter((e, i) => i !== index); + }); + let native = pair.native; + if (!isDisabled(sub)) { + const own = isImage(sub) + ? (e) => e[0] === names[1] || e[0] === names[2] + : (e) => e[0] === sub.name; + const index = isImage(sub) ? -1 : native.map((e) => own(e)).lastIndexOf(true); + native = isImage(sub) + ? native.filter((e) => !own(e)) + : native.filter((e, i) => i !== index); + } + return { plugin: plugin, native: native }; + }, + }, +]; + +E2E_DIFFERENCES.push({ + id: "IFRAME-DIRNAME", + description: "an iframe upload posts the form itself, so it sends dirname fields as native does", + normalize: (pair, ctx) => + ctx.transport.iframe + ? { plugin: pair.plugin.filter((e) => !/^dir-\d+$/.test(e[0])), native: pair.native } + : pair, +}); + +window.e2e = { + // A seeded form from the serialization oracle. + generate(seed, attributes) { + current = generateForm(seed, fixture()); + setAttributes(current.form, attributes); + return { + html: document.getElementById("fixture").innerHTML, + hasFiles: !!document.querySelector("#fixture input[type=file]"), + submitter: current.submitter ? current.submitter.outerHTML : null, + }; + }, + + // A hand-written form: `html` holds one form, `submitter` selects its submitter. + build(html, attributes, submitter) { + const container = fixture(); + container.innerHTML = html; + const form = container.querySelector("form"); + setAttributes(form, attributes); + current = { + form: form, + submitter: submitter ? container.querySelector(submitter) : null, + outsideNames: [], + }; + }, + + // Adds files to a file input: [{ name, type, bytes }] with bytes as numbers. + setFiles(selector, files) { + const transfer = new DataTransfer(); + files.forEach(function (file) { + transfer.items.add(new File([new Uint8Array(file.bytes)], file.name, { type: file.type })); + }); + document.querySelector(selector).files = transfer.files; + }, + + // Submits the form natively into the named frame, with its submitter when it has one. + nativeSubmit() { + const form = current.form; + const target = form.getAttribute("target"); + form.noValidate = true; + form.setAttribute("target", "native-sink"); + if (current.submitter) { + form.requestSubmit(current.submitter); + } else { + form.submit(); + } + if (target === null) { + form.removeAttribute("target"); + } else { + form.setAttribute("target", target); + } + }, + + // Submits the form with ajaxSubmit; resolves with the callbacks that ran and their arguments. + pluginSubmit(options) { + const form = current.form; + const submitter = current.submitter; + form.clk = submitter || undefined; + form.clk_x = isImage(submitter) ? 0 : undefined; + form.clk_y = isImage(submitter) ? 0 : undefined; + return new Promise(function (resolve) { + const result = { calls: [] }; + $(form).ajaxSubmit( + $.extend({}, options, { + success: function (data, status) { + result.calls.push("success"); + result.data = describeData(data); + result.status = status; + }, + error: function (xhr, status, error) { + result.calls.push("error"); + result.error = String(error); + result.status = status; + result.httpStatus = xhr.status; + result.responseText = xhr.responseText; + }, + complete: function () { + result.calls.push("complete"); + setTimeout(function () { + resolve(result); + }); + }, + }) + ); + }); + }, + + // Applies the known differences to [name, kind, value] lists of the current form: the + // end-to-end classes first, then the serialization oracle's. + normalize(plugin, native, transport) { + const ctx = { + submitter: current.submitter, + outsideNames: current.outsideNames, + semantic: false, + transport: transport, + }; + let pair = { plugin: plugin, native: native }; + E2E_DIFFERENCES.forEach(function (known) { + pair = known.normalize(pair, ctx); + }); + return applyKnownDifferences(pair.plugin, pair.native, ctx); + }, +}; diff --git a/test/e2e/helpers.mjs b/test/e2e/helpers.mjs new file mode 100644 index 0000000..34ea466 --- /dev/null +++ b/test/e2e/helpers.mjs @@ -0,0 +1,82 @@ +import { expect } from "@playwright/test"; + +let counter = 0; + +// A fresh request id per submission pair, so parallel tests never read each other's requests. +export function requestId(testInfo) { + counter += 1; + return `${testInfo.workerIndex}-${testInfo.testId}-${counter}`; +} + +// Waits until the server recorded `count` requests for `id`, and returns them. +export async function requests(request, id, count) { + let list = []; + await expect + .poll( + async () => { + list = await (await request.get(`/requests?id=${encodeURIComponent(id)}`)).json(); + return list.length; + }, + { timeout: 10000 } + ) + .toBeGreaterThanOrEqual(count); + return list; +} + +// [name, kind, value] triples, as the shared known differences expect them (files by name). +export function entries(fields) { + return (fields || []).map((f) => [f.name, f.kind, f.value]); +} + +// Files with their type and bytes. +export function files(fields) { + return (fields || []).filter((f) => f.kind === "file").map((f) => [f.name, f.value, f.base64]); +} + +// "multipart", "urlencoded", or "none" for a request without a form body. +export function encoding(recorded) { + const type = recorded.headers["content-type"] || ""; + if (/^multipart\/form-data/i.test(type)) { + return "multipart"; + } + return /^application\/x-www-form-urlencoded/i.test(type) ? "urlencoded" : "none"; +} + +// The fields a request carries: the parsed body, or the query string for GET. +export function sent(recorded) { + return recorded.method === "GET" ? recorded.query : recorded.fields; +} + +// Submits the current form natively, then through the plugin; returns both recorded requests and +// the plugin's callbacks. +export async function submitBoth(page, request, id, options) { + await page.evaluate(() => window.e2e.nativeSubmit()); + await requests(request, id, 1); + const result = await page.evaluate((o) => window.e2e.pluginSubmit(o), options || {}); + // An upload that throws before it posts sends nothing. + if (/Error/.test(result.error || "")) { + return { native: (await requests(request, id, 1))[0], plugin: null, result }; + } + const [native, plugin] = await requests(request, id, 2); + return { native, plugin, result }; +} + +// Compares the plugin's request with the native one after the shared known differences. +export async function expectSameFields(page, native, plugin, context) { + const transport = { + plugin: encoding(plugin), + native: encoding(native), + iframe: !plugin.headers["x-requested-with"], + }; + const pair = await page.evaluate( + ([p, n, t]) => window.e2e.normalize(p, n, t), + [entries(sent(plugin)), entries(sent(native)), transport] + ); + const normalized = `normalized plugin: ${JSON.stringify(pair.plugin)}\nnormalized native: ${JSON.stringify(pair.native)}`; + expect(pair.plugin, `unlisted difference\n${context}\n${normalized}`).toEqual(pair.native); +} + +export async function openPage(page) { + await page.goto("/page"); + await page.waitForFunction(() => window.e2e && window.jQuery && window.jQuery.fn.ajaxSubmit); +} diff --git a/test/e2e/requests.spec.mjs b/test/e2e/requests.spec.mjs new file mode 100644 index 0000000..5926e7f --- /dev/null +++ b/test/e2e/requests.spec.mjs @@ -0,0 +1,281 @@ +import { expect, test } from "@playwright/test"; +import { + encoding, + entries, + expectSameFields, + files, + openPage, + requestId, + requests, + sent, +} from "./helpers.mjs"; + +// Hand-written forms through each transport: the plugin's request must equal a native submit of +// the same form after parsing, modulo the known differences; extra data has no native counterpart. +const FORM = `
+ + + + + + + + + +
`; + +const BYTES = Array.from({ length: 256 }, (v, i) => i); + +const TRANSPORTS = [ + { name: "a urlencoded XHR post", enctype: null, file: false, options: {} }, + { name: "a multipart XHR post", enctype: "multipart/form-data", file: true, options: {} }, + { + name: "an iframe upload", + enctype: "multipart/form-data", + file: true, + options: { iframe: true }, + }, +]; + +async function arrange(page, id, attributes, options) { + const settings = Object.assign({ file: false, submitter: "button[name=go]" }, options); + await page.evaluate( + ([html, attrs, submitter, withFile]) => { + window.e2e.build(html, attrs, submitter); + document.querySelector("#fixture textarea").value = "one\r\ntwo\nthree\rfour"; + if (!withFile) { + document.querySelector("#fixture input[type=file]").remove(); + } + }, + [ + FORM, + Object.assign({ action: `/r/${id}/ok`, method: "post" }, attributes), + settings.submitter, + settings.file, + ] + ); + if (settings.file) { + await page.evaluate( + (bytes) => + window.e2e.setFiles("#fixture input[type=file]", [ + { name: "bytes ΓΌ.bin", type: "application/octet-stream", bytes: bytes }, + ]), + BYTES + ); + } +} + +async function nativeSubmit(page, request, id) { + await page.evaluate(() => window.e2e.nativeSubmit()); + return (await requests(request, id, 1))[0]; +} + +async function pluginSubmit(page, request, id, options, count) { + const result = await page.evaluate((o) => window.e2e.pluginSubmit(o), options); + expect(result.calls, result.error).toEqual(["success", "complete"]); + return (await requests(request, id, count || 2))[(count || 2) - 1]; +} + +test.describe("requests the plugin sends", () => { + test.beforeEach(async ({ page }) => { + await openPage(page); + }); + + for (const transport of TRANSPORTS) { + test.describe(`when a form is sent as ${transport.name}`, () => { + test("it should send the fields, unicode, line breaks and submitter as a native submit does", async ({ + page, + request, + }, testInfo) => { + const id = requestId(testInfo); + await arrange(page, id, { enctype: transport.enctype }, { file: transport.file }); + + const native = await nativeSubmit(page, request, id); + const plugin = await pluginSubmit(page, request, id, transport.options); + + expect(plugin.method).toBe("POST"); + expect(encoding(plugin)).toBe(transport.file ? "multipart" : "urlencoded"); + await expectSameFields(page, native, plugin, transport.name); + }); + + test("it should send the form without a submitter as a native submit does", async ({ + page, + request, + }, testInfo) => { + const id = requestId(testInfo); + await arrange( + page, + id, + { enctype: transport.enctype }, + { file: transport.file, submitter: null } + ); + + const native = await nativeSubmit(page, request, id); + const plugin = await pluginSubmit(page, request, id, transport.options); + + expect(entries(sent(plugin)).map((e) => e[0])).not.toContain("go"); + await expectSameFields(page, native, plugin, transport.name); + }); + + test("it should send extraData after the form's fields", async ({ + page, + request, + }, testInfo) => { + const id = requestId(testInfo); + await arrange(page, id, { enctype: transport.enctype }, { file: transport.file }); + const options = Object.assign({}, transport.options, { + data: { extra: "x ΓΌ\r\ny", list: ["1", "2"] }, + }); + + const native = await nativeSubmit(page, request, id); + const plugin = await pluginSubmit(page, request, id, options); + + const pluginEntries = entries(sent(plugin)); + const nativeCount = entries(sent(native)).length; + expect(pluginEntries.length).toBe(nativeCount + 3); + const extra = transport.options.iframe + ? pluginEntries.filter((e) => e[0] === "extra" || e[0] === "list[]") + : pluginEntries.slice(nativeCount); + expect(extra).toEqual([ + ["extra", "text", "x ΓΌ\r\ny"], + ["list[]", "text", "1"], + ["list[]", "text", "2"], + ]); + }); + }); + } + + test.describe("when a file is uploaded", () => { + for (const transport of TRANSPORTS.filter((t) => t.file)) { + test(`as ${transport.name}, it should send the file's name, type and bytes as a native submit does`, async ({ + page, + request, + }, testInfo) => { + const id = requestId(testInfo); + await arrange(page, id, { enctype: transport.enctype }, { file: true }); + + const native = await nativeSubmit(page, request, id); + const plugin = await pluginSubmit(page, request, id, transport.options); + + expect(files(plugin.fields)).toEqual(files(native.fields)); + expect(plugin.fields.filter((f) => f.kind === "file")[0].type).toBe( + "application/octet-stream" + ); + expect(Buffer.from(files(plugin.fields)[0][2], "base64")).toEqual(Buffer.from(BYTES)); + }); + } + }); + + test.describe("when a form is sent urlencoded", () => { + test("it should send the native body byte for byte", async ({ page, request }, testInfo) => { + const id = requestId(testInfo); + await arrange(page, id, {}); + + const native = await nativeSubmit(page, request, id); + const plugin = await pluginSubmit(page, request, id, {}); + + expect(Buffer.from(plugin.base64, "base64").toString("latin1")).toBe( + Buffer.from(native.base64, "base64").toString("latin1") + ); + expect(plugin.headers["content-type"]).toBe( + "application/x-www-form-urlencoded; charset=UTF-8" + ); + }); + + test("it should append string data as given", async ({ page, request }, testInfo) => { + const id = requestId(testInfo); + await arrange(page, id, {}, { submitter: null }); + + const native = await nativeSubmit(page, request, id); + const plugin = await pluginSubmit(page, request, id, { data: "a=1&b=%C3%BC" }); + + const body = Buffer.from(plugin.base64, "base64").toString("latin1"); + expect(body).toBe(Buffer.from(native.base64, "base64").toString("latin1") + "&a=1&b=%C3%BC"); + }); + }); + + test.describe("when the method is GET", () => { + for (const transport of [TRANSPORTS[0], TRANSPORTS[2]]) { + test(`as ${transport.name}, it should send the fields in the query string as a native submit does`, async ({ + page, + request, + }, testInfo) => { + const id = requestId(testInfo); + await arrange(page, id, { method: "get", enctype: transport.enctype }); + + const native = await nativeSubmit(page, request, id); + const plugin = await pluginSubmit(page, request, id, transport.options); + + expect(native.method).toBe("GET"); + expect(plugin.method).toBe("GET"); + expect(plugin.base64).toBe(""); + await expectSameFields(page, native, plugin, transport.name); + }); + } + + test("with an action that has a query, it should keep the action's query, unlike a native submit", async ({ + page, + request, + }, testInfo) => { + const id = requestId(testInfo); + await arrange(page, id, { method: "get", action: `/r/${id}/ok?keep=1` }, { submitter: null }); + + const native = await nativeSubmit(page, request, id); + const plugin = await pluginSubmit(page, request, id, {}); + + expect(native.query.map((f) => f.name)).not.toContain("keep"); + expect(plugin.query[0]).toEqual({ name: "keep", kind: "text", value: "1" }); + expect(plugin.query.slice(1)).toEqual(native.query); + }); + }); + + test.describe("when options override the form's method and action", () => { + for (const transport of TRANSPORTS) { + test(`as ${transport.name}, the method option should win over the form's method`, async ({ + page, + request, + }, testInfo) => { + const id = requestId(testInfo); + await arrange(page, id, { enctype: transport.enctype }, { file: transport.file }); + const native = await nativeSubmit(page, request, id); + await page.evaluate(() => + document.querySelector("#fixture form").setAttribute("method", "get") + ); + + const plugin = await pluginSubmit( + page, + request, + id, + Object.assign({ method: "POST" }, transport.options) + ); + + expect(plugin.method).toBe("POST"); + await expectSameFields(page, native, plugin, transport.name); + }); + + test(`as ${transport.name}, the url option should win over the form's action`, async ({ + page, + request, + }, testInfo) => { + const id = requestId(testInfo); + await arrange(page, id, { enctype: transport.enctype }, { file: transport.file }); + const native = await nativeSubmit(page, request, id); + await page.evaluate( + (i) => + document.querySelector("#fixture form").setAttribute("action", `/r/${i}-unused/ok`), + id + ); + + const plugin = await pluginSubmit( + page, + request, + id, + Object.assign({ url: `/r/${id}/ok` }, transport.options) + ); + + expect(plugin.url.split("?")[0]).toBe(native.url); + await expectSameFields(page, native, plugin, transport.name); + }); + } + }); +}); diff --git a/test/e2e/responses.spec.mjs b/test/e2e/responses.spec.mjs new file mode 100644 index 0000000..4a98c28 --- /dev/null +++ b/test/e2e/responses.spec.mjs @@ -0,0 +1,132 @@ +import { expect, test } from "@playwright/test"; +import { openPage, requestId, requests } from "./helpers.mjs"; + +// Server responses through the plugin's callbacks. No native counterpart: hand-written expectations. +const FORM = `
`; + +const TRANSPORTS = [ + { name: "an XHR post", options: {}, iframe: false }, + { name: "an iframe upload", options: { iframe: true }, iframe: true }, +]; + +async function submit(page, request, testInfo, response, options) { + const id = requestId(testInfo); + await page.evaluate( + ([html, action]) => window.e2e.build(html, { action: action }, null), + [FORM, `/r/${id}/${response}`] + ); + const result = await page.evaluate((o) => window.e2e.pluginSubmit(o), options); + await requests(request, id, 1); + return result; +} + +test.describe("responses the plugin delivers", () => { + test.beforeEach(async ({ page }) => { + await openPage(page); + }); + + for (const transport of TRANSPORTS) { + test.describe(`when ${transport.name} gets a response`, () => { + test("with JSON and dataType json, it should pass the parsed object to success", async ({ + page, + request, + }, testInfo) => { + const options = Object.assign({ dataType: "json" }, transport.options); + + const result = await submit(page, request, testInfo, "json", options); + + expect(result.calls).toEqual(["success", "complete"]); + expect(result.data).toEqual({ ok: true, text: "ΓΌ" }); + }); + + test("with XML and dataType xml, it should pass the XML document to success", async ({ + page, + request, + }, testInfo) => { + const options = Object.assign({ dataType: "xml" }, transport.options); + + const result = await submit(page, request, testInfo, "xml", options); + + expect(result.calls).toEqual(["success", "complete"]); + expect(result.data).toEqual({ xml: "root", text: "ΓΌ" }); + }); + + test("with HTML, it should pass the markup to success", async ({ + page, + request, + }, testInfo) => { + const options = Object.assign({ dataType: "html" }, transport.options); + + const result = await submit(page, request, testInfo, "html", options); + + expect(result.calls).toEqual(["success", "complete"]); + expect(result.data).toBe('

ΓΌ

'); + }); + + test("with plain text, it should pass the text to success", async ({ + page, + request, + }, testInfo) => { + const options = Object.assign({ dataType: "text" }, transport.options); + + const result = await submit(page, request, testInfo, "text", options); + + expect(result.calls).toEqual(["success", "complete"]); + expect(result.data).toBe("plain ΓΌ"); + }); + + test("with a script and dataType script, it should run the script once", async ({ + page, + request, + }, testInfo) => { + const options = Object.assign({ dataType: "script" }, transport.options); + + const result = await submit(page, request, testInfo, "script", options); + + expect(result.calls).toEqual(["success", "complete"]); + expect(await page.evaluate(() => window.e2eScriptRuns)).toBe(1); + }); + }); + } + + test.describe("when an XHR post gets an error status", () => { + for (const status of [404, 500]) { + test(`with ${status}, it should call error with the status and the response text`, async ({ + page, + request, + }, testInfo) => { + const result = await submit(page, request, testInfo, `status-${status}`, {}); + + expect(result.calls).toEqual(["error", "complete"]); + expect(result.status).toBe("error"); + expect(result.httpStatus).toBe(status); + expect(result.responseText).toBe(status === 404 ? "missing" : "broken"); + }); + } + }); + + test.describe("when an iframe upload gets an error status", () => { + test("it should call success with the error page, since a frame cannot see the status", async ({ + page, + request, + }, testInfo) => { + const options = { iframe: true, dataType: "text" }; + + const result = await submit(page, request, testInfo, "status-500", options); + + expect(result.calls).toEqual(["success", "complete"]); + expect(result.data).toBe("broken"); + }); + }); + + test.describe("when an iframe upload gets JSON wrapped in a textarea", () => { + test("it should pass the parsed object to success", async ({ page, request }, testInfo) => { + const options = { iframe: true, dataType: "json" }; + + const result = await submit(page, request, testInfo, "textarea-json", options); + + expect(result.calls).toEqual(["success", "complete"]); + expect(result.data).toEqual({ ok: true, text: "ΓΌ" }); + }); + }); +}); diff --git a/test/e2e/seeded-forms.spec.mjs b/test/e2e/seeded-forms.spec.mjs new file mode 100644 index 0000000..def4782 --- /dev/null +++ b/test/e2e/seeded-forms.spec.mjs @@ -0,0 +1,72 @@ +import { expect, test } from "@playwright/test"; +import { SEEDS } from "../shared/oracle-forms.js"; +import { + encoding, + entries, + expectSameFields, + openPage, + requestId, + sent, + submitBoth, +} from "./helpers.mjs"; + +// The serialization oracle's seeded forms, posted natively and through the plugin to the server. +// The plugin's request must carry what the native one does, modulo the known differences. +const MODES = [ + { name: "a urlencoded XHR post", enctype: "application/x-www-form-urlencoded", options: {} }, + { name: "a multipart XHR post", enctype: "multipart/form-data", options: {} }, + { name: "an iframe upload", enctype: "multipart/form-data", options: { iframe: true } }, +]; + +// Known failures: the plugin fails where the native submit posts. Each has an ID and a matcher; +// the test then pins the failure, so a fix makes it fail until the entry is removed. +const KNOWN_FAILURES = [ + { + id: "IFRAME-USV-THROW", + description: "an iframe upload whose submitter has a lone surrogate fails with URIError", + matches: (result, mode) => !!mode.options.iframe && /URIError/.test(result.error || ""), + }, +]; + +test.describe("seeded forms posted end to end", () => { + test.beforeEach(async ({ page }) => { + await openPage(page); + }); + + for (const mode of MODES) { + for (const seed of SEEDS) { + test(`when the form of seed ${seed} is sent as ${mode.name}, it should reach the server as a native submit does`, async ({ + page, + request, + }, testInfo) => { + const id = requestId(testInfo); + const form = await page.evaluate( + ([s, attributes]) => window.e2e.generate(s, attributes), + [seed, { action: `/r/${id}/ok`, method: "post", enctype: mode.enctype }] + ); + + const { native, plugin, result } = await submitBoth(page, request, id, mode.options); + + const known = KNOWN_FAILURES.filter((k) => k.matches(result, mode)); + if (known.length) { + testInfo.annotations.push({ type: "known failure", description: known[0].id }); + expect(plugin).toBeNull(); + expect(result.calls).toEqual(["error", "complete"]); + return; + } + const context = [ + `seed ${seed}, ${mode.name}`, + `form: ${form.html}`, + `plugin ${plugin.headers["content-type"]}: ${JSON.stringify(entries(sent(plugin)))}`, + `native ${native.headers["content-type"]}: ${JSON.stringify(entries(sent(native)))}`, + ].join("\n"); + expect(result.calls, `${context}\n${result.error}`).toEqual(["success", "complete"]); + expect(plugin.method, context).toBe("POST"); + if (mode.enctype === "multipart/form-data") { + expect(encoding(plugin), context).toBe("multipart"); + } + await expectSameFields(page, native, plugin, context); + }); + } + } +}); From 692b0207dacf277f1a82c3905e93ee730585f0cc Mon Sep 17 00:00:00 2001 From: Kevin Morris Date: Sun, 1 Nov 2026 21:18:46 -0500 Subject: [PATCH 13/78] ci: run the end-to-end tests on 3 browsers and 3 jQuery versions --- .github/workflows/ci.yml | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b8b11a9..8cec753 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -182,3 +182,42 @@ jobs: env: JQUERY_FILE: ${{ matrix.file }} JQUERY_FORM_FIREFOX: ${{ matrix.browser == 'firefox' && '1' || '' }} + + # End-to-end tests: the built plugin posting to a real server (npm run test:e2e). + e2e: + name: e2e on jQuery ${{ matrix.jquery }} on ${{ matrix.browser }} + runs-on: ubuntu-latest + timeout-minutes: 10 + strategy: + fail-fast: false + matrix: + browser: [chromium, webkit, firefox] + jquery: ["1.7.2", "3.7.1", "4.0.0"] + include: + - { jquery: "1.7.2", file: ".jquery/jquery-1.7.2.js" } + - { jquery: "3.7.1", file: "node_modules/jquery/dist/jquery.js" } + - { jquery: "4.0.0", file: "node_modules/jquery4/dist/jquery.js" } + steps: + - uses: actions/checkout@v7 + - uses: actions/setup-node@v7 + with: + node-version-file: .nvmrc + cache: npm + - run: npm ci + - name: Get Playwright version + id: playwright + run: echo "version=$(node -p "require('playwright/package.json').version")" >> "$GITHUB_OUTPUT" + - name: Cache Playwright browsers + uses: actions/cache@v6 + with: + path: ~/.cache/ms-playwright + key: playwright-${{ runner.os }}-${{ steps.playwright.outputs.version }}-${{ matrix.browser }} + - run: npx playwright install --with-deps ${{ matrix.browser }} + - name: Fetch jQuery 1.7.2 + if: matrix.jquery == '1.7.2' + run: scripts/fetch-jquery.sh 1.7.2 + - name: Run the end-to-end tests on jQuery ${{ matrix.jquery }} + run: npm run test:e2e -- --project ${{ matrix.browser }} + env: + JQUERY_FILE: ${{ matrix.file }} + JQUERY_FORM_FIREFOX: ${{ matrix.browser == 'firefox' && '1' || '' }} From 2a9b2036f109ebd1b34e196ba4d70f762ca94b43 Mon Sep 17 00:00:00 2001 From: Kevin Morris Date: Sun, 1 Nov 2026 21:18:46 -0500 Subject: [PATCH 14/78] docs: explain running the end-to-end tests --- CONTRIBUTING.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0f28409..dda6f22 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -73,6 +73,12 @@ jQuery Form uses [Node.js](https://nodejs.org/), [Rollup](https://rollupjs.org/) Edit `src/jquery.form.js` (an ES module), never `dist/`. `npm test` rebuilds `dist/`; commit the rebuilt files with your change, since CI fails if they differ from the build. +### End-to-end tests + +`npm run test:e2e` runs [Playwright Test](https://playwright.dev/) against the built `dist/jquery.form.js` (run `npm run build` first) on Chromium and WebKit. A small Node server (`test/e2e/server.mjs`) serves the fixture page and records every request the plugin sends, through each transport (urlencoded and FormData XHR, the iframe upload). Each test submits the same form natively and through the plugin, and the two requests must match after parsing, apart from the known differences listed in `test/shared/oracle-forms.js` and `test/e2e/harness.js`. `npm test` does not run them. + +Set `JQUERY_FILE` to test another jQuery build, as for the suite. `npm run test:e2e:docker` runs them in Docker on all three browsers, including Firefox. + ### Running tests in Docker Playwright's Firefox build does not start on some macOS versions, and `npm test` covers only Chromium and WebKit. To run the suite on Firefox (or on all three browsers under Linux), use Docker. The scripts use the Playwright image that matches the `playwright` version in `package.json` and leave your local `node_modules` untouched: @@ -82,7 +88,7 @@ npm run test:firefox # the suite on Firefox npm run test:docker # the suite on Chromium, WebKit and Firefox ``` -`scripts/test-docker.sh` passes any arguments on to `vitest run`. To test another jQuery build, set `JQUERY_FILE`, e.g. `JQUERY_FILE=.jquery/jquery-1.7.2.js npm run test:firefox` (fetch it first with `scripts/fetch-jquery.sh 1.7.2`). +`scripts/test-docker.sh` passes any arguments on to `vitest run` (or to `playwright test` after `--e2e`). To test another jQuery build, set `JQUERY_FILE`, e.g. `JQUERY_FILE=.jquery/jquery-1.7.2.js npm run test:firefox` (fetch it first with `scripts/fetch-jquery.sh 1.7.2`). Node and `node_modules` are cached in Docker volumes (`jquery-form-node`, and `jquery-form-node-modules-` for each `package-lock.json`). To clear them: From 81e1dd27564a60fb89ab9da604ab76e4ff435a75 Mon Sep 17 00:00:00 2001 From: Kevin Morris Date: Sun, 1 Nov 2026 21:27:01 -0500 Subject: [PATCH 15/78] fix: send an iframe upload's clicked button with lone surrogates as U+FFFD --- dist/jquery.form.js | 2 +- dist/jquery.form.min.js | 2 +- dist/jquery.form.min.js.map | 2 +- dist/jquery.form.mjs | 2 +- docs/research/4x-behavior-changes.md | 2 +- src/iframe-post.js | 3 ++- src/successful-controls.js | 2 +- test/e2e/seeded-forms.spec.mjs | 8 +------- test/suite/iframe-transport.test.js | 15 +++++++++++++++ 9 files changed, 24 insertions(+), 14 deletions(-) diff --git a/dist/jquery.form.js b/dist/jquery.form.js index 46dd12e..6d293fe 100644 --- a/dist/jquery.form.js +++ b/dist/jquery.form.js @@ -1036,7 +1036,7 @@ function addSubmitterFields(s, form) { for (var n in fields) { s.extraData = s.extraData || {}; - s.extraData[n] = fields[n]; + s.extraData[wellFormed(n)] = wellFormed(fields[n]); } } diff --git a/dist/jquery.form.min.js b/dist/jquery.form.min.js index 7372515..3842c74 100644 --- a/dist/jquery.form.min.js +++ b/dist/jquery.form.min.js @@ -19,5 +19,5 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. */ -!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof module&&module.exports?module.exports=function(t,r){return void 0===r&&(r="undefined"!=typeof window?require("jquery"):require("jquery")(t)),e(r),r}:e(jQuery)}(function(e){"use strict";var t=["HTMLFormElement","HTMLElement","Element","Node"],r=document.createElement("form");function n(e){for(var r=0;r=0)return r;return null}var l="jqFormSubmitter";function f(e,t,r){try{e[t]=r}catch(e){}}function d(e,t){var r=e[t],n=a(e,"elements");return n&&r&&n.namedItem(t)===r?void 0:r}function p(t,r,n,a){e.data(t,l,{el:r,x:n,y:a}),f(t,"clk",r),"image"===r.type&&(f(t,"clk_x",n),f(t,"clk_y",a)),setTimeout(function(){e.data(t,l,null),f(t,"clk",null),f(t,"clk_x",null),f(t,"clk_y",null)},100)}function m(t){var r=c(t.target,["button","input"]);if(r&&("submit"===r.type||"image"===r.type)){var n=r.form;if(n){var a="image"===r.type?function(t,r){if(void 0!==t.offsetX)return[t.offsetX,t.offsetY];if("function"==typeof e.fn.offset){var n=e(r).offset();return[t.pageX-n.left,t.pageY-n.top]}return[t.pageX-r.offsetLeft,t.pageY-r.offsetTop]}(t,r):[];p(n,r,a[0],a[1])}}}function v(t){if(!t)return null;var r=e.data(t,l);if(r)return r;var n=d(t,"clk");return n?{el:n,x:d(t,"clk_x"),y:d(t,"clk_y")}:null}function h(){if(e.fn.ajaxSubmit.debug){var t="[jquery.form] "+Array.prototype.join.call(arguments,"");window.console&&window.console.log?window.console.log(t):window.opera&&window.opera.postError&&window.opera.postError(t)}}var g={};function y(t,r){e.fn.ajaxSubmit.debug&&!g[t]&&(g[t]=!0,window.console&&"function"==typeof window.console.warn&&window.console.warn("[jquery.form] "+r+" (removed in 5.0)"))}function b(e){(function(e){var t=String(e).split("."),r=Number(t[0]);return r<3||3===r&&Number(t[1])<5})(e)&&y("jquery","support for jQuery "+e+" is deprecated, 5.0 needs jQuery 3.5 or later")}function x(e,t,r,n){if("string"!=typeof e&&!1!==e)return e;var a={url:e,data:t,dataType:r};return"function"==typeof n&&(a.success=n),a}function j(e,t,r,n){return"function"==typeof e?{success:e}:void 0===(e=x(e,t,r,n))?{}:!1===e.url||""===e.url?function(e){var t={};for(var r in e)"url"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}(e):e}function w(e,t){for(var r=0;r"'),e(function(){e(n.s,n.c).ajaxForm(r)}),t):(h("terminating; zero elements found by selector"+(e.isReady?"":" (DOM not ready)")),t)}(this,t))}function L(t){return"string"==typeof t?(q(t),this):(t!==A&&(k={},e(document).off("submit.form-plugin click.form-plugin")),this.off("submit.form-plugin click.form-plugin"))}function M(t,r){if(!u(t))return e(t).attr(r);var n=o(t,"getAttribute",r);return null===n?void 0:n}var C=/\r\n|\r|\n/g,N=/\r/g,I=/^(?:fieldset|object|output)$/;function $(e){return"function"==typeof e.matches?e.matches(":disabled"):!!e.disabled}function P(t){if("select"===i(t))return function(e){var t=e.selectedIndex;if(t<0)return null;for(var r=[],n=e.options,a="select-one"===e.type,o=a?t+1:n.length,i=a?t:0;i=0,o=a?e.responseXML:e.responseText;return a&&"parsererror"===o.documentElement.nodeName&&ee.error&&ee.error("parsererror"),r&&r.dataFilter&&(o=r.dataFilter(o,t)),"string"==typeof o&&(("json"===t||!t)&&n.indexOf("json")>=0?o=JSON.parse(o):"script"===t&&ee.globalEval(o)),o}(t,s,r)}catch(e){i="parsererror",t.error=o=e||i}}catch(e){h("error caught: ",e),i="error",t.error=o=e}return{status:i,data:a,errMsg:o}}var ae=e;function oe(e,t){var r,n,a,o=ae.Deferred(),i={aborted:0,responseText:null,responseXML:null,status:0,statusText:"n/a",getAllResponseHeaders:function(){},getResponseHeader:function(){},setRequestHeader:function(){},abort:function(e){s(e,[i,"aborted",e])}};function u(){return i.aborted||a}function s(n,a,s){var c=s||("timeout"===n?"timeout":"aborted");u()||(h("aborting upload... "+c),i.aborted=1,t.stop(),i.error=c,e.error&&e.error.call(e.context,i,c,n),o.reject.apply(o,a),r&&ae.event.trigger("ajaxError",[i,e,c]),l(c))}function c(){r&&ae.event.trigger("ajaxComplete",[i,e]),r&&! --ae.active&&ae.event.trigger("ajaxStop")}function l(r){e.complete&&e.complete.call(e.context,i,r),c(),clearTimeout(n),setTimeout(function(){t.release(),i.responseXML=null},100)}function f(t){var n=t.status,u=t.errMsg;if(i.aborted)h("upload aborted");else if(i.status&&!(i.status>=200&&i.status<300||304===i.status)&&(n="error"),a=!0,"success"!==n)void 0===u&&(u=i.statusText),e.error&&e.error.call(e.context,i,n,u),o.reject(i,"error",u),r&&ae.event.trigger("ajaxError",[i,e,u]),l(n);else{var s=function(t){var n;try{e.success.call(e.context,t,"success",i)}catch(e){n={error:e}}return o.resolve(i.responseText,"success",i),r&&ae.event.trigger("ajaxSuccess",[i,e,t]),n}(t.data);if(l(n),s)throw s.error}}return o.abort=function(e){i.abort(e)},{xhr:i,deferred:o,start:function(){return(r=e.global)&&0===ae.active++&&ae.event.trigger("ajaxStart"),e.beforeSend&&!1===e.beforeSend.call(e.context,i,e)?(u()||(a=!0,o.reject(),r&&ae.event.trigger("ajaxError",[i,e,"canceled"]),c()),!1):!i.aborted&&(r&&ae.event.trigger("ajaxSend",[i,e]),!i.aborted)},done:u,abort:s,settle:f,fail:function(e){f({status:"error",errMsg:e})},startTimer:function(t){e.timeout&&(n=setTimeout(t,e.timeout))},stopTimer:function(){clearTimeout(n),n=void 0}}}var ie=e;function ue(e,t){var r=0;function n(e){var n=e.form,i=e.method,u=w(ie.extend(!0,{},ie.ajaxSettings,e.options),[ie.ajaxSettings,e.options]);u.context=u.context||u;var s=a(n,"ownerDocument"),l=ie(c(n,["body"])),f=function(e,t,r){var n,a;if(e.iframeTarget)(a=(n=ie(e.iframeTarget,r)).attr("name"))?t=a:(n.attr("name",t),n.each(function(){!function(e,t){try{e.contentWindow&&(e.contentWindow.name=t)}catch(e){}}(this,t)}));else{var o=r.createElement("iframe");o.setAttribute("name",t),o.setAttribute("src",e.iframeSrc),(n=ie(o)).css({position:"absolute",top:"-1000px",left:"-1000px"})}return{$io:n,id:t}}(u,"jqFormIO"+(new Date).getTime()+r++,s),d=f.$io,p=d[0],m=oe(u,function(e,t){return{stop:function(){try{t[0].contentWindow.document.execCommand&&t[0].contentWindow.document.execCommand("Stop")}catch(e){}t.attr("src",e.iframeSrc)},release:function(){e.iframeTarget?t.attr("src",e.iframeSrc):t.remove()}}}(u,d)),v=50;if(!m.start())return m.deferred;function g(){try{var e=te(p).readyState;h("state = "+e),e&&"uninitialized"===e.toLowerCase()&&setTimeout(g,50)}catch(e){h("Server abort: ",e," (",e.name,")"),x(2),m.stopTimer()}}function y(){var r=function(e){var t={};return V.each(_,function(r,n){t[n]=o(e,"hasAttribute",n)?o(e,"getAttribute",n):null}),t}(n);!function(e,t,r,n,a){var o="multipart/form-data";Z(e,"target",t),!r||/post/i.test(r)?Z(e,"method","POST"):Y(r)&&!Y(a.property(e,"method"))&&Z(e,"method","GET"),Z(e,"action",n.url),n.skipEncodingOverride||r&&!/post/i.test(r)||(Z(e,"encoding",o),Z(e,"enctype",o))}(n,f.id,i,u,t),m.startTimer(function(){x(1)});var a=[];try{!function(e,t,r,n,a){function o(r,n){var o=t.createElement("input");o.type="hidden",o.name=r,a.push(V(o).val(n).appendTo(e)[0])}if(r)for(var i in r)if(K.call(r,i))if(V.isPlainObject(r[i])&&K.call(r[i],"name")&&K.call(r[i],"value"))o(r[i].name,r[i].value);else{var u={};u[i]=r[i];for(var s=W(u,n),c=0;c=0?"&":"?")+t+e.url.slice(a.length),e.data=null}else e.data=t}(t,a.param(H(v),p),g),{form:c,$form:e,fields:v,controls:h,options:t,method:l,traditional:p}))},deliver:function(e){var t=e.$form,r=e.options,n=[];if(r.resetForm&&n.push(function(){t.resetForm()}),r.clearForm&&n.push(function(){t.clearForm(r.includeHidden)}),!r.dataType&&r.target){var o=l(r.success);n.push(function(e,t,n){var i=arguments,u=r.replaceTarget?"replaceWith":"html",s=a(r.target);"string"==typeof e?s[u](e):h("target: the response was parsed by jQuery, so it is not inserted"),s.length||f(o,this,i),s.each(function(){f(o,this,i)})})}else a.merge(n,l(r.success));if(r.success=function(e,a,o){for(var i=r.context||this,u=0,s=n.length;u0,u=/^[\t\n\f\r ]*multipart\/form-data[\t\n\f\r ]*$/i,s=u.test(r.attribute(n[0],"enctype"))||u.test(r.attribute(n[0],"encoding")),c=t.fileapi&&t.formdata;h("fileAPI :"+c);var l=(i||s)&&!c,f=(i||s)&&c?"formdata":"ajax";if(!1!==o.iframe&&(o.iframe||l)&&(f="iframe"),"iframe"!==f||o.iframe||y("iframe","choosing the iframe transport automatically without FormData is deprecated, set iframe: true"),"ajax"!==f&&"json"===o.requestFormat)throw new Error('jquery.form: requestFormat "json" cannot send files or use the iframe transport');return f}}}!function(e){var t={};t.fileapi=void 0!==e('').get(0).files,t.formdata=void 0!==window.FormData;var r=!!e.fn.prop;var n={attribute:M,property:function(e,t){var n=r?e[t]:void 0;return"string"==typeof n?n:M(e,t)}},a=U(t),u=se(t,n,a),s={iframe:ue(r,n),formdata:B,ajax:Q};e.fn.attr2=function(){if(y("attr2","attr2 is deprecated, use .prop() or .attr()"),!r)return this.attr.apply(this,arguments);var e=this.prop.apply(this,arguments);return e&&e.jquery||"string"==typeof e?e:this.attr.apply(this,arguments)},e.fn.ajaxSubmit=function(t,r,n,a){if(b(e.fn.jquery),!this.length)return h("ajaxSubmit: skipping submit process - no element selected"),this;if(!e.ajax)throw new Error("jquery.form: ajaxSubmit needs the full jQuery build; this jQuery has no $.ajax");var o=u.prepare(this,j(t,r,n,a));if(!o)return this;u.deliver(o);var i=s[u.chooseTransport(o)](o);this.removeData("jqxhr").data("jqxhr",i);for(var c=0;c=0)return r;return null}var l="jqFormSubmitter";function f(e,t,r){try{e[t]=r}catch(e){}}function d(e,t){var r=e[t],n=a(e,"elements");return n&&r&&n.namedItem(t)===r?void 0:r}function p(t,r,n,a){e.data(t,l,{el:r,x:n,y:a}),f(t,"clk",r),"image"===r.type&&(f(t,"clk_x",n),f(t,"clk_y",a)),setTimeout(function(){e.data(t,l,null),f(t,"clk",null),f(t,"clk_x",null),f(t,"clk_y",null)},100)}function m(t){var r=c(t.target,["button","input"]);if(r&&("submit"===r.type||"image"===r.type)){var n=r.form;if(n){var a="image"===r.type?function(t,r){if(void 0!==t.offsetX)return[t.offsetX,t.offsetY];if("function"==typeof e.fn.offset){var n=e(r).offset();return[t.pageX-n.left,t.pageY-n.top]}return[t.pageX-r.offsetLeft,t.pageY-r.offsetTop]}(t,r):[];p(n,r,a[0],a[1])}}}function v(t){if(!t)return null;var r=e.data(t,l);if(r)return r;var n=d(t,"clk");return n?{el:n,x:d(t,"clk_x"),y:d(t,"clk_y")}:null}function h(){if(e.fn.ajaxSubmit.debug){var t="[jquery.form] "+Array.prototype.join.call(arguments,"");window.console&&window.console.log?window.console.log(t):window.opera&&window.opera.postError&&window.opera.postError(t)}}var g={};function y(t,r){e.fn.ajaxSubmit.debug&&!g[t]&&(g[t]=!0,window.console&&"function"==typeof window.console.warn&&window.console.warn("[jquery.form] "+r+" (removed in 5.0)"))}function b(e){(function(e){var t=String(e).split("."),r=Number(t[0]);return r<3||3===r&&Number(t[1])<5})(e)&&y("jquery","support for jQuery "+e+" is deprecated, 5.0 needs jQuery 3.5 or later")}function x(e,t,r,n){if("string"!=typeof e&&!1!==e)return e;var a={url:e,data:t,dataType:r};return"function"==typeof n&&(a.success=n),a}function j(e,t,r,n){return"function"==typeof e?{success:e}:void 0===(e=x(e,t,r,n))?{}:!1===e.url||""===e.url?function(e){var t={};for(var r in e)"url"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}(e):e}function w(e,t){for(var r=0;r"'),e(function(){e(n.s,n.c).ajaxForm(r)}),t):(h("terminating; zero elements found by selector"+(e.isReady?"":" (DOM not ready)")),t)}(this,t))}function L(t){return"string"==typeof t?(q(t),this):(t!==A&&(k={},e(document).off("submit.form-plugin click.form-plugin")),this.off("submit.form-plugin click.form-plugin"))}function M(t,r){if(!u(t))return e(t).attr(r);var n=o(t,"getAttribute",r);return null===n?void 0:n}var C=/\r\n|\r|\n/g,N=/\r/g,I=/^(?:fieldset|object|output)$/;function $(e){return"function"==typeof e.matches?e.matches(":disabled"):!!e.disabled}function P(t){if("select"===i(t))return function(e){var t=e.selectedIndex;if(t<0)return null;for(var r=[],n=e.options,a="select-one"===e.type,o=a?t+1:n.length,i=a?t:0;i=0,o=a?e.responseXML:e.responseText;return a&&"parsererror"===o.documentElement.nodeName&&ee.error&&ee.error("parsererror"),r&&r.dataFilter&&(o=r.dataFilter(o,t)),"string"==typeof o&&(("json"===t||!t)&&n.indexOf("json")>=0?o=JSON.parse(o):"script"===t&&ee.globalEval(o)),o}(t,s,r)}catch(e){i="parsererror",t.error=o=e||i}}catch(e){h("error caught: ",e),i="error",t.error=o=e}return{status:i,data:a,errMsg:o}}var ae=e;function oe(e,t){var r,n,a,o=ae.Deferred(),i={aborted:0,responseText:null,responseXML:null,status:0,statusText:"n/a",getAllResponseHeaders:function(){},getResponseHeader:function(){},setRequestHeader:function(){},abort:function(e){s(e,[i,"aborted",e])}};function u(){return i.aborted||a}function s(n,a,s){var c=s||("timeout"===n?"timeout":"aborted");u()||(h("aborting upload... "+c),i.aborted=1,t.stop(),i.error=c,e.error&&e.error.call(e.context,i,c,n),o.reject.apply(o,a),r&&ae.event.trigger("ajaxError",[i,e,c]),l(c))}function c(){r&&ae.event.trigger("ajaxComplete",[i,e]),r&&! --ae.active&&ae.event.trigger("ajaxStop")}function l(r){e.complete&&e.complete.call(e.context,i,r),c(),clearTimeout(n),setTimeout(function(){t.release(),i.responseXML=null},100)}function f(t){var n=t.status,u=t.errMsg;if(i.aborted)h("upload aborted");else if(i.status&&!(i.status>=200&&i.status<300||304===i.status)&&(n="error"),a=!0,"success"!==n)void 0===u&&(u=i.statusText),e.error&&e.error.call(e.context,i,n,u),o.reject(i,"error",u),r&&ae.event.trigger("ajaxError",[i,e,u]),l(n);else{var s=function(t){var n;try{e.success.call(e.context,t,"success",i)}catch(e){n={error:e}}return o.resolve(i.responseText,"success",i),r&&ae.event.trigger("ajaxSuccess",[i,e,t]),n}(t.data);if(l(n),s)throw s.error}}return o.abort=function(e){i.abort(e)},{xhr:i,deferred:o,start:function(){return(r=e.global)&&0===ae.active++&&ae.event.trigger("ajaxStart"),e.beforeSend&&!1===e.beforeSend.call(e.context,i,e)?(u()||(a=!0,o.reject(),r&&ae.event.trigger("ajaxError",[i,e,"canceled"]),c()),!1):!i.aborted&&(r&&ae.event.trigger("ajaxSend",[i,e]),!i.aborted)},done:u,abort:s,settle:f,fail:function(e){f({status:"error",errMsg:e})},startTimer:function(t){e.timeout&&(n=setTimeout(t,e.timeout))},stopTimer:function(){clearTimeout(n),n=void 0}}}var ie=e;function ue(e,t){var r=0;function n(e){var n=e.form,i=e.method,u=w(ie.extend(!0,{},ie.ajaxSettings,e.options),[ie.ajaxSettings,e.options]);u.context=u.context||u;var s=a(n,"ownerDocument"),l=ie(c(n,["body"])),f=function(e,t,r){var n,a;if(e.iframeTarget)(a=(n=ie(e.iframeTarget,r)).attr("name"))?t=a:(n.attr("name",t),n.each(function(){!function(e,t){try{e.contentWindow&&(e.contentWindow.name=t)}catch(e){}}(this,t)}));else{var o=r.createElement("iframe");o.setAttribute("name",t),o.setAttribute("src",e.iframeSrc),(n=ie(o)).css({position:"absolute",top:"-1000px",left:"-1000px"})}return{$io:n,id:t}}(u,"jqFormIO"+(new Date).getTime()+r++,s),d=f.$io,p=d[0],m=oe(u,function(e,t){return{stop:function(){try{t[0].contentWindow.document.execCommand&&t[0].contentWindow.document.execCommand("Stop")}catch(e){}t.attr("src",e.iframeSrc)},release:function(){e.iframeTarget?t.attr("src",e.iframeSrc):t.remove()}}}(u,d)),v=50;if(!m.start())return m.deferred;function g(){try{var e=te(p).readyState;h("state = "+e),e&&"uninitialized"===e.toLowerCase()&&setTimeout(g,50)}catch(e){h("Server abort: ",e," (",e.name,")"),x(2),m.stopTimer()}}function y(){var r=function(e){var t={};return V.each(_,function(r,n){t[n]=o(e,"hasAttribute",n)?o(e,"getAttribute",n):null}),t}(n);!function(e,t,r,n,a){var o="multipart/form-data";Z(e,"target",t),!r||/post/i.test(r)?Z(e,"method","POST"):Y(r)&&!Y(a.property(e,"method"))&&Z(e,"method","GET"),Z(e,"action",n.url),n.skipEncodingOverride||r&&!/post/i.test(r)||(Z(e,"encoding",o),Z(e,"enctype",o))}(n,f.id,i,u,t),m.startTimer(function(){x(1)});var a=[];try{!function(e,t,r,n,a){function o(r,n){var o=t.createElement("input");o.type="hidden",o.name=r,a.push(V(o).val(n).appendTo(e)[0])}if(r)for(var i in r)if(K.call(r,i))if(V.isPlainObject(r[i])&&K.call(r[i],"name")&&K.call(r[i],"value"))o(r[i].name,r[i].value);else{var u={};u[i]=r[i];for(var s=W(u,n),c=0;c=0?"&":"?")+t+e.url.slice(a.length),e.data=null}else e.data=t}(t,a.param(H(v),p),g),{form:c,$form:e,fields:v,controls:h,options:t,method:l,traditional:p}))},deliver:function(e){var t=e.$form,r=e.options,n=[];if(r.resetForm&&n.push(function(){t.resetForm()}),r.clearForm&&n.push(function(){t.clearForm(r.includeHidden)}),!r.dataType&&r.target){var o=l(r.success);n.push(function(e,t,n){var i=arguments,u=r.replaceTarget?"replaceWith":"html",s=a(r.target);"string"==typeof e?s[u](e):h("target: the response was parsed by jQuery, so it is not inserted"),s.length||f(o,this,i),s.each(function(){f(o,this,i)})})}else a.merge(n,l(r.success));if(r.success=function(e,a,o){for(var i=r.context||this,u=0,s=n.length;u0,u=/^[\t\n\f\r ]*multipart\/form-data[\t\n\f\r ]*$/i,s=u.test(r.attribute(n[0],"enctype"))||u.test(r.attribute(n[0],"encoding")),c=t.fileapi&&t.formdata;h("fileAPI :"+c);var l=(i||s)&&!c,f=(i||s)&&c?"formdata":"ajax";if(!1!==o.iframe&&(o.iframe||l)&&(f="iframe"),"iframe"!==f||o.iframe||y("iframe","choosing the iframe transport automatically without FormData is deprecated, set iframe: true"),"ajax"!==f&&"json"===o.requestFormat)throw new Error('jquery.form: requestFormat "json" cannot send files or use the iframe transport');return f}}}!function(e){var t={};t.fileapi=void 0!==e('').get(0).files,t.formdata=void 0!==window.FormData;var r=!!e.fn.prop;var n={attribute:M,property:function(e,t){var n=r?e[t]:void 0;return"string"==typeof n?n:M(e,t)}},a=U(t),u=se(t,n,a),s={iframe:ue(r,n),formdata:B,ajax:Q};e.fn.attr2=function(){if(y("attr2","attr2 is deprecated, use .prop() or .attr()"),!r)return this.attr.apply(this,arguments);var e=this.prop.apply(this,arguments);return e&&e.jquery||"string"==typeof e?e:this.attr.apply(this,arguments)},e.fn.ajaxSubmit=function(t,r,n,a){if(b(e.fn.jquery),!this.length)return h("ajaxSubmit: skipping submit process - no element selected"),this;if(!e.ajax)throw new Error("jquery.form: ajaxSubmit needs the full jQuery build; this jQuery has no $.ajax");var o=u.prepare(this,j(t,r,n,a));if(!o)return this;u.deliver(o);var i=s[u.chooseTransport(o)](o);this.removeData("jqxhr").data("jqxhr",i);for(var c=0;c= 0) {\n return node;\n }\n }\n\n return null;\n}\n","import { closestByTag, formMember } from \"./form-members.js\";\nimport jQuery from \"jquery\";\n\n// The submitter: the button that submitted a form, captured from ajaxForm's clicks. It is kept in\n// a private store and cleared shortly after the click. The form's clk, clk_x and clk_y properties\n// are still written for pages that read them, and read when the store has none.\n\nvar storeKey = \"jqFormSubmitter\";\n\n// Writes a property on the form; a control with that name makes it read-only.\nfunction setExpando(form, name, value) {\n try {\n form[name] = value;\n } catch (ignore) {\n // the control keeps the name; the store has the submitter\n }\n}\n\n// A property the page set on the form, never a control of the form with that name.\nfunction expando(form, name) {\n var value = form[name];\n var els = formMember(form, \"elements\");\n\n return els && value && els.namedItem(name) === value ? undefined : value;\n}\n\n// Records a submitter for a form until the click window ends.\nfunction record(form, el, x, y) {\n jQuery.data(form, storeKey, { el: el, x: x, y: y });\n setExpando(form, \"clk\", el);\n\n if (el.type === \"image\") {\n setExpando(form, \"clk_x\", x);\n setExpando(form, \"clk_y\", y);\n }\n\n // clear form vars\n setTimeout(function () {\n jQuery.data(form, storeKey, null);\n setExpando(form, \"clk\", null);\n setExpando(form, \"clk_x\", null);\n setExpando(form, \"clk_y\", null);\n }, 100);\n}\n\n// The clicked point of an image button, relative to the image.\nfunction imagePoint(e, target) {\n if (typeof e.offsetX !== \"undefined\") {\n return [e.offsetX, e.offsetY];\n }\n\n if (typeof jQuery.fn.offset === \"function\") {\n var offset = jQuery(target).offset();\n\n return [e.pageX - offset.left, e.pageY - offset.top];\n }\n\n return [e.pageX - target.offsetLeft, e.pageY - target.offsetTop];\n}\n\n/**\n * Records the submit or image button a click event reached, for the form it belongs to.\n */\nexport function captureSubmitter(e) {\n // the clicked control, or the button around the clicked content (ex: a span within a button)\n var target = closestByTag(e.target, [\"button\", \"input\"]);\n\n // the type property, unlike the attribute, is \"submit\" for a button without a type (#588)\n if (!target || (target.type !== \"submit\" && target.type !== \"image\")) {\n return;\n }\n\n var form = target.form;\n\n if (!form) {\n // a submit control that belongs to no form\n return;\n }\n\n var point = target.type === \"image\" ? imagePoint(e, target) : [];\n\n record(form, target, point[0], point[1]);\n}\n\n/**\n * Records the submitter a submit event names (SubmitEvent.submitter), when no click was captured.\n * An image submitter gets the point 0,0, as native submission sends it without a click.\n */\nexport function captureEventSubmitter(e, form) {\n var el = e.originalEvent && e.originalEvent.submitter;\n\n if (el && !submitterOf(form)) {\n record(form, el, 0, 0);\n }\n}\n\n/**\n * The form's submitter as { el, x, y } (x and y for an image button), or null.\n */\nexport function submitterOf(form) {\n if (!form) {\n return null;\n }\n\n var stored = jQuery.data(form, storeKey);\n\n if (stored) {\n return stored;\n }\n\n var el = expando(form, \"clk\");\n\n return el ? { el: el, x: expando(form, \"clk_x\"), y: expando(form, \"clk_y\") } : null;\n}\n\n/**\n * The submitter's fields for a post that adds them itself (the iframe upload), as name β†’ value.\n */\nexport function submitterFields(form) {\n var fields = {};\n var sub = submitterOf(form);\n var el = sub && sub.el;\n\n if (el && el.name && !el.disabled) {\n fields[el.name] = el.value;\n if (el.type === \"image\") {\n fields[el.name + \".x\"] = sub.x;\n fields[el.name + \".y\"] = sub.y;\n }\n }\n\n return fields;\n}\n\n/**\n * The form's submitter element, or null.\n */\nexport function submitterElement(form) {\n var sub = submitterOf(form);\n\n return sub ? sub.el : null;\n}\n","import jQuery from \"jquery\";\n\n// Debug logging, switched on by $.fn.ajaxSubmit.debug. The flag is read on every call, so it can\n// be turned on after the plugin loads.\nexport function log() {\n if (!jQuery.fn.ajaxSubmit.debug) {\n return;\n }\n\n var msg = \"[jquery.form] \" + Array.prototype.join.call(arguments, \"\");\n\n if (window.console && window.console.log) {\n window.console.log(msg);\n } else if (window.opera && window.opera.postError) {\n window.opera.postError(msg);\n }\n}\n\nvar warned = {};\n\n/**\n * A deprecation warning: console.warn, only while debug is on, once per id per page. The message\n * names the replacement; the warning adds that the feature is removed in 5.0.\n */\nexport function deprecate(id, message) {\n if (!jQuery.fn.ajaxSubmit.debug || warned[id]) {\n return;\n }\n\n warned[id] = true;\n\n if (window.console && typeof window.console.warn === \"function\") {\n window.console.warn(\"[jquery.form] \" + message + \" (removed in 5.0)\");\n }\n}\n\n// Forgets which deprecations have warned (for tests).\nexport function resetDeprecations() {\n warned = {};\n}\n\n// True for a jQuery version string older than 3.5.\nexport function beforeJQuery35(version) {\n var parts = String(version).split(\".\");\n var major = Number(parts[0]);\n\n return major < 3 || (major === 3 && Number(parts[1]) < 5);\n}\n\n// 5.0 needs jQuery 3.5 or later: warned on the first ajaxSubmit or ajaxForm, given jQuery's version.\nexport function deprecateOldJQuery(version) {\n if (beforeJQuery35(version)) {\n deprecate(\n \"jquery\",\n \"support for jQuery \" + version + \" is deprecated, 5.0 needs jQuery 3.5 or later\"\n );\n }\n}\n","// The arguments ajaxSubmit and ajaxForm accept in place of an options object.\n\n/**\n * Turns the (url, data, dataType, success) shorthand into options. A url of false is kept as\n * the url; anything else is returned as given.\n */\nexport function shorthandOptions(options, data, dataType, onSuccess) {\n if (typeof options !== \"string\" && options !== false) {\n return options;\n }\n\n var result = { url: options, data: data, dataType: dataType };\n\n if (typeof onSuccess === \"function\") {\n result.success = onSuccess;\n }\n\n return result;\n}\n\n// A copy of options without its url, so the form action is used.\nfunction withoutUrl(options) {\n var result = {};\n\n for (var key in options) {\n if (key !== \"url\" && Object.prototype.hasOwnProperty.call(options, key)) {\n result[key] = options[key];\n }\n }\n\n return result;\n}\n\n/**\n * The options ajaxSubmit starts from: a function is the success callback, the shorthand is\n * expanded, and no options at all is an empty object. A url of false or \"\" means the form action.\n */\nexport function submitOptions(options, data, dataType, onSuccess) {\n if (typeof options === \"function\") {\n return { success: options };\n }\n\n options = shorthandOptions(options, data, dataType, onSuccess);\n\n if (typeof options === \"undefined\") {\n return {};\n }\n\n return options.url === false || options.url === \"\" ? withoutUrl(options) : options;\n}\n\n/**\n * jQuery treats `context` as a flat option: after a deep merge, the settings get back the\n * caller's own object from the last source that has one, so `this` in callbacks is that object.\n */\nexport function keepContext(settings, sources) {\n for (var i = 0; i < sources.length; i++) {\n if (sources[i].context !== undefined) {\n settings.context = sources[i].context;\n }\n }\n\n return settings;\n}\n","import { assertRealParent, closestByTag, formMember, isElement } from \"./form-members.js\";\nimport { captureEventSubmitter, captureSubmitter } from \"./submitter.js\";\nimport { deprecate, deprecateOldJQuery, log } from \"./diagnostics.js\";\nimport jQuery from \"jquery\";\nimport { shorthandOptions } from \"./options.js\";\n\n// ajaxForm binding: the submit and click handlers that send a form through ajaxSubmit. The\n// handlers look up $.fn.ajaxSubmit when they run, so a replacement installed later is used.\n\n// Sends the submit event's form with ajaxSubmit, unless an earlier handler cancelled it.\nfunction submitWith(e, options) {\n if (!e.isDefaultPrevented()) {\n // if event has been canceled, don't proceed\n e.preventDefault();\n // the form is found through the real tree: a control named nodeType misleads jQuery's closest\n var form = closestByTag(e.target, [\"form\"]);\n\n // a button outside the form (form attribute), or requestSubmit(button), sends no click here\n captureEventSubmitter(e, form);\n jQuery(form).ajaxSubmit(options); // #365\n }\n}\n\nfunction doAjaxSubmit(e) {\n submitWith(e, e.data);\n}\n\nfunction captureSubmittingElement(e) {\n /* jshint validthis:true */\n assertRealParent(this);\n captureSubmitter(e);\n}\n\n// An empty selection: queued until the DOM is ready (old jQuery keeps the selector), or dropped.\nfunction bindLater($sel, options) {\n var o = { s: $sel.selector, c: $sel.context };\n\n if (!jQuery.isReady && o.s) {\n log(\"DOM not ready, queuing ajaxForm\");\n deprecate(\n \"queue\",\n \"queuing ajaxForm until the DOM is ready is deprecated, call ajaxForm inside $(fn) \" +\n 'or use delegation: \"\"'\n );\n jQuery(function () {\n jQuery(o.s, o.c).ajaxForm(options);\n });\n\n return $sel;\n }\n\n // is your DOM ready? http://docs.jquery.com/Tutorials:Introducing_$(document).ready()\n log(\"terminating; zero elements found by selector\" + (jQuery.isReady ? \"\" : \" (DOM not ready)\"));\n\n return $sel;\n}\n\n// delegation: true on jQuery 3 and later, where the selection has no selector: always warned,\n// debug or not, once per ajaxForm call.\nfunction warnUnscoped() {\n var console = window.console || {};\n\n if (typeof console.warn === \"function\") {\n console.warn(\n \"[jquery.form] delegation: true binds every form on the page on jQuery 3 and later; \" +\n 'pass a selector instead, e.g. delegation: \"form.ajax\"'\n );\n }\n}\n\nfunction bindDelegated($sel, options) {\n if ($sel.selector === undefined) {\n warnUnscoped();\n }\n\n jQuery(document)\n .off(\"submit.form-plugin\", $sel.selector, doAjaxSubmit)\n .off(\"click.form-plugin\", $sel.selector, captureSubmittingElement)\n .on(\"submit.form-plugin\", $sel.selector, options, doAjaxSubmit)\n .on(\"click.form-plugin\", $sel.selector, options, captureSubmittingElement);\n\n return $sel;\n}\n\n// The element itself or its nearest ancestor that matches the selector. The walk never reads a\n// parentNode a control can hide (jQuery's delegated walk does, and cycles on such a form).\nfunction closestMatch(el, selector) {\n if (!isElement(el)) {\n return null;\n }\n\n if (window.Element && Element.prototype.closest) {\n return Element.prototype.closest.call(el, selector);\n }\n\n for (var node = el; node && isElement(node); node = formMember(node, \"parentNode\")) {\n if (jQuery(node).is(selector)) {\n return node;\n }\n }\n\n return null;\n}\n\n// The document handlers bound for each delegation selector, keyed by \"s\" + selector.\nvar delegated = {};\n\nfunction unbindSelector(selector) {\n var handlers = delegated[\"s\" + selector];\n\n if (handlers) {\n jQuery(document)\n .off(\"submit.form-plugin\", handlers.submit)\n .off(\"click.form-plugin\", handlers.click);\n delete delegated[\"s\" + selector];\n }\n}\n\n// delegation: \"\": one handler pair on the document, scoped to the selector.\nfunction bindSelector($sel, selector, options) {\n if (!selector) {\n throw new Error(\"jquery.form: delegation needs a selector, or true\");\n }\n\n var handlers = {\n submit: function (e) {\n if (closestMatch(e.target, selector)) {\n submitWith(e, options);\n }\n },\n click: function (e) {\n if (closestMatch(e.target, selector)) {\n captureSubmitter(e);\n }\n },\n };\n\n unbindSelector(selector);\n delegated[\"s\" + selector] = handlers;\n jQuery(document)\n .on(\"submit.form-plugin\", handlers.submit)\n .on(\"click.form-plugin\", handlers.click);\n\n return $sel;\n}\n\n// Passed by ajaxForm's own rebind: unbind the selection only, never the document handlers.\nvar selectionOnly = {};\n\n/**\n * ajaxForm() binds the selected forms so a submit is sent with ajaxSubmit, with the clicked\n * submit button (and image coordinates) included. The options work as for ajaxSubmit.\n */\nexport function ajaxForm(options, data, dataType, onSuccess) {\n deprecateOldJQuery(jQuery.fn.jquery);\n options = shorthandOptions(options, data, dataType, onSuccess) || {};\n\n if (typeof options.delegation === \"string\") {\n return bindSelector(this, options.delegation, options);\n }\n\n options.delegation = options.delegation && typeof jQuery.fn.on === \"function\";\n\n if (!options.delegation && this.length === 0) {\n return bindLater(this, options);\n }\n\n if (options.delegation) {\n return bindDelegated(this, options);\n }\n\n if (options.beforeFormUnbind) {\n options.beforeFormUnbind(this, options);\n }\n\n return this.ajaxFormUnbind(selectionOnly)\n .on(\"submit.form-plugin\", options, doAjaxSubmit)\n .on(\"click.form-plugin\", options, captureSubmittingElement);\n}\n\n/**\n * ajaxFormUnbind() removes the handlers ajaxForm bound on the selection and every delegated\n * binding on the document. ajaxFormUnbind(selector) removes only that delegation selector.\n */\nexport function ajaxFormUnbind(selector) {\n if (typeof selector === \"string\") {\n unbindSelector(selector);\n\n return this;\n }\n\n if (selector !== selectionOnly) {\n delegated = {};\n jQuery(document).off(\"submit.form-plugin click.form-plugin\");\n }\n\n return this.off(\"submit.form-plugin click.form-plugin\");\n}\n","import { callFormMethod, isElement } from \"./form-members.js\";\nimport jQuery from \"jquery\";\n\n/**\n * An attribute of a form, or undefined when it is absent, as jQuery's attr returns it. The\n * subject may also be the document or a plain object, read through jQuery.\n */\nexport function formAttribute(form, name) {\n if (!isElement(form)) {\n return jQuery(form).attr(name);\n }\n\n var value = callFormMethod(form, \"getAttribute\", name);\n\n return value === null ? undefined : value;\n}\n","import { callFormMethod, formMember, isElement, tagName } from \"./form-members.js\";\nimport { formAttribute } from \"./form-attributes.js\";\nimport jQuery from \"jquery\";\nimport { submitterOf } from \"./submitter.js\";\n\n// Successful controls: which controls of a form are sent, and as which name/value fields\n// (https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#constructing-the-form-data-set).\n\n// Line breaks, sent as CRLF\nvar rLineBreak = /\\r\\n|\\r|\\n/g;\nvar rCR = /\\r/g;\n\n// Listed form elements that are never submitted.\nvar rUnsubmittable = /^(?:fieldset|object|output)$/;\n\n/**\n * Whether a control or option is disabled, also through a disabled fieldset or optgroup. Without\n * selector matching, only its own disabled property is read.\n */\nfunction isDisabled(el) {\n return typeof el.matches === \"function\" ? el.matches(\":disabled\") : !!el.disabled;\n}\n\n/**\n * The successful-control rule: whether a control is sent. `submitter` is the button that\n * submitted the control's form; other submit and image buttons of a form are not sent.\n */\nexport function isSuccessful(el, submitter) {\n var t = el.type;\n\n if (!el.name || isDisabled(el) || t === \"reset\" || t === \"button\") {\n return false;\n }\n\n if (t === \"checkbox\" || t === \"radio\") {\n return !!el.checked;\n }\n\n if (t === \"submit\" || t === \"image\") {\n return !el.form || submitter === el;\n }\n\n return tagName(el) !== \"select\" || el.selectedIndex !== -1;\n}\n\n// The value of a select: the selected option's value for one, a list for several.\nfunction selectValue(el) {\n var index = el.selectedIndex;\n\n if (index < 0) {\n return null;\n }\n\n var a = [],\n ops = el.options;\n var one = el.type === \"select-one\";\n var max = one ? index + 1 : ops.length;\n\n for (var i = one ? index : 0; i < max; i++) {\n var op = ops[i];\n\n if (op.selected && !isDisabled(op)) {\n var v = op.value;\n\n if (!v) {\n // extra pain for IE...\n v =\n op.attributes && op.attributes.value && !op.attributes.value.specified\n ? op.text\n : op.value;\n }\n\n if (one) {\n return v;\n }\n\n a.push(v);\n }\n }\n\n return a;\n}\n\n/**\n * The value of a control, whether or not it is successful: a list for a multiple select, null\n * for a select with nothing selected, otherwise a string with CRLF line breaks (a lone CR or LF\n * included).\n */\nexport function valueOf(el) {\n if (tagName(el) === \"select\") {\n return selectValue(el);\n }\n\n var v = jQuery(el).val();\n var raw = el.value;\n\n // jQuery before 4.0 drops carriage returns from .val(); read them from the value itself\n if (typeof raw === \"string\" && raw.replace(rCR, \"\") === v) {\n v = raw;\n }\n\n return v.replace(rLineBreak, \"\\r\\n\");\n}\n\n/**\n * The fields as a urlencoded body sends them: a selected file as its name.\n */\n// A lone surrogate becomes U+FFFD, as in a native submission; jQuery.param would throw.\nvar loneSurrogate = /[\\uD800-\\uDBFF](?![\\uDC00-\\uDFFF])|([^\\uD800-\\uDBFF]|^)([\\uDC00-\\uDFFF])/g;\n\nfunction wellFormed(value) {\n return typeof value === \"string\"\n ? value.replace(loneSurrogate, function (match, before) {\n return (before || \"\") + \"\\uFFFD\";\n })\n : value;\n}\n\nexport function urlencodedFields(fields) {\n return jQuery.map(fields, function (field) {\n var value =\n field.type === \"file\" && typeof field.value !== \"string\" ? field.value.name : field.value;\n var name = wellFormed(field.name);\n value = wellFormed(value);\n\n return name === field.name && value === field.value ? field : { name: name, value: value };\n });\n}\n\n/**\n * The serialization steps. `feature` holds what the entry detected at load (fileapi).\n */\nexport function createSuccessfulControls(feature) {\n var $ = jQuery;\n\n // #386; inputs that name the form in their form attribute, other than the candidates found.\n // A form only gets the ones it owns.\n function outsideControls(formId, els, owner) {\n // hat tip @thet; the id is compared, never built into a selector\n return $(\":input[form]\")\n .filter(function () {\n return (\n this.getAttribute(\"form\") === formId &&\n (!owner || this.form === owner) &&\n $.inArray(this, els) < 0\n );\n })\n .get();\n }\n\n // A descendant of a form is a candidate unless it is a control another form owns.\n function ownedBy(els, owner) {\n return $.grep(els, function (el) {\n return typeof el.form === \"undefined\" || el.form === owner;\n });\n }\n\n /**\n * The candidate controls of a form, in order: its elements, or every descendant it owns in\n * semantic mode, then the outside controls it owns that name it.\n */\n function controlsOf(form, semantic) {\n var formId = formAttribute(form, \"id\");\n var els = formMember(form, \"elements\");\n\n if (semantic || typeof els === \"undefined\") {\n // the document is not an element; it has its own getElementsByTagName\n els = isElement(form)\n ? callFormMethod(form, \"getElementsByTagName\", \"*\")\n : form.getElementsByTagName(\"*\");\n }\n\n els = $.makeArray(els);\n\n // the subject may also be a fieldset, the document or another container\n var owner = tagName(form) === \"form\" ? form : null;\n\n if (semantic && owner) {\n els = ownedBy(els, owner);\n }\n\n // FinesseRus: in non-IE browsers outside fields are already included in form.elements.\n if (formId && (semantic || /(Edge|Trident)\\//.test(navigator.userAgent))) {\n els = els.concat(outsideControls(formId, els, owner));\n }\n\n return els;\n }\n\n // The fields of a control's value, or null when the control is not sent.\n function fieldsOf(el) {\n var n = el.name;\n // read at call time, so a page that replaces $.fieldValue changes what is sent\n var v = $.fieldValue(el, true);\n\n if (v && v.constructor === Array) {\n return $.map(v, function (value) {\n return { name: n, value: value };\n });\n }\n\n if (feature.fileapi && el.type === \"file\") {\n var files = el.files;\n\n // #180: an empty field when no file is selected\n return files.length\n ? $.map(files, function (file) {\n return { name: n, value: file, type: el.type };\n })\n : [{ name: n, value: \"\", type: el.type }];\n }\n\n if (v === null || typeof v === \"undefined\") {\n return null;\n }\n\n return [{ name: n, value: v, type: el.type, required: el.required }];\n }\n\n // The clicked image's value and coordinates.\n function imageFields(sub, input, type) {\n var n = input.name;\n var value = { name: n, value: $(input).val() };\n\n if (type) {\n value.type = type;\n }\n\n return [value, { name: n + \".x\", value: sub.x }, { name: n + \".y\", value: sub.y }];\n }\n\n // Adds one candidate control's fields, and the control when it has a value to send.\n function addCandidate(collected, form, el, semantic) {\n if (!el.name || isDisabled(el) || rUnsubmittable.test(tagName(el))) {\n return;\n }\n\n var sub = semantic && el.type === \"image\" && submitterOf(form);\n\n if (sub) {\n // handle image inputs on the fly when semantic == true\n if (sub.el === el) {\n collected.fields.push.apply(collected.fields, imageFields(sub, el, el.type));\n }\n\n return;\n }\n\n var own = fieldsOf(el);\n\n if (own) {\n collected.controls.push(el);\n collected.fields.push.apply(collected.fields, own);\n }\n }\n\n // input type=='image' are not found in elements array! handle it here\n function addClickedImage(collected, form) {\n var sub = submitterOf(form);\n var input = sub && $(sub.el)[0];\n\n if (input && input.name && !isDisabled(input) && input.type === \"image\") {\n collected.fields.push.apply(collected.fields, imageFields(sub, input));\n }\n }\n\n /**\n * The fields of a form, as formToArray returns them, and the controls they came from.\n */\n function collect(form, semantic, filtering) {\n var collected = { fields: [], controls: [] };\n\n if (!form) {\n return collected;\n }\n\n var els = controlsOf(form, semantic);\n\n if (typeof filtering === \"function\") {\n els = $.map(els, filtering);\n }\n\n for (var i = 0; i < els.length; i++) {\n addCandidate(collected, form, els[i], semantic);\n }\n\n if (!semantic) {\n addClickedImage(collected, form);\n }\n\n return collected;\n }\n\n return {\n controlsOf: controlsOf,\n fieldsOf: fieldsOf,\n collect: collect,\n };\n}\n","import jQuery from \"jquery\";\nimport { keepContext } from \"./options.js\";\n\n// The XMLHttpRequest transports: $.ajax with the encoded fields, or FormData for file uploads.\nvar $ = jQuery;\n\n// utility fn for deep serialization: [name, value] pairs, as $.param encodes them\nexport function deepSerialize(extraData, traditional) {\n var param = $.param(extraData, traditional);\n var serialized = param ? param.split(\"&\") : [];\n var len = serialized.length;\n var result = [];\n var i, part;\n\n for (i = 0; i < len; i++) {\n // #252; undo param space replacement\n serialized[i] = serialized[i].replace(/\\+/g, \" \");\n part = serialized[i].split(\"=\");\n // #278; use array instead of object storage, favoring array serializations\n result.push([decodeURIComponent(part[0]), decodeURIComponent(part[1])]);\n }\n\n return result;\n}\n\n/**\n * Posts the fields and extraData as FormData, for files with the File API.\n * XMLHttpRequest Level 2 file uploads (big hat tip to francois2metz)\n */\nexport function sendFormData(submission) {\n var options = submission.options;\n var a = submission.fields;\n\n var formdata = new FormData();\n\n for (var i = 0; i < a.length; i++) {\n formdata.append(a[i].name, a[i].value);\n }\n\n if (options.extraData) {\n var serializedData = deepSerialize(options.extraData, submission.traditional);\n\n for (i = 0; i < serializedData.length; i++) {\n formdata.append(serializedData[i][0], serializedData[i][1]);\n }\n }\n\n options.data = null;\n\n var s = $.extend(true, {}, $.ajaxSettings, options, {\n contentType: false,\n processData: false,\n cache: false,\n type: submission.method || \"POST\",\n });\n\n keepContext(s, [$.ajaxSettings, options]);\n\n if (options.uploadProgress) {\n // workaround because jqXHR does not expose upload property: wraps the xhr factory, the\n // caller's or jQuery's\n var createXhr = s.xhr;\n\n s.xhr = function () {\n var xhr = createXhr.call(this);\n\n if (xhr.upload) {\n xhr.upload.addEventListener(\n \"progress\",\n function (event) {\n var percent = 0;\n // event.position is the deprecated name, read only when loaded is missing\n var position = event.loaded !== undefined ? event.loaded : event.position;\n var total = event.total;\n\n if (event.lengthComputable) {\n percent = Math.ceil((position / total) * 100);\n }\n\n options.uploadProgress(event, position, total, percent);\n },\n false\n );\n }\n\n return xhr;\n };\n }\n\n s.data = null;\n\n var beforeSend = s.beforeSend;\n\n s.beforeSend = function (xhr, o) {\n // Send FormData() provided by user\n if (options.formData) {\n o.data = options.formData;\n } else {\n o.data = formdata;\n }\n\n // a veto (false) cancels the upload, as on the other transports\n return beforeSend ? beforeSend.call(this, xhr, o) : undefined;\n };\n\n return $.ajax(s);\n}\n\n/**\n * Sends the encoded fields with $.ajax.\n */\nexport function sendAjax(submission) {\n return $.ajax(submission.options);\n}\n","import { callFormMethod } from \"./form-members.js\";\nimport { deepSerialize } from \"./xhr-transport.js\";\nimport jQuery from \"jquery\";\nimport { submitterFields } from \"./submitter.js\";\n\n// The iframe form post: the extra fields (submitter, CSRF, data), the form attributes set while\n// posting and restored after, and the native submit.\nvar $ = jQuery;\n\n// The form attributes an iframe upload changes while it posts.\nvar uploadAttributes = [\"action\", \"target\", \"method\", \"enctype\", \"encoding\"];\n\n// Called through the prototype: an extraData key or a form field may be named hasOwnProperty.\nvar hasOwn = Object.prototype.hasOwnProperty;\n\nfunction isGet(method) {\n return /^get$/i.test(method);\n}\n\n// Resolves both URLs through anchors, as jQuery does for crossDomain, so IE's anchor quirks\n// apply to both sides of the comparison.\nfunction isSameOrigin(url) {\n var origin = document.createElement(\"a\");\n var target = document.createElement(\"a\");\n\n origin.href = window.location.href;\n target.href = url;\n // IE fills in the host of a relative URL only once the resolved href is assigned back\n target.href = target.href; // eslint-disable-line no-self-assign\n\n return origin.protocol + \"//\" + origin.host === target.protocol + \"//\" + target.host;\n}\n\n/** Adds the clicked submitter (and an image's coordinates) to s.extraData. */\nexport function addSubmitterFields(s, form) {\n // add submitting element to data if we know it\n var fields = submitterFields(form);\n\n for (var n in fields) {\n s.extraData = s.extraData || {};\n s.extraData[n] = fields[n];\n }\n}\n\n/** Adds the page's CSRF token to s.extraData when the form is posted to the page's origin. */\nexport function addCsrfField(s, form, method, forms) {\n // Rails CSRF hack (thanks to Yvan Barthelemy); like jquery-ujs, only for the page's origin and\n // only when the form is posted, since a get form would put the token in the url\n var csrf_token = $(\"meta[name=csrf-token]\").attr(\"content\");\n var csrf_param = $(\"meta[name=csrf-param]\").attr(\"content\");\n var posts =\n !isGet(method) &&\n (!method || /post/i.test(method) || /post/i.test(forms.property(form, \"method\")));\n\n if (csrf_param && csrf_token && posts && isSameOrigin(s.url)) {\n s.extraData = s.extraData || {};\n s.extraData[csrf_param] = csrf_token;\n }\n}\n\nfunction setFormAttribute(form, name, value) {\n callFormMethod(form, \"setAttribute\", name, value);\n}\n\n/** The raw attributes the upload changes, null when absent, to put back exactly (#380). */\nexport function saveAttributes(form) {\n var saved = {};\n\n $.each(uploadAttributes, function (i, name) {\n saved[name] = callFormMethod(form, \"hasAttribute\", name)\n ? callFormMethod(form, \"getAttribute\", name)\n : null;\n });\n\n return saved;\n}\n\n/** Puts back the attributes saveAttributes recorded, removing those that were absent. */\nexport function restoreAttributes(form, saved) {\n $.each(uploadAttributes, function (i, name) {\n if (saved[name] === null) {\n callFormMethod(form, \"removeAttribute\", name);\n } else {\n setFormAttribute(form, name, saved[name]);\n }\n });\n}\n\n/** Points the form at the frame `target` with the upload's url, method and encoding. */\nexport function setUploadAttributes(form, target, method, s, forms) {\n var mp = \"multipart/form-data\";\n\n // update form attrs in IE friendly way\n setFormAttribute(form, \"target\", target);\n if (!method || /post/i.test(method)) {\n setFormAttribute(form, \"method\", \"POST\");\n } else if (isGet(method) && !isGet(forms.property(form, \"method\"))) {\n // a form posts natively only with GET or POST; other verbs keep the form's own method\n setFormAttribute(form, \"method\", \"GET\");\n }\n setFormAttribute(form, \"action\", s.url);\n\n // ie borks in some cases when setting encoding\n if (!s.skipEncodingOverride && (!method || /post/i.test(method))) {\n setFormAttribute(form, \"encoding\", mp);\n setFormAttribute(form, \"enctype\", mp);\n }\n}\n\n/** Appends a hidden input per extraData field to the form; each input is pushed onto `added`. */\nexport function addExtraInputs(form, ownerDocument, extraData, traditional, added) {\n // Builds the input with DOM properties: a name is never parsed as HTML.\n function addHiddenInput(name, value) {\n var input = ownerDocument.createElement(\"input\");\n\n input.type = \"hidden\";\n input.name = name;\n added.push($(input).val(value).appendTo(form)[0]);\n }\n\n if (extraData) {\n for (var n in extraData) {\n if (hasOwn.call(extraData, n)) {\n // if using the $.param format that allows for multiple values with the same name\n if (\n $.isPlainObject(extraData[n]) &&\n hasOwn.call(extraData[n], \"name\") &&\n hasOwn.call(extraData[n], \"value\")\n ) {\n addHiddenInput(extraData[n].name, extraData[n].value);\n } else {\n // arrays and objects become one field per value, as $.param sends them (#597)\n var single = {};\n\n single[n] = extraData[n];\n var fields = deepSerialize(single, traditional);\n\n for (var f = 0; f < fields.length; f++) {\n addHiddenInput(fields[f][0], fields[f][1]);\n }\n }\n }\n }\n }\n}\n\n/** Submits the form natively, even when a control named submit hides the method. */\nexport function submitForm(form) {\n try {\n form.submit();\n } catch (err) {\n // just in case form has element with name/id of 'submit'\n callFormMethod(form, \"submit\");\n }\n}\n","import jQuery from \"jquery\";\nimport { log } from \"./diagnostics.js\";\n\n// The iframe response reader: turns the frame's document into the mock xhr's text, XML, status\n// and dataType, then parses it as $.ajax would (dataFilter, JSON, script).\nvar $ = jQuery;\n\n/** The frame's document, or null when the browser denies access to it. */\nexport function getDoc(frame) {\n /* it looks like contentWindow or contentDocument do not\n * carry the protocol property in ie8, when running under ssl\n * frame.document is the only valid response document, since\n * the protocol is know but not on the other two objects. strange?\n * \"Same origin policy\" http://en.wikipedia.org/wiki/Same_origin_policy\n */\n\n var doc = null;\n\n // IE8 cascading access check\n try {\n if (frame.contentWindow) {\n doc = frame.contentWindow.document;\n }\n } catch (err) {\n // IE8 access denied under ssl & missing protocol\n log(\"cannot get iframe.contentWindow document: \" + err);\n }\n\n if (doc) {\n // successful getting content\n return doc;\n }\n\n try {\n // simply checking may throw in ie8 under ssl or mismatched protocol\n doc = frame.contentDocument ? frame.contentDocument : frame.document;\n } catch (err) {\n // last attempt\n log(\"cannot get iframe.contentDocument: \" + err);\n doc = frame.document;\n }\n\n return doc;\n}\n\n/** Parses the response text or XML for the given (lowercase) dataType. */\nexport function httpData(xhr, type, s) {\n // mostly lifted from jq1.4.4\n\n var ct = xhr.getResponseHeader(\"content-type\") || \"\",\n xml = (type === \"xml\" || !type) && ct.indexOf(\"xml\") >= 0,\n data = xml ? xhr.responseXML : xhr.responseText;\n\n if (xml && data.documentElement.nodeName === \"parsererror\") {\n if ($.error) {\n $.error(\"parsererror\");\n }\n }\n if (s && s.dataFilter) {\n data = s.dataFilter(data, type);\n }\n if (typeof data === \"string\") {\n if ((type === \"json\" || !type) && ct.indexOf(\"json\") >= 0) {\n data = JSON.parse(data);\n } else if (type === \"script\") {\n $.globalEval(data);\n }\n }\n\n return data;\n}\n\n// Copies the status and statusText attributes of an element onto the mock xhr.\nfunction readStatus(xhr, el) {\n // support for XHR 'status' & 'statusText' emulation :\n xhr.status = Number(el.getAttribute(\"status\")) || xhr.status;\n xhr.statusText = el.getAttribute(\"statusText\") || xhr.statusText;\n}\n\n// Fills the mock xhr from the document itself.\nfunction readDocument(doc, xhr, s, isXml) {\n var docRoot = doc.body ? doc.body : doc.documentElement;\n\n xhr.responseText = docRoot ? docRoot.innerHTML : null;\n xhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc;\n if (isXml) {\n s.dataType = \"xml\";\n }\n xhr.getResponseHeader = function (header) {\n // the dataType in lowercase, as $.ajax reads it\n var headers = { \"content-type\": s.dataType && s.dataType.toLowerCase() };\n\n return headers[header.toLowerCase()];\n };\n if (docRoot) {\n readStatus(xhr, docRoot);\n }\n}\n\n// A response embedded in a textarea, or text wrapped in pre or body, replaces responseText.\nfunction readEmbedded(doc, xhr, dt, s) {\n var scr = /(json|script|text)/.test(dt);\n\n if (!scr && !s.textarea) {\n return;\n }\n // see if user embedded response in textarea\n var ta = doc.getElementsByTagName(\"textarea\")[0];\n\n if (ta) {\n xhr.responseText = ta.value;\n readStatus(xhr, ta);\n } else if (scr) {\n // account for browsers injecting pre around json response\n var pre = doc.getElementsByTagName(\"pre\")[0];\n var b = doc.getElementsByTagName(\"body\")[0];\n\n if (pre) {\n xhr.responseText = pre.textContent ? pre.textContent : pre.innerText;\n } else if (b) {\n xhr.responseText = b.textContent ? b.textContent : b.innerText;\n }\n }\n}\n\n/**\n * Reads and parses the response document into the mock xhr. Returns {status, data, errMsg}, or\n * null when `retry()` asks to read the document again later (Opera's untraversable DOM).\n */\nexport function readResponse(doc, xhr, s, retry) {\n var status = \"success\",\n data,\n errMsg;\n\n try {\n var isXml = /^xml$/i.test(s.dataType) || doc.XMLDocument || $.isXMLDoc(doc);\n\n log(\"isXml=\" + isXml);\n\n if (!isXml && window.opera && (doc.body === null || !doc.body.innerHTML)) {\n // in some browsers (Opera) the iframe DOM is not always traversable when\n // the onload callback fires, so we loop a bit to accommodate\n if (retry()) {\n return null;\n }\n // let this fall through because server response could be an empty document\n }\n\n readDocument(doc, xhr, s, isXml);\n\n var dt = (s.dataType || \"\").toLowerCase();\n\n readEmbedded(doc, xhr, dt, s);\n\n try {\n data = httpData(xhr, dt, s);\n } catch (err) {\n status = \"parsererror\";\n xhr.error = errMsg = err || status;\n }\n } catch (err) {\n log(\"error caught: \", err);\n status = \"error\";\n xhr.error = errMsg = err;\n }\n\n return { status: status, data: data, errMsg: errMsg };\n}\n","import jQuery from \"jquery\";\nimport { log } from \"./diagnostics.js\";\n\n// The iframe upload's lifecycle: the mock xhr and the Deferred, the global ajax events, the\n// beforeSend veto, the timeout, abort and settling.\nvar $ = jQuery;\n\n/**\n * Creates the lifecycle of one upload with the merged settings `s`. `frame.stop()` stops the\n * frame's load and `frame.release()` removes or resets the frame after the upload.\n */\nexport function createLifecycle(s, frame) {\n var g,\n timeoutHandle,\n callbackProcessed,\n deferred = $.Deferred();\n\n var xhr = {\n // mock object\n aborted: 0,\n responseText: null,\n responseXML: null,\n status: 0,\n statusText: \"n/a\",\n getAllResponseHeaders: function () {},\n getResponseHeader: function () {},\n setRequestHeader: function () {},\n abort: function (status) {\n abort(status, [xhr, \"aborted\", status]);\n },\n };\n\n // #341\n deferred.abort = function (status) {\n xhr.abort(status);\n };\n\n function done() {\n return xhr.aborted || callbackProcessed;\n }\n\n // Completes an aborted upload once and rejects the Deferred with `rejection`.\n // `textStatus` replaces the default \"timeout\"/\"aborted\" text status.\n function abort(status, rejection, textStatus) {\n var e = textStatus || (status === \"timeout\" ? \"timeout\" : \"aborted\");\n\n if (done()) {\n return;\n }\n\n log(\"aborting upload... \" + e);\n xhr.aborted = 1;\n frame.stop();\n xhr.error = e;\n if (s.error) {\n s.error.call(s.context, xhr, e, status);\n }\n deferred.reject.apply(deferred, rejection);\n\n if (g) {\n $.event.trigger(\"ajaxError\", [xhr, s, e]);\n }\n\n complete(e);\n }\n\n // The global events that end every upload, cancelled ones included.\n function endGlobalEvents() {\n if (g) {\n $.event.trigger(\"ajaxComplete\", [xhr, s]);\n }\n\n if (g && !--$.active) {\n $.event.trigger(\"ajaxStop\");\n }\n }\n\n // The steps every finished or aborted upload ends with, in $.ajax order.\n function complete(status) {\n if (s.complete) {\n s.complete.call(s.context, xhr, status);\n }\n\n endGlobalEvents();\n clearTimeout(timeoutHandle);\n\n // clean up\n setTimeout(function () {\n frame.release();\n xhr.responseXML = null;\n }, 100);\n }\n\n // A beforeSend veto ends the upload as $.ajax cancels a request: no callbacks, the global\n // events end with ajaxError \"canceled\".\n function cancel() {\n if (done()) {\n return;\n }\n\n callbackProcessed = true;\n deferred.reject();\n if (g) {\n $.event.trigger(\"ajaxError\", [xhr, s, \"canceled\"]);\n }\n endGlobalEvents();\n }\n\n // Fires the start events and beforeSend; false when the upload must not be posted.\n function start() {\n g = s.global;\n // trigger ajax global events so that activity/block indicators work like normal\n if (g && $.active++ === 0) {\n $.event.trigger(\"ajaxStart\");\n }\n\n if (s.beforeSend && s.beforeSend.call(s.context, xhr, s) === false) {\n cancel();\n\n return false;\n }\n\n if (xhr.aborted) {\n // abort() in beforeSend already completed the upload\n return false;\n }\n\n if (g) {\n $.event.trigger(\"ajaxSend\", [xhr, s]);\n }\n\n // an ajaxSend handler may abort too\n return !xhr.aborted;\n }\n\n // Resolves the upload; returns {error} when the success callback threw.\n function succeed(data) {\n var failure;\n\n try {\n s.success.call(s.context, data, \"success\", xhr);\n } catch (err) {\n failure = { error: err };\n }\n\n deferred.resolve(xhr.responseText, \"success\", xhr);\n\n if (g) {\n $.event.trigger(\"ajaxSuccess\", [xhr, s, data]);\n }\n\n return failure;\n }\n\n // Settles the upload with the response reader's {status, data, errMsg}.\n function settle(result) {\n var status = result.status,\n errMsg = result.errMsg;\n\n if (xhr.aborted) {\n // abort() completed the upload while its response was processed\n log(\"upload aborted\");\n\n return;\n }\n\n // an emulated HTTP error status wins, as in $.ajax; a parse error is kept otherwise\n if (xhr.status && !((xhr.status >= 200 && xhr.status < 300) || xhr.status === 304)) {\n status = \"error\";\n }\n\n callbackProcessed = true;\n\n // ordering of these callbacks/triggers is odd, but that's how $.ajax does it\n if (status === \"success\") {\n var failure = succeed(result.data);\n\n complete(status);\n if (failure) {\n // the upload is settled; the success callback's exception still reaches the console\n throw failure.error;\n }\n\n return;\n }\n\n if (typeof errMsg === \"undefined\") {\n errMsg = xhr.statusText;\n }\n if (s.error) {\n s.error.call(s.context, xhr, status, errMsg);\n }\n deferred.reject(xhr, \"error\", errMsg);\n if (g) {\n $.event.trigger(\"ajaxError\", [xhr, s, errMsg]);\n }\n\n complete(status);\n }\n\n return {\n xhr: xhr,\n deferred: deferred,\n start: start,\n done: done,\n abort: abort,\n settle: settle,\n // Settles an upload that failed with an exception (ignored once aborted).\n fail: function (err) {\n settle({ status: \"error\", errMsg: err });\n },\n // Runs `onTimeout` after s.timeout, when set.\n startTimer: function (onTimeout) {\n if (s.timeout) {\n timeoutHandle = setTimeout(onTimeout, s.timeout);\n }\n },\n stopTimer: function () {\n clearTimeout(timeoutHandle);\n timeoutHandle = undefined;\n },\n };\n}\n","import {\n addCsrfField,\n addExtraInputs,\n addSubmitterFields,\n restoreAttributes,\n saveAttributes,\n setUploadAttributes,\n submitForm,\n} from \"./iframe-post.js\";\nimport { closestByTag, formMember } from \"./form-members.js\";\nimport { deprecate, log } from \"./diagnostics.js\";\nimport { getDoc, readResponse } from \"./iframe-response.js\";\nimport { createLifecycle } from \"./iframe-lifecycle.js\";\nimport jQuery from \"jquery\";\nimport { keepContext } from \"./options.js\";\n\n// The iframe transport: posts the form itself into a hidden frame and reads the response from it,\n// for file uploads without the File API or when the iframe option asks for it.\nvar $ = jQuery;\n\n/**\n * The iframe send step. `hasProp` is what the entry detected at load; `forms.property` reads a\n * form property as attr2 does.\n */\nexport function createIframeTransport(hasProp, forms) {\n var CLIENT_TIMEOUT_ABORT = 1;\n var SERVER_ABORT = 2;\n // tells apart the frames of uploads that start in the same millisecond\n var frameCount = 0;\n\n // ensure that every serialized input is still enabled\n function enableControls(elements) {\n for (var i = 0; i < elements.length; i++) {\n var el = $(elements[i]);\n\n if (hasProp) {\n el.prop(\"disabled\", false);\n } else {\n el.removeAttr(\"disabled\");\n }\n }\n }\n\n // Names the frame's window, when the page may: a cross-origin or sandboxed frame refuses.\n function nameWindow(frame, name) {\n try {\n if (frame.contentWindow) {\n frame.contentWindow.name = name;\n }\n } catch (ignore) {}\n }\n\n // The frame the form posts into: the iframeTarget, named `id` when it has no name, or a new\n // hidden frame named `id`. Returns the frame and the name the form targets.\n function createFrame(s, id, ownerDocument) {\n var $io, n;\n\n if (s.iframeTarget) {\n $io = $(s.iframeTarget, ownerDocument);\n n = $io.attr(\"name\");\n if (!n) {\n $io.attr(\"name\", id);\n // a frame already in the page keeps the browsing context name it was inserted with\n $io.each(function () {\n nameWindow(this, id);\n });\n } else {\n id = n;\n }\n } else {\n var io = ownerDocument.createElement(\"iframe\");\n\n io.setAttribute(\"name\", id);\n io.setAttribute(\"src\", s.iframeSrc);\n $io = $(io);\n $io.css({ position: \"absolute\", top: \"-1000px\", left: \"-1000px\" });\n }\n\n return { $io: $io, id: id };\n }\n\n // The frame hooks the lifecycle calls: stop a load in progress, and release after the upload.\n function frameHooks(s, $io) {\n return {\n stop: function () {\n try {\n // #214, #257\n if ($io[0].contentWindow.document.execCommand) {\n $io[0].contentWindow.document.execCommand(\"Stop\");\n }\n } catch (ignore) {}\n\n $io.attr(\"src\", s.iframeSrc); // abort op in progress\n },\n release: function () {\n if (!s.iframeTarget) {\n $io.remove();\n } else {\n // adding else to clean up existing iframe response.\n $io.attr(\"src\", s.iframeSrc);\n }\n },\n };\n }\n\n function listen(io, cb) {\n if (io.attachEvent) {\n io.attachEvent(\"onload\", cb);\n } else {\n io.addEventListener(\"load\", cb, false);\n }\n }\n\n function unlisten(io, cb) {\n if (io.detachEvent) {\n io.detachEvent(\"onload\", cb);\n } else {\n io.removeEventListener(\"load\", cb, false);\n }\n }\n\n // private function for handling file uploads (hat tip to YAHOO!)\n function fileUploadIframe(submission) {\n var form = submission.form,\n method = submission.method;\n\n var s = keepContext($.extend(true, {}, $.ajaxSettings, submission.options), [\n $.ajaxSettings,\n submission.options,\n ]);\n\n s.context = s.context || s;\n var ownerDocument = formMember(form, \"ownerDocument\");\n var $body = $(closestByTag(form, [\"body\"]));\n var frame = createFrame(s, \"jqFormIO\" + new Date().getTime() + frameCount++, ownerDocument);\n var $io = frame.$io,\n io = $io[0];\n var life = createLifecycle(s, frameHooks(s, $io));\n var domCheckCount = 50;\n\n if (!life.start()) {\n return life.deferred;\n }\n\n addSubmitterFields(s, form);\n addCsrfField(s, form, method, forms);\n\n // look for server aborts\n function checkState() {\n try {\n var state = getDoc(io).readyState;\n\n log(\"state = \" + state);\n if (state && state.toLowerCase() === \"uninitialized\") {\n setTimeout(checkState, 50);\n }\n } catch (e) {\n log(\"Server abort: \", e, \" (\", e.name, \")\");\n cb(SERVER_ABORT);\n life.stopTimer();\n }\n }\n\n // take a breath so that pending repaints get some cpu time before the upload starts\n function doSubmit() {\n var saved = saveAttributes(form);\n\n setUploadAttributes(form, frame.id, method, s, forms);\n\n // support timout\n life.startTimer(function () {\n cb(CLIENT_TIMEOUT_ABORT);\n });\n\n // add \"extra\" data to form if provided in options\n var extraInputs = [];\n\n try {\n addExtraInputs(form, ownerDocument, s.extraData, submission.traditional, extraInputs);\n\n if (!s.iframeTarget) {\n // add iframe to doc and submit the form\n $io.appendTo($body);\n }\n\n // A connected form posting into a frame outside the document opens a new window.\n var root = ownerDocument.documentElement;\n\n if (io && $.contains(root, form) && !$.contains(root, io)) {\n var notInDocument = \"jquery.form: the upload frame is not in the document\";\n\n life.abort(notInDocument, [life.xhr, \"error\", notInDocument], \"error\");\n\n return;\n }\n\n listen(io, cb);\n setTimeout(checkState, 15);\n submitForm(form);\n } finally {\n // reset attrs and remove \"extra\" input elements\n restoreAttributes(form, saved);\n $(extraInputs).remove();\n }\n }\n\n // Reads the next document by Opera's rules: false once the retries are used up.\n function retry() {\n if (--domCheckCount) {\n log(\"requeing onLoad callback, DOM not available\");\n setTimeout(cb, 250);\n\n return true;\n }\n\n return false;\n }\n\n function cb(e) {\n if (life.done()) {\n return;\n }\n\n var doc = getDoc(io);\n\n if (!doc) {\n log(\"cannot access response document\");\n e = SERVER_ABORT;\n }\n if (e === CLIENT_TIMEOUT_ABORT) {\n life.abort(\"timeout\", [life.xhr, \"timeout\"]);\n\n return;\n }\n if (e === SERVER_ABORT) {\n life.abort(\"server abort\", [life.xhr, \"error\", \"server abort\"]);\n\n return;\n }\n\n if (doc.location.href === s.iframeSrc) {\n // response not received yet\n return;\n }\n\n unlisten(io, cb);\n\n var result = readResponse(doc, life.xhr, s, retry);\n\n if (result) {\n life.settle(result);\n }\n }\n\n // An exception while posting settles the upload with \"error\" and the exception.\n function post() {\n if (life.done()) {\n // aborted before the delayed post\n return;\n }\n\n try {\n doSubmit();\n } catch (err) {\n log(\"upload failed: \", err);\n life.fail(err);\n }\n }\n\n if (s.forceSync) {\n post();\n } else {\n setTimeout(post, 10); // this lets dom updates render\n }\n\n return life.deferred;\n }\n\n return function sendIframe(submission) {\n var jqxhr;\n\n // now, while the controls are still listed: ajaxSubmit clears the list when it returns,\n // before a closeKeepAlive request completes\n enableControls(submission.controls);\n\n // hack to fix Safari hang (thanks to Tim Molendijk for this)\n // see: http://groups.google.com/group/jquery-dev/browse_thread/thread/36395b7ab510dd5d\n if (submission.options.closeKeepAlive) {\n deprecate(\"closeKeepAlive\", \"closeKeepAlive works around a Safari 3/4 bug and is deprecated\");\n $.get(submission.options.closeKeepAlive, function () {\n jqxhr = fileUploadIframe(submission);\n });\n } else {\n jqxhr = fileUploadIframe(submission);\n }\n\n return jqxhr;\n };\n}\n","import { deprecate, log } from \"./diagnostics.js\";\nimport { assertRealParent } from \"./form-members.js\";\nimport jQuery from \"jquery\";\nimport { keepContext } from \"./options.js\";\nimport { urlencodedFields } from \"./successful-controls.js\";\n\n// A Submission is one ajaxSubmit call once its vetoes have passed:\n// { form, $form, fields, controls, options, method, traditional }. `options` is the object the\n// callbacks and events receive; later steps change it in place.\n\n/**\n * The submission steps. `feature` holds what the entry detected at load (fileapi, formdata), and\n * `forms` reads form attributes and attr2-style properties (attribute, property), and\n * `serialization` collects the form's fields and controls.\n */\nexport function createSubmission(feature, forms, serialization) {\n var $ = jQuery;\n\n function refuse(message) {\n log(message);\n\n return null;\n }\n\n // The options merged over the form's action, the method, and the ajax defaults.\n function withDefaults(form, options, method) {\n var action = options.url || forms.property(form, \"action\");\n var url = typeof action === \"string\" ? action.trim() : \"\";\n\n // clean url (don't include hash value); an action that is only a fragment means this page\n url = url.split(\"#\")[0] || window.location.href.split(\"#\")[0];\n // IE requires javascript:false in https, but this breaks chrome >83 and goes against spec.\n // Instead of using javascript:false always, let's only apply it for IE.\n var isMsie = /(MSIE|Trident)/.test(navigator.userAgent || \"\");\n var iframeSrc = isMsie && /^https/i.test(document.URL) ? \"javascript:false\" : \"about:blank\"; // eslint-disable-line no-script-url\n\n var merged = $.extend(\n true,\n {\n url: url,\n success: $.ajaxSettings.success,\n type: method || $.ajaxSettings.type,\n iframeSrc: iframeSrc,\n },\n options\n );\n\n return keepContext(merged, [options]);\n }\n\n /**\n * The one method every transport sends, read after the hooks: `method` wins over `type`, and\n * `type` is set to it. Undefined when only the ajax default applies, so each transport keeps\n * its own default.\n */\n function resolveMethod(options, defaultType) {\n var resolved = options.method || options.type;\n\n options.type = resolved;\n\n return resolved === defaultType && !options.method ? undefined : resolved;\n }\n\n // The data option, kept as extraData and encoded, or undefined without one.\n function extraQuery(fields, options, traditional) {\n if (!options.data) {\n return undefined;\n }\n\n var optionsData = typeof options.data === \"function\" ? options.data(fields) : options.data;\n\n if (typeof optionsData === \"string\") {\n if (options.requestFormat === \"json\") {\n throw new Error(\n 'jquery.form: requestFormat \"json\" needs object data; a string data option is a query string'\n );\n }\n\n // a query string: sent as-is when urlencoded, as its own fields otherwise\n options.extraData = queryPairs(optionsData);\n\n return optionsData;\n }\n\n options.extraData = optionsData;\n\n return $.param(optionsData, traditional);\n }\n\n // Sets a key as an own data property, so a name like __proto__ is an ordinary key.\n function defineKey(object, key, value) {\n Object.defineProperty(object, key, {\n value: value,\n enumerable: true,\n writable: true,\n configurable: true,\n });\n }\n\n /**\n * requestFormat \"json\" (#545): the fields as an object (a repeated name gives an array), merged\n * with object data, sent as a JSON body. Based on the idea in PR #557 by zhangciwu.\n */\n function jsonBody(options, fields) {\n if (/^get$/i.test(options.type)) {\n throw new Error('jquery.form: requestFormat \"json\" needs a method with a body, such as POST');\n }\n\n var body = {};\n var own = Object.prototype.hasOwnProperty;\n\n for (var i = 0; i < fields.length; i++) {\n var name = fields[i].name;\n\n if (!own.call(body, name)) {\n defineKey(body, name, fields[i].value);\n } else if (Array.isArray(body[name])) {\n body[name].push(fields[i].value);\n } else {\n defineKey(body, name, [body[name], fields[i].value]);\n }\n }\n\n var extra = options.extraData;\n\n for (var key in extra) {\n if (own.call(extra, key)) {\n defineKey(body, key, extra[key]);\n }\n }\n\n options.data = JSON.stringify(body);\n options.contentType = \"application/json; charset=UTF-8\";\n }\n\n // The fields of a query string, as the { name, value } list $.param takes.\n function queryPairs(query) {\n var pairs = [];\n var parts = query.split(\"&\");\n\n for (var i = 0; i < parts.length; i++) {\n if (parts[i]) {\n var at = parts[i].indexOf(\"=\");\n var name = at < 0 ? parts[i] : parts[i].slice(0, at);\n var value = at < 0 ? \"\" : parts[i].slice(at + 1);\n\n pairs.push({ name: decodeQuery(name), value: decodeQuery(value) });\n }\n }\n\n return pairs;\n }\n\n function decodeQuery(text) {\n return decodeURIComponent(text.replace(/\\+/g, \" \"));\n }\n\n // Puts the encoded fields in the url for a get, and in the data otherwise.\n function encode(options, q, qx) {\n if (qx) {\n q = q ? q + \"&\" + qx : qx;\n }\n\n if (options.type.toUpperCase() === \"GET\") {\n // the query goes before any fragment in the url option\n var hashAt = options.url.indexOf(\"#\");\n var base = hashAt < 0 ? options.url : options.url.slice(0, hashAt);\n\n options.url =\n base + (base.indexOf(\"?\") >= 0 ? \"&\" : \"?\") + q + options.url.slice(base.length);\n options.data = null; // data is null for 'get'\n } else {\n options.data = q; // data is the query string for 'post'\n }\n }\n\n // A callback option as a list: an array as given, one function, or none.\n function callbackList(callback) {\n if (Array.isArray(callback)) {\n return callback;\n }\n\n return callback ? [callback] : [];\n }\n\n // Calls each callback in order with the same this and arguments.\n function callEach(callbacks, context, args) {\n for (var i = 0; i < callbacks.length; i++) {\n callbacks[i].apply(context, args);\n }\n }\n\n /**\n * Resolves the options, serializes the form, and runs the vetoes: the Submission, or null when\n * an event or callback stopped it.\n */\n function prepare($set, options) {\n $set.each(function () {\n assertRealParent(this);\n });\n\n var form = $set[0];\n var method = options.method || options.type || forms.property(form, \"method\");\n\n options = withDefaults(form, options, method);\n\n // the ajax default type, when neither the caller nor the form gave a method\n var defaultType = method ? undefined : options.type;\n\n // hook for manipulating the form data before it is extracted;\n // convenient for use with rich editors like tinyMCE or FCKEditor\n var veto = {};\n\n $set.trigger(\"form-pre-serialize\", [$set, options, veto]);\n if (veto.veto) {\n return refuse(\"ajaxSubmit: submit vetoed via form-pre-serialize trigger\");\n }\n\n // provide opportunity to alter form data before it is serialized\n if (options.beforeSerialize && options.beforeSerialize($set, options) === false) {\n return refuse(\"ajaxSubmit: submit aborted via beforeSerialize callback\");\n }\n\n var traditional = options.traditional;\n\n if (typeof traditional === \"undefined\") {\n traditional = $.ajaxSettings.traditional;\n }\n\n var collected = serialization.collect($set[0], options.semantic, options.filtering);\n var fields = collected.fields;\n var controls = collected.controls;\n var qx = extraQuery(fields, options, traditional);\n\n // give pre-submit callback an opportunity to abort the submit\n if (options.beforeSubmit && options.beforeSubmit(fields, $set, options) === false) {\n return refuse(\"ajaxSubmit: submit aborted via beforeSubmit callback\");\n }\n\n // fire vetoable 'validate' event\n $set.trigger(\"form-submit-validate\", [fields, $set, options, veto]);\n if (veto.veto) {\n return refuse(\"ajaxSubmit: submit vetoed via form-submit-validate trigger\");\n }\n\n method = resolveMethod(options, defaultType);\n\n if (options.requestFormat === \"json\") {\n jsonBody(options, fields);\n } else {\n encode(options, $.param(urlencodedFields(fields), traditional), qx);\n }\n\n return {\n form: form,\n $form: $set,\n fields: fields,\n controls: controls,\n options: options,\n method: method,\n traditional: traditional,\n };\n }\n\n /**\n * Wraps success, error and complete (a function or an array of them, as $.ajax takes) so each\n * also receives the form, and adds the resetForm,\n * clearForm and target steps before the success callbacks.\n */\n function deliver(submission) {\n var $set = submission.$form;\n var options = submission.options;\n var callbacks = [];\n\n if (options.resetForm) {\n callbacks.push(function () {\n $set.resetForm();\n });\n }\n\n if (options.clearForm) {\n callbacks.push(function () {\n $set.clearForm(options.includeHidden);\n });\n }\n\n // perform a load on the target only if dataType is not provided\n if (!options.dataType && options.target) {\n var successes = callbackList(options.success);\n\n callbacks.push(function (data, textStatus, jqXHR) {\n var successArguments = arguments,\n fn = options.replaceTarget ? \"replaceWith\" : \"html\",\n $target = $(options.target);\n\n // Only a string response is inserted. jQuery has already parsed a JSON or XML response,\n // and inserting it would parse each of its strings as HTML.\n if (typeof data === \"string\") {\n $target[fn](data);\n } else {\n log(\"target: the response was parsed by jQuery, so it is not inserted\");\n }\n\n if (!$target.length) {\n // nothing to fill: success still runs once, with the normal context\n callEach(successes, this, successArguments);\n }\n\n $target.each(function () {\n callEach(successes, this, successArguments);\n });\n });\n } else {\n $.merge(callbacks, callbackList(options.success));\n }\n\n options.success = function (data, status, xhr) {\n // jQuery 1.4+ passes xhr as 3rd arg\n var context = options.context || this; // jQuery 1.4+ supports scope context\n\n for (var i = 0, max = callbacks.length; i < max; i++) {\n callbacks[i].apply(context, [data, status, xhr || $set, $set]);\n }\n };\n\n if (options.error) {\n var errors = callbackList(options.error);\n\n options.error = function (xhr, status, error) {\n callEach(errors, options.context || this, [xhr, status, error, $set]);\n };\n }\n\n if (options.complete) {\n var completes = callbackList(options.complete);\n\n options.complete = function (xhr, status) {\n callEach(completes, options.context || this, [xhr, status, $set]);\n };\n }\n }\n\n /**\n * The transport for a submission: \"iframe\" for files without the File API or when forced,\n * \"formdata\" for files with it, \"ajax\" otherwise.\n */\n function chooseTransport(submission) {\n var $set = submission.$form;\n var options = submission.options;\n\n // [value] (issue #113), also see comment:\n // https://github.com/malsup/form/commit/588306aedba1de01388032d5f42a60159eea9228#commitcomment-2180219\n // and the file inputs outside the form that belong to it through their form attribute\n var fileInputs = $(\"input[type=file]:enabled\", $set)\n .add($(submission.controls).filter(\"input[type=file]\"))\n .filter(function () {\n return $(this).val() !== \"\";\n });\n var hasFileInputs = fileInputs.length > 0;\n // compared as the browser does: ASCII case-insensitive, without surrounding whitespace\n var mp = /^[\\t\\n\\f\\r ]*multipart\\/form-data[\\t\\n\\f\\r ]*$/i;\n var multipart =\n mp.test(forms.attribute($set[0], \"enctype\")) || mp.test(forms.attribute($set[0], \"encoding\"));\n var fileAPI = feature.fileapi && feature.formdata;\n\n log(\"fileAPI :\" + fileAPI);\n\n var shouldUseFrame = (hasFileInputs || multipart) && !fileAPI;\n\n var transport = (hasFileInputs || multipart) && fileAPI ? \"formdata\" : \"ajax\";\n\n // options.iframe allows user to force iframe mode\n // 06-NOV-09: now defaulting to iframe mode if file input is detected\n if (options.iframe !== false && (options.iframe || shouldUseFrame)) {\n transport = \"iframe\";\n }\n\n if (transport === \"iframe\" && !options.iframe) {\n deprecate(\n \"iframe\",\n \"choosing the iframe transport automatically without FormData is deprecated, set iframe: true\"\n );\n }\n\n if (transport !== \"ajax\" && options.requestFormat === \"json\") {\n throw new Error(\n 'jquery.form: requestFormat \"json\" cannot send files or use the iframe transport'\n );\n }\n\n return transport;\n }\n\n return { prepare: prepare, deliver: deliver, chooseTransport: chooseTransport };\n}\n","/*!\n * jQuery Form Plugin\n * version: 4.5.0\n * Requires jQuery v1.7.2 or later\n * Project repository: https://github.com/jquery-form/form\n\n * Copyright 2017 Kevin Morris\n * Copyright 2006 M. Alsup\n\n * Dual licensed under the LGPL-2.1+ or MIT licenses\n * https://github.com/jquery-form/form#license\n\n * This library is free software; you can redistribute it and/or\n * modify it under the terms of the GNU Lesser General Public\n * License as published by the Free Software Foundation; either\n * version 2.1 of the License, or (at your option) any later version.\n * This library is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n */\nimport { ajaxForm, ajaxFormUnbind } from \"./ajax-form.js\";\nimport { callFormMethod, tagName } from \"./form-members.js\";\nimport {\n createSuccessfulControls,\n isSuccessful,\n urlencodedFields,\n valueOf,\n} from \"./successful-controls.js\";\nimport { deprecate, deprecateOldJQuery, log } from \"./diagnostics.js\";\nimport { sendAjax, sendFormData } from \"./xhr-transport.js\";\nimport { createIframeTransport } from \"./iframe-transport.js\";\nimport { createSubmission } from \"./submission.js\";\nimport { formAttribute } from \"./form-attributes.js\";\nimport jQuery from \"jquery\";\nimport { submitOptions } from \"./options.js\";\nimport { submitterElement } from \"./submitter.js\";\n\n(function ($) {\n \"use strict\";\n\n /*\n\t\tUsage Note:\n\t\t-----------\n\t\tDo not use both ajaxSubmit and ajaxForm on the same form. These\n\t\tfunctions are mutually exclusive. Use ajaxSubmit if you want\n\t\tto bind your own submit handler to the form. For example,\n\n\t\t$(document).ready(function() {\n\t\t\t$('#myForm').on('submit', function(e) {\n\t\t\t\te.preventDefault(); // <-- important\n\t\t\t\t$(this).ajaxSubmit({\n\t\t\t\t\ttarget: '#output'\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\n\t\tUse ajaxForm when you want the plugin to manage all the event binding\n\t\tfor you. For example,\n\n\t\t$(document).ready(function() {\n\t\t\t$('#myForm').ajaxForm({\n\t\t\t\ttarget: '#output'\n\t\t\t});\n\t\t});\n\n\t\tYou can also use ajaxForm with delegation (requires jQuery v1.7+), so the\n\t\tform does not have to exist when you invoke ajaxForm:\n\n\t\t$('#myForm').ajaxForm({\n\t\t\tdelegation: true,\n\t\t\ttarget: '#output'\n\t\t});\n\n\t\tWhen using ajaxForm, the ajaxSubmit function will be invoked for you\n\t\tat the appropriate time.\n\t*/\n\n /**\n * Feature detection\n */\n var feature = {};\n\n feature.fileapi = $('').get(0).files !== undefined;\n feature.formdata = typeof window.FormData !== \"undefined\";\n\n var hasProp = !!$.fn.prop;\n // What attr2 returns for a form: the property when it is a string, otherwise the attribute. The\n // property is read plainly on purpose: a control named like it shadows it, and then the raw\n // attribute is used.\n function formProperty(form, name) {\n var value = hasProp ? form[name] : undefined;\n\n return typeof value === \"string\" ? value : formAttribute(form, name);\n }\n\n var forms = { attribute: formAttribute, property: formProperty };\n var serialization = createSuccessfulControls(feature);\n var steps = createSubmission(feature, forms, serialization);\n var transports = {\n iframe: createIframeTransport(hasProp, forms),\n formdata: sendFormData,\n ajax: sendAjax,\n };\n\n // attr2 uses prop when it can but checks the return type for\n // an expected string. This accounts for the case where a form\n // contains inputs with names like \"action\" or \"method\"; in those\n // cases \"prop\" returns the element\n $.fn.attr2 = function () {\n deprecate(\"attr2\", \"attr2 is deprecated, use .prop() or .attr()\");\n\n if (!hasProp) {\n return this.attr.apply(this, arguments);\n }\n\n var val = this.prop.apply(this, arguments);\n\n if ((val && val.jquery) || typeof val === \"string\") {\n return val;\n }\n\n return this.attr.apply(this, arguments);\n };\n\n /**\n * ajaxSubmit() provides a mechanism for immediately submitting\n * an HTML form using AJAX.\n *\n * @param\t{object|string}\toptions\t\tjquery.form.js parameters or custom url for submission\n * @param\t{object}\t\tdata\t\textraData\n * @param\t{string}\t\tdataType\tajax dataType\n * @param\t{function}\t\tonSuccess\tajax success callback function\n */\n $.fn.ajaxSubmit = function (options, data, dataType, onSuccess) {\n deprecateOldJQuery($.fn.jquery);\n\n // fast fail if nothing selected (http://dev.jquery.com/ticket/2752)\n if (!this.length) {\n log(\"ajaxSubmit: skipping submit process - no element selected\");\n\n return this;\n }\n\n // #541: jQuery's slim build has no $.ajax\n if (!$.ajax) {\n throw new Error(\n \"jquery.form: ajaxSubmit needs the full jQuery build; this jQuery has no $.ajax\"\n );\n }\n\n var submission = steps.prepare(this, submitOptions(options, data, dataType, onSuccess));\n\n if (!submission) {\n return this;\n }\n\n steps.deliver(submission);\n\n var jqxhr = transports[steps.chooseTransport(submission)](submission);\n\n this.removeData(\"jqxhr\").data(\"jqxhr\", jqxhr);\n\n // clear element array\n for (var k = 0; k < submission.controls.length; k++) {\n submission.controls[k] = null;\n }\n\n // fire 'notify' event\n this.trigger(\"form-submit-notify\", [this, submission.options]);\n\n return this;\n };\n\n $.fn.ajaxForm = ajaxForm;\n $.fn.ajaxFormUnbind = ajaxFormUnbind;\n\n /**\n * formToArray() gathers form element data into an array of objects that can\n * be passed to any of the following ajax functions: $.get, $.post, or load.\n * Each object in the array has both a 'name' and 'value' property. An example of\n * an array for a simple login form might be:\n *\n * [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ]\n *\n * It is this array that is passed to pre-submit callback functions provided to the\n * ajaxSubmit() and ajaxForm() methods.\n */\n $.fn.formToArray = function (semantic, elements, filtering) {\n var collected = serialization.collect(this[0], semantic, filtering);\n\n if (elements) {\n elements.push.apply(elements, collected.controls);\n }\n\n return collected.fields;\n };\n\n /**\n * Serializes form data into a 'submittable' string. This method will return a string\n * in the format: name1=value1&name2=value2\n */\n $.fn.formSerialize = function (semantic) {\n // hand off to jQuery.param for proper encoding\n return $.param(urlencodedFields(this.formToArray(semantic)));\n };\n\n /**\n * Serializes all field elements in the jQuery object into a query string.\n * This method will return a string in the format: name1=value1&name2=value2\n */\n $.fn.fieldSerialize = function (successful) {\n var a = [];\n\n this.each(function () {\n var n = this.name;\n\n // a form is not a field, though it may have a name\n if (!n || tagName(this) === \"form\") {\n return;\n }\n\n var v = $.fieldValue(this, successful);\n\n if (v && v.constructor === Array) {\n for (var i = 0, max = v.length; i < max; i++) {\n a.push({ name: n, value: v[i] });\n }\n } else if (v !== null && typeof v !== \"undefined\") {\n a.push({ name: this.name, value: v });\n }\n });\n\n // hand off to jQuery.param for proper encoding\n return $.param(urlencodedFields(a));\n };\n\n /**\n * Returns the value(s) of the element in the matched set. For example, consider the following form:\n *\n *\t
\n *\t\t\n *\t\t\n *\t\t\n *\t\t\n *\t\t\n *\t\t\n *\t
\n *\n *\tvar v = $('input[type=text]').fieldValue();\n *\t// if no values are entered into the text inputs\n *\tv === ['','']\n *\t// if values entered into the text inputs are 'foo' and 'bar'\n *\tv === ['foo','bar']\n *\n *\tvar v = $('input[type=checkbox]').fieldValue();\n *\t// if neither checkbox is checked\n *\tv === undefined\n *\t// if both checkboxes are checked\n *\tv === ['B1', 'B2']\n *\n *\tvar v = $('input[type=radio]').fieldValue();\n *\t// if neither radio is checked\n *\tv === undefined\n *\t// if first radio is checked\n *\tv === ['C1']\n *\n * The successful argument controls whether or not the field element must be 'successful'\n * (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls).\n * The default value of the successful argument is true. If this value is false the value(s)\n * for each element is returned.\n *\n * Note: This method *always* returns an array. If no valid value can be determined the\n *\tarray will be empty, otherwise it will contain one or more values.\n */\n $.fn.fieldValue = function (successful) {\n for (var val = [], i = 0, max = this.length; i < max; i++) {\n var el = this[i];\n var v = $.fieldValue(el, successful);\n\n if (v === null || typeof v === \"undefined\" || (v.constructor === Array && !v.length)) {\n continue;\n }\n\n if (v.constructor === Array) {\n $.merge(val, v);\n } else {\n val.push(v);\n }\n }\n\n return val;\n };\n\n /**\n * Returns the value of the field element.\n */\n $.fieldValue = function (el, successful) {\n var required = typeof successful === \"undefined\" || successful;\n\n if (required && !isSuccessful(el, submitterElement(el.form))) {\n return null;\n }\n\n return valueOf(el);\n };\n\n /**\n * Clears the form data. Takes the following actions on the form's input fields:\n * - input text fields will have their 'value' property set to the empty string\n * - select elements will have their 'selectedIndex' property set to -1\n * - checkbox and radio inputs will have their 'checked' property set to false\n * - inputs of type submit, button, reset, and hidden will *not* be effected\n * - button elements will *not* be effected\n */\n $.fn.clearForm = function (includeHidden) {\n return this.each(function () {\n $(\"input,select,textarea\", this).clearFields(includeHidden);\n });\n };\n\n /**\n * Clears the selected form elements.\n */\n $.fn.clearInputs = function (includeHidden) {\n deprecate(\"clearInputs\", \"clearInputs is deprecated, use clearFields\");\n\n return this.clearFields(includeHidden);\n };\n\n $.fn.clearFields = function (includeHidden) {\n var re =\n /^(?:color|date|datetime|datetime-local|email|month|number|password|range|search|tel|text|time|url|week)$/i; // 'hidden' is not in this list\n\n return this.each(function () {\n var t = this.type,\n tag = tagName(this);\n\n if (re.test(t) || tag === \"textarea\") {\n this.value = \"\";\n } else if (t === \"checkbox\" || t === \"radio\") {\n this.checked = false;\n } else if (tag === \"select\") {\n this.selectedIndex = -1;\n } else if (t === \"file\") {\n if (/MSIE/.test(navigator.userAgent)) {\n $(this).replaceWith($(this).clone(true));\n } else {\n $(this).val(\"\");\n }\n } else if (includeHidden) {\n // includeHidden can be the value true, or it can be a selector string\n // indicating a special test; for example:\n // $('#myForm').clearForm('.special:hidden')\n // the above would clean hidden inputs that have the class of 'special'\n if (\n (includeHidden === true && /hidden/.test(t)) ||\n (typeof includeHidden === \"string\" && $(this).is(includeHidden))\n ) {\n this.value = \"\";\n }\n }\n });\n };\n\n /**\n * Resets the form data or individual elements. Takes the following actions\n * on the selected tags:\n * - all fields within form elements will be reset to their original value\n * - input / textarea / select fields will be reset to their original value\n * - option / optgroup fields (for multi-selects) will defaulted individually\n * - non-multiple options will find the right select to default\n * - label elements will be searched against its 'for' attribute\n * - all others will be searched for appropriate children to default\n */\n $.fn.resetForm = function () {\n return this.each(function () {\n var el = $(this);\n var tag = tagName(this);\n\n switch (tag) {\n case \"input\":\n this.checked = this.defaultChecked;\n\n // as the native reset: types whose value is the value attribute keep it\n if (this.type === \"file\") {\n // a file input cannot take its value attribute; the native reset empties it\n this.value = \"\";\n } else if (!/^(?:checkbox|radio|hidden|submit|reset|button|image)$/.test(this.type)) {\n this.value = this.defaultValue;\n }\n\n return true;\n\n case \"textarea\":\n this.value = this.defaultValue;\n\n return true;\n\n case \"option\":\n case \"optgroup\":\n var select = el.parents(\"select\");\n\n if (select.length && select[0].multiple) {\n if (tag === \"option\") {\n this.selected = this.defaultSelected;\n } else {\n el.find(\"option\").resetForm();\n }\n } else {\n select.resetForm();\n }\n\n return true;\n\n case \"select\":\n // in order, as the native reset: of several default options, a single select keeps the last\n el.find(\"option\").each(function () {\n this.selected = this.defaultSelected;\n });\n\n return true;\n\n case \"label\":\n // The control whose id the for attribute names, and the controls inside the label. The\n // filter keeps a for that names an ancestor from resetting the label again.\n var forEl = this.htmlFor && this.ownerDocument.getElementById(this.htmlFor);\n\n el.find(\"input,select,textarea\").add(forEl).filter(\"input,select,textarea\").resetForm();\n\n return true;\n\n case \"form\":\n // through the prototype: a control named reset shadows the method\n callFormMethod(this, \"reset\");\n\n return true;\n\n default:\n el.find(\"form,input,label,select,textarea\").resetForm();\n\n return true;\n }\n });\n };\n\n /**\n * Enables or disables any matching elements.\n */\n $.fn.enable = function (b) {\n if (typeof b === \"undefined\") {\n b = true;\n }\n\n return this.each(function () {\n this.disabled = !b;\n });\n };\n\n /**\n * Checks/unchecks any matching checkboxes or radio buttons and\n * selects/deselects and matching option elements.\n */\n $.fn.selected = function (select) {\n if (typeof select === \"undefined\") {\n select = true;\n }\n\n return this.each(function () {\n var t = this.type;\n\n if (t === \"checkbox\" || t === \"radio\") {\n this.checked = select;\n } else if (tagName(this) === \"option\") {\n var $sel = $(this).parent(\"select\");\n\n if (select && $sel[0] && $sel[0].type === \"select-one\") {\n // deselect all other options\n $sel.find(\"option\").selected(false);\n }\n\n this.selected = select;\n }\n });\n };\n\n // expose debug var\n $.fn.ajaxSubmit.debug = false;\n})(jQuery);\n\nexport default jQuery;\n"],"names":["owners","plainForm","document","createElement","findDescriptor","name","i","length","owner","window","descriptor","Object","getOwnPropertyDescriptor","prototype","formMember","form","get","call","e","callFormMethod","value","apply","Array","slice","arguments","tagName","el","toLowerCase","isElement","node","assertRealParent","parentNode","Error","closestByTag","names","indexOf","storeKey","setExpando","ignore","expando","els","namedItem","undefined","record","x","y","jQuery","data","type","setTimeout","captureSubmitter","target","point","offsetX","offsetY","fn","offset","pageX","left","pageY","top","offsetLeft","offsetTop","imagePoint","submitterOf","stored","log","ajaxSubmit","debug","msg","join","console","opera","postError","warned","deprecate","id","message","warn","deprecateOldJQuery","version","parts","String","split","major","Number","beforeJQuery35","shorthandOptions","options","dataType","onSuccess","result","url","success","submitOptions","key","hasOwnProperty","withoutUrl","keepContext","settings","sources","context","submitWith","isDefaultPrevented","preventDefault","originalEvent","submitter","captureEventSubmitter","doAjaxSubmit","captureSubmittingElement","this","bindDelegated","$sel","selector","off","on","closestMatch","Element","closest","is","delegated","unbindSelector","handlers","submit","click","selectionOnly","ajaxForm","jquery","delegation","bindSelector","beforeFormUnbind","ajaxFormUnbind","o","s","c","isReady","bindLater","formAttribute","attr","rLineBreak","rCR","rUnsubmittable","isDisabled","matches","disabled","valueOf","index","selectedIndex","a","ops","one","max","op","selected","v","attributes","specified","text","push","selectValue","val","raw","replace","loneSurrogate","wellFormed","match","before","urlencodedFields","fields","map","field","createSuccessfulControls","feature","$","controlsOf","semantic","formId","getElementsByTagName","makeArray","grep","ownedBy","test","navigator","userAgent","concat","filter","getAttribute","inArray","outsideControls","fieldsOf","n","fieldValue","constructor","fileapi","files","file","required","imageFields","sub","input","addCandidate","collected","own","controls","collect","filtering","addClickedImage","deepSerialize","extraData","traditional","part","param","serialized","len","decodeURIComponent","sendFormData","submission","formdata","FormData","append","serializedData","extend","ajaxSettings","contentType","processData","cache","method","uploadProgress","createXhr","xhr","upload","addEventListener","event","percent","position","loaded","total","lengthComputable","Math","ceil","beforeSend","formData","ajax","sendAjax","uploadAttributes","hasOwn","isGet","addSubmitterFields","submitterFields","addCsrfField","forms","origin","csrf_token","csrf_param","posts","property","href","location","protocol","host","setFormAttribute","getDoc","frame","doc","contentWindow","err","contentDocument","readStatus","status","statusText","readResponse","retry","errMsg","isXml","XMLDocument","isXMLDoc","body","innerHTML","docRoot","documentElement","responseText","responseXML","getResponseHeader","header","readDocument","dt","scr","textarea","ta","pre","b","textContent","innerText","readEmbedded","ct","xml","nodeName","error","dataFilter","JSON","parse","globalEval","httpData","createLifecycle","g","timeoutHandle","callbackProcessed","deferred","Deferred","aborted","getAllResponseHeaders","setRequestHeader","abort","done","rejection","textStatus","stop","reject","trigger","complete","endGlobalEvents","active","clearTimeout","release","settle","failure","resolve","succeed","start","global","fail","startTimer","onTimeout","timeout","stopTimer","createIframeTransport","hasProp","frameCount","fileUploadIframe","ownerDocument","$body","$io","iframeTarget","each","nameWindow","io","setAttribute","iframeSrc","css","createFrame","Date","getTime","life","execCommand","remove","frameHooks","domCheckCount","checkState","state","readyState","cb","doSubmit","saved","saveAttributes","mp","skipEncodingOverride","setUploadAttributes","extraInputs","added","addHiddenInput","appendTo","isPlainObject","single","f","addExtraInputs","root","contains","notInDocument","attachEvent","listen","submitForm","restoreAttributes","detachEvent","removeEventListener","unlisten","post","forceSync","jqxhr","elements","prop","removeAttr","enableControls","closeKeepAlive","createSubmission","serialization","refuse","extraQuery","optionsData","requestFormat","query","pairs","at","decodeQuery","queryPairs","defineKey","object","defineProperty","enumerable","writable","configurable","callbackList","callback","isArray","callEach","callbacks","args","prepare","$set","action","trim","URL","withDefaults","defaultType","veto","beforeSerialize","qx","beforeSubmit","resolved","resolveMethod","extra","stringify","jsonBody","q","toUpperCase","hashAt","base","encode","$form","deliver","resetForm","clearForm","includeHidden","successes","jqXHR","successArguments","replaceTarget","$target","merge","errors","completes","chooseTransport","hasFileInputs","add","multipart","attribute","fileAPI","shouldUseFrame","transport","iframe","steps","transports","attr2","removeData","k","formToArray","formSerialize","fieldSerialize","successful","t","checked","isSuccessful","clearFields","clearInputs","re","tag","replaceWith","clone","defaultChecked","defaultValue","select","parents","multiple","defaultSelected","find","forEl","htmlFor","getElementById","enable","parent"],"mappings":";;;;;;;;;;;;;;;;;;;;;kRAMA,IAAIA,EAAS,CAAC,kBAAmB,cAAe,UAAW,QAGvDC,EAAYC,SAASC,cAAc,QAEvC,SAASC,EAAeC,GACtB,IAAK,IAAIC,EAAI,EAAGA,EAAIN,EAAOO,OAAQD,IAAK,CACtC,IAAIE,EAAQC,OAAOT,EAAOM,IACtBI,EAAaF,GAASG,OAAOC,yBAAyBJ,EAAMK,UAAWR,GAE3E,GAAIK,EACF,OAAOA,CAEX,CAEA,OAAO,IACT,CAOO,SAASI,EAAWC,EAAMV,GAC/B,IAAIK,EAAaN,EAAeC,GAEhC,IACE,OAAOK,EAAWM,IAAIC,KAAKF,EAC7B,CAAE,MAAOG,GACP,OAAOH,EAAKV,EACd,CACF,CAMO,SAASc,EAAeJ,EAAMV,GACnC,IAAIK,EAAaN,EAAeC,GAGhC,OAFaK,EAAaA,EAAWU,MAAQnB,EAAUI,IAEzCgB,MAAMN,EAA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 No newline at end of file +{"version":3,"file":"jquery.form.min.js","sources":["../src/form-members.js","../src/submitter.js","../src/diagnostics.js","../src/options.js","../src/ajax-form.js","../src/form-attributes.js","../src/successful-controls.js","../src/xhr-transport.js","../src/iframe-post.js","../src/iframe-response.js","../src/iframe-lifecycle.js","../src/iframe-transport.js","../src/submission.js","../src/jquery.form.js"],"sourcesContent":["// Form members: the properties and methods the plugin reads or calls on a form. A control named\n// like a member (elements, setAttribute) shadows that member on the form itself, so members are\n// read through the DOM prototypes, which a control cannot shadow.\n\n// The prototype chain of a form, nearest first. Looked up on every call: old browsers have no\n// DOM prototypes, and tests remove them.\nvar owners = [\"HTMLFormElement\", \"HTMLElement\", \"Element\", \"Node\"];\n\n// A form no control can shadow, for methods when the DOM has no prototypes to read them from.\nvar plainForm = document.createElement(\"form\");\n\nfunction findDescriptor(name) {\n for (var i = 0; i < owners.length; i++) {\n var owner = window[owners[i]];\n var descriptor = owner && Object.getOwnPropertyDescriptor(owner.prototype, name);\n\n if (descriptor) {\n return descriptor;\n }\n }\n\n return null;\n}\n\n/**\n * Reads a member of a form through its prototype getter.\n * Falls back to the plain property without DOM prototypes, or on an element the getter does not\n * accept (such as a fieldset for `elements`).\n */\nexport function formMember(form, name) {\n var descriptor = findDescriptor(name);\n\n try {\n return descriptor.get.call(form);\n } catch (e) {\n return form[name];\n }\n}\n\n/**\n * Calls a method of a form through its prototype, or through an unshadowed form without DOM\n * prototypes.\n */\nexport function callFormMethod(form, name) {\n var descriptor = findDescriptor(name);\n var method = descriptor ? descriptor.value : plainForm[name];\n\n return method.apply(form, Array.prototype.slice.call(arguments, 2));\n}\n\n// Nodes such as the document and text nodes have no tag name (#600).\nexport function tagName(el) {\n var name = formMember(el, \"tagName\");\n\n return typeof name === \"string\" ? name.toLowerCase() : \"\";\n}\n\n// Elements only: the subject of formToArray may also be the document or a plain object.\nexport function isElement(node) {\n return formMember(node, \"nodeType\") === 1;\n}\n\n// A control named parentNode makes every parentNode walk (jQuery's trigger and closest among\n// them) cycle between the form and the control.\nexport function assertRealParent(el) {\n if (el.parentNode !== formMember(el, \"parentNode\")) {\n throw new Error(\n 'jquery.form: a form control named \"parentNode\" hides the form\\'s parentNode; rename the control'\n );\n }\n}\n\n// The element itself or its nearest ancestor with one of the tag names, through the real tree.\nexport function closestByTag(el, names) {\n for (var node = el; node; node = formMember(node, \"parentNode\")) {\n if (names.indexOf(tagName(node)) >= 0) {\n return node;\n }\n }\n\n return null;\n}\n","import { closestByTag, formMember } from \"./form-members.js\";\nimport jQuery from \"jquery\";\n\n// The submitter: the button that submitted a form, captured from ajaxForm's clicks. It is kept in\n// a private store and cleared shortly after the click. The form's clk, clk_x and clk_y properties\n// are still written for pages that read them, and read when the store has none.\n\nvar storeKey = \"jqFormSubmitter\";\n\n// Writes a property on the form; a control with that name makes it read-only.\nfunction setExpando(form, name, value) {\n try {\n form[name] = value;\n } catch (ignore) {\n // the control keeps the name; the store has the submitter\n }\n}\n\n// A property the page set on the form, never a control of the form with that name.\nfunction expando(form, name) {\n var value = form[name];\n var els = formMember(form, \"elements\");\n\n return els && value && els.namedItem(name) === value ? undefined : value;\n}\n\n// Records a submitter for a form until the click window ends.\nfunction record(form, el, x, y) {\n jQuery.data(form, storeKey, { el: el, x: x, y: y });\n setExpando(form, \"clk\", el);\n\n if (el.type === \"image\") {\n setExpando(form, \"clk_x\", x);\n setExpando(form, \"clk_y\", y);\n }\n\n // clear form vars\n setTimeout(function () {\n jQuery.data(form, storeKey, null);\n setExpando(form, \"clk\", null);\n setExpando(form, \"clk_x\", null);\n setExpando(form, \"clk_y\", null);\n }, 100);\n}\n\n// The clicked point of an image button, relative to the image.\nfunction imagePoint(e, target) {\n if (typeof e.offsetX !== \"undefined\") {\n return [e.offsetX, e.offsetY];\n }\n\n if (typeof jQuery.fn.offset === \"function\") {\n var offset = jQuery(target).offset();\n\n return [e.pageX - offset.left, e.pageY - offset.top];\n }\n\n return [e.pageX - target.offsetLeft, e.pageY - target.offsetTop];\n}\n\n/**\n * Records the submit or image button a click event reached, for the form it belongs to.\n */\nexport function captureSubmitter(e) {\n // the clicked control, or the button around the clicked content (ex: a span within a button)\n var target = closestByTag(e.target, [\"button\", \"input\"]);\n\n // the type property, unlike the attribute, is \"submit\" for a button without a type (#588)\n if (!target || (target.type !== \"submit\" && target.type !== \"image\")) {\n return;\n }\n\n var form = target.form;\n\n if (!form) {\n // a submit control that belongs to no form\n return;\n }\n\n var point = target.type === \"image\" ? imagePoint(e, target) : [];\n\n record(form, target, point[0], point[1]);\n}\n\n/**\n * Records the submitter a submit event names (SubmitEvent.submitter), when no click was captured.\n * An image submitter gets the point 0,0, as native submission sends it without a click.\n */\nexport function captureEventSubmitter(e, form) {\n var el = e.originalEvent && e.originalEvent.submitter;\n\n if (el && !submitterOf(form)) {\n record(form, el, 0, 0);\n }\n}\n\n/**\n * The form's submitter as { el, x, y } (x and y for an image button), or null.\n */\nexport function submitterOf(form) {\n if (!form) {\n return null;\n }\n\n var stored = jQuery.data(form, storeKey);\n\n if (stored) {\n return stored;\n }\n\n var el = expando(form, \"clk\");\n\n return el ? { el: el, x: expando(form, \"clk_x\"), y: expando(form, \"clk_y\") } : null;\n}\n\n/**\n * The submitter's fields for a post that adds them itself (the iframe upload), as name β†’ value.\n */\nexport function submitterFields(form) {\n var fields = {};\n var sub = submitterOf(form);\n var el = sub && sub.el;\n\n if (el && el.name && !el.disabled) {\n fields[el.name] = el.value;\n if (el.type === \"image\") {\n fields[el.name + \".x\"] = sub.x;\n fields[el.name + \".y\"] = sub.y;\n }\n }\n\n return fields;\n}\n\n/**\n * The form's submitter element, or null.\n */\nexport function submitterElement(form) {\n var sub = submitterOf(form);\n\n return sub ? sub.el : null;\n}\n","import jQuery from \"jquery\";\n\n// Debug logging, switched on by $.fn.ajaxSubmit.debug. The flag is read on every call, so it can\n// be turned on after the plugin loads.\nexport function log() {\n if (!jQuery.fn.ajaxSubmit.debug) {\n return;\n }\n\n var msg = \"[jquery.form] \" + Array.prototype.join.call(arguments, \"\");\n\n if (window.console && window.console.log) {\n window.console.log(msg);\n } else if (window.opera && window.opera.postError) {\n window.opera.postError(msg);\n }\n}\n\nvar warned = {};\n\n/**\n * A deprecation warning: console.warn, only while debug is on, once per id per page. The message\n * names the replacement; the warning adds that the feature is removed in 5.0.\n */\nexport function deprecate(id, message) {\n if (!jQuery.fn.ajaxSubmit.debug || warned[id]) {\n return;\n }\n\n warned[id] = true;\n\n if (window.console && typeof window.console.warn === \"function\") {\n window.console.warn(\"[jquery.form] \" + message + \" (removed in 5.0)\");\n }\n}\n\n// Forgets which deprecations have warned (for tests).\nexport function resetDeprecations() {\n warned = {};\n}\n\n// True for a jQuery version string older than 3.5.\nexport function beforeJQuery35(version) {\n var parts = String(version).split(\".\");\n var major = Number(parts[0]);\n\n return major < 3 || (major === 3 && Number(parts[1]) < 5);\n}\n\n// 5.0 needs jQuery 3.5 or later: warned on the first ajaxSubmit or ajaxForm, given jQuery's version.\nexport function deprecateOldJQuery(version) {\n if (beforeJQuery35(version)) {\n deprecate(\n \"jquery\",\n \"support for jQuery \" + version + \" is deprecated, 5.0 needs jQuery 3.5 or later\"\n );\n }\n}\n","// The arguments ajaxSubmit and ajaxForm accept in place of an options object.\n\n/**\n * Turns the (url, data, dataType, success) shorthand into options. A url of false is kept as\n * the url; anything else is returned as given.\n */\nexport function shorthandOptions(options, data, dataType, onSuccess) {\n if (typeof options !== \"string\" && options !== false) {\n return options;\n }\n\n var result = { url: options, data: data, dataType: dataType };\n\n if (typeof onSuccess === \"function\") {\n result.success = onSuccess;\n }\n\n return result;\n}\n\n// A copy of options without its url, so the form action is used.\nfunction withoutUrl(options) {\n var result = {};\n\n for (var key in options) {\n if (key !== \"url\" && Object.prototype.hasOwnProperty.call(options, key)) {\n result[key] = options[key];\n }\n }\n\n return result;\n}\n\n/**\n * The options ajaxSubmit starts from: a function is the success callback, the shorthand is\n * expanded, and no options at all is an empty object. A url of false or \"\" means the form action.\n */\nexport function submitOptions(options, data, dataType, onSuccess) {\n if (typeof options === \"function\") {\n return { success: options };\n }\n\n options = shorthandOptions(options, data, dataType, onSuccess);\n\n if (typeof options === \"undefined\") {\n return {};\n }\n\n return options.url === false || options.url === \"\" ? withoutUrl(options) : options;\n}\n\n/**\n * jQuery treats `context` as a flat option: after a deep merge, the settings get back the\n * caller's own object from the last source that has one, so `this` in callbacks is that object.\n */\nexport function keepContext(settings, sources) {\n for (var i = 0; i < sources.length; i++) {\n if (sources[i].context !== undefined) {\n settings.context = sources[i].context;\n }\n }\n\n return settings;\n}\n","import { assertRealParent, closestByTag, formMember, isElement } from \"./form-members.js\";\nimport { captureEventSubmitter, captureSubmitter } from \"./submitter.js\";\nimport { deprecate, deprecateOldJQuery, log } from \"./diagnostics.js\";\nimport jQuery from \"jquery\";\nimport { shorthandOptions } from \"./options.js\";\n\n// ajaxForm binding: the submit and click handlers that send a form through ajaxSubmit. The\n// handlers look up $.fn.ajaxSubmit when they run, so a replacement installed later is used.\n\n// Sends the submit event's form with ajaxSubmit, unless an earlier handler cancelled it.\nfunction submitWith(e, options) {\n if (!e.isDefaultPrevented()) {\n // if event has been canceled, don't proceed\n e.preventDefault();\n // the form is found through the real tree: a control named nodeType misleads jQuery's closest\n var form = closestByTag(e.target, [\"form\"]);\n\n // a button outside the form (form attribute), or requestSubmit(button), sends no click here\n captureEventSubmitter(e, form);\n jQuery(form).ajaxSubmit(options); // #365\n }\n}\n\nfunction doAjaxSubmit(e) {\n submitWith(e, e.data);\n}\n\nfunction captureSubmittingElement(e) {\n /* jshint validthis:true */\n assertRealParent(this);\n captureSubmitter(e);\n}\n\n// An empty selection: queued until the DOM is ready (old jQuery keeps the selector), or dropped.\nfunction bindLater($sel, options) {\n var o = { s: $sel.selector, c: $sel.context };\n\n if (!jQuery.isReady && o.s) {\n log(\"DOM not ready, queuing ajaxForm\");\n deprecate(\n \"queue\",\n \"queuing ajaxForm until the DOM is ready is deprecated, call ajaxForm inside $(fn) \" +\n 'or use delegation: \"\"'\n );\n jQuery(function () {\n jQuery(o.s, o.c).ajaxForm(options);\n });\n\n return $sel;\n }\n\n // is your DOM ready? http://docs.jquery.com/Tutorials:Introducing_$(document).ready()\n log(\"terminating; zero elements found by selector\" + (jQuery.isReady ? \"\" : \" (DOM not ready)\"));\n\n return $sel;\n}\n\n// delegation: true on jQuery 3 and later, where the selection has no selector: always warned,\n// debug or not, once per ajaxForm call.\nfunction warnUnscoped() {\n var console = window.console || {};\n\n if (typeof console.warn === \"function\") {\n console.warn(\n \"[jquery.form] delegation: true binds every form on the page on jQuery 3 and later; \" +\n 'pass a selector instead, e.g. delegation: \"form.ajax\"'\n );\n }\n}\n\nfunction bindDelegated($sel, options) {\n if ($sel.selector === undefined) {\n warnUnscoped();\n }\n\n jQuery(document)\n .off(\"submit.form-plugin\", $sel.selector, doAjaxSubmit)\n .off(\"click.form-plugin\", $sel.selector, captureSubmittingElement)\n .on(\"submit.form-plugin\", $sel.selector, options, doAjaxSubmit)\n .on(\"click.form-plugin\", $sel.selector, options, captureSubmittingElement);\n\n return $sel;\n}\n\n// The element itself or its nearest ancestor that matches the selector. The walk never reads a\n// parentNode a control can hide (jQuery's delegated walk does, and cycles on such a form).\nfunction closestMatch(el, selector) {\n if (!isElement(el)) {\n return null;\n }\n\n if (window.Element && Element.prototype.closest) {\n return Element.prototype.closest.call(el, selector);\n }\n\n for (var node = el; node && isElement(node); node = formMember(node, \"parentNode\")) {\n if (jQuery(node).is(selector)) {\n return node;\n }\n }\n\n return null;\n}\n\n// The document handlers bound for each delegation selector, keyed by \"s\" + selector.\nvar delegated = {};\n\nfunction unbindSelector(selector) {\n var handlers = delegated[\"s\" + selector];\n\n if (handlers) {\n jQuery(document)\n .off(\"submit.form-plugin\", handlers.submit)\n .off(\"click.form-plugin\", handlers.click);\n delete delegated[\"s\" + selector];\n }\n}\n\n// delegation: \"\": one handler pair on the document, scoped to the selector.\nfunction bindSelector($sel, selector, options) {\n if (!selector) {\n throw new Error(\"jquery.form: delegation needs a selector, or true\");\n }\n\n var handlers = {\n submit: function (e) {\n if (closestMatch(e.target, selector)) {\n submitWith(e, options);\n }\n },\n click: function (e) {\n if (closestMatch(e.target, selector)) {\n captureSubmitter(e);\n }\n },\n };\n\n unbindSelector(selector);\n delegated[\"s\" + selector] = handlers;\n jQuery(document)\n .on(\"submit.form-plugin\", handlers.submit)\n .on(\"click.form-plugin\", handlers.click);\n\n return $sel;\n}\n\n// Passed by ajaxForm's own rebind: unbind the selection only, never the document handlers.\nvar selectionOnly = {};\n\n/**\n * ajaxForm() binds the selected forms so a submit is sent with ajaxSubmit, with the clicked\n * submit button (and image coordinates) included. The options work as for ajaxSubmit.\n */\nexport function ajaxForm(options, data, dataType, onSuccess) {\n deprecateOldJQuery(jQuery.fn.jquery);\n options = shorthandOptions(options, data, dataType, onSuccess) || {};\n\n if (typeof options.delegation === \"string\") {\n return bindSelector(this, options.delegation, options);\n }\n\n options.delegation = options.delegation && typeof jQuery.fn.on === \"function\";\n\n if (!options.delegation && this.length === 0) {\n return bindLater(this, options);\n }\n\n if (options.delegation) {\n return bindDelegated(this, options);\n }\n\n if (options.beforeFormUnbind) {\n options.beforeFormUnbind(this, options);\n }\n\n return this.ajaxFormUnbind(selectionOnly)\n .on(\"submit.form-plugin\", options, doAjaxSubmit)\n .on(\"click.form-plugin\", options, captureSubmittingElement);\n}\n\n/**\n * ajaxFormUnbind() removes the handlers ajaxForm bound on the selection and every delegated\n * binding on the document. ajaxFormUnbind(selector) removes only that delegation selector.\n */\nexport function ajaxFormUnbind(selector) {\n if (typeof selector === \"string\") {\n unbindSelector(selector);\n\n return this;\n }\n\n if (selector !== selectionOnly) {\n delegated = {};\n jQuery(document).off(\"submit.form-plugin click.form-plugin\");\n }\n\n return this.off(\"submit.form-plugin click.form-plugin\");\n}\n","import { callFormMethod, isElement } from \"./form-members.js\";\nimport jQuery from \"jquery\";\n\n/**\n * An attribute of a form, or undefined when it is absent, as jQuery's attr returns it. The\n * subject may also be the document or a plain object, read through jQuery.\n */\nexport function formAttribute(form, name) {\n if (!isElement(form)) {\n return jQuery(form).attr(name);\n }\n\n var value = callFormMethod(form, \"getAttribute\", name);\n\n return value === null ? undefined : value;\n}\n","import { callFormMethod, formMember, isElement, tagName } from \"./form-members.js\";\nimport { formAttribute } from \"./form-attributes.js\";\nimport jQuery from \"jquery\";\nimport { submitterOf } from \"./submitter.js\";\n\n// Successful controls: which controls of a form are sent, and as which name/value fields\n// (https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#constructing-the-form-data-set).\n\n// Line breaks, sent as CRLF\nvar rLineBreak = /\\r\\n|\\r|\\n/g;\nvar rCR = /\\r/g;\n\n// Listed form elements that are never submitted.\nvar rUnsubmittable = /^(?:fieldset|object|output)$/;\n\n/**\n * Whether a control or option is disabled, also through a disabled fieldset or optgroup. Without\n * selector matching, only its own disabled property is read.\n */\nfunction isDisabled(el) {\n return typeof el.matches === \"function\" ? el.matches(\":disabled\") : !!el.disabled;\n}\n\n/**\n * The successful-control rule: whether a control is sent. `submitter` is the button that\n * submitted the control's form; other submit and image buttons of a form are not sent.\n */\nexport function isSuccessful(el, submitter) {\n var t = el.type;\n\n if (!el.name || isDisabled(el) || t === \"reset\" || t === \"button\") {\n return false;\n }\n\n if (t === \"checkbox\" || t === \"radio\") {\n return !!el.checked;\n }\n\n if (t === \"submit\" || t === \"image\") {\n return !el.form || submitter === el;\n }\n\n return tagName(el) !== \"select\" || el.selectedIndex !== -1;\n}\n\n// The value of a select: the selected option's value for one, a list for several.\nfunction selectValue(el) {\n var index = el.selectedIndex;\n\n if (index < 0) {\n return null;\n }\n\n var a = [],\n ops = el.options;\n var one = el.type === \"select-one\";\n var max = one ? index + 1 : ops.length;\n\n for (var i = one ? index : 0; i < max; i++) {\n var op = ops[i];\n\n if (op.selected && !isDisabled(op)) {\n var v = op.value;\n\n if (!v) {\n // extra pain for IE...\n v =\n op.attributes && op.attributes.value && !op.attributes.value.specified\n ? op.text\n : op.value;\n }\n\n if (one) {\n return v;\n }\n\n a.push(v);\n }\n }\n\n return a;\n}\n\n/**\n * The value of a control, whether or not it is successful: a list for a multiple select, null\n * for a select with nothing selected, otherwise a string with CRLF line breaks (a lone CR or LF\n * included).\n */\nexport function valueOf(el) {\n if (tagName(el) === \"select\") {\n return selectValue(el);\n }\n\n var v = jQuery(el).val();\n var raw = el.value;\n\n // jQuery before 4.0 drops carriage returns from .val(); read them from the value itself\n if (typeof raw === \"string\" && raw.replace(rCR, \"\") === v) {\n v = raw;\n }\n\n return v.replace(rLineBreak, \"\\r\\n\");\n}\n\n/**\n * The fields as a urlencoded body sends them: a selected file as its name.\n */\n// A lone surrogate becomes U+FFFD, as in a native submission; jQuery.param would throw.\nvar loneSurrogate = /[\\uD800-\\uDBFF](?![\\uDC00-\\uDFFF])|([^\\uD800-\\uDBFF]|^)([\\uDC00-\\uDFFF])/g;\n\nexport function wellFormed(value) {\n return typeof value === \"string\"\n ? value.replace(loneSurrogate, function (match, before) {\n return (before || \"\") + \"\\uFFFD\";\n })\n : value;\n}\n\nexport function urlencodedFields(fields) {\n return jQuery.map(fields, function (field) {\n var value =\n field.type === \"file\" && typeof field.value !== \"string\" ? field.value.name : field.value;\n var name = wellFormed(field.name);\n value = wellFormed(value);\n\n return name === field.name && value === field.value ? field : { name: name, value: value };\n });\n}\n\n/**\n * The serialization steps. `feature` holds what the entry detected at load (fileapi).\n */\nexport function createSuccessfulControls(feature) {\n var $ = jQuery;\n\n // #386; inputs that name the form in their form attribute, other than the candidates found.\n // A form only gets the ones it owns.\n function outsideControls(formId, els, owner) {\n // hat tip @thet; the id is compared, never built into a selector\n return $(\":input[form]\")\n .filter(function () {\n return (\n this.getAttribute(\"form\") === formId &&\n (!owner || this.form === owner) &&\n $.inArray(this, els) < 0\n );\n })\n .get();\n }\n\n // A descendant of a form is a candidate unless it is a control another form owns.\n function ownedBy(els, owner) {\n return $.grep(els, function (el) {\n return typeof el.form === \"undefined\" || el.form === owner;\n });\n }\n\n /**\n * The candidate controls of a form, in order: its elements, or every descendant it owns in\n * semantic mode, then the outside controls it owns that name it.\n */\n function controlsOf(form, semantic) {\n var formId = formAttribute(form, \"id\");\n var els = formMember(form, \"elements\");\n\n if (semantic || typeof els === \"undefined\") {\n // the document is not an element; it has its own getElementsByTagName\n els = isElement(form)\n ? callFormMethod(form, \"getElementsByTagName\", \"*\")\n : form.getElementsByTagName(\"*\");\n }\n\n els = $.makeArray(els);\n\n // the subject may also be a fieldset, the document or another container\n var owner = tagName(form) === \"form\" ? form : null;\n\n if (semantic && owner) {\n els = ownedBy(els, owner);\n }\n\n // FinesseRus: in non-IE browsers outside fields are already included in form.elements.\n if (formId && (semantic || /(Edge|Trident)\\//.test(navigator.userAgent))) {\n els = els.concat(outsideControls(formId, els, owner));\n }\n\n return els;\n }\n\n // The fields of a control's value, or null when the control is not sent.\n function fieldsOf(el) {\n var n = el.name;\n // read at call time, so a page that replaces $.fieldValue changes what is sent\n var v = $.fieldValue(el, true);\n\n if (v && v.constructor === Array) {\n return $.map(v, function (value) {\n return { name: n, value: value };\n });\n }\n\n if (feature.fileapi && el.type === \"file\") {\n var files = el.files;\n\n // #180: an empty field when no file is selected\n return files.length\n ? $.map(files, function (file) {\n return { name: n, value: file, type: el.type };\n })\n : [{ name: n, value: \"\", type: el.type }];\n }\n\n if (v === null || typeof v === \"undefined\") {\n return null;\n }\n\n return [{ name: n, value: v, type: el.type, required: el.required }];\n }\n\n // The clicked image's value and coordinates.\n function imageFields(sub, input, type) {\n var n = input.name;\n var value = { name: n, value: $(input).val() };\n\n if (type) {\n value.type = type;\n }\n\n return [value, { name: n + \".x\", value: sub.x }, { name: n + \".y\", value: sub.y }];\n }\n\n // Adds one candidate control's fields, and the control when it has a value to send.\n function addCandidate(collected, form, el, semantic) {\n if (!el.name || isDisabled(el) || rUnsubmittable.test(tagName(el))) {\n return;\n }\n\n var sub = semantic && el.type === \"image\" && submitterOf(form);\n\n if (sub) {\n // handle image inputs on the fly when semantic == true\n if (sub.el === el) {\n collected.fields.push.apply(collected.fields, imageFields(sub, el, el.type));\n }\n\n return;\n }\n\n var own = fieldsOf(el);\n\n if (own) {\n collected.controls.push(el);\n collected.fields.push.apply(collected.fields, own);\n }\n }\n\n // input type=='image' are not found in elements array! handle it here\n function addClickedImage(collected, form) {\n var sub = submitterOf(form);\n var input = sub && $(sub.el)[0];\n\n if (input && input.name && !isDisabled(input) && input.type === \"image\") {\n collected.fields.push.apply(collected.fields, imageFields(sub, input));\n }\n }\n\n /**\n * The fields of a form, as formToArray returns them, and the controls they came from.\n */\n function collect(form, semantic, filtering) {\n var collected = { fields: [], controls: [] };\n\n if (!form) {\n return collected;\n }\n\n var els = controlsOf(form, semantic);\n\n if (typeof filtering === \"function\") {\n els = $.map(els, filtering);\n }\n\n for (var i = 0; i < els.length; i++) {\n addCandidate(collected, form, els[i], semantic);\n }\n\n if (!semantic) {\n addClickedImage(collected, form);\n }\n\n return collected;\n }\n\n return {\n controlsOf: controlsOf,\n fieldsOf: fieldsOf,\n collect: collect,\n };\n}\n","import jQuery from \"jquery\";\nimport { keepContext } from \"./options.js\";\n\n// The XMLHttpRequest transports: $.ajax with the encoded fields, or FormData for file uploads.\nvar $ = jQuery;\n\n// utility fn for deep serialization: [name, value] pairs, as $.param encodes them\nexport function deepSerialize(extraData, traditional) {\n var param = $.param(extraData, traditional);\n var serialized = param ? param.split(\"&\") : [];\n var len = serialized.length;\n var result = [];\n var i, part;\n\n for (i = 0; i < len; i++) {\n // #252; undo param space replacement\n serialized[i] = serialized[i].replace(/\\+/g, \" \");\n part = serialized[i].split(\"=\");\n // #278; use array instead of object storage, favoring array serializations\n result.push([decodeURIComponent(part[0]), decodeURIComponent(part[1])]);\n }\n\n return result;\n}\n\n/**\n * Posts the fields and extraData as FormData, for files with the File API.\n * XMLHttpRequest Level 2 file uploads (big hat tip to francois2metz)\n */\nexport function sendFormData(submission) {\n var options = submission.options;\n var a = submission.fields;\n\n var formdata = new FormData();\n\n for (var i = 0; i < a.length; i++) {\n formdata.append(a[i].name, a[i].value);\n }\n\n if (options.extraData) {\n var serializedData = deepSerialize(options.extraData, submission.traditional);\n\n for (i = 0; i < serializedData.length; i++) {\n formdata.append(serializedData[i][0], serializedData[i][1]);\n }\n }\n\n options.data = null;\n\n var s = $.extend(true, {}, $.ajaxSettings, options, {\n contentType: false,\n processData: false,\n cache: false,\n type: submission.method || \"POST\",\n });\n\n keepContext(s, [$.ajaxSettings, options]);\n\n if (options.uploadProgress) {\n // workaround because jqXHR does not expose upload property: wraps the xhr factory, the\n // caller's or jQuery's\n var createXhr = s.xhr;\n\n s.xhr = function () {\n var xhr = createXhr.call(this);\n\n if (xhr.upload) {\n xhr.upload.addEventListener(\n \"progress\",\n function (event) {\n var percent = 0;\n // event.position is the deprecated name, read only when loaded is missing\n var position = event.loaded !== undefined ? event.loaded : event.position;\n var total = event.total;\n\n if (event.lengthComputable) {\n percent = Math.ceil((position / total) * 100);\n }\n\n options.uploadProgress(event, position, total, percent);\n },\n false\n );\n }\n\n return xhr;\n };\n }\n\n s.data = null;\n\n var beforeSend = s.beforeSend;\n\n s.beforeSend = function (xhr, o) {\n // Send FormData() provided by user\n if (options.formData) {\n o.data = options.formData;\n } else {\n o.data = formdata;\n }\n\n // a veto (false) cancels the upload, as on the other transports\n return beforeSend ? beforeSend.call(this, xhr, o) : undefined;\n };\n\n return $.ajax(s);\n}\n\n/**\n * Sends the encoded fields with $.ajax.\n */\nexport function sendAjax(submission) {\n return $.ajax(submission.options);\n}\n","import { callFormMethod } from \"./form-members.js\";\nimport { deepSerialize } from \"./xhr-transport.js\";\nimport jQuery from \"jquery\";\nimport { submitterFields } from \"./submitter.js\";\nimport { wellFormed } from \"./successful-controls.js\";\n\n// The iframe form post: the extra fields (submitter, CSRF, data), the form attributes set while\n// posting and restored after, and the native submit.\nvar $ = jQuery;\n\n// The form attributes an iframe upload changes while it posts.\nvar uploadAttributes = [\"action\", \"target\", \"method\", \"enctype\", \"encoding\"];\n\n// Called through the prototype: an extraData key or a form field may be named hasOwnProperty.\nvar hasOwn = Object.prototype.hasOwnProperty;\n\nfunction isGet(method) {\n return /^get$/i.test(method);\n}\n\n// Resolves both URLs through anchors, as jQuery does for crossDomain, so IE's anchor quirks\n// apply to both sides of the comparison.\nfunction isSameOrigin(url) {\n var origin = document.createElement(\"a\");\n var target = document.createElement(\"a\");\n\n origin.href = window.location.href;\n target.href = url;\n // IE fills in the host of a relative URL only once the resolved href is assigned back\n target.href = target.href; // eslint-disable-line no-self-assign\n\n return origin.protocol + \"//\" + origin.host === target.protocol + \"//\" + target.host;\n}\n\n/** Adds the clicked submitter (and an image's coordinates) to s.extraData. */\nexport function addSubmitterFields(s, form) {\n // add submitting element to data if we know it\n var fields = submitterFields(form);\n\n for (var n in fields) {\n s.extraData = s.extraData || {};\n s.extraData[wellFormed(n)] = wellFormed(fields[n]);\n }\n}\n\n/** Adds the page's CSRF token to s.extraData when the form is posted to the page's origin. */\nexport function addCsrfField(s, form, method, forms) {\n // Rails CSRF hack (thanks to Yvan Barthelemy); like jquery-ujs, only for the page's origin and\n // only when the form is posted, since a get form would put the token in the url\n var csrf_token = $(\"meta[name=csrf-token]\").attr(\"content\");\n var csrf_param = $(\"meta[name=csrf-param]\").attr(\"content\");\n var posts =\n !isGet(method) &&\n (!method || /post/i.test(method) || /post/i.test(forms.property(form, \"method\")));\n\n if (csrf_param && csrf_token && posts && isSameOrigin(s.url)) {\n s.extraData = s.extraData || {};\n s.extraData[csrf_param] = csrf_token;\n }\n}\n\nfunction setFormAttribute(form, name, value) {\n callFormMethod(form, \"setAttribute\", name, value);\n}\n\n/** The raw attributes the upload changes, null when absent, to put back exactly (#380). */\nexport function saveAttributes(form) {\n var saved = {};\n\n $.each(uploadAttributes, function (i, name) {\n saved[name] = callFormMethod(form, \"hasAttribute\", name)\n ? callFormMethod(form, \"getAttribute\", name)\n : null;\n });\n\n return saved;\n}\n\n/** Puts back the attributes saveAttributes recorded, removing those that were absent. */\nexport function restoreAttributes(form, saved) {\n $.each(uploadAttributes, function (i, name) {\n if (saved[name] === null) {\n callFormMethod(form, \"removeAttribute\", name);\n } else {\n setFormAttribute(form, name, saved[name]);\n }\n });\n}\n\n/** Points the form at the frame `target` with the upload's url, method and encoding. */\nexport function setUploadAttributes(form, target, method, s, forms) {\n var mp = \"multipart/form-data\";\n\n // update form attrs in IE friendly way\n setFormAttribute(form, \"target\", target);\n if (!method || /post/i.test(method)) {\n setFormAttribute(form, \"method\", \"POST\");\n } else if (isGet(method) && !isGet(forms.property(form, \"method\"))) {\n // a form posts natively only with GET or POST; other verbs keep the form's own method\n setFormAttribute(form, \"method\", \"GET\");\n }\n setFormAttribute(form, \"action\", s.url);\n\n // ie borks in some cases when setting encoding\n if (!s.skipEncodingOverride && (!method || /post/i.test(method))) {\n setFormAttribute(form, \"encoding\", mp);\n setFormAttribute(form, \"enctype\", mp);\n }\n}\n\n/** Appends a hidden input per extraData field to the form; each input is pushed onto `added`. */\nexport function addExtraInputs(form, ownerDocument, extraData, traditional, added) {\n // Builds the input with DOM properties: a name is never parsed as HTML.\n function addHiddenInput(name, value) {\n var input = ownerDocument.createElement(\"input\");\n\n input.type = \"hidden\";\n input.name = name;\n added.push($(input).val(value).appendTo(form)[0]);\n }\n\n if (extraData) {\n for (var n in extraData) {\n if (hasOwn.call(extraData, n)) {\n // if using the $.param format that allows for multiple values with the same name\n if (\n $.isPlainObject(extraData[n]) &&\n hasOwn.call(extraData[n], \"name\") &&\n hasOwn.call(extraData[n], \"value\")\n ) {\n addHiddenInput(extraData[n].name, extraData[n].value);\n } else {\n // arrays and objects become one field per value, as $.param sends them (#597)\n var single = {};\n\n single[n] = extraData[n];\n var fields = deepSerialize(single, traditional);\n\n for (var f = 0; f < fields.length; f++) {\n addHiddenInput(fields[f][0], fields[f][1]);\n }\n }\n }\n }\n }\n}\n\n/** Submits the form natively, even when a control named submit hides the method. */\nexport function submitForm(form) {\n try {\n form.submit();\n } catch (err) {\n // just in case form has element with name/id of 'submit'\n callFormMethod(form, \"submit\");\n }\n}\n","import jQuery from \"jquery\";\nimport { log } from \"./diagnostics.js\";\n\n// The iframe response reader: turns the frame's document into the mock xhr's text, XML, status\n// and dataType, then parses it as $.ajax would (dataFilter, JSON, script).\nvar $ = jQuery;\n\n/** The frame's document, or null when the browser denies access to it. */\nexport function getDoc(frame) {\n /* it looks like contentWindow or contentDocument do not\n * carry the protocol property in ie8, when running under ssl\n * frame.document is the only valid response document, since\n * the protocol is know but not on the other two objects. strange?\n * \"Same origin policy\" http://en.wikipedia.org/wiki/Same_origin_policy\n */\n\n var doc = null;\n\n // IE8 cascading access check\n try {\n if (frame.contentWindow) {\n doc = frame.contentWindow.document;\n }\n } catch (err) {\n // IE8 access denied under ssl & missing protocol\n log(\"cannot get iframe.contentWindow document: \" + err);\n }\n\n if (doc) {\n // successful getting content\n return doc;\n }\n\n try {\n // simply checking may throw in ie8 under ssl or mismatched protocol\n doc = frame.contentDocument ? frame.contentDocument : frame.document;\n } catch (err) {\n // last attempt\n log(\"cannot get iframe.contentDocument: \" + err);\n doc = frame.document;\n }\n\n return doc;\n}\n\n/** Parses the response text or XML for the given (lowercase) dataType. */\nexport function httpData(xhr, type, s) {\n // mostly lifted from jq1.4.4\n\n var ct = xhr.getResponseHeader(\"content-type\") || \"\",\n xml = (type === \"xml\" || !type) && ct.indexOf(\"xml\") >= 0,\n data = xml ? xhr.responseXML : xhr.responseText;\n\n if (xml && data.documentElement.nodeName === \"parsererror\") {\n if ($.error) {\n $.error(\"parsererror\");\n }\n }\n if (s && s.dataFilter) {\n data = s.dataFilter(data, type);\n }\n if (typeof data === \"string\") {\n if ((type === \"json\" || !type) && ct.indexOf(\"json\") >= 0) {\n data = JSON.parse(data);\n } else if (type === \"script\") {\n $.globalEval(data);\n }\n }\n\n return data;\n}\n\n// Copies the status and statusText attributes of an element onto the mock xhr.\nfunction readStatus(xhr, el) {\n // support for XHR 'status' & 'statusText' emulation :\n xhr.status = Number(el.getAttribute(\"status\")) || xhr.status;\n xhr.statusText = el.getAttribute(\"statusText\") || xhr.statusText;\n}\n\n// Fills the mock xhr from the document itself.\nfunction readDocument(doc, xhr, s, isXml) {\n var docRoot = doc.body ? doc.body : doc.documentElement;\n\n xhr.responseText = docRoot ? docRoot.innerHTML : null;\n xhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc;\n if (isXml) {\n s.dataType = \"xml\";\n }\n xhr.getResponseHeader = function (header) {\n // the dataType in lowercase, as $.ajax reads it\n var headers = { \"content-type\": s.dataType && s.dataType.toLowerCase() };\n\n return headers[header.toLowerCase()];\n };\n if (docRoot) {\n readStatus(xhr, docRoot);\n }\n}\n\n// A response embedded in a textarea, or text wrapped in pre or body, replaces responseText.\nfunction readEmbedded(doc, xhr, dt, s) {\n var scr = /(json|script|text)/.test(dt);\n\n if (!scr && !s.textarea) {\n return;\n }\n // see if user embedded response in textarea\n var ta = doc.getElementsByTagName(\"textarea\")[0];\n\n if (ta) {\n xhr.responseText = ta.value;\n readStatus(xhr, ta);\n } else if (scr) {\n // account for browsers injecting pre around json response\n var pre = doc.getElementsByTagName(\"pre\")[0];\n var b = doc.getElementsByTagName(\"body\")[0];\n\n if (pre) {\n xhr.responseText = pre.textContent ? pre.textContent : pre.innerText;\n } else if (b) {\n xhr.responseText = b.textContent ? b.textContent : b.innerText;\n }\n }\n}\n\n/**\n * Reads and parses the response document into the mock xhr. Returns {status, data, errMsg}, or\n * null when `retry()` asks to read the document again later (Opera's untraversable DOM).\n */\nexport function readResponse(doc, xhr, s, retry) {\n var status = \"success\",\n data,\n errMsg;\n\n try {\n var isXml = /^xml$/i.test(s.dataType) || doc.XMLDocument || $.isXMLDoc(doc);\n\n log(\"isXml=\" + isXml);\n\n if (!isXml && window.opera && (doc.body === null || !doc.body.innerHTML)) {\n // in some browsers (Opera) the iframe DOM is not always traversable when\n // the onload callback fires, so we loop a bit to accommodate\n if (retry()) {\n return null;\n }\n // let this fall through because server response could be an empty document\n }\n\n readDocument(doc, xhr, s, isXml);\n\n var dt = (s.dataType || \"\").toLowerCase();\n\n readEmbedded(doc, xhr, dt, s);\n\n try {\n data = httpData(xhr, dt, s);\n } catch (err) {\n status = \"parsererror\";\n xhr.error = errMsg = err || status;\n }\n } catch (err) {\n log(\"error caught: \", err);\n status = \"error\";\n xhr.error = errMsg = err;\n }\n\n return { status: status, data: data, errMsg: errMsg };\n}\n","import jQuery from \"jquery\";\nimport { log } from \"./diagnostics.js\";\n\n// The iframe upload's lifecycle: the mock xhr and the Deferred, the global ajax events, the\n// beforeSend veto, the timeout, abort and settling.\nvar $ = jQuery;\n\n/**\n * Creates the lifecycle of one upload with the merged settings `s`. `frame.stop()` stops the\n * frame's load and `frame.release()` removes or resets the frame after the upload.\n */\nexport function createLifecycle(s, frame) {\n var g,\n timeoutHandle,\n callbackProcessed,\n deferred = $.Deferred();\n\n var xhr = {\n // mock object\n aborted: 0,\n responseText: null,\n responseXML: null,\n status: 0,\n statusText: \"n/a\",\n getAllResponseHeaders: function () {},\n getResponseHeader: function () {},\n setRequestHeader: function () {},\n abort: function (status) {\n abort(status, [xhr, \"aborted\", status]);\n },\n };\n\n // #341\n deferred.abort = function (status) {\n xhr.abort(status);\n };\n\n function done() {\n return xhr.aborted || callbackProcessed;\n }\n\n // Completes an aborted upload once and rejects the Deferred with `rejection`.\n // `textStatus` replaces the default \"timeout\"/\"aborted\" text status.\n function abort(status, rejection, textStatus) {\n var e = textStatus || (status === \"timeout\" ? \"timeout\" : \"aborted\");\n\n if (done()) {\n return;\n }\n\n log(\"aborting upload... \" + e);\n xhr.aborted = 1;\n frame.stop();\n xhr.error = e;\n if (s.error) {\n s.error.call(s.context, xhr, e, status);\n }\n deferred.reject.apply(deferred, rejection);\n\n if (g) {\n $.event.trigger(\"ajaxError\", [xhr, s, e]);\n }\n\n complete(e);\n }\n\n // The global events that end every upload, cancelled ones included.\n function endGlobalEvents() {\n if (g) {\n $.event.trigger(\"ajaxComplete\", [xhr, s]);\n }\n\n if (g && !--$.active) {\n $.event.trigger(\"ajaxStop\");\n }\n }\n\n // The steps every finished or aborted upload ends with, in $.ajax order.\n function complete(status) {\n if (s.complete) {\n s.complete.call(s.context, xhr, status);\n }\n\n endGlobalEvents();\n clearTimeout(timeoutHandle);\n\n // clean up\n setTimeout(function () {\n frame.release();\n xhr.responseXML = null;\n }, 100);\n }\n\n // A beforeSend veto ends the upload as $.ajax cancels a request: no callbacks, the global\n // events end with ajaxError \"canceled\".\n function cancel() {\n if (done()) {\n return;\n }\n\n callbackProcessed = true;\n deferred.reject();\n if (g) {\n $.event.trigger(\"ajaxError\", [xhr, s, \"canceled\"]);\n }\n endGlobalEvents();\n }\n\n // Fires the start events and beforeSend; false when the upload must not be posted.\n function start() {\n g = s.global;\n // trigger ajax global events so that activity/block indicators work like normal\n if (g && $.active++ === 0) {\n $.event.trigger(\"ajaxStart\");\n }\n\n if (s.beforeSend && s.beforeSend.call(s.context, xhr, s) === false) {\n cancel();\n\n return false;\n }\n\n if (xhr.aborted) {\n // abort() in beforeSend already completed the upload\n return false;\n }\n\n if (g) {\n $.event.trigger(\"ajaxSend\", [xhr, s]);\n }\n\n // an ajaxSend handler may abort too\n return !xhr.aborted;\n }\n\n // Resolves the upload; returns {error} when the success callback threw.\n function succeed(data) {\n var failure;\n\n try {\n s.success.call(s.context, data, \"success\", xhr);\n } catch (err) {\n failure = { error: err };\n }\n\n deferred.resolve(xhr.responseText, \"success\", xhr);\n\n if (g) {\n $.event.trigger(\"ajaxSuccess\", [xhr, s, data]);\n }\n\n return failure;\n }\n\n // Settles the upload with the response reader's {status, data, errMsg}.\n function settle(result) {\n var status = result.status,\n errMsg = result.errMsg;\n\n if (xhr.aborted) {\n // abort() completed the upload while its response was processed\n log(\"upload aborted\");\n\n return;\n }\n\n // an emulated HTTP error status wins, as in $.ajax; a parse error is kept otherwise\n if (xhr.status && !((xhr.status >= 200 && xhr.status < 300) || xhr.status === 304)) {\n status = \"error\";\n }\n\n callbackProcessed = true;\n\n // ordering of these callbacks/triggers is odd, but that's how $.ajax does it\n if (status === \"success\") {\n var failure = succeed(result.data);\n\n complete(status);\n if (failure) {\n // the upload is settled; the success callback's exception still reaches the console\n throw failure.error;\n }\n\n return;\n }\n\n if (typeof errMsg === \"undefined\") {\n errMsg = xhr.statusText;\n }\n if (s.error) {\n s.error.call(s.context, xhr, status, errMsg);\n }\n deferred.reject(xhr, \"error\", errMsg);\n if (g) {\n $.event.trigger(\"ajaxError\", [xhr, s, errMsg]);\n }\n\n complete(status);\n }\n\n return {\n xhr: xhr,\n deferred: deferred,\n start: start,\n done: done,\n abort: abort,\n settle: settle,\n // Settles an upload that failed with an exception (ignored once aborted).\n fail: function (err) {\n settle({ status: \"error\", errMsg: err });\n },\n // Runs `onTimeout` after s.timeout, when set.\n startTimer: function (onTimeout) {\n if (s.timeout) {\n timeoutHandle = setTimeout(onTimeout, s.timeout);\n }\n },\n stopTimer: function () {\n clearTimeout(timeoutHandle);\n timeoutHandle = undefined;\n },\n };\n}\n","import {\n addCsrfField,\n addExtraInputs,\n addSubmitterFields,\n restoreAttributes,\n saveAttributes,\n setUploadAttributes,\n submitForm,\n} from \"./iframe-post.js\";\nimport { closestByTag, formMember } from \"./form-members.js\";\nimport { deprecate, log } from \"./diagnostics.js\";\nimport { getDoc, readResponse } from \"./iframe-response.js\";\nimport { createLifecycle } from \"./iframe-lifecycle.js\";\nimport jQuery from \"jquery\";\nimport { keepContext } from \"./options.js\";\n\n// The iframe transport: posts the form itself into a hidden frame and reads the response from it,\n// for file uploads without the File API or when the iframe option asks for it.\nvar $ = jQuery;\n\n/**\n * The iframe send step. `hasProp` is what the entry detected at load; `forms.property` reads a\n * form property as attr2 does.\n */\nexport function createIframeTransport(hasProp, forms) {\n var CLIENT_TIMEOUT_ABORT = 1;\n var SERVER_ABORT = 2;\n // tells apart the frames of uploads that start in the same millisecond\n var frameCount = 0;\n\n // ensure that every serialized input is still enabled\n function enableControls(elements) {\n for (var i = 0; i < elements.length; i++) {\n var el = $(elements[i]);\n\n if (hasProp) {\n el.prop(\"disabled\", false);\n } else {\n el.removeAttr(\"disabled\");\n }\n }\n }\n\n // Names the frame's window, when the page may: a cross-origin or sandboxed frame refuses.\n function nameWindow(frame, name) {\n try {\n if (frame.contentWindow) {\n frame.contentWindow.name = name;\n }\n } catch (ignore) {}\n }\n\n // The frame the form posts into: the iframeTarget, named `id` when it has no name, or a new\n // hidden frame named `id`. Returns the frame and the name the form targets.\n function createFrame(s, id, ownerDocument) {\n var $io, n;\n\n if (s.iframeTarget) {\n $io = $(s.iframeTarget, ownerDocument);\n n = $io.attr(\"name\");\n if (!n) {\n $io.attr(\"name\", id);\n // a frame already in the page keeps the browsing context name it was inserted with\n $io.each(function () {\n nameWindow(this, id);\n });\n } else {\n id = n;\n }\n } else {\n var io = ownerDocument.createElement(\"iframe\");\n\n io.setAttribute(\"name\", id);\n io.setAttribute(\"src\", s.iframeSrc);\n $io = $(io);\n $io.css({ position: \"absolute\", top: \"-1000px\", left: \"-1000px\" });\n }\n\n return { $io: $io, id: id };\n }\n\n // The frame hooks the lifecycle calls: stop a load in progress, and release after the upload.\n function frameHooks(s, $io) {\n return {\n stop: function () {\n try {\n // #214, #257\n if ($io[0].contentWindow.document.execCommand) {\n $io[0].contentWindow.document.execCommand(\"Stop\");\n }\n } catch (ignore) {}\n\n $io.attr(\"src\", s.iframeSrc); // abort op in progress\n },\n release: function () {\n if (!s.iframeTarget) {\n $io.remove();\n } else {\n // adding else to clean up existing iframe response.\n $io.attr(\"src\", s.iframeSrc);\n }\n },\n };\n }\n\n function listen(io, cb) {\n if (io.attachEvent) {\n io.attachEvent(\"onload\", cb);\n } else {\n io.addEventListener(\"load\", cb, false);\n }\n }\n\n function unlisten(io, cb) {\n if (io.detachEvent) {\n io.detachEvent(\"onload\", cb);\n } else {\n io.removeEventListener(\"load\", cb, false);\n }\n }\n\n // private function for handling file uploads (hat tip to YAHOO!)\n function fileUploadIframe(submission) {\n var form = submission.form,\n method = submission.method;\n\n var s = keepContext($.extend(true, {}, $.ajaxSettings, submission.options), [\n $.ajaxSettings,\n submission.options,\n ]);\n\n s.context = s.context || s;\n var ownerDocument = formMember(form, \"ownerDocument\");\n var $body = $(closestByTag(form, [\"body\"]));\n var frame = createFrame(s, \"jqFormIO\" + new Date().getTime() + frameCount++, ownerDocument);\n var $io = frame.$io,\n io = $io[0];\n var life = createLifecycle(s, frameHooks(s, $io));\n var domCheckCount = 50;\n\n if (!life.start()) {\n return life.deferred;\n }\n\n addSubmitterFields(s, form);\n addCsrfField(s, form, method, forms);\n\n // look for server aborts\n function checkState() {\n try {\n var state = getDoc(io).readyState;\n\n log(\"state = \" + state);\n if (state && state.toLowerCase() === \"uninitialized\") {\n setTimeout(checkState, 50);\n }\n } catch (e) {\n log(\"Server abort: \", e, \" (\", e.name, \")\");\n cb(SERVER_ABORT);\n life.stopTimer();\n }\n }\n\n // take a breath so that pending repaints get some cpu time before the upload starts\n function doSubmit() {\n var saved = saveAttributes(form);\n\n setUploadAttributes(form, frame.id, method, s, forms);\n\n // support timout\n life.startTimer(function () {\n cb(CLIENT_TIMEOUT_ABORT);\n });\n\n // add \"extra\" data to form if provided in options\n var extraInputs = [];\n\n try {\n addExtraInputs(form, ownerDocument, s.extraData, submission.traditional, extraInputs);\n\n if (!s.iframeTarget) {\n // add iframe to doc and submit the form\n $io.appendTo($body);\n }\n\n // A connected form posting into a frame outside the document opens a new window.\n var root = ownerDocument.documentElement;\n\n if (io && $.contains(root, form) && !$.contains(root, io)) {\n var notInDocument = \"jquery.form: the upload frame is not in the document\";\n\n life.abort(notInDocument, [life.xhr, \"error\", notInDocument], \"error\");\n\n return;\n }\n\n listen(io, cb);\n setTimeout(checkState, 15);\n submitForm(form);\n } finally {\n // reset attrs and remove \"extra\" input elements\n restoreAttributes(form, saved);\n $(extraInputs).remove();\n }\n }\n\n // Reads the next document by Opera's rules: false once the retries are used up.\n function retry() {\n if (--domCheckCount) {\n log(\"requeing onLoad callback, DOM not available\");\n setTimeout(cb, 250);\n\n return true;\n }\n\n return false;\n }\n\n function cb(e) {\n if (life.done()) {\n return;\n }\n\n var doc = getDoc(io);\n\n if (!doc) {\n log(\"cannot access response document\");\n e = SERVER_ABORT;\n }\n if (e === CLIENT_TIMEOUT_ABORT) {\n life.abort(\"timeout\", [life.xhr, \"timeout\"]);\n\n return;\n }\n if (e === SERVER_ABORT) {\n life.abort(\"server abort\", [life.xhr, \"error\", \"server abort\"]);\n\n return;\n }\n\n if (doc.location.href === s.iframeSrc) {\n // response not received yet\n return;\n }\n\n unlisten(io, cb);\n\n var result = readResponse(doc, life.xhr, s, retry);\n\n if (result) {\n life.settle(result);\n }\n }\n\n // An exception while posting settles the upload with \"error\" and the exception.\n function post() {\n if (life.done()) {\n // aborted before the delayed post\n return;\n }\n\n try {\n doSubmit();\n } catch (err) {\n log(\"upload failed: \", err);\n life.fail(err);\n }\n }\n\n if (s.forceSync) {\n post();\n } else {\n setTimeout(post, 10); // this lets dom updates render\n }\n\n return life.deferred;\n }\n\n return function sendIframe(submission) {\n var jqxhr;\n\n // now, while the controls are still listed: ajaxSubmit clears the list when it returns,\n // before a closeKeepAlive request completes\n enableControls(submission.controls);\n\n // hack to fix Safari hang (thanks to Tim Molendijk for this)\n // see: http://groups.google.com/group/jquery-dev/browse_thread/thread/36395b7ab510dd5d\n if (submission.options.closeKeepAlive) {\n deprecate(\"closeKeepAlive\", \"closeKeepAlive works around a Safari 3/4 bug and is deprecated\");\n $.get(submission.options.closeKeepAlive, function () {\n jqxhr = fileUploadIframe(submission);\n });\n } else {\n jqxhr = fileUploadIframe(submission);\n }\n\n return jqxhr;\n };\n}\n","import { deprecate, log } from \"./diagnostics.js\";\nimport { assertRealParent } from \"./form-members.js\";\nimport jQuery from \"jquery\";\nimport { keepContext } from \"./options.js\";\nimport { urlencodedFields } from \"./successful-controls.js\";\n\n// A Submission is one ajaxSubmit call once its vetoes have passed:\n// { form, $form, fields, controls, options, method, traditional }. `options` is the object the\n// callbacks and events receive; later steps change it in place.\n\n/**\n * The submission steps. `feature` holds what the entry detected at load (fileapi, formdata), and\n * `forms` reads form attributes and attr2-style properties (attribute, property), and\n * `serialization` collects the form's fields and controls.\n */\nexport function createSubmission(feature, forms, serialization) {\n var $ = jQuery;\n\n function refuse(message) {\n log(message);\n\n return null;\n }\n\n // The options merged over the form's action, the method, and the ajax defaults.\n function withDefaults(form, options, method) {\n var action = options.url || forms.property(form, \"action\");\n var url = typeof action === \"string\" ? action.trim() : \"\";\n\n // clean url (don't include hash value); an action that is only a fragment means this page\n url = url.split(\"#\")[0] || window.location.href.split(\"#\")[0];\n // IE requires javascript:false in https, but this breaks chrome >83 and goes against spec.\n // Instead of using javascript:false always, let's only apply it for IE.\n var isMsie = /(MSIE|Trident)/.test(navigator.userAgent || \"\");\n var iframeSrc = isMsie && /^https/i.test(document.URL) ? \"javascript:false\" : \"about:blank\"; // eslint-disable-line no-script-url\n\n var merged = $.extend(\n true,\n {\n url: url,\n success: $.ajaxSettings.success,\n type: method || $.ajaxSettings.type,\n iframeSrc: iframeSrc,\n },\n options\n );\n\n return keepContext(merged, [options]);\n }\n\n /**\n * The one method every transport sends, read after the hooks: `method` wins over `type`, and\n * `type` is set to it. Undefined when only the ajax default applies, so each transport keeps\n * its own default.\n */\n function resolveMethod(options, defaultType) {\n var resolved = options.method || options.type;\n\n options.type = resolved;\n\n return resolved === defaultType && !options.method ? undefined : resolved;\n }\n\n // The data option, kept as extraData and encoded, or undefined without one.\n function extraQuery(fields, options, traditional) {\n if (!options.data) {\n return undefined;\n }\n\n var optionsData = typeof options.data === \"function\" ? options.data(fields) : options.data;\n\n if (typeof optionsData === \"string\") {\n if (options.requestFormat === \"json\") {\n throw new Error(\n 'jquery.form: requestFormat \"json\" needs object data; a string data option is a query string'\n );\n }\n\n // a query string: sent as-is when urlencoded, as its own fields otherwise\n options.extraData = queryPairs(optionsData);\n\n return optionsData;\n }\n\n options.extraData = optionsData;\n\n return $.param(optionsData, traditional);\n }\n\n // Sets a key as an own data property, so a name like __proto__ is an ordinary key.\n function defineKey(object, key, value) {\n Object.defineProperty(object, key, {\n value: value,\n enumerable: true,\n writable: true,\n configurable: true,\n });\n }\n\n /**\n * requestFormat \"json\" (#545): the fields as an object (a repeated name gives an array), merged\n * with object data, sent as a JSON body. Based on the idea in PR #557 by zhangciwu.\n */\n function jsonBody(options, fields) {\n if (/^get$/i.test(options.type)) {\n throw new Error('jquery.form: requestFormat \"json\" needs a method with a body, such as POST');\n }\n\n var body = {};\n var own = Object.prototype.hasOwnProperty;\n\n for (var i = 0; i < fields.length; i++) {\n var name = fields[i].name;\n\n if (!own.call(body, name)) {\n defineKey(body, name, fields[i].value);\n } else if (Array.isArray(body[name])) {\n body[name].push(fields[i].value);\n } else {\n defineKey(body, name, [body[name], fields[i].value]);\n }\n }\n\n var extra = options.extraData;\n\n for (var key in extra) {\n if (own.call(extra, key)) {\n defineKey(body, key, extra[key]);\n }\n }\n\n options.data = JSON.stringify(body);\n options.contentType = \"application/json; charset=UTF-8\";\n }\n\n // The fields of a query string, as the { name, value } list $.param takes.\n function queryPairs(query) {\n var pairs = [];\n var parts = query.split(\"&\");\n\n for (var i = 0; i < parts.length; i++) {\n if (parts[i]) {\n var at = parts[i].indexOf(\"=\");\n var name = at < 0 ? parts[i] : parts[i].slice(0, at);\n var value = at < 0 ? \"\" : parts[i].slice(at + 1);\n\n pairs.push({ name: decodeQuery(name), value: decodeQuery(value) });\n }\n }\n\n return pairs;\n }\n\n function decodeQuery(text) {\n return decodeURIComponent(text.replace(/\\+/g, \" \"));\n }\n\n // Puts the encoded fields in the url for a get, and in the data otherwise.\n function encode(options, q, qx) {\n if (qx) {\n q = q ? q + \"&\" + qx : qx;\n }\n\n if (options.type.toUpperCase() === \"GET\") {\n // the query goes before any fragment in the url option\n var hashAt = options.url.indexOf(\"#\");\n var base = hashAt < 0 ? options.url : options.url.slice(0, hashAt);\n\n options.url =\n base + (base.indexOf(\"?\") >= 0 ? \"&\" : \"?\") + q + options.url.slice(base.length);\n options.data = null; // data is null for 'get'\n } else {\n options.data = q; // data is the query string for 'post'\n }\n }\n\n // A callback option as a list: an array as given, one function, or none.\n function callbackList(callback) {\n if (Array.isArray(callback)) {\n return callback;\n }\n\n return callback ? [callback] : [];\n }\n\n // Calls each callback in order with the same this and arguments.\n function callEach(callbacks, context, args) {\n for (var i = 0; i < callbacks.length; i++) {\n callbacks[i].apply(context, args);\n }\n }\n\n /**\n * Resolves the options, serializes the form, and runs the vetoes: the Submission, or null when\n * an event or callback stopped it.\n */\n function prepare($set, options) {\n $set.each(function () {\n assertRealParent(this);\n });\n\n var form = $set[0];\n var method = options.method || options.type || forms.property(form, \"method\");\n\n options = withDefaults(form, options, method);\n\n // the ajax default type, when neither the caller nor the form gave a method\n var defaultType = method ? undefined : options.type;\n\n // hook for manipulating the form data before it is extracted;\n // convenient for use with rich editors like tinyMCE or FCKEditor\n var veto = {};\n\n $set.trigger(\"form-pre-serialize\", [$set, options, veto]);\n if (veto.veto) {\n return refuse(\"ajaxSubmit: submit vetoed via form-pre-serialize trigger\");\n }\n\n // provide opportunity to alter form data before it is serialized\n if (options.beforeSerialize && options.beforeSerialize($set, options) === false) {\n return refuse(\"ajaxSubmit: submit aborted via beforeSerialize callback\");\n }\n\n var traditional = options.traditional;\n\n if (typeof traditional === \"undefined\") {\n traditional = $.ajaxSettings.traditional;\n }\n\n var collected = serialization.collect($set[0], options.semantic, options.filtering);\n var fields = collected.fields;\n var controls = collected.controls;\n var qx = extraQuery(fields, options, traditional);\n\n // give pre-submit callback an opportunity to abort the submit\n if (options.beforeSubmit && options.beforeSubmit(fields, $set, options) === false) {\n return refuse(\"ajaxSubmit: submit aborted via beforeSubmit callback\");\n }\n\n // fire vetoable 'validate' event\n $set.trigger(\"form-submit-validate\", [fields, $set, options, veto]);\n if (veto.veto) {\n return refuse(\"ajaxSubmit: submit vetoed via form-submit-validate trigger\");\n }\n\n method = resolveMethod(options, defaultType);\n\n if (options.requestFormat === \"json\") {\n jsonBody(options, fields);\n } else {\n encode(options, $.param(urlencodedFields(fields), traditional), qx);\n }\n\n return {\n form: form,\n $form: $set,\n fields: fields,\n controls: controls,\n options: options,\n method: method,\n traditional: traditional,\n };\n }\n\n /**\n * Wraps success, error and complete (a function or an array of them, as $.ajax takes) so each\n * also receives the form, and adds the resetForm,\n * clearForm and target steps before the success callbacks.\n */\n function deliver(submission) {\n var $set = submission.$form;\n var options = submission.options;\n var callbacks = [];\n\n if (options.resetForm) {\n callbacks.push(function () {\n $set.resetForm();\n });\n }\n\n if (options.clearForm) {\n callbacks.push(function () {\n $set.clearForm(options.includeHidden);\n });\n }\n\n // perform a load on the target only if dataType is not provided\n if (!options.dataType && options.target) {\n var successes = callbackList(options.success);\n\n callbacks.push(function (data, textStatus, jqXHR) {\n var successArguments = arguments,\n fn = options.replaceTarget ? \"replaceWith\" : \"html\",\n $target = $(options.target);\n\n // Only a string response is inserted. jQuery has already parsed a JSON or XML response,\n // and inserting it would parse each of its strings as HTML.\n if (typeof data === \"string\") {\n $target[fn](data);\n } else {\n log(\"target: the response was parsed by jQuery, so it is not inserted\");\n }\n\n if (!$target.length) {\n // nothing to fill: success still runs once, with the normal context\n callEach(successes, this, successArguments);\n }\n\n $target.each(function () {\n callEach(successes, this, successArguments);\n });\n });\n } else {\n $.merge(callbacks, callbackList(options.success));\n }\n\n options.success = function (data, status, xhr) {\n // jQuery 1.4+ passes xhr as 3rd arg\n var context = options.context || this; // jQuery 1.4+ supports scope context\n\n for (var i = 0, max = callbacks.length; i < max; i++) {\n callbacks[i].apply(context, [data, status, xhr || $set, $set]);\n }\n };\n\n if (options.error) {\n var errors = callbackList(options.error);\n\n options.error = function (xhr, status, error) {\n callEach(errors, options.context || this, [xhr, status, error, $set]);\n };\n }\n\n if (options.complete) {\n var completes = callbackList(options.complete);\n\n options.complete = function (xhr, status) {\n callEach(completes, options.context || this, [xhr, status, $set]);\n };\n }\n }\n\n /**\n * The transport for a submission: \"iframe\" for files without the File API or when forced,\n * \"formdata\" for files with it, \"ajax\" otherwise.\n */\n function chooseTransport(submission) {\n var $set = submission.$form;\n var options = submission.options;\n\n // [value] (issue #113), also see comment:\n // https://github.com/malsup/form/commit/588306aedba1de01388032d5f42a60159eea9228#commitcomment-2180219\n // and the file inputs outside the form that belong to it through their form attribute\n var fileInputs = $(\"input[type=file]:enabled\", $set)\n .add($(submission.controls).filter(\"input[type=file]\"))\n .filter(function () {\n return $(this).val() !== \"\";\n });\n var hasFileInputs = fileInputs.length > 0;\n // compared as the browser does: ASCII case-insensitive, without surrounding whitespace\n var mp = /^[\\t\\n\\f\\r ]*multipart\\/form-data[\\t\\n\\f\\r ]*$/i;\n var multipart =\n mp.test(forms.attribute($set[0], \"enctype\")) || mp.test(forms.attribute($set[0], \"encoding\"));\n var fileAPI = feature.fileapi && feature.formdata;\n\n log(\"fileAPI :\" + fileAPI);\n\n var shouldUseFrame = (hasFileInputs || multipart) && !fileAPI;\n\n var transport = (hasFileInputs || multipart) && fileAPI ? \"formdata\" : \"ajax\";\n\n // options.iframe allows user to force iframe mode\n // 06-NOV-09: now defaulting to iframe mode if file input is detected\n if (options.iframe !== false && (options.iframe || shouldUseFrame)) {\n transport = \"iframe\";\n }\n\n if (transport === \"iframe\" && !options.iframe) {\n deprecate(\n \"iframe\",\n \"choosing the iframe transport automatically without FormData is deprecated, set iframe: true\"\n );\n }\n\n if (transport !== \"ajax\" && options.requestFormat === \"json\") {\n throw new Error(\n 'jquery.form: requestFormat \"json\" cannot send files or use the iframe transport'\n );\n }\n\n return transport;\n }\n\n return { prepare: prepare, deliver: deliver, chooseTransport: chooseTransport };\n}\n","/*!\n * jQuery Form Plugin\n * version: 4.5.0\n * Requires jQuery v1.7.2 or later\n * Project repository: https://github.com/jquery-form/form\n\n * Copyright 2017 Kevin Morris\n * Copyright 2006 M. Alsup\n\n * Dual licensed under the LGPL-2.1+ or MIT licenses\n * https://github.com/jquery-form/form#license\n\n * This library is free software; you can redistribute it and/or\n * modify it under the terms of the GNU Lesser General Public\n * License as published by the Free Software Foundation; either\n * version 2.1 of the License, or (at your option) any later version.\n * This library is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n */\nimport { ajaxForm, ajaxFormUnbind } from \"./ajax-form.js\";\nimport { callFormMethod, tagName } from \"./form-members.js\";\nimport {\n createSuccessfulControls,\n isSuccessful,\n urlencodedFields,\n valueOf,\n} from \"./successful-controls.js\";\nimport { deprecate, deprecateOldJQuery, log } from \"./diagnostics.js\";\nimport { sendAjax, sendFormData } from \"./xhr-transport.js\";\nimport { createIframeTransport } from \"./iframe-transport.js\";\nimport { createSubmission } from \"./submission.js\";\nimport { formAttribute } from \"./form-attributes.js\";\nimport jQuery from \"jquery\";\nimport { submitOptions } from \"./options.js\";\nimport { submitterElement } from \"./submitter.js\";\n\n(function ($) {\n \"use strict\";\n\n /*\n\t\tUsage Note:\n\t\t-----------\n\t\tDo not use both ajaxSubmit and ajaxForm on the same form. These\n\t\tfunctions are mutually exclusive. Use ajaxSubmit if you want\n\t\tto bind your own submit handler to the form. For example,\n\n\t\t$(document).ready(function() {\n\t\t\t$('#myForm').on('submit', function(e) {\n\t\t\t\te.preventDefault(); // <-- important\n\t\t\t\t$(this).ajaxSubmit({\n\t\t\t\t\ttarget: '#output'\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\n\t\tUse ajaxForm when you want the plugin to manage all the event binding\n\t\tfor you. For example,\n\n\t\t$(document).ready(function() {\n\t\t\t$('#myForm').ajaxForm({\n\t\t\t\ttarget: '#output'\n\t\t\t});\n\t\t});\n\n\t\tYou can also use ajaxForm with delegation (requires jQuery v1.7+), so the\n\t\tform does not have to exist when you invoke ajaxForm:\n\n\t\t$('#myForm').ajaxForm({\n\t\t\tdelegation: true,\n\t\t\ttarget: '#output'\n\t\t});\n\n\t\tWhen using ajaxForm, the ajaxSubmit function will be invoked for you\n\t\tat the appropriate time.\n\t*/\n\n /**\n * Feature detection\n */\n var feature = {};\n\n feature.fileapi = $('').get(0).files !== undefined;\n feature.formdata = typeof window.FormData !== \"undefined\";\n\n var hasProp = !!$.fn.prop;\n // What attr2 returns for a form: the property when it is a string, otherwise the attribute. The\n // property is read plainly on purpose: a control named like it shadows it, and then the raw\n // attribute is used.\n function formProperty(form, name) {\n var value = hasProp ? form[name] : undefined;\n\n return typeof value === \"string\" ? value : formAttribute(form, name);\n }\n\n var forms = { attribute: formAttribute, property: formProperty };\n var serialization = createSuccessfulControls(feature);\n var steps = createSubmission(feature, forms, serialization);\n var transports = {\n iframe: createIframeTransport(hasProp, forms),\n formdata: sendFormData,\n ajax: sendAjax,\n };\n\n // attr2 uses prop when it can but checks the return type for\n // an expected string. This accounts for the case where a form\n // contains inputs with names like \"action\" or \"method\"; in those\n // cases \"prop\" returns the element\n $.fn.attr2 = function () {\n deprecate(\"attr2\", \"attr2 is deprecated, use .prop() or .attr()\");\n\n if (!hasProp) {\n return this.attr.apply(this, arguments);\n }\n\n var val = this.prop.apply(this, arguments);\n\n if ((val && val.jquery) || typeof val === \"string\") {\n return val;\n }\n\n return this.attr.apply(this, arguments);\n };\n\n /**\n * ajaxSubmit() provides a mechanism for immediately submitting\n * an HTML form using AJAX.\n *\n * @param\t{object|string}\toptions\t\tjquery.form.js parameters or custom url for submission\n * @param\t{object}\t\tdata\t\textraData\n * @param\t{string}\t\tdataType\tajax dataType\n * @param\t{function}\t\tonSuccess\tajax success callback function\n */\n $.fn.ajaxSubmit = function (options, data, dataType, onSuccess) {\n deprecateOldJQuery($.fn.jquery);\n\n // fast fail if nothing selected (http://dev.jquery.com/ticket/2752)\n if (!this.length) {\n log(\"ajaxSubmit: skipping submit process - no element selected\");\n\n return this;\n }\n\n // #541: jQuery's slim build has no $.ajax\n if (!$.ajax) {\n throw new Error(\n \"jquery.form: ajaxSubmit needs the full jQuery build; this jQuery has no $.ajax\"\n );\n }\n\n var submission = steps.prepare(this, submitOptions(options, data, dataType, onSuccess));\n\n if (!submission) {\n return this;\n }\n\n steps.deliver(submission);\n\n var jqxhr = transports[steps.chooseTransport(submission)](submission);\n\n this.removeData(\"jqxhr\").data(\"jqxhr\", jqxhr);\n\n // clear element array\n for (var k = 0; k < submission.controls.length; k++) {\n submission.controls[k] = null;\n }\n\n // fire 'notify' event\n this.trigger(\"form-submit-notify\", [this, submission.options]);\n\n return this;\n };\n\n $.fn.ajaxForm = ajaxForm;\n $.fn.ajaxFormUnbind = ajaxFormUnbind;\n\n /**\n * formToArray() gathers form element data into an array of objects that can\n * be passed to any of the following ajax functions: $.get, $.post, or load.\n * Each object in the array has both a 'name' and 'value' property. An example of\n * an array for a simple login form might be:\n *\n * [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ]\n *\n * It is this array that is passed to pre-submit callback functions provided to the\n * ajaxSubmit() and ajaxForm() methods.\n */\n $.fn.formToArray = function (semantic, elements, filtering) {\n var collected = serialization.collect(this[0], semantic, filtering);\n\n if (elements) {\n elements.push.apply(elements, collected.controls);\n }\n\n return collected.fields;\n };\n\n /**\n * Serializes form data into a 'submittable' string. This method will return a string\n * in the format: name1=value1&name2=value2\n */\n $.fn.formSerialize = function (semantic) {\n // hand off to jQuery.param for proper encoding\n return $.param(urlencodedFields(this.formToArray(semantic)));\n };\n\n /**\n * Serializes all field elements in the jQuery object into a query string.\n * This method will return a string in the format: name1=value1&name2=value2\n */\n $.fn.fieldSerialize = function (successful) {\n var a = [];\n\n this.each(function () {\n var n = this.name;\n\n // a form is not a field, though it may have a name\n if (!n || tagName(this) === \"form\") {\n return;\n }\n\n var v = $.fieldValue(this, successful);\n\n if (v && v.constructor === Array) {\n for (var i = 0, max = v.length; i < max; i++) {\n a.push({ name: n, value: v[i] });\n }\n } else if (v !== null && typeof v !== \"undefined\") {\n a.push({ name: this.name, value: v });\n }\n });\n\n // hand off to jQuery.param for proper encoding\n return $.param(urlencodedFields(a));\n };\n\n /**\n * Returns the value(s) of the element in the matched set. For example, consider the following form:\n *\n *\t
\n *\t\t\n *\t\t\n *\t\t\n *\t\t\n *\t\t\n *\t\t\n *\t
\n *\n *\tvar v = $('input[type=text]').fieldValue();\n *\t// if no values are entered into the text inputs\n *\tv === ['','']\n *\t// if values entered into the text inputs are 'foo' and 'bar'\n *\tv === ['foo','bar']\n *\n *\tvar v = $('input[type=checkbox]').fieldValue();\n *\t// if neither checkbox is checked\n *\tv === undefined\n *\t// if both checkboxes are checked\n *\tv === ['B1', 'B2']\n *\n *\tvar v = $('input[type=radio]').fieldValue();\n *\t// if neither radio is checked\n *\tv === undefined\n *\t// if first radio is checked\n *\tv === ['C1']\n *\n * The successful argument controls whether or not the field element must be 'successful'\n * (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls).\n * The default value of the successful argument is true. If this value is false the value(s)\n * for each element is returned.\n *\n * Note: This method *always* returns an array. If no valid value can be determined the\n *\tarray will be empty, otherwise it will contain one or more values.\n */\n $.fn.fieldValue = function (successful) {\n for (var val = [], i = 0, max = this.length; i < max; i++) {\n var el = this[i];\n var v = $.fieldValue(el, successful);\n\n if (v === null || typeof v === \"undefined\" || (v.constructor === Array && !v.length)) {\n continue;\n }\n\n if (v.constructor === Array) {\n $.merge(val, v);\n } else {\n val.push(v);\n }\n }\n\n return val;\n };\n\n /**\n * Returns the value of the field element.\n */\n $.fieldValue = function (el, successful) {\n var required = typeof successful === \"undefined\" || successful;\n\n if (required && !isSuccessful(el, submitterElement(el.form))) {\n return null;\n }\n\n return valueOf(el);\n };\n\n /**\n * Clears the form data. Takes the following actions on the form's input fields:\n * - input text fields will have their 'value' property set to the empty string\n * - select elements will have their 'selectedIndex' property set to -1\n * - checkbox and radio inputs will have their 'checked' property set to false\n * - inputs of type submit, button, reset, and hidden will *not* be effected\n * - button elements will *not* be effected\n */\n $.fn.clearForm = function (includeHidden) {\n return this.each(function () {\n $(\"input,select,textarea\", this).clearFields(includeHidden);\n });\n };\n\n /**\n * Clears the selected form elements.\n */\n $.fn.clearInputs = function (includeHidden) {\n deprecate(\"clearInputs\", \"clearInputs is deprecated, use clearFields\");\n\n return this.clearFields(includeHidden);\n };\n\n $.fn.clearFields = function (includeHidden) {\n var re =\n /^(?:color|date|datetime|datetime-local|email|month|number|password|range|search|tel|text|time|url|week)$/i; // 'hidden' is not in this list\n\n return this.each(function () {\n var t = this.type,\n tag = tagName(this);\n\n if (re.test(t) || tag === \"textarea\") {\n this.value = \"\";\n } else if (t === \"checkbox\" || t === \"radio\") {\n this.checked = false;\n } else if (tag === \"select\") {\n this.selectedIndex = -1;\n } else if (t === \"file\") {\n if (/MSIE/.test(navigator.userAgent)) {\n $(this).replaceWith($(this).clone(true));\n } else {\n $(this).val(\"\");\n }\n } else if (includeHidden) {\n // includeHidden can be the value true, or it can be a selector string\n // indicating a special test; for example:\n // $('#myForm').clearForm('.special:hidden')\n // the above would clean hidden inputs that have the class of 'special'\n if (\n (includeHidden === true && /hidden/.test(t)) ||\n (typeof includeHidden === \"string\" && $(this).is(includeHidden))\n ) {\n this.value = \"\";\n }\n }\n });\n };\n\n /**\n * Resets the form data or individual elements. Takes the following actions\n * on the selected tags:\n * - all fields within form elements will be reset to their original value\n * - input / textarea / select fields will be reset to their original value\n * - option / optgroup fields (for multi-selects) will defaulted individually\n * - non-multiple options will find the right select to default\n * - label elements will be searched against its 'for' attribute\n * - all others will be searched for appropriate children to default\n */\n $.fn.resetForm = function () {\n return this.each(function () {\n var el = $(this);\n var tag = tagName(this);\n\n switch (tag) {\n case \"input\":\n this.checked = this.defaultChecked;\n\n // as the native reset: types whose value is the value attribute keep it\n if (this.type === \"file\") {\n // a file input cannot take its value attribute; the native reset empties it\n this.value = \"\";\n } else if (!/^(?:checkbox|radio|hidden|submit|reset|button|image)$/.test(this.type)) {\n this.value = this.defaultValue;\n }\n\n return true;\n\n case \"textarea\":\n this.value = this.defaultValue;\n\n return true;\n\n case \"option\":\n case \"optgroup\":\n var select = el.parents(\"select\");\n\n if (select.length && select[0].multiple) {\n if (tag === \"option\") {\n this.selected = this.defaultSelected;\n } else {\n el.find(\"option\").resetForm();\n }\n } else {\n select.resetForm();\n }\n\n return true;\n\n case \"select\":\n // in order, as the native reset: of several default options, a single select keeps the last\n el.find(\"option\").each(function () {\n this.selected = this.defaultSelected;\n });\n\n return true;\n\n case \"label\":\n // The control whose id the for attribute names, and the controls inside the label. The\n // filter keeps a for that names an ancestor from resetting the label again.\n var forEl = this.htmlFor && this.ownerDocument.getElementById(this.htmlFor);\n\n el.find(\"input,select,textarea\").add(forEl).filter(\"input,select,textarea\").resetForm();\n\n return true;\n\n case \"form\":\n // through the prototype: a control named reset shadows the method\n callFormMethod(this, \"reset\");\n\n return true;\n\n default:\n el.find(\"form,input,label,select,textarea\").resetForm();\n\n return true;\n }\n });\n };\n\n /**\n * Enables or disables any matching elements.\n */\n $.fn.enable = function (b) {\n if (typeof b === \"undefined\") {\n b = true;\n }\n\n return this.each(function () {\n this.disabled = !b;\n });\n };\n\n /**\n * Checks/unchecks any matching checkboxes or radio buttons and\n * selects/deselects and matching option elements.\n */\n $.fn.selected = function (select) {\n if (typeof select === \"undefined\") {\n select = true;\n }\n\n return this.each(function () {\n var t = this.type;\n\n if (t === \"checkbox\" || t === \"radio\") {\n this.checked = select;\n } else if (tagName(this) === \"option\") {\n var $sel = $(this).parent(\"select\");\n\n if (select && $sel[0] && $sel[0].type === \"select-one\") {\n // deselect all other options\n $sel.find(\"option\").selected(false);\n }\n\n this.selected = select;\n }\n });\n };\n\n // expose debug var\n $.fn.ajaxSubmit.debug = false;\n})(jQuery);\n\nexport default jQuery;\n"],"names":["owners","plainForm","document","createElement","findDescriptor","name","i","length","owner","window","descriptor","Object","getOwnPropertyDescriptor","prototype","formMember","form","get","call","e","callFormMethod","value","apply","Array","slice","arguments","tagName","el","toLowerCase","isElement","node","assertRealParent","parentNode","Error","closestByTag","names","indexOf","storeKey","setExpando","ignore","expando","els","namedItem","undefined","record","x","y","jQuery","data","type","setTimeout","captureSubmitter","target","point","offsetX","offsetY","fn","offset","pageX","left","pageY","top","offsetLeft","offsetTop","imagePoint","submitterOf","stored","log","ajaxSubmit","debug","msg","join","console","opera","postError","warned","deprecate","id","message","warn","deprecateOldJQuery","version","parts","String","split","major","Number","beforeJQuery35","shorthandOptions","options","dataType","onSuccess","result","url","success","submitOptions","key","hasOwnProperty","withoutUrl","keepContext","settings","sources","context","submitWith","isDefaultPrevented","preventDefault","originalEvent","submitter","captureEventSubmitter","doAjaxSubmit","captureSubmittingElement","this","bindDelegated","$sel","selector","off","on","closestMatch","Element","closest","is","delegated","unbindSelector","handlers","submit","click","selectionOnly","ajaxForm","jquery","delegation","bindSelector","beforeFormUnbind","ajaxFormUnbind","o","s","c","isReady","bindLater","formAttribute","attr","rLineBreak","rCR","rUnsubmittable","isDisabled","matches","disabled","valueOf","index","selectedIndex","a","ops","one","max","op","selected","v","attributes","specified","text","push","selectValue","val","raw","replace","loneSurrogate","wellFormed","match","before","urlencodedFields","fields","map","field","createSuccessfulControls","feature","$","controlsOf","semantic","formId","getElementsByTagName","makeArray","grep","ownedBy","test","navigator","userAgent","concat","filter","getAttribute","inArray","outsideControls","fieldsOf","n","fieldValue","constructor","fileapi","files","file","required","imageFields","sub","input","addCandidate","collected","own","controls","collect","filtering","addClickedImage","deepSerialize","extraData","traditional","part","param","serialized","len","decodeURIComponent","sendFormData","submission","formdata","FormData","append","serializedData","extend","ajaxSettings","contentType","processData","cache","method","uploadProgress","createXhr","xhr","upload","addEventListener","event","percent","position","loaded","total","lengthComputable","Math","ceil","beforeSend","formData","ajax","sendAjax","uploadAttributes","hasOwn","isGet","addSubmitterFields","submitterFields","addCsrfField","forms","origin","csrf_token","csrf_param","posts","property","href","location","protocol","host","setFormAttribute","getDoc","frame","doc","contentWindow","err","contentDocument","readStatus","status","statusText","readResponse","retry","errMsg","isXml","XMLDocument","isXMLDoc","body","innerHTML","docRoot","documentElement","responseText","responseXML","getResponseHeader","header","readDocument","dt","scr","textarea","ta","pre","b","textContent","innerText","readEmbedded","ct","xml","nodeName","error","dataFilter","JSON","parse","globalEval","httpData","createLifecycle","g","timeoutHandle","callbackProcessed","deferred","Deferred","aborted","getAllResponseHeaders","setRequestHeader","abort","done","rejection","textStatus","stop","reject","trigger","complete","endGlobalEvents","active","clearTimeout","release","settle","failure","resolve","succeed","start","global","fail","startTimer","onTimeout","timeout","stopTimer","createIframeTransport","hasProp","frameCount","fileUploadIframe","ownerDocument","$body","$io","iframeTarget","each","nameWindow","io","setAttribute","iframeSrc","css","createFrame","Date","getTime","life","execCommand","remove","frameHooks","domCheckCount","checkState","state","readyState","cb","doSubmit","saved","saveAttributes","mp","skipEncodingOverride","setUploadAttributes","extraInputs","added","addHiddenInput","appendTo","isPlainObject","single","f","addExtraInputs","root","contains","notInDocument","attachEvent","listen","submitForm","restoreAttributes","detachEvent","removeEventListener","unlisten","post","forceSync","jqxhr","elements","prop","removeAttr","enableControls","closeKeepAlive","createSubmission","serialization","refuse","extraQuery","optionsData","requestFormat","query","pairs","at","decodeQuery","queryPairs","defineKey","object","defineProperty","enumerable","writable","configurable","callbackList","callback","isArray","callEach","callbacks","args","prepare","$set","action","trim","URL","withDefaults","defaultType","veto","beforeSerialize","qx","beforeSubmit","resolved","resolveMethod","extra","stringify","jsonBody","q","toUpperCase","hashAt","base","encode","$form","deliver","resetForm","clearForm","includeHidden","successes","jqXHR","successArguments","replaceTarget","$target","merge","errors","completes","chooseTransport","hasFileInputs","add","multipart","attribute","fileAPI","shouldUseFrame","transport","iframe","steps","transports","attr2","removeData","k","formToArray","formSerialize","fieldSerialize","successful","t","checked","isSuccessful","clearFields","clearInputs","re","tag","replaceWith","clone","defaultChecked","defaultValue","select","parents","multiple","defaultSelected","find","forEl","htmlFor","getElementById","enable","parent"],"mappings":";;;;;;;;;;;;;;;;;;;;;kRAMA,IAAIA,EAAS,CAAC,kBAAmB,cAAe,UAAW,QAGvDC,EAAYC,SAASC,cAAc,QAEvC,SAASC,EAAeC,GACtB,IAAK,IAAIC,EAAI,EAAGA,EAAIN,EAAOO,OAAQD,IAAK,CACtC,IAAIE,EAAQC,OAAOT,EAAOM,IACtBI,EAAaF,GAASG,OAAOC,yBAAyB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AItW,KAAK9D,KAEb,GAAU,aAANoa,GAA0B,UAANA,EACtBtW,KAAKuW,QAAUU,OACV,GAAsB,WAAlBtc,EAAQqF,MAAoB,CACrC,IAAIE,EAAO6D,EAAE/D,MAAM0X,OAAO,UAEtBT,GAAU/W,EAAK,IAAuB,eAAjBA,EAAK,GAAGhE,MAE/BgE,EAAKmX,KAAK,UAAU1U,UAAS,GAG/B3C,KAAK2C,SAAWsU,CAClB,CACF,EACF,EAGAlT,EAAEtH,GAAGY,WAAWC,OAAQ,CACzB,CAlcD,CAkcGtB"} \ No newline at end of file diff --git a/dist/jquery.form.mjs b/dist/jquery.form.mjs index 52938ed..f97160b 100644 --- a/dist/jquery.form.mjs +++ b/dist/jquery.form.mjs @@ -1012,7 +1012,7 @@ function addSubmitterFields(s, form) { for (var n in fields) { s.extraData = s.extraData || {}; - s.extraData[n] = fields[n]; + s.extraData[wellFormed(n)] = wellFormed(fields[n]); } } diff --git a/docs/research/4x-behavior-changes.md b/docs/research/4x-behavior-changes.md index 6390e79..3a2630f 100644 --- a/docs/research/4x-behavior-changes.md +++ b/docs/research/4x-behavior-changes.md @@ -114,7 +114,7 @@ Collected as the modernization proceeds. Each entry is a change a consumer could ## Phase 13 -- **A lone surrogate is sent as U+FFFD.** `formSerialize`, `fieldSerialize` and a urlencoded `ajaxSubmit` body threw `URIError` when a name or value held an unpaired UTF-16 surrogate. Each one is now replaced with U+FFFD, as a native form submission and `FormData` do. +- **A lone surrogate is sent as U+FFFD.** `formSerialize`, `fieldSerialize`, a urlencoded `ajaxSubmit` body and the clicked button of an iframe upload threw `URIError` when a name or value held an unpaired UTF-16 surrogate. Each one is now replaced with U+FFFD, as a native form submission and `FormData` do. ## Known behavior, not changed diff --git a/src/iframe-post.js b/src/iframe-post.js index 0ccd286..3192316 100644 --- a/src/iframe-post.js +++ b/src/iframe-post.js @@ -2,6 +2,7 @@ import { callFormMethod } from "./form-members.js"; import { deepSerialize } from "./xhr-transport.js"; import jQuery from "jquery"; import { submitterFields } from "./submitter.js"; +import { wellFormed } from "./successful-controls.js"; // The iframe form post: the extra fields (submitter, CSRF, data), the form attributes set while // posting and restored after, and the native submit. @@ -38,7 +39,7 @@ export function addSubmitterFields(s, form) { for (var n in fields) { s.extraData = s.extraData || {}; - s.extraData[n] = fields[n]; + s.extraData[wellFormed(n)] = wellFormed(fields[n]); } } diff --git a/src/successful-controls.js b/src/successful-controls.js index 768ec72..438d05f 100644 --- a/src/successful-controls.js +++ b/src/successful-controls.js @@ -108,7 +108,7 @@ export function valueOf(el) { // A lone surrogate becomes U+FFFD, as in a native submission; jQuery.param would throw. var loneSurrogate = /[\uD800-\uDBFF](?![\uDC00-\uDFFF])|([^\uD800-\uDBFF]|^)([\uDC00-\uDFFF])/g; -function wellFormed(value) { +export function wellFormed(value) { return typeof value === "string" ? value.replace(loneSurrogate, function (match, before) { return (before || "") + "\uFFFD"; diff --git a/test/e2e/seeded-forms.spec.mjs b/test/e2e/seeded-forms.spec.mjs index def4782..1955bc7 100644 --- a/test/e2e/seeded-forms.spec.mjs +++ b/test/e2e/seeded-forms.spec.mjs @@ -20,13 +20,7 @@ const MODES = [ // Known failures: the plugin fails where the native submit posts. Each has an ID and a matcher; // the test then pins the failure, so a fix makes it fail until the entry is removed. -const KNOWN_FAILURES = [ - { - id: "IFRAME-USV-THROW", - description: "an iframe upload whose submitter has a lone surrogate fails with URIError", - matches: (result, mode) => !!mode.options.iframe && /URIError/.test(result.error || ""), - }, -]; +const KNOWN_FAILURES = []; test.describe("seeded forms posted end to end", () => { test.beforeEach(async ({ page }) => { diff --git a/test/suite/iframe-transport.test.js b/test/suite/iframe-transport.test.js index 932398c..b5ecbd0 100644 --- a/test/suite/iframe-transport.test.js +++ b/test/suite/iframe-transport.test.js @@ -1929,6 +1929,21 @@ describe("form", function () { assert.deepEqual(fields, [["choice", "picked"]]); }); + it("should post a clicked button's lone surrogate as U+FFFD", function () { + const $form = createIframeForm("ajax/iframe-text.html"); + const button = $('' + ); + form.setAttribute("action", action); + var transfer = new DataTransfer(); + transfer.items.add(new File(["file bytes"], "a.txt", { type: "text/plain" })); + form.querySelector("input[type=file]").files = transfer.files; + return settle(function (callbacks) { + state.$(form).ajaxForm(state.$.extend({ iframe: true, dataType: "json" }, callbacks)); + form.querySelector("button").click(); + }); + }, + }; +})(); diff --git a/test/e2e/published.spec.mjs b/test/e2e/published.spec.mjs new file mode 100644 index 0000000..46bdc6d --- /dev/null +++ b/test/e2e/published.spec.mjs @@ -0,0 +1,111 @@ +import { readFileSync } from "node:fs"; +import { resolve } from "node:path"; +import { expect, test } from "@playwright/test"; +import { requestId, requests } from "./helpers.mjs"; + +// The packed tarball (scripts/pack-fixture.mjs), loaded by the entry points its package.json +// names, through each loader. Every loader runs the same smoke checks, so the minified build +// must give the same results as the plain one. +const jqueryFile = resolve( + import.meta.dirname, + "../..", + process.env.JQUERY_FILE || "node_modules/jquery/dist/jquery.js" +); +const jqueryVersion = readFileSync(jqueryFile, "utf8").match( + /jQuery JavaScript Library v([\w.-]+)/ +)[1]; +const hasModuleBuild = /^[4-9]\./.test(jqueryVersion); + +const LOADERS = [ + { name: "a script tag", path: "/published/script", value: "jQuery", global: "same" }, + { + name: "a script tag, minified", + path: "/published/script?min", + value: "jQuery", + global: "same", + }, + { name: "RequireJS", path: "/published/amd", value: "undefined", global: "same" }, + { name: "RequireJS, minified", path: "/published/amd?min", value: "undefined", global: "same" }, + { + name: "an import map", + path: "/published/esm", + value: "jQuery", + // jQuery 4's module build sets no global; older versions load as a script and export it. + global: hasModuleBuild ? "none" : "same", + }, +]; + +for (const loader of LOADERS) { + test.describe(`when the packed plugin is loaded by ${loader.name}`, () => { + test.beforeEach(async ({ page }) => { + await page.goto(loader.path); + await page.waitForFunction(() => window.published && window.published.describe); + await page.waitForFunction(() => { + try { + return !!window.published.describe(); + } catch { + return false; + } + }); + }); + + test("should install the public API on the jQuery the loader returns", async ({ page }) => { + // Arrange: the page loaded the plugin. + + // Act + const described = await page.evaluate(() => window.published.describe()); + + // Assert + expect(described).toEqual({ + loader: loader.path.slice(11).replace("?min", ""), + jquery: jqueryVersion, + missing: [], + staticFieldValue: "function", + debug: false, + value: loader.value, + global: loader.global, + }); + }); + + test("should post a form over XHR with ajaxSubmit", async ({ page, request }, testInfo) => { + // Arrange + const id = requestId(testInfo); + + // Act + const result = await page.evaluate((url) => window.published.xhr(url), `/r/${id}/json`); + + // Assert + expect(result.calls, result.error).toEqual(["success", "complete"]); + expect(result.data).toEqual({ ok: true, text: "ΓΌ" }); + const [sent] = await requests(request, id, 1); + expect(sent.headers["x-requested-with"]).toBe("XMLHttpRequest"); + expect(sent.fields).toEqual([ + { name: "text", kind: "text", value: "plain ΓΌ" }, + { name: "pick", kind: "text", value: "b" }, + ]); + }); + + test("should upload a file through the iframe with ajaxForm", async ({ + page, + request, + }, testInfo) => { + // Arrange + const id = requestId(testInfo); + + // Act + const result = await page.evaluate((url) => window.published.upload(url), `/r/${id}/json`); + + // Assert + expect(result.calls, result.error).toEqual(["success", "complete"]); + expect(result.data).toEqual({ ok: true, text: "ΓΌ" }); + const [sent] = await requests(request, id, 1); + expect(sent.headers["x-requested-with"]).toBeUndefined(); + expect(sent.fields.map((f) => [f.name, f.kind, f.value])).toEqual([ + ["text", "text", "plain"], + ["upload", "file", "a.txt"], + ["go", "text", "clicked"], + ]); + expect(Buffer.from(sent.fields[1].base64, "base64").toString()).toBe("file bytes"); + }); + }); +} From f6a4e60cf680778a90faeaa6d39ece7137b19ee2 Mon Sep 17 00:00:00 2001 From: Kevin Morris Date: Sun, 1 Nov 2026 21:47:15 -0500 Subject: [PATCH 19/78] build: run the published-file tests in npm run test:e2e and its Docker variant --- package.json | 2 +- scripts/test-docker.sh | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 8d914be..a9e769c 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,7 @@ "metrics": "node scripts/code-metrics.mjs", "test": "npm run lint && npm run format:check && npm run build && vitest run --coverage --project !suite-webkit && vitest run --project suite-webkit", "test:docker": "scripts/test-docker.sh", - "test:e2e": "playwright test", + "test:e2e": "node scripts/pack-fixture.mjs && node --test test/e2e/published-node.test.mjs && playwright test", "test:e2e:docker": "scripts/test-docker.sh --e2e", "test:firefox": "scripts/test-docker.sh --project suite-firefox" }, diff --git a/scripts/test-docker.sh b/scripts/test-docker.sh index 57f1394..e702e1c 100755 --- a/scripts/test-docker.sh +++ b/scripts/test-docker.sh @@ -3,7 +3,8 @@ # Usage: [JQUERY_FILE=.jquery/jquery-1.7.2.js] scripts/test-docker.sh [vitest args...] # [JQUERY_FILE=...] scripts/test-docker.sh --e2e [playwright test args...] # Defaults to the suite on Chromium, WebKit and Firefox; --e2e runs the end-to-end tests -# (npm run test:e2e) instead, on all three browsers unless --project is given. Node and node_modules are cached in named +# (npm run test:e2e, with the packed-package tests) instead, on all three browsers unless +# --project is given. Node and node_modules are cached in named # volumes (jquery-form-node, jquery-form-node-modules-); the host's node_modules stays untouched. set -euo pipefail @@ -12,10 +13,10 @@ image="mcr.microsoft.com/playwright:v$playwright-noble" node_major=$(cat .nvmrc) lock_hash=$(shasum -a 256 package-lock.json | cut -c1-12) -runner="vitest run" +runner="npx vitest run" if [ "${1:-}" = "--e2e" ]; then shift - runner="playwright test" + runner="npm run test:e2e --" elif [ $# -eq 0 ]; then set -- --project suite-chromium --project suite-webkit --project suite-firefox fi @@ -25,7 +26,7 @@ exec docker run --rm --init --ipc=host \ -v jquery-form-node:/opt/node \ -v "jquery-form-node-modules-$lock_hash":/work/node_modules \ -e N_PREFIX=/opt/node -e PATH="/opt/node/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" \ - -e JQUERY_FILE="${JQUERY_FILE:-}" -e JQUERY_FORM_FIREFOX=1 -e RUNNER="$runner" \ + -e JQUERY_FILE="${JQUERY_FILE:-}" -e JQUERY_FORM_FIREFOX=1 -e JQUERY_FORM_TARBALL="${JQUERY_FORM_TARBALL:-}" -e RUNNER="$runner" \ "$image" bash -euo pipefail -c ' if ! node --version 2>/dev/null | grep -q "^v'"$node_major"'\."; then (cd /tmp && npx --yes n '"$node_major"' >/dev/null) @@ -36,5 +37,5 @@ exec docker run --rm --init --ipc=host \ touch node_modules/.installed fi npx playwright install chromium webkit firefox >/dev/null - npx $RUNNER "$@" + $RUNNER "$@" ' bash "$@" From 089617647a17ba7bd56bd6834e03e98109444ea6 Mon Sep 17 00:00:00 2001 From: Kevin Morris Date: Sun, 1 Nov 2026 21:47:15 -0500 Subject: [PATCH 20/78] docs: explain the published-file tests --- CONTRIBUTING.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index dda6f22..6359cef 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -77,6 +77,8 @@ Edit `src/jquery.form.js` (an ES module), never `dist/`. `npm test` rebuilds `di `npm run test:e2e` runs [Playwright Test](https://playwright.dev/) against the built `dist/jquery.form.js` (run `npm run build` first) on Chromium and WebKit. A small Node server (`test/e2e/server.mjs`) serves the fixture page and records every request the plugin sends, through each transport (urlencoded and FormData XHR, the iframe upload). Each test submits the same form natively and through the plugin, and the two requests must match after parsing, apart from the known differences listed in `test/shared/oracle-forms.js` and `test/e2e/harness.js`. `npm test` does not run them. +It first tests the package as npm would publish it: `scripts/pack-fixture.mjs` runs `npm pack` and installs the tarball into fixture projects under `.pack/` (one per jQuery version, installed from the registry or npm's cache). `test/e2e/published-node.test.mjs` (`node --test`) loads it by name from CommonJS and ES modules in Node, with jsdom as the window, and `test/e2e/published.spec.mjs` loads it in the browser by script tag (plain and minified), RequireJS and an import map, then posts a form over XHR and uploads a file through the iframe. Set `JQUERY_FORM_TARBALL` to test a tarball you packed elsewhere. + Set `JQUERY_FILE` to test another jQuery build, as for the suite. `npm run test:e2e:docker` runs them in Docker on all three browsers, including Firefox. ### Running tests in Docker From eb5e99a890b9e536c702cb1569f71175c2157c19 Mon Sep 17 00:00:00 2001 From: Kevin Morris Date: Sun, 1 Nov 2026 22:04:12 -0500 Subject: [PATCH 21/78] fix: let bundlers use the module build and name the minified build for CDNs --- docs/research/4x-behavior-changes.md | 1 + docs/research/security-review.md | 2 +- package.json | 3 ++- test/e2e/published-node.test.mjs | 2 +- test/e2e/server.mjs | 2 +- test/surfaces/manifests.test.js | 10 ++++++++-- 6 files changed, 14 insertions(+), 6 deletions(-) diff --git a/docs/research/4x-behavior-changes.md b/docs/research/4x-behavior-changes.md index 3a2630f..d19b90d 100644 --- a/docs/research/4x-behavior-changes.md +++ b/docs/research/4x-behavior-changes.md @@ -115,6 +115,7 @@ Collected as the modernization proceeds. Each entry is a change a consumer could ## Phase 13 - **A lone surrogate is sent as U+FFFD.** `formSerialize`, `fieldSerialize`, a urlencoded `ajaxSubmit` body and the clicked button of an iframe upload threw `URIError` when a name or value held an unpaired UTF-16 surrogate. Each one is now replaced with U+FFFD, as a native form submission and `FormData` do. +- **Bundlers get the module build; CDNs keep the minified one.** The `browser` field in `package.json` pointed at `dist/jquery.form.min.js`, and bundlers that read it first (webpack, Vite, Browserify) bundled the minified classic build. It is removed: webpack and Vite now use `module` (`dist/jquery.form.mjs`) and Browserify uses `main` (`dist/jquery.form.js`). New `jsdelivr` and `unpkg` fields keep a bare CDN URL serving `dist/jquery.form.min.js`. ## Known behavior, not changed diff --git a/docs/research/security-review.md b/docs/research/security-review.md index 49b14a0..d18fa16 100644 --- a/docs/research/security-review.md +++ b/docs/research/security-review.md @@ -244,7 +244,7 @@ The ADR-0001 dual surface (a module entry plus the classic script-tag, AMD and C } ``` -- **`main`, `module` and `browser` stay** for tools that predate `exports`. +- **`main` and `module` stay** for tools that predate `exports`, and `jsdelivr`/`unpkg` keep naming the minified build for CDNs. 4.6.0 dropped `browser`. - **Script tags and AMD are unaffected**, because they load files by path (CDNs, `bower.json`, `composer.json`). `test/surfaces/manifests.test.js` gains checks that every 4.x deep path still resolves through `exports`. - **Dual-package hazard.** An app that both `import`s and `require`s the plugin loads it twice. The module registers on import; the CommonJS factory registers when it is called with a jQuery. If both get the same jQuery, the only cost is registering twice. If they get different jQuery copies, each copy gets its own plugin. Document it rather than work around it; the peer dependency (finding 5) makes a single jQuery the normal case. diff --git a/package.json b/package.json index a9e769c..466ea42 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,8 @@ ], "main": "dist/jquery.form.js", "module": "dist/jquery.form.mjs", - "browser": "dist/jquery.form.min.js", + "jsdelivr": "dist/jquery.form.min.js", + "unpkg": "dist/jquery.form.min.js", "files": [ "dist", "src" diff --git a/test/e2e/published-node.test.mjs b/test/e2e/published-node.test.mjs index 46122ce..e763c7b 100644 --- a/test/e2e/published-node.test.mjs +++ b/test/e2e/published-node.test.mjs @@ -113,7 +113,7 @@ describe("when the packed package is installed", () => { const manifest = JSON.parse(readFileSync(resolve(installed, "package.json"), "utf8")); // Act - const entries = [manifest.main, manifest.module, manifest.browser]; + const entries = [manifest.main, manifest.module, manifest.jsdelivr, manifest.unpkg]; // Assert assert.deepEqual( diff --git a/test/e2e/server.mjs b/test/e2e/server.mjs index ac7e0cf..2fc1675 100644 --- a/test/e2e/server.mjs +++ b/test/e2e/server.mjs @@ -52,7 +52,7 @@ const page = ` // points its package.json names (main, browser for the minified build, module). async function publishedPage(loader, min) { const manifest = JSON.parse(await readFile(resolve(packageDir, "package.json"), "utf8")); - const classic = "/pkg/" + (min ? manifest.browser : manifest.main); + const classic = "/pkg/" + (min ? manifest.jsdelivr : manifest.main); const hasModule = existsSync(jqueryModule); const loaders = { script: ` diff --git a/test/surfaces/manifests.test.js b/test/surfaces/manifests.test.js index fc33047..f74943f 100644 --- a/test/surfaces/manifests.test.js +++ b/test/surfaces/manifests.test.js @@ -15,7 +15,8 @@ describe("when the package manifests are read", () => { const entries = [ pkg.main, pkg.module, - pkg.browser, + pkg.jsdelivr, + pkg.unpkg, bower.main, registry.main, registry.browser, @@ -31,7 +32,12 @@ describe("when the package manifests are read", () => { it("should keep the classic build as main and the module build as module", () => { expect(pkg.main).toBe("dist/jquery.form.js"); expect(pkg.module).toBe("dist/jquery.form.mjs"); - expect(pkg.browser).toBe("dist/jquery.form.min.js"); + }); + + it("should leave bundlers on module and main and serve the minified build from CDNs", () => { + expect(pkg).not.toHaveProperty("browser"); + expect(pkg.jsdelivr).toBe("dist/jquery.form.min.js"); + expect(pkg.unpkg).toBe("dist/jquery.form.min.js"); }); it("should publish the entry points through the files list", () => { From 9d7ed4ace724e77a4b3a5e2b9a4b161f6ff50f44 Mon Sep 17 00:00:00 2001 From: Kevin Morris Date: Sun, 1 Nov 2026 22:34:18 -0500 Subject: [PATCH 22/78] fix: publish LICENSE-MIT with the package --- docs/research/4x-behavior-changes.md | 1 + package.json | 3 ++- test/e2e/published-node.test.mjs | 11 +++++++++++ test/surfaces/manifests.test.js | 4 ++++ 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/docs/research/4x-behavior-changes.md b/docs/research/4x-behavior-changes.md index d19b90d..63d7abd 100644 --- a/docs/research/4x-behavior-changes.md +++ b/docs/research/4x-behavior-changes.md @@ -116,6 +116,7 @@ Collected as the modernization proceeds. Each entry is a change a consumer could - **A lone surrogate is sent as U+FFFD.** `formSerialize`, `fieldSerialize`, a urlencoded `ajaxSubmit` body and the clicked button of an iframe upload threw `URIError` when a name or value held an unpaired UTF-16 surrogate. Each one is now replaced with U+FFFD, as a native form submission and `FormData` do. - **Bundlers get the module build; CDNs keep the minified one.** The `browser` field in `package.json` pointed at `dist/jquery.form.min.js`, and bundlers that read it first (webpack, Vite, Browserify) bundled the minified classic build. It is removed: webpack and Vite now use `module` (`dist/jquery.form.mjs`) and Browserify uses `main` (`dist/jquery.form.js`). New `jsdelivr` and `unpkg` fields keep a bare CDN URL serving `dist/jquery.form.min.js`. +- **The package includes `LICENSE-MIT`.** The package is dual-licensed (LGPL-2.1+ or MIT), but only `LICENSE` was published. ## Known behavior, not changed diff --git a/package.json b/package.json index 466ea42..fe32df5 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,8 @@ "unpkg": "dist/jquery.form.min.js", "files": [ "dist", - "src" + "src", + "LICENSE-MIT" ], "repository": { "type": "git", diff --git a/test/e2e/published-node.test.mjs b/test/e2e/published-node.test.mjs index e763c7b..0418921 100644 --- a/test/e2e/published-node.test.mjs +++ b/test/e2e/published-node.test.mjs @@ -121,6 +121,17 @@ describe("when the packed package is installed", () => { [] ); }); + + it("should ship both license files of the dual license", () => { + // Arrange + const files = ["LICENSE", "LICENSE-MIT"]; + + // Act + const missing = files.filter((file) => !existsSync(resolve(installed, file))); + + // Assert + assert.deepEqual(missing, []); + }); }); // Makes the jsdom window global, as a test environment such as jest-environment-jsdom does. diff --git a/test/surfaces/manifests.test.js b/test/surfaces/manifests.test.js index f74943f..2b3212b 100644 --- a/test/surfaces/manifests.test.js +++ b/test/surfaces/manifests.test.js @@ -44,6 +44,10 @@ describe("when the package manifests are read", () => { expect(pkg.files).toContain("dist"); }); + it("should publish both licenses of the dual license", () => { + expect(pkg.files).toContain("LICENSE-MIT"); + }); + it("should agree on the version with the registry manifest and every dist banner", () => { expect(registry.version).toBe(pkg.version); for (const file of distFiles) { From 2f616b539475dc1486d8238f400ccbe703a70ada Mon Sep 17 00:00:00 2001 From: Kevin Morris Date: Sun, 1 Nov 2026 22:41:55 -0500 Subject: [PATCH 23/78] fix: let the CommonJS factory use the window it is given instead of the global one ADR-0001: same files and factory; the classic body now starts by reading its globals from root. --- dist/jquery.form.js | 13 +++++++++---- dist/jquery.form.min.js | 2 +- dist/jquery.form.min.js.map | 2 +- docs/research/4x-behavior-changes.md | 1 + rollup.config.mjs | 19 ++++++++++++++----- test/e2e/published-node.test.mjs | 25 +++++++++++-------------- 6 files changed, 37 insertions(+), 25 deletions(-) diff --git a/dist/jquery.form.js b/dist/jquery.form.js index 6d293fe..39950b4 100644 --- a/dist/jquery.form.js +++ b/dist/jquery.form.js @@ -23,7 +23,9 @@ (function (factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. - define(['jquery'], factory); + define(['jquery'], function (jQuery) { + factory(jQuery, window); + }); } else if (typeof module === 'object' && module.exports) { // Node/CommonJS module.exports = function( root, jQuery ) { @@ -37,16 +39,19 @@ jQuery = require('jquery')(root); } } - factory(jQuery); + factory(jQuery, root || (typeof window !== 'undefined' ? window : undefined)); return jQuery; }; } else { // Browser globals - factory(jQuery); + factory(jQuery, window); } -}(function (jQuery) { +}(function (jQuery, root) { 'use strict'; + var window = root; + var document = window.document, navigator = window.navigator; + var Element = window.Element, FormData = window.FormData; // Form members: the properties and methods the plugin reads or calls on a form. A control named // like a member (elements, setAttribute) shadows that member on the form itself, so members are // read through the DOM prototypes, which a control cannot shadow. diff --git a/dist/jquery.form.min.js b/dist/jquery.form.min.js index 3842c74..f00bb87 100644 --- a/dist/jquery.form.min.js +++ b/dist/jquery.form.min.js @@ -19,5 +19,5 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. */ -!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof module&&module.exports?module.exports=function(t,r){return void 0===r&&(r="undefined"!=typeof window?require("jquery"):require("jquery")(t)),e(r),r}:e(jQuery)}(function(e){"use strict";var t=["HTMLFormElement","HTMLElement","Element","Node"],r=document.createElement("form");function n(e){for(var r=0;r=0)return r;return null}var l="jqFormSubmitter";function f(e,t,r){try{e[t]=r}catch(e){}}function d(e,t){var r=e[t],n=a(e,"elements");return n&&r&&n.namedItem(t)===r?void 0:r}function p(t,r,n,a){e.data(t,l,{el:r,x:n,y:a}),f(t,"clk",r),"image"===r.type&&(f(t,"clk_x",n),f(t,"clk_y",a)),setTimeout(function(){e.data(t,l,null),f(t,"clk",null),f(t,"clk_x",null),f(t,"clk_y",null)},100)}function m(t){var r=c(t.target,["button","input"]);if(r&&("submit"===r.type||"image"===r.type)){var n=r.form;if(n){var a="image"===r.type?function(t,r){if(void 0!==t.offsetX)return[t.offsetX,t.offsetY];if("function"==typeof e.fn.offset){var n=e(r).offset();return[t.pageX-n.left,t.pageY-n.top]}return[t.pageX-r.offsetLeft,t.pageY-r.offsetTop]}(t,r):[];p(n,r,a[0],a[1])}}}function v(t){if(!t)return null;var r=e.data(t,l);if(r)return r;var n=d(t,"clk");return n?{el:n,x:d(t,"clk_x"),y:d(t,"clk_y")}:null}function h(){if(e.fn.ajaxSubmit.debug){var t="[jquery.form] "+Array.prototype.join.call(arguments,"");window.console&&window.console.log?window.console.log(t):window.opera&&window.opera.postError&&window.opera.postError(t)}}var g={};function y(t,r){e.fn.ajaxSubmit.debug&&!g[t]&&(g[t]=!0,window.console&&"function"==typeof window.console.warn&&window.console.warn("[jquery.form] "+r+" (removed in 5.0)"))}function b(e){(function(e){var t=String(e).split("."),r=Number(t[0]);return r<3||3===r&&Number(t[1])<5})(e)&&y("jquery","support for jQuery "+e+" is deprecated, 5.0 needs jQuery 3.5 or later")}function x(e,t,r,n){if("string"!=typeof e&&!1!==e)return e;var a={url:e,data:t,dataType:r};return"function"==typeof n&&(a.success=n),a}function j(e,t,r,n){return"function"==typeof e?{success:e}:void 0===(e=x(e,t,r,n))?{}:!1===e.url||""===e.url?function(e){var t={};for(var r in e)"url"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}(e):e}function w(e,t){for(var r=0;r"'),e(function(){e(n.s,n.c).ajaxForm(r)}),t):(h("terminating; zero elements found by selector"+(e.isReady?"":" (DOM not ready)")),t)}(this,t))}function L(t){return"string"==typeof t?(q(t),this):(t!==A&&(k={},e(document).off("submit.form-plugin click.form-plugin")),this.off("submit.form-plugin click.form-plugin"))}function M(t,r){if(!u(t))return e(t).attr(r);var n=o(t,"getAttribute",r);return null===n?void 0:n}var C=/\r\n|\r|\n/g,N=/\r/g,I=/^(?:fieldset|object|output)$/;function $(e){return"function"==typeof e.matches?e.matches(":disabled"):!!e.disabled}function P(t){if("select"===i(t))return function(e){var t=e.selectedIndex;if(t<0)return null;for(var r=[],n=e.options,a="select-one"===e.type,o=a?t+1:n.length,i=a?t:0;i=0,o=a?e.responseXML:e.responseText;return a&&"parsererror"===o.documentElement.nodeName&&ee.error&&ee.error("parsererror"),r&&r.dataFilter&&(o=r.dataFilter(o,t)),"string"==typeof o&&(("json"===t||!t)&&n.indexOf("json")>=0?o=JSON.parse(o):"script"===t&&ee.globalEval(o)),o}(t,s,r)}catch(e){i="parsererror",t.error=o=e||i}}catch(e){h("error caught: ",e),i="error",t.error=o=e}return{status:i,data:a,errMsg:o}}var ae=e;function oe(e,t){var r,n,a,o=ae.Deferred(),i={aborted:0,responseText:null,responseXML:null,status:0,statusText:"n/a",getAllResponseHeaders:function(){},getResponseHeader:function(){},setRequestHeader:function(){},abort:function(e){s(e,[i,"aborted",e])}};function u(){return i.aborted||a}function s(n,a,s){var c=s||("timeout"===n?"timeout":"aborted");u()||(h("aborting upload... "+c),i.aborted=1,t.stop(),i.error=c,e.error&&e.error.call(e.context,i,c,n),o.reject.apply(o,a),r&&ae.event.trigger("ajaxError",[i,e,c]),l(c))}function c(){r&&ae.event.trigger("ajaxComplete",[i,e]),r&&! --ae.active&&ae.event.trigger("ajaxStop")}function l(r){e.complete&&e.complete.call(e.context,i,r),c(),clearTimeout(n),setTimeout(function(){t.release(),i.responseXML=null},100)}function f(t){var n=t.status,u=t.errMsg;if(i.aborted)h("upload aborted");else if(i.status&&!(i.status>=200&&i.status<300||304===i.status)&&(n="error"),a=!0,"success"!==n)void 0===u&&(u=i.statusText),e.error&&e.error.call(e.context,i,n,u),o.reject(i,"error",u),r&&ae.event.trigger("ajaxError",[i,e,u]),l(n);else{var s=function(t){var n;try{e.success.call(e.context,t,"success",i)}catch(e){n={error:e}}return o.resolve(i.responseText,"success",i),r&&ae.event.trigger("ajaxSuccess",[i,e,t]),n}(t.data);if(l(n),s)throw s.error}}return o.abort=function(e){i.abort(e)},{xhr:i,deferred:o,start:function(){return(r=e.global)&&0===ae.active++&&ae.event.trigger("ajaxStart"),e.beforeSend&&!1===e.beforeSend.call(e.context,i,e)?(u()||(a=!0,o.reject(),r&&ae.event.trigger("ajaxError",[i,e,"canceled"]),c()),!1):!i.aborted&&(r&&ae.event.trigger("ajaxSend",[i,e]),!i.aborted)},done:u,abort:s,settle:f,fail:function(e){f({status:"error",errMsg:e})},startTimer:function(t){e.timeout&&(n=setTimeout(t,e.timeout))},stopTimer:function(){clearTimeout(n),n=void 0}}}var ie=e;function ue(e,t){var r=0;function n(e){var n=e.form,i=e.method,u=w(ie.extend(!0,{},ie.ajaxSettings,e.options),[ie.ajaxSettings,e.options]);u.context=u.context||u;var s=a(n,"ownerDocument"),l=ie(c(n,["body"])),f=function(e,t,r){var n,a;if(e.iframeTarget)(a=(n=ie(e.iframeTarget,r)).attr("name"))?t=a:(n.attr("name",t),n.each(function(){!function(e,t){try{e.contentWindow&&(e.contentWindow.name=t)}catch(e){}}(this,t)}));else{var o=r.createElement("iframe");o.setAttribute("name",t),o.setAttribute("src",e.iframeSrc),(n=ie(o)).css({position:"absolute",top:"-1000px",left:"-1000px"})}return{$io:n,id:t}}(u,"jqFormIO"+(new Date).getTime()+r++,s),d=f.$io,p=d[0],m=oe(u,function(e,t){return{stop:function(){try{t[0].contentWindow.document.execCommand&&t[0].contentWindow.document.execCommand("Stop")}catch(e){}t.attr("src",e.iframeSrc)},release:function(){e.iframeTarget?t.attr("src",e.iframeSrc):t.remove()}}}(u,d)),v=50;if(!m.start())return m.deferred;function g(){try{var e=te(p).readyState;h("state = "+e),e&&"uninitialized"===e.toLowerCase()&&setTimeout(g,50)}catch(e){h("Server abort: ",e," (",e.name,")"),x(2),m.stopTimer()}}function y(){var r=function(e){var t={};return V.each(_,function(r,n){t[n]=o(e,"hasAttribute",n)?o(e,"getAttribute",n):null}),t}(n);!function(e,t,r,n,a){var o="multipart/form-data";Z(e,"target",t),!r||/post/i.test(r)?Z(e,"method","POST"):Y(r)&&!Y(a.property(e,"method"))&&Z(e,"method","GET"),Z(e,"action",n.url),n.skipEncodingOverride||r&&!/post/i.test(r)||(Z(e,"encoding",o),Z(e,"enctype",o))}(n,f.id,i,u,t),m.startTimer(function(){x(1)});var a=[];try{!function(e,t,r,n,a){function o(r,n){var o=t.createElement("input");o.type="hidden",o.name=r,a.push(V(o).val(n).appendTo(e)[0])}if(r)for(var i in r)if(K.call(r,i))if(V.isPlainObject(r[i])&&K.call(r[i],"name")&&K.call(r[i],"value"))o(r[i].name,r[i].value);else{var u={};u[i]=r[i];for(var s=W(u,n),c=0;c=0?"&":"?")+t+e.url.slice(a.length),e.data=null}else e.data=t}(t,a.param(H(v),p),g),{form:c,$form:e,fields:v,controls:h,options:t,method:l,traditional:p}))},deliver:function(e){var t=e.$form,r=e.options,n=[];if(r.resetForm&&n.push(function(){t.resetForm()}),r.clearForm&&n.push(function(){t.clearForm(r.includeHidden)}),!r.dataType&&r.target){var o=l(r.success);n.push(function(e,t,n){var i=arguments,u=r.replaceTarget?"replaceWith":"html",s=a(r.target);"string"==typeof e?s[u](e):h("target: the response was parsed by jQuery, so it is not inserted"),s.length||f(o,this,i),s.each(function(){f(o,this,i)})})}else a.merge(n,l(r.success));if(r.success=function(e,a,o){for(var i=r.context||this,u=0,s=n.length;u0,u=/^[\t\n\f\r ]*multipart\/form-data[\t\n\f\r ]*$/i,s=u.test(r.attribute(n[0],"enctype"))||u.test(r.attribute(n[0],"encoding")),c=t.fileapi&&t.formdata;h("fileAPI :"+c);var l=(i||s)&&!c,f=(i||s)&&c?"formdata":"ajax";if(!1!==o.iframe&&(o.iframe||l)&&(f="iframe"),"iframe"!==f||o.iframe||y("iframe","choosing the iframe transport automatically without FormData is deprecated, set iframe: true"),"ajax"!==f&&"json"===o.requestFormat)throw new Error('jquery.form: requestFormat "json" cannot send files or use the iframe transport');return f}}}!function(e){var t={};t.fileapi=void 0!==e('').get(0).files,t.formdata=void 0!==window.FormData;var r=!!e.fn.prop;var n={attribute:M,property:function(e,t){var n=r?e[t]:void 0;return"string"==typeof n?n:M(e,t)}},a=U(t),u=se(t,n,a),s={iframe:ue(r,n),formdata:B,ajax:Q};e.fn.attr2=function(){if(y("attr2","attr2 is deprecated, use .prop() or .attr()"),!r)return this.attr.apply(this,arguments);var e=this.prop.apply(this,arguments);return e&&e.jquery||"string"==typeof e?e:this.attr.apply(this,arguments)},e.fn.ajaxSubmit=function(t,r,n,a){if(b(e.fn.jquery),!this.length)return h("ajaxSubmit: skipping submit process - no element selected"),this;if(!e.ajax)throw new Error("jquery.form: ajaxSubmit needs the full jQuery build; this jQuery has no $.ajax");var o=u.prepare(this,j(t,r,n,a));if(!o)return this;u.deliver(o);var i=s[u.chooseTransport(o)](o);this.removeData("jqxhr").data("jqxhr",i);for(var c=0;c=0)return r;return null}var h="jqFormSubmitter";function g(e,t,r){try{e[t]=r}catch(e){}}function y(e,t){var r=e[t],n=l(e,"elements");return n&&r&&n.namedItem(t)===r?void 0:r}function b(t,r,n,a){e.data(t,h,{el:r,x:n,y:a}),g(t,"clk",r),"image"===r.type&&(g(t,"clk_x",n),g(t,"clk_y",a)),setTimeout(function(){e.data(t,h,null),g(t,"clk",null),g(t,"clk_x",null),g(t,"clk_y",null)},100)}function x(t){var r=v(t.target,["button","input"]);if(r&&("submit"===r.type||"image"===r.type)){var n=r.form;if(n){var a="image"===r.type?function(t,r){if(void 0!==t.offsetX)return[t.offsetX,t.offsetY];if("function"==typeof e.fn.offset){var n=e(r).offset();return[t.pageX-n.left,t.pageY-n.top]}return[t.pageX-r.offsetLeft,t.pageY-r.offsetTop]}(t,r):[];b(n,r,a[0],a[1])}}}function j(t){if(!t)return null;var r=e.data(t,h);if(r)return r;var n=y(t,"clk");return n?{el:n,x:y(t,"clk_x"),y:y(t,"clk_y")}:null}function T(){if(e.fn.ajaxSubmit.debug){var t="[jquery.form] "+Array.prototype.join.call(arguments,"");r.console&&r.console.log?r.console.log(t):r.opera&&r.opera.postError&&r.opera.postError(t)}}var w={};function S(t,n){e.fn.ajaxSubmit.debug&&!w[t]&&(w[t]=!0,r.console&&"function"==typeof r.console.warn&&r.console.warn("[jquery.form] "+n+" (removed in 5.0)"))}function F(e){(function(e){var t=String(e).split("."),r=Number(t[0]);return r<3||3===r&&Number(t[1])<5})(e)&&S("jquery","support for jQuery "+e+" is deprecated, 5.0 needs jQuery 3.5 or later")}function E(e,t,r,n){if("string"!=typeof e&&!1!==e)return e;var a={url:e,data:t,dataType:r};return"function"==typeof n&&(a.success=n),a}function D(e,t,r,n){return"function"==typeof e?{success:e}:void 0===(e=E(e,t,r,n))?{}:!1===e.url||""===e.url?function(e){var t={};for(var r in e)"url"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}(e):e}function k(e,t){for(var r=0;r"'),e(function(){e(n.s,n.c).ajaxForm(r)}),t):(T("terminating; zero elements found by selector"+(e.isReady?"":" (DOM not ready)")),t)}(this,t))}function P(t){return"string"==typeof t?(N(t),this):(t!==I&&(C={},e(n).off("submit.form-plugin click.form-plugin")),this.off("submit.form-plugin click.form-plugin"))}function X(t,r){if(!p(t))return e(t).attr(r);var n=f(t,"getAttribute",r);return null===n?void 0:n}var R=/\r\n|\r|\n/g,H=/\r/g,U=/^(?:fieldset|object|output)$/;function z(e){return"function"==typeof e.matches?e.matches(":disabled"):!!e.disabled}function W(t){if("select"===d(t))return function(e){var t=e.selectedIndex;if(t<0)return null;for(var r=[],n=e.options,a="select-one"===e.type,o=a?t+1:n.length,i=a?t:0;i=0,o=a?e.responseXML:e.responseText;return a&&"parsererror"===o.documentElement.nodeName&&ie.error&&ie.error("parsererror"),r&&r.dataFilter&&(o=r.dataFilter(o,t)),"string"==typeof o&&(("json"===t||!t)&&n.indexOf("json")>=0?o=JSON.parse(o):"script"===t&&ie.globalEval(o)),o}(t,c,n)}catch(e){u="parsererror",t.error=i=e||u}}catch(e){T("error caught: ",e),u="error",t.error=i=e}return{status:u,data:o,errMsg:i}}var le=e;function fe(e,t){var r,n,a,o=le.Deferred(),i={aborted:0,responseText:null,responseXML:null,status:0,statusText:"n/a",getAllResponseHeaders:function(){},getResponseHeader:function(){},setRequestHeader:function(){},abort:function(e){s(e,[i,"aborted",e])}};function u(){return i.aborted||a}function s(n,a,s){var c=s||("timeout"===n?"timeout":"aborted");u()||(T("aborting upload... "+c),i.aborted=1,t.stop(),i.error=c,e.error&&e.error.call(e.context,i,c,n),o.reject.apply(o,a),r&&le.event.trigger("ajaxError",[i,e,c]),l(c))}function c(){r&&le.event.trigger("ajaxComplete",[i,e]),r&&! --le.active&&le.event.trigger("ajaxStop")}function l(r){e.complete&&e.complete.call(e.context,i,r),c(),clearTimeout(n),setTimeout(function(){t.release(),i.responseXML=null},100)}function f(t){var n=t.status,u=t.errMsg;if(i.aborted)T("upload aborted");else if(i.status&&!(i.status>=200&&i.status<300||304===i.status)&&(n="error"),a=!0,"success"!==n)void 0===u&&(u=i.statusText),e.error&&e.error.call(e.context,i,n,u),o.reject(i,"error",u),r&&le.event.trigger("ajaxError",[i,e,u]),l(n);else{var s=function(t){var n;try{e.success.call(e.context,t,"success",i)}catch(e){n={error:e}}return o.resolve(i.responseText,"success",i),r&&le.event.trigger("ajaxSuccess",[i,e,t]),n}(t.data);if(l(n),s)throw s.error}}return o.abort=function(e){i.abort(e)},{xhr:i,deferred:o,start:function(){return(r=e.global)&&0===le.active++&&le.event.trigger("ajaxStart"),e.beforeSend&&!1===e.beforeSend.call(e.context,i,e)?(u()||(a=!0,o.reject(),r&&le.event.trigger("ajaxError",[i,e,"canceled"]),c()),!1):!i.aborted&&(r&&le.event.trigger("ajaxSend",[i,e]),!i.aborted)},done:u,abort:s,settle:f,fail:function(e){f({status:"error",errMsg:e})},startTimer:function(t){e.timeout&&(n=setTimeout(t,e.timeout))},stopTimer:function(){clearTimeout(n),n=void 0}}}var de=e;function pe(e,t){var r=0;function n(e){var n=e.form,a=e.method,o=k(de.extend(!0,{},de.ajaxSettings,e.options),[de.ajaxSettings,e.options]);o.context=o.context||o;var i=l(n,"ownerDocument"),u=de(v(n,["body"])),s=function(e,t,r){var n,a;if(e.iframeTarget)(a=(n=de(e.iframeTarget,r)).attr("name"))?t=a:(n.attr("name",t),n.each(function(){!function(e,t){try{e.contentWindow&&(e.contentWindow.name=t)}catch(e){}}(this,t)}));else{var o=r.createElement("iframe");o.setAttribute("name",t),o.setAttribute("src",e.iframeSrc),(n=de(o)).css({position:"absolute",top:"-1000px",left:"-1000px"})}return{$io:n,id:t}}(o,"jqFormIO"+(new Date).getTime()+r++,i),c=s.$io,d=c[0],p=fe(o,function(e,t){return{stop:function(){try{t[0].contentWindow.document.execCommand&&t[0].contentWindow.document.execCommand("Stop")}catch(e){}t.attr("src",e.iframeSrc)},release:function(){e.iframeTarget?t.attr("src",e.iframeSrc):t.remove()}}}(o,c)),m=50;if(!p.start())return p.deferred;function h(){try{var e=ue(d).readyState;T("state = "+e),e&&"uninitialized"===e.toLowerCase()&&setTimeout(h,50)}catch(e){T("Server abort: ",e," (",e.name,")"),b(2),p.stopTimer()}}function g(){var r=function(e){var t={};return Z.each(ee,function(r,n){t[n]=f(e,"hasAttribute",n)?f(e,"getAttribute",n):null}),t}(n);!function(e,t,r,n,a){var o="multipart/form-data";oe(e,"target",t),!r||/post/i.test(r)?oe(e,"method","POST"):re(r)&&!re(a.property(e,"method"))&&oe(e,"method","GET"),oe(e,"action",n.url),n.skipEncodingOverride||r&&!/post/i.test(r)||(oe(e,"encoding",o),oe(e,"enctype",o))}(n,s.id,a,o,t),p.startTimer(function(){b(1)});var l=[];try{!function(e,t,r,n,a){function o(r,n){var o=t.createElement("input");o.type="hidden",o.name=r,a.push(Z(o).val(n).appendTo(e)[0])}if(r)for(var i in r)if(te.call(r,i))if(Z.isPlainObject(r[i])&&te.call(r[i],"name")&&te.call(r[i],"value"))o(r[i].name,r[i].value);else{var u={};u[i]=r[i];for(var s=Y(u,n),c=0;c=0?"&":"?")+t+e.url.slice(a.length),e.data=null}else e.data=t}(t,u.param(V(y),h),x),{form:f,$form:e,fields:y,controls:b,options:t,method:d,traditional:h}))},deliver:function(e){var t=e.$form,r=e.options,n=[];if(r.resetForm&&n.push(function(){t.resetForm()}),r.clearForm&&n.push(function(){t.clearForm(r.includeHidden)}),!r.dataType&&r.target){var a=d(r.success);n.push(function(e,t,n){var o=arguments,i=r.replaceTarget?"replaceWith":"html",s=u(r.target);"string"==typeof e?s[i](e):T("target: the response was parsed by jQuery, so it is not inserted"),s.length||p(a,this,o),s.each(function(){p(a,this,o)})})}else u.merge(n,d(r.success));if(r.success=function(e,a,o){for(var i=r.context||this,u=0,s=n.length;u0,i=/^[\t\n\f\r ]*multipart\/form-data[\t\n\f\r ]*$/i,s=i.test(o.attribute(r[0],"enctype"))||i.test(o.attribute(r[0],"encoding")),c=t.fileapi&&t.formdata;T("fileAPI :"+c);var l=(a||s)&&!c,f=(a||s)&&c?"formdata":"ajax";if(!1!==n.iframe&&(n.iframe||l)&&(f="iframe"),"iframe"!==f||n.iframe||S("iframe","choosing the iframe transport automatically without FormData is deprecated, set iframe: true"),"ajax"!==f&&"json"===n.requestFormat)throw new Error('jquery.form: requestFormat "json" cannot send files or use the iframe transport');return f}}}!function(e){var t={};t.fileapi=void 0!==e('').get(0).files,t.formdata=void 0!==r.FormData;var n=!!e.fn.prop;var o={attribute:X,property:function(e,t){var r=n?e[t]:void 0;return"string"==typeof r?r:X(e,t)}},i=_(t),u=me(t,o,i),s={iframe:pe(n,o),formdata:G,ajax:J};e.fn.attr2=function(){if(S("attr2","attr2 is deprecated, use .prop() or .attr()"),!n)return this.attr.apply(this,arguments);var e=this.prop.apply(this,arguments);return e&&e.jquery||"string"==typeof e?e:this.attr.apply(this,arguments)},e.fn.ajaxSubmit=function(t,r,n,a){if(F(e.fn.jquery),!this.length)return T("ajaxSubmit: skipping submit process - no element selected"),this;if(!e.ajax)throw new Error("jquery.form: ajaxSubmit needs the full jQuery build; this jQuery has no $.ajax");var o=u.prepare(this,D(t,r,n,a));if(!o)return this;u.deliver(o);var i=s[u.chooseTransport(o)](o);this.removeData("jqxhr").data("jqxhr",i);for(var c=0;c= 0) {\n return node;\n }\n }\n\n return null;\n}\n","import { closestByTag, formMember } from \"./form-members.js\";\nimport jQuery from \"jquery\";\n\n// The submitter: the button that submitted a form, captured from ajaxForm's clicks. It is kept in\n// a private store and cleared shortly after the click. The form's clk, clk_x and clk_y properties\n// are still written for pages that read them, and read when the store has none.\n\nvar storeKey = \"jqFormSubmitter\";\n\n// Writes a property on the form; a control with that name makes it read-only.\nfunction setExpando(form, name, value) {\n try {\n form[name] = value;\n } catch (ignore) {\n // the control keeps the name; the store has the submitter\n }\n}\n\n// A property the page set on the form, never a control of the form with that name.\nfunction expando(form, name) {\n var value = form[name];\n var els = formMember(form, \"elements\");\n\n return els && value && els.namedItem(name) === value ? undefined : value;\n}\n\n// Records a submitter for a form until the click window ends.\nfunction record(form, el, x, y) {\n jQuery.data(form, storeKey, { el: el, x: x, y: y });\n setExpando(form, \"clk\", el);\n\n if (el.type === \"image\") {\n setExpando(form, \"clk_x\", x);\n setExpando(form, \"clk_y\", y);\n }\n\n // clear form vars\n setTimeout(function () {\n jQuery.data(form, storeKey, null);\n setExpando(form, \"clk\", null);\n setExpando(form, \"clk_x\", null);\n setExpando(form, \"clk_y\", null);\n }, 100);\n}\n\n// The clicked point of an image button, relative to the image.\nfunction imagePoint(e, target) {\n if (typeof e.offsetX !== \"undefined\") {\n return [e.offsetX, e.offsetY];\n }\n\n if (typeof jQuery.fn.offset === \"function\") {\n var offset = jQuery(target).offset();\n\n return [e.pageX - offset.left, e.pageY - offset.top];\n }\n\n return [e.pageX - target.offsetLeft, e.pageY - target.offsetTop];\n}\n\n/**\n * Records the submit or image button a click event reached, for the form it belongs to.\n */\nexport function captureSubmitter(e) {\n // the clicked control, or the button around the clicked content (ex: a span within a button)\n var target = closestByTag(e.target, [\"button\", \"input\"]);\n\n // the type property, unlike the attribute, is \"submit\" for a button without a type (#588)\n if (!target || (target.type !== \"submit\" && target.type !== \"image\")) {\n return;\n }\n\n var form = target.form;\n\n if (!form) {\n // a submit control that belongs to no form\n return;\n }\n\n var point = target.type === \"image\" ? imagePoint(e, target) : [];\n\n record(form, target, point[0], point[1]);\n}\n\n/**\n * Records the submitter a submit event names (SubmitEvent.submitter), when no click was captured.\n * An image submitter gets the point 0,0, as native submission sends it without a click.\n */\nexport function captureEventSubmitter(e, form) {\n var el = e.originalEvent && e.originalEvent.submitter;\n\n if (el && !submitterOf(form)) {\n record(form, el, 0, 0);\n }\n}\n\n/**\n * The form's submitter as { el, x, y } (x and y for an image button), or null.\n */\nexport function submitterOf(form) {\n if (!form) {\n return null;\n }\n\n var stored = jQuery.data(form, storeKey);\n\n if (stored) {\n return stored;\n }\n\n var el = expando(form, \"clk\");\n\n return el ? { el: el, x: expando(form, \"clk_x\"), y: expando(form, \"clk_y\") } : null;\n}\n\n/**\n * The submitter's fields for a post that adds them itself (the iframe upload), as name β†’ value.\n */\nexport function submitterFields(form) {\n var fields = {};\n var sub = submitterOf(form);\n var el = sub && sub.el;\n\n if (el && el.name && !el.disabled) {\n fields[el.name] = el.value;\n if (el.type === \"image\") {\n fields[el.name + \".x\"] = sub.x;\n fields[el.name + \".y\"] = sub.y;\n }\n }\n\n return fields;\n}\n\n/**\n * The form's submitter element, or null.\n */\nexport function submitterElement(form) {\n var sub = submitterOf(form);\n\n return sub ? sub.el : null;\n}\n","import jQuery from \"jquery\";\n\n// Debug logging, switched on by $.fn.ajaxSubmit.debug. The flag is read on every call, so it can\n// be turned on after the plugin loads.\nexport function log() {\n if (!jQuery.fn.ajaxSubmit.debug) {\n return;\n }\n\n var msg = \"[jquery.form] \" + Array.prototype.join.call(arguments, \"\");\n\n if (window.console && window.console.log) {\n window.console.log(msg);\n } else if (window.opera && window.opera.postError) {\n window.opera.postError(msg);\n }\n}\n\nvar warned = {};\n\n/**\n * A deprecation warning: console.warn, only while debug is on, once per id per page. The message\n * names the replacement; the warning adds that the feature is removed in 5.0.\n */\nexport function deprecate(id, message) {\n if (!jQuery.fn.ajaxSubmit.debug || warned[id]) {\n return;\n }\n\n warned[id] = true;\n\n if (window.console && typeof window.console.warn === \"function\") {\n window.console.warn(\"[jquery.form] \" + message + \" (removed in 5.0)\");\n }\n}\n\n// Forgets which deprecations have warned (for tests).\nexport function resetDeprecations() {\n warned = {};\n}\n\n// True for a jQuery version string older than 3.5.\nexport function beforeJQuery35(version) {\n var parts = String(version).split(\".\");\n var major = Number(parts[0]);\n\n return major < 3 || (major === 3 && Number(parts[1]) < 5);\n}\n\n// 5.0 needs jQuery 3.5 or later: warned on the first ajaxSubmit or ajaxForm, given jQuery's version.\nexport function deprecateOldJQuery(version) {\n if (beforeJQuery35(version)) {\n deprecate(\n \"jquery\",\n \"support for jQuery \" + version + \" is deprecated, 5.0 needs jQuery 3.5 or later\"\n );\n }\n}\n","// The arguments ajaxSubmit and ajaxForm accept in place of an options object.\n\n/**\n * Turns the (url, data, dataType, success) shorthand into options. A url of false is kept as\n * the url; anything else is returned as given.\n */\nexport function shorthandOptions(options, data, dataType, onSuccess) {\n if (typeof options !== \"string\" && options !== false) {\n return options;\n }\n\n var result = { url: options, data: data, dataType: dataType };\n\n if (typeof onSuccess === \"function\") {\n result.success = onSuccess;\n }\n\n return result;\n}\n\n// A copy of options without its url, so the form action is used.\nfunction withoutUrl(options) {\n var result = {};\n\n for (var key in options) {\n if (key !== \"url\" && Object.prototype.hasOwnProperty.call(options, key)) {\n result[key] = options[key];\n }\n }\n\n return result;\n}\n\n/**\n * The options ajaxSubmit starts from: a function is the success callback, the shorthand is\n * expanded, and no options at all is an empty object. A url of false or \"\" means the form action.\n */\nexport function submitOptions(options, data, dataType, onSuccess) {\n if (typeof options === \"function\") {\n return { success: options };\n }\n\n options = shorthandOptions(options, data, dataType, onSuccess);\n\n if (typeof options === \"undefined\") {\n return {};\n }\n\n return options.url === false || options.url === \"\" ? withoutUrl(options) : options;\n}\n\n/**\n * jQuery treats `context` as a flat option: after a deep merge, the settings get back the\n * caller's own object from the last source that has one, so `this` in callbacks is that object.\n */\nexport function keepContext(settings, sources) {\n for (var i = 0; i < sources.length; i++) {\n if (sources[i].context !== undefined) {\n settings.context = sources[i].context;\n }\n }\n\n return settings;\n}\n","import { assertRealParent, closestByTag, formMember, isElement } from \"./form-members.js\";\nimport { captureEventSubmitter, captureSubmitter } from \"./submitter.js\";\nimport { deprecate, deprecateOldJQuery, log } from \"./diagnostics.js\";\nimport jQuery from \"jquery\";\nimport { shorthandOptions } from \"./options.js\";\n\n// ajaxForm binding: the submit and click handlers that send a form through ajaxSubmit. The\n// handlers look up $.fn.ajaxSubmit when they run, so a replacement installed later is used.\n\n// Sends the submit event's form with ajaxSubmit, unless an earlier handler cancelled it.\nfunction submitWith(e, options) {\n if (!e.isDefaultPrevented()) {\n // if event has been canceled, don't proceed\n e.preventDefault();\n // the form is found through the real tree: a control named nodeType misleads jQuery's closest\n var form = closestByTag(e.target, [\"form\"]);\n\n // a button outside the form (form attribute), or requestSubmit(button), sends no click here\n captureEventSubmitter(e, form);\n jQuery(form).ajaxSubmit(options); // #365\n }\n}\n\nfunction doAjaxSubmit(e) {\n submitWith(e, e.data);\n}\n\nfunction captureSubmittingElement(e) {\n /* jshint validthis:true */\n assertRealParent(this);\n captureSubmitter(e);\n}\n\n// An empty selection: queued until the DOM is ready (old jQuery keeps the selector), or dropped.\nfunction bindLater($sel, options) {\n var o = { s: $sel.selector, c: $sel.context };\n\n if (!jQuery.isReady && o.s) {\n log(\"DOM not ready, queuing ajaxForm\");\n deprecate(\n \"queue\",\n \"queuing ajaxForm until the DOM is ready is deprecated, call ajaxForm inside $(fn) \" +\n 'or use delegation: \"\"'\n );\n jQuery(function () {\n jQuery(o.s, o.c).ajaxForm(options);\n });\n\n return $sel;\n }\n\n // is your DOM ready? http://docs.jquery.com/Tutorials:Introducing_$(document).ready()\n log(\"terminating; zero elements found by selector\" + (jQuery.isReady ? \"\" : \" (DOM not ready)\"));\n\n return $sel;\n}\n\n// delegation: true on jQuery 3 and later, where the selection has no selector: always warned,\n// debug or not, once per ajaxForm call.\nfunction warnUnscoped() {\n var console = window.console || {};\n\n if (typeof console.warn === \"function\") {\n console.warn(\n \"[jquery.form] delegation: true binds every form on the page on jQuery 3 and later; \" +\n 'pass a selector instead, e.g. delegation: \"form.ajax\"'\n );\n }\n}\n\nfunction bindDelegated($sel, options) {\n if ($sel.selector === undefined) {\n warnUnscoped();\n }\n\n jQuery(document)\n .off(\"submit.form-plugin\", $sel.selector, doAjaxSubmit)\n .off(\"click.form-plugin\", $sel.selector, captureSubmittingElement)\n .on(\"submit.form-plugin\", $sel.selector, options, doAjaxSubmit)\n .on(\"click.form-plugin\", $sel.selector, options, captureSubmittingElement);\n\n return $sel;\n}\n\n// The element itself or its nearest ancestor that matches the selector. The walk never reads a\n// parentNode a control can hide (jQuery's delegated walk does, and cycles on such a form).\nfunction closestMatch(el, selector) {\n if (!isElement(el)) {\n return null;\n }\n\n if (window.Element && Element.prototype.closest) {\n return Element.prototype.closest.call(el, selector);\n }\n\n for (var node = el; node && isElement(node); node = formMember(node, \"parentNode\")) {\n if (jQuery(node).is(selector)) {\n return node;\n }\n }\n\n return null;\n}\n\n// The document handlers bound for each delegation selector, keyed by \"s\" + selector.\nvar delegated = {};\n\nfunction unbindSelector(selector) {\n var handlers = delegated[\"s\" + selector];\n\n if (handlers) {\n jQuery(document)\n .off(\"submit.form-plugin\", handlers.submit)\n .off(\"click.form-plugin\", handlers.click);\n delete delegated[\"s\" + selector];\n }\n}\n\n// delegation: \"\": one handler pair on the document, scoped to the selector.\nfunction bindSelector($sel, selector, options) {\n if (!selector) {\n throw new Error(\"jquery.form: delegation needs a selector, or true\");\n }\n\n var handlers = {\n submit: function (e) {\n if (closestMatch(e.target, selector)) {\n submitWith(e, options);\n }\n },\n click: function (e) {\n if (closestMatch(e.target, selector)) {\n captureSubmitter(e);\n }\n },\n };\n\n unbindSelector(selector);\n delegated[\"s\" + selector] = handlers;\n jQuery(document)\n .on(\"submit.form-plugin\", handlers.submit)\n .on(\"click.form-plugin\", handlers.click);\n\n return $sel;\n}\n\n// Passed by ajaxForm's own rebind: unbind the selection only, never the document handlers.\nvar selectionOnly = {};\n\n/**\n * ajaxForm() binds the selected forms so a submit is sent with ajaxSubmit, with the clicked\n * submit button (and image coordinates) included. The options work as for ajaxSubmit.\n */\nexport function ajaxForm(options, data, dataType, onSuccess) {\n deprecateOldJQuery(jQuery.fn.jquery);\n options = shorthandOptions(options, data, dataType, onSuccess) || {};\n\n if (typeof options.delegation === \"string\") {\n return bindSelector(this, options.delegation, options);\n }\n\n options.delegation = options.delegation && typeof jQuery.fn.on === \"function\";\n\n if (!options.delegation && this.length === 0) {\n return bindLater(this, options);\n }\n\n if (options.delegation) {\n return bindDelegated(this, options);\n }\n\n if (options.beforeFormUnbind) {\n options.beforeFormUnbind(this, options);\n }\n\n return this.ajaxFormUnbind(selectionOnly)\n .on(\"submit.form-plugin\", options, doAjaxSubmit)\n .on(\"click.form-plugin\", options, captureSubmittingElement);\n}\n\n/**\n * ajaxFormUnbind() removes the handlers ajaxForm bound on the selection and every delegated\n * binding on the document. ajaxFormUnbind(selector) removes only that delegation selector.\n */\nexport function ajaxFormUnbind(selector) {\n if (typeof selector === \"string\") {\n unbindSelector(selector);\n\n return this;\n }\n\n if (selector !== selectionOnly) {\n delegated = {};\n jQuery(document).off(\"submit.form-plugin click.form-plugin\");\n }\n\n return this.off(\"submit.form-plugin click.form-plugin\");\n}\n","import { callFormMethod, isElement } from \"./form-members.js\";\nimport jQuery from \"jquery\";\n\n/**\n * An attribute of a form, or undefined when it is absent, as jQuery's attr returns it. The\n * subject may also be the document or a plain object, read through jQuery.\n */\nexport function formAttribute(form, name) {\n if (!isElement(form)) {\n return jQuery(form).attr(name);\n }\n\n var value = callFormMethod(form, \"getAttribute\", name);\n\n return value === null ? undefined : value;\n}\n","import { callFormMethod, formMember, isElement, tagName } from \"./form-members.js\";\nimport { formAttribute } from \"./form-attributes.js\";\nimport jQuery from \"jquery\";\nimport { submitterOf } from \"./submitter.js\";\n\n// Successful controls: which controls of a form are sent, and as which name/value fields\n// (https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#constructing-the-form-data-set).\n\n// Line breaks, sent as CRLF\nvar rLineBreak = /\\r\\n|\\r|\\n/g;\nvar rCR = /\\r/g;\n\n// Listed form elements that are never submitted.\nvar rUnsubmittable = /^(?:fieldset|object|output)$/;\n\n/**\n * Whether a control or option is disabled, also through a disabled fieldset or optgroup. Without\n * selector matching, only its own disabled property is read.\n */\nfunction isDisabled(el) {\n return typeof el.matches === \"function\" ? el.matches(\":disabled\") : !!el.disabled;\n}\n\n/**\n * The successful-control rule: whether a control is sent. `submitter` is the button that\n * submitted the control's form; other submit and image buttons of a form are not sent.\n */\nexport function isSuccessful(el, submitter) {\n var t = el.type;\n\n if (!el.name || isDisabled(el) || t === \"reset\" || t === \"button\") {\n return false;\n }\n\n if (t === \"checkbox\" || t === \"radio\") {\n return !!el.checked;\n }\n\n if (t === \"submit\" || t === \"image\") {\n return !el.form || submitter === el;\n }\n\n return tagName(el) !== \"select\" || el.selectedIndex !== -1;\n}\n\n// The value of a select: the selected option's value for one, a list for several.\nfunction selectValue(el) {\n var index = el.selectedIndex;\n\n if (index < 0) {\n return null;\n }\n\n var a = [],\n ops = el.options;\n var one = el.type === \"select-one\";\n var max = one ? index + 1 : ops.length;\n\n for (var i = one ? index : 0; i < max; i++) {\n var op = ops[i];\n\n if (op.selected && !isDisabled(op)) {\n var v = op.value;\n\n if (!v) {\n // extra pain for IE...\n v =\n op.attributes && op.attributes.value && !op.attributes.value.specified\n ? op.text\n : op.value;\n }\n\n if (one) {\n return v;\n }\n\n a.push(v);\n }\n }\n\n return a;\n}\n\n/**\n * The value of a control, whether or not it is successful: a list for a multiple select, null\n * for a select with nothing selected, otherwise a string with CRLF line breaks (a lone CR or LF\n * included).\n */\nexport function valueOf(el) {\n if (tagName(el) === \"select\") {\n return selectValue(el);\n }\n\n var v = jQuery(el).val();\n var raw = el.value;\n\n // jQuery before 4.0 drops carriage returns from .val(); read them from the value itself\n if (typeof raw === \"string\" && raw.replace(rCR, \"\") === v) {\n v = raw;\n }\n\n return v.replace(rLineBreak, \"\\r\\n\");\n}\n\n/**\n * The fields as a urlencoded body sends them: a selected file as its name.\n */\n// A lone surrogate becomes U+FFFD, as in a native submission; jQuery.param would throw.\nvar loneSurrogate = /[\\uD800-\\uDBFF](?![\\uDC00-\\uDFFF])|([^\\uD800-\\uDBFF]|^)([\\uDC00-\\uDFFF])/g;\n\nexport function wellFormed(value) {\n return typeof value === \"string\"\n ? value.replace(loneSurrogate, function (match, before) {\n return (before || \"\") + \"\\uFFFD\";\n })\n : value;\n}\n\nexport function urlencodedFields(fields) {\n return jQuery.map(fields, function (field) {\n var value =\n field.type === \"file\" && typeof field.value !== \"string\" ? field.value.name : field.value;\n var name = wellFormed(field.name);\n value = wellFormed(value);\n\n return name === field.name && value === field.value ? field : { name: name, value: value };\n });\n}\n\n/**\n * The serialization steps. `feature` holds what the entry detected at load (fileapi).\n */\nexport function createSuccessfulControls(feature) {\n var $ = jQuery;\n\n // #386; inputs that name the form in their form attribute, other than the candidates found.\n // A form only gets the ones it owns.\n function outsideControls(formId, els, owner) {\n // hat tip @thet; the id is compared, never built into a selector\n return $(\":input[form]\")\n .filter(function () {\n return (\n this.getAttribute(\"form\") === formId &&\n (!owner || this.form === owner) &&\n $.inArray(this, els) < 0\n );\n })\n .get();\n }\n\n // A descendant of a form is a candidate unless it is a control another form owns.\n function ownedBy(els, owner) {\n return $.grep(els, function (el) {\n return typeof el.form === \"undefined\" || el.form === owner;\n });\n }\n\n /**\n * The candidate controls of a form, in order: its elements, or every descendant it owns in\n * semantic mode, then the outside controls it owns that name it.\n */\n function controlsOf(form, semantic) {\n var formId = formAttribute(form, \"id\");\n var els = formMember(form, \"elements\");\n\n if (semantic || typeof els === \"undefined\") {\n // the document is not an element; it has its own getElementsByTagName\n els = isElement(form)\n ? callFormMethod(form, \"getElementsByTagName\", \"*\")\n : form.getElementsByTagName(\"*\");\n }\n\n els = $.makeArray(els);\n\n // the subject may also be a fieldset, the document or another container\n var owner = tagName(form) === \"form\" ? form : null;\n\n if (semantic && owner) {\n els = ownedBy(els, owner);\n }\n\n // FinesseRus: in non-IE browsers outside fields are already included in form.elements.\n if (formId && (semantic || /(Edge|Trident)\\//.test(navigator.userAgent))) {\n els = els.concat(outsideControls(formId, els, owner));\n }\n\n return els;\n }\n\n // The fields of a control's value, or null when the control is not sent.\n function fieldsOf(el) {\n var n = el.name;\n // read at call time, so a page that replaces $.fieldValue changes what is sent\n var v = $.fieldValue(el, true);\n\n if (v && v.constructor === Array) {\n return $.map(v, function (value) {\n return { name: n, value: value };\n });\n }\n\n if (feature.fileapi && el.type === \"file\") {\n var files = el.files;\n\n // #180: an empty field when no file is selected\n return files.length\n ? $.map(files, function (file) {\n return { name: n, value: file, type: el.type };\n })\n : [{ name: n, value: \"\", type: el.type }];\n }\n\n if (v === null || typeof v === \"undefined\") {\n return null;\n }\n\n return [{ name: n, value: v, type: el.type, required: el.required }];\n }\n\n // The clicked image's value and coordinates.\n function imageFields(sub, input, type) {\n var n = input.name;\n var value = { name: n, value: $(input).val() };\n\n if (type) {\n value.type = type;\n }\n\n return [value, { name: n + \".x\", value: sub.x }, { name: n + \".y\", value: sub.y }];\n }\n\n // Adds one candidate control's fields, and the control when it has a value to send.\n function addCandidate(collected, form, el, semantic) {\n if (!el.name || isDisabled(el) || rUnsubmittable.test(tagName(el))) {\n return;\n }\n\n var sub = semantic && el.type === \"image\" && submitterOf(form);\n\n if (sub) {\n // handle image inputs on the fly when semantic == true\n if (sub.el === el) {\n collected.fields.push.apply(collected.fields, imageFields(sub, el, el.type));\n }\n\n return;\n }\n\n var own = fieldsOf(el);\n\n if (own) {\n collected.controls.push(el);\n collected.fields.push.apply(collected.fields, own);\n }\n }\n\n // input type=='image' are not found in elements array! handle it here\n function addClickedImage(collected, form) {\n var sub = submitterOf(form);\n var input = sub && $(sub.el)[0];\n\n if (input && input.name && !isDisabled(input) && input.type === \"image\") {\n collected.fields.push.apply(collected.fields, imageFields(sub, input));\n }\n }\n\n /**\n * The fields of a form, as formToArray returns them, and the controls they came from.\n */\n function collect(form, semantic, filtering) {\n var collected = { fields: [], controls: [] };\n\n if (!form) {\n return collected;\n }\n\n var els = controlsOf(form, semantic);\n\n if (typeof filtering === \"function\") {\n els = $.map(els, filtering);\n }\n\n for (var i = 0; i < els.length; i++) {\n addCandidate(collected, form, els[i], semantic);\n }\n\n if (!semantic) {\n addClickedImage(collected, form);\n }\n\n return collected;\n }\n\n return {\n controlsOf: controlsOf,\n fieldsOf: fieldsOf,\n collect: collect,\n };\n}\n","import jQuery from \"jquery\";\nimport { keepContext } from \"./options.js\";\n\n// The XMLHttpRequest transports: $.ajax with the encoded fields, or FormData for file uploads.\nvar $ = jQuery;\n\n// utility fn for deep serialization: [name, value] pairs, as $.param encodes them\nexport function deepSerialize(extraData, traditional) {\n var param = $.param(extraData, traditional);\n var serialized = param ? param.split(\"&\") : [];\n var len = serialized.length;\n var result = [];\n var i, part;\n\n for (i = 0; i < len; i++) {\n // #252; undo param space replacement\n serialized[i] = serialized[i].replace(/\\+/g, \" \");\n part = serialized[i].split(\"=\");\n // #278; use array instead of object storage, favoring array serializations\n result.push([decodeURIComponent(part[0]), decodeURIComponent(part[1])]);\n }\n\n return result;\n}\n\n/**\n * Posts the fields and extraData as FormData, for files with the File API.\n * XMLHttpRequest Level 2 file uploads (big hat tip to francois2metz)\n */\nexport function sendFormData(submission) {\n var options = submission.options;\n var a = submission.fields;\n\n var formdata = new FormData();\n\n for (var i = 0; i < a.length; i++) {\n formdata.append(a[i].name, a[i].value);\n }\n\n if (options.extraData) {\n var serializedData = deepSerialize(options.extraData, submission.traditional);\n\n for (i = 0; i < serializedData.length; i++) {\n formdata.append(serializedData[i][0], serializedData[i][1]);\n }\n }\n\n options.data = null;\n\n var s = $.extend(true, {}, $.ajaxSettings, options, {\n contentType: false,\n processData: false,\n cache: false,\n type: submission.method || \"POST\",\n });\n\n keepContext(s, [$.ajaxSettings, options]);\n\n if (options.uploadProgress) {\n // workaround because jqXHR does not expose upload property: wraps the xhr factory, the\n // caller's or jQuery's\n var createXhr = s.xhr;\n\n s.xhr = function () {\n var xhr = createXhr.call(this);\n\n if (xhr.upload) {\n xhr.upload.addEventListener(\n \"progress\",\n function (event) {\n var percent = 0;\n // event.position is the deprecated name, read only when loaded is missing\n var position = event.loaded !== undefined ? event.loaded : event.position;\n var total = event.total;\n\n if (event.lengthComputable) {\n percent = Math.ceil((position / total) * 100);\n }\n\n options.uploadProgress(event, position, total, percent);\n },\n false\n );\n }\n\n return xhr;\n };\n }\n\n s.data = null;\n\n var beforeSend = s.beforeSend;\n\n s.beforeSend = function (xhr, o) {\n // Send FormData() provided by user\n if (options.formData) {\n o.data = options.formData;\n } else {\n o.data = formdata;\n }\n\n // a veto (false) cancels the upload, as on the other transports\n return beforeSend ? beforeSend.call(this, xhr, o) : undefined;\n };\n\n return $.ajax(s);\n}\n\n/**\n * Sends the encoded fields with $.ajax.\n */\nexport function sendAjax(submission) {\n return $.ajax(submission.options);\n}\n","import { callFormMethod } from \"./form-members.js\";\nimport { deepSerialize } from \"./xhr-transport.js\";\nimport jQuery from \"jquery\";\nimport { submitterFields } from \"./submitter.js\";\nimport { wellFormed } from \"./successful-controls.js\";\n\n// The iframe form post: the extra fields (submitter, CSRF, data), the form attributes set while\n// posting and restored after, and the native submit.\nvar $ = jQuery;\n\n// The form attributes an iframe upload changes while it posts.\nvar uploadAttributes = [\"action\", \"target\", \"method\", \"enctype\", \"encoding\"];\n\n// Called through the prototype: an extraData key or a form field may be named hasOwnProperty.\nvar hasOwn = Object.prototype.hasOwnProperty;\n\nfunction isGet(method) {\n return /^get$/i.test(method);\n}\n\n// Resolves both URLs through anchors, as jQuery does for crossDomain, so IE's anchor quirks\n// apply to both sides of the comparison.\nfunction isSameOrigin(url) {\n var origin = document.createElement(\"a\");\n var target = document.createElement(\"a\");\n\n origin.href = window.location.href;\n target.href = url;\n // IE fills in the host of a relative URL only once the resolved href is assigned back\n target.href = target.href; // eslint-disable-line no-self-assign\n\n return origin.protocol + \"//\" + origin.host === target.protocol + \"//\" + target.host;\n}\n\n/** Adds the clicked submitter (and an image's coordinates) to s.extraData. */\nexport function addSubmitterFields(s, form) {\n // add submitting element to data if we know it\n var fields = submitterFields(form);\n\n for (var n in fields) {\n s.extraData = s.extraData || {};\n s.extraData[wellFormed(n)] = wellFormed(fields[n]);\n }\n}\n\n/** Adds the page's CSRF token to s.extraData when the form is posted to the page's origin. */\nexport function addCsrfField(s, form, method, forms) {\n // Rails CSRF hack (thanks to Yvan Barthelemy); like jquery-ujs, only for the page's origin and\n // only when the form is posted, since a get form would put the token in the url\n var csrf_token = $(\"meta[name=csrf-token]\").attr(\"content\");\n var csrf_param = $(\"meta[name=csrf-param]\").attr(\"content\");\n var posts =\n !isGet(method) &&\n (!method || /post/i.test(method) || /post/i.test(forms.property(form, \"method\")));\n\n if (csrf_param && csrf_token && posts && isSameOrigin(s.url)) {\n s.extraData = s.extraData || {};\n s.extraData[csrf_param] = csrf_token;\n }\n}\n\nfunction setFormAttribute(form, name, value) {\n callFormMethod(form, \"setAttribute\", name, value);\n}\n\n/** The raw attributes the upload changes, null when absent, to put back exactly (#380). */\nexport function saveAttributes(form) {\n var saved = {};\n\n $.each(uploadAttributes, function (i, name) {\n saved[name] = callFormMethod(form, \"hasAttribute\", name)\n ? callFormMethod(form, \"getAttribute\", name)\n : null;\n });\n\n return saved;\n}\n\n/** Puts back the attributes saveAttributes recorded, removing those that were absent. */\nexport function restoreAttributes(form, saved) {\n $.each(uploadAttributes, function (i, name) {\n if (saved[name] === null) {\n callFormMethod(form, \"removeAttribute\", name);\n } else {\n setFormAttribute(form, name, saved[name]);\n }\n });\n}\n\n/** Points the form at the frame `target` with the upload's url, method and encoding. */\nexport function setUploadAttributes(form, target, method, s, forms) {\n var mp = \"multipart/form-data\";\n\n // update form attrs in IE friendly way\n setFormAttribute(form, \"target\", target);\n if (!method || /post/i.test(method)) {\n setFormAttribute(form, \"method\", \"POST\");\n } else if (isGet(method) && !isGet(forms.property(form, \"method\"))) {\n // a form posts natively only with GET or POST; other verbs keep the form's own method\n setFormAttribute(form, \"method\", \"GET\");\n }\n setFormAttribute(form, \"action\", s.url);\n\n // ie borks in some cases when setting encoding\n if (!s.skipEncodingOverride && (!method || /post/i.test(method))) {\n setFormAttribute(form, \"encoding\", mp);\n setFormAttribute(form, \"enctype\", mp);\n }\n}\n\n/** Appends a hidden input per extraData field to the form; each input is pushed onto `added`. */\nexport function addExtraInputs(form, ownerDocument, extraData, traditional, added) {\n // Builds the input with DOM properties: a name is never parsed as HTML.\n function addHiddenInput(name, value) {\n var input = ownerDocument.createElement(\"input\");\n\n input.type = \"hidden\";\n input.name = name;\n added.push($(input).val(value).appendTo(form)[0]);\n }\n\n if (extraData) {\n for (var n in extraData) {\n if (hasOwn.call(extraData, n)) {\n // if using the $.param format that allows for multiple values with the same name\n if (\n $.isPlainObject(extraData[n]) &&\n hasOwn.call(extraData[n], \"name\") &&\n hasOwn.call(extraData[n], \"value\")\n ) {\n addHiddenInput(extraData[n].name, extraData[n].value);\n } else {\n // arrays and objects become one field per value, as $.param sends them (#597)\n var single = {};\n\n single[n] = extraData[n];\n var fields = deepSerialize(single, traditional);\n\n for (var f = 0; f < fields.length; f++) {\n addHiddenInput(fields[f][0], fields[f][1]);\n }\n }\n }\n }\n }\n}\n\n/** Submits the form natively, even when a control named submit hides the method. */\nexport function submitForm(form) {\n try {\n form.submit();\n } catch (err) {\n // just in case form has element with name/id of 'submit'\n callFormMethod(form, \"submit\");\n }\n}\n","import jQuery from \"jquery\";\nimport { log } from \"./diagnostics.js\";\n\n// The iframe response reader: turns the frame's document into the mock xhr's text, XML, status\n// and dataType, then parses it as $.ajax would (dataFilter, JSON, script).\nvar $ = jQuery;\n\n/** The frame's document, or null when the browser denies access to it. */\nexport function getDoc(frame) {\n /* it looks like contentWindow or contentDocument do not\n * carry the protocol property in ie8, when running under ssl\n * frame.document is the only valid response document, since\n * the protocol is know but not on the other two objects. strange?\n * \"Same origin policy\" http://en.wikipedia.org/wiki/Same_origin_policy\n */\n\n var doc = null;\n\n // IE8 cascading access check\n try {\n if (frame.contentWindow) {\n doc = frame.contentWindow.document;\n }\n } catch (err) {\n // IE8 access denied under ssl & missing protocol\n log(\"cannot get iframe.contentWindow document: \" + err);\n }\n\n if (doc) {\n // successful getting content\n return doc;\n }\n\n try {\n // simply checking may throw in ie8 under ssl or mismatched protocol\n doc = frame.contentDocument ? frame.contentDocument : frame.document;\n } catch (err) {\n // last attempt\n log(\"cannot get iframe.contentDocument: \" + err);\n doc = frame.document;\n }\n\n return doc;\n}\n\n/** Parses the response text or XML for the given (lowercase) dataType. */\nexport function httpData(xhr, type, s) {\n // mostly lifted from jq1.4.4\n\n var ct = xhr.getResponseHeader(\"content-type\") || \"\",\n xml = (type === \"xml\" || !type) && ct.indexOf(\"xml\") >= 0,\n data = xml ? xhr.responseXML : xhr.responseText;\n\n if (xml && data.documentElement.nodeName === \"parsererror\") {\n if ($.error) {\n $.error(\"parsererror\");\n }\n }\n if (s && s.dataFilter) {\n data = s.dataFilter(data, type);\n }\n if (typeof data === \"string\") {\n if ((type === \"json\" || !type) && ct.indexOf(\"json\") >= 0) {\n data = JSON.parse(data);\n } else if (type === \"script\") {\n $.globalEval(data);\n }\n }\n\n return data;\n}\n\n// Copies the status and statusText attributes of an element onto the mock xhr.\nfunction readStatus(xhr, el) {\n // support for XHR 'status' & 'statusText' emulation :\n xhr.status = Number(el.getAttribute(\"status\")) || xhr.status;\n xhr.statusText = el.getAttribute(\"statusText\") || xhr.statusText;\n}\n\n// Fills the mock xhr from the document itself.\nfunction readDocument(doc, xhr, s, isXml) {\n var docRoot = doc.body ? doc.body : doc.documentElement;\n\n xhr.responseText = docRoot ? docRoot.innerHTML : null;\n xhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc;\n if (isXml) {\n s.dataType = \"xml\";\n }\n xhr.getResponseHeader = function (header) {\n // the dataType in lowercase, as $.ajax reads it\n var headers = { \"content-type\": s.dataType && s.dataType.toLowerCase() };\n\n return headers[header.toLowerCase()];\n };\n if (docRoot) {\n readStatus(xhr, docRoot);\n }\n}\n\n// A response embedded in a textarea, or text wrapped in pre or body, replaces responseText.\nfunction readEmbedded(doc, xhr, dt, s) {\n var scr = /(json|script|text)/.test(dt);\n\n if (!scr && !s.textarea) {\n return;\n }\n // see if user embedded response in textarea\n var ta = doc.getElementsByTagName(\"textarea\")[0];\n\n if (ta) {\n xhr.responseText = ta.value;\n readStatus(xhr, ta);\n } else if (scr) {\n // account for browsers injecting pre around json response\n var pre = doc.getElementsByTagName(\"pre\")[0];\n var b = doc.getElementsByTagName(\"body\")[0];\n\n if (pre) {\n xhr.responseText = pre.textContent ? pre.textContent : pre.innerText;\n } else if (b) {\n xhr.responseText = b.textContent ? b.textContent : b.innerText;\n }\n }\n}\n\n/**\n * Reads and parses the response document into the mock xhr. Returns {status, data, errMsg}, or\n * null when `retry()` asks to read the document again later (Opera's untraversable DOM).\n */\nexport function readResponse(doc, xhr, s, retry) {\n var status = \"success\",\n data,\n errMsg;\n\n try {\n var isXml = /^xml$/i.test(s.dataType) || doc.XMLDocument || $.isXMLDoc(doc);\n\n log(\"isXml=\" + isXml);\n\n if (!isXml && window.opera && (doc.body === null || !doc.body.innerHTML)) {\n // in some browsers (Opera) the iframe DOM is not always traversable when\n // the onload callback fires, so we loop a bit to accommodate\n if (retry()) {\n return null;\n }\n // let this fall through because server response could be an empty document\n }\n\n readDocument(doc, xhr, s, isXml);\n\n var dt = (s.dataType || \"\").toLowerCase();\n\n readEmbedded(doc, xhr, dt, s);\n\n try {\n data = httpData(xhr, dt, s);\n } catch (err) {\n status = \"parsererror\";\n xhr.error = errMsg = err || status;\n }\n } catch (err) {\n log(\"error caught: \", err);\n status = \"error\";\n xhr.error = errMsg = err;\n }\n\n return { status: status, data: data, errMsg: errMsg };\n}\n","import jQuery from \"jquery\";\nimport { log } from \"./diagnostics.js\";\n\n// The iframe upload's lifecycle: the mock xhr and the Deferred, the global ajax events, the\n// beforeSend veto, the timeout, abort and settling.\nvar $ = jQuery;\n\n/**\n * Creates the lifecycle of one upload with the merged settings `s`. `frame.stop()` stops the\n * frame's load and `frame.release()` removes or resets the frame after the upload.\n */\nexport function createLifecycle(s, frame) {\n var g,\n timeoutHandle,\n callbackProcessed,\n deferred = $.Deferred();\n\n var xhr = {\n // mock object\n aborted: 0,\n responseText: null,\n responseXML: null,\n status: 0,\n statusText: \"n/a\",\n getAllResponseHeaders: function () {},\n getResponseHeader: function () {},\n setRequestHeader: function () {},\n abort: function (status) {\n abort(status, [xhr, \"aborted\", status]);\n },\n };\n\n // #341\n deferred.abort = function (status) {\n xhr.abort(status);\n };\n\n function done() {\n return xhr.aborted || callbackProcessed;\n }\n\n // Completes an aborted upload once and rejects the Deferred with `rejection`.\n // `textStatus` replaces the default \"timeout\"/\"aborted\" text status.\n function abort(status, rejection, textStatus) {\n var e = textStatus || (status === \"timeout\" ? \"timeout\" : \"aborted\");\n\n if (done()) {\n return;\n }\n\n log(\"aborting upload... \" + e);\n xhr.aborted = 1;\n frame.stop();\n xhr.error = e;\n if (s.error) {\n s.error.call(s.context, xhr, e, status);\n }\n deferred.reject.apply(deferred, rejection);\n\n if (g) {\n $.event.trigger(\"ajaxError\", [xhr, s, e]);\n }\n\n complete(e);\n }\n\n // The global events that end every upload, cancelled ones included.\n function endGlobalEvents() {\n if (g) {\n $.event.trigger(\"ajaxComplete\", [xhr, s]);\n }\n\n if (g && !--$.active) {\n $.event.trigger(\"ajaxStop\");\n }\n }\n\n // The steps every finished or aborted upload ends with, in $.ajax order.\n function complete(status) {\n if (s.complete) {\n s.complete.call(s.context, xhr, status);\n }\n\n endGlobalEvents();\n clearTimeout(timeoutHandle);\n\n // clean up\n setTimeout(function () {\n frame.release();\n xhr.responseXML = null;\n }, 100);\n }\n\n // A beforeSend veto ends the upload as $.ajax cancels a request: no callbacks, the global\n // events end with ajaxError \"canceled\".\n function cancel() {\n if (done()) {\n return;\n }\n\n callbackProcessed = true;\n deferred.reject();\n if (g) {\n $.event.trigger(\"ajaxError\", [xhr, s, \"canceled\"]);\n }\n endGlobalEvents();\n }\n\n // Fires the start events and beforeSend; false when the upload must not be posted.\n function start() {\n g = s.global;\n // trigger ajax global events so that activity/block indicators work like normal\n if (g && $.active++ === 0) {\n $.event.trigger(\"ajaxStart\");\n }\n\n if (s.beforeSend && s.beforeSend.call(s.context, xhr, s) === false) {\n cancel();\n\n return false;\n }\n\n if (xhr.aborted) {\n // abort() in beforeSend already completed the upload\n return false;\n }\n\n if (g) {\n $.event.trigger(\"ajaxSend\", [xhr, s]);\n }\n\n // an ajaxSend handler may abort too\n return !xhr.aborted;\n }\n\n // Resolves the upload; returns {error} when the success callback threw.\n function succeed(data) {\n var failure;\n\n try {\n s.success.call(s.context, data, \"success\", xhr);\n } catch (err) {\n failure = { error: err };\n }\n\n deferred.resolve(xhr.responseText, \"success\", xhr);\n\n if (g) {\n $.event.trigger(\"ajaxSuccess\", [xhr, s, data]);\n }\n\n return failure;\n }\n\n // Settles the upload with the response reader's {status, data, errMsg}.\n function settle(result) {\n var status = result.status,\n errMsg = result.errMsg;\n\n if (xhr.aborted) {\n // abort() completed the upload while its response was processed\n log(\"upload aborted\");\n\n return;\n }\n\n // an emulated HTTP error status wins, as in $.ajax; a parse error is kept otherwise\n if (xhr.status && !((xhr.status >= 200 && xhr.status < 300) || xhr.status === 304)) {\n status = \"error\";\n }\n\n callbackProcessed = true;\n\n // ordering of these callbacks/triggers is odd, but that's how $.ajax does it\n if (status === \"success\") {\n var failure = succeed(result.data);\n\n complete(status);\n if (failure) {\n // the upload is settled; the success callback's exception still reaches the console\n throw failure.error;\n }\n\n return;\n }\n\n if (typeof errMsg === \"undefined\") {\n errMsg = xhr.statusText;\n }\n if (s.error) {\n s.error.call(s.context, xhr, status, errMsg);\n }\n deferred.reject(xhr, \"error\", errMsg);\n if (g) {\n $.event.trigger(\"ajaxError\", [xhr, s, errMsg]);\n }\n\n complete(status);\n }\n\n return {\n xhr: xhr,\n deferred: deferred,\n start: start,\n done: done,\n abort: abort,\n settle: settle,\n // Settles an upload that failed with an exception (ignored once aborted).\n fail: function (err) {\n settle({ status: \"error\", errMsg: err });\n },\n // Runs `onTimeout` after s.timeout, when set.\n startTimer: function (onTimeout) {\n if (s.timeout) {\n timeoutHandle = setTimeout(onTimeout, s.timeout);\n }\n },\n stopTimer: function () {\n clearTimeout(timeoutHandle);\n timeoutHandle = undefined;\n },\n };\n}\n","import {\n addCsrfField,\n addExtraInputs,\n addSubmitterFields,\n restoreAttributes,\n saveAttributes,\n setUploadAttributes,\n submitForm,\n} from \"./iframe-post.js\";\nimport { closestByTag, formMember } from \"./form-members.js\";\nimport { deprecate, log } from \"./diagnostics.js\";\nimport { getDoc, readResponse } from \"./iframe-response.js\";\nimport { createLifecycle } from \"./iframe-lifecycle.js\";\nimport jQuery from \"jquery\";\nimport { keepContext } from \"./options.js\";\n\n// The iframe transport: posts the form itself into a hidden frame and reads the response from it,\n// for file uploads without the File API or when the iframe option asks for it.\nvar $ = jQuery;\n\n/**\n * The iframe send step. `hasProp` is what the entry detected at load; `forms.property` reads a\n * form property as attr2 does.\n */\nexport function createIframeTransport(hasProp, forms) {\n var CLIENT_TIMEOUT_ABORT = 1;\n var SERVER_ABORT = 2;\n // tells apart the frames of uploads that start in the same millisecond\n var frameCount = 0;\n\n // ensure that every serialized input is still enabled\n function enableControls(elements) {\n for (var i = 0; i < elements.length; i++) {\n var el = $(elements[i]);\n\n if (hasProp) {\n el.prop(\"disabled\", false);\n } else {\n el.removeAttr(\"disabled\");\n }\n }\n }\n\n // Names the frame's window, when the page may: a cross-origin or sandboxed frame refuses.\n function nameWindow(frame, name) {\n try {\n if (frame.contentWindow) {\n frame.contentWindow.name = name;\n }\n } catch (ignore) {}\n }\n\n // The frame the form posts into: the iframeTarget, named `id` when it has no name, or a new\n // hidden frame named `id`. Returns the frame and the name the form targets.\n function createFrame(s, id, ownerDocument) {\n var $io, n;\n\n if (s.iframeTarget) {\n $io = $(s.iframeTarget, ownerDocument);\n n = $io.attr(\"name\");\n if (!n) {\n $io.attr(\"name\", id);\n // a frame already in the page keeps the browsing context name it was inserted with\n $io.each(function () {\n nameWindow(this, id);\n });\n } else {\n id = n;\n }\n } else {\n var io = ownerDocument.createElement(\"iframe\");\n\n io.setAttribute(\"name\", id);\n io.setAttribute(\"src\", s.iframeSrc);\n $io = $(io);\n $io.css({ position: \"absolute\", top: \"-1000px\", left: \"-1000px\" });\n }\n\n return { $io: $io, id: id };\n }\n\n // The frame hooks the lifecycle calls: stop a load in progress, and release after the upload.\n function frameHooks(s, $io) {\n return {\n stop: function () {\n try {\n // #214, #257\n if ($io[0].contentWindow.document.execCommand) {\n $io[0].contentWindow.document.execCommand(\"Stop\");\n }\n } catch (ignore) {}\n\n $io.attr(\"src\", s.iframeSrc); // abort op in progress\n },\n release: function () {\n if (!s.iframeTarget) {\n $io.remove();\n } else {\n // adding else to clean up existing iframe response.\n $io.attr(\"src\", s.iframeSrc);\n }\n },\n };\n }\n\n function listen(io, cb) {\n if (io.attachEvent) {\n io.attachEvent(\"onload\", cb);\n } else {\n io.addEventListener(\"load\", cb, false);\n }\n }\n\n function unlisten(io, cb) {\n if (io.detachEvent) {\n io.detachEvent(\"onload\", cb);\n } else {\n io.removeEventListener(\"load\", cb, false);\n }\n }\n\n // private function for handling file uploads (hat tip to YAHOO!)\n function fileUploadIframe(submission) {\n var form = submission.form,\n method = submission.method;\n\n var s = keepContext($.extend(true, {}, $.ajaxSettings, submission.options), [\n $.ajaxSettings,\n submission.options,\n ]);\n\n s.context = s.context || s;\n var ownerDocument = formMember(form, \"ownerDocument\");\n var $body = $(closestByTag(form, [\"body\"]));\n var frame = createFrame(s, \"jqFormIO\" + new Date().getTime() + frameCount++, ownerDocument);\n var $io = frame.$io,\n io = $io[0];\n var life = createLifecycle(s, frameHooks(s, $io));\n var domCheckCount = 50;\n\n if (!life.start()) {\n return life.deferred;\n }\n\n addSubmitterFields(s, form);\n addCsrfField(s, form, method, forms);\n\n // look for server aborts\n function checkState() {\n try {\n var state = getDoc(io).readyState;\n\n log(\"state = \" + state);\n if (state && state.toLowerCase() === \"uninitialized\") {\n setTimeout(checkState, 50);\n }\n } catch (e) {\n log(\"Server abort: \", e, \" (\", e.name, \")\");\n cb(SERVER_ABORT);\n life.stopTimer();\n }\n }\n\n // take a breath so that pending repaints get some cpu time before the upload starts\n function doSubmit() {\n var saved = saveAttributes(form);\n\n setUploadAttributes(form, frame.id, method, s, forms);\n\n // support timout\n life.startTimer(function () {\n cb(CLIENT_TIMEOUT_ABORT);\n });\n\n // add \"extra\" data to form if provided in options\n var extraInputs = [];\n\n try {\n addExtraInputs(form, ownerDocument, s.extraData, submission.traditional, extraInputs);\n\n if (!s.iframeTarget) {\n // add iframe to doc and submit the form\n $io.appendTo($body);\n }\n\n // A connected form posting into a frame outside the document opens a new window.\n var root = ownerDocument.documentElement;\n\n if (io && $.contains(root, form) && !$.contains(root, io)) {\n var notInDocument = \"jquery.form: the upload frame is not in the document\";\n\n life.abort(notInDocument, [life.xhr, \"error\", notInDocument], \"error\");\n\n return;\n }\n\n listen(io, cb);\n setTimeout(checkState, 15);\n submitForm(form);\n } finally {\n // reset attrs and remove \"extra\" input elements\n restoreAttributes(form, saved);\n $(extraInputs).remove();\n }\n }\n\n // Reads the next document by Opera's rules: false once the retries are used up.\n function retry() {\n if (--domCheckCount) {\n log(\"requeing onLoad callback, DOM not available\");\n setTimeout(cb, 250);\n\n return true;\n }\n\n return false;\n }\n\n function cb(e) {\n if (life.done()) {\n return;\n }\n\n var doc = getDoc(io);\n\n if (!doc) {\n log(\"cannot access response document\");\n e = SERVER_ABORT;\n }\n if (e === CLIENT_TIMEOUT_ABORT) {\n life.abort(\"timeout\", [life.xhr, \"timeout\"]);\n\n return;\n }\n if (e === SERVER_ABORT) {\n life.abort(\"server abort\", [life.xhr, \"error\", \"server abort\"]);\n\n return;\n }\n\n if (doc.location.href === s.iframeSrc) {\n // response not received yet\n return;\n }\n\n unlisten(io, cb);\n\n var result = readResponse(doc, life.xhr, s, retry);\n\n if (result) {\n life.settle(result);\n }\n }\n\n // An exception while posting settles the upload with \"error\" and the exception.\n function post() {\n if (life.done()) {\n // aborted before the delayed post\n return;\n }\n\n try {\n doSubmit();\n } catch (err) {\n log(\"upload failed: \", err);\n life.fail(err);\n }\n }\n\n if (s.forceSync) {\n post();\n } else {\n setTimeout(post, 10); // this lets dom updates render\n }\n\n return life.deferred;\n }\n\n return function sendIframe(submission) {\n var jqxhr;\n\n // now, while the controls are still listed: ajaxSubmit clears the list when it returns,\n // before a closeKeepAlive request completes\n enableControls(submission.controls);\n\n // hack to fix Safari hang (thanks to Tim Molendijk for this)\n // see: http://groups.google.com/group/jquery-dev/browse_thread/thread/36395b7ab510dd5d\n if (submission.options.closeKeepAlive) {\n deprecate(\"closeKeepAlive\", \"closeKeepAlive works around a Safari 3/4 bug and is deprecated\");\n $.get(submission.options.closeKeepAlive, function () {\n jqxhr = fileUploadIframe(submission);\n });\n } else {\n jqxhr = fileUploadIframe(submission);\n }\n\n return jqxhr;\n };\n}\n","import { deprecate, log } from \"./diagnostics.js\";\nimport { assertRealParent } from \"./form-members.js\";\nimport jQuery from \"jquery\";\nimport { keepContext } from \"./options.js\";\nimport { urlencodedFields } from \"./successful-controls.js\";\n\n// A Submission is one ajaxSubmit call once its vetoes have passed:\n// { form, $form, fields, controls, options, method, traditional }. `options` is the object the\n// callbacks and events receive; later steps change it in place.\n\n/**\n * The submission steps. `feature` holds what the entry detected at load (fileapi, formdata), and\n * `forms` reads form attributes and attr2-style properties (attribute, property), and\n * `serialization` collects the form's fields and controls.\n */\nexport function createSubmission(feature, forms, serialization) {\n var $ = jQuery;\n\n function refuse(message) {\n log(message);\n\n return null;\n }\n\n // The options merged over the form's action, the method, and the ajax defaults.\n function withDefaults(form, options, method) {\n var action = options.url || forms.property(form, \"action\");\n var url = typeof action === \"string\" ? action.trim() : \"\";\n\n // clean url (don't include hash value); an action that is only a fragment means this page\n url = url.split(\"#\")[0] || window.location.href.split(\"#\")[0];\n // IE requires javascript:false in https, but this breaks chrome >83 and goes against spec.\n // Instead of using javascript:false always, let's only apply it for IE.\n var isMsie = /(MSIE|Trident)/.test(navigator.userAgent || \"\");\n var iframeSrc = isMsie && /^https/i.test(document.URL) ? \"javascript:false\" : \"about:blank\"; // eslint-disable-line no-script-url\n\n var merged = $.extend(\n true,\n {\n url: url,\n success: $.ajaxSettings.success,\n type: method || $.ajaxSettings.type,\n iframeSrc: iframeSrc,\n },\n options\n );\n\n return keepContext(merged, [options]);\n }\n\n /**\n * The one method every transport sends, read after the hooks: `method` wins over `type`, and\n * `type` is set to it. Undefined when only the ajax default applies, so each transport keeps\n * its own default.\n */\n function resolveMethod(options, defaultType) {\n var resolved = options.method || options.type;\n\n options.type = resolved;\n\n return resolved === defaultType && !options.method ? undefined : resolved;\n }\n\n // The data option, kept as extraData and encoded, or undefined without one.\n function extraQuery(fields, options, traditional) {\n if (!options.data) {\n return undefined;\n }\n\n var optionsData = typeof options.data === \"function\" ? options.data(fields) : options.data;\n\n if (typeof optionsData === \"string\") {\n if (options.requestFormat === \"json\") {\n throw new Error(\n 'jquery.form: requestFormat \"json\" needs object data; a string data option is a query string'\n );\n }\n\n // a query string: sent as-is when urlencoded, as its own fields otherwise\n options.extraData = queryPairs(optionsData);\n\n return optionsData;\n }\n\n options.extraData = optionsData;\n\n return $.param(optionsData, traditional);\n }\n\n // Sets a key as an own data property, so a name like __proto__ is an ordinary key.\n function defineKey(object, key, value) {\n Object.defineProperty(object, key, {\n value: value,\n enumerable: true,\n writable: true,\n configurable: true,\n });\n }\n\n /**\n * requestFormat \"json\" (#545): the fields as an object (a repeated name gives an array), merged\n * with object data, sent as a JSON body. Based on the idea in PR #557 by zhangciwu.\n */\n function jsonBody(options, fields) {\n if (/^get$/i.test(options.type)) {\n throw new Error('jquery.form: requestFormat \"json\" needs a method with a body, such as POST');\n }\n\n var body = {};\n var own = Object.prototype.hasOwnProperty;\n\n for (var i = 0; i < fields.length; i++) {\n var name = fields[i].name;\n\n if (!own.call(body, name)) {\n defineKey(body, name, fields[i].value);\n } else if (Array.isArray(body[name])) {\n body[name].push(fields[i].value);\n } else {\n defineKey(body, name, [body[name], fields[i].value]);\n }\n }\n\n var extra = options.extraData;\n\n for (var key in extra) {\n if (own.call(extra, key)) {\n defineKey(body, key, extra[key]);\n }\n }\n\n options.data = JSON.stringify(body);\n options.contentType = \"application/json; charset=UTF-8\";\n }\n\n // The fields of a query string, as the { name, value } list $.param takes.\n function queryPairs(query) {\n var pairs = [];\n var parts = query.split(\"&\");\n\n for (var i = 0; i < parts.length; i++) {\n if (parts[i]) {\n var at = parts[i].indexOf(\"=\");\n var name = at < 0 ? parts[i] : parts[i].slice(0, at);\n var value = at < 0 ? \"\" : parts[i].slice(at + 1);\n\n pairs.push({ name: decodeQuery(name), value: decodeQuery(value) });\n }\n }\n\n return pairs;\n }\n\n function decodeQuery(text) {\n return decodeURIComponent(text.replace(/\\+/g, \" \"));\n }\n\n // Puts the encoded fields in the url for a get, and in the data otherwise.\n function encode(options, q, qx) {\n if (qx) {\n q = q ? q + \"&\" + qx : qx;\n }\n\n if (options.type.toUpperCase() === \"GET\") {\n // the query goes before any fragment in the url option\n var hashAt = options.url.indexOf(\"#\");\n var base = hashAt < 0 ? options.url : options.url.slice(0, hashAt);\n\n options.url =\n base + (base.indexOf(\"?\") >= 0 ? \"&\" : \"?\") + q + options.url.slice(base.length);\n options.data = null; // data is null for 'get'\n } else {\n options.data = q; // data is the query string for 'post'\n }\n }\n\n // A callback option as a list: an array as given, one function, or none.\n function callbackList(callback) {\n if (Array.isArray(callback)) {\n return callback;\n }\n\n return callback ? [callback] : [];\n }\n\n // Calls each callback in order with the same this and arguments.\n function callEach(callbacks, context, args) {\n for (var i = 0; i < callbacks.length; i++) {\n callbacks[i].apply(context, args);\n }\n }\n\n /**\n * Resolves the options, serializes the form, and runs the vetoes: the Submission, or null when\n * an event or callback stopped it.\n */\n function prepare($set, options) {\n $set.each(function () {\n assertRealParent(this);\n });\n\n var form = $set[0];\n var method = options.method || options.type || forms.property(form, \"method\");\n\n options = withDefaults(form, options, method);\n\n // the ajax default type, when neither the caller nor the form gave a method\n var defaultType = method ? undefined : options.type;\n\n // hook for manipulating the form data before it is extracted;\n // convenient for use with rich editors like tinyMCE or FCKEditor\n var veto = {};\n\n $set.trigger(\"form-pre-serialize\", [$set, options, veto]);\n if (veto.veto) {\n return refuse(\"ajaxSubmit: submit vetoed via form-pre-serialize trigger\");\n }\n\n // provide opportunity to alter form data before it is serialized\n if (options.beforeSerialize && options.beforeSerialize($set, options) === false) {\n return refuse(\"ajaxSubmit: submit aborted via beforeSerialize callback\");\n }\n\n var traditional = options.traditional;\n\n if (typeof traditional === \"undefined\") {\n traditional = $.ajaxSettings.traditional;\n }\n\n var collected = serialization.collect($set[0], options.semantic, options.filtering);\n var fields = collected.fields;\n var controls = collected.controls;\n var qx = extraQuery(fields, options, traditional);\n\n // give pre-submit callback an opportunity to abort the submit\n if (options.beforeSubmit && options.beforeSubmit(fields, $set, options) === false) {\n return refuse(\"ajaxSubmit: submit aborted via beforeSubmit callback\");\n }\n\n // fire vetoable 'validate' event\n $set.trigger(\"form-submit-validate\", [fields, $set, options, veto]);\n if (veto.veto) {\n return refuse(\"ajaxSubmit: submit vetoed via form-submit-validate trigger\");\n }\n\n method = resolveMethod(options, defaultType);\n\n if (options.requestFormat === \"json\") {\n jsonBody(options, fields);\n } else {\n encode(options, $.param(urlencodedFields(fields), traditional), qx);\n }\n\n return {\n form: form,\n $form: $set,\n fields: fields,\n controls: controls,\n options: options,\n method: method,\n traditional: traditional,\n };\n }\n\n /**\n * Wraps success, error and complete (a function or an array of them, as $.ajax takes) so each\n * also receives the form, and adds the resetForm,\n * clearForm and target steps before the success callbacks.\n */\n function deliver(submission) {\n var $set = submission.$form;\n var options = submission.options;\n var callbacks = [];\n\n if (options.resetForm) {\n callbacks.push(function () {\n $set.resetForm();\n });\n }\n\n if (options.clearForm) {\n callbacks.push(function () {\n $set.clearForm(options.includeHidden);\n });\n }\n\n // perform a load on the target only if dataType is not provided\n if (!options.dataType && options.target) {\n var successes = callbackList(options.success);\n\n callbacks.push(function (data, textStatus, jqXHR) {\n var successArguments = arguments,\n fn = options.replaceTarget ? \"replaceWith\" : \"html\",\n $target = $(options.target);\n\n // Only a string response is inserted. jQuery has already parsed a JSON or XML response,\n // and inserting it would parse each of its strings as HTML.\n if (typeof data === \"string\") {\n $target[fn](data);\n } else {\n log(\"target: the response was parsed by jQuery, so it is not inserted\");\n }\n\n if (!$target.length) {\n // nothing to fill: success still runs once, with the normal context\n callEach(successes, this, successArguments);\n }\n\n $target.each(function () {\n callEach(successes, this, successArguments);\n });\n });\n } else {\n $.merge(callbacks, callbackList(options.success));\n }\n\n options.success = function (data, status, xhr) {\n // jQuery 1.4+ passes xhr as 3rd arg\n var context = options.context || this; // jQuery 1.4+ supports scope context\n\n for (var i = 0, max = callbacks.length; i < max; i++) {\n callbacks[i].apply(context, [data, status, xhr || $set, $set]);\n }\n };\n\n if (options.error) {\n var errors = callbackList(options.error);\n\n options.error = function (xhr, status, error) {\n callEach(errors, options.context || this, [xhr, status, error, $set]);\n };\n }\n\n if (options.complete) {\n var completes = callbackList(options.complete);\n\n options.complete = function (xhr, status) {\n callEach(completes, options.context || this, [xhr, status, $set]);\n };\n }\n }\n\n /**\n * The transport for a submission: \"iframe\" for files without the File API or when forced,\n * \"formdata\" for files with it, \"ajax\" otherwise.\n */\n function chooseTransport(submission) {\n var $set = submission.$form;\n var options = submission.options;\n\n // [value] (issue #113), also see comment:\n // https://github.com/malsup/form/commit/588306aedba1de01388032d5f42a60159eea9228#commitcomment-2180219\n // and the file inputs outside the form that belong to it through their form attribute\n var fileInputs = $(\"input[type=file]:enabled\", $set)\n .add($(submission.controls).filter(\"input[type=file]\"))\n .filter(function () {\n return $(this).val() !== \"\";\n });\n var hasFileInputs = fileInputs.length > 0;\n // compared as the browser does: ASCII case-insensitive, without surrounding whitespace\n var mp = /^[\\t\\n\\f\\r ]*multipart\\/form-data[\\t\\n\\f\\r ]*$/i;\n var multipart =\n mp.test(forms.attribute($set[0], \"enctype\")) || mp.test(forms.attribute($set[0], \"encoding\"));\n var fileAPI = feature.fileapi && feature.formdata;\n\n log(\"fileAPI :\" + fileAPI);\n\n var shouldUseFrame = (hasFileInputs || multipart) && !fileAPI;\n\n var transport = (hasFileInputs || multipart) && fileAPI ? \"formdata\" : \"ajax\";\n\n // options.iframe allows user to force iframe mode\n // 06-NOV-09: now defaulting to iframe mode if file input is detected\n if (options.iframe !== false && (options.iframe || shouldUseFrame)) {\n transport = \"iframe\";\n }\n\n if (transport === \"iframe\" && !options.iframe) {\n deprecate(\n \"iframe\",\n \"choosing the iframe transport automatically without FormData is deprecated, set iframe: true\"\n );\n }\n\n if (transport !== \"ajax\" && options.requestFormat === \"json\") {\n throw new Error(\n 'jquery.form: requestFormat \"json\" cannot send files or use the iframe transport'\n );\n }\n\n return transport;\n }\n\n return { prepare: prepare, deliver: deliver, chooseTransport: chooseTransport };\n}\n","/*!\n * jQuery Form Plugin\n * version: 4.5.0\n * Requires jQuery v1.7.2 or later\n * Project repository: https://github.com/jquery-form/form\n\n * Copyright 2017 Kevin Morris\n * Copyright 2006 M. Alsup\n\n * Dual licensed under the LGPL-2.1+ or MIT licenses\n * https://github.com/jquery-form/form#license\n\n * This library is free software; you can redistribute it and/or\n * modify it under the terms of the GNU Lesser General Public\n * License as published by the Free Software Foundation; either\n * version 2.1 of the License, or (at your option) any later version.\n * This library is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n */\nimport { ajaxForm, ajaxFormUnbind } from \"./ajax-form.js\";\nimport { callFormMethod, tagName } from \"./form-members.js\";\nimport {\n createSuccessfulControls,\n isSuccessful,\n urlencodedFields,\n valueOf,\n} from \"./successful-controls.js\";\nimport { deprecate, deprecateOldJQuery, log } from \"./diagnostics.js\";\nimport { sendAjax, sendFormData } from \"./xhr-transport.js\";\nimport { createIframeTransport } from \"./iframe-transport.js\";\nimport { createSubmission } from \"./submission.js\";\nimport { formAttribute } from \"./form-attributes.js\";\nimport jQuery from \"jquery\";\nimport { submitOptions } from \"./options.js\";\nimport { submitterElement } from \"./submitter.js\";\n\n(function ($) {\n \"use strict\";\n\n /*\n\t\tUsage Note:\n\t\t-----------\n\t\tDo not use both ajaxSubmit and ajaxForm on the same form. These\n\t\tfunctions are mutually exclusive. Use ajaxSubmit if you want\n\t\tto bind your own submit handler to the form. For example,\n\n\t\t$(document).ready(function() {\n\t\t\t$('#myForm').on('submit', function(e) {\n\t\t\t\te.preventDefault(); // <-- important\n\t\t\t\t$(this).ajaxSubmit({\n\t\t\t\t\ttarget: '#output'\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\n\t\tUse ajaxForm when you want the plugin to manage all the event binding\n\t\tfor you. For example,\n\n\t\t$(document).ready(function() {\n\t\t\t$('#myForm').ajaxForm({\n\t\t\t\ttarget: '#output'\n\t\t\t});\n\t\t});\n\n\t\tYou can also use ajaxForm with delegation (requires jQuery v1.7+), so the\n\t\tform does not have to exist when you invoke ajaxForm:\n\n\t\t$('#myForm').ajaxForm({\n\t\t\tdelegation: true,\n\t\t\ttarget: '#output'\n\t\t});\n\n\t\tWhen using ajaxForm, the ajaxSubmit function will be invoked for you\n\t\tat the appropriate time.\n\t*/\n\n /**\n * Feature detection\n */\n var feature = {};\n\n feature.fileapi = $('').get(0).files !== undefined;\n feature.formdata = typeof window.FormData !== \"undefined\";\n\n var hasProp = !!$.fn.prop;\n // What attr2 returns for a form: the property when it is a string, otherwise the attribute. The\n // property is read plainly on purpose: a control named like it shadows it, and then the raw\n // attribute is used.\n function formProperty(form, name) {\n var value = hasProp ? form[name] : undefined;\n\n return typeof value === \"string\" ? value : formAttribute(form, name);\n }\n\n var forms = { attribute: formAttribute, property: formProperty };\n var serialization = createSuccessfulControls(feature);\n var steps = createSubmission(feature, forms, serialization);\n var transports = {\n iframe: createIframeTransport(hasProp, forms),\n formdata: sendFormData,\n ajax: sendAjax,\n };\n\n // attr2 uses prop when it can but checks the return type for\n // an expected string. This accounts for the case where a form\n // contains inputs with names like \"action\" or \"method\"; in those\n // cases \"prop\" returns the element\n $.fn.attr2 = function () {\n deprecate(\"attr2\", \"attr2 is deprecated, use .prop() or .attr()\");\n\n if (!hasProp) {\n return this.attr.apply(this, arguments);\n }\n\n var val = this.prop.apply(this, arguments);\n\n if ((val && val.jquery) || typeof val === \"string\") {\n return val;\n }\n\n return this.attr.apply(this, arguments);\n };\n\n /**\n * ajaxSubmit() provides a mechanism for immediately submitting\n * an HTML form using AJAX.\n *\n * @param\t{object|string}\toptions\t\tjquery.form.js parameters or custom url for submission\n * @param\t{object}\t\tdata\t\textraData\n * @param\t{string}\t\tdataType\tajax dataType\n * @param\t{function}\t\tonSuccess\tajax success callback function\n */\n $.fn.ajaxSubmit = function (options, data, dataType, onSuccess) {\n deprecateOldJQuery($.fn.jquery);\n\n // fast fail if nothing selected (http://dev.jquery.com/ticket/2752)\n if (!this.length) {\n log(\"ajaxSubmit: skipping submit process - no element selected\");\n\n return this;\n }\n\n // #541: jQuery's slim build has no $.ajax\n if (!$.ajax) {\n throw new Error(\n \"jquery.form: ajaxSubmit needs the full jQuery build; this jQuery has no $.ajax\"\n );\n }\n\n var submission = steps.prepare(this, submitOptions(options, data, dataType, onSuccess));\n\n if (!submission) {\n return this;\n }\n\n steps.deliver(submission);\n\n var jqxhr = transports[steps.chooseTransport(submission)](submission);\n\n this.removeData(\"jqxhr\").data(\"jqxhr\", jqxhr);\n\n // clear element array\n for (var k = 0; k < submission.controls.length; k++) {\n submission.controls[k] = null;\n }\n\n // fire 'notify' event\n this.trigger(\"form-submit-notify\", [this, submission.options]);\n\n return this;\n };\n\n $.fn.ajaxForm = ajaxForm;\n $.fn.ajaxFormUnbind = ajaxFormUnbind;\n\n /**\n * formToArray() gathers form element data into an array of objects that can\n * be passed to any of the following ajax functions: $.get, $.post, or load.\n * Each object in the array has both a 'name' and 'value' property. An example of\n * an array for a simple login form might be:\n *\n * [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ]\n *\n * It is this array that is passed to pre-submit callback functions provided to the\n * ajaxSubmit() and ajaxForm() methods.\n */\n $.fn.formToArray = function (semantic, elements, filtering) {\n var collected = serialization.collect(this[0], semantic, filtering);\n\n if (elements) {\n elements.push.apply(elements, collected.controls);\n }\n\n return collected.fields;\n };\n\n /**\n * Serializes form data into a 'submittable' string. This method will return a string\n * in the format: name1=value1&name2=value2\n */\n $.fn.formSerialize = function (semantic) {\n // hand off to jQuery.param for proper encoding\n return $.param(urlencodedFields(this.formToArray(semantic)));\n };\n\n /**\n * Serializes all field elements in the jQuery object into a query string.\n * This method will return a string in the format: name1=value1&name2=value2\n */\n $.fn.fieldSerialize = function (successful) {\n var a = [];\n\n this.each(function () {\n var n = this.name;\n\n // a form is not a field, though it may have a name\n if (!n || tagName(this) === \"form\") {\n return;\n }\n\n var v = $.fieldValue(this, successful);\n\n if (v && v.constructor === Array) {\n for (var i = 0, max = v.length; i < max; i++) {\n a.push({ name: n, value: v[i] });\n }\n } else if (v !== null && typeof v !== \"undefined\") {\n a.push({ name: this.name, value: v });\n }\n });\n\n // hand off to jQuery.param for proper encoding\n return $.param(urlencodedFields(a));\n };\n\n /**\n * Returns the value(s) of the element in the matched set. For example, consider the following form:\n *\n *\t
\n *\t\t\n *\t\t\n *\t\t\n *\t\t\n *\t\t\n *\t\t\n *\t
\n *\n *\tvar v = $('input[type=text]').fieldValue();\n *\t// if no values are entered into the text inputs\n *\tv === ['','']\n *\t// if values entered into the text inputs are 'foo' and 'bar'\n *\tv === ['foo','bar']\n *\n *\tvar v = $('input[type=checkbox]').fieldValue();\n *\t// if neither checkbox is checked\n *\tv === undefined\n *\t// if both checkboxes are checked\n *\tv === ['B1', 'B2']\n *\n *\tvar v = $('input[type=radio]').fieldValue();\n *\t// if neither radio is checked\n *\tv === undefined\n *\t// if first radio is checked\n *\tv === ['C1']\n *\n * The successful argument controls whether or not the field element must be 'successful'\n * (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls).\n * The default value of the successful argument is true. If this value is false the value(s)\n * for each element is returned.\n *\n * Note: This method *always* returns an array. If no valid value can be determined the\n *\tarray will be empty, otherwise it will contain one or more values.\n */\n $.fn.fieldValue = function (successful) {\n for (var val = [], i = 0, max = this.length; i < max; i++) {\n var el = this[i];\n var v = $.fieldValue(el, successful);\n\n if (v === null || typeof v === \"undefined\" || (v.constructor === Array && !v.length)) {\n continue;\n }\n\n if (v.constructor === Array) {\n $.merge(val, v);\n } else {\n val.push(v);\n }\n }\n\n return val;\n };\n\n /**\n * Returns the value of the field element.\n */\n $.fieldValue = function (el, successful) {\n var required = typeof successful === \"undefined\" || successful;\n\n if (required && !isSuccessful(el, submitterElement(el.form))) {\n return null;\n }\n\n return valueOf(el);\n };\n\n /**\n * Clears the form data. Takes the following actions on the form's input fields:\n * - input text fields will have their 'value' property set to the empty string\n * - select elements will have their 'selectedIndex' property set to -1\n * - checkbox and radio inputs will have their 'checked' property set to false\n * - inputs of type submit, button, reset, and hidden will *not* be effected\n * - button elements will *not* be effected\n */\n $.fn.clearForm = function (includeHidden) {\n return this.each(function () {\n $(\"input,select,textarea\", this).clearFields(includeHidden);\n });\n };\n\n /**\n * Clears the selected form elements.\n */\n $.fn.clearInputs = function (includeHidden) {\n deprecate(\"clearInputs\", \"clearInputs is deprecated, use clearFields\");\n\n return this.clearFields(includeHidden);\n };\n\n $.fn.clearFields = function (includeHidden) {\n var re =\n /^(?:color|date|datetime|datetime-local|email|month|number|password|range|search|tel|text|time|url|week)$/i; // 'hidden' is not in this list\n\n return this.each(function () {\n var t = this.type,\n tag = tagName(this);\n\n if (re.test(t) || tag === \"textarea\") {\n this.value = \"\";\n } else if (t === \"checkbox\" || t === \"radio\") {\n this.checked = false;\n } else if (tag === \"select\") {\n this.selectedIndex = -1;\n } else if (t === \"file\") {\n if (/MSIE/.test(navigator.userAgent)) {\n $(this).replaceWith($(this).clone(true));\n } else {\n $(this).val(\"\");\n }\n } else if (includeHidden) {\n // includeHidden can be the value true, or it can be a selector string\n // indicating a special test; for example:\n // $('#myForm').clearForm('.special:hidden')\n // the above would clean hidden inputs that have the class of 'special'\n if (\n (includeHidden === true && /hidden/.test(t)) ||\n (typeof includeHidden === \"string\" && $(this).is(includeHidden))\n ) {\n this.value = \"\";\n }\n }\n });\n };\n\n /**\n * Resets the form data or individual elements. Takes the following actions\n * on the selected tags:\n * - all fields within form elements will be reset to their original value\n * - input / textarea / select fields will be reset to their original value\n * - option / optgroup fields (for multi-selects) will defaulted individually\n * - non-multiple options will find the right select to default\n * - label elements will be searched against its 'for' attribute\n * - all others will be searched for appropriate children to default\n */\n $.fn.resetForm = function () {\n return this.each(function () {\n var el = $(this);\n var tag = tagName(this);\n\n switch (tag) {\n case \"input\":\n this.checked = this.defaultChecked;\n\n // as the native reset: types whose value is the value attribute keep it\n if (this.type === \"file\") {\n // a file input cannot take its value attribute; the native reset empties it\n this.value = \"\";\n } else if (!/^(?:checkbox|radio|hidden|submit|reset|button|image)$/.test(this.type)) {\n this.value = this.defaultValue;\n }\n\n return true;\n\n case \"textarea\":\n this.value = this.defaultValue;\n\n return true;\n\n case \"option\":\n case \"optgroup\":\n var select = el.parents(\"select\");\n\n if (select.length && select[0].multiple) {\n if (tag === \"option\") {\n this.selected = this.defaultSelected;\n } else {\n el.find(\"option\").resetForm();\n }\n } else {\n select.resetForm();\n }\n\n return true;\n\n case \"select\":\n // in order, as the native reset: of several default options, a single select keeps the last\n el.find(\"option\").each(function () {\n this.selected = this.defaultSelected;\n });\n\n return true;\n\n case \"label\":\n // The control whose id the for attribute names, and the controls inside the label. The\n // filter keeps a for that names an ancestor from resetting the label again.\n var forEl = this.htmlFor && this.ownerDocument.getElementById(this.htmlFor);\n\n el.find(\"input,select,textarea\").add(forEl).filter(\"input,select,textarea\").resetForm();\n\n return true;\n\n case \"form\":\n // through the prototype: a control named reset shadows the method\n callFormMethod(this, \"reset\");\n\n return true;\n\n default:\n el.find(\"form,input,label,select,textarea\").resetForm();\n\n return true;\n }\n });\n };\n\n /**\n * Enables or disables any matching elements.\n */\n $.fn.enable = function (b) {\n if (typeof b === \"undefined\") {\n b = true;\n }\n\n return this.each(function () {\n this.disabled = !b;\n });\n };\n\n /**\n * Checks/unchecks any matching checkboxes or radio buttons and\n * selects/deselects and matching option elements.\n */\n $.fn.selected = function (select) {\n if (typeof select === \"undefined\") {\n select = true;\n }\n\n return this.each(function () {\n var t = this.type;\n\n if (t === \"checkbox\" || t === \"radio\") {\n this.checked = select;\n } else if (tagName(this) === \"option\") {\n var $sel = $(this).parent(\"select\");\n\n if (select && $sel[0] && $sel[0].type === \"select-one\") {\n // deselect all other options\n $sel.find(\"option\").selected(false);\n }\n\n this.selected = select;\n }\n });\n };\n\n // expose debug var\n $.fn.ajaxSubmit.debug = false;\n})(jQuery);\n\nexport default jQuery;\n"],"names":["owners","plainForm","document","createElement","findDescriptor","name","i","length","owner","window","descriptor","Object","getOwnPropertyDescriptor","prototype","formMember","form","get","call","e","callFormMethod","value","apply","Array","slice","arguments","tagName","el","toLowerCase","isElement","node","assertRealParent","parentNode","Error","closestByTag","names","indexOf","storeKey","setExpando","ignore","expando","els","namedItem","undefined","record","x","y","jQuery","data","type","setTimeout","captureSubmitter","target","point","offsetX","offsetY","fn","offset","pageX","left","pageY","top","offsetLeft","offsetTop","imagePoint","submitterOf","stored","log","ajaxSubmit","debug","msg","join","console","opera","postError","warned","deprecate","id","message","warn","deprecateOldJQuery","version","parts","String","split","major","Number","beforeJQuery35","shorthandOptions","options","dataType","onSuccess","result","url","success","submitOptions","key","hasOwnProperty","withoutUrl","keepContext","settings","sources","context","submitWith","isDefaultPrevented","preventDefault","originalEvent","submitter","captureEventSubmitter","doAjaxSubmit","captureSubmittingElement","this","bindDelegated","$sel","selector","off","on","closestMatch","Element","closest","is","delegated","unbindSelector","handlers","submit","click","selectionOnly","ajaxForm","jquery","delegation","bindSelector","beforeFormUnbind","ajaxFormUnbind","o","s","c","isReady","bindLater","formAttribute","attr","rLineBreak","rCR","rUnsubmittable","isDisabled","matches","disabled","valueOf","index","selectedIndex","a","ops","one","max","op","selected","v","attributes","specified","text","push","selectValue","val","raw","replace","loneSurrogate","wellFormed","match","before","urlencodedFields","fields","map","field","createSuccessfulControls","feature","$","controlsOf","semantic","formId","getElementsByTagName","makeArray","grep","ownedBy","test","navigator","userAgent","concat","filter","getAttribute","inArray","outsideControls","fieldsOf","n","fieldValue","constructor","fileapi","files","file","required","imageFields","sub","input","addCandidate","collected","own","controls","collect","filtering","addClickedImage","deepSerialize","extraData","traditional","part","param","serialized","len","decodeURIComponent","sendFormData","submission","formdata","FormData","append","serializedData","extend","ajaxSettings","contentType","processData","cache","method","uploadProgress","createXhr","xhr","upload","addEventListener","event","percent","position","loaded","total","lengthComputable","Math","ceil","beforeSend","formData","ajax","sendAjax","uploadAttributes","hasOwn","isGet","addSubmitterFields","submitterFields","addCsrfField","forms","origin","csrf_token","csrf_param","posts","property","href","location","protocol","host","setFormAttribute","getDoc","frame","doc","contentWindow","err","contentDocument","readStatus","status","statusText","readResponse","retry","errMsg","isXml","XMLDocument","isXMLDoc","body","innerHTML","docRoot","documentElement","responseText","responseXML","getResponseHeader","header","readDocument","dt","scr","textarea","ta","pre","b","textContent","innerText","readEmbedded","ct","xml","nodeName","error","dataFilter","JSON","parse","globalEval","httpData","createLifecycle","g","timeoutHandle","callbackProcessed","deferred","Deferred","aborted","getAllResponseHeaders","setRequestHeader","abort","done","rejection","textStatus","stop","reject","trigger","complete","endGlobalEvents","active","clearTimeout","release","settle","failure","resolve","succeed","start","global","fail","startTimer","onTimeout","timeout","stopTimer","createIframeTransport","hasProp","frameCount","fileUploadIframe","ownerDocument","$body","$io","iframeTarget","each","nameWindow","io","setAttribute","iframeSrc","css","createFrame","Date","getTime","life","execCommand","remove","frameHooks","domCheckCount","checkState","state","readyState","cb","doSubmit","saved","saveAttributes","mp","skipEncodingOverride","setUploadAttributes","extraInputs","added","addHiddenInput","appendTo","isPlainObject","single","f","addExtraInputs","root","contains","notInDocument","attachEvent","listen","submitForm","restoreAttributes","detachEvent","removeEventListener","unlisten","post","forceSync","jqxhr","elements","prop","removeAttr","enableControls","closeKeepAlive","createSubmission","serialization","refuse","extraQuery","optionsData","requestFormat","query","pairs","at","decodeQuery","queryPairs","defineKey","object","defineProperty","enumerable","writable","configurable","callbackList","callback","isArray","callEach","callbacks","args","prepare","$set","action","trim","URL","withDefaults","defaultType","veto","beforeSerialize","qx","beforeSubmit","resolved","resolveMethod","extra","stringify","jsonBody","q","toUpperCase","hashAt","base","encode","$form","deliver","resetForm","clearForm","includeHidden","successes","jqXHR","successArguments","replaceTarget","$target","merge","errors","completes","chooseTransport","hasFileInputs","add","multipart","attribute","fileAPI","shouldUseFrame","transport","iframe","steps","transports","attr2","removeData","k","formToArray","formSerialize","fieldSerialize","successful","t","checked","isSuccessful","clearFields","clearInputs","re","tag","replaceWith","clone","defaultChecked","defaultValue","select","parents","multiple","defaultSelected","find","forEl","htmlFor","getElementById","enable","parent"],"mappings":";;;;;;;;;;;;;;;;;;;;;kRAMA,IAAIA,EAAS,CAAC,kBAAmB,cAAe,UAAW,QAGvDC,EAAYC,SAASC,cAAc,QAEvC,SAASC,EAAeC,GACtB,IAAK,IAAIC,EAAI,EAAGA,EAAIN,EAAOO,OAAQD,IAAK,CACtC,IAAIE,EAAQC,OAAOT,EAAOM,IACtBI,EAAaF,GAASG,OAAOC,yBAAyBJ,EAAMK,UAAWR,GAE3E,GAAIK,EACF,OAAOA,CAEX,CAEA,OAAO,IACT,CAOO,SAASI,EAAWC,EAAMV,GAC/B,IAAIK,EAAaN,EAAeC,GAEhC,IACE,OAAOK,EAAWM,IAAIC,KAAKF,EAC7B,CAAE,MAAOG,GACP,OAAOH,EAAKV,EACd,CACF,CAMO,SAASc,EAAeJ,EAAMV,GACnC,IAAIK,EAAaN,EAAeC,GAGhC,OAFaK,EAAaA,EAAWU,MAAQnB,EAAUI,IAEzCg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Q,CACzB,CAlcD,CAkcGtB"} \ No newline at end of file +{"version":3,"file":"jquery.form.min.js","sources":["../src/form-members.js","../src/submitter.js","../src/diagnostics.js","../src/options.js","../src/ajax-form.js","../src/form-attributes.js","../src/successful-controls.js","../src/xhr-transport.js","../src/iframe-post.js","../src/iframe-response.js","../src/iframe-lifecycle.js","../src/iframe-transport.js","../src/submission.js","../src/jquery.form.js"],"sourcesContent":["// Form members: the properties and methods the plugin reads or calls on a form. A control named\n// like a member (elements, setAttribute) shadows that member on the form itself, so members are\n// read through the DOM prototypes, which a control cannot shadow.\n\n// The prototype chain of a form, nearest first. Looked up on every call: old browsers have no\n// DOM prototypes, and tests remove them.\nvar owners = [\"HTMLFormElement\", \"HTMLElement\", \"Element\", \"Node\"];\n\n// A form no control can shadow, for methods when the DOM has no prototypes to read them from.\nvar plainForm = document.createElement(\"form\");\n\nfunction findDescriptor(name) {\n for (var i = 0; i < owners.length; i++) {\n var owner = window[owners[i]];\n var descriptor = owner && Object.getOwnPropertyDescriptor(owner.prototype, name);\n\n if (descriptor) {\n return descriptor;\n }\n }\n\n return null;\n}\n\n/**\n * Reads a member of a form through its prototype getter.\n * Falls back to the plain property without DOM prototypes, or on an element the getter does not\n * accept (such as a fieldset for `elements`).\n */\nexport function formMember(form, name) {\n var descriptor = findDescriptor(name);\n\n try {\n return descriptor.get.call(form);\n } catch (e) {\n return form[name];\n }\n}\n\n/**\n * Calls a method of a form through its prototype, or through an unshadowed form without DOM\n * prototypes.\n */\nexport function callFormMethod(form, name) {\n var descriptor = findDescriptor(name);\n var method = descriptor ? descriptor.value : plainForm[name];\n\n return method.apply(form, Array.prototype.slice.call(arguments, 2));\n}\n\n// Nodes such as the document and text nodes have no tag name (#600).\nexport function tagName(el) {\n var name = formMember(el, \"tagName\");\n\n return typeof name === \"string\" ? name.toLowerCase() : \"\";\n}\n\n// Elements only: the subject of formToArray may also be the document or a plain object.\nexport function isElement(node) {\n return formMember(node, \"nodeType\") === 1;\n}\n\n// A control named parentNode makes every parentNode walk (jQuery's trigger and closest among\n// them) cycle between the form and the control.\nexport function assertRealParent(el) {\n if (el.parentNode !== formMember(el, \"parentNode\")) {\n throw new Error(\n 'jquery.form: a form control named \"parentNode\" hides the form\\'s parentNode; rename the control'\n );\n }\n}\n\n// The element itself or its nearest ancestor with one of the tag names, through the real tree.\nexport function closestByTag(el, names) {\n for (var node = el; node; node = formMember(node, \"parentNode\")) {\n if (names.indexOf(tagName(node)) >= 0) {\n return node;\n }\n }\n\n return null;\n}\n","import { closestByTag, formMember } from \"./form-members.js\";\nimport jQuery from \"jquery\";\n\n// The submitter: the button that submitted a form, captured from ajaxForm's clicks. It is kept in\n// a private store and cleared shortly after the click. The form's clk, clk_x and clk_y properties\n// are still written for pages that read them, and read when the store has none.\n\nvar storeKey = \"jqFormSubmitter\";\n\n// Writes a property on the form; a control with that name makes it read-only.\nfunction setExpando(form, name, value) {\n try {\n form[name] = value;\n } catch (ignore) {\n // the control keeps the name; the store has the submitter\n }\n}\n\n// A property the page set on the form, never a control of the form with that name.\nfunction expando(form, name) {\n var value = form[name];\n var els = formMember(form, \"elements\");\n\n return els && value && els.namedItem(name) === value ? undefined : value;\n}\n\n// Records a submitter for a form until the click window ends.\nfunction record(form, el, x, y) {\n jQuery.data(form, storeKey, { el: el, x: x, y: y });\n setExpando(form, \"clk\", el);\n\n if (el.type === \"image\") {\n setExpando(form, \"clk_x\", x);\n setExpando(form, \"clk_y\", y);\n }\n\n // clear form vars\n setTimeout(function () {\n jQuery.data(form, storeKey, null);\n setExpando(form, \"clk\", null);\n setExpando(form, \"clk_x\", null);\n setExpando(form, \"clk_y\", null);\n }, 100);\n}\n\n// The clicked point of an image button, relative to the image.\nfunction imagePoint(e, target) {\n if (typeof e.offsetX !== \"undefined\") {\n return [e.offsetX, e.offsetY];\n }\n\n if (typeof jQuery.fn.offset === \"function\") {\n var offset = jQuery(target).offset();\n\n return [e.pageX - offset.left, e.pageY - offset.top];\n }\n\n return [e.pageX - target.offsetLeft, e.pageY - target.offsetTop];\n}\n\n/**\n * Records the submit or image button a click event reached, for the form it belongs to.\n */\nexport function captureSubmitter(e) {\n // the clicked control, or the button around the clicked content (ex: a span within a button)\n var target = closestByTag(e.target, [\"button\", \"input\"]);\n\n // the type property, unlike the attribute, is \"submit\" for a button without a type (#588)\n if (!target || (target.type !== \"submit\" && target.type !== \"image\")) {\n return;\n }\n\n var form = target.form;\n\n if (!form) {\n // a submit control that belongs to no form\n return;\n }\n\n var point = target.type === \"image\" ? imagePoint(e, target) : [];\n\n record(form, target, point[0], point[1]);\n}\n\n/**\n * Records the submitter a submit event names (SubmitEvent.submitter), when no click was captured.\n * An image submitter gets the point 0,0, as native submission sends it without a click.\n */\nexport function captureEventSubmitter(e, form) {\n var el = e.originalEvent && e.originalEvent.submitter;\n\n if (el && !submitterOf(form)) {\n record(form, el, 0, 0);\n }\n}\n\n/**\n * The form's submitter as { el, x, y } (x and y for an image button), or null.\n */\nexport function submitterOf(form) {\n if (!form) {\n return null;\n }\n\n var stored = jQuery.data(form, storeKey);\n\n if (stored) {\n return stored;\n }\n\n var el = expando(form, \"clk\");\n\n return el ? { el: el, x: expando(form, \"clk_x\"), y: expando(form, \"clk_y\") } : null;\n}\n\n/**\n * The submitter's fields for a post that adds them itself (the iframe upload), as name β†’ value.\n */\nexport function submitterFields(form) {\n var fields = {};\n var sub = submitterOf(form);\n var el = sub && sub.el;\n\n if (el && el.name && !el.disabled) {\n fields[el.name] = el.value;\n if (el.type === \"image\") {\n fields[el.name + \".x\"] = sub.x;\n fields[el.name + \".y\"] = sub.y;\n }\n }\n\n return fields;\n}\n\n/**\n * The form's submitter element, or null.\n */\nexport function submitterElement(form) {\n var sub = submitterOf(form);\n\n return sub ? sub.el : null;\n}\n","import jQuery from \"jquery\";\n\n// Debug logging, switched on by $.fn.ajaxSubmit.debug. The flag is read on every call, so it can\n// be turned on after the plugin loads.\nexport function log() {\n if (!jQuery.fn.ajaxSubmit.debug) {\n return;\n }\n\n var msg = \"[jquery.form] \" + Array.prototype.join.call(arguments, \"\");\n\n if (window.console && window.console.log) {\n window.console.log(msg);\n } else if (window.opera && window.opera.postError) {\n window.opera.postError(msg);\n }\n}\n\nvar warned = {};\n\n/**\n * A deprecation warning: console.warn, only while debug is on, once per id per page. The message\n * names the replacement; the warning adds that the feature is removed in 5.0.\n */\nexport function deprecate(id, message) {\n if (!jQuery.fn.ajaxSubmit.debug || warned[id]) {\n return;\n }\n\n warned[id] = true;\n\n if (window.console && typeof window.console.warn === \"function\") {\n window.console.warn(\"[jquery.form] \" + message + \" (removed in 5.0)\");\n }\n}\n\n// Forgets which deprecations have warned (for tests).\nexport function resetDeprecations() {\n warned = {};\n}\n\n// True for a jQuery version string older than 3.5.\nexport function beforeJQuery35(version) {\n var parts = String(version).split(\".\");\n var major = Number(parts[0]);\n\n return major < 3 || (major === 3 && Number(parts[1]) < 5);\n}\n\n// 5.0 needs jQuery 3.5 or later: warned on the first ajaxSubmit or ajaxForm, given jQuery's version.\nexport function deprecateOldJQuery(version) {\n if (beforeJQuery35(version)) {\n deprecate(\n \"jquery\",\n \"support for jQuery \" + version + \" is deprecated, 5.0 needs jQuery 3.5 or later\"\n );\n }\n}\n","// The arguments ajaxSubmit and ajaxForm accept in place of an options object.\n\n/**\n * Turns the (url, data, dataType, success) shorthand into options. A url of false is kept as\n * the url; anything else is returned as given.\n */\nexport function shorthandOptions(options, data, dataType, onSuccess) {\n if (typeof options !== \"string\" && options !== false) {\n return options;\n }\n\n var result = { url: options, data: data, dataType: dataType };\n\n if (typeof onSuccess === \"function\") {\n result.success = onSuccess;\n }\n\n return result;\n}\n\n// A copy of options without its url, so the form action is used.\nfunction withoutUrl(options) {\n var result = {};\n\n for (var key in options) {\n if (key !== \"url\" && Object.prototype.hasOwnProperty.call(options, key)) {\n result[key] = options[key];\n }\n }\n\n return result;\n}\n\n/**\n * The options ajaxSubmit starts from: a function is the success callback, the shorthand is\n * expanded, and no options at all is an empty object. A url of false or \"\" means the form action.\n */\nexport function submitOptions(options, data, dataType, onSuccess) {\n if (typeof options === \"function\") {\n return { success: options };\n }\n\n options = shorthandOptions(options, data, dataType, onSuccess);\n\n if (typeof options === \"undefined\") {\n return {};\n }\n\n return options.url === false || options.url === \"\" ? withoutUrl(options) : options;\n}\n\n/**\n * jQuery treats `context` as a flat option: after a deep merge, the settings get back the\n * caller's own object from the last source that has one, so `this` in callbacks is that object.\n */\nexport function keepContext(settings, sources) {\n for (var i = 0; i < sources.length; i++) {\n if (sources[i].context !== undefined) {\n settings.context = sources[i].context;\n }\n }\n\n return settings;\n}\n","import { assertRealParent, closestByTag, formMember, isElement } from \"./form-members.js\";\nimport { captureEventSubmitter, captureSubmitter } from \"./submitter.js\";\nimport { deprecate, deprecateOldJQuery, log } from \"./diagnostics.js\";\nimport jQuery from \"jquery\";\nimport { shorthandOptions } from \"./options.js\";\n\n// ajaxForm binding: the submit and click handlers that send a form through ajaxSubmit. The\n// handlers look up $.fn.ajaxSubmit when they run, so a replacement installed later is used.\n\n// Sends the submit event's form with ajaxSubmit, unless an earlier handler cancelled it.\nfunction submitWith(e, options) {\n if (!e.isDefaultPrevented()) {\n // if event has been canceled, don't proceed\n e.preventDefault();\n // the form is found through the real tree: a control named nodeType misleads jQuery's closest\n var form = closestByTag(e.target, [\"form\"]);\n\n // a button outside the form (form attribute), or requestSubmit(button), sends no click here\n captureEventSubmitter(e, form);\n jQuery(form).ajaxSubmit(options); // #365\n }\n}\n\nfunction doAjaxSubmit(e) {\n submitWith(e, e.data);\n}\n\nfunction captureSubmittingElement(e) {\n /* jshint validthis:true */\n assertRealParent(this);\n captureSubmitter(e);\n}\n\n// An empty selection: queued until the DOM is ready (old jQuery keeps the selector), or dropped.\nfunction bindLater($sel, options) {\n var o = { s: $sel.selector, c: $sel.context };\n\n if (!jQuery.isReady && o.s) {\n log(\"DOM not ready, queuing ajaxForm\");\n deprecate(\n \"queue\",\n \"queuing ajaxForm until the DOM is ready is deprecated, call ajaxForm inside $(fn) \" +\n 'or use delegation: \"\"'\n );\n jQuery(function () {\n jQuery(o.s, o.c).ajaxForm(options);\n });\n\n return $sel;\n }\n\n // is your DOM ready? http://docs.jquery.com/Tutorials:Introducing_$(document).ready()\n log(\"terminating; zero elements found by selector\" + (jQuery.isReady ? \"\" : \" (DOM not ready)\"));\n\n return $sel;\n}\n\n// delegation: true on jQuery 3 and later, where the selection has no selector: always warned,\n// debug or not, once per ajaxForm call.\nfunction warnUnscoped() {\n var console = window.console || {};\n\n if (typeof console.warn === \"function\") {\n console.warn(\n \"[jquery.form] delegation: true binds every form on the page on jQuery 3 and later; \" +\n 'pass a selector instead, e.g. delegation: \"form.ajax\"'\n );\n }\n}\n\nfunction bindDelegated($sel, options) {\n if ($sel.selector === undefined) {\n warnUnscoped();\n }\n\n jQuery(document)\n .off(\"submit.form-plugin\", $sel.selector, doAjaxSubmit)\n .off(\"click.form-plugin\", $sel.selector, captureSubmittingElement)\n .on(\"submit.form-plugin\", $sel.selector, options, doAjaxSubmit)\n .on(\"click.form-plugin\", $sel.selector, options, captureSubmittingElement);\n\n return $sel;\n}\n\n// The element itself or its nearest ancestor that matches the selector. The walk never reads a\n// parentNode a control can hide (jQuery's delegated walk does, and cycles on such a form).\nfunction closestMatch(el, selector) {\n if (!isElement(el)) {\n return null;\n }\n\n if (window.Element && Element.prototype.closest) {\n return Element.prototype.closest.call(el, selector);\n }\n\n for (var node = el; node && isElement(node); node = formMember(node, \"parentNode\")) {\n if (jQuery(node).is(selector)) {\n return node;\n }\n }\n\n return null;\n}\n\n// The document handlers bound for each delegation selector, keyed by \"s\" + selector.\nvar delegated = {};\n\nfunction unbindSelector(selector) {\n var handlers = delegated[\"s\" + selector];\n\n if (handlers) {\n jQuery(document)\n .off(\"submit.form-plugin\", handlers.submit)\n .off(\"click.form-plugin\", handlers.click);\n delete delegated[\"s\" + selector];\n }\n}\n\n// delegation: \"\": one handler pair on the document, scoped to the selector.\nfunction bindSelector($sel, selector, options) {\n if (!selector) {\n throw new Error(\"jquery.form: delegation needs a selector, or true\");\n }\n\n var handlers = {\n submit: function (e) {\n if (closestMatch(e.target, selector)) {\n submitWith(e, options);\n }\n },\n click: function (e) {\n if (closestMatch(e.target, selector)) {\n captureSubmitter(e);\n }\n },\n };\n\n unbindSelector(selector);\n delegated[\"s\" + selector] = handlers;\n jQuery(document)\n .on(\"submit.form-plugin\", handlers.submit)\n .on(\"click.form-plugin\", handlers.click);\n\n return $sel;\n}\n\n// Passed by ajaxForm's own rebind: unbind the selection only, never the document handlers.\nvar selectionOnly = {};\n\n/**\n * ajaxForm() binds the selected forms so a submit is sent with ajaxSubmit, with the clicked\n * submit button (and image coordinates) included. The options work as for ajaxSubmit.\n */\nexport function ajaxForm(options, data, dataType, onSuccess) {\n deprecateOldJQuery(jQuery.fn.jquery);\n options = shorthandOptions(options, data, dataType, onSuccess) || {};\n\n if (typeof options.delegation === \"string\") {\n return bindSelector(this, options.delegation, options);\n }\n\n options.delegation = options.delegation && typeof jQuery.fn.on === \"function\";\n\n if (!options.delegation && this.length === 0) {\n return bindLater(this, options);\n }\n\n if (options.delegation) {\n return bindDelegated(this, options);\n }\n\n if (options.beforeFormUnbind) {\n options.beforeFormUnbind(this, options);\n }\n\n return this.ajaxFormUnbind(selectionOnly)\n .on(\"submit.form-plugin\", options, doAjaxSubmit)\n .on(\"click.form-plugin\", options, captureSubmittingElement);\n}\n\n/**\n * ajaxFormUnbind() removes the handlers ajaxForm bound on the selection and every delegated\n * binding on the document. ajaxFormUnbind(selector) removes only that delegation selector.\n */\nexport function ajaxFormUnbind(selector) {\n if (typeof selector === \"string\") {\n unbindSelector(selector);\n\n return this;\n }\n\n if (selector !== selectionOnly) {\n delegated = {};\n jQuery(document).off(\"submit.form-plugin click.form-plugin\");\n }\n\n return this.off(\"submit.form-plugin click.form-plugin\");\n}\n","import { callFormMethod, isElement } from \"./form-members.js\";\nimport jQuery from \"jquery\";\n\n/**\n * An attribute of a form, or undefined when it is absent, as jQuery's attr returns it. The\n * subject may also be the document or a plain object, read through jQuery.\n */\nexport function formAttribute(form, name) {\n if (!isElement(form)) {\n return jQuery(form).attr(name);\n }\n\n var value = callFormMethod(form, \"getAttribute\", name);\n\n return value === null ? undefined : value;\n}\n","import { callFormMethod, formMember, isElement, tagName } from \"./form-members.js\";\nimport { formAttribute } from \"./form-attributes.js\";\nimport jQuery from \"jquery\";\nimport { submitterOf } from \"./submitter.js\";\n\n// Successful controls: which controls of a form are sent, and as which name/value fields\n// (https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#constructing-the-form-data-set).\n\n// Line breaks, sent as CRLF\nvar rLineBreak = /\\r\\n|\\r|\\n/g;\nvar rCR = /\\r/g;\n\n// Listed form elements that are never submitted.\nvar rUnsubmittable = /^(?:fieldset|object|output)$/;\n\n/**\n * Whether a control or option is disabled, also through a disabled fieldset or optgroup. Without\n * selector matching, only its own disabled property is read.\n */\nfunction isDisabled(el) {\n return typeof el.matches === \"function\" ? el.matches(\":disabled\") : !!el.disabled;\n}\n\n/**\n * The successful-control rule: whether a control is sent. `submitter` is the button that\n * submitted the control's form; other submit and image buttons of a form are not sent.\n */\nexport function isSuccessful(el, submitter) {\n var t = el.type;\n\n if (!el.name || isDisabled(el) || t === \"reset\" || t === \"button\") {\n return false;\n }\n\n if (t === \"checkbox\" || t === \"radio\") {\n return !!el.checked;\n }\n\n if (t === \"submit\" || t === \"image\") {\n return !el.form || submitter === el;\n }\n\n return tagName(el) !== \"select\" || el.selectedIndex !== -1;\n}\n\n// The value of a select: the selected option's value for one, a list for several.\nfunction selectValue(el) {\n var index = el.selectedIndex;\n\n if (index < 0) {\n return null;\n }\n\n var a = [],\n ops = el.options;\n var one = el.type === \"select-one\";\n var max = one ? index + 1 : ops.length;\n\n for (var i = one ? index : 0; i < max; i++) {\n var op = ops[i];\n\n if (op.selected && !isDisabled(op)) {\n var v = op.value;\n\n if (!v) {\n // extra pain for IE...\n v =\n op.attributes && op.attributes.value && !op.attributes.value.specified\n ? op.text\n : op.value;\n }\n\n if (one) {\n return v;\n }\n\n a.push(v);\n }\n }\n\n return a;\n}\n\n/**\n * The value of a control, whether or not it is successful: a list for a multiple select, null\n * for a select with nothing selected, otherwise a string with CRLF line breaks (a lone CR or LF\n * included).\n */\nexport function valueOf(el) {\n if (tagName(el) === \"select\") {\n return selectValue(el);\n }\n\n var v = jQuery(el).val();\n var raw = el.value;\n\n // jQuery before 4.0 drops carriage returns from .val(); read them from the value itself\n if (typeof raw === \"string\" && raw.replace(rCR, \"\") === v) {\n v = raw;\n }\n\n return v.replace(rLineBreak, \"\\r\\n\");\n}\n\n/**\n * The fields as a urlencoded body sends them: a selected file as its name.\n */\n// A lone surrogate becomes U+FFFD, as in a native submission; jQuery.param would throw.\nvar loneSurrogate = /[\\uD800-\\uDBFF](?![\\uDC00-\\uDFFF])|([^\\uD800-\\uDBFF]|^)([\\uDC00-\\uDFFF])/g;\n\nexport function wellFormed(value) {\n return typeof value === \"string\"\n ? value.replace(loneSurrogate, function (match, before) {\n return (before || \"\") + \"\\uFFFD\";\n })\n : value;\n}\n\nexport function urlencodedFields(fields) {\n return jQuery.map(fields, function (field) {\n var value =\n field.type === \"file\" && typeof field.value !== \"string\" ? field.value.name : field.value;\n var name = wellFormed(field.name);\n value = wellFormed(value);\n\n return name === field.name && value === field.value ? field : { name: name, value: value };\n });\n}\n\n/**\n * The serialization steps. `feature` holds what the entry detected at load (fileapi).\n */\nexport function createSuccessfulControls(feature) {\n var $ = jQuery;\n\n // #386; inputs that name the form in their form attribute, other than the candidates found.\n // A form only gets the ones it owns.\n function outsideControls(formId, els, owner) {\n // hat tip @thet; the id is compared, never built into a selector\n return $(\":input[form]\")\n .filter(function () {\n return (\n this.getAttribute(\"form\") === formId &&\n (!owner || this.form === owner) &&\n $.inArray(this, els) < 0\n );\n })\n .get();\n }\n\n // A descendant of a form is a candidate unless it is a control another form owns.\n function ownedBy(els, owner) {\n return $.grep(els, function (el) {\n return typeof el.form === \"undefined\" || el.form === owner;\n });\n }\n\n /**\n * The candidate controls of a form, in order: its elements, or every descendant it owns in\n * semantic mode, then the outside controls it owns that name it.\n */\n function controlsOf(form, semantic) {\n var formId = formAttribute(form, \"id\");\n var els = formMember(form, \"elements\");\n\n if (semantic || typeof els === \"undefined\") {\n // the document is not an element; it has its own getElementsByTagName\n els = isElement(form)\n ? callFormMethod(form, \"getElementsByTagName\", \"*\")\n : form.getElementsByTagName(\"*\");\n }\n\n els = $.makeArray(els);\n\n // the subject may also be a fieldset, the document or another container\n var owner = tagName(form) === \"form\" ? form : null;\n\n if (semantic && owner) {\n els = ownedBy(els, owner);\n }\n\n // FinesseRus: in non-IE browsers outside fields are already included in form.elements.\n if (formId && (semantic || /(Edge|Trident)\\//.test(navigator.userAgent))) {\n els = els.concat(outsideControls(formId, els, owner));\n }\n\n return els;\n }\n\n // The fields of a control's value, or null when the control is not sent.\n function fieldsOf(el) {\n var n = el.name;\n // read at call time, so a page that replaces $.fieldValue changes what is sent\n var v = $.fieldValue(el, true);\n\n if (v && v.constructor === Array) {\n return $.map(v, function (value) {\n return { name: n, value: value };\n });\n }\n\n if (feature.fileapi && el.type === \"file\") {\n var files = el.files;\n\n // #180: an empty field when no file is selected\n return files.length\n ? $.map(files, function (file) {\n return { name: n, value: file, type: el.type };\n })\n : [{ name: n, value: \"\", type: el.type }];\n }\n\n if (v === null || typeof v === \"undefined\") {\n return null;\n }\n\n return [{ name: n, value: v, type: el.type, required: el.required }];\n }\n\n // The clicked image's value and coordinates.\n function imageFields(sub, input, type) {\n var n = input.name;\n var value = { name: n, value: $(input).val() };\n\n if (type) {\n value.type = type;\n }\n\n return [value, { name: n + \".x\", value: sub.x }, { name: n + \".y\", value: sub.y }];\n }\n\n // Adds one candidate control's fields, and the control when it has a value to send.\n function addCandidate(collected, form, el, semantic) {\n if (!el.name || isDisabled(el) || rUnsubmittable.test(tagName(el))) {\n return;\n }\n\n var sub = semantic && el.type === \"image\" && submitterOf(form);\n\n if (sub) {\n // handle image inputs on the fly when semantic == true\n if (sub.el === el) {\n collected.fields.push.apply(collected.fields, imageFields(sub, el, el.type));\n }\n\n return;\n }\n\n var own = fieldsOf(el);\n\n if (own) {\n collected.controls.push(el);\n collected.fields.push.apply(collected.fields, own);\n }\n }\n\n // input type=='image' are not found in elements array! handle it here\n function addClickedImage(collected, form) {\n var sub = submitterOf(form);\n var input = sub && $(sub.el)[0];\n\n if (input && input.name && !isDisabled(input) && input.type === \"image\") {\n collected.fields.push.apply(collected.fields, imageFields(sub, input));\n }\n }\n\n /**\n * The fields of a form, as formToArray returns them, and the controls they came from.\n */\n function collect(form, semantic, filtering) {\n var collected = { fields: [], controls: [] };\n\n if (!form) {\n return collected;\n }\n\n var els = controlsOf(form, semantic);\n\n if (typeof filtering === \"function\") {\n els = $.map(els, filtering);\n }\n\n for (var i = 0; i < els.length; i++) {\n addCandidate(collected, form, els[i], semantic);\n }\n\n if (!semantic) {\n addClickedImage(collected, form);\n }\n\n return collected;\n }\n\n return {\n controlsOf: controlsOf,\n fieldsOf: fieldsOf,\n collect: collect,\n };\n}\n","import jQuery from \"jquery\";\nimport { keepContext } from \"./options.js\";\n\n// The XMLHttpRequest transports: $.ajax with the encoded fields, or FormData for file uploads.\nvar $ = jQuery;\n\n// utility fn for deep serialization: [name, value] pairs, as $.param encodes them\nexport function deepSerialize(extraData, traditional) {\n var param = $.param(extraData, traditional);\n var serialized = param ? param.split(\"&\") : [];\n var len = serialized.length;\n var result = [];\n var i, part;\n\n for (i = 0; i < len; i++) {\n // #252; undo param space replacement\n serialized[i] = serialized[i].replace(/\\+/g, \" \");\n part = serialized[i].split(\"=\");\n // #278; use array instead of object storage, favoring array serializations\n result.push([decodeURIComponent(part[0]), decodeURIComponent(part[1])]);\n }\n\n return result;\n}\n\n/**\n * Posts the fields and extraData as FormData, for files with the File API.\n * XMLHttpRequest Level 2 file uploads (big hat tip to francois2metz)\n */\nexport function sendFormData(submission) {\n var options = submission.options;\n var a = submission.fields;\n\n var formdata = new FormData();\n\n for (var i = 0; i < a.length; i++) {\n formdata.append(a[i].name, a[i].value);\n }\n\n if (options.extraData) {\n var serializedData = deepSerialize(options.extraData, submission.traditional);\n\n for (i = 0; i < serializedData.length; i++) {\n formdata.append(serializedData[i][0], serializedData[i][1]);\n }\n }\n\n options.data = null;\n\n var s = $.extend(true, {}, $.ajaxSettings, options, {\n contentType: false,\n processData: false,\n cache: false,\n type: submission.method || \"POST\",\n });\n\n keepContext(s, [$.ajaxSettings, options]);\n\n if (options.uploadProgress) {\n // workaround because jqXHR does not expose upload property: wraps the xhr factory, the\n // caller's or jQuery's\n var createXhr = s.xhr;\n\n s.xhr = function () {\n var xhr = createXhr.call(this);\n\n if (xhr.upload) {\n xhr.upload.addEventListener(\n \"progress\",\n function (event) {\n var percent = 0;\n // event.position is the deprecated name, read only when loaded is missing\n var position = event.loaded !== undefined ? event.loaded : event.position;\n var total = event.total;\n\n if (event.lengthComputable) {\n percent = Math.ceil((position / total) * 100);\n }\n\n options.uploadProgress(event, position, total, percent);\n },\n false\n );\n }\n\n return xhr;\n };\n }\n\n s.data = null;\n\n var beforeSend = s.beforeSend;\n\n s.beforeSend = function (xhr, o) {\n // Send FormData() provided by user\n if (options.formData) {\n o.data = options.formData;\n } else {\n o.data = formdata;\n }\n\n // a veto (false) cancels the upload, as on the other transports\n return beforeSend ? beforeSend.call(this, xhr, o) : undefined;\n };\n\n return $.ajax(s);\n}\n\n/**\n * Sends the encoded fields with $.ajax.\n */\nexport function sendAjax(submission) {\n return $.ajax(submission.options);\n}\n","import { callFormMethod } from \"./form-members.js\";\nimport { deepSerialize } from \"./xhr-transport.js\";\nimport jQuery from \"jquery\";\nimport { submitterFields } from \"./submitter.js\";\nimport { wellFormed } from \"./successful-controls.js\";\n\n// The iframe form post: the extra fields (submitter, CSRF, data), the form attributes set while\n// posting and restored after, and the native submit.\nvar $ = jQuery;\n\n// The form attributes an iframe upload changes while it posts.\nvar uploadAttributes = [\"action\", \"target\", \"method\", \"enctype\", \"encoding\"];\n\n// Called through the prototype: an extraData key or a form field may be named hasOwnProperty.\nvar hasOwn = Object.prototype.hasOwnProperty;\n\nfunction isGet(method) {\n return /^get$/i.test(method);\n}\n\n// Resolves both URLs through anchors, as jQuery does for crossDomain, so IE's anchor quirks\n// apply to both sides of the comparison.\nfunction isSameOrigin(url) {\n var origin = document.createElement(\"a\");\n var target = document.createElement(\"a\");\n\n origin.href = window.location.href;\n target.href = url;\n // IE fills in the host of a relative URL only once the resolved href is assigned back\n target.href = target.href; // eslint-disable-line no-self-assign\n\n return origin.protocol + \"//\" + origin.host === target.protocol + \"//\" + target.host;\n}\n\n/** Adds the clicked submitter (and an image's coordinates) to s.extraData. */\nexport function addSubmitterFields(s, form) {\n // add submitting element to data if we know it\n var fields = submitterFields(form);\n\n for (var n in fields) {\n s.extraData = s.extraData || {};\n s.extraData[wellFormed(n)] = wellFormed(fields[n]);\n }\n}\n\n/** Adds the page's CSRF token to s.extraData when the form is posted to the page's origin. */\nexport function addCsrfField(s, form, method, forms) {\n // Rails CSRF hack (thanks to Yvan Barthelemy); like jquery-ujs, only for the page's origin and\n // only when the form is posted, since a get form would put the token in the url\n var csrf_token = $(\"meta[name=csrf-token]\").attr(\"content\");\n var csrf_param = $(\"meta[name=csrf-param]\").attr(\"content\");\n var posts =\n !isGet(method) &&\n (!method || /post/i.test(method) || /post/i.test(forms.property(form, \"method\")));\n\n if (csrf_param && csrf_token && posts && isSameOrigin(s.url)) {\n s.extraData = s.extraData || {};\n s.extraData[csrf_param] = csrf_token;\n }\n}\n\nfunction setFormAttribute(form, name, value) {\n callFormMethod(form, \"setAttribute\", name, value);\n}\n\n/** The raw attributes the upload changes, null when absent, to put back exactly (#380). */\nexport function saveAttributes(form) {\n var saved = {};\n\n $.each(uploadAttributes, function (i, name) {\n saved[name] = callFormMethod(form, \"hasAttribute\", name)\n ? callFormMethod(form, \"getAttribute\", name)\n : null;\n });\n\n return saved;\n}\n\n/** Puts back the attributes saveAttributes recorded, removing those that were absent. */\nexport function restoreAttributes(form, saved) {\n $.each(uploadAttributes, function (i, name) {\n if (saved[name] === null) {\n callFormMethod(form, \"removeAttribute\", name);\n } else {\n setFormAttribute(form, name, saved[name]);\n }\n });\n}\n\n/** Points the form at the frame `target` with the upload's url, method and encoding. */\nexport function setUploadAttributes(form, target, method, s, forms) {\n var mp = \"multipart/form-data\";\n\n // update form attrs in IE friendly way\n setFormAttribute(form, \"target\", target);\n if (!method || /post/i.test(method)) {\n setFormAttribute(form, \"method\", \"POST\");\n } else if (isGet(method) && !isGet(forms.property(form, \"method\"))) {\n // a form posts natively only with GET or POST; other verbs keep the form's own method\n setFormAttribute(form, \"method\", \"GET\");\n }\n setFormAttribute(form, \"action\", s.url);\n\n // ie borks in some cases when setting encoding\n if (!s.skipEncodingOverride && (!method || /post/i.test(method))) {\n setFormAttribute(form, \"encoding\", mp);\n setFormAttribute(form, \"enctype\", mp);\n }\n}\n\n/** Appends a hidden input per extraData field to the form; each input is pushed onto `added`. */\nexport function addExtraInputs(form, ownerDocument, extraData, traditional, added) {\n // Builds the input with DOM properties: a name is never parsed as HTML.\n function addHiddenInput(name, value) {\n var input = ownerDocument.createElement(\"input\");\n\n input.type = \"hidden\";\n input.name = name;\n added.push($(input).val(value).appendTo(form)[0]);\n }\n\n if (extraData) {\n for (var n in extraData) {\n if (hasOwn.call(extraData, n)) {\n // if using the $.param format that allows for multiple values with the same name\n if (\n $.isPlainObject(extraData[n]) &&\n hasOwn.call(extraData[n], \"name\") &&\n hasOwn.call(extraData[n], \"value\")\n ) {\n addHiddenInput(extraData[n].name, extraData[n].value);\n } else {\n // arrays and objects become one field per value, as $.param sends them (#597)\n var single = {};\n\n single[n] = extraData[n];\n var fields = deepSerialize(single, traditional);\n\n for (var f = 0; f < fields.length; f++) {\n addHiddenInput(fields[f][0], fields[f][1]);\n }\n }\n }\n }\n }\n}\n\n/** Submits the form natively, even when a control named submit hides the method. */\nexport function submitForm(form) {\n try {\n form.submit();\n } catch (err) {\n // just in case form has element with name/id of 'submit'\n callFormMethod(form, \"submit\");\n }\n}\n","import jQuery from \"jquery\";\nimport { log } from \"./diagnostics.js\";\n\n// The iframe response reader: turns the frame's document into the mock xhr's text, XML, status\n// and dataType, then parses it as $.ajax would (dataFilter, JSON, script).\nvar $ = jQuery;\n\n/** The frame's document, or null when the browser denies access to it. */\nexport function getDoc(frame) {\n /* it looks like contentWindow or contentDocument do not\n * carry the protocol property in ie8, when running under ssl\n * frame.document is the only valid response document, since\n * the protocol is know but not on the other two objects. strange?\n * \"Same origin policy\" http://en.wikipedia.org/wiki/Same_origin_policy\n */\n\n var doc = null;\n\n // IE8 cascading access check\n try {\n if (frame.contentWindow) {\n doc = frame.contentWindow.document;\n }\n } catch (err) {\n // IE8 access denied under ssl & missing protocol\n log(\"cannot get iframe.contentWindow document: \" + err);\n }\n\n if (doc) {\n // successful getting content\n return doc;\n }\n\n try {\n // simply checking may throw in ie8 under ssl or mismatched protocol\n doc = frame.contentDocument ? frame.contentDocument : frame.document;\n } catch (err) {\n // last attempt\n log(\"cannot get iframe.contentDocument: \" + err);\n doc = frame.document;\n }\n\n return doc;\n}\n\n/** Parses the response text or XML for the given (lowercase) dataType. */\nexport function httpData(xhr, type, s) {\n // mostly lifted from jq1.4.4\n\n var ct = xhr.getResponseHeader(\"content-type\") || \"\",\n xml = (type === \"xml\" || !type) && ct.indexOf(\"xml\") >= 0,\n data = xml ? xhr.responseXML : xhr.responseText;\n\n if (xml && data.documentElement.nodeName === \"parsererror\") {\n if ($.error) {\n $.error(\"parsererror\");\n }\n }\n if (s && s.dataFilter) {\n data = s.dataFilter(data, type);\n }\n if (typeof data === \"string\") {\n if ((type === \"json\" || !type) && ct.indexOf(\"json\") >= 0) {\n data = JSON.parse(data);\n } else if (type === \"script\") {\n $.globalEval(data);\n }\n }\n\n return data;\n}\n\n// Copies the status and statusText attributes of an element onto the mock xhr.\nfunction readStatus(xhr, el) {\n // support for XHR 'status' & 'statusText' emulation :\n xhr.status = Number(el.getAttribute(\"status\")) || xhr.status;\n xhr.statusText = el.getAttribute(\"statusText\") || xhr.statusText;\n}\n\n// Fills the mock xhr from the document itself.\nfunction readDocument(doc, xhr, s, isXml) {\n var docRoot = doc.body ? doc.body : doc.documentElement;\n\n xhr.responseText = docRoot ? docRoot.innerHTML : null;\n xhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc;\n if (isXml) {\n s.dataType = \"xml\";\n }\n xhr.getResponseHeader = function (header) {\n // the dataType in lowercase, as $.ajax reads it\n var headers = { \"content-type\": s.dataType && s.dataType.toLowerCase() };\n\n return headers[header.toLowerCase()];\n };\n if (docRoot) {\n readStatus(xhr, docRoot);\n }\n}\n\n// A response embedded in a textarea, or text wrapped in pre or body, replaces responseText.\nfunction readEmbedded(doc, xhr, dt, s) {\n var scr = /(json|script|text)/.test(dt);\n\n if (!scr && !s.textarea) {\n return;\n }\n // see if user embedded response in textarea\n var ta = doc.getElementsByTagName(\"textarea\")[0];\n\n if (ta) {\n xhr.responseText = ta.value;\n readStatus(xhr, ta);\n } else if (scr) {\n // account for browsers injecting pre around json response\n var pre = doc.getElementsByTagName(\"pre\")[0];\n var b = doc.getElementsByTagName(\"body\")[0];\n\n if (pre) {\n xhr.responseText = pre.textContent ? pre.textContent : pre.innerText;\n } else if (b) {\n xhr.responseText = b.textContent ? b.textContent : b.innerText;\n }\n }\n}\n\n/**\n * Reads and parses the response document into the mock xhr. Returns {status, data, errMsg}, or\n * null when `retry()` asks to read the document again later (Opera's untraversable DOM).\n */\nexport function readResponse(doc, xhr, s, retry) {\n var status = \"success\",\n data,\n errMsg;\n\n try {\n var isXml = /^xml$/i.test(s.dataType) || doc.XMLDocument || $.isXMLDoc(doc);\n\n log(\"isXml=\" + isXml);\n\n if (!isXml && window.opera && (doc.body === null || !doc.body.innerHTML)) {\n // in some browsers (Opera) the iframe DOM is not always traversable when\n // the onload callback fires, so we loop a bit to accommodate\n if (retry()) {\n return null;\n }\n // let this fall through because server response could be an empty document\n }\n\n readDocument(doc, xhr, s, isXml);\n\n var dt = (s.dataType || \"\").toLowerCase();\n\n readEmbedded(doc, xhr, dt, s);\n\n try {\n data = httpData(xhr, dt, s);\n } catch (err) {\n status = \"parsererror\";\n xhr.error = errMsg = err || status;\n }\n } catch (err) {\n log(\"error caught: \", err);\n status = \"error\";\n xhr.error = errMsg = err;\n }\n\n return { status: status, data: data, errMsg: errMsg };\n}\n","import jQuery from \"jquery\";\nimport { log } from \"./diagnostics.js\";\n\n// The iframe upload's lifecycle: the mock xhr and the Deferred, the global ajax events, the\n// beforeSend veto, the timeout, abort and settling.\nvar $ = jQuery;\n\n/**\n * Creates the lifecycle of one upload with the merged settings `s`. `frame.stop()` stops the\n * frame's load and `frame.release()` removes or resets the frame after the upload.\n */\nexport function createLifecycle(s, frame) {\n var g,\n timeoutHandle,\n callbackProcessed,\n deferred = $.Deferred();\n\n var xhr = {\n // mock object\n aborted: 0,\n responseText: null,\n responseXML: null,\n status: 0,\n statusText: \"n/a\",\n getAllResponseHeaders: function () {},\n getResponseHeader: function () {},\n setRequestHeader: function () {},\n abort: function (status) {\n abort(status, [xhr, \"aborted\", status]);\n },\n };\n\n // #341\n deferred.abort = function (status) {\n xhr.abort(status);\n };\n\n function done() {\n return xhr.aborted || callbackProcessed;\n }\n\n // Completes an aborted upload once and rejects the Deferred with `rejection`.\n // `textStatus` replaces the default \"timeout\"/\"aborted\" text status.\n function abort(status, rejection, textStatus) {\n var e = textStatus || (status === \"timeout\" ? \"timeout\" : \"aborted\");\n\n if (done()) {\n return;\n }\n\n log(\"aborting upload... \" + e);\n xhr.aborted = 1;\n frame.stop();\n xhr.error = e;\n if (s.error) {\n s.error.call(s.context, xhr, e, status);\n }\n deferred.reject.apply(deferred, rejection);\n\n if (g) {\n $.event.trigger(\"ajaxError\", [xhr, s, e]);\n }\n\n complete(e);\n }\n\n // The global events that end every upload, cancelled ones included.\n function endGlobalEvents() {\n if (g) {\n $.event.trigger(\"ajaxComplete\", [xhr, s]);\n }\n\n if (g && !--$.active) {\n $.event.trigger(\"ajaxStop\");\n }\n }\n\n // The steps every finished or aborted upload ends with, in $.ajax order.\n function complete(status) {\n if (s.complete) {\n s.complete.call(s.context, xhr, status);\n }\n\n endGlobalEvents();\n clearTimeout(timeoutHandle);\n\n // clean up\n setTimeout(function () {\n frame.release();\n xhr.responseXML = null;\n }, 100);\n }\n\n // A beforeSend veto ends the upload as $.ajax cancels a request: no callbacks, the global\n // events end with ajaxError \"canceled\".\n function cancel() {\n if (done()) {\n return;\n }\n\n callbackProcessed = true;\n deferred.reject();\n if (g) {\n $.event.trigger(\"ajaxError\", [xhr, s, \"canceled\"]);\n }\n endGlobalEvents();\n }\n\n // Fires the start events and beforeSend; false when the upload must not be posted.\n function start() {\n g = s.global;\n // trigger ajax global events so that activity/block indicators work like normal\n if (g && $.active++ === 0) {\n $.event.trigger(\"ajaxStart\");\n }\n\n if (s.beforeSend && s.beforeSend.call(s.context, xhr, s) === false) {\n cancel();\n\n return false;\n }\n\n if (xhr.aborted) {\n // abort() in beforeSend already completed the upload\n return false;\n }\n\n if (g) {\n $.event.trigger(\"ajaxSend\", [xhr, s]);\n }\n\n // an ajaxSend handler may abort too\n return !xhr.aborted;\n }\n\n // Resolves the upload; returns {error} when the success callback threw.\n function succeed(data) {\n var failure;\n\n try {\n s.success.call(s.context, data, \"success\", xhr);\n } catch (err) {\n failure = { error: err };\n }\n\n deferred.resolve(xhr.responseText, \"success\", xhr);\n\n if (g) {\n $.event.trigger(\"ajaxSuccess\", [xhr, s, data]);\n }\n\n return failure;\n }\n\n // Settles the upload with the response reader's {status, data, errMsg}.\n function settle(result) {\n var status = result.status,\n errMsg = result.errMsg;\n\n if (xhr.aborted) {\n // abort() completed the upload while its response was processed\n log(\"upload aborted\");\n\n return;\n }\n\n // an emulated HTTP error status wins, as in $.ajax; a parse error is kept otherwise\n if (xhr.status && !((xhr.status >= 200 && xhr.status < 300) || xhr.status === 304)) {\n status = \"error\";\n }\n\n callbackProcessed = true;\n\n // ordering of these callbacks/triggers is odd, but that's how $.ajax does it\n if (status === \"success\") {\n var failure = succeed(result.data);\n\n complete(status);\n if (failure) {\n // the upload is settled; the success callback's exception still reaches the console\n throw failure.error;\n }\n\n return;\n }\n\n if (typeof errMsg === \"undefined\") {\n errMsg = xhr.statusText;\n }\n if (s.error) {\n s.error.call(s.context, xhr, status, errMsg);\n }\n deferred.reject(xhr, \"error\", errMsg);\n if (g) {\n $.event.trigger(\"ajaxError\", [xhr, s, errMsg]);\n }\n\n complete(status);\n }\n\n return {\n xhr: xhr,\n deferred: deferred,\n start: start,\n done: done,\n abort: abort,\n settle: settle,\n // Settles an upload that failed with an exception (ignored once aborted).\n fail: function (err) {\n settle({ status: \"error\", errMsg: err });\n },\n // Runs `onTimeout` after s.timeout, when set.\n startTimer: function (onTimeout) {\n if (s.timeout) {\n timeoutHandle = setTimeout(onTimeout, s.timeout);\n }\n },\n stopTimer: function () {\n clearTimeout(timeoutHandle);\n timeoutHandle = undefined;\n },\n };\n}\n","import {\n addCsrfField,\n addExtraInputs,\n addSubmitterFields,\n restoreAttributes,\n saveAttributes,\n setUploadAttributes,\n submitForm,\n} from \"./iframe-post.js\";\nimport { closestByTag, formMember } from \"./form-members.js\";\nimport { deprecate, log } from \"./diagnostics.js\";\nimport { getDoc, readResponse } from \"./iframe-response.js\";\nimport { createLifecycle } from \"./iframe-lifecycle.js\";\nimport jQuery from \"jquery\";\nimport { keepContext } from \"./options.js\";\n\n// The iframe transport: posts the form itself into a hidden frame and reads the response from it,\n// for file uploads without the File API or when the iframe option asks for it.\nvar $ = jQuery;\n\n/**\n * The iframe send step. `hasProp` is what the entry detected at load; `forms.property` reads a\n * form property as attr2 does.\n */\nexport function createIframeTransport(hasProp, forms) {\n var CLIENT_TIMEOUT_ABORT = 1;\n var SERVER_ABORT = 2;\n // tells apart the frames of uploads that start in the same millisecond\n var frameCount = 0;\n\n // ensure that every serialized input is still enabled\n function enableControls(elements) {\n for (var i = 0; i < elements.length; i++) {\n var el = $(elements[i]);\n\n if (hasProp) {\n el.prop(\"disabled\", false);\n } else {\n el.removeAttr(\"disabled\");\n }\n }\n }\n\n // Names the frame's window, when the page may: a cross-origin or sandboxed frame refuses.\n function nameWindow(frame, name) {\n try {\n if (frame.contentWindow) {\n frame.contentWindow.name = name;\n }\n } catch (ignore) {}\n }\n\n // The frame the form posts into: the iframeTarget, named `id` when it has no name, or a new\n // hidden frame named `id`. Returns the frame and the name the form targets.\n function createFrame(s, id, ownerDocument) {\n var $io, n;\n\n if (s.iframeTarget) {\n $io = $(s.iframeTarget, ownerDocument);\n n = $io.attr(\"name\");\n if (!n) {\n $io.attr(\"name\", id);\n // a frame already in the page keeps the browsing context name it was inserted with\n $io.each(function () {\n nameWindow(this, id);\n });\n } else {\n id = n;\n }\n } else {\n var io = ownerDocument.createElement(\"iframe\");\n\n io.setAttribute(\"name\", id);\n io.setAttribute(\"src\", s.iframeSrc);\n $io = $(io);\n $io.css({ position: \"absolute\", top: \"-1000px\", left: \"-1000px\" });\n }\n\n return { $io: $io, id: id };\n }\n\n // The frame hooks the lifecycle calls: stop a load in progress, and release after the upload.\n function frameHooks(s, $io) {\n return {\n stop: function () {\n try {\n // #214, #257\n if ($io[0].contentWindow.document.execCommand) {\n $io[0].contentWindow.document.execCommand(\"Stop\");\n }\n } catch (ignore) {}\n\n $io.attr(\"src\", s.iframeSrc); // abort op in progress\n },\n release: function () {\n if (!s.iframeTarget) {\n $io.remove();\n } else {\n // adding else to clean up existing iframe response.\n $io.attr(\"src\", s.iframeSrc);\n }\n },\n };\n }\n\n function listen(io, cb) {\n if (io.attachEvent) {\n io.attachEvent(\"onload\", cb);\n } else {\n io.addEventListener(\"load\", cb, false);\n }\n }\n\n function unlisten(io, cb) {\n if (io.detachEvent) {\n io.detachEvent(\"onload\", cb);\n } else {\n io.removeEventListener(\"load\", cb, false);\n }\n }\n\n // private function for handling file uploads (hat tip to YAHOO!)\n function fileUploadIframe(submission) {\n var form = submission.form,\n method = submission.method;\n\n var s = keepContext($.extend(true, {}, $.ajaxSettings, submission.options), [\n $.ajaxSettings,\n submission.options,\n ]);\n\n s.context = s.context || s;\n var ownerDocument = formMember(form, \"ownerDocument\");\n var $body = $(closestByTag(form, [\"body\"]));\n var frame = createFrame(s, \"jqFormIO\" + new Date().getTime() + frameCount++, ownerDocument);\n var $io = frame.$io,\n io = $io[0];\n var life = createLifecycle(s, frameHooks(s, $io));\n var domCheckCount = 50;\n\n if (!life.start()) {\n return life.deferred;\n }\n\n addSubmitterFields(s, form);\n addCsrfField(s, form, method, forms);\n\n // look for server aborts\n function checkState() {\n try {\n var state = getDoc(io).readyState;\n\n log(\"state = \" + state);\n if (state && state.toLowerCase() === \"uninitialized\") {\n setTimeout(checkState, 50);\n }\n } catch (e) {\n log(\"Server abort: \", e, \" (\", e.name, \")\");\n cb(SERVER_ABORT);\n life.stopTimer();\n }\n }\n\n // take a breath so that pending repaints get some cpu time before the upload starts\n function doSubmit() {\n var saved = saveAttributes(form);\n\n setUploadAttributes(form, frame.id, method, s, forms);\n\n // support timout\n life.startTimer(function () {\n cb(CLIENT_TIMEOUT_ABORT);\n });\n\n // add \"extra\" data to form if provided in options\n var extraInputs = [];\n\n try {\n addExtraInputs(form, ownerDocument, s.extraData, submission.traditional, extraInputs);\n\n if (!s.iframeTarget) {\n // add iframe to doc and submit the form\n $io.appendTo($body);\n }\n\n // A connected form posting into a frame outside the document opens a new window.\n var root = ownerDocument.documentElement;\n\n if (io && $.contains(root, form) && !$.contains(root, io)) {\n var notInDocument = \"jquery.form: the upload frame is not in the document\";\n\n life.abort(notInDocument, [life.xhr, \"error\", notInDocument], \"error\");\n\n return;\n }\n\n listen(io, cb);\n setTimeout(checkState, 15);\n submitForm(form);\n } finally {\n // reset attrs and remove \"extra\" input elements\n restoreAttributes(form, saved);\n $(extraInputs).remove();\n }\n }\n\n // Reads the next document by Opera's rules: false once the retries are used up.\n function retry() {\n if (--domCheckCount) {\n log(\"requeing onLoad callback, DOM not available\");\n setTimeout(cb, 250);\n\n return true;\n }\n\n return false;\n }\n\n function cb(e) {\n if (life.done()) {\n return;\n }\n\n var doc = getDoc(io);\n\n if (!doc) {\n log(\"cannot access response document\");\n e = SERVER_ABORT;\n }\n if (e === CLIENT_TIMEOUT_ABORT) {\n life.abort(\"timeout\", [life.xhr, \"timeout\"]);\n\n return;\n }\n if (e === SERVER_ABORT) {\n life.abort(\"server abort\", [life.xhr, \"error\", \"server abort\"]);\n\n return;\n }\n\n if (doc.location.href === s.iframeSrc) {\n // response not received yet\n return;\n }\n\n unlisten(io, cb);\n\n var result = readResponse(doc, life.xhr, s, retry);\n\n if (result) {\n life.settle(result);\n }\n }\n\n // An exception while posting settles the upload with \"error\" and the exception.\n function post() {\n if (life.done()) {\n // aborted before the delayed post\n return;\n }\n\n try {\n doSubmit();\n } catch (err) {\n log(\"upload failed: \", err);\n life.fail(err);\n }\n }\n\n if (s.forceSync) {\n post();\n } else {\n setTimeout(post, 10); // this lets dom updates render\n }\n\n return life.deferred;\n }\n\n return function sendIframe(submission) {\n var jqxhr;\n\n // now, while the controls are still listed: ajaxSubmit clears the list when it returns,\n // before a closeKeepAlive request completes\n enableControls(submission.controls);\n\n // hack to fix Safari hang (thanks to Tim Molendijk for this)\n // see: http://groups.google.com/group/jquery-dev/browse_thread/thread/36395b7ab510dd5d\n if (submission.options.closeKeepAlive) {\n deprecate(\"closeKeepAlive\", \"closeKeepAlive works around a Safari 3/4 bug and is deprecated\");\n $.get(submission.options.closeKeepAlive, function () {\n jqxhr = fileUploadIframe(submission);\n });\n } else {\n jqxhr = fileUploadIframe(submission);\n }\n\n return jqxhr;\n };\n}\n","import { deprecate, log } from \"./diagnostics.js\";\nimport { assertRealParent } from \"./form-members.js\";\nimport jQuery from \"jquery\";\nimport { keepContext } from \"./options.js\";\nimport { urlencodedFields } from \"./successful-controls.js\";\n\n// A Submission is one ajaxSubmit call once its vetoes have passed:\n// { form, $form, fields, controls, options, method, traditional }. `options` is the object the\n// callbacks and events receive; later steps change it in place.\n\n/**\n * The submission steps. `feature` holds what the entry detected at load (fileapi, formdata), and\n * `forms` reads form attributes and attr2-style properties (attribute, property), and\n * `serialization` collects the form's fields and controls.\n */\nexport function createSubmission(feature, forms, serialization) {\n var $ = jQuery;\n\n function refuse(message) {\n log(message);\n\n return null;\n }\n\n // The options merged over the form's action, the method, and the ajax defaults.\n function withDefaults(form, options, method) {\n var action = options.url || forms.property(form, \"action\");\n var url = typeof action === \"string\" ? action.trim() : \"\";\n\n // clean url (don't include hash value); an action that is only a fragment means this page\n url = url.split(\"#\")[0] || window.location.href.split(\"#\")[0];\n // IE requires javascript:false in https, but this breaks chrome >83 and goes against spec.\n // Instead of using javascript:false always, let's only apply it for IE.\n var isMsie = /(MSIE|Trident)/.test(navigator.userAgent || \"\");\n var iframeSrc = isMsie && /^https/i.test(document.URL) ? \"javascript:false\" : \"about:blank\"; // eslint-disable-line no-script-url\n\n var merged = $.extend(\n true,\n {\n url: url,\n success: $.ajaxSettings.success,\n type: method || $.ajaxSettings.type,\n iframeSrc: iframeSrc,\n },\n options\n );\n\n return keepContext(merged, [options]);\n }\n\n /**\n * The one method every transport sends, read after the hooks: `method` wins over `type`, and\n * `type` is set to it. Undefined when only the ajax default applies, so each transport keeps\n * its own default.\n */\n function resolveMethod(options, defaultType) {\n var resolved = options.method || options.type;\n\n options.type = resolved;\n\n return resolved === defaultType && !options.method ? undefined : resolved;\n }\n\n // The data option, kept as extraData and encoded, or undefined without one.\n function extraQuery(fields, options, traditional) {\n if (!options.data) {\n return undefined;\n }\n\n var optionsData = typeof options.data === \"function\" ? options.data(fields) : options.data;\n\n if (typeof optionsData === \"string\") {\n if (options.requestFormat === \"json\") {\n throw new Error(\n 'jquery.form: requestFormat \"json\" needs object data; a string data option is a query string'\n );\n }\n\n // a query string: sent as-is when urlencoded, as its own fields otherwise\n options.extraData = queryPairs(optionsData);\n\n return optionsData;\n }\n\n options.extraData = optionsData;\n\n return $.param(optionsData, traditional);\n }\n\n // Sets a key as an own data property, so a name like __proto__ is an ordinary key.\n function defineKey(object, key, value) {\n Object.defineProperty(object, key, {\n value: value,\n enumerable: true,\n writable: true,\n configurable: true,\n });\n }\n\n /**\n * requestFormat \"json\" (#545): the fields as an object (a repeated name gives an array), merged\n * with object data, sent as a JSON body. Based on the idea in PR #557 by zhangciwu.\n */\n function jsonBody(options, fields) {\n if (/^get$/i.test(options.type)) {\n throw new Error('jquery.form: requestFormat \"json\" needs a method with a body, such as POST');\n }\n\n var body = {};\n var own = Object.prototype.hasOwnProperty;\n\n for (var i = 0; i < fields.length; i++) {\n var name = fields[i].name;\n\n if (!own.call(body, name)) {\n defineKey(body, name, fields[i].value);\n } else if (Array.isArray(body[name])) {\n body[name].push(fields[i].value);\n } else {\n defineKey(body, name, [body[name], fields[i].value]);\n }\n }\n\n var extra = options.extraData;\n\n for (var key in extra) {\n if (own.call(extra, key)) {\n defineKey(body, key, extra[key]);\n }\n }\n\n options.data = JSON.stringify(body);\n options.contentType = \"application/json; charset=UTF-8\";\n }\n\n // The fields of a query string, as the { name, value } list $.param takes.\n function queryPairs(query) {\n var pairs = [];\n var parts = query.split(\"&\");\n\n for (var i = 0; i < parts.length; i++) {\n if (parts[i]) {\n var at = parts[i].indexOf(\"=\");\n var name = at < 0 ? parts[i] : parts[i].slice(0, at);\n var value = at < 0 ? \"\" : parts[i].slice(at + 1);\n\n pairs.push({ name: decodeQuery(name), value: decodeQuery(value) });\n }\n }\n\n return pairs;\n }\n\n function decodeQuery(text) {\n return decodeURIComponent(text.replace(/\\+/g, \" \"));\n }\n\n // Puts the encoded fields in the url for a get, and in the data otherwise.\n function encode(options, q, qx) {\n if (qx) {\n q = q ? q + \"&\" + qx : qx;\n }\n\n if (options.type.toUpperCase() === \"GET\") {\n // the query goes before any fragment in the url option\n var hashAt = options.url.indexOf(\"#\");\n var base = hashAt < 0 ? options.url : options.url.slice(0, hashAt);\n\n options.url =\n base + (base.indexOf(\"?\") >= 0 ? \"&\" : \"?\") + q + options.url.slice(base.length);\n options.data = null; // data is null for 'get'\n } else {\n options.data = q; // data is the query string for 'post'\n }\n }\n\n // A callback option as a list: an array as given, one function, or none.\n function callbackList(callback) {\n if (Array.isArray(callback)) {\n return callback;\n }\n\n return callback ? [callback] : [];\n }\n\n // Calls each callback in order with the same this and arguments.\n function callEach(callbacks, context, args) {\n for (var i = 0; i < callbacks.length; i++) {\n callbacks[i].apply(context, args);\n }\n }\n\n /**\n * Resolves the options, serializes the form, and runs the vetoes: the Submission, or null when\n * an event or callback stopped it.\n */\n function prepare($set, options) {\n $set.each(function () {\n assertRealParent(this);\n });\n\n var form = $set[0];\n var method = options.method || options.type || forms.property(form, \"method\");\n\n options = withDefaults(form, options, method);\n\n // the ajax default type, when neither the caller nor the form gave a method\n var defaultType = method ? undefined : options.type;\n\n // hook for manipulating the form data before it is extracted;\n // convenient for use with rich editors like tinyMCE or FCKEditor\n var veto = {};\n\n $set.trigger(\"form-pre-serialize\", [$set, options, veto]);\n if (veto.veto) {\n return refuse(\"ajaxSubmit: submit vetoed via form-pre-serialize trigger\");\n }\n\n // provide opportunity to alter form data before it is serialized\n if (options.beforeSerialize && options.beforeSerialize($set, options) === false) {\n return refuse(\"ajaxSubmit: submit aborted via beforeSerialize callback\");\n }\n\n var traditional = options.traditional;\n\n if (typeof traditional === \"undefined\") {\n traditional = $.ajaxSettings.traditional;\n }\n\n var collected = serialization.collect($set[0], options.semantic, options.filtering);\n var fields = collected.fields;\n var controls = collected.controls;\n var qx = extraQuery(fields, options, traditional);\n\n // give pre-submit callback an opportunity to abort the submit\n if (options.beforeSubmit && options.beforeSubmit(fields, $set, options) === false) {\n return refuse(\"ajaxSubmit: submit aborted via beforeSubmit callback\");\n }\n\n // fire vetoable 'validate' event\n $set.trigger(\"form-submit-validate\", [fields, $set, options, veto]);\n if (veto.veto) {\n return refuse(\"ajaxSubmit: submit vetoed via form-submit-validate trigger\");\n }\n\n method = resolveMethod(options, defaultType);\n\n if (options.requestFormat === \"json\") {\n jsonBody(options, fields);\n } else {\n encode(options, $.param(urlencodedFields(fields), traditional), qx);\n }\n\n return {\n form: form,\n $form: $set,\n fields: fields,\n controls: controls,\n options: options,\n method: method,\n traditional: traditional,\n };\n }\n\n /**\n * Wraps success, error and complete (a function or an array of them, as $.ajax takes) so each\n * also receives the form, and adds the resetForm,\n * clearForm and target steps before the success callbacks.\n */\n function deliver(submission) {\n var $set = submission.$form;\n var options = submission.options;\n var callbacks = [];\n\n if (options.resetForm) {\n callbacks.push(function () {\n $set.resetForm();\n });\n }\n\n if (options.clearForm) {\n callbacks.push(function () {\n $set.clearForm(options.includeHidden);\n });\n }\n\n // perform a load on the target only if dataType is not provided\n if (!options.dataType && options.target) {\n var successes = callbackList(options.success);\n\n callbacks.push(function (data, textStatus, jqXHR) {\n var successArguments = arguments,\n fn = options.replaceTarget ? \"replaceWith\" : \"html\",\n $target = $(options.target);\n\n // Only a string response is inserted. jQuery has already parsed a JSON or XML response,\n // and inserting it would parse each of its strings as HTML.\n if (typeof data === \"string\") {\n $target[fn](data);\n } else {\n log(\"target: the response was parsed by jQuery, so it is not inserted\");\n }\n\n if (!$target.length) {\n // nothing to fill: success still runs once, with the normal context\n callEach(successes, this, successArguments);\n }\n\n $target.each(function () {\n callEach(successes, this, successArguments);\n });\n });\n } else {\n $.merge(callbacks, callbackList(options.success));\n }\n\n options.success = function (data, status, xhr) {\n // jQuery 1.4+ passes xhr as 3rd arg\n var context = options.context || this; // jQuery 1.4+ supports scope context\n\n for (var i = 0, max = callbacks.length; i < max; i++) {\n callbacks[i].apply(context, [data, status, xhr || $set, $set]);\n }\n };\n\n if (options.error) {\n var errors = callbackList(options.error);\n\n options.error = function (xhr, status, error) {\n callEach(errors, options.context || this, [xhr, status, error, $set]);\n };\n }\n\n if (options.complete) {\n var completes = callbackList(options.complete);\n\n options.complete = function (xhr, status) {\n callEach(completes, options.context || this, [xhr, status, $set]);\n };\n }\n }\n\n /**\n * The transport for a submission: \"iframe\" for files without the File API or when forced,\n * \"formdata\" for files with it, \"ajax\" otherwise.\n */\n function chooseTransport(submission) {\n var $set = submission.$form;\n var options = submission.options;\n\n // [value] (issue #113), also see comment:\n // https://github.com/malsup/form/commit/588306aedba1de01388032d5f42a60159eea9228#commitcomment-2180219\n // and the file inputs outside the form that belong to it through their form attribute\n var fileInputs = $(\"input[type=file]:enabled\", $set)\n .add($(submission.controls).filter(\"input[type=file]\"))\n .filter(function () {\n return $(this).val() !== \"\";\n });\n var hasFileInputs = fileInputs.length > 0;\n // compared as the browser does: ASCII case-insensitive, without surrounding whitespace\n var mp = /^[\\t\\n\\f\\r ]*multipart\\/form-data[\\t\\n\\f\\r ]*$/i;\n var multipart =\n mp.test(forms.attribute($set[0], \"enctype\")) || mp.test(forms.attribute($set[0], \"encoding\"));\n var fileAPI = feature.fileapi && feature.formdata;\n\n log(\"fileAPI :\" + fileAPI);\n\n var shouldUseFrame = (hasFileInputs || multipart) && !fileAPI;\n\n var transport = (hasFileInputs || multipart) && fileAPI ? \"formdata\" : \"ajax\";\n\n // options.iframe allows user to force iframe mode\n // 06-NOV-09: now defaulting to iframe mode if file input is detected\n if (options.iframe !== false && (options.iframe || shouldUseFrame)) {\n transport = \"iframe\";\n }\n\n if (transport === \"iframe\" && !options.iframe) {\n deprecate(\n \"iframe\",\n \"choosing the iframe transport automatically without FormData is deprecated, set iframe: true\"\n );\n }\n\n if (transport !== \"ajax\" && options.requestFormat === \"json\") {\n throw new Error(\n 'jquery.form: requestFormat \"json\" cannot send files or use the iframe transport'\n );\n }\n\n return transport;\n }\n\n return { prepare: prepare, deliver: deliver, chooseTransport: chooseTransport };\n}\n","/*!\n * jQuery Form Plugin\n * version: 4.5.0\n * Requires jQuery v1.7.2 or later\n * Project repository: https://github.com/jquery-form/form\n\n * Copyright 2017 Kevin Morris\n * Copyright 2006 M. Alsup\n\n * Dual licensed under the LGPL-2.1+ or MIT licenses\n * https://github.com/jquery-form/form#license\n\n * This library is free software; you can redistribute it and/or\n * modify it under the terms of the GNU Lesser General Public\n * License as published by the Free Software Foundation; either\n * version 2.1 of the License, or (at your option) any later version.\n * This library is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n */\nimport { ajaxForm, ajaxFormUnbind } from \"./ajax-form.js\";\nimport { callFormMethod, tagName } from \"./form-members.js\";\nimport {\n createSuccessfulControls,\n isSuccessful,\n urlencodedFields,\n valueOf,\n} from \"./successful-controls.js\";\nimport { deprecate, deprecateOldJQuery, log } from \"./diagnostics.js\";\nimport { sendAjax, sendFormData } from \"./xhr-transport.js\";\nimport { createIframeTransport } from \"./iframe-transport.js\";\nimport { createSubmission } from \"./submission.js\";\nimport { formAttribute } from \"./form-attributes.js\";\nimport jQuery from \"jquery\";\nimport { submitOptions } from \"./options.js\";\nimport { submitterElement } from \"./submitter.js\";\n\n(function ($) {\n \"use strict\";\n\n /*\n\t\tUsage Note:\n\t\t-----------\n\t\tDo not use both ajaxSubmit and ajaxForm on the same form. These\n\t\tfunctions are mutually exclusive. Use ajaxSubmit if you want\n\t\tto bind your own submit handler to the form. For example,\n\n\t\t$(document).ready(function() {\n\t\t\t$('#myForm').on('submit', function(e) {\n\t\t\t\te.preventDefault(); // <-- important\n\t\t\t\t$(this).ajaxSubmit({\n\t\t\t\t\ttarget: '#output'\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\n\t\tUse ajaxForm when you want the plugin to manage all the event binding\n\t\tfor you. For example,\n\n\t\t$(document).ready(function() {\n\t\t\t$('#myForm').ajaxForm({\n\t\t\t\ttarget: '#output'\n\t\t\t});\n\t\t});\n\n\t\tYou can also use ajaxForm with delegation (requires jQuery v1.7+), so the\n\t\tform does not have to exist when you invoke ajaxForm:\n\n\t\t$('#myForm').ajaxForm({\n\t\t\tdelegation: true,\n\t\t\ttarget: '#output'\n\t\t});\n\n\t\tWhen using ajaxForm, the ajaxSubmit function will be invoked for you\n\t\tat the appropriate time.\n\t*/\n\n /**\n * Feature detection\n */\n var feature = {};\n\n feature.fileapi = $('').get(0).files !== undefined;\n feature.formdata = typeof window.FormData !== \"undefined\";\n\n var hasProp = !!$.fn.prop;\n // What attr2 returns for a form: the property when it is a string, otherwise the attribute. The\n // property is read plainly on purpose: a control named like it shadows it, and then the raw\n // attribute is used.\n function formProperty(form, name) {\n var value = hasProp ? form[name] : undefined;\n\n return typeof value === \"string\" ? value : formAttribute(form, name);\n }\n\n var forms = { attribute: formAttribute, property: formProperty };\n var serialization = createSuccessfulControls(feature);\n var steps = createSubmission(feature, forms, serialization);\n var transports = {\n iframe: createIframeTransport(hasProp, forms),\n formdata: sendFormData,\n ajax: sendAjax,\n };\n\n // attr2 uses prop when it can but checks the return type for\n // an expected string. This accounts for the case where a form\n // contains inputs with names like \"action\" or \"method\"; in those\n // cases \"prop\" returns the element\n $.fn.attr2 = function () {\n deprecate(\"attr2\", \"attr2 is deprecated, use .prop() or .attr()\");\n\n if (!hasProp) {\n return this.attr.apply(this, arguments);\n }\n\n var val = this.prop.apply(this, arguments);\n\n if ((val && val.jquery) || typeof val === \"string\") {\n return val;\n }\n\n return this.attr.apply(this, arguments);\n };\n\n /**\n * ajaxSubmit() provides a mechanism for immediately submitting\n * an HTML form using AJAX.\n *\n * @param\t{object|string}\toptions\t\tjquery.form.js parameters or custom url for submission\n * @param\t{object}\t\tdata\t\textraData\n * @param\t{string}\t\tdataType\tajax dataType\n * @param\t{function}\t\tonSuccess\tajax success callback function\n */\n $.fn.ajaxSubmit = function (options, data, dataType, onSuccess) {\n deprecateOldJQuery($.fn.jquery);\n\n // fast fail if nothing selected (http://dev.jquery.com/ticket/2752)\n if (!this.length) {\n log(\"ajaxSubmit: skipping submit process - no element selected\");\n\n return this;\n }\n\n // #541: jQuery's slim build has no $.ajax\n if (!$.ajax) {\n throw new Error(\n \"jquery.form: ajaxSubmit needs the full jQuery build; this jQuery has no $.ajax\"\n );\n }\n\n var submission = steps.prepare(this, submitOptions(options, data, dataType, onSuccess));\n\n if (!submission) {\n return this;\n }\n\n steps.deliver(submission);\n\n var jqxhr = transports[steps.chooseTransport(submission)](submission);\n\n this.removeData(\"jqxhr\").data(\"jqxhr\", jqxhr);\n\n // clear element array\n for (var k = 0; k < submission.controls.length; k++) {\n submission.controls[k] = null;\n }\n\n // fire 'notify' event\n this.trigger(\"form-submit-notify\", [this, submission.options]);\n\n return this;\n };\n\n $.fn.ajaxForm = ajaxForm;\n $.fn.ajaxFormUnbind = ajaxFormUnbind;\n\n /**\n * formToArray() gathers form element data into an array of objects that can\n * be passed to any of the following ajax functions: $.get, $.post, or load.\n * Each object in the array has both a 'name' and 'value' property. An example of\n * an array for a simple login form might be:\n *\n * [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ]\n *\n * It is this array that is passed to pre-submit callback functions provided to the\n * ajaxSubmit() and ajaxForm() methods.\n */\n $.fn.formToArray = function (semantic, elements, filtering) {\n var collected = serialization.collect(this[0], semantic, filtering);\n\n if (elements) {\n elements.push.apply(elements, collected.controls);\n }\n\n return collected.fields;\n };\n\n /**\n * Serializes form data into a 'submittable' string. This method will return a string\n * in the format: name1=value1&name2=value2\n */\n $.fn.formSerialize = function (semantic) {\n // hand off to jQuery.param for proper encoding\n return $.param(urlencodedFields(this.formToArray(semantic)));\n };\n\n /**\n * Serializes all field elements in the jQuery object into a query string.\n * This method will return a string in the format: name1=value1&name2=value2\n */\n $.fn.fieldSerialize = function (successful) {\n var a = [];\n\n this.each(function () {\n var n = this.name;\n\n // a form is not a field, though it may have a name\n if (!n || tagName(this) === \"form\") {\n return;\n }\n\n var v = $.fieldValue(this, successful);\n\n if (v && v.constructor === Array) {\n for (var i = 0, max = v.length; i < max; i++) {\n a.push({ name: n, value: v[i] });\n }\n } else if (v !== null && typeof v !== \"undefined\") {\n a.push({ name: this.name, value: v });\n }\n });\n\n // hand off to jQuery.param for proper encoding\n return $.param(urlencodedFields(a));\n };\n\n /**\n * Returns the value(s) of the element in the matched set. For example, consider the following form:\n *\n *\t
\n *\t\t\n *\t\t\n *\t\t\n *\t\t\n *\t\t\n *\t\t\n *\t
\n *\n *\tvar v = $('input[type=text]').fieldValue();\n *\t// if no values are entered into the text inputs\n *\tv === ['','']\n *\t// if values entered into the text inputs are 'foo' and 'bar'\n *\tv === ['foo','bar']\n *\n *\tvar v = $('input[type=checkbox]').fieldValue();\n *\t// if neither checkbox is checked\n *\tv === undefined\n *\t// if both checkboxes are checked\n *\tv === ['B1', 'B2']\n *\n *\tvar v = $('input[type=radio]').fieldValue();\n *\t// if neither radio is checked\n *\tv === undefined\n *\t// if first radio is checked\n *\tv === ['C1']\n *\n * The successful argument controls whether or not the field element must be 'successful'\n * (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls).\n * The default value of the successful argument is true. If this value is false the value(s)\n * for each element is returned.\n *\n * Note: This method *always* returns an array. If no valid value can be determined the\n *\tarray will be empty, otherwise it will contain one or more values.\n */\n $.fn.fieldValue = function (successful) {\n for (var val = [], i = 0, max = this.length; i < max; i++) {\n var el = this[i];\n var v = $.fieldValue(el, successful);\n\n if (v === null || typeof v === \"undefined\" || (v.constructor === Array && !v.length)) {\n continue;\n }\n\n if (v.constructor === Array) {\n $.merge(val, v);\n } else {\n val.push(v);\n }\n }\n\n return val;\n };\n\n /**\n * Returns the value of the field element.\n */\n $.fieldValue = function (el, successful) {\n var required = typeof successful === \"undefined\" || successful;\n\n if (required && !isSuccessful(el, submitterElement(el.form))) {\n return null;\n }\n\n return valueOf(el);\n };\n\n /**\n * Clears the form data. Takes the following actions on the form's input fields:\n * - input text fields will have their 'value' property set to the empty string\n * - select elements will have their 'selectedIndex' property set to -1\n * - checkbox and radio inputs will have their 'checked' property set to false\n * - inputs of type submit, button, reset, and hidden will *not* be effected\n * - button elements will *not* be effected\n */\n $.fn.clearForm = function (includeHidden) {\n return this.each(function () {\n $(\"input,select,textarea\", this).clearFields(includeHidden);\n });\n };\n\n /**\n * Clears the selected form elements.\n */\n $.fn.clearInputs = function (includeHidden) {\n deprecate(\"clearInputs\", \"clearInputs is deprecated, use clearFields\");\n\n return this.clearFields(includeHidden);\n };\n\n $.fn.clearFields = function (includeHidden) {\n var re =\n /^(?:color|date|datetime|datetime-local|email|month|number|password|range|search|tel|text|time|url|week)$/i; // 'hidden' is not in this list\n\n return this.each(function () {\n var t = this.type,\n tag = tagName(this);\n\n if (re.test(t) || tag === \"textarea\") {\n this.value = \"\";\n } else if (t === \"checkbox\" || t === \"radio\") {\n this.checked = false;\n } else if (tag === \"select\") {\n this.selectedIndex = -1;\n } else if (t === \"file\") {\n if (/MSIE/.test(navigator.userAgent)) {\n $(this).replaceWith($(this).clone(true));\n } else {\n $(this).val(\"\");\n }\n } else if (includeHidden) {\n // includeHidden can be the value true, or it can be a selector string\n // indicating a special test; for example:\n // $('#myForm').clearForm('.special:hidden')\n // the above would clean hidden inputs that have the class of 'special'\n if (\n (includeHidden === true && /hidden/.test(t)) ||\n (typeof includeHidden === \"string\" && $(this).is(includeHidden))\n ) {\n this.value = \"\";\n }\n }\n });\n };\n\n /**\n * Resets the form data or individual elements. Takes the following actions\n * on the selected tags:\n * - all fields within form elements will be reset to their original value\n * - input / textarea / select fields will be reset to their original value\n * - option / optgroup fields (for multi-selects) will defaulted individually\n * - non-multiple options will find the right select to default\n * - label elements will be searched against its 'for' attribute\n * - all others will be searched for appropriate children to default\n */\n $.fn.resetForm = function () {\n return this.each(function () {\n var el = $(this);\n var tag = tagName(this);\n\n switch (tag) {\n case \"input\":\n this.checked = this.defaultChecked;\n\n // as the native reset: types whose value is the value attribute keep it\n if (this.type === \"file\") {\n // a file input cannot take its value attribute; the native reset empties it\n this.value = \"\";\n } else if (!/^(?:checkbox|radio|hidden|submit|reset|button|image)$/.test(this.type)) {\n this.value = this.defaultValue;\n }\n\n return true;\n\n case \"textarea\":\n this.value = this.defaultValue;\n\n return true;\n\n case \"option\":\n case \"optgroup\":\n var select = el.parents(\"select\");\n\n if (select.length && select[0].multiple) {\n if (tag === \"option\") {\n this.selected = this.defaultSelected;\n } else {\n el.find(\"option\").resetForm();\n }\n } else {\n select.resetForm();\n }\n\n return true;\n\n case \"select\":\n // in order, as the native reset: of several default options, a single select keeps the last\n el.find(\"option\").each(function () {\n this.selected = this.defaultSelected;\n });\n\n return true;\n\n case \"label\":\n // The control whose id the for attribute names, and the controls inside the label. The\n // filter keeps a for that names an ancestor from resetting the label again.\n var forEl = this.htmlFor && this.ownerDocument.getElementById(this.htmlFor);\n\n el.find(\"input,select,textarea\").add(forEl).filter(\"input,select,textarea\").resetForm();\n\n return true;\n\n case \"form\":\n // through the prototype: a control named reset shadows the method\n callFormMethod(this, \"reset\");\n\n return true;\n\n default:\n el.find(\"form,input,label,select,textarea\").resetForm();\n\n return true;\n }\n });\n };\n\n /**\n * Enables or disables any matching elements.\n */\n $.fn.enable = function (b) {\n if (typeof b === \"undefined\") {\n b = true;\n }\n\n return this.each(function () {\n this.disabled = !b;\n });\n };\n\n /**\n * Checks/unchecks any matching checkboxes or radio buttons and\n * selects/deselects and matching option elements.\n */\n $.fn.selected = function (select) {\n if (typeof select === \"undefined\") {\n select = true;\n }\n\n return this.each(function () {\n var t = this.type;\n\n if (t === \"checkbox\" || t === \"radio\") {\n this.checked = select;\n } else if (tagName(this) === \"option\") {\n var $sel = $(this).parent(\"select\");\n\n if (select && $sel[0] && $sel[0].type === \"select-one\") {\n // deselect all other options\n $sel.find(\"option\").selected(false);\n }\n\n this.selected = select;\n }\n });\n };\n\n // expose debug var\n $.fn.ajaxSubmit.debug = false;\n})(jQuery);\n\nexport default jQuery;\n"],"names":["owners","plainForm","document","createElement","findDescriptor","name","i","length","owner","window","descriptor","Object","getOwnPropertyDescriptor","prototype","formMember","form","get","call","e","callFormMethod","value","apply","Array","slice","arguments","tagName","el","toLowerCase","isElement","node","assertRealParent","parentNode","Error","closestByTag","names","indexOf","storeKey","setExpando","ignore","expando","els","namedItem","undefined","record","x","y","jQuery","data","type","setTimeout","captureSubmitter","target","point","offsetX","offsetY","fn","offset","pageX","left","pageY","top","offsetLeft","offsetTop","imagePoint","submitterOf","stored","log","ajaxSubmit","debug","msg","join","console","opera","postError","warned","deprecate","id","message","warn","deprecateOldJQuery","version","parts","String","split","major","Number","beforeJQuery35","shorthandOptions","options","dataType","onSuccess","result","url","success","submitOptions","key","hasOwnProperty","withoutUrl","keepContext","settings","sources","context","submitWith","isDefaultPrevented","preventDefault","originalEvent","submitter","captureEventSubmitter","doAjaxSubmit","captureSubmittingElement","this","bindDelegated","$sel","selector","off","on","closestMatch","Element","closest","is","delegated","unbindSelector","handlers","submit","click","selectionOnly","ajaxForm","jquery","delegation","bindSelector","beforeFormUnbind","ajaxFormUnbind","o","s","c","isReady","bindLater","formAttribute","attr","rLineBreak","rCR","rUnsubmittable","isDisabled","matches","disabled","valueOf","index","selectedIndex","a","ops","one","max","op","selected","v","attributes","specified","text","push","selectValue","val","raw","replace","loneSurrogate","wellFormed","match","before","urlencodedFields","fields","map","field","createSuccessfulControls","feature","$","controlsOf","semantic","formId","getElementsByTagName","makeArray","grep","ownedBy","test","navigator","userAgent","concat","filter","getAttribute","inArray","outsideControls","fieldsOf","n","fieldValue","constructor","fileapi","files","file","required","imageFields","sub","input","addCandidate","collected","own","controls","collect","filtering","addClickedImage","deepSerialize","extraData","traditional","part","param","serialized","len","decodeURIComponent","sendFormData","submission","formdata","FormData","append","serializedData","extend","ajaxSettings","contentType","processData","cache","method","uploadProgress","createXhr","xhr","upload","addEventListener","event","percent","position","loaded","total","lengthComputable","Math","ceil","beforeSend","formData","ajax","sendAjax","uploadAttributes","hasOwn","isGet","addSubmitterFields","submitterFields","addCsrfField","forms","origin","csrf_token","csrf_param","posts","property","href","location","protocol","host","setFormAttribute","getDoc","frame","doc","contentWindow","err","contentDocument","readStatus","status","statusText","readResponse","retry","errMsg","isXml","XMLDocument","isXMLDoc","body","innerHTML","docRoot","documentElement","responseText","responseXML","getResponseHeader","header","readDocument","dt","scr","textarea","ta","pre","b","textContent","innerText","readEmbedded","ct","xml","nodeName","error","dataFilter","JSON","parse","globalEval","httpData","createLifecycle","g","timeoutHandle","callbackProcessed","deferred","Deferred","aborted","getAllResponseHeaders","setRequestHeader","abort","done","rejection","textStatus","stop","reject","trigger","complete","endGlobalEvents","active","clearTimeout","release","settle","failure","resolve","succeed","start","global","fail","startTimer","onTimeout","timeout","stopTimer","createIframeTransport","hasProp","frameCount","fileUploadIframe","ownerDocument","$body","$io","iframeTarget","each","nameWindow","io","setAttribute","iframeSrc","css","createFrame","Date","getTime","life","execCommand","remove","frameHooks","domCheckCount","checkState","state","readyState","cb","doSubmit","saved","saveAttributes","mp","skipEncodingOverride","setUploadAttributes","extraInputs","added","addHiddenInput","appendTo","isPlainObject","single","f","addExtraInputs","root","contains","notInDocument","attachEvent","listen","submitForm","restoreAttributes","detachEvent","removeEventListener","unlisten","post","forceSync","jqxhr","elements","prop","removeAttr","enableControls","closeKeepAlive","createSubmission","serialization","refuse","extraQuery","optionsData","requestFormat","query","pairs","at","decodeQuery","queryPairs","defineKey","object","defineProperty","enumerable","writable","configurable","callbackList","callback","isArray","callEach","callbacks","args","prepare","$set","action","trim","URL","withDefaults","defaultType","veto","beforeSerialize","qx","beforeSubmit","resolved","resolveMethod","extra","stringify","jsonBody","q","toUpperCase","hashAt","base","encode","$form","deliver","resetForm","clearForm","includeHidden","successes","jqXHR","successArguments","replaceTarget","$target","merge","errors","completes","chooseTransport","hasFileInputs","add","multipart","attribute","fileAPI","shouldUseFrame","transport","iframe","steps","transports","attr2","removeData","k","formToArray","formSerialize","fieldSerialize","successful","t","checked","isSuccessful","clearFields","clearInputs","re","tag","replaceWith","clone","defaultChecked","defaultValue","select","parents","multiple","defaultSelected","find","forEl","htmlFor","getElementById","enable","parent"],"mappings":";;;;;;;;;;;;;;;;;;;;;4ZAMIA,EAAS,CAAC,kBAAmB,cAAe,UAAW,QAGvDC,EAAYC,EAASC,cAAc,QAEvC,SAASC,EAAeC,GACtB,IAAK,IAAIC,EAAI,EAAGA,EAAIN,EAAOO,OAAQD,IAAK,CACtC,IAAIE,EAAQC,EAAOT,EAAOM,IACtBI,EAA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O,KAAK,WACf,IAAI6H,EAAItW,KAAK9D,KAEb,GAAU,aAANoa,GAA0B,UAANA,EACtBtW,KAAKuW,QAAUU,OACV,GAAsB,WAAlBtc,EAAQqF,MAAoB,CACrC,IAAIE,EAAO6D,EAAE/D,MAAM0X,OAAO,UAEtBT,GAAU/W,EAAK,IAAuB,eAAjBA,EAAK,GAAGhE,MAE/BgE,EAAKmX,KAAK,UAAU1U,UAAS,GAG/B3C,KAAK2C,SAAWsU,CAClB,CACF,EACF,EAGAlT,EAAEtH,GAAGY,WAAWC,OAAQ,CACzB,CAlcD,CAkcGtB"} \ No newline at end of file diff --git a/docs/research/4x-behavior-changes.md b/docs/research/4x-behavior-changes.md index 63d7abd..4eb3ee8 100644 --- a/docs/research/4x-behavior-changes.md +++ b/docs/research/4x-behavior-changes.md @@ -117,6 +117,7 @@ Collected as the modernization proceeds. Each entry is a change a consumer could - **A lone surrogate is sent as U+FFFD.** `formSerialize`, `fieldSerialize`, a urlencoded `ajaxSubmit` body and the clicked button of an iframe upload threw `URIError` when a name or value held an unpaired UTF-16 surrogate. Each one is now replaced with U+FFFD, as a native form submission and `FormData` do. - **Bundlers get the module build; CDNs keep the minified one.** The `browser` field in `package.json` pointed at `dist/jquery.form.min.js`, and bundlers that read it first (webpack, Vite, Browserify) bundled the minified classic build. It is removed: webpack and Vite now use `module` (`dist/jquery.form.mjs`) and Browserify uses `main` (`dist/jquery.form.js`). New `jsdelivr` and `unpkg` fields keep a bare CDN URL serving `dist/jquery.form.min.js`. - **The package includes `LICENSE-MIT`.** The package is dual-licensed (LGPL-2.1+ or MIT), but only `LICENSE` was published. +- **The CommonJS factory uses the window it is given.** `require("jquery-form")(root, $)` read the global `window` and `document`, so it threw in Node unless a DOM was global (as in jest-environment-jsdom). The classic build now takes `window`, `document`, `navigator`, `Element` and `FormData` from `root`, falling back to the global window. jQuery 4 itself still needs a global window when required without one. ## Known behavior, not changed diff --git a/rollup.config.mjs b/rollup.config.mjs index 63c8e1d..23c56aa 100644 --- a/rollup.config.mjs +++ b/rollup.config.mjs @@ -6,7 +6,9 @@ import terser from "@rollup/plugin-terser"; const umdHeader = `(function (factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. - define(['jquery'], factory); + define(['jquery'], function (jQuery) { + factory(jQuery, window); + }); } else if (typeof module === 'object' && module.exports) { // Node/CommonJS module.exports = function( root, jQuery ) { @@ -20,17 +22,24 @@ const umdHeader = `(function (factory) { jQuery = require('jquery')(root); } } - factory(jQuery); + factory(jQuery, root || (typeof window !== 'undefined' ? window : undefined)); return jQuery; }; } else { // Browser globals - factory(jQuery); + factory(jQuery, window); } -}(function (jQuery) { +}(function (jQuery, root) { `; +// The plugin reads these as globals. In the classic build they come from the window the wrapper +// passes, so a CommonJS factory called with a root works where that root is not the global window. +const rootGlobals = + "\tvar window = root;\n" + + "\tvar document = window.document, navigator = window.navigator;\n" + + "\tvar Element = window.Element, FormData = window.FormData;\n"; + const moduleLines = /^import jQuery from ['"]jquery['"];\nexport \{ default \} from ['"]jquery['"];\n\n/; const preamble = /^\/\*![\s\S]*?\*\/\n\n?/m; @@ -68,7 +77,7 @@ const classicLayout = { const { chunk, header } = splitPreamble(this, code); // Rollup drops directives because modules are strict; a classic script is not, so the whole // factory body is made strict, including module code hoisted above the plugin body. - chunk.prepend(header + umdHeader + "\t'use strict';\n").append("\n}));\n"); + chunk.prepend(header + umdHeader + "\t'use strict';\n" + rootGlobals).append("\n}));\n"); return { code: chunk.toString(), map: chunk.generateMap({ hires: true }) }; }, }; diff --git a/test/e2e/published-node.test.mjs b/test/e2e/published-node.test.mjs index 0418921..d387806 100644 --- a/test/e2e/published-node.test.mjs +++ b/test/e2e/published-node.test.mjs @@ -138,8 +138,6 @@ describe("when the packed package is installed", () => { const GLOBALS = `globalThis.window = dom.window; globalThis.document = dom.window.document;`; // Runs the jQuery build under test inside the jsdom window. const EVAL_JQUERY = `dom.window.eval(require("node:fs").readFileSync(${JSON.stringify(jqueryFile)}, "utf8"));`; -// What the plugin throws when it reads a global the root it was given does not replace. -const MISSING_GLOBAL = /^(window|document) is not defined$/; // Reports what a case threw instead of its smoke result. const settle = (code) => `try { ${code} } catch (error) { report({ thrown: error.message }); }`; @@ -173,7 +171,7 @@ describe("when the packed package is required from CommonJS", () => { assert.deepEqual(result, expected(jqueryVersion, "jQuery")); }); - it(`should fail on the jQuery ${jqueryVersion} it is given when no window is global`, async () => { + it(`should work on the jQuery ${jqueryVersion} and window it is given when no window is global`, async () => { // Arrange const code = `${EVAL_JQUERY} const $ = dom.window.jQuery; @@ -182,9 +180,8 @@ describe("when the packed package is required from CommonJS", () => { // Act const result = await run(fixture, settle(`${code} report(await smoke($, value));`)); - // Assert: known failure, the plugin reads the global window or document (which one depends - // on the version) instead of the root it is given. - assert.match(result.thrown, MISSING_GLOBAL); + // Assert + assert.deepEqual(result, expected(jqueryVersion, "jQuery")); }); for (const version of FIXTURE_VERSIONS) { @@ -202,7 +199,7 @@ describe("when the packed package is required from CommonJS", () => { assert.deepEqual(result, expected(version, "jQuery")); }); - it(`should fail to build the installed jQuery ${version} on a window that is not global`, async () => { + it(`should build the installed jQuery ${version} on a window that is not global, where jQuery allows it`, async () => { // Arrange const code = `const $ = require("jquery-form")(dom.window);`; @@ -212,13 +209,13 @@ describe("when the packed package is required from CommonJS", () => { settle(`${code} report(await smoke($, $));`) ); - // Assert: known failures. jQuery 3 builds on the root, then the plugin reads the global - // document; jQuery 4 throws when required without a global window instead of returning a - // factory, so require('jquery')(root) never runs. - assert.match( - result.thrown, - version === "3.7.1" ? MISSING_GLOBAL : /^jQuery requires a window with a document$/ - ); + // Assert: jQuery 4 throws when required without a global window instead of returning a + // factory, so require('jquery')(root) never runs (a jQuery limit, not the plugin's). + if (version === "3.7.1") { + assert.deepEqual(result, expected(version, "jQuery")); + } else { + assert.match(result.thrown, /^jQuery requires a window with a document$/); + } }); } }); From b05a521ac54881b15ae660121dd8c81800c18586 Mon Sep 17 00:00:00 2001 From: Kevin Morris Date: Sun, 1 Nov 2026 22:48:07 -0500 Subject: [PATCH 24/78] fix: encode spaces as + on every jQuery version, as a native submission does --- dist/jquery.form.js | 12 +++++++++--- dist/jquery.form.min.js | 2 +- dist/jquery.form.min.js.map | 2 +- dist/jquery.form.mjs | 12 +++++++++--- docs/research/4x-behavior-changes.md | 1 + src/jquery.form.js | 6 +++--- src/submission.js | 4 ++-- src/successful-controls.js | 6 ++++++ test/e2e/published-node.test.mjs | 3 +-- test/suite/serialization.test.js | 10 +++------- test/suite/submission.test.js | 14 ++++++++++++-- test/suite/xhr-transport.test.js | 4 ++-- 12 files changed, 50 insertions(+), 26 deletions(-) diff --git a/dist/jquery.form.js b/dist/jquery.form.js index 39950b4..e9b76c0 100644 --- a/dist/jquery.form.js +++ b/dist/jquery.form.js @@ -712,6 +712,12 @@ function wellFormed(value) { : value; } +// jQuery 3 dropped $.param's "+" for a space; a native submission still sends "+". Only a space +// encodes as %20, since a literal % encodes as %25. +function urlencode(fields, traditional) { + return jQuery.param(urlencodedFields(fields), traditional).replace(/%20/g, "+"); +} + function urlencodedFields(fields) { return jQuery.map(fields, function (field) { var value = @@ -2072,7 +2078,7 @@ function createSubmission(feature, forms, serialization) { if (options.requestFormat === "json") { jsonBody(options, fields); } else { - encode(options, $.param(urlencodedFields(fields), traditional), qx); + encode(options, urlencode(fields, traditional), qx); } return { @@ -2383,7 +2389,7 @@ function createSubmission(feature, forms, serialization) { */ $.fn.formSerialize = function (semantic) { // hand off to jQuery.param for proper encoding - return $.param(urlencodedFields(this.formToArray(semantic))); + return urlencode(this.formToArray(semantic)); }; /** @@ -2413,7 +2419,7 @@ function createSubmission(feature, forms, serialization) { }); // hand off to jQuery.param for proper encoding - return $.param(urlencodedFields(a)); + return urlencode(a); }; /** diff --git a/dist/jquery.form.min.js b/dist/jquery.form.min.js index f00bb87..1eb322f 100644 --- a/dist/jquery.form.min.js +++ b/dist/jquery.form.min.js @@ -19,5 +19,5 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. */ -!function(e){"function"==typeof define&&define.amd?define(["jquery"],function(t){e(t,window)}):"object"==typeof module&&module.exports?module.exports=function(t,r){return void 0===r&&(r="undefined"!=typeof window?require("jquery"):require("jquery")(t)),e(r,t||("undefined"!=typeof window?window:void 0)),r}:e(jQuery,window)}(function(e,t){"use strict";var r=t,n=r.document,a=r.navigator,o=r.Element,i=r.FormData,u=["HTMLFormElement","HTMLElement","Element","Node"],s=n.createElement("form");function c(e){for(var t=0;t=0)return r;return null}var h="jqFormSubmitter";function g(e,t,r){try{e[t]=r}catch(e){}}function y(e,t){var r=e[t],n=l(e,"elements");return n&&r&&n.namedItem(t)===r?void 0:r}function b(t,r,n,a){e.data(t,h,{el:r,x:n,y:a}),g(t,"clk",r),"image"===r.type&&(g(t,"clk_x",n),g(t,"clk_y",a)),setTimeout(function(){e.data(t,h,null),g(t,"clk",null),g(t,"clk_x",null),g(t,"clk_y",null)},100)}function x(t){var r=v(t.target,["button","input"]);if(r&&("submit"===r.type||"image"===r.type)){var n=r.form;if(n){var a="image"===r.type?function(t,r){if(void 0!==t.offsetX)return[t.offsetX,t.offsetY];if("function"==typeof e.fn.offset){var n=e(r).offset();return[t.pageX-n.left,t.pageY-n.top]}return[t.pageX-r.offsetLeft,t.pageY-r.offsetTop]}(t,r):[];b(n,r,a[0],a[1])}}}function j(t){if(!t)return null;var r=e.data(t,h);if(r)return r;var n=y(t,"clk");return n?{el:n,x:y(t,"clk_x"),y:y(t,"clk_y")}:null}function T(){if(e.fn.ajaxSubmit.debug){var t="[jquery.form] "+Array.prototype.join.call(arguments,"");r.console&&r.console.log?r.console.log(t):r.opera&&r.opera.postError&&r.opera.postError(t)}}var w={};function S(t,n){e.fn.ajaxSubmit.debug&&!w[t]&&(w[t]=!0,r.console&&"function"==typeof r.console.warn&&r.console.warn("[jquery.form] "+n+" (removed in 5.0)"))}function F(e){(function(e){var t=String(e).split("."),r=Number(t[0]);return r<3||3===r&&Number(t[1])<5})(e)&&S("jquery","support for jQuery "+e+" is deprecated, 5.0 needs jQuery 3.5 or later")}function E(e,t,r,n){if("string"!=typeof e&&!1!==e)return e;var a={url:e,data:t,dataType:r};return"function"==typeof n&&(a.success=n),a}function D(e,t,r,n){return"function"==typeof e?{success:e}:void 0===(e=E(e,t,r,n))?{}:!1===e.url||""===e.url?function(e){var t={};for(var r in e)"url"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}(e):e}function k(e,t){for(var r=0;r"'),e(function(){e(n.s,n.c).ajaxForm(r)}),t):(T("terminating; zero elements found by selector"+(e.isReady?"":" (DOM not ready)")),t)}(this,t))}function P(t){return"string"==typeof t?(N(t),this):(t!==I&&(C={},e(n).off("submit.form-plugin click.form-plugin")),this.off("submit.form-plugin click.form-plugin"))}function X(t,r){if(!p(t))return e(t).attr(r);var n=f(t,"getAttribute",r);return null===n?void 0:n}var R=/\r\n|\r|\n/g,H=/\r/g,U=/^(?:fieldset|object|output)$/;function z(e){return"function"==typeof e.matches?e.matches(":disabled"):!!e.disabled}function W(t){if("select"===d(t))return function(e){var t=e.selectedIndex;if(t<0)return null;for(var r=[],n=e.options,a="select-one"===e.type,o=a?t+1:n.length,i=a?t:0;i=0,o=a?e.responseXML:e.responseText;return a&&"parsererror"===o.documentElement.nodeName&&ie.error&&ie.error("parsererror"),r&&r.dataFilter&&(o=r.dataFilter(o,t)),"string"==typeof o&&(("json"===t||!t)&&n.indexOf("json")>=0?o=JSON.parse(o):"script"===t&&ie.globalEval(o)),o}(t,c,n)}catch(e){u="parsererror",t.error=i=e||u}}catch(e){T("error caught: ",e),u="error",t.error=i=e}return{status:u,data:o,errMsg:i}}var le=e;function fe(e,t){var r,n,a,o=le.Deferred(),i={aborted:0,responseText:null,responseXML:null,status:0,statusText:"n/a",getAllResponseHeaders:function(){},getResponseHeader:function(){},setRequestHeader:function(){},abort:function(e){s(e,[i,"aborted",e])}};function u(){return i.aborted||a}function s(n,a,s){var c=s||("timeout"===n?"timeout":"aborted");u()||(T("aborting upload... "+c),i.aborted=1,t.stop(),i.error=c,e.error&&e.error.call(e.context,i,c,n),o.reject.apply(o,a),r&&le.event.trigger("ajaxError",[i,e,c]),l(c))}function c(){r&&le.event.trigger("ajaxComplete",[i,e]),r&&! --le.active&&le.event.trigger("ajaxStop")}function l(r){e.complete&&e.complete.call(e.context,i,r),c(),clearTimeout(n),setTimeout(function(){t.release(),i.responseXML=null},100)}function f(t){var n=t.status,u=t.errMsg;if(i.aborted)T("upload aborted");else if(i.status&&!(i.status>=200&&i.status<300||304===i.status)&&(n="error"),a=!0,"success"!==n)void 0===u&&(u=i.statusText),e.error&&e.error.call(e.context,i,n,u),o.reject(i,"error",u),r&&le.event.trigger("ajaxError",[i,e,u]),l(n);else{var s=function(t){var n;try{e.success.call(e.context,t,"success",i)}catch(e){n={error:e}}return o.resolve(i.responseText,"success",i),r&&le.event.trigger("ajaxSuccess",[i,e,t]),n}(t.data);if(l(n),s)throw s.error}}return o.abort=function(e){i.abort(e)},{xhr:i,deferred:o,start:function(){return(r=e.global)&&0===le.active++&&le.event.trigger("ajaxStart"),e.beforeSend&&!1===e.beforeSend.call(e.context,i,e)?(u()||(a=!0,o.reject(),r&&le.event.trigger("ajaxError",[i,e,"canceled"]),c()),!1):!i.aborted&&(r&&le.event.trigger("ajaxSend",[i,e]),!i.aborted)},done:u,abort:s,settle:f,fail:function(e){f({status:"error",errMsg:e})},startTimer:function(t){e.timeout&&(n=setTimeout(t,e.timeout))},stopTimer:function(){clearTimeout(n),n=void 0}}}var de=e;function pe(e,t){var r=0;function n(e){var n=e.form,a=e.method,o=k(de.extend(!0,{},de.ajaxSettings,e.options),[de.ajaxSettings,e.options]);o.context=o.context||o;var i=l(n,"ownerDocument"),u=de(v(n,["body"])),s=function(e,t,r){var n,a;if(e.iframeTarget)(a=(n=de(e.iframeTarget,r)).attr("name"))?t=a:(n.attr("name",t),n.each(function(){!function(e,t){try{e.contentWindow&&(e.contentWindow.name=t)}catch(e){}}(this,t)}));else{var o=r.createElement("iframe");o.setAttribute("name",t),o.setAttribute("src",e.iframeSrc),(n=de(o)).css({position:"absolute",top:"-1000px",left:"-1000px"})}return{$io:n,id:t}}(o,"jqFormIO"+(new Date).getTime()+r++,i),c=s.$io,d=c[0],p=fe(o,function(e,t){return{stop:function(){try{t[0].contentWindow.document.execCommand&&t[0].contentWindow.document.execCommand("Stop")}catch(e){}t.attr("src",e.iframeSrc)},release:function(){e.iframeTarget?t.attr("src",e.iframeSrc):t.remove()}}}(o,c)),m=50;if(!p.start())return p.deferred;function h(){try{var e=ue(d).readyState;T("state = "+e),e&&"uninitialized"===e.toLowerCase()&&setTimeout(h,50)}catch(e){T("Server abort: ",e," (",e.name,")"),b(2),p.stopTimer()}}function g(){var r=function(e){var t={};return Z.each(ee,function(r,n){t[n]=f(e,"hasAttribute",n)?f(e,"getAttribute",n):null}),t}(n);!function(e,t,r,n,a){var o="multipart/form-data";oe(e,"target",t),!r||/post/i.test(r)?oe(e,"method","POST"):re(r)&&!re(a.property(e,"method"))&&oe(e,"method","GET"),oe(e,"action",n.url),n.skipEncodingOverride||r&&!/post/i.test(r)||(oe(e,"encoding",o),oe(e,"enctype",o))}(n,s.id,a,o,t),p.startTimer(function(){b(1)});var l=[];try{!function(e,t,r,n,a){function o(r,n){var o=t.createElement("input");o.type="hidden",o.name=r,a.push(Z(o).val(n).appendTo(e)[0])}if(r)for(var i in r)if(te.call(r,i))if(Z.isPlainObject(r[i])&&te.call(r[i],"name")&&te.call(r[i],"value"))o(r[i].name,r[i].value);else{var u={};u[i]=r[i];for(var s=Y(u,n),c=0;c=0?"&":"?")+t+e.url.slice(a.length),e.data=null}else e.data=t}(t,u.param(V(y),h),x),{form:f,$form:e,fields:y,controls:b,options:t,method:d,traditional:h}))},deliver:function(e){var t=e.$form,r=e.options,n=[];if(r.resetForm&&n.push(function(){t.resetForm()}),r.clearForm&&n.push(function(){t.clearForm(r.includeHidden)}),!r.dataType&&r.target){var a=d(r.success);n.push(function(e,t,n){var o=arguments,i=r.replaceTarget?"replaceWith":"html",s=u(r.target);"string"==typeof e?s[i](e):T("target: the response was parsed by jQuery, so it is not inserted"),s.length||p(a,this,o),s.each(function(){p(a,this,o)})})}else u.merge(n,d(r.success));if(r.success=function(e,a,o){for(var i=r.context||this,u=0,s=n.length;u0,i=/^[\t\n\f\r ]*multipart\/form-data[\t\n\f\r ]*$/i,s=i.test(o.attribute(r[0],"enctype"))||i.test(o.attribute(r[0],"encoding")),c=t.fileapi&&t.formdata;T("fileAPI :"+c);var l=(a||s)&&!c,f=(a||s)&&c?"formdata":"ajax";if(!1!==n.iframe&&(n.iframe||l)&&(f="iframe"),"iframe"!==f||n.iframe||S("iframe","choosing the iframe transport automatically without FormData is deprecated, set iframe: true"),"ajax"!==f&&"json"===n.requestFormat)throw new Error('jquery.form: requestFormat "json" cannot send files or use the iframe transport');return f}}}!function(e){var t={};t.fileapi=void 0!==e('').get(0).files,t.formdata=void 0!==r.FormData;var n=!!e.fn.prop;var o={attribute:X,property:function(e,t){var r=n?e[t]:void 0;return"string"==typeof r?r:X(e,t)}},i=_(t),u=me(t,o,i),s={iframe:pe(n,o),formdata:G,ajax:J};e.fn.attr2=function(){if(S("attr2","attr2 is deprecated, use .prop() or .attr()"),!n)return this.attr.apply(this,arguments);var e=this.prop.apply(this,arguments);return e&&e.jquery||"string"==typeof e?e:this.attr.apply(this,arguments)},e.fn.ajaxSubmit=function(t,r,n,a){if(F(e.fn.jquery),!this.length)return T("ajaxSubmit: skipping submit process - no element selected"),this;if(!e.ajax)throw new Error("jquery.form: ajaxSubmit needs the full jQuery build; this jQuery has no $.ajax");var o=u.prepare(this,D(t,r,n,a));if(!o)return this;u.deliver(o);var i=s[u.chooseTransport(o)](o);this.removeData("jqxhr").data("jqxhr",i);for(var c=0;c=0)return r;return null}var h="jqFormSubmitter";function g(e,t,r){try{e[t]=r}catch(e){}}function y(e,t){var r=e[t],n=l(e,"elements");return n&&r&&n.namedItem(t)===r?void 0:r}function b(t,r,n,a){e.data(t,h,{el:r,x:n,y:a}),g(t,"clk",r),"image"===r.type&&(g(t,"clk_x",n),g(t,"clk_y",a)),setTimeout(function(){e.data(t,h,null),g(t,"clk",null),g(t,"clk_x",null),g(t,"clk_y",null)},100)}function x(t){var r=v(t.target,["button","input"]);if(r&&("submit"===r.type||"image"===r.type)){var n=r.form;if(n){var a="image"===r.type?function(t,r){if(void 0!==t.offsetX)return[t.offsetX,t.offsetY];if("function"==typeof e.fn.offset){var n=e(r).offset();return[t.pageX-n.left,t.pageY-n.top]}return[t.pageX-r.offsetLeft,t.pageY-r.offsetTop]}(t,r):[];b(n,r,a[0],a[1])}}}function j(t){if(!t)return null;var r=e.data(t,h);if(r)return r;var n=y(t,"clk");return n?{el:n,x:y(t,"clk_x"),y:y(t,"clk_y")}:null}function T(){if(e.fn.ajaxSubmit.debug){var t="[jquery.form] "+Array.prototype.join.call(arguments,"");r.console&&r.console.log?r.console.log(t):r.opera&&r.opera.postError&&r.opera.postError(t)}}var w={};function S(t,n){e.fn.ajaxSubmit.debug&&!w[t]&&(w[t]=!0,r.console&&"function"==typeof r.console.warn&&r.console.warn("[jquery.form] "+n+" (removed in 5.0)"))}function F(e){(function(e){var t=String(e).split("."),r=Number(t[0]);return r<3||3===r&&Number(t[1])<5})(e)&&S("jquery","support for jQuery "+e+" is deprecated, 5.0 needs jQuery 3.5 or later")}function E(e,t,r,n){if("string"!=typeof e&&!1!==e)return e;var a={url:e,data:t,dataType:r};return"function"==typeof n&&(a.success=n),a}function D(e,t,r,n){return"function"==typeof e?{success:e}:void 0===(e=E(e,t,r,n))?{}:!1===e.url||""===e.url?function(e){var t={};for(var r in e)"url"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}(e):e}function k(e,t){for(var r=0;r"'),e(function(){e(n.s,n.c).ajaxForm(r)}),t):(T("terminating; zero elements found by selector"+(e.isReady?"":" (DOM not ready)")),t)}(this,t))}function P(t){return"string"==typeof t?(N(t),this):(t!==I&&(C={},e(n).off("submit.form-plugin click.form-plugin")),this.off("submit.form-plugin click.form-plugin"))}function X(t,r){if(!p(t))return e(t).attr(r);var n=f(t,"getAttribute",r);return null===n?void 0:n}var R=/\r\n|\r|\n/g,H=/\r/g,U=/^(?:fieldset|object|output)$/;function z(e){return"function"==typeof e.matches?e.matches(":disabled"):!!e.disabled}function W(t){if("select"===d(t))return function(e){var t=e.selectedIndex;if(t<0)return null;for(var r=[],n=e.options,a="select-one"===e.type,o=a?t+1:n.length,i=a?t:0;i=0,o=a?e.responseXML:e.responseText;return a&&"parsererror"===o.documentElement.nodeName&&ie.error&&ie.error("parsererror"),r&&r.dataFilter&&(o=r.dataFilter(o,t)),"string"==typeof o&&(("json"===t||!t)&&n.indexOf("json")>=0?o=JSON.parse(o):"script"===t&&ie.globalEval(o)),o}(t,c,n)}catch(e){u="parsererror",t.error=i=e||u}}catch(e){T("error caught: ",e),u="error",t.error=i=e}return{status:u,data:o,errMsg:i}}var le=e;function fe(e,t){var r,n,a,o=le.Deferred(),i={aborted:0,responseText:null,responseXML:null,status:0,statusText:"n/a",getAllResponseHeaders:function(){},getResponseHeader:function(){},setRequestHeader:function(){},abort:function(e){s(e,[i,"aborted",e])}};function u(){return i.aborted||a}function s(n,a,s){var c=s||("timeout"===n?"timeout":"aborted");u()||(T("aborting upload... "+c),i.aborted=1,t.stop(),i.error=c,e.error&&e.error.call(e.context,i,c,n),o.reject.apply(o,a),r&&le.event.trigger("ajaxError",[i,e,c]),l(c))}function c(){r&&le.event.trigger("ajaxComplete",[i,e]),r&&! --le.active&&le.event.trigger("ajaxStop")}function l(r){e.complete&&e.complete.call(e.context,i,r),c(),clearTimeout(n),setTimeout(function(){t.release(),i.responseXML=null},100)}function f(t){var n=t.status,u=t.errMsg;if(i.aborted)T("upload aborted");else if(i.status&&!(i.status>=200&&i.status<300||304===i.status)&&(n="error"),a=!0,"success"!==n)void 0===u&&(u=i.statusText),e.error&&e.error.call(e.context,i,n,u),o.reject(i,"error",u),r&&le.event.trigger("ajaxError",[i,e,u]),l(n);else{var s=function(t){var n;try{e.success.call(e.context,t,"success",i)}catch(e){n={error:e}}return o.resolve(i.responseText,"success",i),r&&le.event.trigger("ajaxSuccess",[i,e,t]),n}(t.data);if(l(n),s)throw s.error}}return o.abort=function(e){i.abort(e)},{xhr:i,deferred:o,start:function(){return(r=e.global)&&0===le.active++&&le.event.trigger("ajaxStart"),e.beforeSend&&!1===e.beforeSend.call(e.context,i,e)?(u()||(a=!0,o.reject(),r&&le.event.trigger("ajaxError",[i,e,"canceled"]),c()),!1):!i.aborted&&(r&&le.event.trigger("ajaxSend",[i,e]),!i.aborted)},done:u,abort:s,settle:f,fail:function(e){f({status:"error",errMsg:e})},startTimer:function(t){e.timeout&&(n=setTimeout(t,e.timeout))},stopTimer:function(){clearTimeout(n),n=void 0}}}var de=e;function pe(e,t){var r=0;function n(e){var n=e.form,a=e.method,o=k(de.extend(!0,{},de.ajaxSettings,e.options),[de.ajaxSettings,e.options]);o.context=o.context||o;var i=l(n,"ownerDocument"),u=de(v(n,["body"])),s=function(e,t,r){var n,a;if(e.iframeTarget)(a=(n=de(e.iframeTarget,r)).attr("name"))?t=a:(n.attr("name",t),n.each(function(){!function(e,t){try{e.contentWindow&&(e.contentWindow.name=t)}catch(e){}}(this,t)}));else{var o=r.createElement("iframe");o.setAttribute("name",t),o.setAttribute("src",e.iframeSrc),(n=de(o)).css({position:"absolute",top:"-1000px",left:"-1000px"})}return{$io:n,id:t}}(o,"jqFormIO"+(new Date).getTime()+r++,i),c=s.$io,d=c[0],p=fe(o,function(e,t){return{stop:function(){try{t[0].contentWindow.document.execCommand&&t[0].contentWindow.document.execCommand("Stop")}catch(e){}t.attr("src",e.iframeSrc)},release:function(){e.iframeTarget?t.attr("src",e.iframeSrc):t.remove()}}}(o,c)),m=50;if(!p.start())return p.deferred;function h(){try{var e=ue(d).readyState;T("state = "+e),e&&"uninitialized"===e.toLowerCase()&&setTimeout(h,50)}catch(e){T("Server abort: ",e," (",e.name,")"),b(2),p.stopTimer()}}function g(){var r=function(e){var t={};return Z.each(ee,function(r,n){t[n]=f(e,"hasAttribute",n)?f(e,"getAttribute",n):null}),t}(n);!function(e,t,r,n,a){var o="multipart/form-data";oe(e,"target",t),!r||/post/i.test(r)?oe(e,"method","POST"):re(r)&&!re(a.property(e,"method"))&&oe(e,"method","GET"),oe(e,"action",n.url),n.skipEncodingOverride||r&&!/post/i.test(r)||(oe(e,"encoding",o),oe(e,"enctype",o))}(n,s.id,a,o,t),p.startTimer(function(){b(1)});var l=[];try{!function(e,t,r,n,a){function o(r,n){var o=t.createElement("input");o.type="hidden",o.name=r,a.push(Z(o).val(n).appendTo(e)[0])}if(r)for(var i in r)if(te.call(r,i))if(Z.isPlainObject(r[i])&&te.call(r[i],"name")&&te.call(r[i],"value"))o(r[i].name,r[i].value);else{var u={};u[i]=r[i];for(var s=Y(u,n),c=0;c=0?"&":"?")+t+e.url.slice(a.length),e.data=null}else e.data=t}(t,V(y,h),x),{form:f,$form:e,fields:y,controls:b,options:t,method:d,traditional:h}))},deliver:function(e){var t=e.$form,r=e.options,n=[];if(r.resetForm&&n.push(function(){t.resetForm()}),r.clearForm&&n.push(function(){t.clearForm(r.includeHidden)}),!r.dataType&&r.target){var a=d(r.success);n.push(function(e,t,n){var o=arguments,i=r.replaceTarget?"replaceWith":"html",s=u(r.target);"string"==typeof e?s[i](e):T("target: the response was parsed by jQuery, so it is not inserted"),s.length||p(a,this,o),s.each(function(){p(a,this,o)})})}else u.merge(n,d(r.success));if(r.success=function(e,a,o){for(var i=r.context||this,u=0,s=n.length;u0,i=/^[\t\n\f\r ]*multipart\/form-data[\t\n\f\r ]*$/i,s=i.test(o.attribute(r[0],"enctype"))||i.test(o.attribute(r[0],"encoding")),c=t.fileapi&&t.formdata;T("fileAPI :"+c);var l=(a||s)&&!c,f=(a||s)&&c?"formdata":"ajax";if(!1!==n.iframe&&(n.iframe||l)&&(f="iframe"),"iframe"!==f||n.iframe||S("iframe","choosing the iframe transport automatically without FormData is deprecated, set iframe: true"),"ajax"!==f&&"json"===n.requestFormat)throw new Error('jquery.form: requestFormat "json" cannot send files or use the iframe transport');return f}}}!function(e){var t={};t.fileapi=void 0!==e('').get(0).files,t.formdata=void 0!==r.FormData;var n=!!e.fn.prop;var o={attribute:X,property:function(e,t){var r=n?e[t]:void 0;return"string"==typeof r?r:X(e,t)}},i=_(t),u=me(t,o,i),s={iframe:pe(n,o),formdata:G,ajax:J};e.fn.attr2=function(){if(S("attr2","attr2 is deprecated, use .prop() or .attr()"),!n)return this.attr.apply(this,arguments);var e=this.prop.apply(this,arguments);return e&&e.jquery||"string"==typeof e?e:this.attr.apply(this,arguments)},e.fn.ajaxSubmit=function(t,r,n,a){if(F(e.fn.jquery),!this.length)return T("ajaxSubmit: skipping submit process - no element selected"),this;if(!e.ajax)throw new Error("jquery.form: ajaxSubmit needs the full jQuery build; this jQuery has no $.ajax");var o=u.prepare(this,D(t,r,n,a));if(!o)return this;u.deliver(o);var i=s[u.chooseTransport(o)](o);this.removeData("jqxhr").data("jqxhr",i);for(var c=0;c= 0) {\n return node;\n }\n }\n\n return null;\n}\n","import { closestByTag, formMember } from \"./form-members.js\";\nimport jQuery from \"jquery\";\n\n// The submitter: the button that submitted a form, captured from ajaxForm's clicks. It is kept in\n// a private store and cleared shortly after the click. The form's clk, clk_x and clk_y properties\n// are still written for pages that read them, and read when the store has none.\n\nvar storeKey = \"jqFormSubmitter\";\n\n// Writes a property on the form; a control with that name makes it read-only.\nfunction setExpando(form, name, value) {\n try {\n form[name] = value;\n } catch (ignore) {\n // the control keeps the name; the store has the submitter\n }\n}\n\n// A property the page set on the form, never a control of the form with that name.\nfunction expando(form, name) {\n var value = form[name];\n var els = formMember(form, \"elements\");\n\n return els && value && els.namedItem(name) === value ? undefined : value;\n}\n\n// Records a submitter for a form until the click window ends.\nfunction record(form, el, x, y) {\n jQuery.data(form, storeKey, { el: el, x: x, y: y });\n setExpando(form, \"clk\", el);\n\n if (el.type === \"image\") {\n setExpando(form, \"clk_x\", x);\n setExpando(form, \"clk_y\", y);\n }\n\n // clear form vars\n setTimeout(function () {\n jQuery.data(form, storeKey, null);\n setExpando(form, \"clk\", null);\n setExpando(form, \"clk_x\", null);\n setExpando(form, \"clk_y\", null);\n }, 100);\n}\n\n// The clicked point of an image button, relative to the image.\nfunction imagePoint(e, target) {\n if (typeof e.offsetX !== \"undefined\") {\n return [e.offsetX, e.offsetY];\n }\n\n if (typeof jQuery.fn.offset === \"function\") {\n var offset = jQuery(target).offset();\n\n return [e.pageX - offset.left, e.pageY - offset.top];\n }\n\n return [e.pageX - target.offsetLeft, e.pageY - target.offsetTop];\n}\n\n/**\n * Records the submit or image button a click event reached, for the form it belongs to.\n */\nexport function captureSubmitter(e) {\n // the clicked control, or the button around the clicked content (ex: a span within a button)\n var target = closestByTag(e.target, [\"button\", \"input\"]);\n\n // the type property, unlike the attribute, is \"submit\" for a button without a type (#588)\n if (!target || (target.type !== \"submit\" && target.type !== \"image\")) {\n return;\n }\n\n var form = target.form;\n\n if (!form) {\n // a submit control that belongs to no form\n return;\n }\n\n var point = target.type === \"image\" ? imagePoint(e, target) : [];\n\n record(form, target, point[0], point[1]);\n}\n\n/**\n * Records the submitter a submit event names (SubmitEvent.submitter), when no click was captured.\n * An image submitter gets the point 0,0, as native submission sends it without a click.\n */\nexport function captureEventSubmitter(e, form) {\n var el = e.originalEvent && e.originalEvent.submitter;\n\n if (el && !submitterOf(form)) {\n record(form, el, 0, 0);\n }\n}\n\n/**\n * The form's submitter as { el, x, y } (x and y for an image button), or null.\n */\nexport function submitterOf(form) {\n if (!form) {\n return null;\n }\n\n var stored = jQuery.data(form, storeKey);\n\n if (stored) {\n return stored;\n }\n\n var el = expando(form, \"clk\");\n\n return el ? { el: el, x: expando(form, \"clk_x\"), y: expando(form, \"clk_y\") } : null;\n}\n\n/**\n * The submitter's fields for a post that adds them itself (the iframe upload), as name β†’ value.\n */\nexport function submitterFields(form) {\n var fields = {};\n var sub = submitterOf(form);\n var el = sub && sub.el;\n\n if (el && el.name && !el.disabled) {\n fields[el.name] = el.value;\n if (el.type === \"image\") {\n fields[el.name + \".x\"] = sub.x;\n fields[el.name + \".y\"] = sub.y;\n }\n }\n\n return fields;\n}\n\n/**\n * The form's submitter element, or null.\n */\nexport function submitterElement(form) {\n var sub = submitterOf(form);\n\n return sub ? sub.el : null;\n}\n","import jQuery from \"jquery\";\n\n// Debug logging, switched on by $.fn.ajaxSubmit.debug. The flag is read on every call, so it can\n// be turned on after the plugin loads.\nexport function log() {\n if (!jQuery.fn.ajaxSubmit.debug) {\n return;\n }\n\n var msg = \"[jquery.form] \" + Array.prototype.join.call(arguments, \"\");\n\n if (window.console && window.console.log) {\n window.console.log(msg);\n } else if (window.opera && window.opera.postError) {\n window.opera.postError(msg);\n }\n}\n\nvar warned = {};\n\n/**\n * A deprecation warning: console.warn, only while debug is on, once per id per page. The message\n * names the replacement; the warning adds that the feature is removed in 5.0.\n */\nexport function deprecate(id, message) {\n if (!jQuery.fn.ajaxSubmit.debug || warned[id]) {\n return;\n }\n\n warned[id] = true;\n\n if (window.console && typeof window.console.warn === \"function\") {\n window.console.warn(\"[jquery.form] \" + message + \" (removed in 5.0)\");\n }\n}\n\n// Forgets which deprecations have warned (for tests).\nexport function resetDeprecations() {\n warned = {};\n}\n\n// True for a jQuery version string older than 3.5.\nexport function beforeJQuery35(version) {\n var parts = String(version).split(\".\");\n var major = Number(parts[0]);\n\n return major < 3 || (major === 3 && Number(parts[1]) < 5);\n}\n\n// 5.0 needs jQuery 3.5 or later: warned on the first ajaxSubmit or ajaxForm, given jQuery's version.\nexport function deprecateOldJQuery(version) {\n if (beforeJQuery35(version)) {\n deprecate(\n \"jquery\",\n \"support for jQuery \" + version + \" is deprecated, 5.0 needs jQuery 3.5 or later\"\n );\n }\n}\n","// The arguments ajaxSubmit and ajaxForm accept in place of an options object.\n\n/**\n * Turns the (url, data, dataType, success) shorthand into options. A url of false is kept as\n * the url; anything else is returned as given.\n */\nexport function shorthandOptions(options, data, dataType, onSuccess) {\n if (typeof options !== \"string\" && options !== false) {\n return options;\n }\n\n var result = { url: options, data: data, dataType: dataType };\n\n if (typeof onSuccess === \"function\") {\n result.success = onSuccess;\n }\n\n return result;\n}\n\n// A copy of options without its url, so the form action is used.\nfunction withoutUrl(options) {\n var result = {};\n\n for (var key in options) {\n if (key !== \"url\" && Object.prototype.hasOwnProperty.call(options, key)) {\n result[key] = options[key];\n }\n }\n\n return result;\n}\n\n/**\n * The options ajaxSubmit starts from: a function is the success callback, the shorthand is\n * expanded, and no options at all is an empty object. A url of false or \"\" means the form action.\n */\nexport function submitOptions(options, data, dataType, onSuccess) {\n if (typeof options === \"function\") {\n return { success: options };\n }\n\n options = shorthandOptions(options, data, dataType, onSuccess);\n\n if (typeof options === \"undefined\") {\n return {};\n }\n\n return options.url === false || options.url === \"\" ? withoutUrl(options) : options;\n}\n\n/**\n * jQuery treats `context` as a flat option: after a deep merge, the settings get back the\n * caller's own object from the last source that has one, so `this` in callbacks is that object.\n */\nexport function keepContext(settings, sources) {\n for (var i = 0; i < sources.length; i++) {\n if (sources[i].context !== undefined) {\n settings.context = sources[i].context;\n }\n }\n\n return settings;\n}\n","import { assertRealParent, closestByTag, formMember, isElement } from \"./form-members.js\";\nimport { captureEventSubmitter, captureSubmitter } from \"./submitter.js\";\nimport { deprecate, deprecateOldJQuery, log } from \"./diagnostics.js\";\nimport jQuery from \"jquery\";\nimport { shorthandOptions } from \"./options.js\";\n\n// ajaxForm binding: the submit and click handlers that send a form through ajaxSubmit. The\n// handlers look up $.fn.ajaxSubmit when they run, so a replacement installed later is used.\n\n// Sends the submit event's form with ajaxSubmit, unless an earlier handler cancelled it.\nfunction submitWith(e, options) {\n if (!e.isDefaultPrevented()) {\n // if event has been canceled, don't proceed\n e.preventDefault();\n // the form is found through the real tree: a control named nodeType misleads jQuery's closest\n var form = closestByTag(e.target, [\"form\"]);\n\n // a button outside the form (form attribute), or requestSubmit(button), sends no click here\n captureEventSubmitter(e, form);\n jQuery(form).ajaxSubmit(options); // #365\n }\n}\n\nfunction doAjaxSubmit(e) {\n submitWith(e, e.data);\n}\n\nfunction captureSubmittingElement(e) {\n /* jshint validthis:true */\n assertRealParent(this);\n captureSubmitter(e);\n}\n\n// An empty selection: queued until the DOM is ready (old jQuery keeps the selector), or dropped.\nfunction bindLater($sel, options) {\n var o = { s: $sel.selector, c: $sel.context };\n\n if (!jQuery.isReady && o.s) {\n log(\"DOM not ready, queuing ajaxForm\");\n deprecate(\n \"queue\",\n \"queuing ajaxForm until the DOM is ready is deprecated, call ajaxForm inside $(fn) \" +\n 'or use delegation: \"\"'\n );\n jQuery(function () {\n jQuery(o.s, o.c).ajaxForm(options);\n });\n\n return $sel;\n }\n\n // is your DOM ready? http://docs.jquery.com/Tutorials:Introducing_$(document).ready()\n log(\"terminating; zero elements found by selector\" + (jQuery.isReady ? \"\" : \" (DOM not ready)\"));\n\n return $sel;\n}\n\n// delegation: true on jQuery 3 and later, where the selection has no selector: always warned,\n// debug or not, once per ajaxForm call.\nfunction warnUnscoped() {\n var console = window.console || {};\n\n if (typeof console.warn === \"function\") {\n console.warn(\n \"[jquery.form] delegation: true binds every form on the page on jQuery 3 and later; \" +\n 'pass a selector instead, e.g. delegation: \"form.ajax\"'\n );\n }\n}\n\nfunction bindDelegated($sel, options) {\n if ($sel.selector === undefined) {\n warnUnscoped();\n }\n\n jQuery(document)\n .off(\"submit.form-plugin\", $sel.selector, doAjaxSubmit)\n .off(\"click.form-plugin\", $sel.selector, captureSubmittingElement)\n .on(\"submit.form-plugin\", $sel.selector, options, doAjaxSubmit)\n .on(\"click.form-plugin\", $sel.selector, options, captureSubmittingElement);\n\n return $sel;\n}\n\n// The element itself or its nearest ancestor that matches the selector. The walk never reads a\n// parentNode a control can hide (jQuery's delegated walk does, and cycles on such a form).\nfunction closestMatch(el, selector) {\n if (!isElement(el)) {\n return null;\n }\n\n if (window.Element && Element.prototype.closest) {\n return Element.prototype.closest.call(el, selector);\n }\n\n for (var node = el; node && isElement(node); node = formMember(node, \"parentNode\")) {\n if (jQuery(node).is(selector)) {\n return node;\n }\n }\n\n return null;\n}\n\n// The document handlers bound for each delegation selector, keyed by \"s\" + selector.\nvar delegated = {};\n\nfunction unbindSelector(selector) {\n var handlers = delegated[\"s\" + selector];\n\n if (handlers) {\n jQuery(document)\n .off(\"submit.form-plugin\", handlers.submit)\n .off(\"click.form-plugin\", handlers.click);\n delete delegated[\"s\" + selector];\n }\n}\n\n// delegation: \"\": one handler pair on the document, scoped to the selector.\nfunction bindSelector($sel, selector, options) {\n if (!selector) {\n throw new Error(\"jquery.form: delegation needs a selector, or true\");\n }\n\n var handlers = {\n submit: function (e) {\n if (closestMatch(e.target, selector)) {\n submitWith(e, options);\n }\n },\n click: function (e) {\n if (closestMatch(e.target, selector)) {\n captureSubmitter(e);\n }\n },\n };\n\n unbindSelector(selector);\n delegated[\"s\" + selector] = handlers;\n jQuery(document)\n .on(\"submit.form-plugin\", handlers.submit)\n .on(\"click.form-plugin\", handlers.click);\n\n return $sel;\n}\n\n// Passed by ajaxForm's own rebind: unbind the selection only, never the document handlers.\nvar selectionOnly = {};\n\n/**\n * ajaxForm() binds the selected forms so a submit is sent with ajaxSubmit, with the clicked\n * submit button (and image coordinates) included. The options work as for ajaxSubmit.\n */\nexport function ajaxForm(options, data, dataType, onSuccess) {\n deprecateOldJQuery(jQuery.fn.jquery);\n options = shorthandOptions(options, data, dataType, onSuccess) || {};\n\n if (typeof options.delegation === \"string\") {\n return bindSelector(this, options.delegation, options);\n }\n\n options.delegation = options.delegation && typeof jQuery.fn.on === \"function\";\n\n if (!options.delegation && this.length === 0) {\n return bindLater(this, options);\n }\n\n if (options.delegation) {\n return bindDelegated(this, options);\n }\n\n if (options.beforeFormUnbind) {\n options.beforeFormUnbind(this, options);\n }\n\n return this.ajaxFormUnbind(selectionOnly)\n .on(\"submit.form-plugin\", options, doAjaxSubmit)\n .on(\"click.form-plugin\", options, captureSubmittingElement);\n}\n\n/**\n * ajaxFormUnbind() removes the handlers ajaxForm bound on the selection and every delegated\n * binding on the document. ajaxFormUnbind(selector) removes only that delegation selector.\n */\nexport function ajaxFormUnbind(selector) {\n if (typeof selector === \"string\") {\n unbindSelector(selector);\n\n return this;\n }\n\n if (selector !== selectionOnly) {\n delegated = {};\n jQuery(document).off(\"submit.form-plugin click.form-plugin\");\n }\n\n return this.off(\"submit.form-plugin click.form-plugin\");\n}\n","import { callFormMethod, isElement } from \"./form-members.js\";\nimport jQuery from \"jquery\";\n\n/**\n * An attribute of a form, or undefined when it is absent, as jQuery's attr returns it. The\n * subject may also be the document or a plain object, read through jQuery.\n */\nexport function formAttribute(form, name) {\n if (!isElement(form)) {\n return jQuery(form).attr(name);\n }\n\n var value = callFormMethod(form, \"getAttribute\", name);\n\n return value === null ? undefined : value;\n}\n","import { callFormMethod, formMember, isElement, tagName } from \"./form-members.js\";\nimport { formAttribute } from \"./form-attributes.js\";\nimport jQuery from \"jquery\";\nimport { submitterOf } from \"./submitter.js\";\n\n// Successful controls: which controls of a form are sent, and as which name/value fields\n// (https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#constructing-the-form-data-set).\n\n// Line breaks, sent as CRLF\nvar rLineBreak = /\\r\\n|\\r|\\n/g;\nvar rCR = /\\r/g;\n\n// Listed form elements that are never submitted.\nvar rUnsubmittable = /^(?:fieldset|object|output)$/;\n\n/**\n * Whether a control or option is disabled, also through a disabled fieldset or optgroup. Without\n * selector matching, only its own disabled property is read.\n */\nfunction isDisabled(el) {\n return typeof el.matches === \"function\" ? el.matches(\":disabled\") : !!el.disabled;\n}\n\n/**\n * The successful-control rule: whether a control is sent. `submitter` is the button that\n * submitted the control's form; other submit and image buttons of a form are not sent.\n */\nexport function isSuccessful(el, submitter) {\n var t = el.type;\n\n if (!el.name || isDisabled(el) || t === \"reset\" || t === \"button\") {\n return false;\n }\n\n if (t === \"checkbox\" || t === \"radio\") {\n return !!el.checked;\n }\n\n if (t === \"submit\" || t === \"image\") {\n return !el.form || submitter === el;\n }\n\n return tagName(el) !== \"select\" || el.selectedIndex !== -1;\n}\n\n// The value of a select: the selected option's value for one, a list for several.\nfunction selectValue(el) {\n var index = el.selectedIndex;\n\n if (index < 0) {\n return null;\n }\n\n var a = [],\n ops = el.options;\n var one = el.type === \"select-one\";\n var max = one ? index + 1 : ops.length;\n\n for (var i = one ? index : 0; i < max; i++) {\n var op = ops[i];\n\n if (op.selected && !isDisabled(op)) {\n var v = op.value;\n\n if (!v) {\n // extra pain for IE...\n v =\n op.attributes && op.attributes.value && !op.attributes.value.specified\n ? op.text\n : op.value;\n }\n\n if (one) {\n return v;\n }\n\n a.push(v);\n }\n }\n\n return a;\n}\n\n/**\n * The value of a control, whether or not it is successful: a list for a multiple select, null\n * for a select with nothing selected, otherwise a string with CRLF line breaks (a lone CR or LF\n * included).\n */\nexport function valueOf(el) {\n if (tagName(el) === \"select\") {\n return selectValue(el);\n }\n\n var v = jQuery(el).val();\n var raw = el.value;\n\n // jQuery before 4.0 drops carriage returns from .val(); read them from the value itself\n if (typeof raw === \"string\" && raw.replace(rCR, \"\") === v) {\n v = raw;\n }\n\n return v.replace(rLineBreak, \"\\r\\n\");\n}\n\n/**\n * The fields as a urlencoded body sends them: a selected file as its name.\n */\n// A lone surrogate becomes U+FFFD, as in a native submission; jQuery.param would throw.\nvar loneSurrogate = /[\\uD800-\\uDBFF](?![\\uDC00-\\uDFFF])|([^\\uD800-\\uDBFF]|^)([\\uDC00-\\uDFFF])/g;\n\nexport function wellFormed(value) {\n return typeof value === \"string\"\n ? value.replace(loneSurrogate, function (match, before) {\n return (before || \"\") + \"\\uFFFD\";\n })\n : value;\n}\n\nexport function urlencodedFields(fields) {\n return jQuery.map(fields, function (field) {\n var value =\n field.type === \"file\" && typeof field.value !== \"string\" ? field.value.name : field.value;\n var name = wellFormed(field.name);\n value = wellFormed(value);\n\n return name === field.name && value === field.value ? field : { name: name, value: value };\n });\n}\n\n/**\n * The serialization steps. `feature` holds what the entry detected at load (fileapi).\n */\nexport function createSuccessfulControls(feature) {\n var $ = jQuery;\n\n // #386; inputs that name the form in their form attribute, other than the candidates found.\n // A form only gets the ones it owns.\n function outsideControls(formId, els, owner) {\n // hat tip @thet; the id is compared, never built into a selector\n return $(\":input[form]\")\n .filter(function () {\n return (\n this.getAttribute(\"form\") === formId &&\n (!owner || this.form === owner) &&\n $.inArray(this, els) < 0\n );\n })\n .get();\n }\n\n // A descendant of a form is a candidate unless it is a control another form owns.\n function ownedBy(els, owner) {\n return $.grep(els, function (el) {\n return typeof el.form === \"undefined\" || el.form === owner;\n });\n }\n\n /**\n * The candidate controls of a form, in order: its elements, or every descendant it owns in\n * semantic mode, then the outside controls it owns that name it.\n */\n function controlsOf(form, semantic) {\n var formId = formAttribute(form, \"id\");\n var els = formMember(form, \"elements\");\n\n if (semantic || typeof els === \"undefined\") {\n // the document is not an element; it has its own getElementsByTagName\n els = isElement(form)\n ? callFormMethod(form, \"getElementsByTagName\", \"*\")\n : form.getElementsByTagName(\"*\");\n }\n\n els = $.makeArray(els);\n\n // the subject may also be a fieldset, the document or another container\n var owner = tagName(form) === \"form\" ? form : null;\n\n if (semantic && owner) {\n els = ownedBy(els, owner);\n }\n\n // FinesseRus: in non-IE browsers outside fields are already included in form.elements.\n if (formId && (semantic || /(Edge|Trident)\\//.test(navigator.userAgent))) {\n els = els.concat(outsideControls(formId, els, owner));\n }\n\n return els;\n }\n\n // The fields of a control's value, or null when the control is not sent.\n function fieldsOf(el) {\n var n = el.name;\n // read at call time, so a page that replaces $.fieldValue changes what is sent\n var v = $.fieldValue(el, true);\n\n if (v && v.constructor === Array) {\n return $.map(v, function (value) {\n return { name: n, value: value };\n });\n }\n\n if (feature.fileapi && el.type === \"file\") {\n var files = el.files;\n\n // #180: an empty field when no file is selected\n return files.length\n ? $.map(files, function (file) {\n return { name: n, value: file, type: el.type };\n })\n : [{ name: n, value: \"\", type: el.type }];\n }\n\n if (v === null || typeof v === \"undefined\") {\n return null;\n }\n\n return [{ name: n, value: v, type: el.type, required: el.required }];\n }\n\n // The clicked image's value and coordinates.\n function imageFields(sub, input, type) {\n var n = input.name;\n var value = { name: n, value: $(input).val() };\n\n if (type) {\n value.type = type;\n }\n\n return [value, { name: n + \".x\", value: sub.x }, { name: n + \".y\", value: sub.y }];\n }\n\n // Adds one candidate control's fields, and the control when it has a value to send.\n function addCandidate(collected, form, el, semantic) {\n if (!el.name || isDisabled(el) || rUnsubmittable.test(tagName(el))) {\n return;\n }\n\n var sub = semantic && el.type === \"image\" && submitterOf(form);\n\n if (sub) {\n // handle image inputs on the fly when semantic == true\n if (sub.el === el) {\n collected.fields.push.apply(collected.fields, imageFields(sub, el, el.type));\n }\n\n return;\n }\n\n var own = fieldsOf(el);\n\n if (own) {\n collected.controls.push(el);\n collected.fields.push.apply(collected.fields, own);\n }\n }\n\n // input type=='image' are not found in elements array! handle it here\n function addClickedImage(collected, form) {\n var sub = submitterOf(form);\n var input = sub && $(sub.el)[0];\n\n if (input && input.name && !isDisabled(input) && input.type === \"image\") {\n collected.fields.push.apply(collected.fields, imageFields(sub, input));\n }\n }\n\n /**\n * The fields of a form, as formToArray returns them, and the controls they came from.\n */\n function collect(form, semantic, filtering) {\n var collected = { fields: [], controls: [] };\n\n if (!form) {\n return collected;\n }\n\n var els = controlsOf(form, semantic);\n\n if (typeof filtering === \"function\") {\n els = $.map(els, filtering);\n }\n\n for (var i = 0; i < els.length; i++) {\n addCandidate(collected, form, els[i], semantic);\n }\n\n if (!semantic) {\n addClickedImage(collected, form);\n }\n\n return collected;\n }\n\n return {\n controlsOf: controlsOf,\n fieldsOf: fieldsOf,\n collect: collect,\n };\n}\n","import jQuery from \"jquery\";\nimport { keepContext } from \"./options.js\";\n\n// The XMLHttpRequest transports: $.ajax with the encoded fields, or FormData for file uploads.\nvar $ = jQuery;\n\n// utility fn for deep serialization: [name, value] pairs, as $.param encodes them\nexport function deepSerialize(extraData, traditional) {\n var param = $.param(extraData, traditional);\n var serialized = param ? param.split(\"&\") : [];\n var len = serialized.length;\n var result = [];\n var i, part;\n\n for (i = 0; i < len; i++) {\n // #252; undo param space replacement\n serialized[i] = serialized[i].replace(/\\+/g, \" \");\n part = serialized[i].split(\"=\");\n // #278; use array instead of object storage, favoring array serializations\n result.push([decodeURIComponent(part[0]), decodeURIComponent(part[1])]);\n }\n\n return result;\n}\n\n/**\n * Posts the fields and extraData as FormData, for files with the File API.\n * XMLHttpRequest Level 2 file uploads (big hat tip to francois2metz)\n */\nexport function sendFormData(submission) {\n var options = submission.options;\n var a = submission.fields;\n\n var formdata = new FormData();\n\n for (var i = 0; i < a.length; i++) {\n formdata.append(a[i].name, a[i].value);\n }\n\n if (options.extraData) {\n var serializedData = deepSerialize(options.extraData, submission.traditional);\n\n for (i = 0; i < serializedData.length; i++) {\n formdata.append(serializedData[i][0], serializedData[i][1]);\n }\n }\n\n options.data = null;\n\n var s = $.extend(true, {}, $.ajaxSettings, options, {\n contentType: false,\n processData: false,\n cache: false,\n type: submission.method || \"POST\",\n });\n\n keepContext(s, [$.ajaxSettings, options]);\n\n if (options.uploadProgress) {\n // workaround because jqXHR does not expose upload property: wraps the xhr factory, the\n // caller's or jQuery's\n var createXhr = s.xhr;\n\n s.xhr = function () {\n var xhr = createXhr.call(this);\n\n if (xhr.upload) {\n xhr.upload.addEventListener(\n \"progress\",\n function (event) {\n var percent = 0;\n // event.position is the deprecated name, read only when loaded is missing\n var position = event.loaded !== undefined ? event.loaded : event.position;\n var total = event.total;\n\n if (event.lengthComputable) {\n percent = Math.ceil((position / total) * 100);\n }\n\n options.uploadProgress(event, position, total, percent);\n },\n false\n );\n }\n\n return xhr;\n };\n }\n\n s.data = null;\n\n var beforeSend = s.beforeSend;\n\n s.beforeSend = function (xhr, o) {\n // Send FormData() provided by user\n if (options.formData) {\n o.data = options.formData;\n } else {\n o.data = formdata;\n }\n\n // a veto (false) cancels the upload, as on the other transports\n return beforeSend ? beforeSend.call(this, xhr, o) : undefined;\n };\n\n return $.ajax(s);\n}\n\n/**\n * Sends the encoded fields with $.ajax.\n */\nexport function sendAjax(submission) {\n return $.ajax(submission.options);\n}\n","import { callFormMethod } from \"./form-members.js\";\nimport { deepSerialize } from \"./xhr-transport.js\";\nimport jQuery from \"jquery\";\nimport { submitterFields } from \"./submitter.js\";\nimport { wellFormed } from \"./successful-controls.js\";\n\n// The iframe form post: the extra fields (submitter, CSRF, data), the form attributes set while\n// posting and restored after, and the native submit.\nvar $ = jQuery;\n\n// The form attributes an iframe upload changes while it posts.\nvar uploadAttributes = [\"action\", \"target\", \"method\", \"enctype\", \"encoding\"];\n\n// Called through the prototype: an extraData key or a form field may be named hasOwnProperty.\nvar hasOwn = Object.prototype.hasOwnProperty;\n\nfunction isGet(method) {\n return /^get$/i.test(method);\n}\n\n// Resolves both URLs through anchors, as jQuery does for crossDomain, so IE's anchor quirks\n// apply to both sides of the comparison.\nfunction isSameOrigin(url) {\n var origin = document.createElement(\"a\");\n var target = document.createElement(\"a\");\n\n origin.href = window.location.href;\n target.href = url;\n // IE fills in the host of a relative URL only once the resolved href is assigned back\n target.href = target.href; // eslint-disable-line no-self-assign\n\n return origin.protocol + \"//\" + origin.host === target.protocol + \"//\" + target.host;\n}\n\n/** Adds the clicked submitter (and an image's coordinates) to s.extraData. */\nexport function addSubmitterFields(s, form) {\n // add submitting element to data if we know it\n var fields = submitterFields(form);\n\n for (var n in fields) {\n s.extraData = s.extraData || {};\n s.extraData[wellFormed(n)] = wellFormed(fields[n]);\n }\n}\n\n/** Adds the page's CSRF token to s.extraData when the form is posted to the page's origin. */\nexport function addCsrfField(s, form, method, forms) {\n // Rails CSRF hack (thanks to Yvan Barthelemy); like jquery-ujs, only for the page's origin and\n // only when the form is posted, since a get form would put the token in the url\n var csrf_token = $(\"meta[name=csrf-token]\").attr(\"content\");\n var csrf_param = $(\"meta[name=csrf-param]\").attr(\"content\");\n var posts =\n !isGet(method) &&\n (!method || /post/i.test(method) || /post/i.test(forms.property(form, \"method\")));\n\n if (csrf_param && csrf_token && posts && isSameOrigin(s.url)) {\n s.extraData = s.extraData || {};\n s.extraData[csrf_param] = csrf_token;\n }\n}\n\nfunction setFormAttribute(form, name, value) {\n callFormMethod(form, \"setAttribute\", name, value);\n}\n\n/** The raw attributes the upload changes, null when absent, to put back exactly (#380). */\nexport function saveAttributes(form) {\n var saved = {};\n\n $.each(uploadAttributes, function (i, name) {\n saved[name] = callFormMethod(form, \"hasAttribute\", name)\n ? callFormMethod(form, \"getAttribute\", name)\n : null;\n });\n\n return saved;\n}\n\n/** Puts back the attributes saveAttributes recorded, removing those that were absent. */\nexport function restoreAttributes(form, saved) {\n $.each(uploadAttributes, function (i, name) {\n if (saved[name] === null) {\n callFormMethod(form, \"removeAttribute\", name);\n } else {\n setFormAttribute(form, name, saved[name]);\n }\n });\n}\n\n/** Points the form at the frame `target` with the upload's url, method and encoding. */\nexport function setUploadAttributes(form, target, method, s, forms) {\n var mp = \"multipart/form-data\";\n\n // update form attrs in IE friendly way\n setFormAttribute(form, \"target\", target);\n if (!method || /post/i.test(method)) {\n setFormAttribute(form, \"method\", \"POST\");\n } else if (isGet(method) && !isGet(forms.property(form, \"method\"))) {\n // a form posts natively only with GET or POST; other verbs keep the form's own method\n setFormAttribute(form, \"method\", \"GET\");\n }\n setFormAttribute(form, \"action\", s.url);\n\n // ie borks in some cases when setting encoding\n if (!s.skipEncodingOverride && (!method || /post/i.test(method))) {\n setFormAttribute(form, \"encoding\", mp);\n setFormAttribute(form, \"enctype\", mp);\n }\n}\n\n/** Appends a hidden input per extraData field to the form; each input is pushed onto `added`. */\nexport function addExtraInputs(form, ownerDocument, extraData, traditional, added) {\n // Builds the input with DOM properties: a name is never parsed as HTML.\n function addHiddenInput(name, value) {\n var input = ownerDocument.createElement(\"input\");\n\n input.type = \"hidden\";\n input.name = name;\n added.push($(input).val(value).appendTo(form)[0]);\n }\n\n if (extraData) {\n for (var n in extraData) {\n if (hasOwn.call(extraData, n)) {\n // if using the $.param format that allows for multiple values with the same name\n if (\n $.isPlainObject(extraData[n]) &&\n hasOwn.call(extraData[n], \"name\") &&\n hasOwn.call(extraData[n], \"value\")\n ) {\n addHiddenInput(extraData[n].name, extraData[n].value);\n } else {\n // arrays and objects become one field per value, as $.param sends them (#597)\n var single = {};\n\n single[n] = extraData[n];\n var fields = deepSerialize(single, traditional);\n\n for (var f = 0; f < fields.length; f++) {\n addHiddenInput(fields[f][0], fields[f][1]);\n }\n }\n }\n }\n }\n}\n\n/** Submits the form natively, even when a control named submit hides the method. */\nexport function submitForm(form) {\n try {\n form.submit();\n } catch (err) {\n // just in case form has element with name/id of 'submit'\n callFormMethod(form, \"submit\");\n }\n}\n","import jQuery from \"jquery\";\nimport { log } from \"./diagnostics.js\";\n\n// The iframe response reader: turns the frame's document into the mock xhr's text, XML, status\n// and dataType, then parses it as $.ajax would (dataFilter, JSON, script).\nvar $ = jQuery;\n\n/** The frame's document, or null when the browser denies access to it. */\nexport function getDoc(frame) {\n /* it looks like contentWindow or contentDocument do not\n * carry the protocol property in ie8, when running under ssl\n * frame.document is the only valid response document, since\n * the protocol is know but not on the other two objects. strange?\n * \"Same origin policy\" http://en.wikipedia.org/wiki/Same_origin_policy\n */\n\n var doc = null;\n\n // IE8 cascading access check\n try {\n if (frame.contentWindow) {\n doc = frame.contentWindow.document;\n }\n } catch (err) {\n // IE8 access denied under ssl & missing protocol\n log(\"cannot get iframe.contentWindow document: \" + err);\n }\n\n if (doc) {\n // successful getting content\n return doc;\n }\n\n try {\n // simply checking may throw in ie8 under ssl or mismatched protocol\n doc = frame.contentDocument ? frame.contentDocument : frame.document;\n } catch (err) {\n // last attempt\n log(\"cannot get iframe.contentDocument: \" + err);\n doc = frame.document;\n }\n\n return doc;\n}\n\n/** Parses the response text or XML for the given (lowercase) dataType. */\nexport function httpData(xhr, type, s) {\n // mostly lifted from jq1.4.4\n\n var ct = xhr.getResponseHeader(\"content-type\") || \"\",\n xml = (type === \"xml\" || !type) && ct.indexOf(\"xml\") >= 0,\n data = xml ? xhr.responseXML : xhr.responseText;\n\n if (xml && data.documentElement.nodeName === \"parsererror\") {\n if ($.error) {\n $.error(\"parsererror\");\n }\n }\n if (s && s.dataFilter) {\n data = s.dataFilter(data, type);\n }\n if (typeof data === \"string\") {\n if ((type === \"json\" || !type) && ct.indexOf(\"json\") >= 0) {\n data = JSON.parse(data);\n } else if (type === \"script\") {\n $.globalEval(data);\n }\n }\n\n return data;\n}\n\n// Copies the status and statusText attributes of an element onto the mock xhr.\nfunction readStatus(xhr, el) {\n // support for XHR 'status' & 'statusText' emulation :\n xhr.status = Number(el.getAttribute(\"status\")) || xhr.status;\n xhr.statusText = el.getAttribute(\"statusText\") || xhr.statusText;\n}\n\n// Fills the mock xhr from the document itself.\nfunction readDocument(doc, xhr, s, isXml) {\n var docRoot = doc.body ? doc.body : doc.documentElement;\n\n xhr.responseText = docRoot ? docRoot.innerHTML : null;\n xhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc;\n if (isXml) {\n s.dataType = \"xml\";\n }\n xhr.getResponseHeader = function (header) {\n // the dataType in lowercase, as $.ajax reads it\n var headers = { \"content-type\": s.dataType && s.dataType.toLowerCase() };\n\n return headers[header.toLowerCase()];\n };\n if (docRoot) {\n readStatus(xhr, docRoot);\n }\n}\n\n// A response embedded in a textarea, or text wrapped in pre or body, replaces responseText.\nfunction readEmbedded(doc, xhr, dt, s) {\n var scr = /(json|script|text)/.test(dt);\n\n if (!scr && !s.textarea) {\n return;\n }\n // see if user embedded response in textarea\n var ta = doc.getElementsByTagName(\"textarea\")[0];\n\n if (ta) {\n xhr.responseText = ta.value;\n readStatus(xhr, ta);\n } else if (scr) {\n // account for browsers injecting pre around json response\n var pre = doc.getElementsByTagName(\"pre\")[0];\n var b = doc.getElementsByTagName(\"body\")[0];\n\n if (pre) {\n xhr.responseText = pre.textContent ? pre.textContent : pre.innerText;\n } else if (b) {\n xhr.responseText = b.textContent ? b.textContent : b.innerText;\n }\n }\n}\n\n/**\n * Reads and parses the response document into the mock xhr. Returns {status, data, errMsg}, or\n * null when `retry()` asks to read the document again later (Opera's untraversable DOM).\n */\nexport function readResponse(doc, xhr, s, retry) {\n var status = \"success\",\n data,\n errMsg;\n\n try {\n var isXml = /^xml$/i.test(s.dataType) || doc.XMLDocument || $.isXMLDoc(doc);\n\n log(\"isXml=\" + isXml);\n\n if (!isXml && window.opera && (doc.body === null || !doc.body.innerHTML)) {\n // in some browsers (Opera) the iframe DOM is not always traversable when\n // the onload callback fires, so we loop a bit to accommodate\n if (retry()) {\n return null;\n }\n // let this fall through because server response could be an empty document\n }\n\n readDocument(doc, xhr, s, isXml);\n\n var dt = (s.dataType || \"\").toLowerCase();\n\n readEmbedded(doc, xhr, dt, s);\n\n try {\n data = httpData(xhr, dt, s);\n } catch (err) {\n status = \"parsererror\";\n xhr.error = errMsg = err || status;\n }\n } catch (err) {\n log(\"error caught: \", err);\n status = \"error\";\n xhr.error = errMsg = err;\n }\n\n return { status: status, data: data, errMsg: errMsg };\n}\n","import jQuery from \"jquery\";\nimport { log } from \"./diagnostics.js\";\n\n// The iframe upload's lifecycle: the mock xhr and the Deferred, the global ajax events, the\n// beforeSend veto, the timeout, abort and settling.\nvar $ = jQuery;\n\n/**\n * Creates the lifecycle of one upload with the merged settings `s`. `frame.stop()` stops the\n * frame's load and `frame.release()` removes or resets the frame after the upload.\n */\nexport function createLifecycle(s, frame) {\n var g,\n timeoutHandle,\n callbackProcessed,\n deferred = $.Deferred();\n\n var xhr = {\n // mock object\n aborted: 0,\n responseText: null,\n responseXML: null,\n status: 0,\n statusText: \"n/a\",\n getAllResponseHeaders: function () {},\n getResponseHeader: function () {},\n setRequestHeader: function () {},\n abort: function (status) {\n abort(status, [xhr, \"aborted\", status]);\n },\n };\n\n // #341\n deferred.abort = function (status) {\n xhr.abort(status);\n };\n\n function done() {\n return xhr.aborted || callbackProcessed;\n }\n\n // Completes an aborted upload once and rejects the Deferred with `rejection`.\n // `textStatus` replaces the default \"timeout\"/\"aborted\" text status.\n function abort(status, rejection, textStatus) {\n var e = textStatus || (status === \"timeout\" ? \"timeout\" : \"aborted\");\n\n if (done()) {\n return;\n }\n\n log(\"aborting upload... \" + e);\n xhr.aborted = 1;\n frame.stop();\n xhr.error = e;\n if (s.error) {\n s.error.call(s.context, xhr, e, status);\n }\n deferred.reject.apply(deferred, rejection);\n\n if (g) {\n $.event.trigger(\"ajaxError\", [xhr, s, e]);\n }\n\n complete(e);\n }\n\n // The global events that end every upload, cancelled ones included.\n function endGlobalEvents() {\n if (g) {\n $.event.trigger(\"ajaxComplete\", [xhr, s]);\n }\n\n if (g && !--$.active) {\n $.event.trigger(\"ajaxStop\");\n }\n }\n\n // The steps every finished or aborted upload ends with, in $.ajax order.\n function complete(status) {\n if (s.complete) {\n s.complete.call(s.context, xhr, status);\n }\n\n endGlobalEvents();\n clearTimeout(timeoutHandle);\n\n // clean up\n setTimeout(function () {\n frame.release();\n xhr.responseXML = null;\n }, 100);\n }\n\n // A beforeSend veto ends the upload as $.ajax cancels a request: no callbacks, the global\n // events end with ajaxError \"canceled\".\n function cancel() {\n if (done()) {\n return;\n }\n\n callbackProcessed = true;\n deferred.reject();\n if (g) {\n $.event.trigger(\"ajaxError\", [xhr, s, \"canceled\"]);\n }\n endGlobalEvents();\n }\n\n // Fires the start events and beforeSend; false when the upload must not be posted.\n function start() {\n g = s.global;\n // trigger ajax global events so that activity/block indicators work like normal\n if (g && $.active++ === 0) {\n $.event.trigger(\"ajaxStart\");\n }\n\n if (s.beforeSend && s.beforeSend.call(s.context, xhr, s) === false) {\n cancel();\n\n return false;\n }\n\n if (xhr.aborted) {\n // abort() in beforeSend already completed the upload\n return false;\n }\n\n if (g) {\n $.event.trigger(\"ajaxSend\", [xhr, s]);\n }\n\n // an ajaxSend handler may abort too\n return !xhr.aborted;\n }\n\n // Resolves the upload; returns {error} when the success callback threw.\n function succeed(data) {\n var failure;\n\n try {\n s.success.call(s.context, data, \"success\", xhr);\n } catch (err) {\n failure = { error: err };\n }\n\n deferred.resolve(xhr.responseText, \"success\", xhr);\n\n if (g) {\n $.event.trigger(\"ajaxSuccess\", [xhr, s, data]);\n }\n\n return failure;\n }\n\n // Settles the upload with the response reader's {status, data, errMsg}.\n function settle(result) {\n var status = result.status,\n errMsg = result.errMsg;\n\n if (xhr.aborted) {\n // abort() completed the upload while its response was processed\n log(\"upload aborted\");\n\n return;\n }\n\n // an emulated HTTP error status wins, as in $.ajax; a parse error is kept otherwise\n if (xhr.status && !((xhr.status >= 200 && xhr.status < 300) || xhr.status === 304)) {\n status = \"error\";\n }\n\n callbackProcessed = true;\n\n // ordering of these callbacks/triggers is odd, but that's how $.ajax does it\n if (status === \"success\") {\n var failure = succeed(result.data);\n\n complete(status);\n if (failure) {\n // the upload is settled; the success callback's exception still reaches the console\n throw failure.error;\n }\n\n return;\n }\n\n if (typeof errMsg === \"undefined\") {\n errMsg = xhr.statusText;\n }\n if (s.error) {\n s.error.call(s.context, xhr, status, errMsg);\n }\n deferred.reject(xhr, \"error\", errMsg);\n if (g) {\n $.event.trigger(\"ajaxError\", [xhr, s, errMsg]);\n }\n\n complete(status);\n }\n\n return {\n xhr: xhr,\n deferred: deferred,\n start: start,\n done: done,\n abort: abort,\n settle: settle,\n // Settles an upload that failed with an exception (ignored once aborted).\n fail: function (err) {\n settle({ status: \"error\", errMsg: err });\n },\n // Runs `onTimeout` after s.timeout, when set.\n startTimer: function (onTimeout) {\n if (s.timeout) {\n timeoutHandle = setTimeout(onTimeout, s.timeout);\n }\n },\n stopTimer: function () {\n clearTimeout(timeoutHandle);\n timeoutHandle = undefined;\n },\n };\n}\n","import {\n addCsrfField,\n addExtraInputs,\n addSubmitterFields,\n restoreAttributes,\n saveAttributes,\n setUploadAttributes,\n submitForm,\n} from \"./iframe-post.js\";\nimport { closestByTag, formMember } from \"./form-members.js\";\nimport { deprecate, log } from \"./diagnostics.js\";\nimport { getDoc, readResponse } from \"./iframe-response.js\";\nimport { createLifecycle } from \"./iframe-lifecycle.js\";\nimport jQuery from \"jquery\";\nimport { keepContext } from \"./options.js\";\n\n// The iframe transport: posts the form itself into a hidden frame and reads the response from it,\n// for file uploads without the File API or when the iframe option asks for it.\nvar $ = jQuery;\n\n/**\n * The iframe send step. `hasProp` is what the entry detected at load; `forms.property` reads a\n * form property as attr2 does.\n */\nexport function createIframeTransport(hasProp, forms) {\n var CLIENT_TIMEOUT_ABORT = 1;\n var SERVER_ABORT = 2;\n // tells apart the frames of uploads that start in the same millisecond\n var frameCount = 0;\n\n // ensure that every serialized input is still enabled\n function enableControls(elements) {\n for (var i = 0; i < elements.length; i++) {\n var el = $(elements[i]);\n\n if (hasProp) {\n el.prop(\"disabled\", false);\n } else {\n el.removeAttr(\"disabled\");\n }\n }\n }\n\n // Names the frame's window, when the page may: a cross-origin or sandboxed frame refuses.\n function nameWindow(frame, name) {\n try {\n if (frame.contentWindow) {\n frame.contentWindow.name = name;\n }\n } catch (ignore) {}\n }\n\n // The frame the form posts into: the iframeTarget, named `id` when it has no name, or a new\n // hidden frame named `id`. Returns the frame and the name the form targets.\n function createFrame(s, id, ownerDocument) {\n var $io, n;\n\n if (s.iframeTarget) {\n $io = $(s.iframeTarget, ownerDocument);\n n = $io.attr(\"name\");\n if (!n) {\n $io.attr(\"name\", id);\n // a frame already in the page keeps the browsing context name it was inserted with\n $io.each(function () {\n nameWindow(this, id);\n });\n } else {\n id = n;\n }\n } else {\n var io = ownerDocument.createElement(\"iframe\");\n\n io.setAttribute(\"name\", id);\n io.setAttribute(\"src\", s.iframeSrc);\n $io = $(io);\n $io.css({ position: \"absolute\", top: \"-1000px\", left: \"-1000px\" });\n }\n\n return { $io: $io, id: id };\n }\n\n // The frame hooks the lifecycle calls: stop a load in progress, and release after the upload.\n function frameHooks(s, $io) {\n return {\n stop: function () {\n try {\n // #214, #257\n if ($io[0].contentWindow.document.execCommand) {\n $io[0].contentWindow.document.execCommand(\"Stop\");\n }\n } catch (ignore) {}\n\n $io.attr(\"src\", s.iframeSrc); // abort op in progress\n },\n release: function () {\n if (!s.iframeTarget) {\n $io.remove();\n } else {\n // adding else to clean up existing iframe response.\n $io.attr(\"src\", s.iframeSrc);\n }\n },\n };\n }\n\n function listen(io, cb) {\n if (io.attachEvent) {\n io.attachEvent(\"onload\", cb);\n } else {\n io.addEventListener(\"load\", cb, false);\n }\n }\n\n function unlisten(io, cb) {\n if (io.detachEvent) {\n io.detachEvent(\"onload\", cb);\n } else {\n io.removeEventListener(\"load\", cb, false);\n }\n }\n\n // private function for handling file uploads (hat tip to YAHOO!)\n function fileUploadIframe(submission) {\n var form = submission.form,\n method = submission.method;\n\n var s = keepContext($.extend(true, {}, $.ajaxSettings, submission.options), [\n $.ajaxSettings,\n submission.options,\n ]);\n\n s.context = s.context || s;\n var ownerDocument = formMember(form, \"ownerDocument\");\n var $body = $(closestByTag(form, [\"body\"]));\n var frame = createFrame(s, \"jqFormIO\" + new Date().getTime() + frameCount++, ownerDocument);\n var $io = frame.$io,\n io = $io[0];\n var life = createLifecycle(s, frameHooks(s, $io));\n var domCheckCount = 50;\n\n if (!life.start()) {\n return life.deferred;\n }\n\n addSubmitterFields(s, form);\n addCsrfField(s, form, method, forms);\n\n // look for server aborts\n function checkState() {\n try {\n var state = getDoc(io).readyState;\n\n log(\"state = \" + state);\n if (state && state.toLowerCase() === \"uninitialized\") {\n setTimeout(checkState, 50);\n }\n } catch (e) {\n log(\"Server abort: \", e, \" (\", e.name, \")\");\n cb(SERVER_ABORT);\n life.stopTimer();\n }\n }\n\n // take a breath so that pending repaints get some cpu time before the upload starts\n function doSubmit() {\n var saved = saveAttributes(form);\n\n setUploadAttributes(form, frame.id, method, s, forms);\n\n // support timout\n life.startTimer(function () {\n cb(CLIENT_TIMEOUT_ABORT);\n });\n\n // add \"extra\" data to form if provided in options\n var extraInputs = [];\n\n try {\n addExtraInputs(form, ownerDocument, s.extraData, submission.traditional, extraInputs);\n\n if (!s.iframeTarget) {\n // add iframe to doc and submit the form\n $io.appendTo($body);\n }\n\n // A connected form posting into a frame outside the document opens a new window.\n var root = ownerDocument.documentElement;\n\n if (io && $.contains(root, form) && !$.contains(root, io)) {\n var notInDocument = \"jquery.form: the upload frame is not in the document\";\n\n life.abort(notInDocument, [life.xhr, \"error\", notInDocument], \"error\");\n\n return;\n }\n\n listen(io, cb);\n setTimeout(checkState, 15);\n submitForm(form);\n } finally {\n // reset attrs and remove \"extra\" input elements\n restoreAttributes(form, saved);\n $(extraInputs).remove();\n }\n }\n\n // Reads the next document by Opera's rules: false once the retries are used up.\n function retry() {\n if (--domCheckCount) {\n log(\"requeing onLoad callback, DOM not available\");\n setTimeout(cb, 250);\n\n return true;\n }\n\n return false;\n }\n\n function cb(e) {\n if (life.done()) {\n return;\n }\n\n var doc = getDoc(io);\n\n if (!doc) {\n log(\"cannot access response document\");\n e = SERVER_ABORT;\n }\n if (e === CLIENT_TIMEOUT_ABORT) {\n life.abort(\"timeout\", [life.xhr, \"timeout\"]);\n\n return;\n }\n if (e === SERVER_ABORT) {\n life.abort(\"server abort\", [life.xhr, \"error\", \"server abort\"]);\n\n return;\n }\n\n if (doc.location.href === s.iframeSrc) {\n // response not received yet\n return;\n }\n\n unlisten(io, cb);\n\n var result = readResponse(doc, life.xhr, s, retry);\n\n if (result) {\n life.settle(result);\n }\n }\n\n // An exception while posting settles the upload with \"error\" and the exception.\n function post() {\n if (life.done()) {\n // aborted before the delayed post\n return;\n }\n\n try {\n doSubmit();\n } catch (err) {\n log(\"upload failed: \", err);\n life.fail(err);\n }\n }\n\n if (s.forceSync) {\n post();\n } else {\n setTimeout(post, 10); // this lets dom updates render\n }\n\n return life.deferred;\n }\n\n return function sendIframe(submission) {\n var jqxhr;\n\n // now, while the controls are still listed: ajaxSubmit clears the list when it returns,\n // before a closeKeepAlive request completes\n enableControls(submission.controls);\n\n // hack to fix Safari hang (thanks to Tim Molendijk for this)\n // see: http://groups.google.com/group/jquery-dev/browse_thread/thread/36395b7ab510dd5d\n if (submission.options.closeKeepAlive) {\n deprecate(\"closeKeepAlive\", \"closeKeepAlive works around a Safari 3/4 bug and is deprecated\");\n $.get(submission.options.closeKeepAlive, function () {\n jqxhr = fileUploadIframe(submission);\n });\n } else {\n jqxhr = fileUploadIframe(submission);\n }\n\n return jqxhr;\n };\n}\n","import { deprecate, log } from \"./diagnostics.js\";\nimport { assertRealParent } from \"./form-members.js\";\nimport jQuery from \"jquery\";\nimport { keepContext } from \"./options.js\";\nimport { urlencodedFields } from \"./successful-controls.js\";\n\n// A Submission is one ajaxSubmit call once its vetoes have passed:\n// { form, $form, fields, controls, options, method, traditional }. `options` is the object the\n// callbacks and events receive; later steps change it in place.\n\n/**\n * The submission steps. `feature` holds what the entry detected at load (fileapi, formdata), and\n * `forms` reads form attributes and attr2-style properties (attribute, property), and\n * `serialization` collects the form's fields and controls.\n */\nexport function createSubmission(feature, forms, serialization) {\n var $ = jQuery;\n\n function refuse(message) {\n log(message);\n\n return null;\n }\n\n // The options merged over the form's action, the method, and the ajax defaults.\n function withDefaults(form, options, method) {\n var action = options.url || forms.property(form, \"action\");\n var url = typeof action === \"string\" ? action.trim() : \"\";\n\n // clean url (don't include hash value); an action that is only a fragment means this page\n url = url.split(\"#\")[0] || window.location.href.split(\"#\")[0];\n // IE requires javascript:false in https, but this breaks chrome >83 and goes against spec.\n // Instead of using javascript:false always, let's only apply it for IE.\n var isMsie = /(MSIE|Trident)/.test(navigator.userAgent || \"\");\n var iframeSrc = isMsie && /^https/i.test(document.URL) ? \"javascript:false\" : \"about:blank\"; // eslint-disable-line no-script-url\n\n var merged = $.extend(\n true,\n {\n url: url,\n success: $.ajaxSettings.success,\n type: method || $.ajaxSettings.type,\n iframeSrc: iframeSrc,\n },\n options\n );\n\n return keepContext(merged, [options]);\n }\n\n /**\n * The one method every transport sends, read after the hooks: `method` wins over `type`, and\n * `type` is set to it. Undefined when only the ajax default applies, so each transport keeps\n * its own default.\n */\n function resolveMethod(options, defaultType) {\n var resolved = options.method || options.type;\n\n options.type = resolved;\n\n return resolved === defaultType && !options.method ? undefined : resolved;\n }\n\n // The data option, kept as extraData and encoded, or undefined without one.\n function extraQuery(fields, options, traditional) {\n if (!options.data) {\n return undefined;\n }\n\n var optionsData = typeof options.data === \"function\" ? options.data(fields) : options.data;\n\n if (typeof optionsData === \"string\") {\n if (options.requestFormat === \"json\") {\n throw new Error(\n 'jquery.form: requestFormat \"json\" needs object data; a string data option is a query string'\n );\n }\n\n // a query string: sent as-is when urlencoded, as its own fields otherwise\n options.extraData = queryPairs(optionsData);\n\n return optionsData;\n }\n\n options.extraData = optionsData;\n\n return $.param(optionsData, traditional);\n }\n\n // Sets a key as an own data property, so a name like __proto__ is an ordinary key.\n function defineKey(object, key, value) {\n Object.defineProperty(object, key, {\n value: value,\n enumerable: true,\n writable: true,\n configurable: true,\n });\n }\n\n /**\n * requestFormat \"json\" (#545): the fields as an object (a repeated name gives an array), merged\n * with object data, sent as a JSON body. Based on the idea in PR #557 by zhangciwu.\n */\n function jsonBody(options, fields) {\n if (/^get$/i.test(options.type)) {\n throw new Error('jquery.form: requestFormat \"json\" needs a method with a body, such as POST');\n }\n\n var body = {};\n var own = Object.prototype.hasOwnProperty;\n\n for (var i = 0; i < fields.length; i++) {\n var name = fields[i].name;\n\n if (!own.call(body, name)) {\n defineKey(body, name, fields[i].value);\n } else if (Array.isArray(body[name])) {\n body[name].push(fields[i].value);\n } else {\n defineKey(body, name, [body[name], fields[i].value]);\n }\n }\n\n var extra = options.extraData;\n\n for (var key in extra) {\n if (own.call(extra, key)) {\n defineKey(body, key, extra[key]);\n }\n }\n\n options.data = JSON.stringify(body);\n options.contentType = \"application/json; charset=UTF-8\";\n }\n\n // The fields of a query string, as the { name, value } list $.param takes.\n function queryPairs(query) {\n var pairs = [];\n var parts = query.split(\"&\");\n\n for (var i = 0; i < parts.length; i++) {\n if (parts[i]) {\n var at = parts[i].indexOf(\"=\");\n var name = at < 0 ? parts[i] : parts[i].slice(0, at);\n var value = at < 0 ? \"\" : parts[i].slice(at + 1);\n\n pairs.push({ name: decodeQuery(name), value: decodeQuery(value) });\n }\n }\n\n return pairs;\n }\n\n function decodeQuery(text) {\n return decodeURIComponent(text.replace(/\\+/g, \" \"));\n }\n\n // Puts the encoded fields in the url for a get, and in the data otherwise.\n function encode(options, q, qx) {\n if (qx) {\n q = q ? q + \"&\" + qx : qx;\n }\n\n if (options.type.toUpperCase() === \"GET\") {\n // the query goes before any fragment in the url option\n var hashAt = options.url.indexOf(\"#\");\n var base = hashAt < 0 ? options.url : options.url.slice(0, hashAt);\n\n options.url =\n base + (base.indexOf(\"?\") >= 0 ? \"&\" : \"?\") + q + options.url.slice(base.length);\n options.data = null; // data is null for 'get'\n } else {\n options.data = q; // data is the query string for 'post'\n }\n }\n\n // A callback option as a list: an array as given, one function, or none.\n function callbackList(callback) {\n if (Array.isArray(callback)) {\n return callback;\n }\n\n return callback ? [callback] : [];\n }\n\n // Calls each callback in order with the same this and arguments.\n function callEach(callbacks, context, args) {\n for (var i = 0; i < callbacks.length; i++) {\n callbacks[i].apply(context, args);\n }\n }\n\n /**\n * Resolves the options, serializes the form, and runs the vetoes: the Submission, or null when\n * an event or callback stopped it.\n */\n function prepare($set, options) {\n $set.each(function () {\n assertRealParent(this);\n });\n\n var form = $set[0];\n var method = options.method || options.type || forms.property(form, \"method\");\n\n options = withDefaults(form, options, method);\n\n // the ajax default type, when neither the caller nor the form gave a method\n var defaultType = method ? undefined : options.type;\n\n // hook for manipulating the form data before it is extracted;\n // convenient for use with rich editors like tinyMCE or FCKEditor\n var veto = {};\n\n $set.trigger(\"form-pre-serialize\", [$set, options, veto]);\n if (veto.veto) {\n return refuse(\"ajaxSubmit: submit vetoed via form-pre-serialize trigger\");\n }\n\n // provide opportunity to alter form data before it is serialized\n if (options.beforeSerialize && options.beforeSerialize($set, options) === false) {\n return refuse(\"ajaxSubmit: submit aborted via beforeSerialize callback\");\n }\n\n var traditional = options.traditional;\n\n if (typeof traditional === \"undefined\") {\n traditional = $.ajaxSettings.traditional;\n }\n\n var collected = serialization.collect($set[0], options.semantic, options.filtering);\n var fields = collected.fields;\n var controls = collected.controls;\n var qx = extraQuery(fields, options, traditional);\n\n // give pre-submit callback an opportunity to abort the submit\n if (options.beforeSubmit && options.beforeSubmit(fields, $set, options) === false) {\n return refuse(\"ajaxSubmit: submit aborted via beforeSubmit callback\");\n }\n\n // fire vetoable 'validate' event\n $set.trigger(\"form-submit-validate\", [fields, $set, options, veto]);\n if (veto.veto) {\n return refuse(\"ajaxSubmit: submit vetoed via form-submit-validate trigger\");\n }\n\n method = resolveMethod(options, defaultType);\n\n if (options.requestFormat === \"json\") {\n jsonBody(options, fields);\n } else {\n encode(options, $.param(urlencodedFields(fields), traditional), qx);\n }\n\n return {\n form: form,\n $form: $set,\n fields: fields,\n controls: controls,\n options: options,\n method: method,\n traditional: traditional,\n };\n }\n\n /**\n * Wraps success, error and complete (a function or an array of them, as $.ajax takes) so each\n * also receives the form, and adds the resetForm,\n * clearForm and target steps before the success callbacks.\n */\n function deliver(submission) {\n var $set = submission.$form;\n var options = submission.options;\n var callbacks = [];\n\n if (options.resetForm) {\n callbacks.push(function () {\n $set.resetForm();\n });\n }\n\n if (options.clearForm) {\n callbacks.push(function () {\n $set.clearForm(options.includeHidden);\n });\n }\n\n // perform a load on the target only if dataType is not provided\n if (!options.dataType && options.target) {\n var successes = callbackList(options.success);\n\n callbacks.push(function (data, textStatus, jqXHR) {\n var successArguments = arguments,\n fn = options.replaceTarget ? \"replaceWith\" : \"html\",\n $target = $(options.target);\n\n // Only a string response is inserted. jQuery has already parsed a JSON or XML response,\n // and inserting it would parse each of its strings as HTML.\n if (typeof data === \"string\") {\n $target[fn](data);\n } else {\n log(\"target: the response was parsed by jQuery, so it is not inserted\");\n }\n\n if (!$target.length) {\n // nothing to fill: success still runs once, with the normal context\n callEach(successes, this, successArguments);\n }\n\n $target.each(function () {\n callEach(successes, this, successArguments);\n });\n });\n } else {\n $.merge(callbacks, callbackList(options.success));\n }\n\n options.success = function (data, status, xhr) {\n // jQuery 1.4+ passes xhr as 3rd arg\n var context = options.context || this; // jQuery 1.4+ supports scope context\n\n for (var i = 0, max = callbacks.length; i < max; i++) {\n callbacks[i].apply(context, [data, status, xhr || $set, $set]);\n }\n };\n\n if (options.error) {\n var errors = callbackList(options.error);\n\n options.error = function (xhr, status, error) {\n callEach(errors, options.context || this, [xhr, status, error, $set]);\n };\n }\n\n if (options.complete) {\n var completes = callbackList(options.complete);\n\n options.complete = function (xhr, status) {\n callEach(completes, options.context || this, [xhr, status, $set]);\n };\n }\n }\n\n /**\n * The transport for a submission: \"iframe\" for files without the File API or when forced,\n * \"formdata\" for files with it, \"ajax\" otherwise.\n */\n function chooseTransport(submission) {\n var $set = submission.$form;\n var options = submission.options;\n\n // [value] (issue #113), also see comment:\n // https://github.com/malsup/form/commit/588306aedba1de01388032d5f42a60159eea9228#commitcomment-2180219\n // and the file inputs outside the form that belong to it through their form attribute\n var fileInputs = $(\"input[type=file]:enabled\", $set)\n .add($(submission.controls).filter(\"input[type=file]\"))\n .filter(function () {\n return $(this).val() !== \"\";\n });\n var hasFileInputs = fileInputs.length > 0;\n // compared as the browser does: ASCII case-insensitive, without surrounding whitespace\n var mp = /^[\\t\\n\\f\\r ]*multipart\\/form-data[\\t\\n\\f\\r ]*$/i;\n var multipart =\n mp.test(forms.attribute($set[0], \"enctype\")) || mp.test(forms.attribute($set[0], \"encoding\"));\n var fileAPI = feature.fileapi && feature.formdata;\n\n log(\"fileAPI :\" + fileAPI);\n\n var shouldUseFrame = (hasFileInputs || multipart) && !fileAPI;\n\n var transport = (hasFileInputs || multipart) && fileAPI ? \"formdata\" : \"ajax\";\n\n // options.iframe allows user to force iframe mode\n // 06-NOV-09: now defaulting to iframe mode if file input is detected\n if (options.iframe !== false && (options.iframe || shouldUseFrame)) {\n transport = \"iframe\";\n }\n\n if (transport === \"iframe\" && !options.iframe) {\n deprecate(\n \"iframe\",\n \"choosing the iframe transport automatically without FormData is deprecated, set iframe: true\"\n );\n }\n\n if (transport !== \"ajax\" && options.requestFormat === \"json\") {\n throw new Error(\n 'jquery.form: requestFormat \"json\" cannot send files or use the iframe transport'\n );\n }\n\n return transport;\n }\n\n return { prepare: prepare, deliver: deliver, chooseTransport: chooseTransport };\n}\n","/*!\n * jQuery Form Plugin\n * version: 4.5.0\n * Requires jQuery v1.7.2 or later\n * Project repository: https://github.com/jquery-form/form\n\n * Copyright 2017 Kevin Morris\n * Copyright 2006 M. Alsup\n\n * Dual licensed under the LGPL-2.1+ or MIT licenses\n * https://github.com/jquery-form/form#license\n\n * This library is free software; you can redistribute it and/or\n * modify it under the terms of the GNU Lesser General Public\n * License as published by the Free Software Foundation; either\n * version 2.1 of the License, or (at your option) any later version.\n * This library is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n */\nimport { ajaxForm, ajaxFormUnbind } from \"./ajax-form.js\";\nimport { callFormMethod, tagName } from \"./form-members.js\";\nimport {\n createSuccessfulControls,\n isSuccessful,\n urlencodedFields,\n valueOf,\n} from \"./successful-controls.js\";\nimport { deprecate, deprecateOldJQuery, log } from \"./diagnostics.js\";\nimport { sendAjax, sendFormData } from \"./xhr-transport.js\";\nimport { createIframeTransport } from \"./iframe-transport.js\";\nimport { createSubmission } from \"./submission.js\";\nimport { formAttribute } from \"./form-attributes.js\";\nimport jQuery from \"jquery\";\nimport { submitOptions } from \"./options.js\";\nimport { submitterElement } from \"./submitter.js\";\n\n(function ($) {\n \"use strict\";\n\n /*\n\t\tUsage Note:\n\t\t-----------\n\t\tDo not use both ajaxSubmit and ajaxForm on the same form. These\n\t\tfunctions are mutually exclusive. Use ajaxSubmit if you want\n\t\tto bind your own submit handler to the form. For example,\n\n\t\t$(document).ready(function() {\n\t\t\t$('#myForm').on('submit', function(e) {\n\t\t\t\te.preventDefault(); // <-- important\n\t\t\t\t$(this).ajaxSubmit({\n\t\t\t\t\ttarget: '#output'\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\n\t\tUse ajaxForm when you want the plugin to manage all the event binding\n\t\tfor you. For example,\n\n\t\t$(document).ready(function() {\n\t\t\t$('#myForm').ajaxForm({\n\t\t\t\ttarget: '#output'\n\t\t\t});\n\t\t});\n\n\t\tYou can also use ajaxForm with delegation (requires jQuery v1.7+), so the\n\t\tform does not have to exist when you invoke ajaxForm:\n\n\t\t$('#myForm').ajaxForm({\n\t\t\tdelegation: true,\n\t\t\ttarget: '#output'\n\t\t});\n\n\t\tWhen using ajaxForm, the ajaxSubmit function will be invoked for you\n\t\tat the appropriate time.\n\t*/\n\n /**\n * Feature detection\n */\n var feature = {};\n\n feature.fileapi = $('').get(0).files !== undefined;\n feature.formdata = typeof window.FormData !== \"undefined\";\n\n var hasProp = !!$.fn.prop;\n // What attr2 returns for a form: the property when it is a string, otherwise the attribute. The\n // property is read plainly on purpose: a control named like it shadows it, and then the raw\n // attribute is used.\n function formProperty(form, name) {\n var value = hasProp ? form[name] : undefined;\n\n return typeof value === \"string\" ? value : formAttribute(form, name);\n }\n\n var forms = { attribute: formAttribute, property: formProperty };\n var serialization = createSuccessfulControls(feature);\n var steps = createSubmission(feature, forms, serialization);\n var transports = {\n iframe: createIframeTransport(hasProp, forms),\n formdata: sendFormData,\n ajax: sendAjax,\n };\n\n // attr2 uses prop when it can but checks the return type for\n // an expected string. This accounts for the case where a form\n // contains inputs with names like \"action\" or \"method\"; in those\n // cases \"prop\" returns the element\n $.fn.attr2 = function () {\n deprecate(\"attr2\", \"attr2 is deprecated, use .prop() or .attr()\");\n\n if (!hasProp) {\n return this.attr.apply(this, arguments);\n }\n\n var val = this.prop.apply(this, arguments);\n\n if ((val && val.jquery) || typeof val === \"string\") {\n return val;\n }\n\n return this.attr.apply(this, arguments);\n };\n\n /**\n * ajaxSubmit() provides a mechanism for immediately submitting\n * an HTML form using AJAX.\n *\n * @param\t{object|string}\toptions\t\tjquery.form.js parameters or custom url for submission\n * @param\t{object}\t\tdata\t\textraData\n * @param\t{string}\t\tdataType\tajax dataType\n * @param\t{function}\t\tonSuccess\tajax success callback function\n */\n $.fn.ajaxSubmit = function (options, data, dataType, onSuccess) {\n deprecateOldJQuery($.fn.jquery);\n\n // fast fail if nothing selected (http://dev.jquery.com/ticket/2752)\n if (!this.length) {\n log(\"ajaxSubmit: skipping submit process - no element selected\");\n\n return this;\n }\n\n // #541: jQuery's slim build has no $.ajax\n if (!$.ajax) {\n throw new Error(\n \"jquery.form: ajaxSubmit needs the full jQuery build; this jQuery has no $.ajax\"\n );\n }\n\n var submission = steps.prepare(this, submitOptions(options, data, dataType, onSuccess));\n\n if (!submission) {\n return this;\n }\n\n steps.deliver(submission);\n\n var jqxhr = transports[steps.chooseTransport(submission)](submission);\n\n this.removeData(\"jqxhr\").data(\"jqxhr\", jqxhr);\n\n // clear element array\n for (var k = 0; k < submission.controls.length; k++) {\n submission.controls[k] = null;\n }\n\n // fire 'notify' event\n this.trigger(\"form-submit-notify\", [this, submission.options]);\n\n return this;\n };\n\n $.fn.ajaxForm = ajaxForm;\n $.fn.ajaxFormUnbind = ajaxFormUnbind;\n\n /**\n * formToArray() gathers form element data into an array of objects that can\n * be passed to any of the following ajax functions: $.get, $.post, or load.\n * Each object in the array has both a 'name' and 'value' property. An example of\n * an array for a simple login form might be:\n *\n * [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ]\n *\n * It is this array that is passed to pre-submit callback functions provided to the\n * ajaxSubmit() and ajaxForm() methods.\n */\n $.fn.formToArray = function (semantic, elements, filtering) {\n var collected = serialization.collect(this[0], semantic, filtering);\n\n if (elements) {\n elements.push.apply(elements, collected.controls);\n }\n\n return collected.fields;\n };\n\n /**\n * Serializes form data into a 'submittable' string. This method will return a string\n * in the format: name1=value1&name2=value2\n */\n $.fn.formSerialize = function (semantic) {\n // hand off to jQuery.param for proper encoding\n return $.param(urlencodedFields(this.formToArray(semantic)));\n };\n\n /**\n * Serializes all field elements in the jQuery object into a query string.\n * This method will return a string in the format: name1=value1&name2=value2\n */\n $.fn.fieldSerialize = function (successful) {\n var a = [];\n\n this.each(function () {\n var n = this.name;\n\n // a form is not a field, though it may have a name\n if (!n || tagName(this) === \"form\") {\n return;\n }\n\n var v = $.fieldValue(this, successful);\n\n if (v && v.constructor === Array) {\n for (var i = 0, max = v.length; i < max; i++) {\n a.push({ name: n, value: v[i] });\n }\n } else if (v !== null && typeof v !== \"undefined\") {\n a.push({ name: this.name, value: v });\n }\n });\n\n // hand off to jQuery.param for proper encoding\n return $.param(urlencodedFields(a));\n };\n\n /**\n * Returns the value(s) of the element in the matched set. For example, consider the following form:\n *\n *\t
\n *\t\t\n *\t\t\n *\t\t\n *\t\t\n *\t\t\n *\t\t\n *\t
\n *\n *\tvar v = $('input[type=text]').fieldValue();\n *\t// if no values are entered into the text inputs\n *\tv === ['','']\n *\t// if values entered into the text inputs are 'foo' and 'bar'\n *\tv === ['foo','bar']\n *\n *\tvar v = $('input[type=checkbox]').fieldValue();\n *\t// if neither checkbox is checked\n *\tv === undefined\n *\t// if both checkboxes are checked\n *\tv === ['B1', 'B2']\n *\n *\tvar v = $('input[type=radio]').fieldValue();\n *\t// if neither radio is checked\n *\tv === undefined\n *\t// if first radio is checked\n *\tv === ['C1']\n *\n * The successful argument controls whether or not the field element must be 'successful'\n * (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls).\n * The default value of the successful argument is true. If this value is false the value(s)\n * for each element is returned.\n *\n * Note: This method *always* returns an array. If no valid value can be determined the\n *\tarray will be empty, otherwise it will contain one or more values.\n */\n $.fn.fieldValue = function (successful) {\n for (var val = [], i = 0, max = this.length; i < max; i++) {\n var el = this[i];\n var v = $.fieldValue(el, successful);\n\n if (v === null || typeof v === \"undefined\" || (v.constructor === Array && !v.length)) {\n continue;\n }\n\n if (v.constructor === Array) {\n $.merge(val, v);\n } else {\n val.push(v);\n }\n }\n\n return val;\n };\n\n /**\n * Returns the value of the field element.\n */\n $.fieldValue = function (el, successful) {\n var required = typeof successful === \"undefined\" || successful;\n\n if (required && !isSuccessful(el, submitterElement(el.form))) {\n return null;\n }\n\n return valueOf(el);\n };\n\n /**\n * Clears the form data. Takes the following actions on the form's input fields:\n * - input text fields will have their 'value' property set to the empty string\n * - select elements will have their 'selectedIndex' property set to -1\n * - checkbox and radio inputs will have their 'checked' property set to false\n * - inputs of type submit, button, reset, and hidden will *not* be effected\n * - button elements will *not* be effected\n */\n $.fn.clearForm = function (includeHidden) {\n return this.each(function () {\n $(\"input,select,textarea\", this).clearFields(includeHidden);\n });\n };\n\n /**\n * Clears the selected form elements.\n */\n $.fn.clearInputs = function (includeHidden) {\n deprecate(\"clearInputs\", \"clearInputs is deprecated, use clearFields\");\n\n return this.clearFields(includeHidden);\n };\n\n $.fn.clearFields = function (includeHidden) {\n var re =\n /^(?:color|date|datetime|datetime-local|email|month|number|password|range|search|tel|text|time|url|week)$/i; // 'hidden' is not in this list\n\n return this.each(function () {\n var t = this.type,\n tag = tagName(this);\n\n if (re.test(t) || tag === \"textarea\") {\n this.value = \"\";\n } else if (t === \"checkbox\" || t === \"radio\") {\n this.checked = false;\n } else if (tag === \"select\") {\n this.selectedIndex = -1;\n } else if (t === \"file\") {\n if (/MSIE/.test(navigator.userAgent)) {\n $(this).replaceWith($(this).clone(true));\n } else {\n $(this).val(\"\");\n }\n } else if (includeHidden) {\n // includeHidden can be the value true, or it can be a selector string\n // indicating a special test; for example:\n // $('#myForm').clearForm('.special:hidden')\n // the above would clean hidden inputs that have the class of 'special'\n if (\n (includeHidden === true && /hidden/.test(t)) ||\n (typeof includeHidden === \"string\" && $(this).is(includeHidden))\n ) {\n this.value = \"\";\n }\n }\n });\n };\n\n /**\n * Resets the form data or individual elements. Takes the following actions\n * on the selected tags:\n * - all fields within form elements will be reset to their original value\n * - input / textarea / select fields will be reset to their original value\n * - option / optgroup fields (for multi-selects) will defaulted individually\n * - non-multiple options will find the right select to default\n * - label elements will be searched against its 'for' attribute\n * - all others will be searched for appropriate children to default\n */\n $.fn.resetForm = function () {\n return this.each(function () {\n var el = $(this);\n var tag = tagName(this);\n\n switch (tag) {\n case \"input\":\n this.checked = this.defaultChecked;\n\n // as the native reset: types whose value is the value attribute keep it\n if (this.type === \"file\") {\n // a file input cannot take its value attribute; the native reset empties it\n this.value = \"\";\n } else if (!/^(?:checkbox|radio|hidden|submit|reset|button|image)$/.test(this.type)) {\n this.value = this.defaultValue;\n }\n\n return true;\n\n case \"textarea\":\n this.value = this.defaultValue;\n\n return true;\n\n case \"option\":\n case \"optgroup\":\n var select = el.parents(\"select\");\n\n if (select.length && select[0].multiple) {\n if (tag === \"option\") {\n this.selected = this.defaultSelected;\n } else {\n el.find(\"option\").resetForm();\n }\n } else {\n select.resetForm();\n }\n\n return true;\n\n case \"select\":\n // in order, as the native reset: of several default options, a single select keeps the last\n el.find(\"option\").each(function () {\n this.selected = this.defaultSelected;\n });\n\n return true;\n\n case \"label\":\n // The control whose id the for attribute names, and the controls inside the label. The\n // filter keeps a for that names an ancestor from resetting the label again.\n var forEl = this.htmlFor && this.ownerDocument.getElementById(this.htmlFor);\n\n el.find(\"input,select,textarea\").add(forEl).filter(\"input,select,textarea\").resetForm();\n\n return true;\n\n case \"form\":\n // through the prototype: a control named reset shadows the method\n callFormMethod(this, \"reset\");\n\n return true;\n\n default:\n el.find(\"form,input,label,select,textarea\").resetForm();\n\n return true;\n }\n });\n };\n\n /**\n * Enables or disables any matching elements.\n */\n $.fn.enable = function (b) {\n if (typeof b === \"undefined\") {\n b = true;\n }\n\n return this.each(function () {\n this.disabled = !b;\n });\n };\n\n /**\n * Checks/unchecks any matching checkboxes or radio buttons and\n * selects/deselects and matching option elements.\n */\n $.fn.selected = function (select) {\n if (typeof select === \"undefined\") {\n select = true;\n }\n\n return this.each(function () {\n var t = this.type;\n\n if (t === \"checkbox\" || t === \"radio\") {\n this.checked = select;\n } else if (tagName(this) === \"option\") {\n var $sel = $(this).parent(\"select\");\n\n if (select && $sel[0] && $sel[0].type === \"select-one\") {\n // deselect all other options\n $sel.find(\"option\").selected(false);\n }\n\n this.selected = select;\n }\n });\n };\n\n // expose debug var\n $.fn.ajaxSubmit.debug = false;\n})(jQuery);\n\nexport default jQuery;\n"],"names":["owners","plainForm","document","createElement","findDescriptor","name","i","length","owner","window","descriptor","Object","getOwnPropertyDescriptor","prototype","formMember","form","get","call","e","callFormMethod","value","apply","Array","slice","arguments","tagName","el","toLowerCase","isElement","node","assertRealParent","parentNode","Error","closestByTag","names","indexOf","storeKey","setExpando","ignore","expando","els","namedItem","undefined","record","x","y","jQuery","data","type","setTimeout","captureSubmitter","target","point","offsetX","offsetY","fn","offset","pageX","left","pageY","top","offsetLeft","offsetTop","imagePoint","submitterOf","stored","log","ajaxSubmit","debug","msg","join","console","opera","postError","warned","deprecate","id","message","warn","deprecateOldJQuery","version","parts","String","split","major","Number","beforeJQuery35","shorthandOptions","options","dataType","onSuccess","result","url","success","submitOptions","key","hasOwnProperty","withoutUrl","keepContext","settings","sources","context","submitWith","isDefaultPrevented","preventDefault","originalEvent","submitter","captureEventSubmitter","doAjaxSubmit","captureSubmittingElement","this","bindDelegated","$sel","selector","off","on","closestMatch","Element","closest","is","delegated","unbindSelector","handlers","submit","click","selectionOnly","ajaxForm","jquery","delegation","bindSelector","beforeFormUnbind","ajaxFormUnbind","o","s","c","isReady","bindLater","formAttribute","attr","rLineBreak","rCR","rUnsubmittable","isDisabled","matches","disabled","valueOf","index","selectedIndex","a","ops","one","max","op","selected","v","attributes","specified","text","push","selectValue","val","raw","replace","loneSurrogate","wellFormed","match","before","urlencodedFields","fields","map","field","createSuccessfulControls","feature","$","controlsOf","semantic","formId","getElementsByTagName","makeArray","grep","ownedBy","test","navigator","userAgent","concat","filter","getAttribute","inArray","outsideControls","fieldsOf","n","fieldValue","constructor","fileapi","files","file","required","imageFields","sub","input","addCandidate","collected","own","controls","collect","filtering","addClickedImage","deepSerialize","extraData","traditional","part","param","serialized","len","decodeURIComponent","sendFormData","submission","formdata","FormData","append","serializedData","extend","ajaxSettings","contentType","processData","cache","method","uploadProgress","createXhr","xhr","upload","addEventListener","event","percent","position","loaded","total","lengthComputable","Math","ceil","beforeSend","formData","ajax","sendAjax","uploadAttributes","hasOwn","isGet","addSubmitterFields","submitterFields","addCsrfField","forms","origin","csrf_token","csrf_param","posts","property","href","location","protocol","host","setFormAttribute","getDoc","frame","doc","contentWindow","err","contentDocument","readStatus","status","statusText","readResponse","retry","errMsg","isXml","XMLDocument","isXMLDoc","body","innerHTML","docRoot","documentElement","responseText","responseXML","getResponseHeader","header","readDocument","dt","scr","textarea","ta","pre","b","textContent","innerText","readEmbedded","ct","xml","nodeName","error","dataFilter","JSON","parse","globalEval","httpData","createLifecycle","g","timeoutHandle","callbackProcessed","deferred","Deferred","aborted","getAllResponseHeaders","setRequestHeader","abort","done","rejection","textStatus","stop","reject","trigger","complete","endGlobalEvents","active","clearTimeout","release","settle","failure","resolve","succeed","start","global","fail","startTimer","onTimeout","timeout","stopTimer","createIframeTransport","hasProp","frameCount","fileUploadIframe","ownerDocument","$body","$io","iframeTarget","each","nameWindow","io","setAttribute","iframeSrc","css","createFrame","Date","getTime","life","execCommand","remove","frameHooks","domCheckCount","checkState","state","readyState","cb","doSubmit","saved","saveAttributes","mp","skipEncodingOverride","setUploadAttributes","extraInputs","added","addHiddenInput","appendTo","isPlainObject","single","f","addExtraInputs","root","contains","notInDocument","attachEvent","listen","submitForm","restoreAttributes","detachEvent","removeEventListener","unlisten","post","forceSync","jqxhr","elements","prop","removeAttr","enableControls","closeKeepAlive","createSubmission","serialization","refuse","extraQuery","optionsData","requestFormat","query","pairs","at","decodeQuery","queryPairs","defineKey","object","defineProperty","enumerable","writable","configurable","callbackList","callback","isArray","callEach","callbacks","args","prepare","$set","action","trim","URL","withDefaults","defaultType","veto","beforeSerialize","qx","beforeSubmit","resolved","resolveMethod","extra","stringify","jsonBody","q","toUpperCase","hashAt","base","encode","$form","deliver","resetForm","clearForm","includeHidden","successes","jqXHR","successArguments","replaceTarget","$target","merge","errors","completes","chooseTransport","hasFileInputs","add","multipart","attribute","fileAPI","shouldUseFrame","transport","iframe","steps","transports","attr2","removeData","k","formToArray","formSerialize","fieldSerialize","successful","t","checked","isSuccessful","clearFields","clearInputs","re","tag","replaceWith","clone","defaultChecked","defaultValue","select","parents","multiple","defaultSelected","find","forEl","htmlFor","getElementById","enable","parent"],"mappings":";;;;;;;;;;;;;;;;;;;;;4ZAMIA,EAAS,CAAC,kBAAmB,cAAe,UAAW,QAGvDC,EAAYC,EAASC,cAAc,QAEvC,SAASC,EAAeC,GACtB,IAAK,IAAIC,EAAI,EAAGA,EAAIN,EAAOO,OAAQD,IAAK,CACtC,IAAIE,EAAQC,EAAOT,EAAOM,IACtBI,EAAaF,GAASG,OAAOC,yBAAyBJ,EAAMK,UAAWR,GAE3E,GAAIK,EACF,OAAOA,CAEX,CAEA,OAAO,IACT,CAOO,SAASI,EAAWC,EAAMV,GAC/B,IAAIK,EAAaN,EAAeC,GAEhC,IACE,OAAOK,EAAWM,IAAIC,KAAKF,EAC7B,CAAE,MAAOG,GACP,OAAOH,EAAKV,EACd,CACF,CAMO,SAASc,EAAeJ,EAAMV,GACnC,IAAIK,EAAaN,EAAeC,GAGhC,OAFaK,EAAaA,EAAWU,MAAQnB,EAAUI,IAEzCgB,MAAMN,EAAMO,MAAMT,UAAUU,MAAMN,KAAKO,UAAW,GAClE,CAGO,SAASC,EAAQC,GACtB,IAAIrB,EAAOS,EAAWY,EAAI,WAE1B,MAAuB,iBAATrB,EAAoBA,EAAKsB,cAAgB,EACzD,CAGO,SAASC,EAAUC,GACxB,OAAwC,IAAjCf,EAAWe,EAAM,WAC1B,CAIO,SAASC,EAAiBJ,GAC/B,GAAIA,EAAGK,aAAejB,EAAWY,EAAI,cACnC,MAAM,IAAIM,MACR,kGAGN,CAGO,SAASC,EAAaP,EAAIQ,GAC/B,IAAK,IAAIL,EAAOH,EAAIG,EAAMA,EAAOf,EAAWe,EAAM,cAChD,GAAIK,EAAMC,QAAQV,EAAQI,KAAU,EAClC,OAAOA,EAIX,OAAO,IACT,CC1EA,IAAIO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3c,EAAGyc,KAAK,yBAAyB/B,IAAIgC,GAAO3S,OAAO,yBAAyB8P,aAErE,EAET,IAAK,OAIH,OAFApa,EAAe2F,KAAM,UAEd,EAET,QAGE,OAFApF,EAAGyc,KAAK,oCAAoC5C,aAErC,EAEb,EACF,EAKA1Q,EAAEtH,GAAGgb,OAAS,SAAUrM,GAKtB,YAJiB,IAANA,IACTA,GAAI,GAGCpL,KAAKyO,KAAK,WACfzO,KAAKkC,UAAYkJ,CACnB,EACF,EAMArH,EAAEtH,GAAGkG,SAAW,SAAUsU,GAKxB,YAJsB,IAAXA,IACTA,GAAS,GAGJjX,KAAKyO,KAAK,WACf,IAAI6H,EAAItW,KAAK9D,KAEb,GAAU,aAANoa,GAA0B,UAANA,EACtBtW,KAAKuW,QAAUU,OACV,GAAsB,WAAlBtc,EAAQqF,MAAoB,CACrC,IAAIE,EAAO6D,EAAE/D,MAAM0X,OAAO,UAEtBT,GAAU/W,EAAK,IAAuB,eAAjBA,EAAK,GAAGhE,MAE/BgE,EAAKmX,KAAK,UAAU1U,UAAS,GAG/B3C,KAAK2C,SAAWsU,CAClB,CACF,EACF,EAGAlT,EAAEtH,GAAGY,WAAWC,OAAQ,CACzB,CAlcD,CAkcGtB"} \ No newline at end of file +{"version":3,"file":"jquery.form.min.js","sources":["../src/form-members.js","../src/submitter.js","../src/diagnostics.js","../src/options.js","../src/ajax-form.js","../src/form-attributes.js","../src/successful-controls.js","../src/xhr-transport.js","../src/iframe-post.js","../src/iframe-response.js","../src/iframe-lifecycle.js","../src/iframe-transport.js","../src/submission.js","../src/jquery.form.js"],"sourcesContent":["// Form members: the properties and methods the plugin reads or calls on a form. A control named\n// like a member (elements, setAttribute) shadows that member on the form itself, so members are\n// read through the DOM prototypes, which a control cannot shadow.\n\n// The prototype chain of a form, nearest first. Looked up on every call: old browsers have no\n// DOM prototypes, and tests remove them.\nvar owners = [\"HTMLFormElement\", \"HTMLElement\", \"Element\", \"Node\"];\n\n// A form no control can shadow, for methods when the DOM has no prototypes to read them from.\nvar plainForm = document.createElement(\"form\");\n\nfunction findDescriptor(name) {\n for (var i = 0; i < owners.length; i++) {\n var owner = window[owners[i]];\n var descriptor = owner && Object.getOwnPropertyDescriptor(owner.prototype, name);\n\n if (descriptor) {\n return descriptor;\n }\n }\n\n return null;\n}\n\n/**\n * Reads a member of a form through its prototype getter.\n * Falls back to the plain property without DOM prototypes, or on an element the getter does not\n * accept (such as a fieldset for `elements`).\n */\nexport function formMember(form, name) {\n var descriptor = findDescriptor(name);\n\n try {\n return descriptor.get.call(form);\n } catch (e) {\n return form[name];\n }\n}\n\n/**\n * Calls a method of a form through its prototype, or through an unshadowed form without DOM\n * prototypes.\n */\nexport function callFormMethod(form, name) {\n var descriptor = findDescriptor(name);\n var method = descriptor ? descriptor.value : plainForm[name];\n\n return method.apply(form, Array.prototype.slice.call(arguments, 2));\n}\n\n// Nodes such as the document and text nodes have no tag name (#600).\nexport function tagName(el) {\n var name = formMember(el, \"tagName\");\n\n return typeof name === \"string\" ? name.toLowerCase() : \"\";\n}\n\n// Elements only: the subject of formToArray may also be the document or a plain object.\nexport function isElement(node) {\n return formMember(node, \"nodeType\") === 1;\n}\n\n// A control named parentNode makes every parentNode walk (jQuery's trigger and closest among\n// them) cycle between the form and the control.\nexport function assertRealParent(el) {\n if (el.parentNode !== formMember(el, \"parentNode\")) {\n throw new Error(\n 'jquery.form: a form control named \"parentNode\" hides the form\\'s parentNode; rename the control'\n );\n }\n}\n\n// The element itself or its nearest ancestor with one of the tag names, through the real tree.\nexport function closestByTag(el, names) {\n for (var node = el; node; node = formMember(node, \"parentNode\")) {\n if (names.indexOf(tagName(node)) >= 0) {\n return node;\n }\n }\n\n return null;\n}\n","import { closestByTag, formMember } from \"./form-members.js\";\nimport jQuery from \"jquery\";\n\n// The submitter: the button that submitted a form, captured from ajaxForm's clicks. It is kept in\n// a private store and cleared shortly after the click. The form's clk, clk_x and clk_y properties\n// are still written for pages that read them, and read when the store has none.\n\nvar storeKey = \"jqFormSubmitter\";\n\n// Writes a property on the form; a control with that name makes it read-only.\nfunction setExpando(form, name, value) {\n try {\n form[name] = value;\n } catch (ignore) {\n // the control keeps the name; the store has the submitter\n }\n}\n\n// A property the page set on the form, never a control of the form with that name.\nfunction expando(form, name) {\n var value = form[name];\n var els = formMember(form, \"elements\");\n\n return els && value && els.namedItem(name) === value ? undefined : value;\n}\n\n// Records a submitter for a form until the click window ends.\nfunction record(form, el, x, y) {\n jQuery.data(form, storeKey, { el: el, x: x, y: y });\n setExpando(form, \"clk\", el);\n\n if (el.type === \"image\") {\n setExpando(form, \"clk_x\", x);\n setExpando(form, \"clk_y\", y);\n }\n\n // clear form vars\n setTimeout(function () {\n jQuery.data(form, storeKey, null);\n setExpando(form, \"clk\", null);\n setExpando(form, \"clk_x\", null);\n setExpando(form, \"clk_y\", null);\n }, 100);\n}\n\n// The clicked point of an image button, relative to the image.\nfunction imagePoint(e, target) {\n if (typeof e.offsetX !== \"undefined\") {\n return [e.offsetX, e.offsetY];\n }\n\n if (typeof jQuery.fn.offset === \"function\") {\n var offset = jQuery(target).offset();\n\n return [e.pageX - offset.left, e.pageY - offset.top];\n }\n\n return [e.pageX - target.offsetLeft, e.pageY - target.offsetTop];\n}\n\n/**\n * Records the submit or image button a click event reached, for the form it belongs to.\n */\nexport function captureSubmitter(e) {\n // the clicked control, or the button around the clicked content (ex: a span within a button)\n var target = closestByTag(e.target, [\"button\", \"input\"]);\n\n // the type property, unlike the attribute, is \"submit\" for a button without a type (#588)\n if (!target || (target.type !== \"submit\" && target.type !== \"image\")) {\n return;\n }\n\n var form = target.form;\n\n if (!form) {\n // a submit control that belongs to no form\n return;\n }\n\n var point = target.type === \"image\" ? imagePoint(e, target) : [];\n\n record(form, target, point[0], point[1]);\n}\n\n/**\n * Records the submitter a submit event names (SubmitEvent.submitter), when no click was captured.\n * An image submitter gets the point 0,0, as native submission sends it without a click.\n */\nexport function captureEventSubmitter(e, form) {\n var el = e.originalEvent && e.originalEvent.submitter;\n\n if (el && !submitterOf(form)) {\n record(form, el, 0, 0);\n }\n}\n\n/**\n * The form's submitter as { el, x, y } (x and y for an image button), or null.\n */\nexport function submitterOf(form) {\n if (!form) {\n return null;\n }\n\n var stored = jQuery.data(form, storeKey);\n\n if (stored) {\n return stored;\n }\n\n var el = expando(form, \"clk\");\n\n return el ? { el: el, x: expando(form, \"clk_x\"), y: expando(form, \"clk_y\") } : null;\n}\n\n/**\n * The submitter's fields for a post that adds them itself (the iframe upload), as name β†’ value.\n */\nexport function submitterFields(form) {\n var fields = {};\n var sub = submitterOf(form);\n var el = sub && sub.el;\n\n if (el && el.name && !el.disabled) {\n fields[el.name] = el.value;\n if (el.type === \"image\") {\n fields[el.name + \".x\"] = sub.x;\n fields[el.name + \".y\"] = sub.y;\n }\n }\n\n return fields;\n}\n\n/**\n * The form's submitter element, or null.\n */\nexport function submitterElement(form) {\n var sub = submitterOf(form);\n\n return sub ? sub.el : null;\n}\n","import jQuery from \"jquery\";\n\n// Debug logging, switched on by $.fn.ajaxSubmit.debug. The flag is read on every call, so it can\n// be turned on after the plugin loads.\nexport function log() {\n if (!jQuery.fn.ajaxSubmit.debug) {\n return;\n }\n\n var msg = \"[jquery.form] \" + Array.prototype.join.call(arguments, \"\");\n\n if (window.console && window.console.log) {\n window.console.log(msg);\n } else if (window.opera && window.opera.postError) {\n window.opera.postError(msg);\n }\n}\n\nvar warned = {};\n\n/**\n * A deprecation warning: console.warn, only while debug is on, once per id per page. The message\n * names the replacement; the warning adds that the feature is removed in 5.0.\n */\nexport function deprecate(id, message) {\n if (!jQuery.fn.ajaxSubmit.debug || warned[id]) {\n return;\n }\n\n warned[id] = true;\n\n if (window.console && typeof window.console.warn === \"function\") {\n window.console.warn(\"[jquery.form] \" + message + \" (removed in 5.0)\");\n }\n}\n\n// Forgets which deprecations have warned (for tests).\nexport function resetDeprecations() {\n warned = {};\n}\n\n// True for a jQuery version string older than 3.5.\nexport function beforeJQuery35(version) {\n var parts = String(version).split(\".\");\n var major = Number(parts[0]);\n\n return major < 3 || (major === 3 && Number(parts[1]) < 5);\n}\n\n// 5.0 needs jQuery 3.5 or later: warned on the first ajaxSubmit or ajaxForm, given jQuery's version.\nexport function deprecateOldJQuery(version) {\n if (beforeJQuery35(version)) {\n deprecate(\n \"jquery\",\n \"support for jQuery \" + version + \" is deprecated, 5.0 needs jQuery 3.5 or later\"\n );\n }\n}\n","// The arguments ajaxSubmit and ajaxForm accept in place of an options object.\n\n/**\n * Turns the (url, data, dataType, success) shorthand into options. A url of false is kept as\n * the url; anything else is returned as given.\n */\nexport function shorthandOptions(options, data, dataType, onSuccess) {\n if (typeof options !== \"string\" && options !== false) {\n return options;\n }\n\n var result = { url: options, data: data, dataType: dataType };\n\n if (typeof onSuccess === \"function\") {\n result.success = onSuccess;\n }\n\n return result;\n}\n\n// A copy of options without its url, so the form action is used.\nfunction withoutUrl(options) {\n var result = {};\n\n for (var key in options) {\n if (key !== \"url\" && Object.prototype.hasOwnProperty.call(options, key)) {\n result[key] = options[key];\n }\n }\n\n return result;\n}\n\n/**\n * The options ajaxSubmit starts from: a function is the success callback, the shorthand is\n * expanded, and no options at all is an empty object. A url of false or \"\" means the form action.\n */\nexport function submitOptions(options, data, dataType, onSuccess) {\n if (typeof options === \"function\") {\n return { success: options };\n }\n\n options = shorthandOptions(options, data, dataType, onSuccess);\n\n if (typeof options === \"undefined\") {\n return {};\n }\n\n return options.url === false || options.url === \"\" ? withoutUrl(options) : options;\n}\n\n/**\n * jQuery treats `context` as a flat option: after a deep merge, the settings get back the\n * caller's own object from the last source that has one, so `this` in callbacks is that object.\n */\nexport function keepContext(settings, sources) {\n for (var i = 0; i < sources.length; i++) {\n if (sources[i].context !== undefined) {\n settings.context = sources[i].context;\n }\n }\n\n return settings;\n}\n","import { assertRealParent, closestByTag, formMember, isElement } from \"./form-members.js\";\nimport { captureEventSubmitter, captureSubmitter } from \"./submitter.js\";\nimport { deprecate, deprecateOldJQuery, log } from \"./diagnostics.js\";\nimport jQuery from \"jquery\";\nimport { shorthandOptions } from \"./options.js\";\n\n// ajaxForm binding: the submit and click handlers that send a form through ajaxSubmit. The\n// handlers look up $.fn.ajaxSubmit when they run, so a replacement installed later is used.\n\n// Sends the submit event's form with ajaxSubmit, unless an earlier handler cancelled it.\nfunction submitWith(e, options) {\n if (!e.isDefaultPrevented()) {\n // if event has been canceled, don't proceed\n e.preventDefault();\n // the form is found through the real tree: a control named nodeType misleads jQuery's closest\n var form = closestByTag(e.target, [\"form\"]);\n\n // a button outside the form (form attribute), or requestSubmit(button), sends no click here\n captureEventSubmitter(e, form);\n jQuery(form).ajaxSubmit(options); // #365\n }\n}\n\nfunction doAjaxSubmit(e) {\n submitWith(e, e.data);\n}\n\nfunction captureSubmittingElement(e) {\n /* jshint validthis:true */\n assertRealParent(this);\n captureSubmitter(e);\n}\n\n// An empty selection: queued until the DOM is ready (old jQuery keeps the selector), or dropped.\nfunction bindLater($sel, options) {\n var o = { s: $sel.selector, c: $sel.context };\n\n if (!jQuery.isReady && o.s) {\n log(\"DOM not ready, queuing ajaxForm\");\n deprecate(\n \"queue\",\n \"queuing ajaxForm until the DOM is ready is deprecated, call ajaxForm inside $(fn) \" +\n 'or use delegation: \"\"'\n );\n jQuery(function () {\n jQuery(o.s, o.c).ajaxForm(options);\n });\n\n return $sel;\n }\n\n // is your DOM ready? http://docs.jquery.com/Tutorials:Introducing_$(document).ready()\n log(\"terminating; zero elements found by selector\" + (jQuery.isReady ? \"\" : \" (DOM not ready)\"));\n\n return $sel;\n}\n\n// delegation: true on jQuery 3 and later, where the selection has no selector: always warned,\n// debug or not, once per ajaxForm call.\nfunction warnUnscoped() {\n var console = window.console || {};\n\n if (typeof console.warn === \"function\") {\n console.warn(\n \"[jquery.form] delegation: true binds every form on the page on jQuery 3 and later; \" +\n 'pass a selector instead, e.g. delegation: \"form.ajax\"'\n );\n }\n}\n\nfunction bindDelegated($sel, options) {\n if ($sel.selector === undefined) {\n warnUnscoped();\n }\n\n jQuery(document)\n .off(\"submit.form-plugin\", $sel.selector, doAjaxSubmit)\n .off(\"click.form-plugin\", $sel.selector, captureSubmittingElement)\n .on(\"submit.form-plugin\", $sel.selector, options, doAjaxSubmit)\n .on(\"click.form-plugin\", $sel.selector, options, captureSubmittingElement);\n\n return $sel;\n}\n\n// The element itself or its nearest ancestor that matches the selector. The walk never reads a\n// parentNode a control can hide (jQuery's delegated walk does, and cycles on such a form).\nfunction closestMatch(el, selector) {\n if (!isElement(el)) {\n return null;\n }\n\n if (window.Element && Element.prototype.closest) {\n return Element.prototype.closest.call(el, selector);\n }\n\n for (var node = el; node && isElement(node); node = formMember(node, \"parentNode\")) {\n if (jQuery(node).is(selector)) {\n return node;\n }\n }\n\n return null;\n}\n\n// The document handlers bound for each delegation selector, keyed by \"s\" + selector.\nvar delegated = {};\n\nfunction unbindSelector(selector) {\n var handlers = delegated[\"s\" + selector];\n\n if (handlers) {\n jQuery(document)\n .off(\"submit.form-plugin\", handlers.submit)\n .off(\"click.form-plugin\", handlers.click);\n delete delegated[\"s\" + selector];\n }\n}\n\n// delegation: \"\": one handler pair on the document, scoped to the selector.\nfunction bindSelector($sel, selector, options) {\n if (!selector) {\n throw new Error(\"jquery.form: delegation needs a selector, or true\");\n }\n\n var handlers = {\n submit: function (e) {\n if (closestMatch(e.target, selector)) {\n submitWith(e, options);\n }\n },\n click: function (e) {\n if (closestMatch(e.target, selector)) {\n captureSubmitter(e);\n }\n },\n };\n\n unbindSelector(selector);\n delegated[\"s\" + selector] = handlers;\n jQuery(document)\n .on(\"submit.form-plugin\", handlers.submit)\n .on(\"click.form-plugin\", handlers.click);\n\n return $sel;\n}\n\n// Passed by ajaxForm's own rebind: unbind the selection only, never the document handlers.\nvar selectionOnly = {};\n\n/**\n * ajaxForm() binds the selected forms so a submit is sent with ajaxSubmit, with the clicked\n * submit button (and image coordinates) included. The options work as for ajaxSubmit.\n */\nexport function ajaxForm(options, data, dataType, onSuccess) {\n deprecateOldJQuery(jQuery.fn.jquery);\n options = shorthandOptions(options, data, dataType, onSuccess) || {};\n\n if (typeof options.delegation === \"string\") {\n return bindSelector(this, options.delegation, options);\n }\n\n options.delegation = options.delegation && typeof jQuery.fn.on === \"function\";\n\n if (!options.delegation && this.length === 0) {\n return bindLater(this, options);\n }\n\n if (options.delegation) {\n return bindDelegated(this, options);\n }\n\n if (options.beforeFormUnbind) {\n options.beforeFormUnbind(this, options);\n }\n\n return this.ajaxFormUnbind(selectionOnly)\n .on(\"submit.form-plugin\", options, doAjaxSubmit)\n .on(\"click.form-plugin\", options, captureSubmittingElement);\n}\n\n/**\n * ajaxFormUnbind() removes the handlers ajaxForm bound on the selection and every delegated\n * binding on the document. ajaxFormUnbind(selector) removes only that delegation selector.\n */\nexport function ajaxFormUnbind(selector) {\n if (typeof selector === \"string\") {\n unbindSelector(selector);\n\n return this;\n }\n\n if (selector !== selectionOnly) {\n delegated = {};\n jQuery(document).off(\"submit.form-plugin click.form-plugin\");\n }\n\n return this.off(\"submit.form-plugin click.form-plugin\");\n}\n","import { callFormMethod, isElement } from \"./form-members.js\";\nimport jQuery from \"jquery\";\n\n/**\n * An attribute of a form, or undefined when it is absent, as jQuery's attr returns it. The\n * subject may also be the document or a plain object, read through jQuery.\n */\nexport function formAttribute(form, name) {\n if (!isElement(form)) {\n return jQuery(form).attr(name);\n }\n\n var value = callFormMethod(form, \"getAttribute\", name);\n\n return value === null ? undefined : value;\n}\n","import { callFormMethod, formMember, isElement, tagName } from \"./form-members.js\";\nimport { formAttribute } from \"./form-attributes.js\";\nimport jQuery from \"jquery\";\nimport { submitterOf } from \"./submitter.js\";\n\n// Successful controls: which controls of a form are sent, and as which name/value fields\n// (https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#constructing-the-form-data-set).\n\n// Line breaks, sent as CRLF\nvar rLineBreak = /\\r\\n|\\r|\\n/g;\nvar rCR = /\\r/g;\n\n// Listed form elements that are never submitted.\nvar rUnsubmittable = /^(?:fieldset|object|output)$/;\n\n/**\n * Whether a control or option is disabled, also through a disabled fieldset or optgroup. Without\n * selector matching, only its own disabled property is read.\n */\nfunction isDisabled(el) {\n return typeof el.matches === \"function\" ? el.matches(\":disabled\") : !!el.disabled;\n}\n\n/**\n * The successful-control rule: whether a control is sent. `submitter` is the button that\n * submitted the control's form; other submit and image buttons of a form are not sent.\n */\nexport function isSuccessful(el, submitter) {\n var t = el.type;\n\n if (!el.name || isDisabled(el) || t === \"reset\" || t === \"button\") {\n return false;\n }\n\n if (t === \"checkbox\" || t === \"radio\") {\n return !!el.checked;\n }\n\n if (t === \"submit\" || t === \"image\") {\n return !el.form || submitter === el;\n }\n\n return tagName(el) !== \"select\" || el.selectedIndex !== -1;\n}\n\n// The value of a select: the selected option's value for one, a list for several.\nfunction selectValue(el) {\n var index = el.selectedIndex;\n\n if (index < 0) {\n return null;\n }\n\n var a = [],\n ops = el.options;\n var one = el.type === \"select-one\";\n var max = one ? index + 1 : ops.length;\n\n for (var i = one ? index : 0; i < max; i++) {\n var op = ops[i];\n\n if (op.selected && !isDisabled(op)) {\n var v = op.value;\n\n if (!v) {\n // extra pain for IE...\n v =\n op.attributes && op.attributes.value && !op.attributes.value.specified\n ? op.text\n : op.value;\n }\n\n if (one) {\n return v;\n }\n\n a.push(v);\n }\n }\n\n return a;\n}\n\n/**\n * The value of a control, whether or not it is successful: a list for a multiple select, null\n * for a select with nothing selected, otherwise a string with CRLF line breaks (a lone CR or LF\n * included).\n */\nexport function valueOf(el) {\n if (tagName(el) === \"select\") {\n return selectValue(el);\n }\n\n var v = jQuery(el).val();\n var raw = el.value;\n\n // jQuery before 4.0 drops carriage returns from .val(); read them from the value itself\n if (typeof raw === \"string\" && raw.replace(rCR, \"\") === v) {\n v = raw;\n }\n\n return v.replace(rLineBreak, \"\\r\\n\");\n}\n\n/**\n * The fields as a urlencoded body sends them: a selected file as its name.\n */\n// A lone surrogate becomes U+FFFD, as in a native submission; jQuery.param would throw.\nvar loneSurrogate = /[\\uD800-\\uDBFF](?![\\uDC00-\\uDFFF])|([^\\uD800-\\uDBFF]|^)([\\uDC00-\\uDFFF])/g;\n\nexport function wellFormed(value) {\n return typeof value === \"string\"\n ? value.replace(loneSurrogate, function (match, before) {\n return (before || \"\") + \"\\uFFFD\";\n })\n : value;\n}\n\n// jQuery 3 dropped $.param's \"+\" for a space; a native submission still sends \"+\". Only a space\n// encodes as %20, since a literal % encodes as %25.\nexport function urlencode(fields, traditional) {\n return jQuery.param(urlencodedFields(fields), traditional).replace(/%20/g, \"+\");\n}\n\nexport function urlencodedFields(fields) {\n return jQuery.map(fields, function (field) {\n var value =\n field.type === \"file\" && typeof field.value !== \"string\" ? field.value.name : field.value;\n var name = wellFormed(field.name);\n value = wellFormed(value);\n\n return name === field.name && value === field.value ? field : { name: name, value: value };\n });\n}\n\n/**\n * The serialization steps. `feature` holds what the entry detected at load (fileapi).\n */\nexport function createSuccessfulControls(feature) {\n var $ = jQuery;\n\n // #386; inputs that name the form in their form attribute, other than the candidates found.\n // A form only gets the ones it owns.\n function outsideControls(formId, els, owner) {\n // hat tip @thet; the id is compared, never built into a selector\n return $(\":input[form]\")\n .filter(function () {\n return (\n this.getAttribute(\"form\") === formId &&\n (!owner || this.form === owner) &&\n $.inArray(this, els) < 0\n );\n })\n .get();\n }\n\n // A descendant of a form is a candidate unless it is a control another form owns.\n function ownedBy(els, owner) {\n return $.grep(els, function (el) {\n return typeof el.form === \"undefined\" || el.form === owner;\n });\n }\n\n /**\n * The candidate controls of a form, in order: its elements, or every descendant it owns in\n * semantic mode, then the outside controls it owns that name it.\n */\n function controlsOf(form, semantic) {\n var formId = formAttribute(form, \"id\");\n var els = formMember(form, \"elements\");\n\n if (semantic || typeof els === \"undefined\") {\n // the document is not an element; it has its own getElementsByTagName\n els = isElement(form)\n ? callFormMethod(form, \"getElementsByTagName\", \"*\")\n : form.getElementsByTagName(\"*\");\n }\n\n els = $.makeArray(els);\n\n // the subject may also be a fieldset, the document or another container\n var owner = tagName(form) === \"form\" ? form : null;\n\n if (semantic && owner) {\n els = ownedBy(els, owner);\n }\n\n // FinesseRus: in non-IE browsers outside fields are already included in form.elements.\n if (formId && (semantic || /(Edge|Trident)\\//.test(navigator.userAgent))) {\n els = els.concat(outsideControls(formId, els, owner));\n }\n\n return els;\n }\n\n // The fields of a control's value, or null when the control is not sent.\n function fieldsOf(el) {\n var n = el.name;\n // read at call time, so a page that replaces $.fieldValue changes what is sent\n var v = $.fieldValue(el, true);\n\n if (v && v.constructor === Array) {\n return $.map(v, function (value) {\n return { name: n, value: value };\n });\n }\n\n if (feature.fileapi && el.type === \"file\") {\n var files = el.files;\n\n // #180: an empty field when no file is selected\n return files.length\n ? $.map(files, function (file) {\n return { name: n, value: file, type: el.type };\n })\n : [{ name: n, value: \"\", type: el.type }];\n }\n\n if (v === null || typeof v === \"undefined\") {\n return null;\n }\n\n return [{ name: n, value: v, type: el.type, required: el.required }];\n }\n\n // The clicked image's value and coordinates.\n function imageFields(sub, input, type) {\n var n = input.name;\n var value = { name: n, value: $(input).val() };\n\n if (type) {\n value.type = type;\n }\n\n return [value, { name: n + \".x\", value: sub.x }, { name: n + \".y\", value: sub.y }];\n }\n\n // Adds one candidate control's fields, and the control when it has a value to send.\n function addCandidate(collected, form, el, semantic) {\n if (!el.name || isDisabled(el) || rUnsubmittable.test(tagName(el))) {\n return;\n }\n\n var sub = semantic && el.type === \"image\" && submitterOf(form);\n\n if (sub) {\n // handle image inputs on the fly when semantic == true\n if (sub.el === el) {\n collected.fields.push.apply(collected.fields, imageFields(sub, el, el.type));\n }\n\n return;\n }\n\n var own = fieldsOf(el);\n\n if (own) {\n collected.controls.push(el);\n collected.fields.push.apply(collected.fields, own);\n }\n }\n\n // input type=='image' are not found in elements array! handle it here\n function addClickedImage(collected, form) {\n var sub = submitterOf(form);\n var input = sub && $(sub.el)[0];\n\n if (input && input.name && !isDisabled(input) && input.type === \"image\") {\n collected.fields.push.apply(collected.fields, imageFields(sub, input));\n }\n }\n\n /**\n * The fields of a form, as formToArray returns them, and the controls they came from.\n */\n function collect(form, semantic, filtering) {\n var collected = { fields: [], controls: [] };\n\n if (!form) {\n return collected;\n }\n\n var els = controlsOf(form, semantic);\n\n if (typeof filtering === \"function\") {\n els = $.map(els, filtering);\n }\n\n for (var i = 0; i < els.length; i++) {\n addCandidate(collected, form, els[i], semantic);\n }\n\n if (!semantic) {\n addClickedImage(collected, form);\n }\n\n return collected;\n }\n\n return {\n controlsOf: controlsOf,\n fieldsOf: fieldsOf,\n collect: collect,\n };\n}\n","import jQuery from \"jquery\";\nimport { keepContext } from \"./options.js\";\n\n// The XMLHttpRequest transports: $.ajax with the encoded fields, or FormData for file uploads.\nvar $ = jQuery;\n\n// utility fn for deep serialization: [name, value] pairs, as $.param encodes them\nexport function deepSerialize(extraData, traditional) {\n var param = $.param(extraData, traditional);\n var serialized = param ? param.split(\"&\") : [];\n var len = serialized.length;\n var result = [];\n var i, part;\n\n for (i = 0; i < len; i++) {\n // #252; undo param space replacement\n serialized[i] = serialized[i].replace(/\\+/g, \" \");\n part = serialized[i].split(\"=\");\n // #278; use array instead of object storage, favoring array serializations\n result.push([decodeURIComponent(part[0]), decodeURIComponent(part[1])]);\n }\n\n return result;\n}\n\n/**\n * Posts the fields and extraData as FormData, for files with the File API.\n * XMLHttpRequest Level 2 file uploads (big hat tip to francois2metz)\n */\nexport function sendFormData(submission) {\n var options = submission.options;\n var a = submission.fields;\n\n var formdata = new FormData();\n\n for (var i = 0; i < a.length; i++) {\n formdata.append(a[i].name, a[i].value);\n }\n\n if (options.extraData) {\n var serializedData = deepSerialize(options.extraData, submission.traditional);\n\n for (i = 0; i < serializedData.length; i++) {\n formdata.append(serializedData[i][0], serializedData[i][1]);\n }\n }\n\n options.data = null;\n\n var s = $.extend(true, {}, $.ajaxSettings, options, {\n contentType: false,\n processData: false,\n cache: false,\n type: submission.method || \"POST\",\n });\n\n keepContext(s, [$.ajaxSettings, options]);\n\n if (options.uploadProgress) {\n // workaround because jqXHR does not expose upload property: wraps the xhr factory, the\n // caller's or jQuery's\n var createXhr = s.xhr;\n\n s.xhr = function () {\n var xhr = createXhr.call(this);\n\n if (xhr.upload) {\n xhr.upload.addEventListener(\n \"progress\",\n function (event) {\n var percent = 0;\n // event.position is the deprecated name, read only when loaded is missing\n var position = event.loaded !== undefined ? event.loaded : event.position;\n var total = event.total;\n\n if (event.lengthComputable) {\n percent = Math.ceil((position / total) * 100);\n }\n\n options.uploadProgress(event, position, total, percent);\n },\n false\n );\n }\n\n return xhr;\n };\n }\n\n s.data = null;\n\n var beforeSend = s.beforeSend;\n\n s.beforeSend = function (xhr, o) {\n // Send FormData() provided by user\n if (options.formData) {\n o.data = options.formData;\n } else {\n o.data = formdata;\n }\n\n // a veto (false) cancels the upload, as on the other transports\n return beforeSend ? beforeSend.call(this, xhr, o) : undefined;\n };\n\n return $.ajax(s);\n}\n\n/**\n * Sends the encoded fields with $.ajax.\n */\nexport function sendAjax(submission) {\n return $.ajax(submission.options);\n}\n","import { callFormMethod } from \"./form-members.js\";\nimport { deepSerialize } from \"./xhr-transport.js\";\nimport jQuery from \"jquery\";\nimport { submitterFields } from \"./submitter.js\";\nimport { wellFormed } from \"./successful-controls.js\";\n\n// The iframe form post: the extra fields (submitter, CSRF, data), the form attributes set while\n// posting and restored after, and the native submit.\nvar $ = jQuery;\n\n// The form attributes an iframe upload changes while it posts.\nvar uploadAttributes = [\"action\", \"target\", \"method\", \"enctype\", \"encoding\"];\n\n// Called through the prototype: an extraData key or a form field may be named hasOwnProperty.\nvar hasOwn = Object.prototype.hasOwnProperty;\n\nfunction isGet(method) {\n return /^get$/i.test(method);\n}\n\n// Resolves both URLs through anchors, as jQuery does for crossDomain, so IE's anchor quirks\n// apply to both sides of the comparison.\nfunction isSameOrigin(url) {\n var origin = document.createElement(\"a\");\n var target = document.createElement(\"a\");\n\n origin.href = window.location.href;\n target.href = url;\n // IE fills in the host of a relative URL only once the resolved href is assigned back\n target.href = target.href; // eslint-disable-line no-self-assign\n\n return origin.protocol + \"//\" + origin.host === target.protocol + \"//\" + target.host;\n}\n\n/** Adds the clicked submitter (and an image's coordinates) to s.extraData. */\nexport function addSubmitterFields(s, form) {\n // add submitting element to data if we know it\n var fields = submitterFields(form);\n\n for (var n in fields) {\n s.extraData = s.extraData || {};\n s.extraData[wellFormed(n)] = wellFormed(fields[n]);\n }\n}\n\n/** Adds the page's CSRF token to s.extraData when the form is posted to the page's origin. */\nexport function addCsrfField(s, form, method, forms) {\n // Rails CSRF hack (thanks to Yvan Barthelemy); like jquery-ujs, only for the page's origin and\n // only when the form is posted, since a get form would put the token in the url\n var csrf_token = $(\"meta[name=csrf-token]\").attr(\"content\");\n var csrf_param = $(\"meta[name=csrf-param]\").attr(\"content\");\n var posts =\n !isGet(method) &&\n (!method || /post/i.test(method) || /post/i.test(forms.property(form, \"method\")));\n\n if (csrf_param && csrf_token && posts && isSameOrigin(s.url)) {\n s.extraData = s.extraData || {};\n s.extraData[csrf_param] = csrf_token;\n }\n}\n\nfunction setFormAttribute(form, name, value) {\n callFormMethod(form, \"setAttribute\", name, value);\n}\n\n/** The raw attributes the upload changes, null when absent, to put back exactly (#380). */\nexport function saveAttributes(form) {\n var saved = {};\n\n $.each(uploadAttributes, function (i, name) {\n saved[name] = callFormMethod(form, \"hasAttribute\", name)\n ? callFormMethod(form, \"getAttribute\", name)\n : null;\n });\n\n return saved;\n}\n\n/** Puts back the attributes saveAttributes recorded, removing those that were absent. */\nexport function restoreAttributes(form, saved) {\n $.each(uploadAttributes, function (i, name) {\n if (saved[name] === null) {\n callFormMethod(form, \"removeAttribute\", name);\n } else {\n setFormAttribute(form, name, saved[name]);\n }\n });\n}\n\n/** Points the form at the frame `target` with the upload's url, method and encoding. */\nexport function setUploadAttributes(form, target, method, s, forms) {\n var mp = \"multipart/form-data\";\n\n // update form attrs in IE friendly way\n setFormAttribute(form, \"target\", target);\n if (!method || /post/i.test(method)) {\n setFormAttribute(form, \"method\", \"POST\");\n } else if (isGet(method) && !isGet(forms.property(form, \"method\"))) {\n // a form posts natively only with GET or POST; other verbs keep the form's own method\n setFormAttribute(form, \"method\", \"GET\");\n }\n setFormAttribute(form, \"action\", s.url);\n\n // ie borks in some cases when setting encoding\n if (!s.skipEncodingOverride && (!method || /post/i.test(method))) {\n setFormAttribute(form, \"encoding\", mp);\n setFormAttribute(form, \"enctype\", mp);\n }\n}\n\n/** Appends a hidden input per extraData field to the form; each input is pushed onto `added`. */\nexport function addExtraInputs(form, ownerDocument, extraData, traditional, added) {\n // Builds the input with DOM properties: a name is never parsed as HTML.\n function addHiddenInput(name, value) {\n var input = ownerDocument.createElement(\"input\");\n\n input.type = \"hidden\";\n input.name = name;\n added.push($(input).val(value).appendTo(form)[0]);\n }\n\n if (extraData) {\n for (var n in extraData) {\n if (hasOwn.call(extraData, n)) {\n // if using the $.param format that allows for multiple values with the same name\n if (\n $.isPlainObject(extraData[n]) &&\n hasOwn.call(extraData[n], \"name\") &&\n hasOwn.call(extraData[n], \"value\")\n ) {\n addHiddenInput(extraData[n].name, extraData[n].value);\n } else {\n // arrays and objects become one field per value, as $.param sends them (#597)\n var single = {};\n\n single[n] = extraData[n];\n var fields = deepSerialize(single, traditional);\n\n for (var f = 0; f < fields.length; f++) {\n addHiddenInput(fields[f][0], fields[f][1]);\n }\n }\n }\n }\n }\n}\n\n/** Submits the form natively, even when a control named submit hides the method. */\nexport function submitForm(form) {\n try {\n form.submit();\n } catch (err) {\n // just in case form has element with name/id of 'submit'\n callFormMethod(form, \"submit\");\n }\n}\n","import jQuery from \"jquery\";\nimport { log } from \"./diagnostics.js\";\n\n// The iframe response reader: turns the frame's document into the mock xhr's text, XML, status\n// and dataType, then parses it as $.ajax would (dataFilter, JSON, script).\nvar $ = jQuery;\n\n/** The frame's document, or null when the browser denies access to it. */\nexport function getDoc(frame) {\n /* it looks like contentWindow or contentDocument do not\n * carry the protocol property in ie8, when running under ssl\n * frame.document is the only valid response document, since\n * the protocol is know but not on the other two objects. strange?\n * \"Same origin policy\" http://en.wikipedia.org/wiki/Same_origin_policy\n */\n\n var doc = null;\n\n // IE8 cascading access check\n try {\n if (frame.contentWindow) {\n doc = frame.contentWindow.document;\n }\n } catch (err) {\n // IE8 access denied under ssl & missing protocol\n log(\"cannot get iframe.contentWindow document: \" + err);\n }\n\n if (doc) {\n // successful getting content\n return doc;\n }\n\n try {\n // simply checking may throw in ie8 under ssl or mismatched protocol\n doc = frame.contentDocument ? frame.contentDocument : frame.document;\n } catch (err) {\n // last attempt\n log(\"cannot get iframe.contentDocument: \" + err);\n doc = frame.document;\n }\n\n return doc;\n}\n\n/** Parses the response text or XML for the given (lowercase) dataType. */\nexport function httpData(xhr, type, s) {\n // mostly lifted from jq1.4.4\n\n var ct = xhr.getResponseHeader(\"content-type\") || \"\",\n xml = (type === \"xml\" || !type) && ct.indexOf(\"xml\") >= 0,\n data = xml ? xhr.responseXML : xhr.responseText;\n\n if (xml && data.documentElement.nodeName === \"parsererror\") {\n if ($.error) {\n $.error(\"parsererror\");\n }\n }\n if (s && s.dataFilter) {\n data = s.dataFilter(data, type);\n }\n if (typeof data === \"string\") {\n if ((type === \"json\" || !type) && ct.indexOf(\"json\") >= 0) {\n data = JSON.parse(data);\n } else if (type === \"script\") {\n $.globalEval(data);\n }\n }\n\n return data;\n}\n\n// Copies the status and statusText attributes of an element onto the mock xhr.\nfunction readStatus(xhr, el) {\n // support for XHR 'status' & 'statusText' emulation :\n xhr.status = Number(el.getAttribute(\"status\")) || xhr.status;\n xhr.statusText = el.getAttribute(\"statusText\") || xhr.statusText;\n}\n\n// Fills the mock xhr from the document itself.\nfunction readDocument(doc, xhr, s, isXml) {\n var docRoot = doc.body ? doc.body : doc.documentElement;\n\n xhr.responseText = docRoot ? docRoot.innerHTML : null;\n xhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc;\n if (isXml) {\n s.dataType = \"xml\";\n }\n xhr.getResponseHeader = function (header) {\n // the dataType in lowercase, as $.ajax reads it\n var headers = { \"content-type\": s.dataType && s.dataType.toLowerCase() };\n\n return headers[header.toLowerCase()];\n };\n if (docRoot) {\n readStatus(xhr, docRoot);\n }\n}\n\n// A response embedded in a textarea, or text wrapped in pre or body, replaces responseText.\nfunction readEmbedded(doc, xhr, dt, s) {\n var scr = /(json|script|text)/.test(dt);\n\n if (!scr && !s.textarea) {\n return;\n }\n // see if user embedded response in textarea\n var ta = doc.getElementsByTagName(\"textarea\")[0];\n\n if (ta) {\n xhr.responseText = ta.value;\n readStatus(xhr, ta);\n } else if (scr) {\n // account for browsers injecting pre around json response\n var pre = doc.getElementsByTagName(\"pre\")[0];\n var b = doc.getElementsByTagName(\"body\")[0];\n\n if (pre) {\n xhr.responseText = pre.textContent ? pre.textContent : pre.innerText;\n } else if (b) {\n xhr.responseText = b.textContent ? b.textContent : b.innerText;\n }\n }\n}\n\n/**\n * Reads and parses the response document into the mock xhr. Returns {status, data, errMsg}, or\n * null when `retry()` asks to read the document again later (Opera's untraversable DOM).\n */\nexport function readResponse(doc, xhr, s, retry) {\n var status = \"success\",\n data,\n errMsg;\n\n try {\n var isXml = /^xml$/i.test(s.dataType) || doc.XMLDocument || $.isXMLDoc(doc);\n\n log(\"isXml=\" + isXml);\n\n if (!isXml && window.opera && (doc.body === null || !doc.body.innerHTML)) {\n // in some browsers (Opera) the iframe DOM is not always traversable when\n // the onload callback fires, so we loop a bit to accommodate\n if (retry()) {\n return null;\n }\n // let this fall through because server response could be an empty document\n }\n\n readDocument(doc, xhr, s, isXml);\n\n var dt = (s.dataType || \"\").toLowerCase();\n\n readEmbedded(doc, xhr, dt, s);\n\n try {\n data = httpData(xhr, dt, s);\n } catch (err) {\n status = \"parsererror\";\n xhr.error = errMsg = err || status;\n }\n } catch (err) {\n log(\"error caught: \", err);\n status = \"error\";\n xhr.error = errMsg = err;\n }\n\n return { status: status, data: data, errMsg: errMsg };\n}\n","import jQuery from \"jquery\";\nimport { log } from \"./diagnostics.js\";\n\n// The iframe upload's lifecycle: the mock xhr and the Deferred, the global ajax events, the\n// beforeSend veto, the timeout, abort and settling.\nvar $ = jQuery;\n\n/**\n * Creates the lifecycle of one upload with the merged settings `s`. `frame.stop()` stops the\n * frame's load and `frame.release()` removes or resets the frame after the upload.\n */\nexport function createLifecycle(s, frame) {\n var g,\n timeoutHandle,\n callbackProcessed,\n deferred = $.Deferred();\n\n var xhr = {\n // mock object\n aborted: 0,\n responseText: null,\n responseXML: null,\n status: 0,\n statusText: \"n/a\",\n getAllResponseHeaders: function () {},\n getResponseHeader: function () {},\n setRequestHeader: function () {},\n abort: function (status) {\n abort(status, [xhr, \"aborted\", status]);\n },\n };\n\n // #341\n deferred.abort = function (status) {\n xhr.abort(status);\n };\n\n function done() {\n return xhr.aborted || callbackProcessed;\n }\n\n // Completes an aborted upload once and rejects the Deferred with `rejection`.\n // `textStatus` replaces the default \"timeout\"/\"aborted\" text status.\n function abort(status, rejection, textStatus) {\n var e = textStatus || (status === \"timeout\" ? \"timeout\" : \"aborted\");\n\n if (done()) {\n return;\n }\n\n log(\"aborting upload... \" + e);\n xhr.aborted = 1;\n frame.stop();\n xhr.error = e;\n if (s.error) {\n s.error.call(s.context, xhr, e, status);\n }\n deferred.reject.apply(deferred, rejection);\n\n if (g) {\n $.event.trigger(\"ajaxError\", [xhr, s, e]);\n }\n\n complete(e);\n }\n\n // The global events that end every upload, cancelled ones included.\n function endGlobalEvents() {\n if (g) {\n $.event.trigger(\"ajaxComplete\", [xhr, s]);\n }\n\n if (g && !--$.active) {\n $.event.trigger(\"ajaxStop\");\n }\n }\n\n // The steps every finished or aborted upload ends with, in $.ajax order.\n function complete(status) {\n if (s.complete) {\n s.complete.call(s.context, xhr, status);\n }\n\n endGlobalEvents();\n clearTimeout(timeoutHandle);\n\n // clean up\n setTimeout(function () {\n frame.release();\n xhr.responseXML = null;\n }, 100);\n }\n\n // A beforeSend veto ends the upload as $.ajax cancels a request: no callbacks, the global\n // events end with ajaxError \"canceled\".\n function cancel() {\n if (done()) {\n return;\n }\n\n callbackProcessed = true;\n deferred.reject();\n if (g) {\n $.event.trigger(\"ajaxError\", [xhr, s, \"canceled\"]);\n }\n endGlobalEvents();\n }\n\n // Fires the start events and beforeSend; false when the upload must not be posted.\n function start() {\n g = s.global;\n // trigger ajax global events so that activity/block indicators work like normal\n if (g && $.active++ === 0) {\n $.event.trigger(\"ajaxStart\");\n }\n\n if (s.beforeSend && s.beforeSend.call(s.context, xhr, s) === false) {\n cancel();\n\n return false;\n }\n\n if (xhr.aborted) {\n // abort() in beforeSend already completed the upload\n return false;\n }\n\n if (g) {\n $.event.trigger(\"ajaxSend\", [xhr, s]);\n }\n\n // an ajaxSend handler may abort too\n return !xhr.aborted;\n }\n\n // Resolves the upload; returns {error} when the success callback threw.\n function succeed(data) {\n var failure;\n\n try {\n s.success.call(s.context, data, \"success\", xhr);\n } catch (err) {\n failure = { error: err };\n }\n\n deferred.resolve(xhr.responseText, \"success\", xhr);\n\n if (g) {\n $.event.trigger(\"ajaxSuccess\", [xhr, s, data]);\n }\n\n return failure;\n }\n\n // Settles the upload with the response reader's {status, data, errMsg}.\n function settle(result) {\n var status = result.status,\n errMsg = result.errMsg;\n\n if (xhr.aborted) {\n // abort() completed the upload while its response was processed\n log(\"upload aborted\");\n\n return;\n }\n\n // an emulated HTTP error status wins, as in $.ajax; a parse error is kept otherwise\n if (xhr.status && !((xhr.status >= 200 && xhr.status < 300) || xhr.status === 304)) {\n status = \"error\";\n }\n\n callbackProcessed = true;\n\n // ordering of these callbacks/triggers is odd, but that's how $.ajax does it\n if (status === \"success\") {\n var failure = succeed(result.data);\n\n complete(status);\n if (failure) {\n // the upload is settled; the success callback's exception still reaches the console\n throw failure.error;\n }\n\n return;\n }\n\n if (typeof errMsg === \"undefined\") {\n errMsg = xhr.statusText;\n }\n if (s.error) {\n s.error.call(s.context, xhr, status, errMsg);\n }\n deferred.reject(xhr, \"error\", errMsg);\n if (g) {\n $.event.trigger(\"ajaxError\", [xhr, s, errMsg]);\n }\n\n complete(status);\n }\n\n return {\n xhr: xhr,\n deferred: deferred,\n start: start,\n done: done,\n abort: abort,\n settle: settle,\n // Settles an upload that failed with an exception (ignored once aborted).\n fail: function (err) {\n settle({ status: \"error\", errMsg: err });\n },\n // Runs `onTimeout` after s.timeout, when set.\n startTimer: function (onTimeout) {\n if (s.timeout) {\n timeoutHandle = setTimeout(onTimeout, s.timeout);\n }\n },\n stopTimer: function () {\n clearTimeout(timeoutHandle);\n timeoutHandle = undefined;\n },\n };\n}\n","import {\n addCsrfField,\n addExtraInputs,\n addSubmitterFields,\n restoreAttributes,\n saveAttributes,\n setUploadAttributes,\n submitForm,\n} from \"./iframe-post.js\";\nimport { closestByTag, formMember } from \"./form-members.js\";\nimport { deprecate, log } from \"./diagnostics.js\";\nimport { getDoc, readResponse } from \"./iframe-response.js\";\nimport { createLifecycle } from \"./iframe-lifecycle.js\";\nimport jQuery from \"jquery\";\nimport { keepContext } from \"./options.js\";\n\n// The iframe transport: posts the form itself into a hidden frame and reads the response from it,\n// for file uploads without the File API or when the iframe option asks for it.\nvar $ = jQuery;\n\n/**\n * The iframe send step. `hasProp` is what the entry detected at load; `forms.property` reads a\n * form property as attr2 does.\n */\nexport function createIframeTransport(hasProp, forms) {\n var CLIENT_TIMEOUT_ABORT = 1;\n var SERVER_ABORT = 2;\n // tells apart the frames of uploads that start in the same millisecond\n var frameCount = 0;\n\n // ensure that every serialized input is still enabled\n function enableControls(elements) {\n for (var i = 0; i < elements.length; i++) {\n var el = $(elements[i]);\n\n if (hasProp) {\n el.prop(\"disabled\", false);\n } else {\n el.removeAttr(\"disabled\");\n }\n }\n }\n\n // Names the frame's window, when the page may: a cross-origin or sandboxed frame refuses.\n function nameWindow(frame, name) {\n try {\n if (frame.contentWindow) {\n frame.contentWindow.name = name;\n }\n } catch (ignore) {}\n }\n\n // The frame the form posts into: the iframeTarget, named `id` when it has no name, or a new\n // hidden frame named `id`. Returns the frame and the name the form targets.\n function createFrame(s, id, ownerDocument) {\n var $io, n;\n\n if (s.iframeTarget) {\n $io = $(s.iframeTarget, ownerDocument);\n n = $io.attr(\"name\");\n if (!n) {\n $io.attr(\"name\", id);\n // a frame already in the page keeps the browsing context name it was inserted with\n $io.each(function () {\n nameWindow(this, id);\n });\n } else {\n id = n;\n }\n } else {\n var io = ownerDocument.createElement(\"iframe\");\n\n io.setAttribute(\"name\", id);\n io.setAttribute(\"src\", s.iframeSrc);\n $io = $(io);\n $io.css({ position: \"absolute\", top: \"-1000px\", left: \"-1000px\" });\n }\n\n return { $io: $io, id: id };\n }\n\n // The frame hooks the lifecycle calls: stop a load in progress, and release after the upload.\n function frameHooks(s, $io) {\n return {\n stop: function () {\n try {\n // #214, #257\n if ($io[0].contentWindow.document.execCommand) {\n $io[0].contentWindow.document.execCommand(\"Stop\");\n }\n } catch (ignore) {}\n\n $io.attr(\"src\", s.iframeSrc); // abort op in progress\n },\n release: function () {\n if (!s.iframeTarget) {\n $io.remove();\n } else {\n // adding else to clean up existing iframe response.\n $io.attr(\"src\", s.iframeSrc);\n }\n },\n };\n }\n\n function listen(io, cb) {\n if (io.attachEvent) {\n io.attachEvent(\"onload\", cb);\n } else {\n io.addEventListener(\"load\", cb, false);\n }\n }\n\n function unlisten(io, cb) {\n if (io.detachEvent) {\n io.detachEvent(\"onload\", cb);\n } else {\n io.removeEventListener(\"load\", cb, false);\n }\n }\n\n // private function for handling file uploads (hat tip to YAHOO!)\n function fileUploadIframe(submission) {\n var form = submission.form,\n method = submission.method;\n\n var s = keepContext($.extend(true, {}, $.ajaxSettings, submission.options), [\n $.ajaxSettings,\n submission.options,\n ]);\n\n s.context = s.context || s;\n var ownerDocument = formMember(form, \"ownerDocument\");\n var $body = $(closestByTag(form, [\"body\"]));\n var frame = createFrame(s, \"jqFormIO\" + new Date().getTime() + frameCount++, ownerDocument);\n var $io = frame.$io,\n io = $io[0];\n var life = createLifecycle(s, frameHooks(s, $io));\n var domCheckCount = 50;\n\n if (!life.start()) {\n return life.deferred;\n }\n\n addSubmitterFields(s, form);\n addCsrfField(s, form, method, forms);\n\n // look for server aborts\n function checkState() {\n try {\n var state = getDoc(io).readyState;\n\n log(\"state = \" + state);\n if (state && state.toLowerCase() === \"uninitialized\") {\n setTimeout(checkState, 50);\n }\n } catch (e) {\n log(\"Server abort: \", e, \" (\", e.name, \")\");\n cb(SERVER_ABORT);\n life.stopTimer();\n }\n }\n\n // take a breath so that pending repaints get some cpu time before the upload starts\n function doSubmit() {\n var saved = saveAttributes(form);\n\n setUploadAttributes(form, frame.id, method, s, forms);\n\n // support timout\n life.startTimer(function () {\n cb(CLIENT_TIMEOUT_ABORT);\n });\n\n // add \"extra\" data to form if provided in options\n var extraInputs = [];\n\n try {\n addExtraInputs(form, ownerDocument, s.extraData, submission.traditional, extraInputs);\n\n if (!s.iframeTarget) {\n // add iframe to doc and submit the form\n $io.appendTo($body);\n }\n\n // A connected form posting into a frame outside the document opens a new window.\n var root = ownerDocument.documentElement;\n\n if (io && $.contains(root, form) && !$.contains(root, io)) {\n var notInDocument = \"jquery.form: the upload frame is not in the document\";\n\n life.abort(notInDocument, [life.xhr, \"error\", notInDocument], \"error\");\n\n return;\n }\n\n listen(io, cb);\n setTimeout(checkState, 15);\n submitForm(form);\n } finally {\n // reset attrs and remove \"extra\" input elements\n restoreAttributes(form, saved);\n $(extraInputs).remove();\n }\n }\n\n // Reads the next document by Opera's rules: false once the retries are used up.\n function retry() {\n if (--domCheckCount) {\n log(\"requeing onLoad callback, DOM not available\");\n setTimeout(cb, 250);\n\n return true;\n }\n\n return false;\n }\n\n function cb(e) {\n if (life.done()) {\n return;\n }\n\n var doc = getDoc(io);\n\n if (!doc) {\n log(\"cannot access response document\");\n e = SERVER_ABORT;\n }\n if (e === CLIENT_TIMEOUT_ABORT) {\n life.abort(\"timeout\", [life.xhr, \"timeout\"]);\n\n return;\n }\n if (e === SERVER_ABORT) {\n life.abort(\"server abort\", [life.xhr, \"error\", \"server abort\"]);\n\n return;\n }\n\n if (doc.location.href === s.iframeSrc) {\n // response not received yet\n return;\n }\n\n unlisten(io, cb);\n\n var result = readResponse(doc, life.xhr, s, retry);\n\n if (result) {\n life.settle(result);\n }\n }\n\n // An exception while posting settles the upload with \"error\" and the exception.\n function post() {\n if (life.done()) {\n // aborted before the delayed post\n return;\n }\n\n try {\n doSubmit();\n } catch (err) {\n log(\"upload failed: \", err);\n life.fail(err);\n }\n }\n\n if (s.forceSync) {\n post();\n } else {\n setTimeout(post, 10); // this lets dom updates render\n }\n\n return life.deferred;\n }\n\n return function sendIframe(submission) {\n var jqxhr;\n\n // now, while the controls are still listed: ajaxSubmit clears the list when it returns,\n // before a closeKeepAlive request completes\n enableControls(submission.controls);\n\n // hack to fix Safari hang (thanks to Tim Molendijk for this)\n // see: http://groups.google.com/group/jquery-dev/browse_thread/thread/36395b7ab510dd5d\n if (submission.options.closeKeepAlive) {\n deprecate(\"closeKeepAlive\", \"closeKeepAlive works around a Safari 3/4 bug and is deprecated\");\n $.get(submission.options.closeKeepAlive, function () {\n jqxhr = fileUploadIframe(submission);\n });\n } else {\n jqxhr = fileUploadIframe(submission);\n }\n\n return jqxhr;\n };\n}\n","import { deprecate, log } from \"./diagnostics.js\";\nimport { assertRealParent } from \"./form-members.js\";\nimport jQuery from \"jquery\";\nimport { keepContext } from \"./options.js\";\nimport { urlencode } from \"./successful-controls.js\";\n\n// A Submission is one ajaxSubmit call once its vetoes have passed:\n// { form, $form, fields, controls, options, method, traditional }. `options` is the object the\n// callbacks and events receive; later steps change it in place.\n\n/**\n * The submission steps. `feature` holds what the entry detected at load (fileapi, formdata), and\n * `forms` reads form attributes and attr2-style properties (attribute, property), and\n * `serialization` collects the form's fields and controls.\n */\nexport function createSubmission(feature, forms, serialization) {\n var $ = jQuery;\n\n function refuse(message) {\n log(message);\n\n return null;\n }\n\n // The options merged over the form's action, the method, and the ajax defaults.\n function withDefaults(form, options, method) {\n var action = options.url || forms.property(form, \"action\");\n var url = typeof action === \"string\" ? action.trim() : \"\";\n\n // clean url (don't include hash value); an action that is only a fragment means this page\n url = url.split(\"#\")[0] || window.location.href.split(\"#\")[0];\n // IE requires javascript:false in https, but this breaks chrome >83 and goes against spec.\n // Instead of using javascript:false always, let's only apply it for IE.\n var isMsie = /(MSIE|Trident)/.test(navigator.userAgent || \"\");\n var iframeSrc = isMsie && /^https/i.test(document.URL) ? \"javascript:false\" : \"about:blank\"; // eslint-disable-line no-script-url\n\n var merged = $.extend(\n true,\n {\n url: url,\n success: $.ajaxSettings.success,\n type: method || $.ajaxSettings.type,\n iframeSrc: iframeSrc,\n },\n options\n );\n\n return keepContext(merged, [options]);\n }\n\n /**\n * The one method every transport sends, read after the hooks: `method` wins over `type`, and\n * `type` is set to it. Undefined when only the ajax default applies, so each transport keeps\n * its own default.\n */\n function resolveMethod(options, defaultType) {\n var resolved = options.method || options.type;\n\n options.type = resolved;\n\n return resolved === defaultType && !options.method ? undefined : resolved;\n }\n\n // The data option, kept as extraData and encoded, or undefined without one.\n function extraQuery(fields, options, traditional) {\n if (!options.data) {\n return undefined;\n }\n\n var optionsData = typeof options.data === \"function\" ? options.data(fields) : options.data;\n\n if (typeof optionsData === \"string\") {\n if (options.requestFormat === \"json\") {\n throw new Error(\n 'jquery.form: requestFormat \"json\" needs object data; a string data option is a query string'\n );\n }\n\n // a query string: sent as-is when urlencoded, as its own fields otherwise\n options.extraData = queryPairs(optionsData);\n\n return optionsData;\n }\n\n options.extraData = optionsData;\n\n return $.param(optionsData, traditional);\n }\n\n // Sets a key as an own data property, so a name like __proto__ is an ordinary key.\n function defineKey(object, key, value) {\n Object.defineProperty(object, key, {\n value: value,\n enumerable: true,\n writable: true,\n configurable: true,\n });\n }\n\n /**\n * requestFormat \"json\" (#545): the fields as an object (a repeated name gives an array), merged\n * with object data, sent as a JSON body. Based on the idea in PR #557 by zhangciwu.\n */\n function jsonBody(options, fields) {\n if (/^get$/i.test(options.type)) {\n throw new Error('jquery.form: requestFormat \"json\" needs a method with a body, such as POST');\n }\n\n var body = {};\n var own = Object.prototype.hasOwnProperty;\n\n for (var i = 0; i < fields.length; i++) {\n var name = fields[i].name;\n\n if (!own.call(body, name)) {\n defineKey(body, name, fields[i].value);\n } else if (Array.isArray(body[name])) {\n body[name].push(fields[i].value);\n } else {\n defineKey(body, name, [body[name], fields[i].value]);\n }\n }\n\n var extra = options.extraData;\n\n for (var key in extra) {\n if (own.call(extra, key)) {\n defineKey(body, key, extra[key]);\n }\n }\n\n options.data = JSON.stringify(body);\n options.contentType = \"application/json; charset=UTF-8\";\n }\n\n // The fields of a query string, as the { name, value } list $.param takes.\n function queryPairs(query) {\n var pairs = [];\n var parts = query.split(\"&\");\n\n for (var i = 0; i < parts.length; i++) {\n if (parts[i]) {\n var at = parts[i].indexOf(\"=\");\n var name = at < 0 ? parts[i] : parts[i].slice(0, at);\n var value = at < 0 ? \"\" : parts[i].slice(at + 1);\n\n pairs.push({ name: decodeQuery(name), value: decodeQuery(value) });\n }\n }\n\n return pairs;\n }\n\n function decodeQuery(text) {\n return decodeURIComponent(text.replace(/\\+/g, \" \"));\n }\n\n // Puts the encoded fields in the url for a get, and in the data otherwise.\n function encode(options, q, qx) {\n if (qx) {\n q = q ? q + \"&\" + qx : qx;\n }\n\n if (options.type.toUpperCase() === \"GET\") {\n // the query goes before any fragment in the url option\n var hashAt = options.url.indexOf(\"#\");\n var base = hashAt < 0 ? options.url : options.url.slice(0, hashAt);\n\n options.url =\n base + (base.indexOf(\"?\") >= 0 ? \"&\" : \"?\") + q + options.url.slice(base.length);\n options.data = null; // data is null for 'get'\n } else {\n options.data = q; // data is the query string for 'post'\n }\n }\n\n // A callback option as a list: an array as given, one function, or none.\n function callbackList(callback) {\n if (Array.isArray(callback)) {\n return callback;\n }\n\n return callback ? [callback] : [];\n }\n\n // Calls each callback in order with the same this and arguments.\n function callEach(callbacks, context, args) {\n for (var i = 0; i < callbacks.length; i++) {\n callbacks[i].apply(context, args);\n }\n }\n\n /**\n * Resolves the options, serializes the form, and runs the vetoes: the Submission, or null when\n * an event or callback stopped it.\n */\n function prepare($set, options) {\n $set.each(function () {\n assertRealParent(this);\n });\n\n var form = $set[0];\n var method = options.method || options.type || forms.property(form, \"method\");\n\n options = withDefaults(form, options, method);\n\n // the ajax default type, when neither the caller nor the form gave a method\n var defaultType = method ? undefined : options.type;\n\n // hook for manipulating the form data before it is extracted;\n // convenient for use with rich editors like tinyMCE or FCKEditor\n var veto = {};\n\n $set.trigger(\"form-pre-serialize\", [$set, options, veto]);\n if (veto.veto) {\n return refuse(\"ajaxSubmit: submit vetoed via form-pre-serialize trigger\");\n }\n\n // provide opportunity to alter form data before it is serialized\n if (options.beforeSerialize && options.beforeSerialize($set, options) === false) {\n return refuse(\"ajaxSubmit: submit aborted via beforeSerialize callback\");\n }\n\n var traditional = options.traditional;\n\n if (typeof traditional === \"undefined\") {\n traditional = $.ajaxSettings.traditional;\n }\n\n var collected = serialization.collect($set[0], options.semantic, options.filtering);\n var fields = collected.fields;\n var controls = collected.controls;\n var qx = extraQuery(fields, options, traditional);\n\n // give pre-submit callback an opportunity to abort the submit\n if (options.beforeSubmit && options.beforeSubmit(fields, $set, options) === false) {\n return refuse(\"ajaxSubmit: submit aborted via beforeSubmit callback\");\n }\n\n // fire vetoable 'validate' event\n $set.trigger(\"form-submit-validate\", [fields, $set, options, veto]);\n if (veto.veto) {\n return refuse(\"ajaxSubmit: submit vetoed via form-submit-validate trigger\");\n }\n\n method = resolveMethod(options, defaultType);\n\n if (options.requestFormat === \"json\") {\n jsonBody(options, fields);\n } else {\n encode(options, urlencode(fields, traditional), qx);\n }\n\n return {\n form: form,\n $form: $set,\n fields: fields,\n controls: controls,\n options: options,\n method: method,\n traditional: traditional,\n };\n }\n\n /**\n * Wraps success, error and complete (a function or an array of them, as $.ajax takes) so each\n * also receives the form, and adds the resetForm,\n * clearForm and target steps before the success callbacks.\n */\n function deliver(submission) {\n var $set = submission.$form;\n var options = submission.options;\n var callbacks = [];\n\n if (options.resetForm) {\n callbacks.push(function () {\n $set.resetForm();\n });\n }\n\n if (options.clearForm) {\n callbacks.push(function () {\n $set.clearForm(options.includeHidden);\n });\n }\n\n // perform a load on the target only if dataType is not provided\n if (!options.dataType && options.target) {\n var successes = callbackList(options.success);\n\n callbacks.push(function (data, textStatus, jqXHR) {\n var successArguments = arguments,\n fn = options.replaceTarget ? \"replaceWith\" : \"html\",\n $target = $(options.target);\n\n // Only a string response is inserted. jQuery has already parsed a JSON or XML response,\n // and inserting it would parse each of its strings as HTML.\n if (typeof data === \"string\") {\n $target[fn](data);\n } else {\n log(\"target: the response was parsed by jQuery, so it is not inserted\");\n }\n\n if (!$target.length) {\n // nothing to fill: success still runs once, with the normal context\n callEach(successes, this, successArguments);\n }\n\n $target.each(function () {\n callEach(successes, this, successArguments);\n });\n });\n } else {\n $.merge(callbacks, callbackList(options.success));\n }\n\n options.success = function (data, status, xhr) {\n // jQuery 1.4+ passes xhr as 3rd arg\n var context = options.context || this; // jQuery 1.4+ supports scope context\n\n for (var i = 0, max = callbacks.length; i < max; i++) {\n callbacks[i].apply(context, [data, status, xhr || $set, $set]);\n }\n };\n\n if (options.error) {\n var errors = callbackList(options.error);\n\n options.error = function (xhr, status, error) {\n callEach(errors, options.context || this, [xhr, status, error, $set]);\n };\n }\n\n if (options.complete) {\n var completes = callbackList(options.complete);\n\n options.complete = function (xhr, status) {\n callEach(completes, options.context || this, [xhr, status, $set]);\n };\n }\n }\n\n /**\n * The transport for a submission: \"iframe\" for files without the File API or when forced,\n * \"formdata\" for files with it, \"ajax\" otherwise.\n */\n function chooseTransport(submission) {\n var $set = submission.$form;\n var options = submission.options;\n\n // [value] (issue #113), also see comment:\n // https://github.com/malsup/form/commit/588306aedba1de01388032d5f42a60159eea9228#commitcomment-2180219\n // and the file inputs outside the form that belong to it through their form attribute\n var fileInputs = $(\"input[type=file]:enabled\", $set)\n .add($(submission.controls).filter(\"input[type=file]\"))\n .filter(function () {\n return $(this).val() !== \"\";\n });\n var hasFileInputs = fileInputs.length > 0;\n // compared as the browser does: ASCII case-insensitive, without surrounding whitespace\n var mp = /^[\\t\\n\\f\\r ]*multipart\\/form-data[\\t\\n\\f\\r ]*$/i;\n var multipart =\n mp.test(forms.attribute($set[0], \"enctype\")) || mp.test(forms.attribute($set[0], \"encoding\"));\n var fileAPI = feature.fileapi && feature.formdata;\n\n log(\"fileAPI :\" + fileAPI);\n\n var shouldUseFrame = (hasFileInputs || multipart) && !fileAPI;\n\n var transport = (hasFileInputs || multipart) && fileAPI ? \"formdata\" : \"ajax\";\n\n // options.iframe allows user to force iframe mode\n // 06-NOV-09: now defaulting to iframe mode if file input is detected\n if (options.iframe !== false && (options.iframe || shouldUseFrame)) {\n transport = \"iframe\";\n }\n\n if (transport === \"iframe\" && !options.iframe) {\n deprecate(\n \"iframe\",\n \"choosing the iframe transport automatically without FormData is deprecated, set iframe: true\"\n );\n }\n\n if (transport !== \"ajax\" && options.requestFormat === \"json\") {\n throw new Error(\n 'jquery.form: requestFormat \"json\" cannot send files or use the iframe transport'\n );\n }\n\n return transport;\n }\n\n return { prepare: prepare, deliver: deliver, chooseTransport: chooseTransport };\n}\n","/*!\n * jQuery Form Plugin\n * version: 4.5.0\n * Requires jQuery v1.7.2 or later\n * Project repository: https://github.com/jquery-form/form\n\n * Copyright 2017 Kevin Morris\n * Copyright 2006 M. Alsup\n\n * Dual licensed under the LGPL-2.1+ or MIT licenses\n * https://github.com/jquery-form/form#license\n\n * This library is free software; you can redistribute it and/or\n * modify it under the terms of the GNU Lesser General Public\n * License as published by the Free Software Foundation; either\n * version 2.1 of the License, or (at your option) any later version.\n * This library is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n */\nimport { ajaxForm, ajaxFormUnbind } from \"./ajax-form.js\";\nimport { callFormMethod, tagName } from \"./form-members.js\";\nimport {\n createSuccessfulControls,\n isSuccessful,\n urlencode,\n valueOf,\n} from \"./successful-controls.js\";\nimport { deprecate, deprecateOldJQuery, log } from \"./diagnostics.js\";\nimport { sendAjax, sendFormData } from \"./xhr-transport.js\";\nimport { createIframeTransport } from \"./iframe-transport.js\";\nimport { createSubmission } from \"./submission.js\";\nimport { formAttribute } from \"./form-attributes.js\";\nimport jQuery from \"jquery\";\nimport { submitOptions } from \"./options.js\";\nimport { submitterElement } from \"./submitter.js\";\n\n(function ($) {\n \"use strict\";\n\n /*\n\t\tUsage Note:\n\t\t-----------\n\t\tDo not use both ajaxSubmit and ajaxForm on the same form. These\n\t\tfunctions are mutually exclusive. Use ajaxSubmit if you want\n\t\tto bind your own submit handler to the form. For example,\n\n\t\t$(document).ready(function() {\n\t\t\t$('#myForm').on('submit', function(e) {\n\t\t\t\te.preventDefault(); // <-- important\n\t\t\t\t$(this).ajaxSubmit({\n\t\t\t\t\ttarget: '#output'\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\n\t\tUse ajaxForm when you want the plugin to manage all the event binding\n\t\tfor you. For example,\n\n\t\t$(document).ready(function() {\n\t\t\t$('#myForm').ajaxForm({\n\t\t\t\ttarget: '#output'\n\t\t\t});\n\t\t});\n\n\t\tYou can also use ajaxForm with delegation (requires jQuery v1.7+), so the\n\t\tform does not have to exist when you invoke ajaxForm:\n\n\t\t$('#myForm').ajaxForm({\n\t\t\tdelegation: true,\n\t\t\ttarget: '#output'\n\t\t});\n\n\t\tWhen using ajaxForm, the ajaxSubmit function will be invoked for you\n\t\tat the appropriate time.\n\t*/\n\n /**\n * Feature detection\n */\n var feature = {};\n\n feature.fileapi = $('').get(0).files !== undefined;\n feature.formdata = typeof window.FormData !== \"undefined\";\n\n var hasProp = !!$.fn.prop;\n // What attr2 returns for a form: the property when it is a string, otherwise the attribute. The\n // property is read plainly on purpose: a control named like it shadows it, and then the raw\n // attribute is used.\n function formProperty(form, name) {\n var value = hasProp ? form[name] : undefined;\n\n return typeof value === \"string\" ? value : formAttribute(form, name);\n }\n\n var forms = { attribute: formAttribute, property: formProperty };\n var serialization = createSuccessfulControls(feature);\n var steps = createSubmission(feature, forms, serialization);\n var transports = {\n iframe: createIframeTransport(hasProp, forms),\n formdata: sendFormData,\n ajax: sendAjax,\n };\n\n // attr2 uses prop when it can but checks the return type for\n // an expected string. This accounts for the case where a form\n // contains inputs with names like \"action\" or \"method\"; in those\n // cases \"prop\" returns the element\n $.fn.attr2 = function () {\n deprecate(\"attr2\", \"attr2 is deprecated, use .prop() or .attr()\");\n\n if (!hasProp) {\n return this.attr.apply(this, arguments);\n }\n\n var val = this.prop.apply(this, arguments);\n\n if ((val && val.jquery) || typeof val === \"string\") {\n return val;\n }\n\n return this.attr.apply(this, arguments);\n };\n\n /**\n * ajaxSubmit() provides a mechanism for immediately submitting\n * an HTML form using AJAX.\n *\n * @param\t{object|string}\toptions\t\tjquery.form.js parameters or custom url for submission\n * @param\t{object}\t\tdata\t\textraData\n * @param\t{string}\t\tdataType\tajax dataType\n * @param\t{function}\t\tonSuccess\tajax success callback function\n */\n $.fn.ajaxSubmit = function (options, data, dataType, onSuccess) {\n deprecateOldJQuery($.fn.jquery);\n\n // fast fail if nothing selected (http://dev.jquery.com/ticket/2752)\n if (!this.length) {\n log(\"ajaxSubmit: skipping submit process - no element selected\");\n\n return this;\n }\n\n // #541: jQuery's slim build has no $.ajax\n if (!$.ajax) {\n throw new Error(\n \"jquery.form: ajaxSubmit needs the full jQuery build; this jQuery has no $.ajax\"\n );\n }\n\n var submission = steps.prepare(this, submitOptions(options, data, dataType, onSuccess));\n\n if (!submission) {\n return this;\n }\n\n steps.deliver(submission);\n\n var jqxhr = transports[steps.chooseTransport(submission)](submission);\n\n this.removeData(\"jqxhr\").data(\"jqxhr\", jqxhr);\n\n // clear element array\n for (var k = 0; k < submission.controls.length; k++) {\n submission.controls[k] = null;\n }\n\n // fire 'notify' event\n this.trigger(\"form-submit-notify\", [this, submission.options]);\n\n return this;\n };\n\n $.fn.ajaxForm = ajaxForm;\n $.fn.ajaxFormUnbind = ajaxFormUnbind;\n\n /**\n * formToArray() gathers form element data into an array of objects that can\n * be passed to any of the following ajax functions: $.get, $.post, or load.\n * Each object in the array has both a 'name' and 'value' property. An example of\n * an array for a simple login form might be:\n *\n * [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ]\n *\n * It is this array that is passed to pre-submit callback functions provided to the\n * ajaxSubmit() and ajaxForm() methods.\n */\n $.fn.formToArray = function (semantic, elements, filtering) {\n var collected = serialization.collect(this[0], semantic, filtering);\n\n if (elements) {\n elements.push.apply(elements, collected.controls);\n }\n\n return collected.fields;\n };\n\n /**\n * Serializes form data into a 'submittable' string. This method will return a string\n * in the format: name1=value1&name2=value2\n */\n $.fn.formSerialize = function (semantic) {\n // hand off to jQuery.param for proper encoding\n return urlencode(this.formToArray(semantic));\n };\n\n /**\n * Serializes all field elements in the jQuery object into a query string.\n * This method will return a string in the format: name1=value1&name2=value2\n */\n $.fn.fieldSerialize = function (successful) {\n var a = [];\n\n this.each(function () {\n var n = this.name;\n\n // a form is not a field, though it may have a name\n if (!n || tagName(this) === \"form\") {\n return;\n }\n\n var v = $.fieldValue(this, successful);\n\n if (v && v.constructor === Array) {\n for (var i = 0, max = v.length; i < max; i++) {\n a.push({ name: n, value: v[i] });\n }\n } else if (v !== null && typeof v !== \"undefined\") {\n a.push({ name: this.name, value: v });\n }\n });\n\n // hand off to jQuery.param for proper encoding\n return urlencode(a);\n };\n\n /**\n * Returns the value(s) of the element in the matched set. For example, consider the following form:\n *\n *\t
\n *\t\t\n *\t\t\n *\t\t\n *\t\t\n *\t\t\n *\t\t\n *\t
\n *\n *\tvar v = $('input[type=text]').fieldValue();\n *\t// if no values are entered into the text inputs\n *\tv === ['','']\n *\t// if values entered into the text inputs are 'foo' and 'bar'\n *\tv === ['foo','bar']\n *\n *\tvar v = $('input[type=checkbox]').fieldValue();\n *\t// if neither checkbox is checked\n *\tv === undefined\n *\t// if both checkboxes are checked\n *\tv === ['B1', 'B2']\n *\n *\tvar v = $('input[type=radio]').fieldValue();\n *\t// if neither radio is checked\n *\tv === undefined\n *\t// if first radio is checked\n *\tv === ['C1']\n *\n * The successful argument controls whether or not the field element must be 'successful'\n * (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls).\n * The default value of the successful argument is true. If this value is false the value(s)\n * for each element is returned.\n *\n * Note: This method *always* returns an array. If no valid value can be determined the\n *\tarray will be empty, otherwise it will contain one or more values.\n */\n $.fn.fieldValue = function (successful) {\n for (var val = [], i = 0, max = this.length; i < max; i++) {\n var el = this[i];\n var v = $.fieldValue(el, successful);\n\n if (v === null || typeof v === \"undefined\" || (v.constructor === Array && !v.length)) {\n continue;\n }\n\n if (v.constructor === Array) {\n $.merge(val, v);\n } else {\n val.push(v);\n }\n }\n\n return val;\n };\n\n /**\n * Returns the value of the field element.\n */\n $.fieldValue = function (el, successful) {\n var required = typeof successful === \"undefined\" || successful;\n\n if (required && !isSuccessful(el, submitterElement(el.form))) {\n return null;\n }\n\n return valueOf(el);\n };\n\n /**\n * Clears the form data. Takes the following actions on the form's input fields:\n * - input text fields will have their 'value' property set to the empty string\n * - select elements will have their 'selectedIndex' property set to -1\n * - checkbox and radio inputs will have their 'checked' property set to false\n * - inputs of type submit, button, reset, and hidden will *not* be effected\n * - button elements will *not* be effected\n */\n $.fn.clearForm = function (includeHidden) {\n return this.each(function () {\n $(\"input,select,textarea\", this).clearFields(includeHidden);\n });\n };\n\n /**\n * Clears the selected form elements.\n */\n $.fn.clearInputs = function (includeHidden) {\n deprecate(\"clearInputs\", \"clearInputs is deprecated, use clearFields\");\n\n return this.clearFields(includeHidden);\n };\n\n $.fn.clearFields = function (includeHidden) {\n var re =\n /^(?:color|date|datetime|datetime-local|email|month|number|password|range|search|tel|text|time|url|week)$/i; // 'hidden' is not in this list\n\n return this.each(function () {\n var t = this.type,\n tag = tagName(this);\n\n if (re.test(t) || tag === \"textarea\") {\n this.value = \"\";\n } else if (t === \"checkbox\" || t === \"radio\") {\n this.checked = false;\n } else if (tag === \"select\") {\n this.selectedIndex = -1;\n } else if (t === \"file\") {\n if (/MSIE/.test(navigator.userAgent)) {\n $(this).replaceWith($(this).clone(true));\n } else {\n $(this).val(\"\");\n }\n } else if (includeHidden) {\n // includeHidden can be the value true, or it can be a selector string\n // indicating a special test; for example:\n // $('#myForm').clearForm('.special:hidden')\n // the above would clean hidden inputs that have the class of 'special'\n if (\n (includeHidden === true && /hidden/.test(t)) ||\n (typeof includeHidden === \"string\" && $(this).is(includeHidden))\n ) {\n this.value = \"\";\n }\n }\n });\n };\n\n /**\n * Resets the form data or individual elements. Takes the following actions\n * on the selected tags:\n * - all fields within form elements will be reset to their original value\n * - input / textarea / select fields will be reset to their original value\n * - option / optgroup fields (for multi-selects) will defaulted individually\n * - non-multiple options will find the right select to default\n * - label elements will be searched against its 'for' attribute\n * - all others will be searched for appropriate children to default\n */\n $.fn.resetForm = function () {\n return this.each(function () {\n var el = $(this);\n var tag = tagName(this);\n\n switch (tag) {\n case \"input\":\n this.checked = this.defaultChecked;\n\n // as the native reset: types whose value is the value attribute keep it\n if (this.type === \"file\") {\n // a file input cannot take its value attribute; the native reset empties it\n this.value = \"\";\n } else if (!/^(?:checkbox|radio|hidden|submit|reset|button|image)$/.test(this.type)) {\n this.value = this.defaultValue;\n }\n\n return true;\n\n case \"textarea\":\n this.value = this.defaultValue;\n\n return true;\n\n case \"option\":\n case \"optgroup\":\n var select = el.parents(\"select\");\n\n if (select.length && select[0].multiple) {\n if (tag === \"option\") {\n this.selected = this.defaultSelected;\n } else {\n el.find(\"option\").resetForm();\n }\n } else {\n select.resetForm();\n }\n\n return true;\n\n case \"select\":\n // in order, as the native reset: of several default options, a single select keeps the last\n el.find(\"option\").each(function () {\n this.selected = this.defaultSelected;\n });\n\n return true;\n\n case \"label\":\n // The control whose id the for attribute names, and the controls inside the label. The\n // filter keeps a for that names an ancestor from resetting the label again.\n var forEl = this.htmlFor && this.ownerDocument.getElementById(this.htmlFor);\n\n el.find(\"input,select,textarea\").add(forEl).filter(\"input,select,textarea\").resetForm();\n\n return true;\n\n case \"form\":\n // through the prototype: a control named reset shadows the method\n callFormMethod(this, \"reset\");\n\n return true;\n\n default:\n el.find(\"form,input,label,select,textarea\").resetForm();\n\n return true;\n }\n });\n };\n\n /**\n * Enables or disables any matching elements.\n */\n $.fn.enable = function (b) {\n if (typeof b === \"undefined\") {\n b = true;\n }\n\n return this.each(function () {\n this.disabled = !b;\n });\n };\n\n /**\n * Checks/unchecks any matching checkboxes or radio buttons and\n * selects/deselects and matching option elements.\n */\n $.fn.selected = function (select) {\n if (typeof select === \"undefined\") {\n select = true;\n }\n\n return this.each(function () {\n var t = this.type;\n\n if (t === \"checkbox\" || t === \"radio\") {\n this.checked = select;\n } else if (tagName(this) === \"option\") {\n var $sel = $(this).parent(\"select\");\n\n if (select && $sel[0] && $sel[0].type === \"select-one\") {\n // deselect all other options\n $sel.find(\"option\").selected(false);\n }\n\n this.selected = select;\n }\n });\n };\n\n // expose debug var\n $.fn.ajaxSubmit.debug = false;\n})(jQuery);\n\nexport default jQuery;\n"],"names":["owners","plainForm","document","createElement","findDescriptor","name","i","length","owner","window","descriptor","Object","getOwnPropertyDescriptor","prototype","formMember","form","get","call","e","callFormMethod","value","apply","Array","slice","arguments","tagName","el","toLowerCase","isElement","node","assertRealParent","parentNode","Error","closestByTag","names","indexOf","storeKey","setExpando","ignore","expando","els","namedItem","undefined","record","x","y","jQuery","data","type","setTimeout","captureSubmitter","target","point","offsetX","offsetY","fn","offset","pageX","left","pageY","top","offsetLeft","offsetTop","imagePoint","submitterOf","stored","log","ajaxSubmit","debug","msg","join","console","opera","postError","warned","deprecate","id","message","warn","deprecateOldJQuery","version","parts","String","split","major","Number","beforeJQuery35","shorthandOptions","options","dataType","onSuccess","result","url","success","submitOptions","key","hasOwnProperty","withoutUrl","keepContext","settings","sources","context","submitWith","isDefaultPrevented","preventDefault","originalEvent","submitter","captureEventSubmitter","doAjaxSubmit","captureSubmittingElement","this","bindDelegated","$sel","selector","off","on","closestMatch","Element","closest","is","delegated","unbindSelector","handlers","submit","click","selectionOnly","ajaxForm","jquery","delegation","bindSelector","beforeFormUnbind","ajaxFormUnbind","o","s","c","isReady","bindLater","formAttribute","attr","rLineBreak","rCR","rUnsubmittable","isDisabled","matches","disabled","valueOf","index","selectedIndex","a","ops","one","max","op","selected","v","attributes","specified","text","push","selectValue","val","raw","replace","loneSurrogate","wellFormed","match","before","urlencode","fields","traditional","param","map","field","urlencodedFields","createSuccessfulControls","feature","$","controlsOf","semantic","formId","getElementsByTagName","makeArray","grep","ownedBy","test","navigator","userAgent","concat","filter","getAttribute","inArray","outsideControls","fieldsOf","n","fieldValue","constructor","fileapi","files","file","required","imageFields","sub","input","addCandidate","collected","own","controls","collect","filtering","addClickedImage","deepSerialize","extraData","part","serialized","len","decodeURIComponent","sendFormData","submission","formdata","FormData","append","serializedData","extend","ajaxSettings","contentType","processData","cache","method","uploadProgress","createXhr","xhr","upload","addEventListener","event","percent","position","loaded","total","lengthComputable","Math","ceil","beforeSend","formData","ajax","sendAjax","uploadAttributes","hasOwn","isGet","addSubmitterFields","submitterFields","addCsrfField","forms","origin","csrf_token","csrf_param","posts","property","href","location","protocol","host","setFormAttribute","getDoc","frame","doc","contentWindow","err","contentDocument","readStatus","status","statusText","readResponse","retry","errMsg","isXml","XMLDocument","isXMLDoc","body","innerHTML","docRoot","documentElement","responseText","responseXML","getResponseHeader","header","readDocument","dt","scr","textarea","ta","pre","b","textContent","innerText","readEmbedded","ct","xml","nodeName","error","dataFilter","JSON","parse","globalEval","httpData","createLifecycle","g","timeoutHandle","callbackProcessed","deferred","Deferred","aborted","getAllResponseHeaders","setRequestHeader","abort","done","rejection","textStatus","stop","reject","trigger","complete","endGlobalEvents","active","clearTimeout","release","settle","failure","resolve","succeed","start","global","fail","startTimer","onTimeout","timeout","stopTimer","createIframeTransport","hasProp","frameCount","fileUploadIframe","ownerDocument","$body","$io","iframeTarget","each","nameWindow","io","setAttribute","iframeSrc","css","createFrame","Date","getTime","life","execCommand","remove","frameHooks","domCheckCount","checkState","state","readyState","cb","doSubmit","saved","saveAttributes","mp","skipEncodingOverride","setUploadAttributes","extraInputs","added","addHiddenInput","appendTo","isPlainObject","single","f","addExtraInputs","root","contains","notInDocument","attachEvent","listen","submitForm","restoreAttributes","detachEvent","removeEventListener","unlisten","post","forceSync","jqxhr","elements","prop","removeAttr","enableControls","closeKeepAlive","createSubmission","serialization","refuse","extraQuery","optionsData","requestFormat","query","pairs","at","decodeQuery","queryPairs","defineKey","object","defineProperty","enumerable","writable","configurable","callbackList","callback","isArray","callEach","callbacks","args","prepare","$set","action","trim","URL","withDefaults","defaultType","veto","beforeSerialize","qx","beforeSubmit","resolved","resolveMethod","extra","stringify","jsonBody","q","toUpperCase","hashAt","base","encode","$form","deliver","resetForm","clearForm","includeHidden","successes","jqXHR","successArguments","replaceTarget","$target","merge","errors","completes","chooseTransport","hasFileInputs","add","multipart","attribute","fileAPI","shouldUseFrame","transport","iframe","steps","transports","attr2","removeData","k","formToArray","formSerialize","fieldSerialize","successful","t","checked","isSuccessful","clearFields","clearInputs","re","tag","replaceWith","clone","defaultChecked","defaultValue","select","parents","multiple","defaultSelected","find","forEl","htmlFor","getElementById","enable","parent"],"mappings":";;;;;;;;;;;;;;;;;;;;;4ZAMIA,EAAS,CAAC,kBAAmB,cAAe,UAAW,QAGvDC,EAAYC,EAASC,cAAc,QAEvC,SAASC,EAAeC,GACtB,IAAK,IAAIC,EAAI,EAAGA,EAAIN,EAAOO,OAAQD,IAAK,CACtC,IAAIE,EAAQC,EAAOT,EAAOM,IACtBI,EAAaF,GAASG,OAAOC,yBAAyBJ,EAAMK,UAAWR,GAE3E,GAAIK,EACF,OAAOA,CAEX,CAEA,OAAO,IACT,CAOO,SAASI,EAAWC,EAAMV,GAC/B,IAAIK,EAAaN,EAAeC,GAEhC,IACE,OAAOK,EAAWM,IAAIC,KAAKF,EAC7B,CAAE,MAAOG,GACP,OAAOH,EAAKV,EACd,CACF,CAMO,SAASc,EAAeJ,EAAMV,GACnC,IAAIK,EAAaN,EAAeC,GAGhC,OAFaK,EAAaA,EAAWU,MAAQnB,EAAUI,IAEzCgB,MAAMN,EAAMO,MAAMT,UAA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zH,GAAGY,WAAWC,OAAQ,CACzB,CAlcD,CAkcGtB"} \ No newline at end of file diff --git a/dist/jquery.form.mjs b/dist/jquery.form.mjs index f97160b..7dc8f41 100644 --- a/dist/jquery.form.mjs +++ b/dist/jquery.form.mjs @@ -683,6 +683,12 @@ function wellFormed(value) { : value; } +// jQuery 3 dropped $.param's "+" for a space; a native submission still sends "+". Only a space +// encodes as %20, since a literal % encodes as %25. +function urlencode(fields, traditional) { + return jQuery.param(urlencodedFields(fields), traditional).replace(/%20/g, "+"); +} + function urlencodedFields(fields) { return jQuery.map(fields, function (field) { var value = @@ -2043,7 +2049,7 @@ function createSubmission(feature, forms, serialization) { if (options.requestFormat === "json") { jsonBody(options, fields); } else { - encode(options, $.param(urlencodedFields(fields), traditional), qx); + encode(options, urlencode(fields, traditional), qx); } return { @@ -2354,7 +2360,7 @@ function createSubmission(feature, forms, serialization) { */ $.fn.formSerialize = function (semantic) { // hand off to jQuery.param for proper encoding - return $.param(urlencodedFields(this.formToArray(semantic))); + return urlencode(this.formToArray(semantic)); }; /** @@ -2384,7 +2390,7 @@ function createSubmission(feature, forms, serialization) { }); // hand off to jQuery.param for proper encoding - return $.param(urlencodedFields(a)); + return urlencode(a); }; /** diff --git a/docs/research/4x-behavior-changes.md b/docs/research/4x-behavior-changes.md index 4eb3ee8..3c61f84 100644 --- a/docs/research/4x-behavior-changes.md +++ b/docs/research/4x-behavior-changes.md @@ -118,6 +118,7 @@ Collected as the modernization proceeds. Each entry is a change a consumer could - **Bundlers get the module build; CDNs keep the minified one.** The `browser` field in `package.json` pointed at `dist/jquery.form.min.js`, and bundlers that read it first (webpack, Vite, Browserify) bundled the minified classic build. It is removed: webpack and Vite now use `module` (`dist/jquery.form.mjs`) and Browserify uses `main` (`dist/jquery.form.js`). New `jsdelivr` and `unpkg` fields keep a bare CDN URL serving `dist/jquery.form.min.js`. - **The package includes `LICENSE-MIT`.** The package is dual-licensed (LGPL-2.1+ or MIT), but only `LICENSE` was published. - **The CommonJS factory uses the window it is given.** `require("jquery-form")(root, $)` read the global `window` and `document`, so it threw in Node unless a DOM was global (as in jest-environment-jsdom). The classic build now takes `window`, `document`, `navigator`, `Element` and `FormData` from `root`, falling back to the global window. jQuery 4 itself still needs a global window when required without one. +- **Spaces encode as `+` on every jQuery version.** jQuery 3 and later made `$.param` write a space as `%20`, so `formSerialize`, `fieldSerialize`, a GET query string and the `data` that `beforeSend` sees used `%20`, while jQuery 1 and 2 and a native form submission use `+`. They now use `+` everywhere. Servers decode both the same way; only code that compares the strings sees a difference. A string `data` option is passed through unchanged. ## Known behavior, not changed diff --git a/src/jquery.form.js b/src/jquery.form.js index c3be119..e4b5809 100644 --- a/src/jquery.form.js +++ b/src/jquery.form.js @@ -24,7 +24,7 @@ import { callFormMethod, tagName } from "./form-members.js"; import { createSuccessfulControls, isSuccessful, - urlencodedFields, + urlencode, valueOf, } from "./successful-controls.js"; import { deprecate, deprecateOldJQuery, log } from "./diagnostics.js"; @@ -202,7 +202,7 @@ import { submitterElement } from "./submitter.js"; */ $.fn.formSerialize = function (semantic) { // hand off to jQuery.param for proper encoding - return $.param(urlencodedFields(this.formToArray(semantic))); + return urlencode(this.formToArray(semantic)); }; /** @@ -232,7 +232,7 @@ import { submitterElement } from "./submitter.js"; }); // hand off to jQuery.param for proper encoding - return $.param(urlencodedFields(a)); + return urlencode(a); }; /** diff --git a/src/submission.js b/src/submission.js index 3bb8f80..08884ec 100644 --- a/src/submission.js +++ b/src/submission.js @@ -2,7 +2,7 @@ import { deprecate, log } from "./diagnostics.js"; import { assertRealParent } from "./form-members.js"; import jQuery from "jquery"; import { keepContext } from "./options.js"; -import { urlencodedFields } from "./successful-controls.js"; +import { urlencode } from "./successful-controls.js"; // A Submission is one ajaxSubmit call once its vetoes have passed: // { form, $form, fields, controls, options, method, traditional }. `options` is the object the @@ -248,7 +248,7 @@ export function createSubmission(feature, forms, serialization) { if (options.requestFormat === "json") { jsonBody(options, fields); } else { - encode(options, $.param(urlencodedFields(fields), traditional), qx); + encode(options, urlencode(fields, traditional), qx); } return { diff --git a/src/successful-controls.js b/src/successful-controls.js index 438d05f..3a8b999 100644 --- a/src/successful-controls.js +++ b/src/successful-controls.js @@ -116,6 +116,12 @@ export function wellFormed(value) { : value; } +// jQuery 3 dropped $.param's "+" for a space; a native submission still sends "+". Only a space +// encodes as %20, since a literal % encodes as %25. +export function urlencode(fields, traditional) { + return jQuery.param(urlencodedFields(fields), traditional).replace(/%20/g, "+"); +} + export function urlencodedFields(fields) { return jQuery.map(fields, function (field) { var value = diff --git a/test/e2e/published-node.test.mjs b/test/e2e/published-node.test.mjs index d387806..4ca79e4 100644 --- a/test/e2e/published-node.test.mjs +++ b/test/e2e/published-node.test.mjs @@ -99,8 +99,7 @@ function expected(version, value) { ownWindow: true, api: true, value, - // jQuery 1's $.param writes spaces as "+", later versions as "%20". - serialized: `text=plain${/^1\./.test(version) ? "+" : "%20"}%C3%BC&pick=b`, + serialized: "text=plain+%C3%BC&pick=b", data: { method: "POST", body: "text=plain+%C3%BC&pick=b" }, }; } diff --git a/test/suite/serialization.test.js b/test/suite/serialization.test.js index d34d8dc..de672bc 100644 --- a/test/suite/serialization.test.js +++ b/test/suite/serialization.test.js @@ -1173,14 +1173,12 @@ describe("form", function () { assert.strictEqual(serialized, "first=1"); }); - it("should encode spaces per jQuery version", function () { + it("should encode spaces as + on every jQuery version, as a native submission does", function () { const $form = $('
'); const serialized = $form.formSerialize(); - // jQuery before 3.0 encodes a space as "+" in $.param; later versions use "%20". - const space = Number($.fn.jquery.split(".")[0]) < 3 ? "+" : "%20"; - assert.strictEqual(serialized, `a=x${space}y`); + assert.strictEqual(serialized, "a=x+y"); }); it("should order the clicked image in place only when semantic is true", function () { @@ -1539,9 +1537,7 @@ describe("form", function () { const result = $fields.fieldSerialize(); - // jQuery before 3.0 encodes a space as "+" in $.param; later versions use "%20". - const space = Number($.fn.jquery.split(".")[0]) < 3 ? "+" : "%20"; - assert.strictEqual(result, `choice=a${space}b&choice=c`); + assert.strictEqual(result, "choice=a+b&choice=c"); }); it("should skip unnamed fields when successful is false", function () { diff --git a/test/suite/submission.test.js b/test/suite/submission.test.js index e5fd13d..2abc9d1 100644 --- a/test/suite/submission.test.js +++ b/test/suite/submission.test.js @@ -1895,14 +1895,24 @@ describe("form", function () { }); describe("request url and body", function () { - it("should encode spaces in the request body per jQuery version", function () { + it("should encode spaces in the request body as + on every jQuery version", function () { const $form = makeForm( '
' ); const settings = submitWith($form, [{}]); - assert.strictEqual(settings.data, majorVersion() < 3 ? "a=x+y" : "a=x%20y"); + assert.strictEqual(settings.data, "a=x+y"); + }); + + it("should encode spaces in a GET query string as + on every jQuery version", function () { + const $form = makeForm( + '
' + ); + + const settings = submitWith($form, [{}]); + + assert.strictEqual(settings.url, absolute("ajax/text.html") + "?a=x+y"); }); it("should leave a bare ? when a GET form has no fields", function () { diff --git a/test/suite/xhr-transport.test.js b/test/suite/xhr-transport.test.js index 5a59c71..d4781d7 100644 --- a/test/suite/xhr-transport.test.js +++ b/test/suite/xhr-transport.test.js @@ -519,7 +519,7 @@ describe("form", function () { const result = submitTransport(upload.$form); assert.strictEqual(result.transport, "plain"); - assert.strictEqual(result.settings.data, $.param({ title: "quarterly report" })); + assert.strictEqual(result.settings.data, "title=quarterly+report"); }); it("should use the FormData transport when a descendant file input belongs to another form", function () { @@ -1217,7 +1217,7 @@ describe("form", function () { assert.strictEqual( settings.url.split("?")[1], - $.param({ title: "quarterly report", document: "report.txt" }) + "title=quarterly+report&document=report.txt" ); }); }); From c137ff166a61bca7513bad790a5462585f90dfd8 Mon Sep 17 00:00:00 2001 From: Kevin Morris Date: Sun, 1 Nov 2026 23:38:20 -0500 Subject: [PATCH 25/78] test: cover debug output, the old-jQuery warning and ajaxForm unbinding --- test/suite/ajax-form.test.js | 64 ++++++++++++++++++++++++++++++++++ test/suite/diagnostics.test.js | 59 ++++++++++++++++++++++++++++++- 2 files changed, 122 insertions(+), 1 deletion(-) diff --git a/test/suite/ajax-form.test.js b/test/suite/ajax-form.test.js index 18241be..87914ea 100644 --- a/test/suite/ajax-form.test.js +++ b/test/suite/ajax-form.test.js @@ -123,6 +123,14 @@ describe("form", function () { } }); + it("should not queue an empty selection once the DOM is ready", function () { + const $empty = $(".missing-ready-form"); + + const warnings = recordDeprecations(true, () => $empty.ajaxForm()); + + assert.isFalse(warnings.some((text) => text.includes("queuing"))); + }); + it("should return an empty selection without binding handlers", function () { const $missing = $(".missing-ajax-form"); @@ -479,6 +487,23 @@ describe("form", function () { }); }); + it("should not send a button clicked before the click window ended", async function () { + const $form = $( + '
' + ).appendTo("#main"); + $form.on("submit", false); + $form.ajaxForm(); + $form.find("button").trigger("click"); + await new Promise((resolve) => setTimeout(resolve, 120)); + + const requests = await withAjaxCapture(async function (requests) { + $form.ajaxSubmit(); + return requests; + }); + + assert.strictEqual(requests[0].data, ""); + }); + it("should call beforeSubmit and then success when the submit button is clicked", async function () { const opts = {}; @@ -902,6 +927,18 @@ describe("form", function () { ); }); + it("should name a selector to pass instead in the warning", function () { + const $form = $("
").appendTo("#main"); + + $form.ajaxForm({ delegation: true }); + + const expected = $form.selector === undefined ? 1 : 0; + assert.strictEqual( + warnings.filter((message) => message.includes('delegation: "form.ajax"')).length, + expected + ); + }); + it("should not warn when delegation is a selector", function () { $().ajaxForm({ delegation: ".scoped-ajax-form" }); @@ -1179,6 +1216,21 @@ describe("form", function () { ); }); + it("should keep other selectors bound when a selector is named like an object member", async function () { + const $form = $('
').appendTo("#main"); + + const calls = await withAjaxSubmitStub(async function (calls) { + $().ajaxForm({ delegation: ".scoped-ajax-form" }); + $().ajaxForm({ delegation: "constructor" }); + $form.trigger("submit"); + $().ajaxFormUnbind("constructor"); + $().ajaxFormUnbind(".scoped-ajax-form"); + return calls; + }); + + assert.strictEqual(calls.length, 1); + }); + describe("without Element.prototype.closest", function () { let closest; @@ -2062,6 +2114,18 @@ describe("form", function () { $(document).off(".form-plugin"); }); + it("should leave the page's own document handlers in place", function () { + let clicks = 0; + $(document).on("click.page-handler", () => clicks++); + $().ajaxForm({ delegation: ".scoped-ajax-form" }); + + $().ajaxFormUnbind(); + $(document).trigger("click"); + $(document).off("click.page-handler"); + + assert.strictEqual(clicks, 1); + }); + it("should keep a delegation selector working when another form is bound directly", async function () { const $scoped = $('
').appendTo("#main"); const $direct = $("
").appendTo("#main"); diff --git a/test/suite/diagnostics.test.js b/test/suite/diagnostics.test.js index 122fbea..6d988a7 100644 --- a/test/suite/diagnostics.test.js +++ b/test/suite/diagnostics.test.js @@ -1,5 +1,5 @@ import { assert, describe, it } from "vitest"; -import { beforeJQuery35, deprecate, deprecateOldJQuery } from "../../src/diagnostics.js"; +import { beforeJQuery35, deprecate, deprecateOldJQuery, log } from "../../src/diagnostics.js"; import { recordDeprecations, resetFixture } from "./helpers.js"; describe("form", function () { @@ -54,6 +54,22 @@ describe("form", function () { assert.doesNotThrow(run); }); + it("should prefix the message and join its parts without a separator", function () { + const logged = []; + const consoleLog = console.log; + console.log = (text) => logged.push(text); + $.fn.ajaxSubmit.debug = true; + + try { + log("state = ", "complete", 1); + } finally { + $.fn.ajaxSubmit.debug = false; + console.log = consoleLog; + } + + assert.deepEqual(logged, ["[jquery.form] state = complete1"]); + }); + it("should stay silent when debug is disabled", function () { const logged = []; const log = console.log; @@ -181,5 +197,46 @@ describe("form", function () { assert.deepEqual(warnings, []); }); + + it("should prefix a deprecation warning with the plugin name", function () { + const warnings = recordDeprecations(true, () => deprecate("test-prefix", "a message")); + + assert.deepEqual(warnings, ["[jquery.form] a message (removed in 5.0)"]); + }); + + describe("on a page whose jQuery is older than 3.5", function () { + function withJQueryVersion(version, run) { + const actual = $.fn.jquery; + $.fn.jquery = version; + + try { + return run(); + } finally { + $.fn.jquery = actual; + } + } + + it("should warn on the first ajaxSubmit under debug", function () { + const $form = $('
').appendTo("#main"); + + const warnings = withJQueryVersion("3.4.1", () => + recordDeprecations(true, () => $form.ajaxSubmit({ beforeSubmit: () => false })) + ); + + assert.strictEqual(warnings.length, 1); + assert.include(warnings[0], "jQuery 3.4.1"); + }); + + it("should warn on the first ajaxForm under debug", function () { + const $form = $("
").appendTo("#main"); + + const warnings = withJQueryVersion("3.4.1", () => + recordDeprecations(true, () => $form.ajaxForm()) + ); + + assert.strictEqual(warnings.length, 1); + assert.include(warnings[0], "jQuery 3.4.1"); + }); + }); }); }); From 09ca0f0c6a0839284ebe0ba1ff109d499971d6dd Mon Sep 17 00:00:00 2001 From: Kevin Morris Date: Sun, 1 Nov 2026 23:40:28 -0500 Subject: [PATCH 26/78] test: cover iframe upload events, CSRF method checks and embedded responses --- test/suite/iframe-response.test.js | 27 ++++++ test/suite/iframe-transport.test.js | 125 ++++++++++++++++++++++++++++ 2 files changed, 152 insertions(+) diff --git a/test/suite/iframe-response.test.js b/test/suite/iframe-response.test.js index b46c632..af93925 100644 --- a/test/suite/iframe-response.test.js +++ b/test/suite/iframe-response.test.js @@ -57,6 +57,33 @@ describe("iframe response reader", function () { assert.strictEqual(xhr.getResponseHeader("Content-Type"), "xml"); }); + it("should keep the markup of an HTML response that contains a textarea", function () { + const doc = parse(""); + const xhr = mockXhr(); + + const result = readResponse(doc, xhr, { dataType: "html" }, noRetry); + + assert.strictEqual(result.data, ""); + }); + + it("should keep the body markup with the textarea option when no textarea is found", function () { + const doc = parse("bold"); + const xhr = mockXhr(); + + const result = readResponse(doc, xhr, { dataType: "html", textarea: true }, noRetry); + + assert.strictEqual(result.data, "bold"); + }); + + it("should parse JSON from the body text when there is no pre or textarea", function () { + const doc = parse('{"a":"x & y"}'); + const xhr = mockXhr(); + + const result = readResponse(doc, xhr, { dataType: "json" }, noRetry); + + assert.deepEqual(result.data, { a: "x & y" }); + }); + it("should parse JSON embedded in a textarea", function () { const doc = parse(''); const xhr = mockXhr(); diff --git a/test/suite/iframe-transport.test.js b/test/suite/iframe-transport.test.js index b5ecbd0..7725094 100644 --- a/test/suite/iframe-transport.test.js +++ b/test/suite/iframe-transport.test.js @@ -1844,6 +1844,41 @@ describe("form", function () { assert.strictEqual($("iframe").length, frames); }); + it("should pass the xhr, the settings and canceled to ajaxError when beforeSend vetoes", function () { + const $form = createIframeForm("ajax/iframe-text.html"); + let seen; + $(document).on("ajaxError.ifrlog", function (event, xhr, settings, reason) { + seen = [typeof xhr.abort, settings.iframe, reason]; + }); + + $form.ajaxSubmit({ iframe: true, beforeSend: () => false }); + + assert.deepEqual(seen, ["function", true, "canceled"]); + }); + + it("should fire no global events when beforeSend vetoes with global false", function () { + const $form = createIframeForm("ajax/iframe-text.html"); + const events = []; + recordGlobalEvents(events); + + $form.ajaxSubmit({ iframe: true, global: false, beforeSend: () => false }); + + assert.deepEqual(events, []); + }); + + it("should ignore an abort after beforeSend vetoed", function () { + const $form = createIframeForm("ajax/iframe-text.html"); + const events = []; + let errors = 0; + $form.ajaxSubmit({ iframe: true, beforeSend: () => false, error: () => errors++ }); + recordGlobalEvents(events); + + $form.data("jqxhr").abort(); + + assert.strictEqual(errors, 0); + assert.deepEqual(events, []); + }); + it("should end the global events without ajaxSend when beforeSend vetoes", function () { const $form = createIframeForm("ajax/iframe-text.html"); const events = []; @@ -1998,6 +2033,34 @@ describe("form", function () { }); }); + it("should post the CSRF token when the type option is POST on a form without a method", function () { + const $form = $( + '
' + ).appendTo("#main"); + addCsrfMetas("secret"); + let fields; + + startStubbedUpload($form, { type: "POST" }, function (form) { + fields = hiddenFields(form); + }); + + assert.deepEqual(fields, [["authenticity_token", "secret"]]); + }); + + it("should not post the CSRF token when the type option is PUT on a form without a method", function () { + const $form = $( + '
' + ).appendTo("#main"); + addCsrfMetas("secret"); + let fields; + + startStubbedUpload($form, { type: "PUT" }, function (form) { + fields = hiddenFields(form); + }); + + assert.deepEqual(fields, []); + }); + it("should post the CSRF param twice when the form already has that field", function () { const $form = createIframeForm("ajax/iframe-text.html"); $('').appendTo($form); @@ -2555,6 +2618,68 @@ describe("form", function () { assert.strictEqual(result.success[2].status, 304); }); + it("should treat an emulated 300 as an error", async function () { + const result = await submitWithBodyAttributes({ status: "300" }, { dataType: "text" }); + + assert.strictEqual(result.error[1], "error"); + }); + + it("should resolve the Deferred with the response text, success and the xhr", async function () { + const $form = createIframeForm("ajax/iframe-text.html"); + + const result = await submitThroughIframe($form, { dataType: "text" }); + const resolved = await new Promise((resolve) => + result.xhr.done((...args) => resolve(args)) + ); + + assert.deepEqual([resolved[0].trim(), resolved[1]], ["iframe response", "success"]); + assert.strictEqual(resolved[2], result.success[2]); + }); + + it("should pass the xhr and the settings to ajaxComplete", async function () { + const $form = createIframeForm("ajax/iframe-text.html"); + let seen; + $(document).on("ajaxComplete.ifrlog", function (event, xhr, settings) { + seen = [xhr.responseText.trim(), settings.iframe]; + }); + + await submitThroughIframe($form, { dataType: "text" }); + + assert.deepEqual(seen, ["iframe response", true]); + }); + + it("should fire no ajaxError for an error status with global false", async function () { + const $form = createIframeForm("ajax/iframe-error.html"); + const events = []; + recordGlobalEvents(events); + + const result = await submitThroughIframe($form, { dataType: "text", global: false }); + + assert.strictEqual(result.error[1], "error"); + assert.deepEqual(events, []); + }); + + it("should rethrow the error the success callback threw", async function () { + const $form = createIframeForm("ajax/iframe-text.html"); + const thrown = new Error("success failed"); + + const errors = await withWindowErrors(async function (errors) { + await new Promise(function (resolve) { + $form.ajaxSubmit({ + iframe: true, + dataType: "text", + success: function () { + setTimeout(resolve, 20); + throw thrown; + }, + }); + }); + return errors.slice(); + }); + + assert.deepEqual(errors, [thrown]); + }); + it("should treat an emulated 1xx status as an error", async function () { const result = await submitWithBodyAttributes({ status: "102" }, { dataType: "text" }); From 191f28f240d1aff2ed7c7f594ce837f819bc759d Mon Sep 17 00:00:00 2001 From: Kevin Morris Date: Sun, 1 Nov 2026 23:42:50 -0500 Subject: [PATCH 27/78] test: cover container serialization, an overriding fieldValue and resetForm on mixed selections --- test/suite/field-helpers.test.js | 14 +++++++++++ test/suite/form-members.test.js | 11 +++++++++ test/suite/serialization.test.js | 41 ++++++++++++++++++++++++++++++++ 3 files changed, 66 insertions(+) diff --git a/test/suite/field-helpers.test.js b/test/suite/field-helpers.test.js index 2cc8c3f..5bde2f2 100644 --- a/test/suite/field-helpers.test.js +++ b/test/suite/field-helpers.test.js @@ -226,6 +226,20 @@ describe("form", function () { assert.strictEqual($label.find("input").val(), "nested"); }); + it("should reset every selected element after a label or a container", function () { + const $label = $('').appendTo("#main"); + const $div = $('
').appendTo("#main"); + const $last = $('').appendTo("#main"); + $("#main input").val("changed"); + + $label.add($div).add($last).resetForm(); + + assert.deepEqual( + [$label.find("input").val(), $div.find("input").val(), $last.val()], + ["in label", "in div", "last"] + ); + }); + // #600: the document and text nodes have no tag name. it("should reset the fields of a document and skip text nodes", function () { const $input = $('').appendTo("#main").val("changed"); diff --git a/test/suite/form-members.test.js b/test/suite/form-members.test.js index 03c34a0..b05cfcd 100644 --- a/test/suite/form-members.test.js +++ b/test/suite/form-members.test.js @@ -1,5 +1,6 @@ import { assert, describe, it } from "vitest"; import { callFormMethod, formMember } from "../../src/form-members.js"; +import { formAttribute } from "../../src/form-attributes.js"; describe("form members", function () { describe("formMember", function () { @@ -75,4 +76,14 @@ describe("form members", function () { assert.strictEqual(valid, false); }); }); + + describe("formAttribute", function () { + it("should return undefined for an absent attribute, as jQuery's attr does", function () { + const form = $('
')[0]; + + const value = formAttribute(form, "id"); + + assert.strictEqual(value, undefined); + }); + }); }); diff --git a/test/suite/serialization.test.js b/test/suite/serialization.test.js index de672bc..aab6f87 100644 --- a/test/suite/serialization.test.js +++ b/test/suite/serialization.test.js @@ -273,6 +273,27 @@ describe("form", function () { assert.strictEqual(calls, 0); }); + it("should keep the controls of a nested form when a container is serialized semantically", function () { + const $div = $( + '
' + ).appendTo("#main"); + + const names = $div.formToArray(true).map((field) => field.name); + + assert.deepEqual(names, ["loose", "inner"]); + }); + + it("should not add controls that name another form when a container with an id is serialized semantically", function () { + const $div = $('
').appendTo( + "#main" + ); + $('').appendTo("#main"); + + const names = $div.formToArray(true).map((field) => field.name); + + assert.deepEqual(names, ["a"]); + }); + it("should serialize only the first form when the selection holds several forms", function () { const $forms = $( '
' @@ -1227,6 +1248,26 @@ describe("form", function () { } }); + it("should skip a control for which an overriding $.fieldValue returns undefined", function () { + const $form = $('
'); + const saved = $.fieldValue; + $.fieldValue = function () { + return undefined; + }; + + try { + const results = [ + $form.formToArray(), + $form.find("input").fieldSerialize(), + $form.find("input").fieldValue(), + ]; + + assert.deepEqual(results, [[], "", []]); + } finally { + $.fieldValue = saved; + } + }); + it("should return null for a control inside a disabled fieldset", function () { const input = $('
').find("input")[0]; From fd6b910c13982c3ef61861f981845fb093db7536 Mon Sep 17 00:00:00 2001 From: Kevin Morris Date: Sun, 1 Nov 2026 23:44:56 -0500 Subject: [PATCH 28/78] test: cover submission url, method and transport edge cases --- test/suite/legacy-jquery.test.js | 21 ++++++ test/suite/submission.test.js | 107 +++++++++++++++++++++++++++++++ 2 files changed, 128 insertions(+) diff --git a/test/suite/legacy-jquery.test.js b/test/suite/legacy-jquery.test.js index dfd5f32..a9cf682 100644 --- a/test/suite/legacy-jquery.test.js +++ b/test/suite/legacy-jquery.test.js @@ -259,6 +259,27 @@ describe("form", function () { assert.strictEqual(result.transport, "iframe"); }); + it("should send a form without files that is not multipart as a plain request", function () { + const $form = $( + '
' + ).appendTo("#main"); + + const result = submitTransport($form); + + assert.strictEqual(result.transport, "plain"); + }); + + it("should send a selected file as a plain request when iframe is false", function () { + const $form = $( + '
' + ).appendTo("#main"); + selectFiles($form.find("input")[0], ["x.txt"]); + + const result = submitTransport($form, { iframe: false }); + + assert.strictEqual(result.transport, "plain"); + }); + it("should use the iframe transport when the form is multipart and has no file", function () { const $form = $( '
' diff --git a/test/suite/submission.test.js b/test/suite/submission.test.js index 2abc9d1..93ccb66 100644 --- a/test/suite/submission.test.js +++ b/test/suite/submission.test.js @@ -12,6 +12,8 @@ import { selectFiles, formHidingParentNode, buildForm, + recordDeprecations, + submitTransport, } from "./helpers.js"; function makeForm(html) { @@ -540,6 +542,17 @@ describe("form", function () { }); describe("callbacks", function () { + it("should leave the fields as they are after success without resetForm", function () { + const $form = makeForm( + '
' + ); + $form.find("input").val("changed"); + + submitWith($form, [{}], (settings) => settings.success("ok", "success", {})); + + assert.strictEqual($form.find("input").val(), "changed"); + }); + it("should call beforeSubmit with the field array and the form", async function () { const opts = {}; @@ -957,6 +970,15 @@ describe("form", function () { }); describe("method and type", function () { + it("should upload a container's files with the type option GET", function () { + const $div = makeForm('
'); + selectFiles($div.find("input")[0], ["a.txt"]); + + const settings = submitWith($div, [{ type: "GET", url: "ajax/text.html" }]); + + assert.strictEqual(settings.type, "GET"); + }); + it("should use options.method as the type on the $.ajax path", function () { const $form = makeForm( '
' @@ -1187,6 +1209,35 @@ describe("form", function () { } ); }); + + it("should keep the other options when the url option is false", function () { + const $form = makeForm('
'); + + const settings = submitWith($form, [{ url: false, type: "put", data: { x: "1" } }]); + + assert.strictEqual(settings.type, "put"); + assert.strictEqual(settings.data, "x=1"); + }); + + it("should put the query before the fragment of a url option that is only a fragment", function () { + const $form = makeForm( + '
' + ); + + const settings = submitWith($form, [{ url: "#top" }]); + + assert.strictEqual(settings.url, "?a=1#top"); + }); + + it("should join the query with & to a url option that is only a query", function () { + const $form = makeForm( + '
' + ); + + const settings = submitWith($form, [{ url: "?x=1" }]); + + assert.strictEqual(settings.url, "?x=1&a=1"); + }); }); describe("options merge", function () { @@ -1803,6 +1854,21 @@ describe("form", function () { assert.strictEqual(settings.url, absolute("ajax/text.html") + "?a=1&x=1"); }); + + it("should send a query-string part that starts with = as a field without a name", function () { + const $form = makeForm( + '
' + ); + selectFiles($form.find("input")[0], ["a.txt"]); + + const settings = submitWith($form, [{ data: "=x&b" }]); + const entries = Array.from(uploadBody(settings).entries()).filter(([name]) => name !== "f"); + + assert.deepEqual(entries, [ + ["", "x"], + ["b", ""], + ]); + }); }); describe("requestFormat json", function () { @@ -2375,7 +2441,48 @@ describe("form", function () { }); }); + describe("transport and settings", function () { + ["multipart/form-data-x", "x-multipart/form-data"].forEach(function (enctype) { + it("should send a form with the enctype " + enctype + " as a plain request", function () { + const $form = makeForm( + '
' + ).attr("enctype", enctype); + + const result = submitTransport($form, {}); + + assert.strictEqual(result.transport, "plain"); + }); + }); + + it("should use the $.ajaxSetup context for an upload without its own", async function () { + const $form = makeForm( + '
' + ); + selectFiles($form.find("input")[0], ["a.txt"]); + const context = { name: "setup" }; + + const settings = await withAjaxSettings({ context: context }, () => + submitWith($form, [{}]) + ); + + assert.strictEqual(settings.context, context); + }); + }); + describe("debug logging", function () { + it("should not warn about the iframe transport for a plain request", function () { + const $form = makeForm( + '
' + ); + + const warnings = recordDeprecations(true, () => submitWith($form, [{}])); + + assert.deepEqual( + warnings.filter((text) => text.includes("iframe")), + [] + ); + }); + function countLogs(run) { const log = console.log; let count = 0; From 1d92e6f2ea1359c00f1c8dc46344536b312eb432 Mon Sep 17 00:00:00 2001 From: Kevin Morris Date: Sun, 1 Nov 2026 23:12:22 -0500 Subject: [PATCH 29/78] fix: reject an unparsable iframe response with parsererror, and report the statusText of an error status --- dist/jquery.form.js | 8 ++- dist/jquery.form.min.js | 2 +- dist/jquery.form.min.js.map | 2 +- dist/jquery.form.mjs | 8 ++- docs/research/4x-behavior-changes.md | 3 +- src/iframe-lifecycle.js | 8 ++- test/suite/iframe-transport.test.js | 93 ++++++++++++++++++++++------ 7 files changed, 97 insertions(+), 27 deletions(-) diff --git a/dist/jquery.form.js b/dist/jquery.form.js index e9b76c0..66bf704 100644 --- a/dist/jquery.form.js +++ b/dist/jquery.form.js @@ -1492,8 +1492,12 @@ function createLifecycle(s, frame) { return; } - // an emulated HTTP error status wins, as in $.ajax; a parse error is kept otherwise + // an emulated HTTP error status wins with the statusText, as in $.ajax; a parse error is + // kept otherwise if (xhr.status && !((xhr.status >= 200 && xhr.status < 300) || xhr.status === 304)) { + if (status === "parsererror") { + errMsg = undefined; + } status = "error"; } @@ -1518,7 +1522,7 @@ function createLifecycle(s, frame) { if (s.error) { s.error.call(s.context, xhr, status, errMsg); } - deferred.reject(xhr, "error", errMsg); + deferred.reject(xhr, status, errMsg); if (g) { $$1.event.trigger("ajaxError", [xhr, s, errMsg]); } diff --git a/dist/jquery.form.min.js b/dist/jquery.form.min.js index 1eb322f..c80cc48 100644 --- a/dist/jquery.form.min.js +++ b/dist/jquery.form.min.js @@ -19,5 +19,5 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. */ -!function(e){"function"==typeof define&&define.amd?define(["jquery"],function(t){e(t,window)}):"object"==typeof module&&module.exports?module.exports=function(t,r){return void 0===r&&(r="undefined"!=typeof window?require("jquery"):require("jquery")(t)),e(r,t||("undefined"!=typeof window?window:void 0)),r}:e(jQuery,window)}(function(e,t){"use strict";var r=t,n=r.document,a=r.navigator,o=r.Element,i=r.FormData,u=["HTMLFormElement","HTMLElement","Element","Node"],s=n.createElement("form");function c(e){for(var t=0;t=0)return r;return null}var h="jqFormSubmitter";function g(e,t,r){try{e[t]=r}catch(e){}}function y(e,t){var r=e[t],n=l(e,"elements");return n&&r&&n.namedItem(t)===r?void 0:r}function b(t,r,n,a){e.data(t,h,{el:r,x:n,y:a}),g(t,"clk",r),"image"===r.type&&(g(t,"clk_x",n),g(t,"clk_y",a)),setTimeout(function(){e.data(t,h,null),g(t,"clk",null),g(t,"clk_x",null),g(t,"clk_y",null)},100)}function x(t){var r=v(t.target,["button","input"]);if(r&&("submit"===r.type||"image"===r.type)){var n=r.form;if(n){var a="image"===r.type?function(t,r){if(void 0!==t.offsetX)return[t.offsetX,t.offsetY];if("function"==typeof e.fn.offset){var n=e(r).offset();return[t.pageX-n.left,t.pageY-n.top]}return[t.pageX-r.offsetLeft,t.pageY-r.offsetTop]}(t,r):[];b(n,r,a[0],a[1])}}}function j(t){if(!t)return null;var r=e.data(t,h);if(r)return r;var n=y(t,"clk");return n?{el:n,x:y(t,"clk_x"),y:y(t,"clk_y")}:null}function T(){if(e.fn.ajaxSubmit.debug){var t="[jquery.form] "+Array.prototype.join.call(arguments,"");r.console&&r.console.log?r.console.log(t):r.opera&&r.opera.postError&&r.opera.postError(t)}}var w={};function S(t,n){e.fn.ajaxSubmit.debug&&!w[t]&&(w[t]=!0,r.console&&"function"==typeof r.console.warn&&r.console.warn("[jquery.form] "+n+" (removed in 5.0)"))}function F(e){(function(e){var t=String(e).split("."),r=Number(t[0]);return r<3||3===r&&Number(t[1])<5})(e)&&S("jquery","support for jQuery "+e+" is deprecated, 5.0 needs jQuery 3.5 or later")}function E(e,t,r,n){if("string"!=typeof e&&!1!==e)return e;var a={url:e,data:t,dataType:r};return"function"==typeof n&&(a.success=n),a}function D(e,t,r,n){return"function"==typeof e?{success:e}:void 0===(e=E(e,t,r,n))?{}:!1===e.url||""===e.url?function(e){var t={};for(var r in e)"url"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}(e):e}function k(e,t){for(var r=0;r"'),e(function(){e(n.s,n.c).ajaxForm(r)}),t):(T("terminating; zero elements found by selector"+(e.isReady?"":" (DOM not ready)")),t)}(this,t))}function P(t){return"string"==typeof t?(N(t),this):(t!==I&&(C={},e(n).off("submit.form-plugin click.form-plugin")),this.off("submit.form-plugin click.form-plugin"))}function X(t,r){if(!p(t))return e(t).attr(r);var n=f(t,"getAttribute",r);return null===n?void 0:n}var R=/\r\n|\r|\n/g,H=/\r/g,U=/^(?:fieldset|object|output)$/;function z(e){return"function"==typeof e.matches?e.matches(":disabled"):!!e.disabled}function W(t){if("select"===d(t))return function(e){var t=e.selectedIndex;if(t<0)return null;for(var r=[],n=e.options,a="select-one"===e.type,o=a?t+1:n.length,i=a?t:0;i=0,o=a?e.responseXML:e.responseText;return a&&"parsererror"===o.documentElement.nodeName&&ie.error&&ie.error("parsererror"),r&&r.dataFilter&&(o=r.dataFilter(o,t)),"string"==typeof o&&(("json"===t||!t)&&n.indexOf("json")>=0?o=JSON.parse(o):"script"===t&&ie.globalEval(o)),o}(t,c,n)}catch(e){u="parsererror",t.error=i=e||u}}catch(e){T("error caught: ",e),u="error",t.error=i=e}return{status:u,data:o,errMsg:i}}var le=e;function fe(e,t){var r,n,a,o=le.Deferred(),i={aborted:0,responseText:null,responseXML:null,status:0,statusText:"n/a",getAllResponseHeaders:function(){},getResponseHeader:function(){},setRequestHeader:function(){},abort:function(e){s(e,[i,"aborted",e])}};function u(){return i.aborted||a}function s(n,a,s){var c=s||("timeout"===n?"timeout":"aborted");u()||(T("aborting upload... "+c),i.aborted=1,t.stop(),i.error=c,e.error&&e.error.call(e.context,i,c,n),o.reject.apply(o,a),r&&le.event.trigger("ajaxError",[i,e,c]),l(c))}function c(){r&&le.event.trigger("ajaxComplete",[i,e]),r&&! --le.active&&le.event.trigger("ajaxStop")}function l(r){e.complete&&e.complete.call(e.context,i,r),c(),clearTimeout(n),setTimeout(function(){t.release(),i.responseXML=null},100)}function f(t){var n=t.status,u=t.errMsg;if(i.aborted)T("upload aborted");else if(i.status&&!(i.status>=200&&i.status<300||304===i.status)&&(n="error"),a=!0,"success"!==n)void 0===u&&(u=i.statusText),e.error&&e.error.call(e.context,i,n,u),o.reject(i,"error",u),r&&le.event.trigger("ajaxError",[i,e,u]),l(n);else{var s=function(t){var n;try{e.success.call(e.context,t,"success",i)}catch(e){n={error:e}}return o.resolve(i.responseText,"success",i),r&&le.event.trigger("ajaxSuccess",[i,e,t]),n}(t.data);if(l(n),s)throw s.error}}return o.abort=function(e){i.abort(e)},{xhr:i,deferred:o,start:function(){return(r=e.global)&&0===le.active++&&le.event.trigger("ajaxStart"),e.beforeSend&&!1===e.beforeSend.call(e.context,i,e)?(u()||(a=!0,o.reject(),r&&le.event.trigger("ajaxError",[i,e,"canceled"]),c()),!1):!i.aborted&&(r&&le.event.trigger("ajaxSend",[i,e]),!i.aborted)},done:u,abort:s,settle:f,fail:function(e){f({status:"error",errMsg:e})},startTimer:function(t){e.timeout&&(n=setTimeout(t,e.timeout))},stopTimer:function(){clearTimeout(n),n=void 0}}}var de=e;function pe(e,t){var r=0;function n(e){var n=e.form,a=e.method,o=k(de.extend(!0,{},de.ajaxSettings,e.options),[de.ajaxSettings,e.options]);o.context=o.context||o;var i=l(n,"ownerDocument"),u=de(v(n,["body"])),s=function(e,t,r){var n,a;if(e.iframeTarget)(a=(n=de(e.iframeTarget,r)).attr("name"))?t=a:(n.attr("name",t),n.each(function(){!function(e,t){try{e.contentWindow&&(e.contentWindow.name=t)}catch(e){}}(this,t)}));else{var o=r.createElement("iframe");o.setAttribute("name",t),o.setAttribute("src",e.iframeSrc),(n=de(o)).css({position:"absolute",top:"-1000px",left:"-1000px"})}return{$io:n,id:t}}(o,"jqFormIO"+(new Date).getTime()+r++,i),c=s.$io,d=c[0],p=fe(o,function(e,t){return{stop:function(){try{t[0].contentWindow.document.execCommand&&t[0].contentWindow.document.execCommand("Stop")}catch(e){}t.attr("src",e.iframeSrc)},release:function(){e.iframeTarget?t.attr("src",e.iframeSrc):t.remove()}}}(o,c)),m=50;if(!p.start())return p.deferred;function h(){try{var e=ue(d).readyState;T("state = "+e),e&&"uninitialized"===e.toLowerCase()&&setTimeout(h,50)}catch(e){T("Server abort: ",e," (",e.name,")"),b(2),p.stopTimer()}}function g(){var r=function(e){var t={};return Z.each(ee,function(r,n){t[n]=f(e,"hasAttribute",n)?f(e,"getAttribute",n):null}),t}(n);!function(e,t,r,n,a){var o="multipart/form-data";oe(e,"target",t),!r||/post/i.test(r)?oe(e,"method","POST"):re(r)&&!re(a.property(e,"method"))&&oe(e,"method","GET"),oe(e,"action",n.url),n.skipEncodingOverride||r&&!/post/i.test(r)||(oe(e,"encoding",o),oe(e,"enctype",o))}(n,s.id,a,o,t),p.startTimer(function(){b(1)});var l=[];try{!function(e,t,r,n,a){function o(r,n){var o=t.createElement("input");o.type="hidden",o.name=r,a.push(Z(o).val(n).appendTo(e)[0])}if(r)for(var i in r)if(te.call(r,i))if(Z.isPlainObject(r[i])&&te.call(r[i],"name")&&te.call(r[i],"value"))o(r[i].name,r[i].value);else{var u={};u[i]=r[i];for(var s=Y(u,n),c=0;c=0?"&":"?")+t+e.url.slice(a.length),e.data=null}else e.data=t}(t,V(y,h),x),{form:f,$form:e,fields:y,controls:b,options:t,method:d,traditional:h}))},deliver:function(e){var t=e.$form,r=e.options,n=[];if(r.resetForm&&n.push(function(){t.resetForm()}),r.clearForm&&n.push(function(){t.clearForm(r.includeHidden)}),!r.dataType&&r.target){var a=d(r.success);n.push(function(e,t,n){var o=arguments,i=r.replaceTarget?"replaceWith":"html",s=u(r.target);"string"==typeof e?s[i](e):T("target: the response was parsed by jQuery, so it is not inserted"),s.length||p(a,this,o),s.each(function(){p(a,this,o)})})}else u.merge(n,d(r.success));if(r.success=function(e,a,o){for(var i=r.context||this,u=0,s=n.length;u0,i=/^[\t\n\f\r ]*multipart\/form-data[\t\n\f\r ]*$/i,s=i.test(o.attribute(r[0],"enctype"))||i.test(o.attribute(r[0],"encoding")),c=t.fileapi&&t.formdata;T("fileAPI :"+c);var l=(a||s)&&!c,f=(a||s)&&c?"formdata":"ajax";if(!1!==n.iframe&&(n.iframe||l)&&(f="iframe"),"iframe"!==f||n.iframe||S("iframe","choosing the iframe transport automatically without FormData is deprecated, set iframe: true"),"ajax"!==f&&"json"===n.requestFormat)throw new Error('jquery.form: requestFormat "json" cannot send files or use the iframe transport');return f}}}!function(e){var t={};t.fileapi=void 0!==e('').get(0).files,t.formdata=void 0!==r.FormData;var n=!!e.fn.prop;var o={attribute:X,property:function(e,t){var r=n?e[t]:void 0;return"string"==typeof r?r:X(e,t)}},i=_(t),u=me(t,o,i),s={iframe:pe(n,o),formdata:G,ajax:J};e.fn.attr2=function(){if(S("attr2","attr2 is deprecated, use .prop() or .attr()"),!n)return this.attr.apply(this,arguments);var e=this.prop.apply(this,arguments);return e&&e.jquery||"string"==typeof e?e:this.attr.apply(this,arguments)},e.fn.ajaxSubmit=function(t,r,n,a){if(F(e.fn.jquery),!this.length)return T("ajaxSubmit: skipping submit process - no element selected"),this;if(!e.ajax)throw new Error("jquery.form: ajaxSubmit needs the full jQuery build; this jQuery has no $.ajax");var o=u.prepare(this,D(t,r,n,a));if(!o)return this;u.deliver(o);var i=s[u.chooseTransport(o)](o);this.removeData("jqxhr").data("jqxhr",i);for(var c=0;c=0)return r;return null}var h="jqFormSubmitter";function g(e,t,r){try{e[t]=r}catch(e){}}function y(e,t){var r=e[t],n=l(e,"elements");return n&&r&&n.namedItem(t)===r?void 0:r}function b(t,r,n,a){e.data(t,h,{el:r,x:n,y:a}),g(t,"clk",r),"image"===r.type&&(g(t,"clk_x",n),g(t,"clk_y",a)),setTimeout(function(){e.data(t,h,null),g(t,"clk",null),g(t,"clk_x",null),g(t,"clk_y",null)},100)}function x(t){var r=v(t.target,["button","input"]);if(r&&("submit"===r.type||"image"===r.type)){var n=r.form;if(n){var a="image"===r.type?function(t,r){if(void 0!==t.offsetX)return[t.offsetX,t.offsetY];if("function"==typeof e.fn.offset){var n=e(r).offset();return[t.pageX-n.left,t.pageY-n.top]}return[t.pageX-r.offsetLeft,t.pageY-r.offsetTop]}(t,r):[];b(n,r,a[0],a[1])}}}function j(t){if(!t)return null;var r=e.data(t,h);if(r)return r;var n=y(t,"clk");return n?{el:n,x:y(t,"clk_x"),y:y(t,"clk_y")}:null}function T(){if(e.fn.ajaxSubmit.debug){var t="[jquery.form] "+Array.prototype.join.call(arguments,"");r.console&&r.console.log?r.console.log(t):r.opera&&r.opera.postError&&r.opera.postError(t)}}var w={};function S(t,n){e.fn.ajaxSubmit.debug&&!w[t]&&(w[t]=!0,r.console&&"function"==typeof r.console.warn&&r.console.warn("[jquery.form] "+n+" (removed in 5.0)"))}function F(e){(function(e){var t=String(e).split("."),r=Number(t[0]);return r<3||3===r&&Number(t[1])<5})(e)&&S("jquery","support for jQuery "+e+" is deprecated, 5.0 needs jQuery 3.5 or later")}function E(e,t,r,n){if("string"!=typeof e&&!1!==e)return e;var a={url:e,data:t,dataType:r};return"function"==typeof n&&(a.success=n),a}function D(e,t,r,n){return"function"==typeof e?{success:e}:void 0===(e=E(e,t,r,n))?{}:!1===e.url||""===e.url?function(e){var t={};for(var r in e)"url"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}(e):e}function k(e,t){for(var r=0;r"'),e(function(){e(n.s,n.c).ajaxForm(r)}),t):(T("terminating; zero elements found by selector"+(e.isReady?"":" (DOM not ready)")),t)}(this,t))}function P(t){return"string"==typeof t?(N(t),this):(t!==I&&(C={},e(n).off("submit.form-plugin click.form-plugin")),this.off("submit.form-plugin click.form-plugin"))}function X(t,r){if(!p(t))return e(t).attr(r);var n=f(t,"getAttribute",r);return null===n?void 0:n}var R=/\r\n|\r|\n/g,H=/\r/g,U=/^(?:fieldset|object|output)$/;function z(e){return"function"==typeof e.matches?e.matches(":disabled"):!!e.disabled}function W(t){if("select"===d(t))return function(e){var t=e.selectedIndex;if(t<0)return null;for(var r=[],n=e.options,a="select-one"===e.type,o=a?t+1:n.length,i=a?t:0;i=0,o=a?e.responseXML:e.responseText;return a&&"parsererror"===o.documentElement.nodeName&&ie.error&&ie.error("parsererror"),r&&r.dataFilter&&(o=r.dataFilter(o,t)),"string"==typeof o&&(("json"===t||!t)&&n.indexOf("json")>=0?o=JSON.parse(o):"script"===t&&ie.globalEval(o)),o}(t,c,n)}catch(e){u="parsererror",t.error=i=e||u}}catch(e){T("error caught: ",e),u="error",t.error=i=e}return{status:u,data:o,errMsg:i}}var le=e;function fe(e,t){var r,n,a,o=le.Deferred(),i={aborted:0,responseText:null,responseXML:null,status:0,statusText:"n/a",getAllResponseHeaders:function(){},getResponseHeader:function(){},setRequestHeader:function(){},abort:function(e){s(e,[i,"aborted",e])}};function u(){return i.aborted||a}function s(n,a,s){var c=s||("timeout"===n?"timeout":"aborted");u()||(T("aborting upload... "+c),i.aborted=1,t.stop(),i.error=c,e.error&&e.error.call(e.context,i,c,n),o.reject.apply(o,a),r&&le.event.trigger("ajaxError",[i,e,c]),l(c))}function c(){r&&le.event.trigger("ajaxComplete",[i,e]),r&&! --le.active&&le.event.trigger("ajaxStop")}function l(r){e.complete&&e.complete.call(e.context,i,r),c(),clearTimeout(n),setTimeout(function(){t.release(),i.responseXML=null},100)}function f(t){var n=t.status,u=t.errMsg;if(i.aborted)T("upload aborted");else if(i.status&&!(i.status>=200&&i.status<300||304===i.status)&&("parsererror"===n&&(u=void 0),n="error"),a=!0,"success"!==n)void 0===u&&(u=i.statusText),e.error&&e.error.call(e.context,i,n,u),o.reject(i,n,u),r&&le.event.trigger("ajaxError",[i,e,u]),l(n);else{var s=function(t){var n;try{e.success.call(e.context,t,"success",i)}catch(e){n={error:e}}return o.resolve(i.responseText,"success",i),r&&le.event.trigger("ajaxSuccess",[i,e,t]),n}(t.data);if(l(n),s)throw s.error}}return o.abort=function(e){i.abort(e)},{xhr:i,deferred:o,start:function(){return(r=e.global)&&0===le.active++&&le.event.trigger("ajaxStart"),e.beforeSend&&!1===e.beforeSend.call(e.context,i,e)?(u()||(a=!0,o.reject(),r&&le.event.trigger("ajaxError",[i,e,"canceled"]),c()),!1):!i.aborted&&(r&&le.event.trigger("ajaxSend",[i,e]),!i.aborted)},done:u,abort:s,settle:f,fail:function(e){f({status:"error",errMsg:e})},startTimer:function(t){e.timeout&&(n=setTimeout(t,e.timeout))},stopTimer:function(){clearTimeout(n),n=void 0}}}var de=e;function pe(e,t){var r=0;function n(e){var n=e.form,a=e.method,o=k(de.extend(!0,{},de.ajaxSettings,e.options),[de.ajaxSettings,e.options]);o.context=o.context||o;var i=l(n,"ownerDocument"),u=de(v(n,["body"])),s=function(e,t,r){var n,a;if(e.iframeTarget)(a=(n=de(e.iframeTarget,r)).attr("name"))?t=a:(n.attr("name",t),n.each(function(){!function(e,t){try{e.contentWindow&&(e.contentWindow.name=t)}catch(e){}}(this,t)}));else{var o=r.createElement("iframe");o.setAttribute("name",t),o.setAttribute("src",e.iframeSrc),(n=de(o)).css({position:"absolute",top:"-1000px",left:"-1000px"})}return{$io:n,id:t}}(o,"jqFormIO"+(new Date).getTime()+r++,i),c=s.$io,d=c[0],p=fe(o,function(e,t){return{stop:function(){try{t[0].contentWindow.document.execCommand&&t[0].contentWindow.document.execCommand("Stop")}catch(e){}t.attr("src",e.iframeSrc)},release:function(){e.iframeTarget?t.attr("src",e.iframeSrc):t.remove()}}}(o,c)),m=50;if(!p.start())return p.deferred;function h(){try{var e=ue(d).readyState;T("state = "+e),e&&"uninitialized"===e.toLowerCase()&&setTimeout(h,50)}catch(e){T("Server abort: ",e," (",e.name,")"),b(2),p.stopTimer()}}function g(){var r=function(e){var t={};return Z.each(ee,function(r,n){t[n]=f(e,"hasAttribute",n)?f(e,"getAttribute",n):null}),t}(n);!function(e,t,r,n,a){var o="multipart/form-data";oe(e,"target",t),!r||/post/i.test(r)?oe(e,"method","POST"):re(r)&&!re(a.property(e,"method"))&&oe(e,"method","GET"),oe(e,"action",n.url),n.skipEncodingOverride||r&&!/post/i.test(r)||(oe(e,"encoding",o),oe(e,"enctype",o))}(n,s.id,a,o,t),p.startTimer(function(){b(1)});var l=[];try{!function(e,t,r,n,a){function o(r,n){var o=t.createElement("input");o.type="hidden",o.name=r,a.push(Z(o).val(n).appendTo(e)[0])}if(r)for(var i in r)if(te.call(r,i))if(Z.isPlainObject(r[i])&&te.call(r[i],"name")&&te.call(r[i],"value"))o(r[i].name,r[i].value);else{var u={};u[i]=r[i];for(var s=Y(u,n),c=0;c=0?"&":"?")+t+e.url.slice(a.length),e.data=null}else e.data=t}(t,V(y,h),x),{form:f,$form:e,fields:y,controls:b,options:t,method:d,traditional:h}))},deliver:function(e){var t=e.$form,r=e.options,n=[];if(r.resetForm&&n.push(function(){t.resetForm()}),r.clearForm&&n.push(function(){t.clearForm(r.includeHidden)}),!r.dataType&&r.target){var a=d(r.success);n.push(function(e,t,n){var o=arguments,i=r.replaceTarget?"replaceWith":"html",s=u(r.target);"string"==typeof e?s[i](e):T("target: the response was parsed by jQuery, so it is not inserted"),s.length||p(a,this,o),s.each(function(){p(a,this,o)})})}else u.merge(n,d(r.success));if(r.success=function(e,a,o){for(var i=r.context||this,u=0,s=n.length;u0,i=/^[\t\n\f\r ]*multipart\/form-data[\t\n\f\r ]*$/i,s=i.test(o.attribute(r[0],"enctype"))||i.test(o.attribute(r[0],"encoding")),c=t.fileapi&&t.formdata;T("fileAPI :"+c);var l=(a||s)&&!c,f=(a||s)&&c?"formdata":"ajax";if(!1!==n.iframe&&(n.iframe||l)&&(f="iframe"),"iframe"!==f||n.iframe||S("iframe","choosing the iframe transport automatically without FormData is deprecated, set iframe: true"),"ajax"!==f&&"json"===n.requestFormat)throw new Error('jquery.form: requestFormat "json" cannot send files or use the iframe transport');return f}}}!function(e){var t={};t.fileapi=void 0!==e('').get(0).files,t.formdata=void 0!==r.FormData;var n=!!e.fn.prop;var o={attribute:X,property:function(e,t){var r=n?e[t]:void 0;return"string"==typeof r?r:X(e,t)}},i=_(t),u=me(t,o,i),s={iframe:pe(n,o),formdata:G,ajax:J};e.fn.attr2=function(){if(S("attr2","attr2 is deprecated, use .prop() or .attr()"),!n)return this.attr.apply(this,arguments);var e=this.prop.apply(this,arguments);return e&&e.jquery||"string"==typeof e?e:this.attr.apply(this,arguments)},e.fn.ajaxSubmit=function(t,r,n,a){if(F(e.fn.jquery),!this.length)return T("ajaxSubmit: skipping submit process - no element selected"),this;if(!e.ajax)throw new Error("jquery.form: ajaxSubmit needs the full jQuery build; this jQuery has no $.ajax");var o=u.prepare(this,D(t,r,n,a));if(!o)return this;u.deliver(o);var i=s[u.chooseTransport(o)](o);this.removeData("jqxhr").data("jqxhr",i);for(var c=0;c= 0) {\n return node;\n }\n }\n\n return null;\n}\n","import { closestByTag, formMember } from \"./form-members.js\";\nimport jQuery from \"jquery\";\n\n// The submitter: the button that submitted a form, captured from ajaxForm's clicks. It is kept in\n// a private store and cleared shortly after the click. The form's clk, clk_x and clk_y properties\n// are still written for pages that read them, and read when the store has none.\n\nvar storeKey = \"jqFormSubmitter\";\n\n// Writes a property on the form; a control with that name makes it read-only.\nfunction setExpando(form, name, value) {\n try {\n form[name] = value;\n } catch (ignore) {\n // the control keeps the name; the store has the submitter\n }\n}\n\n// A property the page set on the form, never a control of the form with that name.\nfunction expando(form, name) {\n var value = form[name];\n var els = formMember(form, \"elements\");\n\n return els && value && els.namedItem(name) === value ? undefined : value;\n}\n\n// Records a submitter for a form until the click window ends.\nfunction record(form, el, x, y) {\n jQuery.data(form, storeKey, { el: el, x: x, y: y });\n setExpando(form, \"clk\", el);\n\n if (el.type === \"image\") {\n setExpando(form, \"clk_x\", x);\n setExpando(form, \"clk_y\", y);\n }\n\n // clear form vars\n setTimeout(function () {\n jQuery.data(form, storeKey, null);\n setExpando(form, \"clk\", null);\n setExpando(form, \"clk_x\", null);\n setExpando(form, \"clk_y\", null);\n }, 100);\n}\n\n// The clicked point of an image button, relative to the image.\nfunction imagePoint(e, target) {\n if (typeof e.offsetX !== \"undefined\") {\n return [e.offsetX, e.offsetY];\n }\n\n if (typeof jQuery.fn.offset === \"function\") {\n var offset = jQuery(target).offset();\n\n return [e.pageX - offset.left, e.pageY - offset.top];\n }\n\n return [e.pageX - target.offsetLeft, e.pageY - target.offsetTop];\n}\n\n/**\n * Records the submit or image button a click event reached, for the form it belongs to.\n */\nexport function captureSubmitter(e) {\n // the clicked control, or the button around the clicked content (ex: a span within a button)\n var target = closestByTag(e.target, [\"button\", \"input\"]);\n\n // the type property, unlike the attribute, is \"submit\" for a button without a type (#588)\n if (!target || (target.type !== \"submit\" && target.type !== \"image\")) {\n return;\n }\n\n var form = target.form;\n\n if (!form) {\n // a submit control that belongs to no form\n return;\n }\n\n var point = target.type === \"image\" ? imagePoint(e, target) : [];\n\n record(form, target, point[0], point[1]);\n}\n\n/**\n * Records the submitter a submit event names (SubmitEvent.submitter), when no click was captured.\n * An image submitter gets the point 0,0, as native submission sends it without a click.\n */\nexport function captureEventSubmitter(e, form) {\n var el = e.originalEvent && e.originalEvent.submitter;\n\n if (el && !submitterOf(form)) {\n record(form, el, 0, 0);\n }\n}\n\n/**\n * The form's submitter as { el, x, y } (x and y for an image button), or null.\n */\nexport function submitterOf(form) {\n if (!form) {\n return null;\n }\n\n var stored = jQuery.data(form, storeKey);\n\n if (stored) {\n return stored;\n }\n\n var el = expando(form, \"clk\");\n\n return el ? { el: el, x: expando(form, \"clk_x\"), y: expando(form, \"clk_y\") } : null;\n}\n\n/**\n * The submitter's fields for a post that adds them itself (the iframe upload), as name β†’ value.\n */\nexport function submitterFields(form) {\n var fields = {};\n var sub = submitterOf(form);\n var el = sub && sub.el;\n\n if (el && el.name && !el.disabled) {\n fields[el.name] = el.value;\n if (el.type === \"image\") {\n fields[el.name + \".x\"] = sub.x;\n fields[el.name + \".y\"] = sub.y;\n }\n }\n\n return fields;\n}\n\n/**\n * The form's submitter element, or null.\n */\nexport function submitterElement(form) {\n var sub = submitterOf(form);\n\n return sub ? sub.el : null;\n}\n","import jQuery from \"jquery\";\n\n// Debug logging, switched on by $.fn.ajaxSubmit.debug. The flag is read on every call, so it can\n// be turned on after the plugin loads.\nexport function log() {\n if (!jQuery.fn.ajaxSubmit.debug) {\n return;\n }\n\n var msg = \"[jquery.form] \" + Array.prototype.join.call(arguments, \"\");\n\n if (window.console && window.console.log) {\n window.console.log(msg);\n } else if (window.opera && window.opera.postError) {\n window.opera.postError(msg);\n }\n}\n\nvar warned = {};\n\n/**\n * A deprecation warning: console.warn, only while debug is on, once per id per page. The message\n * names the replacement; the warning adds that the feature is removed in 5.0.\n */\nexport function deprecate(id, message) {\n if (!jQuery.fn.ajaxSubmit.debug || warned[id]) {\n return;\n }\n\n warned[id] = true;\n\n if (window.console && typeof window.console.warn === \"function\") {\n window.console.warn(\"[jquery.form] \" + message + \" (removed in 5.0)\");\n }\n}\n\n// Forgets which deprecations have warned (for tests).\nexport function resetDeprecations() {\n warned = {};\n}\n\n// True for a jQuery version string older than 3.5.\nexport function beforeJQuery35(version) {\n var parts = String(version).split(\".\");\n var major = Number(parts[0]);\n\n return major < 3 || (major === 3 && Number(parts[1]) < 5);\n}\n\n// 5.0 needs jQuery 3.5 or later: warned on the first ajaxSubmit or ajaxForm, given jQuery's version.\nexport function deprecateOldJQuery(version) {\n if (beforeJQuery35(version)) {\n deprecate(\n \"jquery\",\n \"support for jQuery \" + version + \" is deprecated, 5.0 needs jQuery 3.5 or later\"\n );\n }\n}\n","// The arguments ajaxSubmit and ajaxForm accept in place of an options object.\n\n/**\n * Turns the (url, data, dataType, success) shorthand into options. A url of false is kept as\n * the url; anything else is returned as given.\n */\nexport function shorthandOptions(options, data, dataType, onSuccess) {\n if (typeof options !== \"string\" && options !== false) {\n return options;\n }\n\n var result = { url: options, data: data, dataType: dataType };\n\n if (typeof onSuccess === \"function\") {\n result.success = onSuccess;\n }\n\n return result;\n}\n\n// A copy of options without its url, so the form action is used.\nfunction withoutUrl(options) {\n var result = {};\n\n for (var key in options) {\n if (key !== \"url\" && Object.prototype.hasOwnProperty.call(options, key)) {\n result[key] = options[key];\n }\n }\n\n return result;\n}\n\n/**\n * The options ajaxSubmit starts from: a function is the success callback, the shorthand is\n * expanded, and no options at all is an empty object. A url of false or \"\" means the form action.\n */\nexport function submitOptions(options, data, dataType, onSuccess) {\n if (typeof options === \"function\") {\n return { success: options };\n }\n\n options = shorthandOptions(options, data, dataType, onSuccess);\n\n if (typeof options === \"undefined\") {\n return {};\n }\n\n return options.url === false || options.url === \"\" ? withoutUrl(options) : options;\n}\n\n/**\n * jQuery treats `context` as a flat option: after a deep merge, the settings get back the\n * caller's own object from the last source that has one, so `this` in callbacks is that object.\n */\nexport function keepContext(settings, sources) {\n for (var i = 0; i < sources.length; i++) {\n if (sources[i].context !== undefined) {\n settings.context = sources[i].context;\n }\n }\n\n return settings;\n}\n","import { assertRealParent, closestByTag, formMember, isElement } from \"./form-members.js\";\nimport { captureEventSubmitter, captureSubmitter } from \"./submitter.js\";\nimport { deprecate, deprecateOldJQuery, log } from \"./diagnostics.js\";\nimport jQuery from \"jquery\";\nimport { shorthandOptions } from \"./options.js\";\n\n// ajaxForm binding: the submit and click handlers that send a form through ajaxSubmit. The\n// handlers look up $.fn.ajaxSubmit when they run, so a replacement installed later is used.\n\n// Sends the submit event's form with ajaxSubmit, unless an earlier handler cancelled it.\nfunction submitWith(e, options) {\n if (!e.isDefaultPrevented()) {\n // if event has been canceled, don't proceed\n e.preventDefault();\n // the form is found through the real tree: a control named nodeType misleads jQuery's closest\n var form = closestByTag(e.target, [\"form\"]);\n\n // a button outside the form (form attribute), or requestSubmit(button), sends no click here\n captureEventSubmitter(e, form);\n jQuery(form).ajaxSubmit(options); // #365\n }\n}\n\nfunction doAjaxSubmit(e) {\n submitWith(e, e.data);\n}\n\nfunction captureSubmittingElement(e) {\n /* jshint validthis:true */\n assertRealParent(this);\n captureSubmitter(e);\n}\n\n// An empty selection: queued until the DOM is ready (old jQuery keeps the selector), or dropped.\nfunction bindLater($sel, options) {\n var o = { s: $sel.selector, c: $sel.context };\n\n if (!jQuery.isReady && o.s) {\n log(\"DOM not ready, queuing ajaxForm\");\n deprecate(\n \"queue\",\n \"queuing ajaxForm until the DOM is ready is deprecated, call ajaxForm inside $(fn) \" +\n 'or use delegation: \"\"'\n );\n jQuery(function () {\n jQuery(o.s, o.c).ajaxForm(options);\n });\n\n return $sel;\n }\n\n // is your DOM ready? http://docs.jquery.com/Tutorials:Introducing_$(document).ready()\n log(\"terminating; zero elements found by selector\" + (jQuery.isReady ? \"\" : \" (DOM not ready)\"));\n\n return $sel;\n}\n\n// delegation: true on jQuery 3 and later, where the selection has no selector: always warned,\n// debug or not, once per ajaxForm call.\nfunction warnUnscoped() {\n var console = window.console || {};\n\n if (typeof console.warn === \"function\") {\n console.warn(\n \"[jquery.form] delegation: true binds every form on the page on jQuery 3 and later; \" +\n 'pass a selector instead, e.g. delegation: \"form.ajax\"'\n );\n }\n}\n\nfunction bindDelegated($sel, options) {\n if ($sel.selector === undefined) {\n warnUnscoped();\n }\n\n jQuery(document)\n .off(\"submit.form-plugin\", $sel.selector, doAjaxSubmit)\n .off(\"click.form-plugin\", $sel.selector, captureSubmittingElement)\n .on(\"submit.form-plugin\", $sel.selector, options, doAjaxSubmit)\n .on(\"click.form-plugin\", $sel.selector, options, captureSubmittingElement);\n\n return $sel;\n}\n\n// The element itself or its nearest ancestor that matches the selector. The walk never reads a\n// parentNode a control can hide (jQuery's delegated walk does, and cycles on such a form).\nfunction closestMatch(el, selector) {\n if (!isElement(el)) {\n return null;\n }\n\n if (window.Element && Element.prototype.closest) {\n return Element.prototype.closest.call(el, selector);\n }\n\n for (var node = el; node && isElement(node); node = formMember(node, \"parentNode\")) {\n if (jQuery(node).is(selector)) {\n return node;\n }\n }\n\n return null;\n}\n\n// The document handlers bound for each delegation selector, keyed by \"s\" + selector.\nvar delegated = {};\n\nfunction unbindSelector(selector) {\n var handlers = delegated[\"s\" + selector];\n\n if (handlers) {\n jQuery(document)\n .off(\"submit.form-plugin\", handlers.submit)\n .off(\"click.form-plugin\", handlers.click);\n delete delegated[\"s\" + selector];\n }\n}\n\n// delegation: \"\": one handler pair on the document, scoped to the selector.\nfunction bindSelector($sel, selector, options) {\n if (!selector) {\n throw new Error(\"jquery.form: delegation needs a selector, or true\");\n }\n\n var handlers = {\n submit: function (e) {\n if (closestMatch(e.target, selector)) {\n submitWith(e, options);\n }\n },\n click: function (e) {\n if (closestMatch(e.target, selector)) {\n captureSubmitter(e);\n }\n },\n };\n\n unbindSelector(selector);\n delegated[\"s\" + selector] = handlers;\n jQuery(document)\n .on(\"submit.form-plugin\", handlers.submit)\n .on(\"click.form-plugin\", handlers.click);\n\n return $sel;\n}\n\n// Passed by ajaxForm's own rebind: unbind the selection only, never the document handlers.\nvar selectionOnly = {};\n\n/**\n * ajaxForm() binds the selected forms so a submit is sent with ajaxSubmit, with the clicked\n * submit button (and image coordinates) included. The options work as for ajaxSubmit.\n */\nexport function ajaxForm(options, data, dataType, onSuccess) {\n deprecateOldJQuery(jQuery.fn.jquery);\n options = shorthandOptions(options, data, dataType, onSuccess) || {};\n\n if (typeof options.delegation === \"string\") {\n return bindSelector(this, options.delegation, options);\n }\n\n options.delegation = options.delegation && typeof jQuery.fn.on === \"function\";\n\n if (!options.delegation && this.length === 0) {\n return bindLater(this, options);\n }\n\n if (options.delegation) {\n return bindDelegated(this, options);\n }\n\n if (options.beforeFormUnbind) {\n options.beforeFormUnbind(this, options);\n }\n\n return this.ajaxFormUnbind(selectionOnly)\n .on(\"submit.form-plugin\", options, doAjaxSubmit)\n .on(\"click.form-plugin\", options, captureSubmittingElement);\n}\n\n/**\n * ajaxFormUnbind() removes the handlers ajaxForm bound on the selection and every delegated\n * binding on the document. ajaxFormUnbind(selector) removes only that delegation selector.\n */\nexport function ajaxFormUnbind(selector) {\n if (typeof selector === \"string\") {\n unbindSelector(selector);\n\n return this;\n }\n\n if (selector !== selectionOnly) {\n delegated = {};\n jQuery(document).off(\"submit.form-plugin click.form-plugin\");\n }\n\n return this.off(\"submit.form-plugin click.form-plugin\");\n}\n","import { callFormMethod, isElement } from \"./form-members.js\";\nimport jQuery from \"jquery\";\n\n/**\n * An attribute of a form, or undefined when it is absent, as jQuery's attr returns it. The\n * subject may also be the document or a plain object, read through jQuery.\n */\nexport function formAttribute(form, name) {\n if (!isElement(form)) {\n return jQuery(form).attr(name);\n }\n\n var value = callFormMethod(form, \"getAttribute\", name);\n\n return value === null ? undefined : value;\n}\n","import { callFormMethod, formMember, isElement, tagName } from \"./form-members.js\";\nimport { formAttribute } from \"./form-attributes.js\";\nimport jQuery from \"jquery\";\nimport { submitterOf } from \"./submitter.js\";\n\n// Successful controls: which controls of a form are sent, and as which name/value fields\n// (https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#constructing-the-form-data-set).\n\n// Line breaks, sent as CRLF\nvar rLineBreak = /\\r\\n|\\r|\\n/g;\nvar rCR = /\\r/g;\n\n// Listed form elements that are never submitted.\nvar rUnsubmittable = /^(?:fieldset|object|output)$/;\n\n/**\n * Whether a control or option is disabled, also through a disabled fieldset or optgroup. Without\n * selector matching, only its own disabled property is read.\n */\nfunction isDisabled(el) {\n return typeof el.matches === \"function\" ? el.matches(\":disabled\") : !!el.disabled;\n}\n\n/**\n * The successful-control rule: whether a control is sent. `submitter` is the button that\n * submitted the control's form; other submit and image buttons of a form are not sent.\n */\nexport function isSuccessful(el, submitter) {\n var t = el.type;\n\n if (!el.name || isDisabled(el) || t === \"reset\" || t === \"button\") {\n return false;\n }\n\n if (t === \"checkbox\" || t === \"radio\") {\n return !!el.checked;\n }\n\n if (t === \"submit\" || t === \"image\") {\n return !el.form || submitter === el;\n }\n\n return tagName(el) !== \"select\" || el.selectedIndex !== -1;\n}\n\n// The value of a select: the selected option's value for one, a list for several.\nfunction selectValue(el) {\n var index = el.selectedIndex;\n\n if (index < 0) {\n return null;\n }\n\n var a = [],\n ops = el.options;\n var one = el.type === \"select-one\";\n var max = one ? index + 1 : ops.length;\n\n for (var i = one ? index : 0; i < max; i++) {\n var op = ops[i];\n\n if (op.selected && !isDisabled(op)) {\n var v = op.value;\n\n if (!v) {\n // extra pain for IE...\n v =\n op.attributes && op.attributes.value && !op.attributes.value.specified\n ? op.text\n : op.value;\n }\n\n if (one) {\n return v;\n }\n\n a.push(v);\n }\n }\n\n return a;\n}\n\n/**\n * The value of a control, whether or not it is successful: a list for a multiple select, null\n * for a select with nothing selected, otherwise a string with CRLF line breaks (a lone CR or LF\n * included).\n */\nexport function valueOf(el) {\n if (tagName(el) === \"select\") {\n return selectValue(el);\n }\n\n var v = jQuery(el).val();\n var raw = el.value;\n\n // jQuery before 4.0 drops carriage returns from .val(); read them from the value itself\n if (typeof raw === \"string\" && raw.replace(rCR, \"\") === v) {\n v = raw;\n }\n\n return v.replace(rLineBreak, \"\\r\\n\");\n}\n\n/**\n * The fields as a urlencoded body sends them: a selected file as its name.\n */\n// A lone surrogate becomes U+FFFD, as in a native submission; jQuery.param would throw.\nvar loneSurrogate = /[\\uD800-\\uDBFF](?![\\uDC00-\\uDFFF])|([^\\uD800-\\uDBFF]|^)([\\uDC00-\\uDFFF])/g;\n\nexport function wellFormed(value) {\n return typeof value === \"string\"\n ? value.replace(loneSurrogate, function (match, before) {\n return (before || \"\") + \"\\uFFFD\";\n })\n : value;\n}\n\n// jQuery 3 dropped $.param's \"+\" for a space; a native submission still sends \"+\". Only a space\n// encodes as %20, since a literal % encodes as %25.\nexport function urlencode(fields, traditional) {\n return jQuery.param(urlencodedFields(fields), traditional).replace(/%20/g, \"+\");\n}\n\nexport function urlencodedFields(fields) {\n return jQuery.map(fields, function (field) {\n var value =\n field.type === \"file\" && typeof field.value !== \"string\" ? field.value.name : field.value;\n var name = wellFormed(field.name);\n value = wellFormed(value);\n\n return name === field.name && value === field.value ? field : { name: name, value: value };\n });\n}\n\n/**\n * The serialization steps. `feature` holds what the entry detected at load (fileapi).\n */\nexport function createSuccessfulControls(feature) {\n var $ = jQuery;\n\n // #386; inputs that name the form in their form attribute, other than the candidates found.\n // A form only gets the ones it owns.\n function outsideControls(formId, els, owner) {\n // hat tip @thet; the id is compared, never built into a selector\n return $(\":input[form]\")\n .filter(function () {\n return (\n this.getAttribute(\"form\") === formId &&\n (!owner || this.form === owner) &&\n $.inArray(this, els) < 0\n );\n })\n .get();\n }\n\n // A descendant of a form is a candidate unless it is a control another form owns.\n function ownedBy(els, owner) {\n return $.grep(els, function (el) {\n return typeof el.form === \"undefined\" || el.form === owner;\n });\n }\n\n /**\n * The candidate controls of a form, in order: its elements, or every descendant it owns in\n * semantic mode, then the outside controls it owns that name it.\n */\n function controlsOf(form, semantic) {\n var formId = formAttribute(form, \"id\");\n var els = formMember(form, \"elements\");\n\n if (semantic || typeof els === \"undefined\") {\n // the document is not an element; it has its own getElementsByTagName\n els = isElement(form)\n ? callFormMethod(form, \"getElementsByTagName\", \"*\")\n : form.getElementsByTagName(\"*\");\n }\n\n els = $.makeArray(els);\n\n // the subject may also be a fieldset, the document or another container\n var owner = tagName(form) === \"form\" ? form : null;\n\n if (semantic && owner) {\n els = ownedBy(els, owner);\n }\n\n // FinesseRus: in non-IE browsers outside fields are already included in form.elements.\n if (formId && (semantic || /(Edge|Trident)\\//.test(navigator.userAgent))) {\n els = els.concat(outsideControls(formId, els, owner));\n }\n\n return els;\n }\n\n // The fields of a control's value, or null when the control is not sent.\n function fieldsOf(el) {\n var n = el.name;\n // read at call time, so a page that replaces $.fieldValue changes what is sent\n var v = $.fieldValue(el, true);\n\n if (v && v.constructor === Array) {\n return $.map(v, function (value) {\n return { name: n, value: value };\n });\n }\n\n if (feature.fileapi && el.type === \"file\") {\n var files = el.files;\n\n // #180: an empty field when no file is selected\n return files.length\n ? $.map(files, function (file) {\n return { name: n, value: file, type: el.type };\n })\n : [{ name: n, value: \"\", type: el.type }];\n }\n\n if (v === null || typeof v === \"undefined\") {\n return null;\n }\n\n return [{ name: n, value: v, type: el.type, required: el.required }];\n }\n\n // The clicked image's value and coordinates.\n function imageFields(sub, input, type) {\n var n = input.name;\n var value = { name: n, value: $(input).val() };\n\n if (type) {\n value.type = type;\n }\n\n return [value, { name: n + \".x\", value: sub.x }, { name: n + \".y\", value: sub.y }];\n }\n\n // Adds one candidate control's fields, and the control when it has a value to send.\n function addCandidate(collected, form, el, semantic) {\n if (!el.name || isDisabled(el) || rUnsubmittable.test(tagName(el))) {\n return;\n }\n\n var sub = semantic && el.type === \"image\" && submitterOf(form);\n\n if (sub) {\n // handle image inputs on the fly when semantic == true\n if (sub.el === el) {\n collected.fields.push.apply(collected.fields, imageFields(sub, el, el.type));\n }\n\n return;\n }\n\n var own = fieldsOf(el);\n\n if (own) {\n collected.controls.push(el);\n collected.fields.push.apply(collected.fields, own);\n }\n }\n\n // input type=='image' are not found in elements array! handle it here\n function addClickedImage(collected, form) {\n var sub = submitterOf(form);\n var input = sub && $(sub.el)[0];\n\n if (input && input.name && !isDisabled(input) && input.type === \"image\") {\n collected.fields.push.apply(collected.fields, imageFields(sub, input));\n }\n }\n\n /**\n * The fields of a form, as formToArray returns them, and the controls they came from.\n */\n function collect(form, semantic, filtering) {\n var collected = { fields: [], controls: [] };\n\n if (!form) {\n return collected;\n }\n\n var els = controlsOf(form, semantic);\n\n if (typeof filtering === \"function\") {\n els = $.map(els, filtering);\n }\n\n for (var i = 0; i < els.length; i++) {\n addCandidate(collected, form, els[i], semantic);\n }\n\n if (!semantic) {\n addClickedImage(collected, form);\n }\n\n return collected;\n }\n\n return {\n controlsOf: controlsOf,\n fieldsOf: fieldsOf,\n collect: collect,\n };\n}\n","import jQuery from \"jquery\";\nimport { keepContext } from \"./options.js\";\n\n// The XMLHttpRequest transports: $.ajax with the encoded fields, or FormData for file uploads.\nvar $ = jQuery;\n\n// utility fn for deep serialization: [name, value] pairs, as $.param encodes them\nexport function deepSerialize(extraData, traditional) {\n var param = $.param(extraData, traditional);\n var serialized = param ? param.split(\"&\") : [];\n var len = serialized.length;\n var result = [];\n var i, part;\n\n for (i = 0; i < len; i++) {\n // #252; undo param space replacement\n serialized[i] = serialized[i].replace(/\\+/g, \" \");\n part = serialized[i].split(\"=\");\n // #278; use array instead of object storage, favoring array serializations\n result.push([decodeURIComponent(part[0]), decodeURIComponent(part[1])]);\n }\n\n return result;\n}\n\n/**\n * Posts the fields and extraData as FormData, for files with the File API.\n * XMLHttpRequest Level 2 file uploads (big hat tip to francois2metz)\n */\nexport function sendFormData(submission) {\n var options = submission.options;\n var a = submission.fields;\n\n var formdata = new FormData();\n\n for (var i = 0; i < a.length; i++) {\n formdata.append(a[i].name, a[i].value);\n }\n\n if (options.extraData) {\n var serializedData = deepSerialize(options.extraData, submission.traditional);\n\n for (i = 0; i < serializedData.length; i++) {\n formdata.append(serializedData[i][0], serializedData[i][1]);\n }\n }\n\n options.data = null;\n\n var s = $.extend(true, {}, $.ajaxSettings, options, {\n contentType: false,\n processData: false,\n cache: false,\n type: submission.method || \"POST\",\n });\n\n keepContext(s, [$.ajaxSettings, options]);\n\n if (options.uploadProgress) {\n // workaround because jqXHR does not expose upload property: wraps the xhr factory, the\n // caller's or jQuery's\n var createXhr = s.xhr;\n\n s.xhr = function () {\n var xhr = createXhr.call(this);\n\n if (xhr.upload) {\n xhr.upload.addEventListener(\n \"progress\",\n function (event) {\n var percent = 0;\n // event.position is the deprecated name, read only when loaded is missing\n var position = event.loaded !== undefined ? event.loaded : event.position;\n var total = event.total;\n\n if (event.lengthComputable) {\n percent = Math.ceil((position / total) * 100);\n }\n\n options.uploadProgress(event, position, total, percent);\n },\n false\n );\n }\n\n return xhr;\n };\n }\n\n s.data = null;\n\n var beforeSend = s.beforeSend;\n\n s.beforeSend = function (xhr, o) {\n // Send FormData() provided by user\n if (options.formData) {\n o.data = options.formData;\n } else {\n o.data = formdata;\n }\n\n // a veto (false) cancels the upload, as on the other transports\n return beforeSend ? beforeSend.call(this, xhr, o) : undefined;\n };\n\n return $.ajax(s);\n}\n\n/**\n * Sends the encoded fields with $.ajax.\n */\nexport function sendAjax(submission) {\n return $.ajax(submission.options);\n}\n","import { callFormMethod } from \"./form-members.js\";\nimport { deepSerialize } from \"./xhr-transport.js\";\nimport jQuery from \"jquery\";\nimport { submitterFields } from \"./submitter.js\";\nimport { wellFormed } from \"./successful-controls.js\";\n\n// The iframe form post: the extra fields (submitter, CSRF, data), the form attributes set while\n// posting and restored after, and the native submit.\nvar $ = jQuery;\n\n// The form attributes an iframe upload changes while it posts.\nvar uploadAttributes = [\"action\", \"target\", \"method\", \"enctype\", \"encoding\"];\n\n// Called through the prototype: an extraData key or a form field may be named hasOwnProperty.\nvar hasOwn = Object.prototype.hasOwnProperty;\n\nfunction isGet(method) {\n return /^get$/i.test(method);\n}\n\n// Resolves both URLs through anchors, as jQuery does for crossDomain, so IE's anchor quirks\n// apply to both sides of the comparison.\nfunction isSameOrigin(url) {\n var origin = document.createElement(\"a\");\n var target = document.createElement(\"a\");\n\n origin.href = window.location.href;\n target.href = url;\n // IE fills in the host of a relative URL only once the resolved href is assigned back\n target.href = target.href; // eslint-disable-line no-self-assign\n\n return origin.protocol + \"//\" + origin.host === target.protocol + \"//\" + target.host;\n}\n\n/** Adds the clicked submitter (and an image's coordinates) to s.extraData. */\nexport function addSubmitterFields(s, form) {\n // add submitting element to data if we know it\n var fields = submitterFields(form);\n\n for (var n in fields) {\n s.extraData = s.extraData || {};\n s.extraData[wellFormed(n)] = wellFormed(fields[n]);\n }\n}\n\n/** Adds the page's CSRF token to s.extraData when the form is posted to the page's origin. */\nexport function addCsrfField(s, form, method, forms) {\n // Rails CSRF hack (thanks to Yvan Barthelemy); like jquery-ujs, only for the page's origin and\n // only when the form is posted, since a get form would put the token in the url\n var csrf_token = $(\"meta[name=csrf-token]\").attr(\"content\");\n var csrf_param = $(\"meta[name=csrf-param]\").attr(\"content\");\n var posts =\n !isGet(method) &&\n (!method || /post/i.test(method) || /post/i.test(forms.property(form, \"method\")));\n\n if (csrf_param && csrf_token && posts && isSameOrigin(s.url)) {\n s.extraData = s.extraData || {};\n s.extraData[csrf_param] = csrf_token;\n }\n}\n\nfunction setFormAttribute(form, name, value) {\n callFormMethod(form, \"setAttribute\", name, value);\n}\n\n/** The raw attributes the upload changes, null when absent, to put back exactly (#380). */\nexport function saveAttributes(form) {\n var saved = {};\n\n $.each(uploadAttributes, function (i, name) {\n saved[name] = callFormMethod(form, \"hasAttribute\", name)\n ? callFormMethod(form, \"getAttribute\", name)\n : null;\n });\n\n return saved;\n}\n\n/** Puts back the attributes saveAttributes recorded, removing those that were absent. */\nexport function restoreAttributes(form, saved) {\n $.each(uploadAttributes, function (i, name) {\n if (saved[name] === null) {\n callFormMethod(form, \"removeAttribute\", name);\n } else {\n setFormAttribute(form, name, saved[name]);\n }\n });\n}\n\n/** Points the form at the frame `target` with the upload's url, method and encoding. */\nexport function setUploadAttributes(form, target, method, s, forms) {\n var mp = \"multipart/form-data\";\n\n // update form attrs in IE friendly way\n setFormAttribute(form, \"target\", target);\n if (!method || /post/i.test(method)) {\n setFormAttribute(form, \"method\", \"POST\");\n } else if (isGet(method) && !isGet(forms.property(form, \"method\"))) {\n // a form posts natively only with GET or POST; other verbs keep the form's own method\n setFormAttribute(form, \"method\", \"GET\");\n }\n setFormAttribute(form, \"action\", s.url);\n\n // ie borks in some cases when setting encoding\n if (!s.skipEncodingOverride && (!method || /post/i.test(method))) {\n setFormAttribute(form, \"encoding\", mp);\n setFormAttribute(form, \"enctype\", mp);\n }\n}\n\n/** Appends a hidden input per extraData field to the form; each input is pushed onto `added`. */\nexport function addExtraInputs(form, ownerDocument, extraData, traditional, added) {\n // Builds the input with DOM properties: a name is never parsed as HTML.\n function addHiddenInput(name, value) {\n var input = ownerDocument.createElement(\"input\");\n\n input.type = \"hidden\";\n input.name = name;\n added.push($(input).val(value).appendTo(form)[0]);\n }\n\n if (extraData) {\n for (var n in extraData) {\n if (hasOwn.call(extraData, n)) {\n // if using the $.param format that allows for multiple values with the same name\n if (\n $.isPlainObject(extraData[n]) &&\n hasOwn.call(extraData[n], \"name\") &&\n hasOwn.call(extraData[n], \"value\")\n ) {\n addHiddenInput(extraData[n].name, extraData[n].value);\n } else {\n // arrays and objects become one field per value, as $.param sends them (#597)\n var single = {};\n\n single[n] = extraData[n];\n var fields = deepSerialize(single, traditional);\n\n for (var f = 0; f < fields.length; f++) {\n addHiddenInput(fields[f][0], fields[f][1]);\n }\n }\n }\n }\n }\n}\n\n/** Submits the form natively, even when a control named submit hides the method. */\nexport function submitForm(form) {\n try {\n form.submit();\n } catch (err) {\n // just in case form has element with name/id of 'submit'\n callFormMethod(form, \"submit\");\n }\n}\n","import jQuery from \"jquery\";\nimport { log } from \"./diagnostics.js\";\n\n// The iframe response reader: turns the frame's document into the mock xhr's text, XML, status\n// and dataType, then parses it as $.ajax would (dataFilter, JSON, script).\nvar $ = jQuery;\n\n/** The frame's document, or null when the browser denies access to it. */\nexport function getDoc(frame) {\n /* it looks like contentWindow or contentDocument do not\n * carry the protocol property in ie8, when running under ssl\n * frame.document is the only valid response document, since\n * the protocol is know but not on the other two objects. strange?\n * \"Same origin policy\" http://en.wikipedia.org/wiki/Same_origin_policy\n */\n\n var doc = null;\n\n // IE8 cascading access check\n try {\n if (frame.contentWindow) {\n doc = frame.contentWindow.document;\n }\n } catch (err) {\n // IE8 access denied under ssl & missing protocol\n log(\"cannot get iframe.contentWindow document: \" + err);\n }\n\n if (doc) {\n // successful getting content\n return doc;\n }\n\n try {\n // simply checking may throw in ie8 under ssl or mismatched protocol\n doc = frame.contentDocument ? frame.contentDocument : frame.document;\n } catch (err) {\n // last attempt\n log(\"cannot get iframe.contentDocument: \" + err);\n doc = frame.document;\n }\n\n return doc;\n}\n\n/** Parses the response text or XML for the given (lowercase) dataType. */\nexport function httpData(xhr, type, s) {\n // mostly lifted from jq1.4.4\n\n var ct = xhr.getResponseHeader(\"content-type\") || \"\",\n xml = (type === \"xml\" || !type) && ct.indexOf(\"xml\") >= 0,\n data = xml ? xhr.responseXML : xhr.responseText;\n\n if (xml && data.documentElement.nodeName === \"parsererror\") {\n if ($.error) {\n $.error(\"parsererror\");\n }\n }\n if (s && s.dataFilter) {\n data = s.dataFilter(data, type);\n }\n if (typeof data === \"string\") {\n if ((type === \"json\" || !type) && ct.indexOf(\"json\") >= 0) {\n data = JSON.parse(data);\n } else if (type === \"script\") {\n $.globalEval(data);\n }\n }\n\n return data;\n}\n\n// Copies the status and statusText attributes of an element onto the mock xhr.\nfunction readStatus(xhr, el) {\n // support for XHR 'status' & 'statusText' emulation :\n xhr.status = Number(el.getAttribute(\"status\")) || xhr.status;\n xhr.statusText = el.getAttribute(\"statusText\") || xhr.statusText;\n}\n\n// Fills the mock xhr from the document itself.\nfunction readDocument(doc, xhr, s, isXml) {\n var docRoot = doc.body ? doc.body : doc.documentElement;\n\n xhr.responseText = docRoot ? docRoot.innerHTML : null;\n xhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc;\n if (isXml) {\n s.dataType = \"xml\";\n }\n xhr.getResponseHeader = function (header) {\n // the dataType in lowercase, as $.ajax reads it\n var headers = { \"content-type\": s.dataType && s.dataType.toLowerCase() };\n\n return headers[header.toLowerCase()];\n };\n if (docRoot) {\n readStatus(xhr, docRoot);\n }\n}\n\n// A response embedded in a textarea, or text wrapped in pre or body, replaces responseText.\nfunction readEmbedded(doc, xhr, dt, s) {\n var scr = /(json|script|text)/.test(dt);\n\n if (!scr && !s.textarea) {\n return;\n }\n // see if user embedded response in textarea\n var ta = doc.getElementsByTagName(\"textarea\")[0];\n\n if (ta) {\n xhr.responseText = ta.value;\n readStatus(xhr, ta);\n } else if (scr) {\n // account for browsers injecting pre around json response\n var pre = doc.getElementsByTagName(\"pre\")[0];\n var b = doc.getElementsByTagName(\"body\")[0];\n\n if (pre) {\n xhr.responseText = pre.textContent ? pre.textContent : pre.innerText;\n } else if (b) {\n xhr.responseText = b.textContent ? b.textContent : b.innerText;\n }\n }\n}\n\n/**\n * Reads and parses the response document into the mock xhr. Returns {status, data, errMsg}, or\n * null when `retry()` asks to read the document again later (Opera's untraversable DOM).\n */\nexport function readResponse(doc, xhr, s, retry) {\n var status = \"success\",\n data,\n errMsg;\n\n try {\n var isXml = /^xml$/i.test(s.dataType) || doc.XMLDocument || $.isXMLDoc(doc);\n\n log(\"isXml=\" + isXml);\n\n if (!isXml && window.opera && (doc.body === null || !doc.body.innerHTML)) {\n // in some browsers (Opera) the iframe DOM is not always traversable when\n // the onload callback fires, so we loop a bit to accommodate\n if (retry()) {\n return null;\n }\n // let this fall through because server response could be an empty document\n }\n\n readDocument(doc, xhr, s, isXml);\n\n var dt = (s.dataType || \"\").toLowerCase();\n\n readEmbedded(doc, xhr, dt, s);\n\n try {\n data = httpData(xhr, dt, s);\n } catch (err) {\n status = \"parsererror\";\n xhr.error = errMsg = err || status;\n }\n } catch (err) {\n log(\"error caught: \", err);\n status = \"error\";\n xhr.error = errMsg = err;\n }\n\n return { status: status, data: data, errMsg: errMsg };\n}\n","import jQuery from \"jquery\";\nimport { log } from \"./diagnostics.js\";\n\n// The iframe upload's lifecycle: the mock xhr and the Deferred, the global ajax events, the\n// beforeSend veto, the timeout, abort and settling.\nvar $ = jQuery;\n\n/**\n * Creates the lifecycle of one upload with the merged settings `s`. `frame.stop()` stops the\n * frame's load and `frame.release()` removes or resets the frame after the upload.\n */\nexport function createLifecycle(s, frame) {\n var g,\n timeoutHandle,\n callbackProcessed,\n deferred = $.Deferred();\n\n var xhr = {\n // mock object\n aborted: 0,\n responseText: null,\n responseXML: null,\n status: 0,\n statusText: \"n/a\",\n getAllResponseHeaders: function () {},\n getResponseHeader: function () {},\n setRequestHeader: function () {},\n abort: function (status) {\n abort(status, [xhr, \"aborted\", status]);\n },\n };\n\n // #341\n deferred.abort = function (status) {\n xhr.abort(status);\n };\n\n function done() {\n return xhr.aborted || callbackProcessed;\n }\n\n // Completes an aborted upload once and rejects the Deferred with `rejection`.\n // `textStatus` replaces the default \"timeout\"/\"aborted\" text status.\n function abort(status, rejection, textStatus) {\n var e = textStatus || (status === \"timeout\" ? \"timeout\" : \"aborted\");\n\n if (done()) {\n return;\n }\n\n log(\"aborting upload... \" + e);\n xhr.aborted = 1;\n frame.stop();\n xhr.error = e;\n if (s.error) {\n s.error.call(s.context, xhr, e, status);\n }\n deferred.reject.apply(deferred, rejection);\n\n if (g) {\n $.event.trigger(\"ajaxError\", [xhr, s, e]);\n }\n\n complete(e);\n }\n\n // The global events that end every upload, cancelled ones included.\n function endGlobalEvents() {\n if (g) {\n $.event.trigger(\"ajaxComplete\", [xhr, s]);\n }\n\n if (g && !--$.active) {\n $.event.trigger(\"ajaxStop\");\n }\n }\n\n // The steps every finished or aborted upload ends with, in $.ajax order.\n function complete(status) {\n if (s.complete) {\n s.complete.call(s.context, xhr, status);\n }\n\n endGlobalEvents();\n clearTimeout(timeoutHandle);\n\n // clean up\n setTimeout(function () {\n frame.release();\n xhr.responseXML = null;\n }, 100);\n }\n\n // A beforeSend veto ends the upload as $.ajax cancels a request: no callbacks, the global\n // events end with ajaxError \"canceled\".\n function cancel() {\n if (done()) {\n return;\n }\n\n callbackProcessed = true;\n deferred.reject();\n if (g) {\n $.event.trigger(\"ajaxError\", [xhr, s, \"canceled\"]);\n }\n endGlobalEvents();\n }\n\n // Fires the start events and beforeSend; false when the upload must not be posted.\n function start() {\n g = s.global;\n // trigger ajax global events so that activity/block indicators work like normal\n if (g && $.active++ === 0) {\n $.event.trigger(\"ajaxStart\");\n }\n\n if (s.beforeSend && s.beforeSend.call(s.context, xhr, s) === false) {\n cancel();\n\n return false;\n }\n\n if (xhr.aborted) {\n // abort() in beforeSend already completed the upload\n return false;\n }\n\n if (g) {\n $.event.trigger(\"ajaxSend\", [xhr, s]);\n }\n\n // an ajaxSend handler may abort too\n return !xhr.aborted;\n }\n\n // Resolves the upload; returns {error} when the success callback threw.\n function succeed(data) {\n var failure;\n\n try {\n s.success.call(s.context, data, \"success\", xhr);\n } catch (err) {\n failure = { error: err };\n }\n\n deferred.resolve(xhr.responseText, \"success\", xhr);\n\n if (g) {\n $.event.trigger(\"ajaxSuccess\", [xhr, s, data]);\n }\n\n return failure;\n }\n\n // Settles the upload with the response reader's {status, data, errMsg}.\n function settle(result) {\n var status = result.status,\n errMsg = result.errMsg;\n\n if (xhr.aborted) {\n // abort() completed the upload while its response was processed\n log(\"upload aborted\");\n\n return;\n }\n\n // an emulated HTTP error status wins, as in $.ajax; a parse error is kept otherwise\n if (xhr.status && !((xhr.status >= 200 && xhr.status < 300) || xhr.status === 304)) {\n status = \"error\";\n }\n\n callbackProcessed = true;\n\n // ordering of these callbacks/triggers is odd, but that's how $.ajax does it\n if (status === \"success\") {\n var failure = succeed(result.data);\n\n complete(status);\n if (failure) {\n // the upload is settled; the success callback's exception still reaches the console\n throw failure.error;\n }\n\n return;\n }\n\n if (typeof errMsg === \"undefined\") {\n errMsg = xhr.statusText;\n }\n if (s.error) {\n s.error.call(s.context, xhr, status, errMsg);\n }\n deferred.reject(xhr, \"error\", errMsg);\n if (g) {\n $.event.trigger(\"ajaxError\", [xhr, s, errMsg]);\n }\n\n complete(status);\n }\n\n return {\n xhr: xhr,\n deferred: deferred,\n start: start,\n done: done,\n abort: abort,\n settle: settle,\n // Settles an upload that failed with an exception (ignored once aborted).\n fail: function (err) {\n settle({ status: \"error\", errMsg: err });\n },\n // Runs `onTimeout` after s.timeout, when set.\n startTimer: function (onTimeout) {\n if (s.timeout) {\n timeoutHandle = setTimeout(onTimeout, s.timeout);\n }\n },\n stopTimer: function () {\n clearTimeout(timeoutHandle);\n timeoutHandle = undefined;\n },\n };\n}\n","import {\n addCsrfField,\n addExtraInputs,\n addSubmitterFields,\n restoreAttributes,\n saveAttributes,\n setUploadAttributes,\n submitForm,\n} from \"./iframe-post.js\";\nimport { closestByTag, formMember } from \"./form-members.js\";\nimport { deprecate, log } from \"./diagnostics.js\";\nimport { getDoc, readResponse } from \"./iframe-response.js\";\nimport { createLifecycle } from \"./iframe-lifecycle.js\";\nimport jQuery from \"jquery\";\nimport { keepContext } from \"./options.js\";\n\n// The iframe transport: posts the form itself into a hidden frame and reads the response from it,\n// for file uploads without the File API or when the iframe option asks for it.\nvar $ = jQuery;\n\n/**\n * The iframe send step. `hasProp` is what the entry detected at load; `forms.property` reads a\n * form property as attr2 does.\n */\nexport function createIframeTransport(hasProp, forms) {\n var CLIENT_TIMEOUT_ABORT = 1;\n var SERVER_ABORT = 2;\n // tells apart the frames of uploads that start in the same millisecond\n var frameCount = 0;\n\n // ensure that every serialized input is still enabled\n function enableControls(elements) {\n for (var i = 0; i < elements.length; i++) {\n var el = $(elements[i]);\n\n if (hasProp) {\n el.prop(\"disabled\", false);\n } else {\n el.removeAttr(\"disabled\");\n }\n }\n }\n\n // Names the frame's window, when the page may: a cross-origin or sandboxed frame refuses.\n function nameWindow(frame, name) {\n try {\n if (frame.contentWindow) {\n frame.contentWindow.name = name;\n }\n } catch (ignore) {}\n }\n\n // The frame the form posts into: the iframeTarget, named `id` when it has no name, or a new\n // hidden frame named `id`. Returns the frame and the name the form targets.\n function createFrame(s, id, ownerDocument) {\n var $io, n;\n\n if (s.iframeTarget) {\n $io = $(s.iframeTarget, ownerDocument);\n n = $io.attr(\"name\");\n if (!n) {\n $io.attr(\"name\", id);\n // a frame already in the page keeps the browsing context name it was inserted with\n $io.each(function () {\n nameWindow(this, id);\n });\n } else {\n id = n;\n }\n } else {\n var io = ownerDocument.createElement(\"iframe\");\n\n io.setAttribute(\"name\", id);\n io.setAttribute(\"src\", s.iframeSrc);\n $io = $(io);\n $io.css({ position: \"absolute\", top: \"-1000px\", left: \"-1000px\" });\n }\n\n return { $io: $io, id: id };\n }\n\n // The frame hooks the lifecycle calls: stop a load in progress, and release after the upload.\n function frameHooks(s, $io) {\n return {\n stop: function () {\n try {\n // #214, #257\n if ($io[0].contentWindow.document.execCommand) {\n $io[0].contentWindow.document.execCommand(\"Stop\");\n }\n } catch (ignore) {}\n\n $io.attr(\"src\", s.iframeSrc); // abort op in progress\n },\n release: function () {\n if (!s.iframeTarget) {\n $io.remove();\n } else {\n // adding else to clean up existing iframe response.\n $io.attr(\"src\", s.iframeSrc);\n }\n },\n };\n }\n\n function listen(io, cb) {\n if (io.attachEvent) {\n io.attachEvent(\"onload\", cb);\n } else {\n io.addEventListener(\"load\", cb, false);\n }\n }\n\n function unlisten(io, cb) {\n if (io.detachEvent) {\n io.detachEvent(\"onload\", cb);\n } else {\n io.removeEventListener(\"load\", cb, false);\n }\n }\n\n // private function for handling file uploads (hat tip to YAHOO!)\n function fileUploadIframe(submission) {\n var form = submission.form,\n method = submission.method;\n\n var s = keepContext($.extend(true, {}, $.ajaxSettings, submission.options), [\n $.ajaxSettings,\n submission.options,\n ]);\n\n s.context = s.context || s;\n var ownerDocument = formMember(form, \"ownerDocument\");\n var $body = $(closestByTag(form, [\"body\"]));\n var frame = createFrame(s, \"jqFormIO\" + new Date().getTime() + frameCount++, ownerDocument);\n var $io = frame.$io,\n io = $io[0];\n var life = createLifecycle(s, frameHooks(s, $io));\n var domCheckCount = 50;\n\n if (!life.start()) {\n return life.deferred;\n }\n\n addSubmitterFields(s, form);\n addCsrfField(s, form, method, forms);\n\n // look for server aborts\n function checkState() {\n try {\n var state = getDoc(io).readyState;\n\n log(\"state = \" + state);\n if (state && state.toLowerCase() === \"uninitialized\") {\n setTimeout(checkState, 50);\n }\n } catch (e) {\n log(\"Server abort: \", e, \" (\", e.name, \")\");\n cb(SERVER_ABORT);\n life.stopTimer();\n }\n }\n\n // take a breath so that pending repaints get some cpu time before the upload starts\n function doSubmit() {\n var saved = saveAttributes(form);\n\n setUploadAttributes(form, frame.id, method, s, forms);\n\n // support timout\n life.startTimer(function () {\n cb(CLIENT_TIMEOUT_ABORT);\n });\n\n // add \"extra\" data to form if provided in options\n var extraInputs = [];\n\n try {\n addExtraInputs(form, ownerDocument, s.extraData, submission.traditional, extraInputs);\n\n if (!s.iframeTarget) {\n // add iframe to doc and submit the form\n $io.appendTo($body);\n }\n\n // A connected form posting into a frame outside the document opens a new window.\n var root = ownerDocument.documentElement;\n\n if (io && $.contains(root, form) && !$.contains(root, io)) {\n var notInDocument = \"jquery.form: the upload frame is not in the document\";\n\n life.abort(notInDocument, [life.xhr, \"error\", notInDocument], \"error\");\n\n return;\n }\n\n listen(io, cb);\n setTimeout(checkState, 15);\n submitForm(form);\n } finally {\n // reset attrs and remove \"extra\" input elements\n restoreAttributes(form, saved);\n $(extraInputs).remove();\n }\n }\n\n // Reads the next document by Opera's rules: false once the retries are used up.\n function retry() {\n if (--domCheckCount) {\n log(\"requeing onLoad callback, DOM not available\");\n setTimeout(cb, 250);\n\n return true;\n }\n\n return false;\n }\n\n function cb(e) {\n if (life.done()) {\n return;\n }\n\n var doc = getDoc(io);\n\n if (!doc) {\n log(\"cannot access response document\");\n e = SERVER_ABORT;\n }\n if (e === CLIENT_TIMEOUT_ABORT) {\n life.abort(\"timeout\", [life.xhr, \"timeout\"]);\n\n return;\n }\n if (e === SERVER_ABORT) {\n life.abort(\"server abort\", [life.xhr, \"error\", \"server abort\"]);\n\n return;\n }\n\n if (doc.location.href === s.iframeSrc) {\n // response not received yet\n return;\n }\n\n unlisten(io, cb);\n\n var result = readResponse(doc, life.xhr, s, retry);\n\n if (result) {\n life.settle(result);\n }\n }\n\n // An exception while posting settles the upload with \"error\" and the exception.\n function post() {\n if (life.done()) {\n // aborted before the delayed post\n return;\n }\n\n try {\n doSubmit();\n } catch (err) {\n log(\"upload failed: \", err);\n life.fail(err);\n }\n }\n\n if (s.forceSync) {\n post();\n } else {\n setTimeout(post, 10); // this lets dom updates render\n }\n\n return life.deferred;\n }\n\n return function sendIframe(submission) {\n var jqxhr;\n\n // now, while the controls are still listed: ajaxSubmit clears the list when it returns,\n // before a closeKeepAlive request completes\n enableControls(submission.controls);\n\n // hack to fix Safari hang (thanks to Tim Molendijk for this)\n // see: http://groups.google.com/group/jquery-dev/browse_thread/thread/36395b7ab510dd5d\n if (submission.options.closeKeepAlive) {\n deprecate(\"closeKeepAlive\", \"closeKeepAlive works around a Safari 3/4 bug and is deprecated\");\n $.get(submission.options.closeKeepAlive, function () {\n jqxhr = fileUploadIframe(submission);\n });\n } else {\n jqxhr = fileUploadIframe(submission);\n }\n\n return jqxhr;\n };\n}\n","import { deprecate, log } from \"./diagnostics.js\";\nimport { assertRealParent } from \"./form-members.js\";\nimport jQuery from \"jquery\";\nimport { keepContext } from \"./options.js\";\nimport { urlencode } from \"./successful-controls.js\";\n\n// A Submission is one ajaxSubmit call once its vetoes have passed:\n// { form, $form, fields, controls, options, method, traditional }. `options` is the object the\n// callbacks and events receive; later steps change it in place.\n\n/**\n * The submission steps. `feature` holds what the entry detected at load (fileapi, formdata), and\n * `forms` reads form attributes and attr2-style properties (attribute, property), and\n * `serialization` collects the form's fields and controls.\n */\nexport function createSubmission(feature, forms, serialization) {\n var $ = jQuery;\n\n function refuse(message) {\n log(message);\n\n return null;\n }\n\n // The options merged over the form's action, the method, and the ajax defaults.\n function withDefaults(form, options, method) {\n var action = options.url || forms.property(form, \"action\");\n var url = typeof action === \"string\" ? action.trim() : \"\";\n\n // clean url (don't include hash value); an action that is only a fragment means this page\n url = url.split(\"#\")[0] || window.location.href.split(\"#\")[0];\n // IE requires javascript:false in https, but this breaks chrome >83 and goes against spec.\n // Instead of using javascript:false always, let's only apply it for IE.\n var isMsie = /(MSIE|Trident)/.test(navigator.userAgent || \"\");\n var iframeSrc = isMsie && /^https/i.test(document.URL) ? \"javascript:false\" : \"about:blank\"; // eslint-disable-line no-script-url\n\n var merged = $.extend(\n true,\n {\n url: url,\n success: $.ajaxSettings.success,\n type: method || $.ajaxSettings.type,\n iframeSrc: iframeSrc,\n },\n options\n );\n\n return keepContext(merged, [options]);\n }\n\n /**\n * The one method every transport sends, read after the hooks: `method` wins over `type`, and\n * `type` is set to it. Undefined when only the ajax default applies, so each transport keeps\n * its own default.\n */\n function resolveMethod(options, defaultType) {\n var resolved = options.method || options.type;\n\n options.type = resolved;\n\n return resolved === defaultType && !options.method ? undefined : resolved;\n }\n\n // The data option, kept as extraData and encoded, or undefined without one.\n function extraQuery(fields, options, traditional) {\n if (!options.data) {\n return undefined;\n }\n\n var optionsData = typeof options.data === \"function\" ? options.data(fields) : options.data;\n\n if (typeof optionsData === \"string\") {\n if (options.requestFormat === \"json\") {\n throw new Error(\n 'jquery.form: requestFormat \"json\" needs object data; a string data option is a query string'\n );\n }\n\n // a query string: sent as-is when urlencoded, as its own fields otherwise\n options.extraData = queryPairs(optionsData);\n\n return optionsData;\n }\n\n options.extraData = optionsData;\n\n return $.param(optionsData, traditional);\n }\n\n // Sets a key as an own data property, so a name like __proto__ is an ordinary key.\n function defineKey(object, key, value) {\n Object.defineProperty(object, key, {\n value: value,\n enumerable: true,\n writable: true,\n configurable: true,\n });\n }\n\n /**\n * requestFormat \"json\" (#545): the fields as an object (a repeated name gives an array), merged\n * with object data, sent as a JSON body. Based on the idea in PR #557 by zhangciwu.\n */\n function jsonBody(options, fields) {\n if (/^get$/i.test(options.type)) {\n throw new Error('jquery.form: requestFormat \"json\" needs a method with a body, such as POST');\n }\n\n var body = {};\n var own = Object.prototype.hasOwnProperty;\n\n for (var i = 0; i < fields.length; i++) {\n var name = fields[i].name;\n\n if (!own.call(body, name)) {\n defineKey(body, name, fields[i].value);\n } else if (Array.isArray(body[name])) {\n body[name].push(fields[i].value);\n } else {\n defineKey(body, name, [body[name], fields[i].value]);\n }\n }\n\n var extra = options.extraData;\n\n for (var key in extra) {\n if (own.call(extra, key)) {\n defineKey(body, key, extra[key]);\n }\n }\n\n options.data = JSON.stringify(body);\n options.contentType = \"application/json; charset=UTF-8\";\n }\n\n // The fields of a query string, as the { name, value } list $.param takes.\n function queryPairs(query) {\n var pairs = [];\n var parts = query.split(\"&\");\n\n for (var i = 0; i < parts.length; i++) {\n if (parts[i]) {\n var at = parts[i].indexOf(\"=\");\n var name = at < 0 ? parts[i] : parts[i].slice(0, at);\n var value = at < 0 ? \"\" : parts[i].slice(at + 1);\n\n pairs.push({ name: decodeQuery(name), value: decodeQuery(value) });\n }\n }\n\n return pairs;\n }\n\n function decodeQuery(text) {\n return decodeURIComponent(text.replace(/\\+/g, \" \"));\n }\n\n // Puts the encoded fields in the url for a get, and in the data otherwise.\n function encode(options, q, qx) {\n if (qx) {\n q = q ? q + \"&\" + qx : qx;\n }\n\n if (options.type.toUpperCase() === \"GET\") {\n // the query goes before any fragment in the url option\n var hashAt = options.url.indexOf(\"#\");\n var base = hashAt < 0 ? options.url : options.url.slice(0, hashAt);\n\n options.url =\n base + (base.indexOf(\"?\") >= 0 ? \"&\" : \"?\") + q + options.url.slice(base.length);\n options.data = null; // data is null for 'get'\n } else {\n options.data = q; // data is the query string for 'post'\n }\n }\n\n // A callback option as a list: an array as given, one function, or none.\n function callbackList(callback) {\n if (Array.isArray(callback)) {\n return callback;\n }\n\n return callback ? [callback] : [];\n }\n\n // Calls each callback in order with the same this and arguments.\n function callEach(callbacks, context, args) {\n for (var i = 0; i < callbacks.length; i++) {\n callbacks[i].apply(context, args);\n }\n }\n\n /**\n * Resolves the options, serializes the form, and runs the vetoes: the Submission, or null when\n * an event or callback stopped it.\n */\n function prepare($set, options) {\n $set.each(function () {\n assertRealParent(this);\n });\n\n var form = $set[0];\n var method = options.method || options.type || forms.property(form, \"method\");\n\n options = withDefaults(form, options, method);\n\n // the ajax default type, when neither the caller nor the form gave a method\n var defaultType = method ? undefined : options.type;\n\n // hook for manipulating the form data before it is extracted;\n // convenient for use with rich editors like tinyMCE or FCKEditor\n var veto = {};\n\n $set.trigger(\"form-pre-serialize\", [$set, options, veto]);\n if (veto.veto) {\n return refuse(\"ajaxSubmit: submit vetoed via form-pre-serialize trigger\");\n }\n\n // provide opportunity to alter form data before it is serialized\n if (options.beforeSerialize && options.beforeSerialize($set, options) === false) {\n return refuse(\"ajaxSubmit: submit aborted via beforeSerialize callback\");\n }\n\n var traditional = options.traditional;\n\n if (typeof traditional === \"undefined\") {\n traditional = $.ajaxSettings.traditional;\n }\n\n var collected = serialization.collect($set[0], options.semantic, options.filtering);\n var fields = collected.fields;\n var controls = collected.controls;\n var qx = extraQuery(fields, options, traditional);\n\n // give pre-submit callback an opportunity to abort the submit\n if (options.beforeSubmit && options.beforeSubmit(fields, $set, options) === false) {\n return refuse(\"ajaxSubmit: submit aborted via beforeSubmit callback\");\n }\n\n // fire vetoable 'validate' event\n $set.trigger(\"form-submit-validate\", [fields, $set, options, veto]);\n if (veto.veto) {\n return refuse(\"ajaxSubmit: submit vetoed via form-submit-validate trigger\");\n }\n\n method = resolveMethod(options, defaultType);\n\n if (options.requestFormat === \"json\") {\n jsonBody(options, fields);\n } else {\n encode(options, urlencode(fields, traditional), qx);\n }\n\n return {\n form: form,\n $form: $set,\n fields: fields,\n controls: controls,\n options: options,\n method: method,\n traditional: traditional,\n };\n }\n\n /**\n * Wraps success, error and complete (a function or an array of them, as $.ajax takes) so each\n * also receives the form, and adds the resetForm,\n * clearForm and target steps before the success callbacks.\n */\n function deliver(submission) {\n var $set = submission.$form;\n var options = submission.options;\n var callbacks = [];\n\n if (options.resetForm) {\n callbacks.push(function () {\n $set.resetForm();\n });\n }\n\n if (options.clearForm) {\n callbacks.push(function () {\n $set.clearForm(options.includeHidden);\n });\n }\n\n // perform a load on the target only if dataType is not provided\n if (!options.dataType && options.target) {\n var successes = callbackList(options.success);\n\n callbacks.push(function (data, textStatus, jqXHR) {\n var successArguments = arguments,\n fn = options.replaceTarget ? \"replaceWith\" : \"html\",\n $target = $(options.target);\n\n // Only a string response is inserted. jQuery has already parsed a JSON or XML response,\n // and inserting it would parse each of its strings as HTML.\n if (typeof data === \"string\") {\n $target[fn](data);\n } else {\n log(\"target: the response was parsed by jQuery, so it is not inserted\");\n }\n\n if (!$target.length) {\n // nothing to fill: success still runs once, with the normal context\n callEach(successes, this, successArguments);\n }\n\n $target.each(function () {\n callEach(successes, this, successArguments);\n });\n });\n } else {\n $.merge(callbacks, callbackList(options.success));\n }\n\n options.success = function (data, status, xhr) {\n // jQuery 1.4+ passes xhr as 3rd arg\n var context = options.context || this; // jQuery 1.4+ supports scope context\n\n for (var i = 0, max = callbacks.length; i < max; i++) {\n callbacks[i].apply(context, [data, status, xhr || $set, $set]);\n }\n };\n\n if (options.error) {\n var errors = callbackList(options.error);\n\n options.error = function (xhr, status, error) {\n callEach(errors, options.context || this, [xhr, status, error, $set]);\n };\n }\n\n if (options.complete) {\n var completes = callbackList(options.complete);\n\n options.complete = function (xhr, status) {\n callEach(completes, options.context || this, [xhr, status, $set]);\n };\n }\n }\n\n /**\n * The transport for a submission: \"iframe\" for files without the File API or when forced,\n * \"formdata\" for files with it, \"ajax\" otherwise.\n */\n function chooseTransport(submission) {\n var $set = submission.$form;\n var options = submission.options;\n\n // [value] (issue #113), also see comment:\n // https://github.com/malsup/form/commit/588306aedba1de01388032d5f42a60159eea9228#commitcomment-2180219\n // and the file inputs outside the form that belong to it through their form attribute\n var fileInputs = $(\"input[type=file]:enabled\", $set)\n .add($(submission.controls).filter(\"input[type=file]\"))\n .filter(function () {\n return $(this).val() !== \"\";\n });\n var hasFileInputs = fileInputs.length > 0;\n // compared as the browser does: ASCII case-insensitive, without surrounding whitespace\n var mp = /^[\\t\\n\\f\\r ]*multipart\\/form-data[\\t\\n\\f\\r ]*$/i;\n var multipart =\n mp.test(forms.attribute($set[0], \"enctype\")) || mp.test(forms.attribute($set[0], \"encoding\"));\n var fileAPI = feature.fileapi && feature.formdata;\n\n log(\"fileAPI :\" + fileAPI);\n\n var shouldUseFrame = (hasFileInputs || multipart) && !fileAPI;\n\n var transport = (hasFileInputs || multipart) && fileAPI ? \"formdata\" : \"ajax\";\n\n // options.iframe allows user to force iframe mode\n // 06-NOV-09: now defaulting to iframe mode if file input is detected\n if (options.iframe !== false && (options.iframe || shouldUseFrame)) {\n transport = \"iframe\";\n }\n\n if (transport === \"iframe\" && !options.iframe) {\n deprecate(\n \"iframe\",\n \"choosing the iframe transport automatically without FormData is deprecated, set iframe: true\"\n );\n }\n\n if (transport !== \"ajax\" && options.requestFormat === \"json\") {\n throw new Error(\n 'jquery.form: requestFormat \"json\" cannot send files or use the iframe transport'\n );\n }\n\n return transport;\n }\n\n return { prepare: prepare, deliver: deliver, chooseTransport: chooseTransport };\n}\n","/*!\n * jQuery Form Plugin\n * version: 4.5.0\n * Requires jQuery v1.7.2 or later\n * Project repository: https://github.com/jquery-form/form\n\n * Copyright 2017 Kevin Morris\n * Copyright 2006 M. Alsup\n\n * Dual licensed under the LGPL-2.1+ or MIT licenses\n * https://github.com/jquery-form/form#license\n\n * This library is free software; you can redistribute it and/or\n * modify it under the terms of the GNU Lesser General Public\n * License as published by the Free Software Foundation; either\n * version 2.1 of the License, or (at your option) any later version.\n * This library is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n */\nimport { ajaxForm, ajaxFormUnbind } from \"./ajax-form.js\";\nimport { callFormMethod, tagName } from \"./form-members.js\";\nimport {\n createSuccessfulControls,\n isSuccessful,\n urlencode,\n valueOf,\n} from \"./successful-controls.js\";\nimport { deprecate, deprecateOldJQuery, log } from \"./diagnostics.js\";\nimport { sendAjax, sendFormData } from \"./xhr-transport.js\";\nimport { createIframeTransport } from \"./iframe-transport.js\";\nimport { createSubmission } from \"./submission.js\";\nimport { formAttribute } from \"./form-attributes.js\";\nimport jQuery from \"jquery\";\nimport { submitOptions } from \"./options.js\";\nimport { submitterElement } from \"./submitter.js\";\n\n(function ($) {\n \"use strict\";\n\n /*\n\t\tUsage Note:\n\t\t-----------\n\t\tDo not use both ajaxSubmit and ajaxForm on the same form. These\n\t\tfunctions are mutually exclusive. Use ajaxSubmit if you want\n\t\tto bind your own submit handler to the form. For example,\n\n\t\t$(document).ready(function() {\n\t\t\t$('#myForm').on('submit', function(e) {\n\t\t\t\te.preventDefault(); // <-- important\n\t\t\t\t$(this).ajaxSubmit({\n\t\t\t\t\ttarget: '#output'\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\n\t\tUse ajaxForm when you want the plugin to manage all the event binding\n\t\tfor you. For example,\n\n\t\t$(document).ready(function() {\n\t\t\t$('#myForm').ajaxForm({\n\t\t\t\ttarget: '#output'\n\t\t\t});\n\t\t});\n\n\t\tYou can also use ajaxForm with delegation (requires jQuery v1.7+), so the\n\t\tform does not have to exist when you invoke ajaxForm:\n\n\t\t$('#myForm').ajaxForm({\n\t\t\tdelegation: true,\n\t\t\ttarget: '#output'\n\t\t});\n\n\t\tWhen using ajaxForm, the ajaxSubmit function will be invoked for you\n\t\tat the appropriate time.\n\t*/\n\n /**\n * Feature detection\n */\n var feature = {};\n\n feature.fileapi = $('').get(0).files !== undefined;\n feature.formdata = typeof window.FormData !== \"undefined\";\n\n var hasProp = !!$.fn.prop;\n // What attr2 returns for a form: the property when it is a string, otherwise the attribute. The\n // property is read plainly on purpose: a control named like it shadows it, and then the raw\n // attribute is used.\n function formProperty(form, name) {\n var value = hasProp ? form[name] : undefined;\n\n return typeof value === \"string\" ? value : formAttribute(form, name);\n }\n\n var forms = { attribute: formAttribute, property: formProperty };\n var serialization = createSuccessfulControls(feature);\n var steps = createSubmission(feature, forms, serialization);\n var transports = {\n iframe: createIframeTransport(hasProp, forms),\n formdata: sendFormData,\n ajax: sendAjax,\n };\n\n // attr2 uses prop when it can but checks the return type for\n // an expected string. This accounts for the case where a form\n // contains inputs with names like \"action\" or \"method\"; in those\n // cases \"prop\" returns the element\n $.fn.attr2 = function () {\n deprecate(\"attr2\", \"attr2 is deprecated, use .prop() or .attr()\");\n\n if (!hasProp) {\n return this.attr.apply(this, arguments);\n }\n\n var val = this.prop.apply(this, arguments);\n\n if ((val && val.jquery) || typeof val === \"string\") {\n return val;\n }\n\n return this.attr.apply(this, arguments);\n };\n\n /**\n * ajaxSubmit() provides a mechanism for immediately submitting\n * an HTML form using AJAX.\n *\n * @param\t{object|string}\toptions\t\tjquery.form.js parameters or custom url for submission\n * @param\t{object}\t\tdata\t\textraData\n * @param\t{string}\t\tdataType\tajax dataType\n * @param\t{function}\t\tonSuccess\tajax success callback function\n */\n $.fn.ajaxSubmit = function (options, data, dataType, onSuccess) {\n deprecateOldJQuery($.fn.jquery);\n\n // fast fail if nothing selected (http://dev.jquery.com/ticket/2752)\n if (!this.length) {\n log(\"ajaxSubmit: skipping submit process - no element selected\");\n\n return this;\n }\n\n // #541: jQuery's slim build has no $.ajax\n if (!$.ajax) {\n throw new Error(\n \"jquery.form: ajaxSubmit needs the full jQuery build; this jQuery has no $.ajax\"\n );\n }\n\n var submission = steps.prepare(this, submitOptions(options, data, dataType, onSuccess));\n\n if (!submission) {\n return this;\n }\n\n steps.deliver(submission);\n\n var jqxhr = transports[steps.chooseTransport(submission)](submission);\n\n this.removeData(\"jqxhr\").data(\"jqxhr\", jqxhr);\n\n // clear element array\n for (var k = 0; k < submission.controls.length; k++) {\n submission.controls[k] = null;\n }\n\n // fire 'notify' event\n this.trigger(\"form-submit-notify\", [this, submission.options]);\n\n return this;\n };\n\n $.fn.ajaxForm = ajaxForm;\n $.fn.ajaxFormUnbind = ajaxFormUnbind;\n\n /**\n * formToArray() gathers form element data into an array of objects that can\n * be passed to any of the following ajax functions: $.get, $.post, or load.\n * Each object in the array has both a 'name' and 'value' property. An example of\n * an array for a simple login form might be:\n *\n * [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ]\n *\n * It is this array that is passed to pre-submit callback functions provided to the\n * ajaxSubmit() and ajaxForm() methods.\n */\n $.fn.formToArray = function (semantic, elements, filtering) {\n var collected = serialization.collect(this[0], semantic, filtering);\n\n if (elements) {\n elements.push.apply(elements, collected.controls);\n }\n\n return collected.fields;\n };\n\n /**\n * Serializes form data into a 'submittable' string. This method will return a string\n * in the format: name1=value1&name2=value2\n */\n $.fn.formSerialize = function (semantic) {\n // hand off to jQuery.param for proper encoding\n return urlencode(this.formToArray(semantic));\n };\n\n /**\n * Serializes all field elements in the jQuery object into a query string.\n * This method will return a string in the format: name1=value1&name2=value2\n */\n $.fn.fieldSerialize = function (successful) {\n var a = [];\n\n this.each(function () {\n var n = this.name;\n\n // a form is not a field, though it may have a name\n if (!n || tagName(this) === \"form\") {\n return;\n }\n\n var v = $.fieldValue(this, successful);\n\n if (v && v.constructor === Array) {\n for (var i = 0, max = v.length; i < max; i++) {\n a.push({ name: n, value: v[i] });\n }\n } else if (v !== null && typeof v !== \"undefined\") {\n a.push({ name: this.name, value: v });\n }\n });\n\n // hand off to jQuery.param for proper encoding\n return urlencode(a);\n };\n\n /**\n * Returns the value(s) of the element in the matched set. For example, consider the following form:\n *\n *\t
\n *\t\t\n *\t\t\n *\t\t\n *\t\t\n *\t\t\n *\t\t\n *\t
\n *\n *\tvar v = $('input[type=text]').fieldValue();\n *\t// if no values are entered into the text inputs\n *\tv === ['','']\n *\t// if values entered into the text inputs are 'foo' and 'bar'\n *\tv === ['foo','bar']\n *\n *\tvar v = $('input[type=checkbox]').fieldValue();\n *\t// if neither checkbox is checked\n *\tv === undefined\n *\t// if both checkboxes are checked\n *\tv === ['B1', 'B2']\n *\n *\tvar v = $('input[type=radio]').fieldValue();\n *\t// if neither radio is checked\n *\tv === undefined\n *\t// if first radio is checked\n *\tv === ['C1']\n *\n * The successful argument controls whether or not the field element must be 'successful'\n * (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls).\n * The default value of the successful argument is true. If this value is false the value(s)\n * for each element is returned.\n *\n * Note: This method *always* returns an array. If no valid value can be determined the\n *\tarray will be empty, otherwise it will contain one or more values.\n */\n $.fn.fieldValue = function (successful) {\n for (var val = [], i = 0, max = this.length; i < max; i++) {\n var el = this[i];\n var v = $.fieldValue(el, successful);\n\n if (v === null || typeof v === \"undefined\" || (v.constructor === Array && !v.length)) {\n continue;\n }\n\n if (v.constructor === Array) {\n $.merge(val, v);\n } else {\n val.push(v);\n }\n }\n\n return val;\n };\n\n /**\n * Returns the value of the field element.\n */\n $.fieldValue = function (el, successful) {\n var required = typeof successful === \"undefined\" || successful;\n\n if (required && !isSuccessful(el, submitterElement(el.form))) {\n return null;\n }\n\n return valueOf(el);\n };\n\n /**\n * Clears the form data. Takes the following actions on the form's input fields:\n * - input text fields will have their 'value' property set to the empty string\n * - select elements will have their 'selectedIndex' property set to -1\n * - checkbox and radio inputs will have their 'checked' property set to false\n * - inputs of type submit, button, reset, and hidden will *not* be effected\n * - button elements will *not* be effected\n */\n $.fn.clearForm = function (includeHidden) {\n return this.each(function () {\n $(\"input,select,textarea\", this).clearFields(includeHidden);\n });\n };\n\n /**\n * Clears the selected form elements.\n */\n $.fn.clearInputs = function (includeHidden) {\n deprecate(\"clearInputs\", \"clearInputs is deprecated, use clearFields\");\n\n return this.clearFields(includeHidden);\n };\n\n $.fn.clearFields = function (includeHidden) {\n var re =\n /^(?:color|date|datetime|datetime-local|email|month|number|password|range|search|tel|text|time|url|week)$/i; // 'hidden' is not in this list\n\n return this.each(function () {\n var t = this.type,\n tag = tagName(this);\n\n if (re.test(t) || tag === \"textarea\") {\n this.value = \"\";\n } else if (t === \"checkbox\" || t === \"radio\") {\n this.checked = false;\n } else if (tag === \"select\") {\n this.selectedIndex = -1;\n } else if (t === \"file\") {\n if (/MSIE/.test(navigator.userAgent)) {\n $(this).replaceWith($(this).clone(true));\n } else {\n $(this).val(\"\");\n }\n } else if (includeHidden) {\n // includeHidden can be the value true, or it can be a selector string\n // indicating a special test; for example:\n // $('#myForm').clearForm('.special:hidden')\n // the above would clean hidden inputs that have the class of 'special'\n if (\n (includeHidden === true && /hidden/.test(t)) ||\n (typeof includeHidden === \"string\" && $(this).is(includeHidden))\n ) {\n this.value = \"\";\n }\n }\n });\n };\n\n /**\n * Resets the form data or individual elements. Takes the following actions\n * on the selected tags:\n * - all fields within form elements will be reset to their original value\n * - input / textarea / select fields will be reset to their original value\n * - option / optgroup fields (for multi-selects) will defaulted individually\n * - non-multiple options will find the right select to default\n * - label elements will be searched against its 'for' attribute\n * - all others will be searched for appropriate children to default\n */\n $.fn.resetForm = function () {\n return this.each(function () {\n var el = $(this);\n var tag = tagName(this);\n\n switch (tag) {\n case \"input\":\n this.checked = this.defaultChecked;\n\n // as the native reset: types whose value is the value attribute keep it\n if (this.type === \"file\") {\n // a file input cannot take its value attribute; the native reset empties it\n this.value = \"\";\n } else if (!/^(?:checkbox|radio|hidden|submit|reset|button|image)$/.test(this.type)) {\n this.value = this.defaultValue;\n }\n\n return true;\n\n case \"textarea\":\n this.value = this.defaultValue;\n\n return true;\n\n case \"option\":\n case \"optgroup\":\n var select = el.parents(\"select\");\n\n if (select.length && select[0].multiple) {\n if (tag === \"option\") {\n this.selected = this.defaultSelected;\n } else {\n el.find(\"option\").resetForm();\n }\n } else {\n select.resetForm();\n }\n\n return true;\n\n case \"select\":\n // in order, as the native reset: of several default options, a single select keeps the last\n el.find(\"option\").each(function () {\n this.selected = this.defaultSelected;\n });\n\n return true;\n\n case \"label\":\n // The control whose id the for attribute names, and the controls inside the label. The\n // filter keeps a for that names an ancestor from resetting the label again.\n var forEl = this.htmlFor && this.ownerDocument.getElementById(this.htmlFor);\n\n el.find(\"input,select,textarea\").add(forEl).filter(\"input,select,textarea\").resetForm();\n\n return true;\n\n case \"form\":\n // through the prototype: a control named reset shadows the method\n callFormMethod(this, \"reset\");\n\n return true;\n\n default:\n el.find(\"form,input,label,select,textarea\").resetForm();\n\n return true;\n }\n });\n };\n\n /**\n * Enables or disables any matching elements.\n */\n $.fn.enable = function (b) {\n if (typeof b === \"undefined\") {\n b = true;\n }\n\n return this.each(function () {\n this.disabled = !b;\n });\n };\n\n /**\n * Checks/unchecks any matching checkboxes or radio buttons and\n * selects/deselects and matching option elements.\n */\n $.fn.selected = function (select) {\n if (typeof select === \"undefined\") {\n select = true;\n }\n\n return this.each(function () {\n var t = this.type;\n\n if (t === \"checkbox\" || t === \"radio\") {\n this.checked = select;\n } else if (tagName(this) === \"option\") {\n var $sel = $(this).parent(\"select\");\n\n if (select && $sel[0] && $sel[0].type === \"select-one\") {\n // deselect all other options\n $sel.find(\"option\").selected(false);\n }\n\n this.selected = select;\n }\n });\n };\n\n // expose debug var\n $.fn.ajaxSubmit.debug = false;\n})(jQuery);\n\nexport default jQuery;\n"],"names":["owners","plainForm","document","createElement","findDescriptor","name","i","length","owner","window","descriptor","Object","getOwnPropertyDescriptor","prototype","formMember","form","get","call","e","callFormMethod","value","apply","Array","slice","arguments","tagName","el","toLowerCase","isElement","node","assertRealParent","parentNode","Error","closestByTag","names","indexOf","storeKey","setExpando","ignore","expando","els","namedItem","undefined","record","x","y","jQuery","data","type","setTimeout","captureSubmitter","target","point","offsetX","offsetY","fn","offset","pageX","left","pageY","top","offsetLeft","offsetTop","imagePoint","submitterOf","stored","log","ajaxSubmit","debug","msg","join","console","opera","postError","warned","deprecate","id","message","warn","deprecateOldJQuery","version","parts","String","split","major","Number","beforeJQuery35","shorthandOptions","options","dataType","onSuccess","result","url","success","submitOptions","key","hasOwnProperty","withoutUrl","keepContext","settings","sources","context","submitWith","isDefaultPrevented","preventDefault","originalEvent","submitter","captureEventSubmitter","doAjaxSubmit","captureSubmittingElement","this","bindDelegated","$sel","selector","off","on","closestMatch","Element","closest","is","delegated","unbindSelector","handlers","submit","click","selectionOnly","ajaxForm","jquery","delegation","bindSelector","beforeFormUnbind","ajaxFormUnbind","o","s","c","isReady","bindLater","formAttribute","attr","rLineBreak","rCR","rUnsubmittable","isDisabled","matches","disabled","valueOf","index","selectedIndex","a","ops","one","max","op","selected","v","attributes","specified","text","push","selectValue","val","raw","replace","loneSurrogate","wellFormed","match","before","urlencode","fields","traditional","param","map","field","urlencodedFields","createSuccessfulControls","feature","$","controlsOf","semantic","formId","getElementsByTagName","makeArray","grep","ownedBy","test","navigator","userAgent","concat","filter","getAttribute","inArray","outsideControls","fieldsOf","n","fieldValue","constructor","fileapi","files","file","required","imageFields","sub","input","addCandidate","collected","own","controls","collect","filtering","addClickedImage","deepSerialize","extraData","part","serialized","len","decodeURIComponent","sendFormData","submission","formdata","FormData","append","serializedData","extend","ajaxSettings","contentType","processData","cache","method","uploadProgress","createXhr","xhr","upload","addEventListener","event","percent","position","loaded","total","lengthComputable","Math","ceil","beforeSend","formData","ajax","sendAjax","uploadAttributes","hasOwn","isGet","addSubmitterFields","submitterFields","addCsrfField","forms","origin","csrf_token","csrf_param","posts","property","href","location","protocol","host","setFormAttribute","getDoc","frame","doc","contentWindow","err","contentDocument","readStatus","status","statusText","readResponse","retry","errMsg","isXml","XMLDocument","isXMLDoc","body","innerHTML","docRoot","documentElement","responseText","responseXML","getResponseHeader","header","readDocument","dt","scr","textarea","ta","pre","b","textContent","innerText","readEmbedded","ct","xml","nodeName","error","dataFilter","JSON","parse","globalEval","httpData","createLifecycle","g","timeoutHandle","callbackProcessed","deferred","Deferred","aborted","getAllResponseHeaders","setRequestHeader","abort","done","rejection","textStatus","stop","reject","trigger","complete","endGlobalEvents","active","clearTimeout","release","settle","failure","resolve","succeed","start","global","fail","startTimer","onTimeout","timeout","stopTimer","createIframeTransport","hasProp","frameCount","fileUploadIframe","ownerDocument","$body","$io","iframeTarget","each","nameWindow","io","setAttribute","iframeSrc","css","createFrame","Date","getTime","life","execCommand","remove","frameHooks","domCheckCount","checkState","state","readyState","cb","doSubmit","saved","saveAttributes","mp","skipEncodingOverride","setUploadAttributes","extraInputs","added","addHiddenInput","appendTo","isPlainObject","single","f","addExtraInputs","root","contains","notInDocument","attachEvent","listen","submitForm","restoreAttributes","detachEvent","removeEventListener","unlisten","post","forceSync","jqxhr","elements","prop","removeAttr","enableControls","closeKeepAlive","createSubmission","serialization","refuse","extraQuery","optionsData","requestFormat","query","pairs","at","decodeQuery","queryPairs","defineKey","object","defineProperty","enumerable","writable","configurable","callbackList","callback","isArray","callEach","callbacks","args","prepare","$set","action","trim","URL","withDefaults","defaultType","veto","beforeSerialize","qx","beforeSubmit","resolved","resolveMethod","extra","stringify","jsonBody","q","toUpperCase","hashAt","base","encode","$form","deliver","resetForm","clearForm","includeHidden","successes","jqXHR","successArguments","replaceTarget","$target","merge","errors","completes","chooseTransport","hasFileInputs","add","multipart","attribute","fileAPI","shouldUseFrame","transport","iframe","steps","transports","attr2","removeData","k","formToArray","formSerialize","fieldSerialize","successful","t","checked","isSuccessful","clearFields","clearInputs","re","tag","replaceWith","clone","defaultChecked","defaultValue","select","parents","multiple","defaultSelected","find","forEl","htmlFor","getElementById","enable","parent"],"mappings":";;;;;;;;;;;;;;;;;;;;;4ZAMIA,EAAS,CAAC,kBAAmB,cAAe,UAAW,QAGvDC,EAAYC,EAASC,cAAc,QAEvC,SAASC,EAAeC,GACtB,IAAK,IAAIC,EAAI,EAAGA,EAAIN,EAAOO,OAAQD,IAAK,CACtC,IAAIE,EAAQC,EAAOT,EAAOM,IACtBI,EAAaF,GAASG,OAAOC,yBAAyBJ,EAAMK,UAAWR,GAE3E,GAAIK,EACF,OAAOA,CAEX,CAEA,OAAO,IACT,CAOO,SAASI,EAAWC,EAAMV,GAC/B,IAAIK,EAAaN,EAAeC,GAEhC,IACE,OAAOK,EAAWM,IAAIC,KAAKF,EAC7B,CAAE,MAAOG,GACP,OAAOH,EAAKV,EACd,CACF,CAMO,SAASc,EAAeJ,EAAMV,GACnC,IAAIK,EAAaN,EAAeC,GAGhC,OAFaK,EAAaA,EAAWU,MAAQnB,EAAUI,IAEzCgB,MAAMN,EAAMO,MAAMT,UAAUU,MAAMN,KAAKO,UAAW,GAClE,CAGO,SAASC,EAAQC,GACtB,IAAIrB,EAAOS,EAAWY,EAAI,WAE1B,MAAuB,iBAATrB,EAAoBA,EAAKsB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AET,IAAK,SACL,IAAK,WACH,IAAIC,EAAStc,EAAGuc,QAAQ,UAYxB,OAVID,EAAOzd,QAAUyd,EAAO,GAAGE,SACjB,WAARP,EACF7W,KAAK2C,SAAW3C,KAAKqX,gBAErBzc,EAAG0c,KAAK,UAAU5C,YAGpBwC,EAAOxC,aAGF,EAET,IAAK,SAMH,OAJA9Z,EAAG0c,KAAK,UAAU5I,KAAK,WACrB1O,KAAK2C,SAAW3C,KAAKqX,eACvB,IAEO,EAET,IAAK,QAGH,IAAIE,EAAQvX,KAAKwX,SAAWxX,KAAKsO,cAAcmJ,eAAezX,KAAKwX,SAInE,OAFA5c,EAAG0c,KAAK,yBAAyB/B,IAAIgC,GAAOzS,OAAO,yBAAyB4P,aAErE,EAET,IAAK,OAIH,OAFAra,EAAe2F,KAAM,UAEd,EAET,QAGE,OAFApF,EAAG0c,KAAK,oCAAoC5C,aAErC,EAEb,EACF,EAKAxQ,EAAEzH,GAAGib,OAAS,SAAUrM,GAKtB,YAJiB,IAANA,IACTA,GAAI,GAGCrL,KAAK0O,KAAK,WACf1O,KAAKkC,UAAYmJ,CACnB,EACF,EAMAnH,EAAEzH,GAAGkG,SAAW,SAAUuU,GAKxB,YAJsB,IAAXA,IACTA,GAAS,GAGJlX,KAAK0O,KAAK,WACf,IAAI6H,EAAIvW,KAAK9D,KAEb,GAAU,aAANqa,GAA0B,UAANA,EACtBvW,KAAKwW,QAAUU,OACV,GAAsB,WAAlBvc,EAAQqF,MAAoB,CACrC,IAAIE,EAAOgE,EAAElE,MAAM2X,OAAO,UAEtBT,GAAUhX,EAAK,IAAuB,eAAjBA,EAAK,GAAGhE,MAE/BgE,EAAKoX,KAAK,UAAU3U,UAAS,GAG/B3C,KAAK2C,SAAWuU,CAClB,CACF,EACF,EAGAhT,EAAEzH,GAAGY,WAAWC,OAAQ,CACzB,CAlcD,CAkcGtB"} \ No newline at end of file +{"version":3,"file":"jquery.form.min.js","sources":["../src/form-members.js","../src/submitter.js","../src/diagnostics.js","../src/options.js","../src/ajax-form.js","../src/form-attributes.js","../src/successful-controls.js","../src/xhr-transport.js","../src/iframe-post.js","../src/iframe-response.js","../src/iframe-lifecycle.js","../src/iframe-transport.js","../src/submission.js","../src/jquery.form.js"],"sourcesContent":["// Form members: the properties and methods the plugin reads or calls on a form. A control named\n// like a member (elements, setAttribute) shadows that member on the form itself, so members are\n// read through the DOM prototypes, which a control cannot shadow.\n\n// The prototype chain of a form, nearest first. Looked up on every call: old browsers have no\n// DOM prototypes, and tests remove them.\nvar owners = [\"HTMLFormElement\", \"HTMLElement\", \"Element\", \"Node\"];\n\n// A form no control can shadow, for methods when the DOM has no prototypes to read them from.\nvar plainForm = document.createElement(\"form\");\n\nfunction findDescriptor(name) {\n for (var i = 0; i < owners.length; i++) {\n var owner = window[owners[i]];\n var descriptor = owner && Object.getOwnPropertyDescriptor(owner.prototype, name);\n\n if (descriptor) {\n return descriptor;\n }\n }\n\n return null;\n}\n\n/**\n * Reads a member of a form through its prototype getter.\n * Falls back to the plain property without DOM prototypes, or on an element the getter does not\n * accept (such as a fieldset for `elements`).\n */\nexport function formMember(form, name) {\n var descriptor = findDescriptor(name);\n\n try {\n return descriptor.get.call(form);\n } catch (e) {\n return form[name];\n }\n}\n\n/**\n * Calls a method of a form through its prototype, or through an unshadowed form without DOM\n * prototypes.\n */\nexport function callFormMethod(form, name) {\n var descriptor = findDescriptor(name);\n var method = descriptor ? descriptor.value : plainForm[name];\n\n return method.apply(form, Array.prototype.slice.call(arguments, 2));\n}\n\n// Nodes such as the document and text nodes have no tag name (#600).\nexport function tagName(el) {\n var name = formMember(el, \"tagName\");\n\n return typeof name === \"string\" ? name.toLowerCase() : \"\";\n}\n\n// Elements only: the subject of formToArray may also be the document or a plain object.\nexport function isElement(node) {\n return formMember(node, \"nodeType\") === 1;\n}\n\n// A control named parentNode makes every parentNode walk (jQuery's trigger and closest among\n// them) cycle between the form and the control.\nexport function assertRealParent(el) {\n if (el.parentNode !== formMember(el, \"parentNode\")) {\n throw new Error(\n 'jquery.form: a form control named \"parentNode\" hides the form\\'s parentNode; rename the control'\n );\n }\n}\n\n// The element itself or its nearest ancestor with one of the tag names, through the real tree.\nexport function closestByTag(el, names) {\n for (var node = el; node; node = formMember(node, \"parentNode\")) {\n if (names.indexOf(tagName(node)) >= 0) {\n return node;\n }\n }\n\n return null;\n}\n","import { closestByTag, formMember } from \"./form-members.js\";\nimport jQuery from \"jquery\";\n\n// The submitter: the button that submitted a form, captured from ajaxForm's clicks. It is kept in\n// a private store and cleared shortly after the click. The form's clk, clk_x and clk_y properties\n// are still written for pages that read them, and read when the store has none.\n\nvar storeKey = \"jqFormSubmitter\";\n\n// Writes a property on the form; a control with that name makes it read-only.\nfunction setExpando(form, name, value) {\n try {\n form[name] = value;\n } catch (ignore) {\n // the control keeps the name; the store has the submitter\n }\n}\n\n// A property the page set on the form, never a control of the form with that name.\nfunction expando(form, name) {\n var value = form[name];\n var els = formMember(form, \"elements\");\n\n return els && value && els.namedItem(name) === value ? undefined : value;\n}\n\n// Records a submitter for a form until the click window ends.\nfunction record(form, el, x, y) {\n jQuery.data(form, storeKey, { el: el, x: x, y: y });\n setExpando(form, \"clk\", el);\n\n if (el.type === \"image\") {\n setExpando(form, \"clk_x\", x);\n setExpando(form, \"clk_y\", y);\n }\n\n // clear form vars\n setTimeout(function () {\n jQuery.data(form, storeKey, null);\n setExpando(form, \"clk\", null);\n setExpando(form, \"clk_x\", null);\n setExpando(form, \"clk_y\", null);\n }, 100);\n}\n\n// The clicked point of an image button, relative to the image.\nfunction imagePoint(e, target) {\n if (typeof e.offsetX !== \"undefined\") {\n return [e.offsetX, e.offsetY];\n }\n\n if (typeof jQuery.fn.offset === \"function\") {\n var offset = jQuery(target).offset();\n\n return [e.pageX - offset.left, e.pageY - offset.top];\n }\n\n return [e.pageX - target.offsetLeft, e.pageY - target.offsetTop];\n}\n\n/**\n * Records the submit or image button a click event reached, for the form it belongs to.\n */\nexport function captureSubmitter(e) {\n // the clicked control, or the button around the clicked content (ex: a span within a button)\n var target = closestByTag(e.target, [\"button\", \"input\"]);\n\n // the type property, unlike the attribute, is \"submit\" for a button without a type (#588)\n if (!target || (target.type !== \"submit\" && target.type !== \"image\")) {\n return;\n }\n\n var form = target.form;\n\n if (!form) {\n // a submit control that belongs to no form\n return;\n }\n\n var point = target.type === \"image\" ? imagePoint(e, target) : [];\n\n record(form, target, point[0], point[1]);\n}\n\n/**\n * Records the submitter a submit event names (SubmitEvent.submitter), when no click was captured.\n * An image submitter gets the point 0,0, as native submission sends it without a click.\n */\nexport function captureEventSubmitter(e, form) {\n var el = e.originalEvent && e.originalEvent.submitter;\n\n if (el && !submitterOf(form)) {\n record(form, el, 0, 0);\n }\n}\n\n/**\n * The form's submitter as { el, x, y } (x and y for an image button), or null.\n */\nexport function submitterOf(form) {\n if (!form) {\n return null;\n }\n\n var stored = jQuery.data(form, storeKey);\n\n if (stored) {\n return stored;\n }\n\n var el = expando(form, \"clk\");\n\n return el ? { el: el, x: expando(form, \"clk_x\"), y: expando(form, \"clk_y\") } : null;\n}\n\n/**\n * The submitter's fields for a post that adds them itself (the iframe upload), as name β†’ value.\n */\nexport function submitterFields(form) {\n var fields = {};\n var sub = submitterOf(form);\n var el = sub && sub.el;\n\n if (el && el.name && !el.disabled) {\n fields[el.name] = el.value;\n if (el.type === \"image\") {\n fields[el.name + \".x\"] = sub.x;\n fields[el.name + \".y\"] = sub.y;\n }\n }\n\n return fields;\n}\n\n/**\n * The form's submitter element, or null.\n */\nexport function submitterElement(form) {\n var sub = submitterOf(form);\n\n return sub ? sub.el : null;\n}\n","import jQuery from \"jquery\";\n\n// Debug logging, switched on by $.fn.ajaxSubmit.debug. The flag is read on every call, so it can\n// be turned on after the plugin loads.\nexport function log() {\n if (!jQuery.fn.ajaxSubmit.debug) {\n return;\n }\n\n var msg = \"[jquery.form] \" + Array.prototype.join.call(arguments, \"\");\n\n if (window.console && window.console.log) {\n window.console.log(msg);\n } else if (window.opera && window.opera.postError) {\n window.opera.postError(msg);\n }\n}\n\nvar warned = {};\n\n/**\n * A deprecation warning: console.warn, only while debug is on, once per id per page. The message\n * names the replacement; the warning adds that the feature is removed in 5.0.\n */\nexport function deprecate(id, message) {\n if (!jQuery.fn.ajaxSubmit.debug || warned[id]) {\n return;\n }\n\n warned[id] = true;\n\n if (window.console && typeof window.console.warn === \"function\") {\n window.console.warn(\"[jquery.form] \" + message + \" (removed in 5.0)\");\n }\n}\n\n// Forgets which deprecations have warned (for tests).\nexport function resetDeprecations() {\n warned = {};\n}\n\n// True for a jQuery version string older than 3.5.\nexport function beforeJQuery35(version) {\n var parts = String(version).split(\".\");\n var major = Number(parts[0]);\n\n return major < 3 || (major === 3 && Number(parts[1]) < 5);\n}\n\n// 5.0 needs jQuery 3.5 or later: warned on the first ajaxSubmit or ajaxForm, given jQuery's version.\nexport function deprecateOldJQuery(version) {\n if (beforeJQuery35(version)) {\n deprecate(\n \"jquery\",\n \"support for jQuery \" + version + \" is deprecated, 5.0 needs jQuery 3.5 or later\"\n );\n }\n}\n","// The arguments ajaxSubmit and ajaxForm accept in place of an options object.\n\n/**\n * Turns the (url, data, dataType, success) shorthand into options. A url of false is kept as\n * the url; anything else is returned as given.\n */\nexport function shorthandOptions(options, data, dataType, onSuccess) {\n if (typeof options !== \"string\" && options !== false) {\n return options;\n }\n\n var result = { url: options, data: data, dataType: dataType };\n\n if (typeof onSuccess === \"function\") {\n result.success = onSuccess;\n }\n\n return result;\n}\n\n// A copy of options without its url, so the form action is used.\nfunction withoutUrl(options) {\n var result = {};\n\n for (var key in options) {\n if (key !== \"url\" && Object.prototype.hasOwnProperty.call(options, key)) {\n result[key] = options[key];\n }\n }\n\n return result;\n}\n\n/**\n * The options ajaxSubmit starts from: a function is the success callback, the shorthand is\n * expanded, and no options at all is an empty object. A url of false or \"\" means the form action.\n */\nexport function submitOptions(options, data, dataType, onSuccess) {\n if (typeof options === \"function\") {\n return { success: options };\n }\n\n options = shorthandOptions(options, data, dataType, onSuccess);\n\n if (typeof options === \"undefined\") {\n return {};\n }\n\n return options.url === false || options.url === \"\" ? withoutUrl(options) : options;\n}\n\n/**\n * jQuery treats `context` as a flat option: after a deep merge, the settings get back the\n * caller's own object from the last source that has one, so `this` in callbacks is that object.\n */\nexport function keepContext(settings, sources) {\n for (var i = 0; i < sources.length; i++) {\n if (sources[i].context !== undefined) {\n settings.context = sources[i].context;\n }\n }\n\n return settings;\n}\n","import { assertRealParent, closestByTag, formMember, isElement } from \"./form-members.js\";\nimport { captureEventSubmitter, captureSubmitter } from \"./submitter.js\";\nimport { deprecate, deprecateOldJQuery, log } from \"./diagnostics.js\";\nimport jQuery from \"jquery\";\nimport { shorthandOptions } from \"./options.js\";\n\n// ajaxForm binding: the submit and click handlers that send a form through ajaxSubmit. The\n// handlers look up $.fn.ajaxSubmit when they run, so a replacement installed later is used.\n\n// Sends the submit event's form with ajaxSubmit, unless an earlier handler cancelled it.\nfunction submitWith(e, options) {\n if (!e.isDefaultPrevented()) {\n // if event has been canceled, don't proceed\n e.preventDefault();\n // the form is found through the real tree: a control named nodeType misleads jQuery's closest\n var form = closestByTag(e.target, [\"form\"]);\n\n // a button outside the form (form attribute), or requestSubmit(button), sends no click here\n captureEventSubmitter(e, form);\n jQuery(form).ajaxSubmit(options); // #365\n }\n}\n\nfunction doAjaxSubmit(e) {\n submitWith(e, e.data);\n}\n\nfunction captureSubmittingElement(e) {\n /* jshint validthis:true */\n assertRealParent(this);\n captureSubmitter(e);\n}\n\n// An empty selection: queued until the DOM is ready (old jQuery keeps the selector), or dropped.\nfunction bindLater($sel, options) {\n var o = { s: $sel.selector, c: $sel.context };\n\n if (!jQuery.isReady && o.s) {\n log(\"DOM not ready, queuing ajaxForm\");\n deprecate(\n \"queue\",\n \"queuing ajaxForm until the DOM is ready is deprecated, call ajaxForm inside $(fn) \" +\n 'or use delegation: \"\"'\n );\n jQuery(function () {\n jQuery(o.s, o.c).ajaxForm(options);\n });\n\n return $sel;\n }\n\n // is your DOM ready? http://docs.jquery.com/Tutorials:Introducing_$(document).ready()\n log(\"terminating; zero elements found by selector\" + (jQuery.isReady ? \"\" : \" (DOM not ready)\"));\n\n return $sel;\n}\n\n// delegation: true on jQuery 3 and later, where the selection has no selector: always warned,\n// debug or not, once per ajaxForm call.\nfunction warnUnscoped() {\n var console = window.console || {};\n\n if (typeof console.warn === \"function\") {\n console.warn(\n \"[jquery.form] delegation: true binds every form on the page on jQuery 3 and later; \" +\n 'pass a selector instead, e.g. delegation: \"form.ajax\"'\n );\n }\n}\n\nfunction bindDelegated($sel, options) {\n if ($sel.selector === undefined) {\n warnUnscoped();\n }\n\n jQuery(document)\n .off(\"submit.form-plugin\", $sel.selector, doAjaxSubmit)\n .off(\"click.form-plugin\", $sel.selector, captureSubmittingElement)\n .on(\"submit.form-plugin\", $sel.selector, options, doAjaxSubmit)\n .on(\"click.form-plugin\", $sel.selector, options, captureSubmittingElement);\n\n return $sel;\n}\n\n// The element itself or its nearest ancestor that matches the selector. The walk never reads a\n// parentNode a control can hide (jQuery's delegated walk does, and cycles on such a form).\nfunction closestMatch(el, selector) {\n if (!isElement(el)) {\n return null;\n }\n\n if (window.Element && Element.prototype.closest) {\n return Element.prototype.closest.call(el, selector);\n }\n\n for (var node = el; node && isElement(node); node = formMember(node, \"parentNode\")) {\n if (jQuery(node).is(selector)) {\n return node;\n }\n }\n\n return null;\n}\n\n// The document handlers bound for each delegation selector, keyed by \"s\" + selector.\nvar delegated = {};\n\nfunction unbindSelector(selector) {\n var handlers = delegated[\"s\" + selector];\n\n if (handlers) {\n jQuery(document)\n .off(\"submit.form-plugin\", handlers.submit)\n .off(\"click.form-plugin\", handlers.click);\n delete delegated[\"s\" + selector];\n }\n}\n\n// delegation: \"\": one handler pair on the document, scoped to the selector.\nfunction bindSelector($sel, selector, options) {\n if (!selector) {\n throw new Error(\"jquery.form: delegation needs a selector, or true\");\n }\n\n var handlers = {\n submit: function (e) {\n if (closestMatch(e.target, selector)) {\n submitWith(e, options);\n }\n },\n click: function (e) {\n if (closestMatch(e.target, selector)) {\n captureSubmitter(e);\n }\n },\n };\n\n unbindSelector(selector);\n delegated[\"s\" + selector] = handlers;\n jQuery(document)\n .on(\"submit.form-plugin\", handlers.submit)\n .on(\"click.form-plugin\", handlers.click);\n\n return $sel;\n}\n\n// Passed by ajaxForm's own rebind: unbind the selection only, never the document handlers.\nvar selectionOnly = {};\n\n/**\n * ajaxForm() binds the selected forms so a submit is sent with ajaxSubmit, with the clicked\n * submit button (and image coordinates) included. The options work as for ajaxSubmit.\n */\nexport function ajaxForm(options, data, dataType, onSuccess) {\n deprecateOldJQuery(jQuery.fn.jquery);\n options = shorthandOptions(options, data, dataType, onSuccess) || {};\n\n if (typeof options.delegation === \"string\") {\n return bindSelector(this, options.delegation, options);\n }\n\n options.delegation = options.delegation && typeof jQuery.fn.on === \"function\";\n\n if (!options.delegation && this.length === 0) {\n return bindLater(this, options);\n }\n\n if (options.delegation) {\n return bindDelegated(this, options);\n }\n\n if (options.beforeFormUnbind) {\n options.beforeFormUnbind(this, options);\n }\n\n return this.ajaxFormUnbind(selectionOnly)\n .on(\"submit.form-plugin\", options, doAjaxSubmit)\n .on(\"click.form-plugin\", options, captureSubmittingElement);\n}\n\n/**\n * ajaxFormUnbind() removes the handlers ajaxForm bound on the selection and every delegated\n * binding on the document. ajaxFormUnbind(selector) removes only that delegation selector.\n */\nexport function ajaxFormUnbind(selector) {\n if (typeof selector === \"string\") {\n unbindSelector(selector);\n\n return this;\n }\n\n if (selector !== selectionOnly) {\n delegated = {};\n jQuery(document).off(\"submit.form-plugin click.form-plugin\");\n }\n\n return this.off(\"submit.form-plugin click.form-plugin\");\n}\n","import { callFormMethod, isElement } from \"./form-members.js\";\nimport jQuery from \"jquery\";\n\n/**\n * An attribute of a form, or undefined when it is absent, as jQuery's attr returns it. The\n * subject may also be the document or a plain object, read through jQuery.\n */\nexport function formAttribute(form, name) {\n if (!isElement(form)) {\n return jQuery(form).attr(name);\n }\n\n var value = callFormMethod(form, \"getAttribute\", name);\n\n return value === null ? undefined : value;\n}\n","import { callFormMethod, formMember, isElement, tagName } from \"./form-members.js\";\nimport { formAttribute } from \"./form-attributes.js\";\nimport jQuery from \"jquery\";\nimport { submitterOf } from \"./submitter.js\";\n\n// Successful controls: which controls of a form are sent, and as which name/value fields\n// (https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#constructing-the-form-data-set).\n\n// Line breaks, sent as CRLF\nvar rLineBreak = /\\r\\n|\\r|\\n/g;\nvar rCR = /\\r/g;\n\n// Listed form elements that are never submitted.\nvar rUnsubmittable = /^(?:fieldset|object|output)$/;\n\n/**\n * Whether a control or option is disabled, also through a disabled fieldset or optgroup. Without\n * selector matching, only its own disabled property is read.\n */\nfunction isDisabled(el) {\n return typeof el.matches === \"function\" ? el.matches(\":disabled\") : !!el.disabled;\n}\n\n/**\n * The successful-control rule: whether a control is sent. `submitter` is the button that\n * submitted the control's form; other submit and image buttons of a form are not sent.\n */\nexport function isSuccessful(el, submitter) {\n var t = el.type;\n\n if (!el.name || isDisabled(el) || t === \"reset\" || t === \"button\") {\n return false;\n }\n\n if (t === \"checkbox\" || t === \"radio\") {\n return !!el.checked;\n }\n\n if (t === \"submit\" || t === \"image\") {\n return !el.form || submitter === el;\n }\n\n return tagName(el) !== \"select\" || el.selectedIndex !== -1;\n}\n\n// The value of a select: the selected option's value for one, a list for several.\nfunction selectValue(el) {\n var index = el.selectedIndex;\n\n if (index < 0) {\n return null;\n }\n\n var a = [],\n ops = el.options;\n var one = el.type === \"select-one\";\n var max = one ? index + 1 : ops.length;\n\n for (var i = one ? index : 0; i < max; i++) {\n var op = ops[i];\n\n if (op.selected && !isDisabled(op)) {\n var v = op.value;\n\n if (!v) {\n // extra pain for IE...\n v =\n op.attributes && op.attributes.value && !op.attributes.value.specified\n ? op.text\n : op.value;\n }\n\n if (one) {\n return v;\n }\n\n a.push(v);\n }\n }\n\n return a;\n}\n\n/**\n * The value of a control, whether or not it is successful: a list for a multiple select, null\n * for a select with nothing selected, otherwise a string with CRLF line breaks (a lone CR or LF\n * included).\n */\nexport function valueOf(el) {\n if (tagName(el) === \"select\") {\n return selectValue(el);\n }\n\n var v = jQuery(el).val();\n var raw = el.value;\n\n // jQuery before 4.0 drops carriage returns from .val(); read them from the value itself\n if (typeof raw === \"string\" && raw.replace(rCR, \"\") === v) {\n v = raw;\n }\n\n return v.replace(rLineBreak, \"\\r\\n\");\n}\n\n/**\n * The fields as a urlencoded body sends them: a selected file as its name.\n */\n// A lone surrogate becomes U+FFFD, as in a native submission; jQuery.param would throw.\nvar loneSurrogate = /[\\uD800-\\uDBFF](?![\\uDC00-\\uDFFF])|([^\\uD800-\\uDBFF]|^)([\\uDC00-\\uDFFF])/g;\n\nexport function wellFormed(value) {\n return typeof value === \"string\"\n ? value.replace(loneSurrogate, function (match, before) {\n return (before || \"\") + \"\\uFFFD\";\n })\n : value;\n}\n\n// jQuery 3 dropped $.param's \"+\" for a space; a native submission still sends \"+\". Only a space\n// encodes as %20, since a literal % encodes as %25.\nexport function urlencode(fields, traditional) {\n return jQuery.param(urlencodedFields(fields), traditional).replace(/%20/g, \"+\");\n}\n\nexport function urlencodedFields(fields) {\n return jQuery.map(fields, function (field) {\n var value =\n field.type === \"file\" && typeof field.value !== \"string\" ? field.value.name : field.value;\n var name = wellFormed(field.name);\n value = wellFormed(value);\n\n return name === field.name && value === field.value ? field : { name: name, value: value };\n });\n}\n\n/**\n * The serialization steps. `feature` holds what the entry detected at load (fileapi).\n */\nexport function createSuccessfulControls(feature) {\n var $ = jQuery;\n\n // #386; inputs that name the form in their form attribute, other than the candidates found.\n // A form only gets the ones it owns.\n function outsideControls(formId, els, owner) {\n // hat tip @thet; the id is compared, never built into a selector\n return $(\":input[form]\")\n .filter(function () {\n return (\n this.getAttribute(\"form\") === formId &&\n (!owner || this.form === owner) &&\n $.inArray(this, els) < 0\n );\n })\n .get();\n }\n\n // A descendant of a form is a candidate unless it is a control another form owns.\n function ownedBy(els, owner) {\n return $.grep(els, function (el) {\n return typeof el.form === \"undefined\" || el.form === owner;\n });\n }\n\n /**\n * The candidate controls of a form, in order: its elements, or every descendant it owns in\n * semantic mode, then the outside controls it owns that name it.\n */\n function controlsOf(form, semantic) {\n var formId = formAttribute(form, \"id\");\n var els = formMember(form, \"elements\");\n\n if (semantic || typeof els === \"undefined\") {\n // the document is not an element; it has its own getElementsByTagName\n els = isElement(form)\n ? callFormMethod(form, \"getElementsByTagName\", \"*\")\n : form.getElementsByTagName(\"*\");\n }\n\n els = $.makeArray(els);\n\n // the subject may also be a fieldset, the document or another container\n var owner = tagName(form) === \"form\" ? form : null;\n\n if (semantic && owner) {\n els = ownedBy(els, owner);\n }\n\n // FinesseRus: in non-IE browsers outside fields are already included in form.elements.\n if (formId && (semantic || /(Edge|Trident)\\//.test(navigator.userAgent))) {\n els = els.concat(outsideControls(formId, els, owner));\n }\n\n return els;\n }\n\n // The fields of a control's value, or null when the control is not sent.\n function fieldsOf(el) {\n var n = el.name;\n // read at call time, so a page that replaces $.fieldValue changes what is sent\n var v = $.fieldValue(el, true);\n\n if (v && v.constructor === Array) {\n return $.map(v, function (value) {\n return { name: n, value: value };\n });\n }\n\n if (feature.fileapi && el.type === \"file\") {\n var files = el.files;\n\n // #180: an empty field when no file is selected\n return files.length\n ? $.map(files, function (file) {\n return { name: n, value: file, type: el.type };\n })\n : [{ name: n, value: \"\", type: el.type }];\n }\n\n if (v === null || typeof v === \"undefined\") {\n return null;\n }\n\n return [{ name: n, value: v, type: el.type, required: el.required }];\n }\n\n // The clicked image's value and coordinates.\n function imageFields(sub, input, type) {\n var n = input.name;\n var value = { name: n, value: $(input).val() };\n\n if (type) {\n value.type = type;\n }\n\n return [value, { name: n + \".x\", value: sub.x }, { name: n + \".y\", value: sub.y }];\n }\n\n // Adds one candidate control's fields, and the control when it has a value to send.\n function addCandidate(collected, form, el, semantic) {\n if (!el.name || isDisabled(el) || rUnsubmittable.test(tagName(el))) {\n return;\n }\n\n var sub = semantic && el.type === \"image\" && submitterOf(form);\n\n if (sub) {\n // handle image inputs on the fly when semantic == true\n if (sub.el === el) {\n collected.fields.push.apply(collected.fields, imageFields(sub, el, el.type));\n }\n\n return;\n }\n\n var own = fieldsOf(el);\n\n if (own) {\n collected.controls.push(el);\n collected.fields.push.apply(collected.fields, own);\n }\n }\n\n // input type=='image' are not found in elements array! handle it here\n function addClickedImage(collected, form) {\n var sub = submitterOf(form);\n var input = sub && $(sub.el)[0];\n\n if (input && input.name && !isDisabled(input) && input.type === \"image\") {\n collected.fields.push.apply(collected.fields, imageFields(sub, input));\n }\n }\n\n /**\n * The fields of a form, as formToArray returns them, and the controls they came from.\n */\n function collect(form, semantic, filtering) {\n var collected = { fields: [], controls: [] };\n\n if (!form) {\n return collected;\n }\n\n var els = controlsOf(form, semantic);\n\n if (typeof filtering === \"function\") {\n els = $.map(els, filtering);\n }\n\n for (var i = 0; i < els.length; i++) {\n addCandidate(collected, form, els[i], semantic);\n }\n\n if (!semantic) {\n addClickedImage(collected, form);\n }\n\n return collected;\n }\n\n return {\n controlsOf: controlsOf,\n fieldsOf: fieldsOf,\n collect: collect,\n };\n}\n","import jQuery from \"jquery\";\nimport { keepContext } from \"./options.js\";\n\n// The XMLHttpRequest transports: $.ajax with the encoded fields, or FormData for file uploads.\nvar $ = jQuery;\n\n// utility fn for deep serialization: [name, value] pairs, as $.param encodes them\nexport function deepSerialize(extraData, traditional) {\n var param = $.param(extraData, traditional);\n var serialized = param ? param.split(\"&\") : [];\n var len = serialized.length;\n var result = [];\n var i, part;\n\n for (i = 0; i < len; i++) {\n // #252; undo param space replacement\n serialized[i] = serialized[i].replace(/\\+/g, \" \");\n part = serialized[i].split(\"=\");\n // #278; use array instead of object storage, favoring array serializations\n result.push([decodeURIComponent(part[0]), decodeURIComponent(part[1])]);\n }\n\n return result;\n}\n\n/**\n * Posts the fields and extraData as FormData, for files with the File API.\n * XMLHttpRequest Level 2 file uploads (big hat tip to francois2metz)\n */\nexport function sendFormData(submission) {\n var options = submission.options;\n var a = submission.fields;\n\n var formdata = new FormData();\n\n for (var i = 0; i < a.length; i++) {\n formdata.append(a[i].name, a[i].value);\n }\n\n if (options.extraData) {\n var serializedData = deepSerialize(options.extraData, submission.traditional);\n\n for (i = 0; i < serializedData.length; i++) {\n formdata.append(serializedData[i][0], serializedData[i][1]);\n }\n }\n\n options.data = null;\n\n var s = $.extend(true, {}, $.ajaxSettings, options, {\n contentType: false,\n processData: false,\n cache: false,\n type: submission.method || \"POST\",\n });\n\n keepContext(s, [$.ajaxSettings, options]);\n\n if (options.uploadProgress) {\n // workaround because jqXHR does not expose upload property: wraps the xhr factory, the\n // caller's or jQuery's\n var createXhr = s.xhr;\n\n s.xhr = function () {\n var xhr = createXhr.call(this);\n\n if (xhr.upload) {\n xhr.upload.addEventListener(\n \"progress\",\n function (event) {\n var percent = 0;\n // event.position is the deprecated name, read only when loaded is missing\n var position = event.loaded !== undefined ? event.loaded : event.position;\n var total = event.total;\n\n if (event.lengthComputable) {\n percent = Math.ceil((position / total) * 100);\n }\n\n options.uploadProgress(event, position, total, percent);\n },\n false\n );\n }\n\n return xhr;\n };\n }\n\n s.data = null;\n\n var beforeSend = s.beforeSend;\n\n s.beforeSend = function (xhr, o) {\n // Send FormData() provided by user\n if (options.formData) {\n o.data = options.formData;\n } else {\n o.data = formdata;\n }\n\n // a veto (false) cancels the upload, as on the other transports\n return beforeSend ? beforeSend.call(this, xhr, o) : undefined;\n };\n\n return $.ajax(s);\n}\n\n/**\n * Sends the encoded fields with $.ajax.\n */\nexport function sendAjax(submission) {\n return $.ajax(submission.options);\n}\n","import { callFormMethod } from \"./form-members.js\";\nimport { deepSerialize } from \"./xhr-transport.js\";\nimport jQuery from \"jquery\";\nimport { submitterFields } from \"./submitter.js\";\nimport { wellFormed } from \"./successful-controls.js\";\n\n// The iframe form post: the extra fields (submitter, CSRF, data), the form attributes set while\n// posting and restored after, and the native submit.\nvar $ = jQuery;\n\n// The form attributes an iframe upload changes while it posts.\nvar uploadAttributes = [\"action\", \"target\", \"method\", \"enctype\", \"encoding\"];\n\n// Called through the prototype: an extraData key or a form field may be named hasOwnProperty.\nvar hasOwn = Object.prototype.hasOwnProperty;\n\nfunction isGet(method) {\n return /^get$/i.test(method);\n}\n\n// Resolves both URLs through anchors, as jQuery does for crossDomain, so IE's anchor quirks\n// apply to both sides of the comparison.\nfunction isSameOrigin(url) {\n var origin = document.createElement(\"a\");\n var target = document.createElement(\"a\");\n\n origin.href = window.location.href;\n target.href = url;\n // IE fills in the host of a relative URL only once the resolved href is assigned back\n target.href = target.href; // eslint-disable-line no-self-assign\n\n return origin.protocol + \"//\" + origin.host === target.protocol + \"//\" + target.host;\n}\n\n/** Adds the clicked submitter (and an image's coordinates) to s.extraData. */\nexport function addSubmitterFields(s, form) {\n // add submitting element to data if we know it\n var fields = submitterFields(form);\n\n for (var n in fields) {\n s.extraData = s.extraData || {};\n s.extraData[wellFormed(n)] = wellFormed(fields[n]);\n }\n}\n\n/** Adds the page's CSRF token to s.extraData when the form is posted to the page's origin. */\nexport function addCsrfField(s, form, method, forms) {\n // Rails CSRF hack (thanks to Yvan Barthelemy); like jquery-ujs, only for the page's origin and\n // only when the form is posted, since a get form would put the token in the url\n var csrf_token = $(\"meta[name=csrf-token]\").attr(\"content\");\n var csrf_param = $(\"meta[name=csrf-param]\").attr(\"content\");\n var posts =\n !isGet(method) &&\n (!method || /post/i.test(method) || /post/i.test(forms.property(form, \"method\")));\n\n if (csrf_param && csrf_token && posts && isSameOrigin(s.url)) {\n s.extraData = s.extraData || {};\n s.extraData[csrf_param] = csrf_token;\n }\n}\n\nfunction setFormAttribute(form, name, value) {\n callFormMethod(form, \"setAttribute\", name, value);\n}\n\n/** The raw attributes the upload changes, null when absent, to put back exactly (#380). */\nexport function saveAttributes(form) {\n var saved = {};\n\n $.each(uploadAttributes, function (i, name) {\n saved[name] = callFormMethod(form, \"hasAttribute\", name)\n ? callFormMethod(form, \"getAttribute\", name)\n : null;\n });\n\n return saved;\n}\n\n/** Puts back the attributes saveAttributes recorded, removing those that were absent. */\nexport function restoreAttributes(form, saved) {\n $.each(uploadAttributes, function (i, name) {\n if (saved[name] === null) {\n callFormMethod(form, \"removeAttribute\", name);\n } else {\n setFormAttribute(form, name, saved[name]);\n }\n });\n}\n\n/** Points the form at the frame `target` with the upload's url, method and encoding. */\nexport function setUploadAttributes(form, target, method, s, forms) {\n var mp = \"multipart/form-data\";\n\n // update form attrs in IE friendly way\n setFormAttribute(form, \"target\", target);\n if (!method || /post/i.test(method)) {\n setFormAttribute(form, \"method\", \"POST\");\n } else if (isGet(method) && !isGet(forms.property(form, \"method\"))) {\n // a form posts natively only with GET or POST; other verbs keep the form's own method\n setFormAttribute(form, \"method\", \"GET\");\n }\n setFormAttribute(form, \"action\", s.url);\n\n // ie borks in some cases when setting encoding\n if (!s.skipEncodingOverride && (!method || /post/i.test(method))) {\n setFormAttribute(form, \"encoding\", mp);\n setFormAttribute(form, \"enctype\", mp);\n }\n}\n\n/** Appends a hidden input per extraData field to the form; each input is pushed onto `added`. */\nexport function addExtraInputs(form, ownerDocument, extraData, traditional, added) {\n // Builds the input with DOM properties: a name is never parsed as HTML.\n function addHiddenInput(name, value) {\n var input = ownerDocument.createElement(\"input\");\n\n input.type = \"hidden\";\n input.name = name;\n added.push($(input).val(value).appendTo(form)[0]);\n }\n\n if (extraData) {\n for (var n in extraData) {\n if (hasOwn.call(extraData, n)) {\n // if using the $.param format that allows for multiple values with the same name\n if (\n $.isPlainObject(extraData[n]) &&\n hasOwn.call(extraData[n], \"name\") &&\n hasOwn.call(extraData[n], \"value\")\n ) {\n addHiddenInput(extraData[n].name, extraData[n].value);\n } else {\n // arrays and objects become one field per value, as $.param sends them (#597)\n var single = {};\n\n single[n] = extraData[n];\n var fields = deepSerialize(single, traditional);\n\n for (var f = 0; f < fields.length; f++) {\n addHiddenInput(fields[f][0], fields[f][1]);\n }\n }\n }\n }\n }\n}\n\n/** Submits the form natively, even when a control named submit hides the method. */\nexport function submitForm(form) {\n try {\n form.submit();\n } catch (err) {\n // just in case form has element with name/id of 'submit'\n callFormMethod(form, \"submit\");\n }\n}\n","import jQuery from \"jquery\";\nimport { log } from \"./diagnostics.js\";\n\n// The iframe response reader: turns the frame's document into the mock xhr's text, XML, status\n// and dataType, then parses it as $.ajax would (dataFilter, JSON, script).\nvar $ = jQuery;\n\n/** The frame's document, or null when the browser denies access to it. */\nexport function getDoc(frame) {\n /* it looks like contentWindow or contentDocument do not\n * carry the protocol property in ie8, when running under ssl\n * frame.document is the only valid response document, since\n * the protocol is know but not on the other two objects. strange?\n * \"Same origin policy\" http://en.wikipedia.org/wiki/Same_origin_policy\n */\n\n var doc = null;\n\n // IE8 cascading access check\n try {\n if (frame.contentWindow) {\n doc = frame.contentWindow.document;\n }\n } catch (err) {\n // IE8 access denied under ssl & missing protocol\n log(\"cannot get iframe.contentWindow document: \" + err);\n }\n\n if (doc) {\n // successful getting content\n return doc;\n }\n\n try {\n // simply checking may throw in ie8 under ssl or mismatched protocol\n doc = frame.contentDocument ? frame.contentDocument : frame.document;\n } catch (err) {\n // last attempt\n log(\"cannot get iframe.contentDocument: \" + err);\n doc = frame.document;\n }\n\n return doc;\n}\n\n/** Parses the response text or XML for the given (lowercase) dataType. */\nexport function httpData(xhr, type, s) {\n // mostly lifted from jq1.4.4\n\n var ct = xhr.getResponseHeader(\"content-type\") || \"\",\n xml = (type === \"xml\" || !type) && ct.indexOf(\"xml\") >= 0,\n data = xml ? xhr.responseXML : xhr.responseText;\n\n if (xml && data.documentElement.nodeName === \"parsererror\") {\n if ($.error) {\n $.error(\"parsererror\");\n }\n }\n if (s && s.dataFilter) {\n data = s.dataFilter(data, type);\n }\n if (typeof data === \"string\") {\n if ((type === \"json\" || !type) && ct.indexOf(\"json\") >= 0) {\n data = JSON.parse(data);\n } else if (type === \"script\") {\n $.globalEval(data);\n }\n }\n\n return data;\n}\n\n// Copies the status and statusText attributes of an element onto the mock xhr.\nfunction readStatus(xhr, el) {\n // support for XHR 'status' & 'statusText' emulation :\n xhr.status = Number(el.getAttribute(\"status\")) || xhr.status;\n xhr.statusText = el.getAttribute(\"statusText\") || xhr.statusText;\n}\n\n// Fills the mock xhr from the document itself.\nfunction readDocument(doc, xhr, s, isXml) {\n var docRoot = doc.body ? doc.body : doc.documentElement;\n\n xhr.responseText = docRoot ? docRoot.innerHTML : null;\n xhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc;\n if (isXml) {\n s.dataType = \"xml\";\n }\n xhr.getResponseHeader = function (header) {\n // the dataType in lowercase, as $.ajax reads it\n var headers = { \"content-type\": s.dataType && s.dataType.toLowerCase() };\n\n return headers[header.toLowerCase()];\n };\n if (docRoot) {\n readStatus(xhr, docRoot);\n }\n}\n\n// A response embedded in a textarea, or text wrapped in pre or body, replaces responseText.\nfunction readEmbedded(doc, xhr, dt, s) {\n var scr = /(json|script|text)/.test(dt);\n\n if (!scr && !s.textarea) {\n return;\n }\n // see if user embedded response in textarea\n var ta = doc.getElementsByTagName(\"textarea\")[0];\n\n if (ta) {\n xhr.responseText = ta.value;\n readStatus(xhr, ta);\n } else if (scr) {\n // account for browsers injecting pre around json response\n var pre = doc.getElementsByTagName(\"pre\")[0];\n var b = doc.getElementsByTagName(\"body\")[0];\n\n if (pre) {\n xhr.responseText = pre.textContent ? pre.textContent : pre.innerText;\n } else if (b) {\n xhr.responseText = b.textContent ? b.textContent : b.innerText;\n }\n }\n}\n\n/**\n * Reads and parses the response document into the mock xhr. Returns {status, data, errMsg}, or\n * null when `retry()` asks to read the document again later (Opera's untraversable DOM).\n */\nexport function readResponse(doc, xhr, s, retry) {\n var status = \"success\",\n data,\n errMsg;\n\n try {\n var isXml = /^xml$/i.test(s.dataType) || doc.XMLDocument || $.isXMLDoc(doc);\n\n log(\"isXml=\" + isXml);\n\n if (!isXml && window.opera && (doc.body === null || !doc.body.innerHTML)) {\n // in some browsers (Opera) the iframe DOM is not always traversable when\n // the onload callback fires, so we loop a bit to accommodate\n if (retry()) {\n return null;\n }\n // let this fall through because server response could be an empty document\n }\n\n readDocument(doc, xhr, s, isXml);\n\n var dt = (s.dataType || \"\").toLowerCase();\n\n readEmbedded(doc, xhr, dt, s);\n\n try {\n data = httpData(xhr, dt, s);\n } catch (err) {\n status = \"parsererror\";\n xhr.error = errMsg = err || status;\n }\n } catch (err) {\n log(\"error caught: \", err);\n status = \"error\";\n xhr.error = errMsg = err;\n }\n\n return { status: status, data: data, errMsg: errMsg };\n}\n","import jQuery from \"jquery\";\nimport { log } from \"./diagnostics.js\";\n\n// The iframe upload's lifecycle: the mock xhr and the Deferred, the global ajax events, the\n// beforeSend veto, the timeout, abort and settling.\nvar $ = jQuery;\n\n/**\n * Creates the lifecycle of one upload with the merged settings `s`. `frame.stop()` stops the\n * frame's load and `frame.release()` removes or resets the frame after the upload.\n */\nexport function createLifecycle(s, frame) {\n var g,\n timeoutHandle,\n callbackProcessed,\n deferred = $.Deferred();\n\n var xhr = {\n // mock object\n aborted: 0,\n responseText: null,\n responseXML: null,\n status: 0,\n statusText: \"n/a\",\n getAllResponseHeaders: function () {},\n getResponseHeader: function () {},\n setRequestHeader: function () {},\n abort: function (status) {\n abort(status, [xhr, \"aborted\", status]);\n },\n };\n\n // #341\n deferred.abort = function (status) {\n xhr.abort(status);\n };\n\n function done() {\n return xhr.aborted || callbackProcessed;\n }\n\n // Completes an aborted upload once and rejects the Deferred with `rejection`.\n // `textStatus` replaces the default \"timeout\"/\"aborted\" text status.\n function abort(status, rejection, textStatus) {\n var e = textStatus || (status === \"timeout\" ? \"timeout\" : \"aborted\");\n\n if (done()) {\n return;\n }\n\n log(\"aborting upload... \" + e);\n xhr.aborted = 1;\n frame.stop();\n xhr.error = e;\n if (s.error) {\n s.error.call(s.context, xhr, e, status);\n }\n deferred.reject.apply(deferred, rejection);\n\n if (g) {\n $.event.trigger(\"ajaxError\", [xhr, s, e]);\n }\n\n complete(e);\n }\n\n // The global events that end every upload, cancelled ones included.\n function endGlobalEvents() {\n if (g) {\n $.event.trigger(\"ajaxComplete\", [xhr, s]);\n }\n\n if (g && !--$.active) {\n $.event.trigger(\"ajaxStop\");\n }\n }\n\n // The steps every finished or aborted upload ends with, in $.ajax order.\n function complete(status) {\n if (s.complete) {\n s.complete.call(s.context, xhr, status);\n }\n\n endGlobalEvents();\n clearTimeout(timeoutHandle);\n\n // clean up\n setTimeout(function () {\n frame.release();\n xhr.responseXML = null;\n }, 100);\n }\n\n // A beforeSend veto ends the upload as $.ajax cancels a request: no callbacks, the global\n // events end with ajaxError \"canceled\".\n function cancel() {\n if (done()) {\n return;\n }\n\n callbackProcessed = true;\n deferred.reject();\n if (g) {\n $.event.trigger(\"ajaxError\", [xhr, s, \"canceled\"]);\n }\n endGlobalEvents();\n }\n\n // Fires the start events and beforeSend; false when the upload must not be posted.\n function start() {\n g = s.global;\n // trigger ajax global events so that activity/block indicators work like normal\n if (g && $.active++ === 0) {\n $.event.trigger(\"ajaxStart\");\n }\n\n if (s.beforeSend && s.beforeSend.call(s.context, xhr, s) === false) {\n cancel();\n\n return false;\n }\n\n if (xhr.aborted) {\n // abort() in beforeSend already completed the upload\n return false;\n }\n\n if (g) {\n $.event.trigger(\"ajaxSend\", [xhr, s]);\n }\n\n // an ajaxSend handler may abort too\n return !xhr.aborted;\n }\n\n // Resolves the upload; returns {error} when the success callback threw.\n function succeed(data) {\n var failure;\n\n try {\n s.success.call(s.context, data, \"success\", xhr);\n } catch (err) {\n failure = { error: err };\n }\n\n deferred.resolve(xhr.responseText, \"success\", xhr);\n\n if (g) {\n $.event.trigger(\"ajaxSuccess\", [xhr, s, data]);\n }\n\n return failure;\n }\n\n // Settles the upload with the response reader's {status, data, errMsg}.\n function settle(result) {\n var status = result.status,\n errMsg = result.errMsg;\n\n if (xhr.aborted) {\n // abort() completed the upload while its response was processed\n log(\"upload aborted\");\n\n return;\n }\n\n // an emulated HTTP error status wins with the statusText, as in $.ajax; a parse error is\n // kept otherwise\n if (xhr.status && !((xhr.status >= 200 && xhr.status < 300) || xhr.status === 304)) {\n if (status === \"parsererror\") {\n errMsg = undefined;\n }\n status = \"error\";\n }\n\n callbackProcessed = true;\n\n // ordering of these callbacks/triggers is odd, but that's how $.ajax does it\n if (status === \"success\") {\n var failure = succeed(result.data);\n\n complete(status);\n if (failure) {\n // the upload is settled; the success callback's exception still reaches the console\n throw failure.error;\n }\n\n return;\n }\n\n if (typeof errMsg === \"undefined\") {\n errMsg = xhr.statusText;\n }\n if (s.error) {\n s.error.call(s.context, xhr, status, errMsg);\n }\n deferred.reject(xhr, status, errMsg);\n if (g) {\n $.event.trigger(\"ajaxError\", [xhr, s, errMsg]);\n }\n\n complete(status);\n }\n\n return {\n xhr: xhr,\n deferred: deferred,\n start: start,\n done: done,\n abort: abort,\n settle: settle,\n // Settles an upload that failed with an exception (ignored once aborted).\n fail: function (err) {\n settle({ status: \"error\", errMsg: err });\n },\n // Runs `onTimeout` after s.timeout, when set.\n startTimer: function (onTimeout) {\n if (s.timeout) {\n timeoutHandle = setTimeout(onTimeout, s.timeout);\n }\n },\n stopTimer: function () {\n clearTimeout(timeoutHandle);\n timeoutHandle = undefined;\n },\n };\n}\n","import {\n addCsrfField,\n addExtraInputs,\n addSubmitterFields,\n restoreAttributes,\n saveAttributes,\n setUploadAttributes,\n submitForm,\n} from \"./iframe-post.js\";\nimport { closestByTag, formMember } from \"./form-members.js\";\nimport { deprecate, log } from \"./diagnostics.js\";\nimport { getDoc, readResponse } from \"./iframe-response.js\";\nimport { createLifecycle } from \"./iframe-lifecycle.js\";\nimport jQuery from \"jquery\";\nimport { keepContext } from \"./options.js\";\n\n// The iframe transport: posts the form itself into a hidden frame and reads the response from it,\n// for file uploads without the File API or when the iframe option asks for it.\nvar $ = jQuery;\n\n/**\n * The iframe send step. `hasProp` is what the entry detected at load; `forms.property` reads a\n * form property as attr2 does.\n */\nexport function createIframeTransport(hasProp, forms) {\n var CLIENT_TIMEOUT_ABORT = 1;\n var SERVER_ABORT = 2;\n // tells apart the frames of uploads that start in the same millisecond\n var frameCount = 0;\n\n // ensure that every serialized input is still enabled\n function enableControls(elements) {\n for (var i = 0; i < elements.length; i++) {\n var el = $(elements[i]);\n\n if (hasProp) {\n el.prop(\"disabled\", false);\n } else {\n el.removeAttr(\"disabled\");\n }\n }\n }\n\n // Names the frame's window, when the page may: a cross-origin or sandboxed frame refuses.\n function nameWindow(frame, name) {\n try {\n if (frame.contentWindow) {\n frame.contentWindow.name = name;\n }\n } catch (ignore) {}\n }\n\n // The frame the form posts into: the iframeTarget, named `id` when it has no name, or a new\n // hidden frame named `id`. Returns the frame and the name the form targets.\n function createFrame(s, id, ownerDocument) {\n var $io, n;\n\n if (s.iframeTarget) {\n $io = $(s.iframeTarget, ownerDocument);\n n = $io.attr(\"name\");\n if (!n) {\n $io.attr(\"name\", id);\n // a frame already in the page keeps the browsing context name it was inserted with\n $io.each(function () {\n nameWindow(this, id);\n });\n } else {\n id = n;\n }\n } else {\n var io = ownerDocument.createElement(\"iframe\");\n\n io.setAttribute(\"name\", id);\n io.setAttribute(\"src\", s.iframeSrc);\n $io = $(io);\n $io.css({ position: \"absolute\", top: \"-1000px\", left: \"-1000px\" });\n }\n\n return { $io: $io, id: id };\n }\n\n // The frame hooks the lifecycle calls: stop a load in progress, and release after the upload.\n function frameHooks(s, $io) {\n return {\n stop: function () {\n try {\n // #214, #257\n if ($io[0].contentWindow.document.execCommand) {\n $io[0].contentWindow.document.execCommand(\"Stop\");\n }\n } catch (ignore) {}\n\n $io.attr(\"src\", s.iframeSrc); // abort op in progress\n },\n release: function () {\n if (!s.iframeTarget) {\n $io.remove();\n } else {\n // adding else to clean up existing iframe response.\n $io.attr(\"src\", s.iframeSrc);\n }\n },\n };\n }\n\n function listen(io, cb) {\n if (io.attachEvent) {\n io.attachEvent(\"onload\", cb);\n } else {\n io.addEventListener(\"load\", cb, false);\n }\n }\n\n function unlisten(io, cb) {\n if (io.detachEvent) {\n io.detachEvent(\"onload\", cb);\n } else {\n io.removeEventListener(\"load\", cb, false);\n }\n }\n\n // private function for handling file uploads (hat tip to YAHOO!)\n function fileUploadIframe(submission) {\n var form = submission.form,\n method = submission.method;\n\n var s = keepContext($.extend(true, {}, $.ajaxSettings, submission.options), [\n $.ajaxSettings,\n submission.options,\n ]);\n\n s.context = s.context || s;\n var ownerDocument = formMember(form, \"ownerDocument\");\n var $body = $(closestByTag(form, [\"body\"]));\n var frame = createFrame(s, \"jqFormIO\" + new Date().getTime() + frameCount++, ownerDocument);\n var $io = frame.$io,\n io = $io[0];\n var life = createLifecycle(s, frameHooks(s, $io));\n var domCheckCount = 50;\n\n if (!life.start()) {\n return life.deferred;\n }\n\n addSubmitterFields(s, form);\n addCsrfField(s, form, method, forms);\n\n // look for server aborts\n function checkState() {\n try {\n var state = getDoc(io).readyState;\n\n log(\"state = \" + state);\n if (state && state.toLowerCase() === \"uninitialized\") {\n setTimeout(checkState, 50);\n }\n } catch (e) {\n log(\"Server abort: \", e, \" (\", e.name, \")\");\n cb(SERVER_ABORT);\n life.stopTimer();\n }\n }\n\n // take a breath so that pending repaints get some cpu time before the upload starts\n function doSubmit() {\n var saved = saveAttributes(form);\n\n setUploadAttributes(form, frame.id, method, s, forms);\n\n // support timout\n life.startTimer(function () {\n cb(CLIENT_TIMEOUT_ABORT);\n });\n\n // add \"extra\" data to form if provided in options\n var extraInputs = [];\n\n try {\n addExtraInputs(form, ownerDocument, s.extraData, submission.traditional, extraInputs);\n\n if (!s.iframeTarget) {\n // add iframe to doc and submit the form\n $io.appendTo($body);\n }\n\n // A connected form posting into a frame outside the document opens a new window.\n var root = ownerDocument.documentElement;\n\n if (io && $.contains(root, form) && !$.contains(root, io)) {\n var notInDocument = \"jquery.form: the upload frame is not in the document\";\n\n life.abort(notInDocument, [life.xhr, \"error\", notInDocument], \"error\");\n\n return;\n }\n\n listen(io, cb);\n setTimeout(checkState, 15);\n submitForm(form);\n } finally {\n // reset attrs and remove \"extra\" input elements\n restoreAttributes(form, saved);\n $(extraInputs).remove();\n }\n }\n\n // Reads the next document by Opera's rules: false once the retries are used up.\n function retry() {\n if (--domCheckCount) {\n log(\"requeing onLoad callback, DOM not available\");\n setTimeout(cb, 250);\n\n return true;\n }\n\n return false;\n }\n\n function cb(e) {\n if (life.done()) {\n return;\n }\n\n var doc = getDoc(io);\n\n if (!doc) {\n log(\"cannot access response document\");\n e = SERVER_ABORT;\n }\n if (e === CLIENT_TIMEOUT_ABORT) {\n life.abort(\"timeout\", [life.xhr, \"timeout\"]);\n\n return;\n }\n if (e === SERVER_ABORT) {\n life.abort(\"server abort\", [life.xhr, \"error\", \"server abort\"]);\n\n return;\n }\n\n if (doc.location.href === s.iframeSrc) {\n // response not received yet\n return;\n }\n\n unlisten(io, cb);\n\n var result = readResponse(doc, life.xhr, s, retry);\n\n if (result) {\n life.settle(result);\n }\n }\n\n // An exception while posting settles the upload with \"error\" and the exception.\n function post() {\n if (life.done()) {\n // aborted before the delayed post\n return;\n }\n\n try {\n doSubmit();\n } catch (err) {\n log(\"upload failed: \", err);\n life.fail(err);\n }\n }\n\n if (s.forceSync) {\n post();\n } else {\n setTimeout(post, 10); // this lets dom updates render\n }\n\n return life.deferred;\n }\n\n return function sendIframe(submission) {\n var jqxhr;\n\n // now, while the controls are still listed: ajaxSubmit clears the list when it returns,\n // before a closeKeepAlive request completes\n enableControls(submission.controls);\n\n // hack to fix Safari hang (thanks to Tim Molendijk for this)\n // see: http://groups.google.com/group/jquery-dev/browse_thread/thread/36395b7ab510dd5d\n if (submission.options.closeKeepAlive) {\n deprecate(\"closeKeepAlive\", \"closeKeepAlive works around a Safari 3/4 bug and is deprecated\");\n $.get(submission.options.closeKeepAlive, function () {\n jqxhr = fileUploadIframe(submission);\n });\n } else {\n jqxhr = fileUploadIframe(submission);\n }\n\n return jqxhr;\n };\n}\n","import { deprecate, log } from \"./diagnostics.js\";\nimport { assertRealParent } from \"./form-members.js\";\nimport jQuery from \"jquery\";\nimport { keepContext } from \"./options.js\";\nimport { urlencode } from \"./successful-controls.js\";\n\n// A Submission is one ajaxSubmit call once its vetoes have passed:\n// { form, $form, fields, controls, options, method, traditional }. `options` is the object the\n// callbacks and events receive; later steps change it in place.\n\n/**\n * The submission steps. `feature` holds what the entry detected at load (fileapi, formdata), and\n * `forms` reads form attributes and attr2-style properties (attribute, property), and\n * `serialization` collects the form's fields and controls.\n */\nexport function createSubmission(feature, forms, serialization) {\n var $ = jQuery;\n\n function refuse(message) {\n log(message);\n\n return null;\n }\n\n // The options merged over the form's action, the method, and the ajax defaults.\n function withDefaults(form, options, method) {\n var action = options.url || forms.property(form, \"action\");\n var url = typeof action === \"string\" ? action.trim() : \"\";\n\n // clean url (don't include hash value); an action that is only a fragment means this page\n url = url.split(\"#\")[0] || window.location.href.split(\"#\")[0];\n // IE requires javascript:false in https, but this breaks chrome >83 and goes against spec.\n // Instead of using javascript:false always, let's only apply it for IE.\n var isMsie = /(MSIE|Trident)/.test(navigator.userAgent || \"\");\n var iframeSrc = isMsie && /^https/i.test(document.URL) ? \"javascript:false\" : \"about:blank\"; // eslint-disable-line no-script-url\n\n var merged = $.extend(\n true,\n {\n url: url,\n success: $.ajaxSettings.success,\n type: method || $.ajaxSettings.type,\n iframeSrc: iframeSrc,\n },\n options\n );\n\n return keepContext(merged, [options]);\n }\n\n /**\n * The one method every transport sends, read after the hooks: `method` wins over `type`, and\n * `type` is set to it. Undefined when only the ajax default applies, so each transport keeps\n * its own default.\n */\n function resolveMethod(options, defaultType) {\n var resolved = options.method || options.type;\n\n options.type = resolved;\n\n return resolved === defaultType && !options.method ? undefined : resolved;\n }\n\n // The data option, kept as extraData and encoded, or undefined without one.\n function extraQuery(fields, options, traditional) {\n if (!options.data) {\n return undefined;\n }\n\n var optionsData = typeof options.data === \"function\" ? options.data(fields) : options.data;\n\n if (typeof optionsData === \"string\") {\n if (options.requestFormat === \"json\") {\n throw new Error(\n 'jquery.form: requestFormat \"json\" needs object data; a string data option is a query string'\n );\n }\n\n // a query string: sent as-is when urlencoded, as its own fields otherwise\n options.extraData = queryPairs(optionsData);\n\n return optionsData;\n }\n\n options.extraData = optionsData;\n\n return $.param(optionsData, traditional);\n }\n\n // Sets a key as an own data property, so a name like __proto__ is an ordinary key.\n function defineKey(object, key, value) {\n Object.defineProperty(object, key, {\n value: value,\n enumerable: true,\n writable: true,\n configurable: true,\n });\n }\n\n /**\n * requestFormat \"json\" (#545): the fields as an object (a repeated name gives an array), merged\n * with object data, sent as a JSON body. Based on the idea in PR #557 by zhangciwu.\n */\n function jsonBody(options, fields) {\n if (/^get$/i.test(options.type)) {\n throw new Error('jquery.form: requestFormat \"json\" needs a method with a body, such as POST');\n }\n\n var body = {};\n var own = Object.prototype.hasOwnProperty;\n\n for (var i = 0; i < fields.length; i++) {\n var name = fields[i].name;\n\n if (!own.call(body, name)) {\n defineKey(body, name, fields[i].value);\n } else if (Array.isArray(body[name])) {\n body[name].push(fields[i].value);\n } else {\n defineKey(body, name, [body[name], fields[i].value]);\n }\n }\n\n var extra = options.extraData;\n\n for (var key in extra) {\n if (own.call(extra, key)) {\n defineKey(body, key, extra[key]);\n }\n }\n\n options.data = JSON.stringify(body);\n options.contentType = \"application/json; charset=UTF-8\";\n }\n\n // The fields of a query string, as the { name, value } list $.param takes.\n function queryPairs(query) {\n var pairs = [];\n var parts = query.split(\"&\");\n\n for (var i = 0; i < parts.length; i++) {\n if (parts[i]) {\n var at = parts[i].indexOf(\"=\");\n var name = at < 0 ? parts[i] : parts[i].slice(0, at);\n var value = at < 0 ? \"\" : parts[i].slice(at + 1);\n\n pairs.push({ name: decodeQuery(name), value: decodeQuery(value) });\n }\n }\n\n return pairs;\n }\n\n function decodeQuery(text) {\n return decodeURIComponent(text.replace(/\\+/g, \" \"));\n }\n\n // Puts the encoded fields in the url for a get, and in the data otherwise.\n function encode(options, q, qx) {\n if (qx) {\n q = q ? q + \"&\" + qx : qx;\n }\n\n if (options.type.toUpperCase() === \"GET\") {\n // the query goes before any fragment in the url option\n var hashAt = options.url.indexOf(\"#\");\n var base = hashAt < 0 ? options.url : options.url.slice(0, hashAt);\n\n options.url =\n base + (base.indexOf(\"?\") >= 0 ? \"&\" : \"?\") + q + options.url.slice(base.length);\n options.data = null; // data is null for 'get'\n } else {\n options.data = q; // data is the query string for 'post'\n }\n }\n\n // A callback option as a list: an array as given, one function, or none.\n function callbackList(callback) {\n if (Array.isArray(callback)) {\n return callback;\n }\n\n return callback ? [callback] : [];\n }\n\n // Calls each callback in order with the same this and arguments.\n function callEach(callbacks, context, args) {\n for (var i = 0; i < callbacks.length; i++) {\n callbacks[i].apply(context, args);\n }\n }\n\n /**\n * Resolves the options, serializes the form, and runs the vetoes: the Submission, or null when\n * an event or callback stopped it.\n */\n function prepare($set, options) {\n $set.each(function () {\n assertRealParent(this);\n });\n\n var form = $set[0];\n var method = options.method || options.type || forms.property(form, \"method\");\n\n options = withDefaults(form, options, method);\n\n // the ajax default type, when neither the caller nor the form gave a method\n var defaultType = method ? undefined : options.type;\n\n // hook for manipulating the form data before it is extracted;\n // convenient for use with rich editors like tinyMCE or FCKEditor\n var veto = {};\n\n $set.trigger(\"form-pre-serialize\", [$set, options, veto]);\n if (veto.veto) {\n return refuse(\"ajaxSubmit: submit vetoed via form-pre-serialize trigger\");\n }\n\n // provide opportunity to alter form data before it is serialized\n if (options.beforeSerialize && options.beforeSerialize($set, options) === false) {\n return refuse(\"ajaxSubmit: submit aborted via beforeSerialize callback\");\n }\n\n var traditional = options.traditional;\n\n if (typeof traditional === \"undefined\") {\n traditional = $.ajaxSettings.traditional;\n }\n\n var collected = serialization.collect($set[0], options.semantic, options.filtering);\n var fields = collected.fields;\n var controls = collected.controls;\n var qx = extraQuery(fields, options, traditional);\n\n // give pre-submit callback an opportunity to abort the submit\n if (options.beforeSubmit && options.beforeSubmit(fields, $set, options) === false) {\n return refuse(\"ajaxSubmit: submit aborted via beforeSubmit callback\");\n }\n\n // fire vetoable 'validate' event\n $set.trigger(\"form-submit-validate\", [fields, $set, options, veto]);\n if (veto.veto) {\n return refuse(\"ajaxSubmit: submit vetoed via form-submit-validate trigger\");\n }\n\n method = resolveMethod(options, defaultType);\n\n if (options.requestFormat === \"json\") {\n jsonBody(options, fields);\n } else {\n encode(options, urlencode(fields, traditional), qx);\n }\n\n return {\n form: form,\n $form: $set,\n fields: fields,\n controls: controls,\n options: options,\n method: method,\n traditional: traditional,\n };\n }\n\n /**\n * Wraps success, error and complete (a function or an array of them, as $.ajax takes) so each\n * also receives the form, and adds the resetForm,\n * clearForm and target steps before the success callbacks.\n */\n function deliver(submission) {\n var $set = submission.$form;\n var options = submission.options;\n var callbacks = [];\n\n if (options.resetForm) {\n callbacks.push(function () {\n $set.resetForm();\n });\n }\n\n if (options.clearForm) {\n callbacks.push(function () {\n $set.clearForm(options.includeHidden);\n });\n }\n\n // perform a load on the target only if dataType is not provided\n if (!options.dataType && options.target) {\n var successes = callbackList(options.success);\n\n callbacks.push(function (data, textStatus, jqXHR) {\n var successArguments = arguments,\n fn = options.replaceTarget ? \"replaceWith\" : \"html\",\n $target = $(options.target);\n\n // Only a string response is inserted. jQuery has already parsed a JSON or XML response,\n // and inserting it would parse each of its strings as HTML.\n if (typeof data === \"string\") {\n $target[fn](data);\n } else {\n log(\"target: the response was parsed by jQuery, so it is not inserted\");\n }\n\n if (!$target.length) {\n // nothing to fill: success still runs once, with the normal context\n callEach(successes, this, successArguments);\n }\n\n $target.each(function () {\n callEach(successes, this, successArguments);\n });\n });\n } else {\n $.merge(callbacks, callbackList(options.success));\n }\n\n options.success = function (data, status, xhr) {\n // jQuery 1.4+ passes xhr as 3rd arg\n var context = options.context || this; // jQuery 1.4+ supports scope context\n\n for (var i = 0, max = callbacks.length; i < max; i++) {\n callbacks[i].apply(context, [data, status, xhr || $set, $set]);\n }\n };\n\n if (options.error) {\n var errors = callbackList(options.error);\n\n options.error = function (xhr, status, error) {\n callEach(errors, options.context || this, [xhr, status, error, $set]);\n };\n }\n\n if (options.complete) {\n var completes = callbackList(options.complete);\n\n options.complete = function (xhr, status) {\n callEach(completes, options.context || this, [xhr, status, $set]);\n };\n }\n }\n\n /**\n * The transport for a submission: \"iframe\" for files without the File API or when forced,\n * \"formdata\" for files with it, \"ajax\" otherwise.\n */\n function chooseTransport(submission) {\n var $set = submission.$form;\n var options = submission.options;\n\n // [value] (issue #113), also see comment:\n // https://github.com/malsup/form/commit/588306aedba1de01388032d5f42a60159eea9228#commitcomment-2180219\n // and the file inputs outside the form that belong to it through their form attribute\n var fileInputs = $(\"input[type=file]:enabled\", $set)\n .add($(submission.controls).filter(\"input[type=file]\"))\n .filter(function () {\n return $(this).val() !== \"\";\n });\n var hasFileInputs = fileInputs.length > 0;\n // compared as the browser does: ASCII case-insensitive, without surrounding whitespace\n var mp = /^[\\t\\n\\f\\r ]*multipart\\/form-data[\\t\\n\\f\\r ]*$/i;\n var multipart =\n mp.test(forms.attribute($set[0], \"enctype\")) || mp.test(forms.attribute($set[0], \"encoding\"));\n var fileAPI = feature.fileapi && feature.formdata;\n\n log(\"fileAPI :\" + fileAPI);\n\n var shouldUseFrame = (hasFileInputs || multipart) && !fileAPI;\n\n var transport = (hasFileInputs || multipart) && fileAPI ? \"formdata\" : \"ajax\";\n\n // options.iframe allows user to force iframe mode\n // 06-NOV-09: now defaulting to iframe mode if file input is detected\n if (options.iframe !== false && (options.iframe || shouldUseFrame)) {\n transport = \"iframe\";\n }\n\n if (transport === \"iframe\" && !options.iframe) {\n deprecate(\n \"iframe\",\n \"choosing the iframe transport automatically without FormData is deprecated, set iframe: true\"\n );\n }\n\n if (transport !== \"ajax\" && options.requestFormat === \"json\") {\n throw new Error(\n 'jquery.form: requestFormat \"json\" cannot send files or use the iframe transport'\n );\n }\n\n return transport;\n }\n\n return { prepare: prepare, deliver: deliver, chooseTransport: chooseTransport };\n}\n","/*!\n * jQuery Form Plugin\n * version: 4.5.0\n * Requires jQuery v1.7.2 or later\n * Project repository: https://github.com/jquery-form/form\n\n * Copyright 2017 Kevin Morris\n * Copyright 2006 M. Alsup\n\n * Dual licensed under the LGPL-2.1+ or MIT licenses\n * https://github.com/jquery-form/form#license\n\n * This library is free software; you can redistribute it and/or\n * modify it under the terms of the GNU Lesser General Public\n * License as published by the Free Software Foundation; either\n * version 2.1 of the License, or (at your option) any later version.\n * This library is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n */\nimport { ajaxForm, ajaxFormUnbind } from \"./ajax-form.js\";\nimport { callFormMethod, tagName } from \"./form-members.js\";\nimport {\n createSuccessfulControls,\n isSuccessful,\n urlencode,\n valueOf,\n} from \"./successful-controls.js\";\nimport { deprecate, deprecateOldJQuery, log } from \"./diagnostics.js\";\nimport { sendAjax, sendFormData } from \"./xhr-transport.js\";\nimport { createIframeTransport } from \"./iframe-transport.js\";\nimport { createSubmission } from \"./submission.js\";\nimport { formAttribute } from \"./form-attributes.js\";\nimport jQuery from \"jquery\";\nimport { submitOptions } from \"./options.js\";\nimport { submitterElement } from \"./submitter.js\";\n\n(function ($) {\n \"use strict\";\n\n /*\n\t\tUsage Note:\n\t\t-----------\n\t\tDo not use both ajaxSubmit and ajaxForm on the same form. These\n\t\tfunctions are mutually exclusive. Use ajaxSubmit if you want\n\t\tto bind your own submit handler to the form. For example,\n\n\t\t$(document).ready(function() {\n\t\t\t$('#myForm').on('submit', function(e) {\n\t\t\t\te.preventDefault(); // <-- important\n\t\t\t\t$(this).ajaxSubmit({\n\t\t\t\t\ttarget: '#output'\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\n\t\tUse ajaxForm when you want the plugin to manage all the event binding\n\t\tfor you. For example,\n\n\t\t$(document).ready(function() {\n\t\t\t$('#myForm').ajaxForm({\n\t\t\t\ttarget: '#output'\n\t\t\t});\n\t\t});\n\n\t\tYou can also use ajaxForm with delegation (requires jQuery v1.7+), so the\n\t\tform does not have to exist when you invoke ajaxForm:\n\n\t\t$('#myForm').ajaxForm({\n\t\t\tdelegation: true,\n\t\t\ttarget: '#output'\n\t\t});\n\n\t\tWhen using ajaxForm, the ajaxSubmit function will be invoked for you\n\t\tat the appropriate time.\n\t*/\n\n /**\n * Feature detection\n */\n var feature = {};\n\n feature.fileapi = $('').get(0).files !== undefined;\n feature.formdata = typeof window.FormData !== \"undefined\";\n\n var hasProp = !!$.fn.prop;\n // What attr2 returns for a form: the property when it is a string, otherwise the attribute. The\n // property is read plainly on purpose: a control named like it shadows it, and then the raw\n // attribute is used.\n function formProperty(form, name) {\n var value = hasProp ? form[name] : undefined;\n\n return typeof value === \"string\" ? value : formAttribute(form, name);\n }\n\n var forms = { attribute: formAttribute, property: formProperty };\n var serialization = createSuccessfulControls(feature);\n var steps = createSubmission(feature, forms, serialization);\n var transports = {\n iframe: createIframeTransport(hasProp, forms),\n formdata: sendFormData,\n ajax: sendAjax,\n };\n\n // attr2 uses prop when it can but checks the return type for\n // an expected string. This accounts for the case where a form\n // contains inputs with names like \"action\" or \"method\"; in those\n // cases \"prop\" returns the element\n $.fn.attr2 = function () {\n deprecate(\"attr2\", \"attr2 is deprecated, use .prop() or .attr()\");\n\n if (!hasProp) {\n return this.attr.apply(this, arguments);\n }\n\n var val = this.prop.apply(this, arguments);\n\n if ((val && val.jquery) || typeof val === \"string\") {\n return val;\n }\n\n return this.attr.apply(this, arguments);\n };\n\n /**\n * ajaxSubmit() provides a mechanism for immediately submitting\n * an HTML form using AJAX.\n *\n * @param\t{object|string}\toptions\t\tjquery.form.js parameters or custom url for submission\n * @param\t{object}\t\tdata\t\textraData\n * @param\t{string}\t\tdataType\tajax dataType\n * @param\t{function}\t\tonSuccess\tajax success callback function\n */\n $.fn.ajaxSubmit = function (options, data, dataType, onSuccess) {\n deprecateOldJQuery($.fn.jquery);\n\n // fast fail if nothing selected (http://dev.jquery.com/ticket/2752)\n if (!this.length) {\n log(\"ajaxSubmit: skipping submit process - no element selected\");\n\n return this;\n }\n\n // #541: jQuery's slim build has no $.ajax\n if (!$.ajax) {\n throw new Error(\n \"jquery.form: ajaxSubmit needs the full jQuery build; this jQuery has no $.ajax\"\n );\n }\n\n var submission = steps.prepare(this, submitOptions(options, data, dataType, onSuccess));\n\n if (!submission) {\n return this;\n }\n\n steps.deliver(submission);\n\n var jqxhr = transports[steps.chooseTransport(submission)](submission);\n\n this.removeData(\"jqxhr\").data(\"jqxhr\", jqxhr);\n\n // clear element array\n for (var k = 0; k < submission.controls.length; k++) {\n submission.controls[k] = null;\n }\n\n // fire 'notify' event\n this.trigger(\"form-submit-notify\", [this, submission.options]);\n\n return this;\n };\n\n $.fn.ajaxForm = ajaxForm;\n $.fn.ajaxFormUnbind = ajaxFormUnbind;\n\n /**\n * formToArray() gathers form element data into an array of objects that can\n * be passed to any of the following ajax functions: $.get, $.post, or load.\n * Each object in the array has both a 'name' and 'value' property. An example of\n * an array for a simple login form might be:\n *\n * [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ]\n *\n * It is this array that is passed to pre-submit callback functions provided to the\n * ajaxSubmit() and ajaxForm() methods.\n */\n $.fn.formToArray = function (semantic, elements, filtering) {\n var collected = serialization.collect(this[0], semantic, filtering);\n\n if (elements) {\n elements.push.apply(elements, collected.controls);\n }\n\n return collected.fields;\n };\n\n /**\n * Serializes form data into a 'submittable' string. This method will return a string\n * in the format: name1=value1&name2=value2\n */\n $.fn.formSerialize = function (semantic) {\n // hand off to jQuery.param for proper encoding\n return urlencode(this.formToArray(semantic));\n };\n\n /**\n * Serializes all field elements in the jQuery object into a query string.\n * This method will return a string in the format: name1=value1&name2=value2\n */\n $.fn.fieldSerialize = function (successful) {\n var a = [];\n\n this.each(function () {\n var n = this.name;\n\n // a form is not a field, though it may have a name\n if (!n || tagName(this) === \"form\") {\n return;\n }\n\n var v = $.fieldValue(this, successful);\n\n if (v && v.constructor === Array) {\n for (var i = 0, max = v.length; i < max; i++) {\n a.push({ name: n, value: v[i] });\n }\n } else if (v !== null && typeof v !== \"undefined\") {\n a.push({ name: this.name, value: v });\n }\n });\n\n // hand off to jQuery.param for proper encoding\n return urlencode(a);\n };\n\n /**\n * Returns the value(s) of the element in the matched set. For example, consider the following form:\n *\n *\t
\n *\t\t\n *\t\t\n *\t\t\n *\t\t\n *\t\t\n *\t\t\n *\t
\n *\n *\tvar v = $('input[type=text]').fieldValue();\n *\t// if no values are entered into the text inputs\n *\tv === ['','']\n *\t// if values entered into the text inputs are 'foo' and 'bar'\n *\tv === ['foo','bar']\n *\n *\tvar v = $('input[type=checkbox]').fieldValue();\n *\t// if neither checkbox is checked\n *\tv === undefined\n *\t// if both checkboxes are checked\n *\tv === ['B1', 'B2']\n *\n *\tvar v = $('input[type=radio]').fieldValue();\n *\t// if neither radio is checked\n *\tv === undefined\n *\t// if first radio is checked\n *\tv === ['C1']\n *\n * The successful argument controls whether or not the field element must be 'successful'\n * (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls).\n * The default value of the successful argument is true. If this value is false the value(s)\n * for each element is returned.\n *\n * Note: This method *always* returns an array. If no valid value can be determined the\n *\tarray will be empty, otherwise it will contain one or more values.\n */\n $.fn.fieldValue = function (successful) {\n for (var val = [], i = 0, max = this.length; i < max; i++) {\n var el = this[i];\n var v = $.fieldValue(el, successful);\n\n if (v === null || typeof v === \"undefined\" || (v.constructor === Array && !v.length)) {\n continue;\n }\n\n if (v.constructor === Array) {\n $.merge(val, v);\n } else {\n val.push(v);\n }\n }\n\n return val;\n };\n\n /**\n * Returns the value of the field element.\n */\n $.fieldValue = function (el, successful) {\n var required = typeof successful === \"undefined\" || successful;\n\n if (required && !isSuccessful(el, submitterElement(el.form))) {\n return null;\n }\n\n return valueOf(el);\n };\n\n /**\n * Clears the form data. Takes the following actions on the form's input fields:\n * - input text fields will have their 'value' property set to the empty string\n * - select elements will have their 'selectedIndex' property set to -1\n * - checkbox and radio inputs will have their 'checked' property set to false\n * - inputs of type submit, button, reset, and hidden will *not* be effected\n * - button elements will *not* be effected\n */\n $.fn.clearForm = function (includeHidden) {\n return this.each(function () {\n $(\"input,select,textarea\", this).clearFields(includeHidden);\n });\n };\n\n /**\n * Clears the selected form elements.\n */\n $.fn.clearInputs = function (includeHidden) {\n deprecate(\"clearInputs\", \"clearInputs is deprecated, use clearFields\");\n\n return this.clearFields(includeHidden);\n };\n\n $.fn.clearFields = function (includeHidden) {\n var re =\n /^(?:color|date|datetime|datetime-local|email|month|number|password|range|search|tel|text|time|url|week)$/i; // 'hidden' is not in this list\n\n return this.each(function () {\n var t = this.type,\n tag = tagName(this);\n\n if (re.test(t) || tag === \"textarea\") {\n this.value = \"\";\n } else if (t === \"checkbox\" || t === \"radio\") {\n this.checked = false;\n } else if (tag === \"select\") {\n this.selectedIndex = -1;\n } else if (t === \"file\") {\n if (/MSIE/.test(navigator.userAgent)) {\n $(this).replaceWith($(this).clone(true));\n } else {\n $(this).val(\"\");\n }\n } else if (includeHidden) {\n // includeHidden can be the value true, or it can be a selector string\n // indicating a special test; for example:\n // $('#myForm').clearForm('.special:hidden')\n // the above would clean hidden inputs that have the class of 'special'\n if (\n (includeHidden === true && /hidden/.test(t)) ||\n (typeof includeHidden === \"string\" && $(this).is(includeHidden))\n ) {\n this.value = \"\";\n }\n }\n });\n };\n\n /**\n * Resets the form data or individual elements. Takes the following actions\n * on the selected tags:\n * - all fields within form elements will be reset to their original value\n * - input / textarea / select fields will be reset to their original value\n * - option / optgroup fields (for multi-selects) will defaulted individually\n * - non-multiple options will find the right select to default\n * - label elements will be searched against its 'for' attribute\n * - all others will be searched for appropriate children to default\n */\n $.fn.resetForm = function () {\n return this.each(function () {\n var el = $(this);\n var tag = tagName(this);\n\n switch (tag) {\n case \"input\":\n this.checked = this.defaultChecked;\n\n // as the native reset: types whose value is the value attribute keep it\n if (this.type === \"file\") {\n // a file input cannot take its value attribute; the native reset empties it\n this.value = \"\";\n } else if (!/^(?:checkbox|radio|hidden|submit|reset|button|image)$/.test(this.type)) {\n this.value = this.defaultValue;\n }\n\n return true;\n\n case \"textarea\":\n this.value = this.defaultValue;\n\n return true;\n\n case \"option\":\n case \"optgroup\":\n var select = el.parents(\"select\");\n\n if (select.length && select[0].multiple) {\n if (tag === \"option\") {\n this.selected = this.defaultSelected;\n } else {\n el.find(\"option\").resetForm();\n }\n } else {\n select.resetForm();\n }\n\n return true;\n\n case \"select\":\n // in order, as the native reset: of several default options, a single select keeps the last\n el.find(\"option\").each(function () {\n this.selected = this.defaultSelected;\n });\n\n return true;\n\n case \"label\":\n // The control whose id the for attribute names, and the controls inside the label. The\n // filter keeps a for that names an ancestor from resetting the label again.\n var forEl = this.htmlFor && this.ownerDocument.getElementById(this.htmlFor);\n\n el.find(\"input,select,textarea\").add(forEl).filter(\"input,select,textarea\").resetForm();\n\n return true;\n\n case \"form\":\n // through the prototype: a control named reset shadows the method\n callFormMethod(this, \"reset\");\n\n return true;\n\n default:\n el.find(\"form,input,label,select,textarea\").resetForm();\n\n return true;\n }\n });\n };\n\n /**\n * Enables or disables any matching elements.\n */\n $.fn.enable = function (b) {\n if (typeof b === \"undefined\") {\n b = true;\n }\n\n return this.each(function () {\n this.disabled = !b;\n });\n };\n\n /**\n * Checks/unchecks any matching checkboxes or radio buttons and\n * selects/deselects and matching option elements.\n */\n $.fn.selected = function (select) {\n if (typeof select === \"undefined\") {\n select = true;\n }\n\n return this.each(function () {\n var t = this.type;\n\n if (t === \"checkbox\" || t === \"radio\") {\n this.checked = select;\n } else if (tagName(this) === \"option\") {\n var $sel = $(this).parent(\"select\");\n\n if (select && $sel[0] && $sel[0].type === \"select-one\") {\n // deselect all other options\n $sel.find(\"option\").selected(false);\n }\n\n this.selected = select;\n }\n });\n };\n\n // expose debug var\n $.fn.ajaxSubmit.debug = false;\n})(jQuery);\n\nexport default jQuery;\n"],"names":["owners","plainForm","document","createElement","findDescriptor","name","i","length","owner","window","descriptor","Object","getOwnPropertyDescriptor","prototype","formMember","form","get","call","e","callFormMethod","value","apply","Array","slice","arguments","tagName","el","toLowerCase","isElement","node","assertRealParent","parentNode","Error","closestByTag","names","indexOf","storeKey","setExpando","ignore","expando","els","namedItem","undefined","record","x","y","jQuery","data","type","setTimeout","captureSubmitter","target","point","offsetX","offsetY","fn","offset","pageX","left","pageY","top","offsetLeft","offsetTop","imagePoint","submitterOf","stored","log","ajaxSubmit","debug","msg","join","console","opera","postError","warned","deprecate","id","message","warn","deprecateOldJQuery","version","parts","String","split","major","Number","beforeJQuery35","shorthandOptions","options","dataType","onSuccess","result","url","success","submitOptions","key","hasOwnProperty","withoutUrl","keepContext","settings","sources","context","submitWith","isDefaultPrevented","preventDefault","originalEvent","submitter","captureEventSubmitter","doAjaxSubmit","captureSubmittingElement","this","bindDelegated","$sel","selector","off","on","closestMatch","Element","closest","is","delegated","unbindSelector","handlers","submit","click","selectionOnly","ajaxForm","jquery","delegation","bindSelector","beforeFormUnbind","ajaxFormUnbind","o","s","c","isReady","bindLater","formAttribute","attr","rLineBreak","rCR","rUnsubmittable","isDisabled","matches","disabled","valueOf","index","selectedIndex","a","ops","one","max","op","selected","v","attributes","specified","text","push","selectValue","val","raw","replace","loneSurrogate","wellFormed","match","before","urlencode","fields","traditional","param","map","field","urlencodedFields","createSuccessfulControls","feature","$","controlsOf","semantic","formId","getElementsByTagName","makeArray","grep","ownedBy","test","navigator","userAgent","concat","filter","getAttribute","inArray","outsideControls","fieldsOf","n","fieldValue","constructor","fileapi","files","file","required","imageFields","sub","input","addCandidate","collected","own","controls","collect","filtering","addClickedImage","deepSerialize","extraData","part","serialized","len","decodeURIComponent","sendFormData","submission","formdata","FormData","append","serializedData","extend","ajaxSettings","contentType","processData","cache","method","uploadProgress","createXhr","xhr","upload","addEventListener","event","percent","position","loaded","total","lengthComputable","Math","ceil","beforeSend","formData","ajax","sendAjax","uploadAttributes","hasOwn","isGet","addSubmitterFields","submitterFields","addCsrfField","forms","origin","csrf_token","csrf_param","posts","property","href","location","protocol","host","setFormAttribute","getDoc","frame","doc","contentWindow","err","contentDocument","readStatus","status","statusText","readResponse","retry","errMsg","isXml","XMLDocument","isXMLDoc","body","innerHTML","docRoot","documentElement","responseText","responseXML","getResponseHeader","header","readDocument","dt","scr","textarea","ta","pre","b","textContent","innerText","readEmbedded","ct","xml","nodeName","error","dataFilter","JSON","parse","globalEval","httpData","createLifecycle","g","timeoutHandle","callbackProcessed","deferred","Deferred","aborted","getAllResponseHeaders","setRequestHeader","abort","done","rejection","textStatus","stop","reject","trigger","complete","endGlobalEvents","active","clearTimeout","release","settle","failure","resolve","succeed","start","global","fail","startTimer","onTimeout","timeout","stopTimer","createIframeTransport","hasProp","frameCount","fileUploadIframe","ownerDocument","$body","$io","iframeTarget","each","nameWindow","io","setAttribute","iframeSrc","css","createFrame","Date","getTime","life","execCommand","remove","frameHooks","domCheckCount","checkState","state","readyState","cb","doSubmit","saved","saveAttributes","mp","skipEncodingOverride","setUploadAttributes","extraInputs","added","addHiddenInput","appendTo","isPlainObject","single","f","addExtraInputs","root","contains","notInDocument","attachEvent","listen","submitForm","restoreAttributes","detachEvent","removeEventListener","unlisten","post","forceSync","jqxhr","elements","prop","removeAttr","enableControls","closeKeepAlive","createSubmission","serialization","refuse","extraQuery","optionsData","requestFormat","query","pairs","at","decodeQuery","queryPairs","defineKey","object","defineProperty","enumerable","writable","configurable","callbackList","callback","isArray","callEach","callbacks","args","prepare","$set","action","trim","URL","withDefaults","defaultType","veto","beforeSerialize","qx","beforeSubmit","resolved","resolveMethod","extra","stringify","jsonBody","q","toUpperCase","hashAt","base","encode","$form","deliver","resetForm","clearForm","includeHidden","successes","jqXHR","successArguments","replaceTarget","$target","merge","errors","completes","chooseTransport","hasFileInputs","add","multipart","attribute","fileAPI","shouldUseFrame","transport","iframe","steps","transports","attr2","removeData","k","formToArray","formSerialize","fieldSerialize","successful","t","checked","isSuccessful","clearFields","clearInputs","re","tag","replaceWith","clone","defaultChecked","defaultValue","select","parents","multiple","defaultSelected","find","forEl","htmlFor","getElementById","enable","parent"],"mappings":";;;;;;;;;;;;;;;;;;;;;4ZAMIA,EAAS,CAAC,kBAAmB,cAAe,UAAW,QAGvDC,EAAYC,EAASC,cAAc,QAEvC,SAASC,EAAeC,GACtB,IAAK,IAAIC,EAAI,EAAGA,EAAIN,EA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rL,KAAK0O,KAAK,WACf1O,KAAKkC,UAAYmJ,CACnB,EACF,EAMAnH,EAAEzH,GAAGkG,SAAW,SAAUuU,GAKxB,YAJsB,IAAXA,IACTA,GAAS,GAGJlX,KAAK0O,KAAK,WACf,IAAI6H,EAAIvW,KAAK9D,KAEb,GAAU,aAANqa,GAA0B,UAANA,EACtBvW,KAAKwW,QAAUU,OACV,GAAsB,WAAlBvc,EAAQqF,MAAoB,CACrC,IAAIE,EAAOgE,EAAElE,MAAM2X,OAAO,UAEtBT,GAAUhX,EAAK,IAAuB,eAAjBA,EAAK,GAAGhE,MAE/BgE,EAAKoX,KAAK,UAAU3U,UAAS,GAG/B3C,KAAK2C,SAAWuU,CAClB,CACF,EACF,EAGAhT,EAAEzH,GAAGY,WAAWC,OAAQ,CACzB,CAlcD,CAkcGtB"} \ No newline at end of file diff --git a/dist/jquery.form.mjs b/dist/jquery.form.mjs index 7dc8f41..e3cbd7c 100644 --- a/dist/jquery.form.mjs +++ b/dist/jquery.form.mjs @@ -1463,8 +1463,12 @@ function createLifecycle(s, frame) { return; } - // an emulated HTTP error status wins, as in $.ajax; a parse error is kept otherwise + // an emulated HTTP error status wins with the statusText, as in $.ajax; a parse error is + // kept otherwise if (xhr.status && !((xhr.status >= 200 && xhr.status < 300) || xhr.status === 304)) { + if (status === "parsererror") { + errMsg = undefined; + } status = "error"; } @@ -1489,7 +1493,7 @@ function createLifecycle(s, frame) { if (s.error) { s.error.call(s.context, xhr, status, errMsg); } - deferred.reject(xhr, "error", errMsg); + deferred.reject(xhr, status, errMsg); if (g) { $$1.event.trigger("ajaxError", [xhr, s, errMsg]); } diff --git a/docs/research/4x-behavior-changes.md b/docs/research/4x-behavior-changes.md index 3c61f84..2d0927e 100644 --- a/docs/research/4x-behavior-changes.md +++ b/docs/research/4x-behavior-changes.md @@ -50,7 +50,7 @@ Collected as the modernization proceeds. Each entry is a change a consumer could - **A string `data` option is a query string.** It is appended as-is to a urlencoded body or GET url, and split into its own fields for FormData and iframe uploads. It used to be sent one character at a time (`0=x&1=%3D&2=1`), and an iframe upload with a clicked submitter or the CSRF metas threw. - **`ajaxSubmit` on jQuery's slim build throws a clear error (#541).** The slim builds have no `$.ajax`. `ajaxSubmit` now throws `jquery.form: ajaxSubmit needs the full jQuery build; this jQuery has no $.ajax` before any event or callback, instead of a `TypeError` about `success`. An empty selection still returns silently. - **New option `requestFormat: "json"` (#545).** It sends the fields (repeated names as arrays) merged with object `data` as a JSON body with `contentType: "application/json; charset=UTF-8"`. It throws a clear error on a GET method, with string `data`, with files or a multipart form, and with the iframe transport. Based on the idea in PR #557 by zhangciwu. -- **The iframe upload fires its events in `$.ajax` order.** `ajaxSend` now fires after `beforeSend`, and not at all when `beforeSend` returns `false` or aborts. A `beforeSend` veto rejects the Deferred and fires `ajaxError` (`"canceled"`), `ajaxComplete` and `ajaxStop`, so `$.active` drops back and global spinners stop; it used to fire `ajaxSend` and leave the global events open. The `complete` callback runs before `ajaxComplete` and `ajaxStop` (it ran after them), and `ajaxSuccess` handlers receive the parsed data as their fourth argument. Unchanged until 5.0: `.done` receives the response text, and a parse error rejects with `"error"`. +- **The iframe upload fires its events in `$.ajax` order.** `ajaxSend` now fires after `beforeSend`, and not at all when `beforeSend` returns `false` or aborts. A `beforeSend` veto rejects the Deferred and fires `ajaxError` (`"canceled"`), `ajaxComplete` and `ajaxStop`, so `$.active` drops back and global spinners stop; it used to fire `ajaxSend` and leave the global events open. The `complete` callback runs before `ajaxComplete` and `ajaxStop` (it ran after them), and `ajaxSuccess` handlers receive the parsed data as their fourth argument. Unchanged until 5.0: `.done` receives the response text. A parse error rejected with `"error"` until 4.6.0 (see Phase 13). - **Every iframe upload settles once, also when it fails with an exception.** An `iframeTarget` that matches nothing, or a subject that is not a form, used to throw and leave `$.active` raised with no `ajaxStop`. The upload now settles with `"error"` and the exception: the `error` callback, a rejected Deferred, `ajaxError`, `complete`, `ajaxComplete` and `ajaxStop`. A `success` callback that throws no longer leaves the Deferred pending and the global events open; its exception still reaches the console, after the upload settled. `beforeSend` that aborts and returns `false` no longer decrements `$.active` twice. @@ -119,6 +119,7 @@ Collected as the modernization proceeds. Each entry is a change a consumer could - **The package includes `LICENSE-MIT`.** The package is dual-licensed (LGPL-2.1+ or MIT), but only `LICENSE` was published. - **The CommonJS factory uses the window it is given.** `require("jquery-form")(root, $)` read the global `window` and `document`, so it threw in Node unless a DOM was global (as in jest-environment-jsdom). The classic build now takes `window`, `document`, `navigator`, `Element` and `FormData` from `root`, falling back to the global window. jQuery 4 itself still needs a global window when required without one. - **Spaces encode as `+` on every jQuery version.** jQuery 3 and later made `$.param` write a space as `%20`, so `formSerialize`, `fieldSerialize`, a GET query string and the `data` that `beforeSend` sees used `%20`, while jQuery 1 and 2 and a native form submission use `+`. They now use `+` everywhere. Servers decode both the same way; only code that compares the strings sees a difference. A string `data` option is passed through unchanged. +- **An iframe response that cannot be parsed rejects with `parsererror`.** The Deferred of an iframe upload rejected with `"error"` when the response did not parse for the `dataType`, while `error`, `complete` and an XHR request report `"parsererror"`; it now rejects with `"parsererror"` too. When the response also carries an emulated error status (a `status` attribute outside 2xx), `error`, `ajaxError` and the rejection now receive the `statusText` attribute, as `$.ajax` reports a server error, instead of the parse exception; the status stays `"error"`. ## Known behavior, not changed diff --git a/src/iframe-lifecycle.js b/src/iframe-lifecycle.js index 0681376..664d65b 100644 --- a/src/iframe-lifecycle.js +++ b/src/iframe-lifecycle.js @@ -164,8 +164,12 @@ export function createLifecycle(s, frame) { return; } - // an emulated HTTP error status wins, as in $.ajax; a parse error is kept otherwise + // an emulated HTTP error status wins with the statusText, as in $.ajax; a parse error is + // kept otherwise if (xhr.status && !((xhr.status >= 200 && xhr.status < 300) || xhr.status === 304)) { + if (status === "parsererror") { + errMsg = undefined; + } status = "error"; } @@ -190,7 +194,7 @@ export function createLifecycle(s, frame) { if (s.error) { s.error.call(s.context, xhr, status, errMsg); } - deferred.reject(xhr, "error", errMsg); + deferred.reject(xhr, status, errMsg); if (g) { $.event.trigger("ajaxError", [xhr, s, errMsg]); } diff --git a/test/suite/iframe-transport.test.js b/test/suite/iframe-transport.test.js index 7725094..3aac9a1 100644 --- a/test/suite/iframe-transport.test.js +++ b/test/suite/iframe-transport.test.js @@ -2786,30 +2786,87 @@ describe("form", function () { assert.strictEqual(ajaxErrorReason, "fixture failure"); }); - it.fails( - "should reject with parsererror when the response cannot be parsed", - async function () { - const $form = createIframeForm("ajax/iframe-text.html"); + it("should reject with parsererror when the response cannot be parsed", async function () { + const $form = createIframeForm("ajax/iframe-text.html"); + + const result = await submitThroughIframe($form, { dataType: "json" }); + const rejection = await new Promise((resolve) => + result.xhr.fail((...args) => resolve(args)) + ); - const result = await submitThroughIframe($form, { dataType: "json" }); - const rejection = await new Promise((resolve) => - result.xhr.fail((...args) => resolve(args)) + assert.strictEqual(rejection[1], "parsererror"); + }); + + it("should report the statusText when an error-status response also fails to parse", async function () { + const $form = createIframeForm("ajax/iframe-error.html"); + + const result = await submitThroughIframe($form, { dataType: "json" }); + + assert.strictEqual(result.error[2], "fixture failure"); + }); + + // Submits the form with `options` and records what each callback, ajaxError and the + // rejection received. + function settleOutcome($form, options) { + const seen = {}; + const onAjaxError = function (event, xhr, settings, reason) { + seen.ajaxError = reason; + }; + $(document).on("ajaxError.ifrlog", onAjaxError); + + return new Promise(function (resolve) { + $form.ajaxSubmit( + $.extend({}, options, { + error: (xhr, status, reason) => (seen.error = [status, reason]), + complete: function (xhr, status) { + seen.complete = status; + $(document).off("ajaxError.ifrlog", onAjaxError); + setTimeout(() => resolve(seen)); + }, + }) ); + $form + .data("jqxhr") + .fail((xhr, status, reason) => (seen.rejection = [status, reason])); + }); + } - assert.strictEqual(rejection[1], "parsererror"); - } - ); + it("should report a parse error to every callback, ajaxError and the rejection as the XHR transport does", async function () { + const iframeForm = createIframeForm("ajax/iframe-text.html"); + const xhrForm = createIframeForm("ajax/iframe-text.html"); + + const viaIframe = await settleOutcome(iframeForm, { iframe: true, dataType: "json" }); + const viaXhr = await settleOutcome(xhrForm, { dataType: "json" }); + + const shape = (seen) => ({ + error: seen.error[0], + complete: seen.complete, + rejection: seen.rejection[0], + sameReason: seen.ajaxError === seen.error[1] && seen.rejection[1] === seen.error[1], + reasonIsError: seen.error[1] instanceof Error, + }); + assert.deepEqual(shape(viaIframe), shape(viaXhr)); + assert.deepEqual(shape(viaIframe), { + error: "parsererror", + complete: "parsererror", + rejection: "parsererror", + sameReason: true, + reasonIsError: true, + }); + }); - it.fails( - "should report the statusText when an error-status response also fails to parse", - async function () { - const $form = createIframeForm("ajax/iframe-error.html"); + it("should report error and the statusText everywhere when an error-status response fails to parse", async function () { + const $form = createIframeForm("ajax/iframe-error.html"); - const result = await submitThroughIframe($form, { dataType: "json" }); + const seen = await settleOutcome($form, { iframe: true, dataType: "json" }); - assert.strictEqual(result.error[2], "fixture failure"); - } - ); + assert.deepEqual(seen, { + error: ["error", "fixture failure"], + rejection: ["error", "fixture failure"], + ajaxError: "fixture failure", + complete: "error", + }); + }); it("should settle the upload and end the global events when success throws", async function () { const $form = createIframeForm("ajax/iframe-text.html"); From 5c8dc94f87335bab0e9522b54bdf4f56ef7ce5c6 Mon Sep 17 00:00:00 2001 From: Kevin Morris Date: Sun, 1 Nov 2026 23:16:39 -0500 Subject: [PATCH 30/78] fix: leave a submitter disabled by its fieldset out of an iframe upload --- dist/jquery.form.js | 19 +++---- dist/jquery.form.min.js | 2 +- dist/jquery.form.min.js.map | 2 +- dist/jquery.form.mjs | 19 +++---- docs/research/4x-behavior-changes.md | 1 + src/form-members.js | 8 +++ src/submitter.js | 5 +- src/successful-controls.js | 10 +--- test/e2e/harness.js | 23 ++++----- test/suite/iframe-transport.test.js | 76 ++++++++++++++++++++++++++++ 10 files changed, 121 insertions(+), 44 deletions(-) diff --git a/dist/jquery.form.js b/dist/jquery.form.js index 66bf704..b714d89 100644 --- a/dist/jquery.form.js +++ b/dist/jquery.form.js @@ -109,6 +109,14 @@ function tagName(el) { return typeof name === "string" ? name.toLowerCase() : ""; } +/** + * Whether a control or option is disabled, also through a disabled fieldset or optgroup. Without + * selector matching, only its own disabled property is read. + */ +function isDisabled(el) { + return typeof el.matches === "function" ? el.matches(":disabled") : !!el.disabled; +} + // Elements only: the subject of formToArray may also be the document or a plain object. function isElement(node) { return formMember(node, "nodeType") === 1; @@ -255,7 +263,8 @@ function submitterFields(form) { var sub = submitterOf(form); var el = sub && sub.el; - if (el && el.name && !el.disabled) { + // a disabled button is not sent, also when a disabled fieldset disables it + if (el && el.name && !isDisabled(el)) { fields[el.name] = el.value; if (el.type === "image") { fields[el.name + ".x"] = sub.x; @@ -609,14 +618,6 @@ var rCR = /\r/g; // Listed form elements that are never submitted. var rUnsubmittable = /^(?:fieldset|object|output)$/; -/** - * Whether a control or option is disabled, also through a disabled fieldset or optgroup. Without - * selector matching, only its own disabled property is read. - */ -function isDisabled(el) { - return typeof el.matches === "function" ? el.matches(":disabled") : !!el.disabled; -} - /** * The successful-control rule: whether a control is sent. `submitter` is the button that * submitted the control's form; other submit and image buttons of a form are not sent. diff --git a/dist/jquery.form.min.js b/dist/jquery.form.min.js index c80cc48..5041a5d 100644 --- a/dist/jquery.form.min.js +++ b/dist/jquery.form.min.js @@ -19,5 +19,5 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. */ -!function(e){"function"==typeof define&&define.amd?define(["jquery"],function(t){e(t,window)}):"object"==typeof module&&module.exports?module.exports=function(t,r){return void 0===r&&(r="undefined"!=typeof window?require("jquery"):require("jquery")(t)),e(r,t||("undefined"!=typeof window?window:void 0)),r}:e(jQuery,window)}(function(e,t){"use strict";var r=t,n=r.document,a=r.navigator,o=r.Element,i=r.FormData,u=["HTMLFormElement","HTMLElement","Element","Node"],s=n.createElement("form");function c(e){for(var t=0;t=0)return r;return null}var h="jqFormSubmitter";function g(e,t,r){try{e[t]=r}catch(e){}}function y(e,t){var r=e[t],n=l(e,"elements");return n&&r&&n.namedItem(t)===r?void 0:r}function b(t,r,n,a){e.data(t,h,{el:r,x:n,y:a}),g(t,"clk",r),"image"===r.type&&(g(t,"clk_x",n),g(t,"clk_y",a)),setTimeout(function(){e.data(t,h,null),g(t,"clk",null),g(t,"clk_x",null),g(t,"clk_y",null)},100)}function x(t){var r=v(t.target,["button","input"]);if(r&&("submit"===r.type||"image"===r.type)){var n=r.form;if(n){var a="image"===r.type?function(t,r){if(void 0!==t.offsetX)return[t.offsetX,t.offsetY];if("function"==typeof e.fn.offset){var n=e(r).offset();return[t.pageX-n.left,t.pageY-n.top]}return[t.pageX-r.offsetLeft,t.pageY-r.offsetTop]}(t,r):[];b(n,r,a[0],a[1])}}}function j(t){if(!t)return null;var r=e.data(t,h);if(r)return r;var n=y(t,"clk");return n?{el:n,x:y(t,"clk_x"),y:y(t,"clk_y")}:null}function T(){if(e.fn.ajaxSubmit.debug){var t="[jquery.form] "+Array.prototype.join.call(arguments,"");r.console&&r.console.log?r.console.log(t):r.opera&&r.opera.postError&&r.opera.postError(t)}}var w={};function S(t,n){e.fn.ajaxSubmit.debug&&!w[t]&&(w[t]=!0,r.console&&"function"==typeof r.console.warn&&r.console.warn("[jquery.form] "+n+" (removed in 5.0)"))}function F(e){(function(e){var t=String(e).split("."),r=Number(t[0]);return r<3||3===r&&Number(t[1])<5})(e)&&S("jquery","support for jQuery "+e+" is deprecated, 5.0 needs jQuery 3.5 or later")}function E(e,t,r,n){if("string"!=typeof e&&!1!==e)return e;var a={url:e,data:t,dataType:r};return"function"==typeof n&&(a.success=n),a}function D(e,t,r,n){return"function"==typeof e?{success:e}:void 0===(e=E(e,t,r,n))?{}:!1===e.url||""===e.url?function(e){var t={};for(var r in e)"url"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}(e):e}function k(e,t){for(var r=0;r"'),e(function(){e(n.s,n.c).ajaxForm(r)}),t):(T("terminating; zero elements found by selector"+(e.isReady?"":" (DOM not ready)")),t)}(this,t))}function P(t){return"string"==typeof t?(N(t),this):(t!==I&&(C={},e(n).off("submit.form-plugin click.form-plugin")),this.off("submit.form-plugin click.form-plugin"))}function X(t,r){if(!p(t))return e(t).attr(r);var n=f(t,"getAttribute",r);return null===n?void 0:n}var R=/\r\n|\r|\n/g,H=/\r/g,U=/^(?:fieldset|object|output)$/;function z(e){return"function"==typeof e.matches?e.matches(":disabled"):!!e.disabled}function W(t){if("select"===d(t))return function(e){var t=e.selectedIndex;if(t<0)return null;for(var r=[],n=e.options,a="select-one"===e.type,o=a?t+1:n.length,i=a?t:0;i=0,o=a?e.responseXML:e.responseText;return a&&"parsererror"===o.documentElement.nodeName&&ie.error&&ie.error("parsererror"),r&&r.dataFilter&&(o=r.dataFilter(o,t)),"string"==typeof o&&(("json"===t||!t)&&n.indexOf("json")>=0?o=JSON.parse(o):"script"===t&&ie.globalEval(o)),o}(t,c,n)}catch(e){u="parsererror",t.error=i=e||u}}catch(e){T("error caught: ",e),u="error",t.error=i=e}return{status:u,data:o,errMsg:i}}var le=e;function fe(e,t){var r,n,a,o=le.Deferred(),i={aborted:0,responseText:null,responseXML:null,status:0,statusText:"n/a",getAllResponseHeaders:function(){},getResponseHeader:function(){},setRequestHeader:function(){},abort:function(e){s(e,[i,"aborted",e])}};function u(){return i.aborted||a}function s(n,a,s){var c=s||("timeout"===n?"timeout":"aborted");u()||(T("aborting upload... "+c),i.aborted=1,t.stop(),i.error=c,e.error&&e.error.call(e.context,i,c,n),o.reject.apply(o,a),r&&le.event.trigger("ajaxError",[i,e,c]),l(c))}function c(){r&&le.event.trigger("ajaxComplete",[i,e]),r&&! --le.active&&le.event.trigger("ajaxStop")}function l(r){e.complete&&e.complete.call(e.context,i,r),c(),clearTimeout(n),setTimeout(function(){t.release(),i.responseXML=null},100)}function f(t){var n=t.status,u=t.errMsg;if(i.aborted)T("upload aborted");else if(i.status&&!(i.status>=200&&i.status<300||304===i.status)&&("parsererror"===n&&(u=void 0),n="error"),a=!0,"success"!==n)void 0===u&&(u=i.statusText),e.error&&e.error.call(e.context,i,n,u),o.reject(i,n,u),r&&le.event.trigger("ajaxError",[i,e,u]),l(n);else{var s=function(t){var n;try{e.success.call(e.context,t,"success",i)}catch(e){n={error:e}}return o.resolve(i.responseText,"success",i),r&&le.event.trigger("ajaxSuccess",[i,e,t]),n}(t.data);if(l(n),s)throw s.error}}return o.abort=function(e){i.abort(e)},{xhr:i,deferred:o,start:function(){return(r=e.global)&&0===le.active++&&le.event.trigger("ajaxStart"),e.beforeSend&&!1===e.beforeSend.call(e.context,i,e)?(u()||(a=!0,o.reject(),r&&le.event.trigger("ajaxError",[i,e,"canceled"]),c()),!1):!i.aborted&&(r&&le.event.trigger("ajaxSend",[i,e]),!i.aborted)},done:u,abort:s,settle:f,fail:function(e){f({status:"error",errMsg:e})},startTimer:function(t){e.timeout&&(n=setTimeout(t,e.timeout))},stopTimer:function(){clearTimeout(n),n=void 0}}}var de=e;function pe(e,t){var r=0;function n(e){var n=e.form,a=e.method,o=k(de.extend(!0,{},de.ajaxSettings,e.options),[de.ajaxSettings,e.options]);o.context=o.context||o;var i=l(n,"ownerDocument"),u=de(v(n,["body"])),s=function(e,t,r){var n,a;if(e.iframeTarget)(a=(n=de(e.iframeTarget,r)).attr("name"))?t=a:(n.attr("name",t),n.each(function(){!function(e,t){try{e.contentWindow&&(e.contentWindow.name=t)}catch(e){}}(this,t)}));else{var o=r.createElement("iframe");o.setAttribute("name",t),o.setAttribute("src",e.iframeSrc),(n=de(o)).css({position:"absolute",top:"-1000px",left:"-1000px"})}return{$io:n,id:t}}(o,"jqFormIO"+(new Date).getTime()+r++,i),c=s.$io,d=c[0],p=fe(o,function(e,t){return{stop:function(){try{t[0].contentWindow.document.execCommand&&t[0].contentWindow.document.execCommand("Stop")}catch(e){}t.attr("src",e.iframeSrc)},release:function(){e.iframeTarget?t.attr("src",e.iframeSrc):t.remove()}}}(o,c)),m=50;if(!p.start())return p.deferred;function h(){try{var e=ue(d).readyState;T("state = "+e),e&&"uninitialized"===e.toLowerCase()&&setTimeout(h,50)}catch(e){T("Server abort: ",e," (",e.name,")"),b(2),p.stopTimer()}}function g(){var r=function(e){var t={};return Z.each(ee,function(r,n){t[n]=f(e,"hasAttribute",n)?f(e,"getAttribute",n):null}),t}(n);!function(e,t,r,n,a){var o="multipart/form-data";oe(e,"target",t),!r||/post/i.test(r)?oe(e,"method","POST"):re(r)&&!re(a.property(e,"method"))&&oe(e,"method","GET"),oe(e,"action",n.url),n.skipEncodingOverride||r&&!/post/i.test(r)||(oe(e,"encoding",o),oe(e,"enctype",o))}(n,s.id,a,o,t),p.startTimer(function(){b(1)});var l=[];try{!function(e,t,r,n,a){function o(r,n){var o=t.createElement("input");o.type="hidden",o.name=r,a.push(Z(o).val(n).appendTo(e)[0])}if(r)for(var i in r)if(te.call(r,i))if(Z.isPlainObject(r[i])&&te.call(r[i],"name")&&te.call(r[i],"value"))o(r[i].name,r[i].value);else{var u={};u[i]=r[i];for(var s=Y(u,n),c=0;c=0?"&":"?")+t+e.url.slice(a.length),e.data=null}else e.data=t}(t,V(y,h),x),{form:f,$form:e,fields:y,controls:b,options:t,method:d,traditional:h}))},deliver:function(e){var t=e.$form,r=e.options,n=[];if(r.resetForm&&n.push(function(){t.resetForm()}),r.clearForm&&n.push(function(){t.clearForm(r.includeHidden)}),!r.dataType&&r.target){var a=d(r.success);n.push(function(e,t,n){var o=arguments,i=r.replaceTarget?"replaceWith":"html",s=u(r.target);"string"==typeof e?s[i](e):T("target: the response was parsed by jQuery, so it is not inserted"),s.length||p(a,this,o),s.each(function(){p(a,this,o)})})}else u.merge(n,d(r.success));if(r.success=function(e,a,o){for(var i=r.context||this,u=0,s=n.length;u0,i=/^[\t\n\f\r ]*multipart\/form-data[\t\n\f\r ]*$/i,s=i.test(o.attribute(r[0],"enctype"))||i.test(o.attribute(r[0],"encoding")),c=t.fileapi&&t.formdata;T("fileAPI :"+c);var l=(a||s)&&!c,f=(a||s)&&c?"formdata":"ajax";if(!1!==n.iframe&&(n.iframe||l)&&(f="iframe"),"iframe"!==f||n.iframe||S("iframe","choosing the iframe transport automatically without FormData is deprecated, set iframe: true"),"ajax"!==f&&"json"===n.requestFormat)throw new Error('jquery.form: requestFormat "json" cannot send files or use the iframe transport');return f}}}!function(e){var t={};t.fileapi=void 0!==e('').get(0).files,t.formdata=void 0!==r.FormData;var n=!!e.fn.prop;var o={attribute:X,property:function(e,t){var r=n?e[t]:void 0;return"string"==typeof r?r:X(e,t)}},i=_(t),u=me(t,o,i),s={iframe:pe(n,o),formdata:G,ajax:J};e.fn.attr2=function(){if(S("attr2","attr2 is deprecated, use .prop() or .attr()"),!n)return this.attr.apply(this,arguments);var e=this.prop.apply(this,arguments);return e&&e.jquery||"string"==typeof e?e:this.attr.apply(this,arguments)},e.fn.ajaxSubmit=function(t,r,n,a){if(F(e.fn.jquery),!this.length)return T("ajaxSubmit: skipping submit process - no element selected"),this;if(!e.ajax)throw new Error("jquery.form: ajaxSubmit needs the full jQuery build; this jQuery has no $.ajax");var o=u.prepare(this,D(t,r,n,a));if(!o)return this;u.deliver(o);var i=s[u.chooseTransport(o)](o);this.removeData("jqxhr").data("jqxhr",i);for(var c=0;c=0)return r;return null}var g="jqFormSubmitter";function y(e,t,r){try{e[t]=r}catch(e){}}function b(e,t){var r=e[t],n=l(e,"elements");return n&&r&&n.namedItem(t)===r?void 0:r}function x(t,r,n,a){e.data(t,g,{el:r,x:n,y:a}),y(t,"clk",r),"image"===r.type&&(y(t,"clk_x",n),y(t,"clk_y",a)),setTimeout(function(){e.data(t,g,null),y(t,"clk",null),y(t,"clk_x",null),y(t,"clk_y",null)},100)}function j(t){var r=h(t.target,["button","input"]);if(r&&("submit"===r.type||"image"===r.type)){var n=r.form;if(n){var a="image"===r.type?function(t,r){if(void 0!==t.offsetX)return[t.offsetX,t.offsetY];if("function"==typeof e.fn.offset){var n=e(r).offset();return[t.pageX-n.left,t.pageY-n.top]}return[t.pageX-r.offsetLeft,t.pageY-r.offsetTop]}(t,r):[];x(n,r,a[0],a[1])}}}function T(t){if(!t)return null;var r=e.data(t,g);if(r)return r;var n=b(t,"clk");return n?{el:n,x:b(t,"clk_x"),y:b(t,"clk_y")}:null}function w(){if(e.fn.ajaxSubmit.debug){var t="[jquery.form] "+Array.prototype.join.call(arguments,"");r.console&&r.console.log?r.console.log(t):r.opera&&r.opera.postError&&r.opera.postError(t)}}var S={};function F(t,n){e.fn.ajaxSubmit.debug&&!S[t]&&(S[t]=!0,r.console&&"function"==typeof r.console.warn&&r.console.warn("[jquery.form] "+n+" (removed in 5.0)"))}function E(e){(function(e){var t=String(e).split("."),r=Number(t[0]);return r<3||3===r&&Number(t[1])<5})(e)&&F("jquery","support for jQuery "+e+" is deprecated, 5.0 needs jQuery 3.5 or later")}function D(e,t,r,n){if("string"!=typeof e&&!1!==e)return e;var a={url:e,data:t,dataType:r};return"function"==typeof n&&(a.success=n),a}function k(e,t,r,n){return"function"==typeof e?{success:e}:void 0===(e=D(e,t,r,n))?{}:!1===e.url||""===e.url?function(e){var t={};for(var r in e)"url"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}(e):e}function q(e,t){for(var r=0;r"'),e(function(){e(n.s,n.c).ajaxForm(r)}),t):(w("terminating; zero elements found by selector"+(e.isReady?"":" (DOM not ready)")),t)}(this,t))}function X(t){return"string"==typeof t?(I(t),this):(t!==$&&(N={},e(n).off("submit.form-plugin click.form-plugin")),this.off("submit.form-plugin click.form-plugin"))}function R(t,r){if(!m(t))return e(t).attr(r);var n=f(t,"getAttribute",r);return null===n?void 0:n}var H=/\r\n|\r|\n/g,U=/\r/g,z=/^(?:fieldset|object|output)$/;function W(t){if("select"===d(t))return function(e){var t=e.selectedIndex;if(t<0)return null;for(var r=[],n=e.options,a="select-one"===e.type,o=a?t+1:n.length,i=a?t:0;i=0,o=a?e.responseXML:e.responseText;return a&&"parsererror"===o.documentElement.nodeName&&ie.error&&ie.error("parsererror"),r&&r.dataFilter&&(o=r.dataFilter(o,t)),"string"==typeof o&&(("json"===t||!t)&&n.indexOf("json")>=0?o=JSON.parse(o):"script"===t&&ie.globalEval(o)),o}(t,c,n)}catch(e){u="parsererror",t.error=i=e||u}}catch(e){w("error caught: ",e),u="error",t.error=i=e}return{status:u,data:o,errMsg:i}}var le=e;function fe(e,t){var r,n,a,o=le.Deferred(),i={aborted:0,responseText:null,responseXML:null,status:0,statusText:"n/a",getAllResponseHeaders:function(){},getResponseHeader:function(){},setRequestHeader:function(){},abort:function(e){s(e,[i,"aborted",e])}};function u(){return i.aborted||a}function s(n,a,s){var c=s||("timeout"===n?"timeout":"aborted");u()||(w("aborting upload... "+c),i.aborted=1,t.stop(),i.error=c,e.error&&e.error.call(e.context,i,c,n),o.reject.apply(o,a),r&&le.event.trigger("ajaxError",[i,e,c]),l(c))}function c(){r&&le.event.trigger("ajaxComplete",[i,e]),r&&! --le.active&&le.event.trigger("ajaxStop")}function l(r){e.complete&&e.complete.call(e.context,i,r),c(),clearTimeout(n),setTimeout(function(){t.release(),i.responseXML=null},100)}function f(t){var n=t.status,u=t.errMsg;if(i.aborted)w("upload aborted");else if(i.status&&!(i.status>=200&&i.status<300||304===i.status)&&("parsererror"===n&&(u=void 0),n="error"),a=!0,"success"!==n)void 0===u&&(u=i.statusText),e.error&&e.error.call(e.context,i,n,u),o.reject(i,n,u),r&&le.event.trigger("ajaxError",[i,e,u]),l(n);else{var s=function(t){var n;try{e.success.call(e.context,t,"success",i)}catch(e){n={error:e}}return o.resolve(i.responseText,"success",i),r&&le.event.trigger("ajaxSuccess",[i,e,t]),n}(t.data);if(l(n),s)throw s.error}}return o.abort=function(e){i.abort(e)},{xhr:i,deferred:o,start:function(){return(r=e.global)&&0===le.active++&&le.event.trigger("ajaxStart"),e.beforeSend&&!1===e.beforeSend.call(e.context,i,e)?(u()||(a=!0,o.reject(),r&&le.event.trigger("ajaxError",[i,e,"canceled"]),c()),!1):!i.aborted&&(r&&le.event.trigger("ajaxSend",[i,e]),!i.aborted)},done:u,abort:s,settle:f,fail:function(e){f({status:"error",errMsg:e})},startTimer:function(t){e.timeout&&(n=setTimeout(t,e.timeout))},stopTimer:function(){clearTimeout(n),n=void 0}}}var de=e;function pe(e,t){var r=0;function n(e){var n=e.form,a=e.method,o=q(de.extend(!0,{},de.ajaxSettings,e.options),[de.ajaxSettings,e.options]);o.context=o.context||o;var i=l(n,"ownerDocument"),u=de(h(n,["body"])),s=function(e,t,r){var n,a;if(e.iframeTarget)(a=(n=de(e.iframeTarget,r)).attr("name"))?t=a:(n.attr("name",t),n.each(function(){!function(e,t){try{e.contentWindow&&(e.contentWindow.name=t)}catch(e){}}(this,t)}));else{var o=r.createElement("iframe");o.setAttribute("name",t),o.setAttribute("src",e.iframeSrc),(n=de(o)).css({position:"absolute",top:"-1000px",left:"-1000px"})}return{$io:n,id:t}}(o,"jqFormIO"+(new Date).getTime()+r++,i),c=s.$io,d=c[0],p=fe(o,function(e,t){return{stop:function(){try{t[0].contentWindow.document.execCommand&&t[0].contentWindow.document.execCommand("Stop")}catch(e){}t.attr("src",e.iframeSrc)},release:function(){e.iframeTarget?t.attr("src",e.iframeSrc):t.remove()}}}(o,c)),m=50;if(!p.start())return p.deferred;function v(){try{var e=ue(d).readyState;w("state = "+e),e&&"uninitialized"===e.toLowerCase()&&setTimeout(v,50)}catch(e){w("Server abort: ",e," (",e.name,")"),b(2),p.stopTimer()}}function g(){var r=function(e){var t={};return Z.each(ee,function(r,n){t[n]=f(e,"hasAttribute",n)?f(e,"getAttribute",n):null}),t}(n);!function(e,t,r,n,a){var o="multipart/form-data";oe(e,"target",t),!r||/post/i.test(r)?oe(e,"method","POST"):re(r)&&!re(a.property(e,"method"))&&oe(e,"method","GET"),oe(e,"action",n.url),n.skipEncodingOverride||r&&!/post/i.test(r)||(oe(e,"encoding",o),oe(e,"enctype",o))}(n,s.id,a,o,t),p.startTimer(function(){b(1)});var l=[];try{!function(e,t,r,n,a){function o(r,n){var o=t.createElement("input");o.type="hidden",o.name=r,a.push(Z(o).val(n).appendTo(e)[0])}if(r)for(var i in r)if(te.call(r,i))if(Z.isPlainObject(r[i])&&te.call(r[i],"name")&&te.call(r[i],"value"))o(r[i].name,r[i].value);else{var u={};u[i]=r[i];for(var s=Y(u,n),c=0;c=0?"&":"?")+t+e.url.slice(a.length),e.data=null}else e.data=t}(t,V(y,h),x),{form:f,$form:e,fields:y,controls:b,options:t,method:d,traditional:h}))},deliver:function(e){var t=e.$form,r=e.options,n=[];if(r.resetForm&&n.push(function(){t.resetForm()}),r.clearForm&&n.push(function(){t.clearForm(r.includeHidden)}),!r.dataType&&r.target){var a=d(r.success);n.push(function(e,t,n){var o=arguments,i=r.replaceTarget?"replaceWith":"html",s=u(r.target);"string"==typeof e?s[i](e):w("target: the response was parsed by jQuery, so it is not inserted"),s.length||p(a,this,o),s.each(function(){p(a,this,o)})})}else u.merge(n,d(r.success));if(r.success=function(e,a,o){for(var i=r.context||this,u=0,s=n.length;u0,i=/^[\t\n\f\r ]*multipart\/form-data[\t\n\f\r ]*$/i,s=i.test(o.attribute(r[0],"enctype"))||i.test(o.attribute(r[0],"encoding")),c=t.fileapi&&t.formdata;w("fileAPI :"+c);var l=(a||s)&&!c,f=(a||s)&&c?"formdata":"ajax";if(!1!==n.iframe&&(n.iframe||l)&&(f="iframe"),"iframe"!==f||n.iframe||F("iframe","choosing the iframe transport automatically without FormData is deprecated, set iframe: true"),"ajax"!==f&&"json"===n.requestFormat)throw new Error('jquery.form: requestFormat "json" cannot send files or use the iframe transport');return f}}}!function(e){var t={};t.fileapi=void 0!==e('').get(0).files,t.formdata=void 0!==r.FormData;var n=!!e.fn.prop;var o={attribute:R,property:function(e,t){var r=n?e[t]:void 0;return"string"==typeof r?r:R(e,t)}},i=_(t),u=me(t,o,i),s={iframe:pe(n,o),formdata:G,ajax:J};e.fn.attr2=function(){if(F("attr2","attr2 is deprecated, use .prop() or .attr()"),!n)return this.attr.apply(this,arguments);var e=this.prop.apply(this,arguments);return e&&e.jquery||"string"==typeof e?e:this.attr.apply(this,arguments)},e.fn.ajaxSubmit=function(t,r,n,a){if(E(e.fn.jquery),!this.length)return w("ajaxSubmit: skipping submit process - no element selected"),this;if(!e.ajax)throw new Error("jquery.form: ajaxSubmit needs the full jQuery build; this jQuery has no $.ajax");var o=u.prepare(this,k(t,r,n,a));if(!o)return this;u.deliver(o);var i=s[u.chooseTransport(o)](o);this.removeData("jqxhr").data("jqxhr",i);for(var c=0;c= 0) {\n return node;\n }\n }\n\n return null;\n}\n","import { closestByTag, formMember } from \"./form-members.js\";\nimport jQuery from \"jquery\";\n\n// The submitter: the button that submitted a form, captured from ajaxForm's clicks. It is kept in\n// a private store and cleared shortly after the click. The form's clk, clk_x and clk_y properties\n// are still written for pages that read them, and read when the store has none.\n\nvar storeKey = \"jqFormSubmitter\";\n\n// Writes a property on the form; a control with that name makes it read-only.\nfunction setExpando(form, name, value) {\n try {\n form[name] = value;\n } catch (ignore) {\n // the control keeps the name; the store has the submitter\n }\n}\n\n// A property the page set on the form, never a control of the form with that name.\nfunction expando(form, name) {\n var value = form[name];\n var els = formMember(form, \"elements\");\n\n return els && value && els.namedItem(name) === value ? undefined : value;\n}\n\n// Records a submitter for a form until the click window ends.\nfunction record(form, el, x, y) {\n jQuery.data(form, storeKey, { el: el, x: x, y: y });\n setExpando(form, \"clk\", el);\n\n if (el.type === \"image\") {\n setExpando(form, \"clk_x\", x);\n setExpando(form, \"clk_y\", y);\n }\n\n // clear form vars\n setTimeout(function () {\n jQuery.data(form, storeKey, null);\n setExpando(form, \"clk\", null);\n setExpando(form, \"clk_x\", null);\n setExpando(form, \"clk_y\", null);\n }, 100);\n}\n\n// The clicked point of an image button, relative to the image.\nfunction imagePoint(e, target) {\n if (typeof e.offsetX !== \"undefined\") {\n return [e.offsetX, e.offsetY];\n }\n\n if (typeof jQuery.fn.offset === \"function\") {\n var offset = jQuery(target).offset();\n\n return [e.pageX - offset.left, e.pageY - offset.top];\n }\n\n return [e.pageX - target.offsetLeft, e.pageY - target.offsetTop];\n}\n\n/**\n * Records the submit or image button a click event reached, for the form it belongs to.\n */\nexport function captureSubmitter(e) {\n // the clicked control, or the button around the clicked content (ex: a span within a button)\n var target = closestByTag(e.target, [\"button\", \"input\"]);\n\n // the type property, unlike the attribute, is \"submit\" for a button without a type (#588)\n if (!target || (target.type !== \"submit\" && target.type !== \"image\")) {\n return;\n }\n\n var form = target.form;\n\n if (!form) {\n // a submit control that belongs to no form\n return;\n }\n\n var point = target.type === \"image\" ? imagePoint(e, target) : [];\n\n record(form, target, point[0], point[1]);\n}\n\n/**\n * Records the submitter a submit event names (SubmitEvent.submitter), when no click was captured.\n * An image submitter gets the point 0,0, as native submission sends it without a click.\n */\nexport function captureEventSubmitter(e, form) {\n var el = e.originalEvent && e.originalEvent.submitter;\n\n if (el && !submitterOf(form)) {\n record(form, el, 0, 0);\n }\n}\n\n/**\n * The form's submitter as { el, x, y } (x and y for an image button), or null.\n */\nexport function submitterOf(form) {\n if (!form) {\n return null;\n }\n\n var stored = jQuery.data(form, storeKey);\n\n if (stored) {\n return stored;\n }\n\n var el = expando(form, \"clk\");\n\n return el ? { el: el, x: expando(form, \"clk_x\"), y: expando(form, \"clk_y\") } : null;\n}\n\n/**\n * The submitter's fields for a post that adds them itself (the iframe upload), as name β†’ value.\n */\nexport function submitterFields(form) {\n var fields = {};\n var sub = submitterOf(form);\n var el = sub && sub.el;\n\n if (el && el.name && !el.disabled) {\n fields[el.name] = el.value;\n if (el.type === \"image\") {\n fields[el.name + \".x\"] = sub.x;\n fields[el.name + \".y\"] = sub.y;\n }\n }\n\n return fields;\n}\n\n/**\n * The form's submitter element, or null.\n */\nexport function submitterElement(form) {\n var sub = submitterOf(form);\n\n return sub ? sub.el : null;\n}\n","import jQuery from \"jquery\";\n\n// Debug logging, switched on by $.fn.ajaxSubmit.debug. The flag is read on every call, so it can\n// be turned on after the plugin loads.\nexport function log() {\n if (!jQuery.fn.ajaxSubmit.debug) {\n return;\n }\n\n var msg = \"[jquery.form] \" + Array.prototype.join.call(arguments, \"\");\n\n if (window.console && window.console.log) {\n window.console.log(msg);\n } else if (window.opera && window.opera.postError) {\n window.opera.postError(msg);\n }\n}\n\nvar warned = {};\n\n/**\n * A deprecation warning: console.warn, only while debug is on, once per id per page. The message\n * names the replacement; the warning adds that the feature is removed in 5.0.\n */\nexport function deprecate(id, message) {\n if (!jQuery.fn.ajaxSubmit.debug || warned[id]) {\n return;\n }\n\n warned[id] = true;\n\n if (window.console && typeof window.console.warn === \"function\") {\n window.console.warn(\"[jquery.form] \" + message + \" (removed in 5.0)\");\n }\n}\n\n// Forgets which deprecations have warned (for tests).\nexport function resetDeprecations() {\n warned = {};\n}\n\n// True for a jQuery version string older than 3.5.\nexport function beforeJQuery35(version) {\n var parts = String(version).split(\".\");\n var major = Number(parts[0]);\n\n return major < 3 || (major === 3 && Number(parts[1]) < 5);\n}\n\n// 5.0 needs jQuery 3.5 or later: warned on the first ajaxSubmit or ajaxForm, given jQuery's version.\nexport function deprecateOldJQuery(version) {\n if (beforeJQuery35(version)) {\n deprecate(\n \"jquery\",\n \"support for jQuery \" + version + \" is deprecated, 5.0 needs jQuery 3.5 or later\"\n );\n }\n}\n","// The arguments ajaxSubmit and ajaxForm accept in place of an options object.\n\n/**\n * Turns the (url, data, dataType, success) shorthand into options. A url of false is kept as\n * the url; anything else is returned as given.\n */\nexport function shorthandOptions(options, data, dataType, onSuccess) {\n if (typeof options !== \"string\" && options !== false) {\n return options;\n }\n\n var result = { url: options, data: data, dataType: dataType };\n\n if (typeof onSuccess === \"function\") {\n result.success = onSuccess;\n }\n\n return result;\n}\n\n// A copy of options without its url, so the form action is used.\nfunction withoutUrl(options) {\n var result = {};\n\n for (var key in options) {\n if (key !== \"url\" && Object.prototype.hasOwnProperty.call(options, key)) {\n result[key] = options[key];\n }\n }\n\n return result;\n}\n\n/**\n * The options ajaxSubmit starts from: a function is the success callback, the shorthand is\n * expanded, and no options at all is an empty object. A url of false or \"\" means the form action.\n */\nexport function submitOptions(options, data, dataType, onSuccess) {\n if (typeof options === \"function\") {\n return { success: options };\n }\n\n options = shorthandOptions(options, data, dataType, onSuccess);\n\n if (typeof options === \"undefined\") {\n return {};\n }\n\n return options.url === false || options.url === \"\" ? withoutUrl(options) : options;\n}\n\n/**\n * jQuery treats `context` as a flat option: after a deep merge, the settings get back the\n * caller's own object from the last source that has one, so `this` in callbacks is that object.\n */\nexport function keepContext(settings, sources) {\n for (var i = 0; i < sources.length; i++) {\n if (sources[i].context !== undefined) {\n settings.context = sources[i].context;\n }\n }\n\n return settings;\n}\n","import { assertRealParent, closestByTag, formMember, isElement } from \"./form-members.js\";\nimport { captureEventSubmitter, captureSubmitter } from \"./submitter.js\";\nimport { deprecate, deprecateOldJQuery, log } from \"./diagnostics.js\";\nimport jQuery from \"jquery\";\nimport { shorthandOptions } from \"./options.js\";\n\n// ajaxForm binding: the submit and click handlers that send a form through ajaxSubmit. The\n// handlers look up $.fn.ajaxSubmit when they run, so a replacement installed later is used.\n\n// Sends the submit event's form with ajaxSubmit, unless an earlier handler cancelled it.\nfunction submitWith(e, options) {\n if (!e.isDefaultPrevented()) {\n // if event has been canceled, don't proceed\n e.preventDefault();\n // the form is found through the real tree: a control named nodeType misleads jQuery's closest\n var form = closestByTag(e.target, [\"form\"]);\n\n // a button outside the form (form attribute), or requestSubmit(button), sends no click here\n captureEventSubmitter(e, form);\n jQuery(form).ajaxSubmit(options); // #365\n }\n}\n\nfunction doAjaxSubmit(e) {\n submitWith(e, e.data);\n}\n\nfunction captureSubmittingElement(e) {\n /* jshint validthis:true */\n assertRealParent(this);\n captureSubmitter(e);\n}\n\n// An empty selection: queued until the DOM is ready (old jQuery keeps the selector), or dropped.\nfunction bindLater($sel, options) {\n var o = { s: $sel.selector, c: $sel.context };\n\n if (!jQuery.isReady && o.s) {\n log(\"DOM not ready, queuing ajaxForm\");\n deprecate(\n \"queue\",\n \"queuing ajaxForm until the DOM is ready is deprecated, call ajaxForm inside $(fn) \" +\n 'or use delegation: \"\"'\n );\n jQuery(function () {\n jQuery(o.s, o.c).ajaxForm(options);\n });\n\n return $sel;\n }\n\n // is your DOM ready? http://docs.jquery.com/Tutorials:Introducing_$(document).ready()\n log(\"terminating; zero elements found by selector\" + (jQuery.isReady ? \"\" : \" (DOM not ready)\"));\n\n return $sel;\n}\n\n// delegation: true on jQuery 3 and later, where the selection has no selector: always warned,\n// debug or not, once per ajaxForm call.\nfunction warnUnscoped() {\n var console = window.console || {};\n\n if (typeof console.warn === \"function\") {\n console.warn(\n \"[jquery.form] delegation: true binds every form on the page on jQuery 3 and later; \" +\n 'pass a selector instead, e.g. delegation: \"form.ajax\"'\n );\n }\n}\n\nfunction bindDelegated($sel, options) {\n if ($sel.selector === undefined) {\n warnUnscoped();\n }\n\n jQuery(document)\n .off(\"submit.form-plugin\", $sel.selector, doAjaxSubmit)\n .off(\"click.form-plugin\", $sel.selector, captureSubmittingElement)\n .on(\"submit.form-plugin\", $sel.selector, options, doAjaxSubmit)\n .on(\"click.form-plugin\", $sel.selector, options, captureSubmittingElement);\n\n return $sel;\n}\n\n// The element itself or its nearest ancestor that matches the selector. The walk never reads a\n// parentNode a control can hide (jQuery's delegated walk does, and cycles on such a form).\nfunction closestMatch(el, selector) {\n if (!isElement(el)) {\n return null;\n }\n\n if (window.Element && Element.prototype.closest) {\n return Element.prototype.closest.call(el, selector);\n }\n\n for (var node = el; node && isElement(node); node = formMember(node, \"parentNode\")) {\n if (jQuery(node).is(selector)) {\n return node;\n }\n }\n\n return null;\n}\n\n// The document handlers bound for each delegation selector, keyed by \"s\" + selector.\nvar delegated = {};\n\nfunction unbindSelector(selector) {\n var handlers = delegated[\"s\" + selector];\n\n if (handlers) {\n jQuery(document)\n .off(\"submit.form-plugin\", handlers.submit)\n .off(\"click.form-plugin\", handlers.click);\n delete delegated[\"s\" + selector];\n }\n}\n\n// delegation: \"\": one handler pair on the document, scoped to the selector.\nfunction bindSelector($sel, selector, options) {\n if (!selector) {\n throw new Error(\"jquery.form: delegation needs a selector, or true\");\n }\n\n var handlers = {\n submit: function (e) {\n if (closestMatch(e.target, selector)) {\n submitWith(e, options);\n }\n },\n click: function (e) {\n if (closestMatch(e.target, selector)) {\n captureSubmitter(e);\n }\n },\n };\n\n unbindSelector(selector);\n delegated[\"s\" + selector] = handlers;\n jQuery(document)\n .on(\"submit.form-plugin\", handlers.submit)\n .on(\"click.form-plugin\", handlers.click);\n\n return $sel;\n}\n\n// Passed by ajaxForm's own rebind: unbind the selection only, never the document handlers.\nvar selectionOnly = {};\n\n/**\n * ajaxForm() binds the selected forms so a submit is sent with ajaxSubmit, with the clicked\n * submit button (and image coordinates) included. The options work as for ajaxSubmit.\n */\nexport function ajaxForm(options, data, dataType, onSuccess) {\n deprecateOldJQuery(jQuery.fn.jquery);\n options = shorthandOptions(options, data, dataType, onSuccess) || {};\n\n if (typeof options.delegation === \"string\") {\n return bindSelector(this, options.delegation, options);\n }\n\n options.delegation = options.delegation && typeof jQuery.fn.on === \"function\";\n\n if (!options.delegation && this.length === 0) {\n return bindLater(this, options);\n }\n\n if (options.delegation) {\n return bindDelegated(this, options);\n }\n\n if (options.beforeFormUnbind) {\n options.beforeFormUnbind(this, options);\n }\n\n return this.ajaxFormUnbind(selectionOnly)\n .on(\"submit.form-plugin\", options, doAjaxSubmit)\n .on(\"click.form-plugin\", options, captureSubmittingElement);\n}\n\n/**\n * ajaxFormUnbind() removes the handlers ajaxForm bound on the selection and every delegated\n * binding on the document. ajaxFormUnbind(selector) removes only that delegation selector.\n */\nexport function ajaxFormUnbind(selector) {\n if (typeof selector === \"string\") {\n unbindSelector(selector);\n\n return this;\n }\n\n if (selector !== selectionOnly) {\n delegated = {};\n jQuery(document).off(\"submit.form-plugin click.form-plugin\");\n }\n\n return this.off(\"submit.form-plugin click.form-plugin\");\n}\n","import { callFormMethod, isElement } from \"./form-members.js\";\nimport jQuery from \"jquery\";\n\n/**\n * An attribute of a form, or undefined when it is absent, as jQuery's attr returns it. The\n * subject may also be the document or a plain object, read through jQuery.\n */\nexport function formAttribute(form, name) {\n if (!isElement(form)) {\n return jQuery(form).attr(name);\n }\n\n var value = callFormMethod(form, \"getAttribute\", name);\n\n return value === null ? undefined : value;\n}\n","import { callFormMethod, formMember, isElement, tagName } from \"./form-members.js\";\nimport { formAttribute } from \"./form-attributes.js\";\nimport jQuery from \"jquery\";\nimport { submitterOf } from \"./submitter.js\";\n\n// Successful controls: which controls of a form are sent, and as which name/value fields\n// (https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#constructing-the-form-data-set).\n\n// Line breaks, sent as CRLF\nvar rLineBreak = /\\r\\n|\\r|\\n/g;\nvar rCR = /\\r/g;\n\n// Listed form elements that are never submitted.\nvar rUnsubmittable = /^(?:fieldset|object|output)$/;\n\n/**\n * Whether a control or option is disabled, also through a disabled fieldset or optgroup. Without\n * selector matching, only its own disabled property is read.\n */\nfunction isDisabled(el) {\n return typeof el.matches === \"function\" ? el.matches(\":disabled\") : !!el.disabled;\n}\n\n/**\n * The successful-control rule: whether a control is sent. `submitter` is the button that\n * submitted the control's form; other submit and image buttons of a form are not sent.\n */\nexport function isSuccessful(el, submitter) {\n var t = el.type;\n\n if (!el.name || isDisabled(el) || t === \"reset\" || t === \"button\") {\n return false;\n }\n\n if (t === \"checkbox\" || t === \"radio\") {\n return !!el.checked;\n }\n\n if (t === \"submit\" || t === \"image\") {\n return !el.form || submitter === el;\n }\n\n return tagName(el) !== \"select\" || el.selectedIndex !== -1;\n}\n\n// The value of a select: the selected option's value for one, a list for several.\nfunction selectValue(el) {\n var index = el.selectedIndex;\n\n if (index < 0) {\n return null;\n }\n\n var a = [],\n ops = el.options;\n var one = el.type === \"select-one\";\n var max = one ? index + 1 : ops.length;\n\n for (var i = one ? index : 0; i < max; i++) {\n var op = ops[i];\n\n if (op.selected && !isDisabled(op)) {\n var v = op.value;\n\n if (!v) {\n // extra pain for IE...\n v =\n op.attributes && op.attributes.value && !op.attributes.value.specified\n ? op.text\n : op.value;\n }\n\n if (one) {\n return v;\n }\n\n a.push(v);\n }\n }\n\n return a;\n}\n\n/**\n * The value of a control, whether or not it is successful: a list for a multiple select, null\n * for a select with nothing selected, otherwise a string with CRLF line breaks (a lone CR or LF\n * included).\n */\nexport function valueOf(el) {\n if (tagName(el) === \"select\") {\n return selectValue(el);\n }\n\n var v = jQuery(el).val();\n var raw = el.value;\n\n // jQuery before 4.0 drops carriage returns from .val(); read them from the value itself\n if (typeof raw === \"string\" && raw.replace(rCR, \"\") === v) {\n v = raw;\n }\n\n return v.replace(rLineBreak, \"\\r\\n\");\n}\n\n/**\n * The fields as a urlencoded body sends them: a selected file as its name.\n */\n// A lone surrogate becomes U+FFFD, as in a native submission; jQuery.param would throw.\nvar loneSurrogate = /[\\uD800-\\uDBFF](?![\\uDC00-\\uDFFF])|([^\\uD800-\\uDBFF]|^)([\\uDC00-\\uDFFF])/g;\n\nexport function wellFormed(value) {\n return typeof value === \"string\"\n ? value.replace(loneSurrogate, function (match, before) {\n return (before || \"\") + \"\\uFFFD\";\n })\n : value;\n}\n\n// jQuery 3 dropped $.param's \"+\" for a space; a native submission still sends \"+\". Only a space\n// encodes as %20, since a literal % encodes as %25.\nexport function urlencode(fields, traditional) {\n return jQuery.param(urlencodedFields(fields), traditional).replace(/%20/g, \"+\");\n}\n\nexport function urlencodedFields(fields) {\n return jQuery.map(fields, function (field) {\n var value =\n field.type === \"file\" && typeof field.value !== \"string\" ? field.value.name : field.value;\n var name = wellFormed(field.name);\n value = wellFormed(value);\n\n return name === field.name && value === field.value ? field : { name: name, value: value };\n });\n}\n\n/**\n * The serialization steps. `feature` holds what the entry detected at load (fileapi).\n */\nexport function createSuccessfulControls(feature) {\n var $ = jQuery;\n\n // #386; inputs that name the form in their form attribute, other than the candidates found.\n // A form only gets the ones it owns.\n function outsideControls(formId, els, owner) {\n // hat tip @thet; the id is compared, never built into a selector\n return $(\":input[form]\")\n .filter(function () {\n return (\n this.getAttribute(\"form\") === formId &&\n (!owner || this.form === owner) &&\n $.inArray(this, els) < 0\n );\n })\n .get();\n }\n\n // A descendant of a form is a candidate unless it is a control another form owns.\n function ownedBy(els, owner) {\n return $.grep(els, function (el) {\n return typeof el.form === \"undefined\" || el.form === owner;\n });\n }\n\n /**\n * The candidate controls of a form, in order: its elements, or every descendant it owns in\n * semantic mode, then the outside controls it owns that name it.\n */\n function controlsOf(form, semantic) {\n var formId = formAttribute(form, \"id\");\n var els = formMember(form, \"elements\");\n\n if (semantic || typeof els === \"undefined\") {\n // the document is not an element; it has its own getElementsByTagName\n els = isElement(form)\n ? callFormMethod(form, \"getElementsByTagName\", \"*\")\n : form.getElementsByTagName(\"*\");\n }\n\n els = $.makeArray(els);\n\n // the subject may also be a fieldset, the document or another container\n var owner = tagName(form) === \"form\" ? form : null;\n\n if (semantic && owner) {\n els = ownedBy(els, owner);\n }\n\n // FinesseRus: in non-IE browsers outside fields are already included in form.elements.\n if (formId && (semantic || /(Edge|Trident)\\//.test(navigator.userAgent))) {\n els = els.concat(outsideControls(formId, els, owner));\n }\n\n return els;\n }\n\n // The fields of a control's value, or null when the control is not sent.\n function fieldsOf(el) {\n var n = el.name;\n // read at call time, so a page that replaces $.fieldValue changes what is sent\n var v = $.fieldValue(el, true);\n\n if (v && v.constructor === Array) {\n return $.map(v, function (value) {\n return { name: n, value: value };\n });\n }\n\n if (feature.fileapi && el.type === \"file\") {\n var files = el.files;\n\n // #180: an empty field when no file is selected\n return files.length\n ? $.map(files, function (file) {\n return { name: n, value: file, type: el.type };\n })\n : [{ name: n, value: \"\", type: el.type }];\n }\n\n if (v === null || typeof v === \"undefined\") {\n return null;\n }\n\n return [{ name: n, value: v, type: el.type, required: el.required }];\n }\n\n // The clicked image's value and coordinates.\n function imageFields(sub, input, type) {\n var n = input.name;\n var value = { name: n, value: $(input).val() };\n\n if (type) {\n value.type = type;\n }\n\n return [value, { name: n + \".x\", value: sub.x }, { name: n + \".y\", value: sub.y }];\n }\n\n // Adds one candidate control's fields, and the control when it has a value to send.\n function addCandidate(collected, form, el, semantic) {\n if (!el.name || isDisabled(el) || rUnsubmittable.test(tagName(el))) {\n return;\n }\n\n var sub = semantic && el.type === \"image\" && submitterOf(form);\n\n if (sub) {\n // handle image inputs on the fly when semantic == true\n if (sub.el === el) {\n collected.fields.push.apply(collected.fields, imageFields(sub, el, el.type));\n }\n\n return;\n }\n\n var own = fieldsOf(el);\n\n if (own) {\n collected.controls.push(el);\n collected.fields.push.apply(collected.fields, own);\n }\n }\n\n // input type=='image' are not found in elements array! handle it here\n function addClickedImage(collected, form) {\n var sub = submitterOf(form);\n var input = sub && $(sub.el)[0];\n\n if (input && input.name && !isDisabled(input) && input.type === \"image\") {\n collected.fields.push.apply(collected.fields, imageFields(sub, input));\n }\n }\n\n /**\n * The fields of a form, as formToArray returns them, and the controls they came from.\n */\n function collect(form, semantic, filtering) {\n var collected = { fields: [], controls: [] };\n\n if (!form) {\n return collected;\n }\n\n var els = controlsOf(form, semantic);\n\n if (typeof filtering === \"function\") {\n els = $.map(els, filtering);\n }\n\n for (var i = 0; i < els.length; i++) {\n addCandidate(collected, form, els[i], semantic);\n }\n\n if (!semantic) {\n addClickedImage(collected, form);\n }\n\n return collected;\n }\n\n return {\n controlsOf: controlsOf,\n fieldsOf: fieldsOf,\n collect: collect,\n };\n}\n","import jQuery from \"jquery\";\nimport { keepContext } from \"./options.js\";\n\n// The XMLHttpRequest transports: $.ajax with the encoded fields, or FormData for file uploads.\nvar $ = jQuery;\n\n// utility fn for deep serialization: [name, value] pairs, as $.param encodes them\nexport function deepSerialize(extraData, traditional) {\n var param = $.param(extraData, traditional);\n var serialized = param ? param.split(\"&\") : [];\n var len = serialized.length;\n var result = [];\n var i, part;\n\n for (i = 0; i < len; i++) {\n // #252; undo param space replacement\n serialized[i] = serialized[i].replace(/\\+/g, \" \");\n part = serialized[i].split(\"=\");\n // #278; use array instead of object storage, favoring array serializations\n result.push([decodeURIComponent(part[0]), decodeURIComponent(part[1])]);\n }\n\n return result;\n}\n\n/**\n * Posts the fields and extraData as FormData, for files with the File API.\n * XMLHttpRequest Level 2 file uploads (big hat tip to francois2metz)\n */\nexport function sendFormData(submission) {\n var options = submission.options;\n var a = submission.fields;\n\n var formdata = new FormData();\n\n for (var i = 0; i < a.length; i++) {\n formdata.append(a[i].name, a[i].value);\n }\n\n if (options.extraData) {\n var serializedData = deepSerialize(options.extraData, submission.traditional);\n\n for (i = 0; i < serializedData.length; i++) {\n formdata.append(serializedData[i][0], serializedData[i][1]);\n }\n }\n\n options.data = null;\n\n var s = $.extend(true, {}, $.ajaxSettings, options, {\n contentType: false,\n processData: false,\n cache: false,\n type: submission.method || \"POST\",\n });\n\n keepContext(s, [$.ajaxSettings, options]);\n\n if (options.uploadProgress) {\n // workaround because jqXHR does not expose upload property: wraps the xhr factory, the\n // caller's or jQuery's\n var createXhr = s.xhr;\n\n s.xhr = function () {\n var xhr = createXhr.call(this);\n\n if (xhr.upload) {\n xhr.upload.addEventListener(\n \"progress\",\n function (event) {\n var percent = 0;\n // event.position is the deprecated name, read only when loaded is missing\n var position = event.loaded !== undefined ? event.loaded : event.position;\n var total = event.total;\n\n if (event.lengthComputable) {\n percent = Math.ceil((position / total) * 100);\n }\n\n options.uploadProgress(event, position, total, percent);\n },\n false\n );\n }\n\n return xhr;\n };\n }\n\n s.data = null;\n\n var beforeSend = s.beforeSend;\n\n s.beforeSend = function (xhr, o) {\n // Send FormData() provided by user\n if (options.formData) {\n o.data = options.formData;\n } else {\n o.data = formdata;\n }\n\n // a veto (false) cancels the upload, as on the other transports\n return beforeSend ? beforeSend.call(this, xhr, o) : undefined;\n };\n\n return $.ajax(s);\n}\n\n/**\n * Sends the encoded fields with $.ajax.\n */\nexport function sendAjax(submission) {\n return $.ajax(submission.options);\n}\n","import { callFormMethod } from \"./form-members.js\";\nimport { deepSerialize } from \"./xhr-transport.js\";\nimport jQuery from \"jquery\";\nimport { submitterFields } from \"./submitter.js\";\nimport { wellFormed } from \"./successful-controls.js\";\n\n// The iframe form post: the extra fields (submitter, CSRF, data), the form attributes set while\n// posting and restored after, and the native submit.\nvar $ = jQuery;\n\n// The form attributes an iframe upload changes while it posts.\nvar uploadAttributes = [\"action\", \"target\", \"method\", \"enctype\", \"encoding\"];\n\n// Called through the prototype: an extraData key or a form field may be named hasOwnProperty.\nvar hasOwn = Object.prototype.hasOwnProperty;\n\nfunction isGet(method) {\n return /^get$/i.test(method);\n}\n\n// Resolves both URLs through anchors, as jQuery does for crossDomain, so IE's anchor quirks\n// apply to both sides of the comparison.\nfunction isSameOrigin(url) {\n var origin = document.createElement(\"a\");\n var target = document.createElement(\"a\");\n\n origin.href = window.location.href;\n target.href = url;\n // IE fills in the host of a relative URL only once the resolved href is assigned back\n target.href = target.href; // eslint-disable-line no-self-assign\n\n return origin.protocol + \"//\" + origin.host === target.protocol + \"//\" + target.host;\n}\n\n/** Adds the clicked submitter (and an image's coordinates) to s.extraData. */\nexport function addSubmitterFields(s, form) {\n // add submitting element to data if we know it\n var fields = submitterFields(form);\n\n for (var n in fields) {\n s.extraData = s.extraData || {};\n s.extraData[wellFormed(n)] = wellFormed(fields[n]);\n }\n}\n\n/** Adds the page's CSRF token to s.extraData when the form is posted to the page's origin. */\nexport function addCsrfField(s, form, method, forms) {\n // Rails CSRF hack (thanks to Yvan Barthelemy); like jquery-ujs, only for the page's origin and\n // only when the form is posted, since a get form would put the token in the url\n var csrf_token = $(\"meta[name=csrf-token]\").attr(\"content\");\n var csrf_param = $(\"meta[name=csrf-param]\").attr(\"content\");\n var posts =\n !isGet(method) &&\n (!method || /post/i.test(method) || /post/i.test(forms.property(form, \"method\")));\n\n if (csrf_param && csrf_token && posts && isSameOrigin(s.url)) {\n s.extraData = s.extraData || {};\n s.extraData[csrf_param] = csrf_token;\n }\n}\n\nfunction setFormAttribute(form, name, value) {\n callFormMethod(form, \"setAttribute\", name, value);\n}\n\n/** The raw attributes the upload changes, null when absent, to put back exactly (#380). */\nexport function saveAttributes(form) {\n var saved = {};\n\n $.each(uploadAttributes, function (i, name) {\n saved[name] = callFormMethod(form, \"hasAttribute\", name)\n ? callFormMethod(form, \"getAttribute\", name)\n : null;\n });\n\n return saved;\n}\n\n/** Puts back the attributes saveAttributes recorded, removing those that were absent. */\nexport function restoreAttributes(form, saved) {\n $.each(uploadAttributes, function (i, name) {\n if (saved[name] === null) {\n callFormMethod(form, \"removeAttribute\", name);\n } else {\n setFormAttribute(form, name, saved[name]);\n }\n });\n}\n\n/** Points the form at the frame `target` with the upload's url, method and encoding. */\nexport function setUploadAttributes(form, target, method, s, forms) {\n var mp = \"multipart/form-data\";\n\n // update form attrs in IE friendly way\n setFormAttribute(form, \"target\", target);\n if (!method || /post/i.test(method)) {\n setFormAttribute(form, \"method\", \"POST\");\n } else if (isGet(method) && !isGet(forms.property(form, \"method\"))) {\n // a form posts natively only with GET or POST; other verbs keep the form's own method\n setFormAttribute(form, \"method\", \"GET\");\n }\n setFormAttribute(form, \"action\", s.url);\n\n // ie borks in some cases when setting encoding\n if (!s.skipEncodingOverride && (!method || /post/i.test(method))) {\n setFormAttribute(form, \"encoding\", mp);\n setFormAttribute(form, \"enctype\", mp);\n }\n}\n\n/** Appends a hidden input per extraData field to the form; each input is pushed onto `added`. */\nexport function addExtraInputs(form, ownerDocument, extraData, traditional, added) {\n // Builds the input with DOM properties: a name is never parsed as HTML.\n function addHiddenInput(name, value) {\n var input = ownerDocument.createElement(\"input\");\n\n input.type = \"hidden\";\n input.name = name;\n added.push($(input).val(value).appendTo(form)[0]);\n }\n\n if (extraData) {\n for (var n in extraData) {\n if (hasOwn.call(extraData, n)) {\n // if using the $.param format that allows for multiple values with the same name\n if (\n $.isPlainObject(extraData[n]) &&\n hasOwn.call(extraData[n], \"name\") &&\n hasOwn.call(extraData[n], \"value\")\n ) {\n addHiddenInput(extraData[n].name, extraData[n].value);\n } else {\n // arrays and objects become one field per value, as $.param sends them (#597)\n var single = {};\n\n single[n] = extraData[n];\n var fields = deepSerialize(single, traditional);\n\n for (var f = 0; f < fields.length; f++) {\n addHiddenInput(fields[f][0], fields[f][1]);\n }\n }\n }\n }\n }\n}\n\n/** Submits the form natively, even when a control named submit hides the method. */\nexport function submitForm(form) {\n try {\n form.submit();\n } catch (err) {\n // just in case form has element with name/id of 'submit'\n callFormMethod(form, \"submit\");\n }\n}\n","import jQuery from \"jquery\";\nimport { log } from \"./diagnostics.js\";\n\n// The iframe response reader: turns the frame's document into the mock xhr's text, XML, status\n// and dataType, then parses it as $.ajax would (dataFilter, JSON, script).\nvar $ = jQuery;\n\n/** The frame's document, or null when the browser denies access to it. */\nexport function getDoc(frame) {\n /* it looks like contentWindow or contentDocument do not\n * carry the protocol property in ie8, when running under ssl\n * frame.document is the only valid response document, since\n * the protocol is know but not on the other two objects. strange?\n * \"Same origin policy\" http://en.wikipedia.org/wiki/Same_origin_policy\n */\n\n var doc = null;\n\n // IE8 cascading access check\n try {\n if (frame.contentWindow) {\n doc = frame.contentWindow.document;\n }\n } catch (err) {\n // IE8 access denied under ssl & missing protocol\n log(\"cannot get iframe.contentWindow document: \" + err);\n }\n\n if (doc) {\n // successful getting content\n return doc;\n }\n\n try {\n // simply checking may throw in ie8 under ssl or mismatched protocol\n doc = frame.contentDocument ? frame.contentDocument : frame.document;\n } catch (err) {\n // last attempt\n log(\"cannot get iframe.contentDocument: \" + err);\n doc = frame.document;\n }\n\n return doc;\n}\n\n/** Parses the response text or XML for the given (lowercase) dataType. */\nexport function httpData(xhr, type, s) {\n // mostly lifted from jq1.4.4\n\n var ct = xhr.getResponseHeader(\"content-type\") || \"\",\n xml = (type === \"xml\" || !type) && ct.indexOf(\"xml\") >= 0,\n data = xml ? xhr.responseXML : xhr.responseText;\n\n if (xml && data.documentElement.nodeName === \"parsererror\") {\n if ($.error) {\n $.error(\"parsererror\");\n }\n }\n if (s && s.dataFilter) {\n data = s.dataFilter(data, type);\n }\n if (typeof data === \"string\") {\n if ((type === \"json\" || !type) && ct.indexOf(\"json\") >= 0) {\n data = JSON.parse(data);\n } else if (type === \"script\") {\n $.globalEval(data);\n }\n }\n\n return data;\n}\n\n// Copies the status and statusText attributes of an element onto the mock xhr.\nfunction readStatus(xhr, el) {\n // support for XHR 'status' & 'statusText' emulation :\n xhr.status = Number(el.getAttribute(\"status\")) || xhr.status;\n xhr.statusText = el.getAttribute(\"statusText\") || xhr.statusText;\n}\n\n// Fills the mock xhr from the document itself.\nfunction readDocument(doc, xhr, s, isXml) {\n var docRoot = doc.body ? doc.body : doc.documentElement;\n\n xhr.responseText = docRoot ? docRoot.innerHTML : null;\n xhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc;\n if (isXml) {\n s.dataType = \"xml\";\n }\n xhr.getResponseHeader = function (header) {\n // the dataType in lowercase, as $.ajax reads it\n var headers = { \"content-type\": s.dataType && s.dataType.toLowerCase() };\n\n return headers[header.toLowerCase()];\n };\n if (docRoot) {\n readStatus(xhr, docRoot);\n }\n}\n\n// A response embedded in a textarea, or text wrapped in pre or body, replaces responseText.\nfunction readEmbedded(doc, xhr, dt, s) {\n var scr = /(json|script|text)/.test(dt);\n\n if (!scr && !s.textarea) {\n return;\n }\n // see if user embedded response in textarea\n var ta = doc.getElementsByTagName(\"textarea\")[0];\n\n if (ta) {\n xhr.responseText = ta.value;\n readStatus(xhr, ta);\n } else if (scr) {\n // account for browsers injecting pre around json response\n var pre = doc.getElementsByTagName(\"pre\")[0];\n var b = doc.getElementsByTagName(\"body\")[0];\n\n if (pre) {\n xhr.responseText = pre.textContent ? pre.textContent : pre.innerText;\n } else if (b) {\n xhr.responseText = b.textContent ? b.textContent : b.innerText;\n }\n }\n}\n\n/**\n * Reads and parses the response document into the mock xhr. Returns {status, data, errMsg}, or\n * null when `retry()` asks to read the document again later (Opera's untraversable DOM).\n */\nexport function readResponse(doc, xhr, s, retry) {\n var status = \"success\",\n data,\n errMsg;\n\n try {\n var isXml = /^xml$/i.test(s.dataType) || doc.XMLDocument || $.isXMLDoc(doc);\n\n log(\"isXml=\" + isXml);\n\n if (!isXml && window.opera && (doc.body === null || !doc.body.innerHTML)) {\n // in some browsers (Opera) the iframe DOM is not always traversable when\n // the onload callback fires, so we loop a bit to accommodate\n if (retry()) {\n return null;\n }\n // let this fall through because server response could be an empty document\n }\n\n readDocument(doc, xhr, s, isXml);\n\n var dt = (s.dataType || \"\").toLowerCase();\n\n readEmbedded(doc, xhr, dt, s);\n\n try {\n data = httpData(xhr, dt, s);\n } catch (err) {\n status = \"parsererror\";\n xhr.error = errMsg = err || status;\n }\n } catch (err) {\n log(\"error caught: \", err);\n status = \"error\";\n xhr.error = errMsg = err;\n }\n\n return { status: status, data: data, errMsg: errMsg };\n}\n","import jQuery from \"jquery\";\nimport { log } from \"./diagnostics.js\";\n\n// The iframe upload's lifecycle: the mock xhr and the Deferred, the global ajax events, the\n// beforeSend veto, the timeout, abort and settling.\nvar $ = jQuery;\n\n/**\n * Creates the lifecycle of one upload with the merged settings `s`. `frame.stop()` stops the\n * frame's load and `frame.release()` removes or resets the frame after the upload.\n */\nexport function createLifecycle(s, frame) {\n var g,\n timeoutHandle,\n callbackProcessed,\n deferred = $.Deferred();\n\n var xhr = {\n // mock object\n aborted: 0,\n responseText: null,\n responseXML: null,\n status: 0,\n statusText: \"n/a\",\n getAllResponseHeaders: function () {},\n getResponseHeader: function () {},\n setRequestHeader: function () {},\n abort: function (status) {\n abort(status, [xhr, \"aborted\", status]);\n },\n };\n\n // #341\n deferred.abort = function (status) {\n xhr.abort(status);\n };\n\n function done() {\n return xhr.aborted || callbackProcessed;\n }\n\n // Completes an aborted upload once and rejects the Deferred with `rejection`.\n // `textStatus` replaces the default \"timeout\"/\"aborted\" text status.\n function abort(status, rejection, textStatus) {\n var e = textStatus || (status === \"timeout\" ? \"timeout\" : \"aborted\");\n\n if (done()) {\n return;\n }\n\n log(\"aborting upload... \" + e);\n xhr.aborted = 1;\n frame.stop();\n xhr.error = e;\n if (s.error) {\n s.error.call(s.context, xhr, e, status);\n }\n deferred.reject.apply(deferred, rejection);\n\n if (g) {\n $.event.trigger(\"ajaxError\", [xhr, s, e]);\n }\n\n complete(e);\n }\n\n // The global events that end every upload, cancelled ones included.\n function endGlobalEvents() {\n if (g) {\n $.event.trigger(\"ajaxComplete\", [xhr, s]);\n }\n\n if (g && !--$.active) {\n $.event.trigger(\"ajaxStop\");\n }\n }\n\n // The steps every finished or aborted upload ends with, in $.ajax order.\n function complete(status) {\n if (s.complete) {\n s.complete.call(s.context, xhr, status);\n }\n\n endGlobalEvents();\n clearTimeout(timeoutHandle);\n\n // clean up\n setTimeout(function () {\n frame.release();\n xhr.responseXML = null;\n }, 100);\n }\n\n // A beforeSend veto ends the upload as $.ajax cancels a request: no callbacks, the global\n // events end with ajaxError \"canceled\".\n function cancel() {\n if (done()) {\n return;\n }\n\n callbackProcessed = true;\n deferred.reject();\n if (g) {\n $.event.trigger(\"ajaxError\", [xhr, s, \"canceled\"]);\n }\n endGlobalEvents();\n }\n\n // Fires the start events and beforeSend; false when the upload must not be posted.\n function start() {\n g = s.global;\n // trigger ajax global events so that activity/block indicators work like normal\n if (g && $.active++ === 0) {\n $.event.trigger(\"ajaxStart\");\n }\n\n if (s.beforeSend && s.beforeSend.call(s.context, xhr, s) === false) {\n cancel();\n\n return false;\n }\n\n if (xhr.aborted) {\n // abort() in beforeSend already completed the upload\n return false;\n }\n\n if (g) {\n $.event.trigger(\"ajaxSend\", [xhr, s]);\n }\n\n // an ajaxSend handler may abort too\n return !xhr.aborted;\n }\n\n // Resolves the upload; returns {error} when the success callback threw.\n function succeed(data) {\n var failure;\n\n try {\n s.success.call(s.context, data, \"success\", xhr);\n } catch (err) {\n failure = { error: err };\n }\n\n deferred.resolve(xhr.responseText, \"success\", xhr);\n\n if (g) {\n $.event.trigger(\"ajaxSuccess\", [xhr, s, data]);\n }\n\n return failure;\n }\n\n // Settles the upload with the response reader's {status, data, errMsg}.\n function settle(result) {\n var status = result.status,\n errMsg = result.errMsg;\n\n if (xhr.aborted) {\n // abort() completed the upload while its response was processed\n log(\"upload aborted\");\n\n return;\n }\n\n // an emulated HTTP error status wins with the statusText, as in $.ajax; a parse error is\n // kept otherwise\n if (xhr.status && !((xhr.status >= 200 && xhr.status < 300) || xhr.status === 304)) {\n if (status === \"parsererror\") {\n errMsg = undefined;\n }\n status = \"error\";\n }\n\n callbackProcessed = true;\n\n // ordering of these callbacks/triggers is odd, but that's how $.ajax does it\n if (status === \"success\") {\n var failure = succeed(result.data);\n\n complete(status);\n if (failure) {\n // the upload is settled; the success callback's exception still reaches the console\n throw failure.error;\n }\n\n return;\n }\n\n if (typeof errMsg === \"undefined\") {\n errMsg = xhr.statusText;\n }\n if (s.error) {\n s.error.call(s.context, xhr, status, errMsg);\n }\n deferred.reject(xhr, status, errMsg);\n if (g) {\n $.event.trigger(\"ajaxError\", [xhr, s, errMsg]);\n }\n\n complete(status);\n }\n\n return {\n xhr: xhr,\n deferred: deferred,\n start: start,\n done: done,\n abort: abort,\n settle: settle,\n // Settles an upload that failed with an exception (ignored once aborted).\n fail: function (err) {\n settle({ status: \"error\", errMsg: err });\n },\n // Runs `onTimeout` after s.timeout, when set.\n startTimer: function (onTimeout) {\n if (s.timeout) {\n timeoutHandle = setTimeout(onTimeout, s.timeout);\n }\n },\n stopTimer: function () {\n clearTimeout(timeoutHandle);\n timeoutHandle = undefined;\n },\n };\n}\n","import {\n addCsrfField,\n addExtraInputs,\n addSubmitterFields,\n restoreAttributes,\n saveAttributes,\n setUploadAttributes,\n submitForm,\n} from \"./iframe-post.js\";\nimport { closestByTag, formMember } from \"./form-members.js\";\nimport { deprecate, log } from \"./diagnostics.js\";\nimport { getDoc, readResponse } from \"./iframe-response.js\";\nimport { createLifecycle } from \"./iframe-lifecycle.js\";\nimport jQuery from \"jquery\";\nimport { keepContext } from \"./options.js\";\n\n// The iframe transport: posts the form itself into a hidden frame and reads the response from it,\n// for file uploads without the File API or when the iframe option asks for it.\nvar $ = jQuery;\n\n/**\n * The iframe send step. `hasProp` is what the entry detected at load; `forms.property` reads a\n * form property as attr2 does.\n */\nexport function createIframeTransport(hasProp, forms) {\n var CLIENT_TIMEOUT_ABORT = 1;\n var SERVER_ABORT = 2;\n // tells apart the frames of uploads that start in the same millisecond\n var frameCount = 0;\n\n // ensure that every serialized input is still enabled\n function enableControls(elements) {\n for (var i = 0; i < elements.length; i++) {\n var el = $(elements[i]);\n\n if (hasProp) {\n el.prop(\"disabled\", false);\n } else {\n el.removeAttr(\"disabled\");\n }\n }\n }\n\n // Names the frame's window, when the page may: a cross-origin or sandboxed frame refuses.\n function nameWindow(frame, name) {\n try {\n if (frame.contentWindow) {\n frame.contentWindow.name = name;\n }\n } catch (ignore) {}\n }\n\n // The frame the form posts into: the iframeTarget, named `id` when it has no name, or a new\n // hidden frame named `id`. Returns the frame and the name the form targets.\n function createFrame(s, id, ownerDocument) {\n var $io, n;\n\n if (s.iframeTarget) {\n $io = $(s.iframeTarget, ownerDocument);\n n = $io.attr(\"name\");\n if (!n) {\n $io.attr(\"name\", id);\n // a frame already in the page keeps the browsing context name it was inserted with\n $io.each(function () {\n nameWindow(this, id);\n });\n } else {\n id = n;\n }\n } else {\n var io = ownerDocument.createElement(\"iframe\");\n\n io.setAttribute(\"name\", id);\n io.setAttribute(\"src\", s.iframeSrc);\n $io = $(io);\n $io.css({ position: \"absolute\", top: \"-1000px\", left: \"-1000px\" });\n }\n\n return { $io: $io, id: id };\n }\n\n // The frame hooks the lifecycle calls: stop a load in progress, and release after the upload.\n function frameHooks(s, $io) {\n return {\n stop: function () {\n try {\n // #214, #257\n if ($io[0].contentWindow.document.execCommand) {\n $io[0].contentWindow.document.execCommand(\"Stop\");\n }\n } catch (ignore) {}\n\n $io.attr(\"src\", s.iframeSrc); // abort op in progress\n },\n release: function () {\n if (!s.iframeTarget) {\n $io.remove();\n } else {\n // adding else to clean up existing iframe response.\n $io.attr(\"src\", s.iframeSrc);\n }\n },\n };\n }\n\n function listen(io, cb) {\n if (io.attachEvent) {\n io.attachEvent(\"onload\", cb);\n } else {\n io.addEventListener(\"load\", cb, false);\n }\n }\n\n function unlisten(io, cb) {\n if (io.detachEvent) {\n io.detachEvent(\"onload\", cb);\n } else {\n io.removeEventListener(\"load\", cb, false);\n }\n }\n\n // private function for handling file uploads (hat tip to YAHOO!)\n function fileUploadIframe(submission) {\n var form = submission.form,\n method = submission.method;\n\n var s = keepContext($.extend(true, {}, $.ajaxSettings, submission.options), [\n $.ajaxSettings,\n submission.options,\n ]);\n\n s.context = s.context || s;\n var ownerDocument = formMember(form, \"ownerDocument\");\n var $body = $(closestByTag(form, [\"body\"]));\n var frame = createFrame(s, \"jqFormIO\" + new Date().getTime() + frameCount++, ownerDocument);\n var $io = frame.$io,\n io = $io[0];\n var life = createLifecycle(s, frameHooks(s, $io));\n var domCheckCount = 50;\n\n if (!life.start()) {\n return life.deferred;\n }\n\n addSubmitterFields(s, form);\n addCsrfField(s, form, method, forms);\n\n // look for server aborts\n function checkState() {\n try {\n var state = getDoc(io).readyState;\n\n log(\"state = \" + state);\n if (state && state.toLowerCase() === \"uninitialized\") {\n setTimeout(checkState, 50);\n }\n } catch (e) {\n log(\"Server abort: \", e, \" (\", e.name, \")\");\n cb(SERVER_ABORT);\n life.stopTimer();\n }\n }\n\n // take a breath so that pending repaints get some cpu time before the upload starts\n function doSubmit() {\n var saved = saveAttributes(form);\n\n setUploadAttributes(form, frame.id, method, s, forms);\n\n // support timout\n life.startTimer(function () {\n cb(CLIENT_TIMEOUT_ABORT);\n });\n\n // add \"extra\" data to form if provided in options\n var extraInputs = [];\n\n try {\n addExtraInputs(form, ownerDocument, s.extraData, submission.traditional, extraInputs);\n\n if (!s.iframeTarget) {\n // add iframe to doc and submit the form\n $io.appendTo($body);\n }\n\n // A connected form posting into a frame outside the document opens a new window.\n var root = ownerDocument.documentElement;\n\n if (io && $.contains(root, form) && !$.contains(root, io)) {\n var notInDocument = \"jquery.form: the upload frame is not in the document\";\n\n life.abort(notInDocument, [life.xhr, \"error\", notInDocument], \"error\");\n\n return;\n }\n\n listen(io, cb);\n setTimeout(checkState, 15);\n submitForm(form);\n } finally {\n // reset attrs and remove \"extra\" input elements\n restoreAttributes(form, saved);\n $(extraInputs).remove();\n }\n }\n\n // Reads the next document by Opera's rules: false once the retries are used up.\n function retry() {\n if (--domCheckCount) {\n log(\"requeing onLoad callback, DOM not available\");\n setTimeout(cb, 250);\n\n return true;\n }\n\n return false;\n }\n\n function cb(e) {\n if (life.done()) {\n return;\n }\n\n var doc = getDoc(io);\n\n if (!doc) {\n log(\"cannot access response document\");\n e = SERVER_ABORT;\n }\n if (e === CLIENT_TIMEOUT_ABORT) {\n life.abort(\"timeout\", [life.xhr, \"timeout\"]);\n\n return;\n }\n if (e === SERVER_ABORT) {\n life.abort(\"server abort\", [life.xhr, \"error\", \"server abort\"]);\n\n return;\n }\n\n if (doc.location.href === s.iframeSrc) {\n // response not received yet\n return;\n }\n\n unlisten(io, cb);\n\n var result = readResponse(doc, life.xhr, s, retry);\n\n if (result) {\n life.settle(result);\n }\n }\n\n // An exception while posting settles the upload with \"error\" and the exception.\n function post() {\n if (life.done()) {\n // aborted before the delayed post\n return;\n }\n\n try {\n doSubmit();\n } catch (err) {\n log(\"upload failed: \", err);\n life.fail(err);\n }\n }\n\n if (s.forceSync) {\n post();\n } else {\n setTimeout(post, 10); // this lets dom updates render\n }\n\n return life.deferred;\n }\n\n return function sendIframe(submission) {\n var jqxhr;\n\n // now, while the controls are still listed: ajaxSubmit clears the list when it returns,\n // before a closeKeepAlive request completes\n enableControls(submission.controls);\n\n // hack to fix Safari hang (thanks to Tim Molendijk for this)\n // see: http://groups.google.com/group/jquery-dev/browse_thread/thread/36395b7ab510dd5d\n if (submission.options.closeKeepAlive) {\n deprecate(\"closeKeepAlive\", \"closeKeepAlive works around a Safari 3/4 bug and is deprecated\");\n $.get(submission.options.closeKeepAlive, function () {\n jqxhr = fileUploadIframe(submission);\n });\n } else {\n jqxhr = fileUploadIframe(submission);\n }\n\n return jqxhr;\n };\n}\n","import { deprecate, log } from \"./diagnostics.js\";\nimport { assertRealParent } from \"./form-members.js\";\nimport jQuery from \"jquery\";\nimport { keepContext } from \"./options.js\";\nimport { urlencode } from \"./successful-controls.js\";\n\n// A Submission is one ajaxSubmit call once its vetoes have passed:\n// { form, $form, fields, controls, options, method, traditional }. `options` is the object the\n// callbacks and events receive; later steps change it in place.\n\n/**\n * The submission steps. `feature` holds what the entry detected at load (fileapi, formdata), and\n * `forms` reads form attributes and attr2-style properties (attribute, property), and\n * `serialization` collects the form's fields and controls.\n */\nexport function createSubmission(feature, forms, serialization) {\n var $ = jQuery;\n\n function refuse(message) {\n log(message);\n\n return null;\n }\n\n // The options merged over the form's action, the method, and the ajax defaults.\n function withDefaults(form, options, method) {\n var action = options.url || forms.property(form, \"action\");\n var url = typeof action === \"string\" ? action.trim() : \"\";\n\n // clean url (don't include hash value); an action that is only a fragment means this page\n url = url.split(\"#\")[0] || window.location.href.split(\"#\")[0];\n // IE requires javascript:false in https, but this breaks chrome >83 and goes against spec.\n // Instead of using javascript:false always, let's only apply it for IE.\n var isMsie = /(MSIE|Trident)/.test(navigator.userAgent || \"\");\n var iframeSrc = isMsie && /^https/i.test(document.URL) ? \"javascript:false\" : \"about:blank\"; // eslint-disable-line no-script-url\n\n var merged = $.extend(\n true,\n {\n url: url,\n success: $.ajaxSettings.success,\n type: method || $.ajaxSettings.type,\n iframeSrc: iframeSrc,\n },\n options\n );\n\n return keepContext(merged, [options]);\n }\n\n /**\n * The one method every transport sends, read after the hooks: `method` wins over `type`, and\n * `type` is set to it. Undefined when only the ajax default applies, so each transport keeps\n * its own default.\n */\n function resolveMethod(options, defaultType) {\n var resolved = options.method || options.type;\n\n options.type = resolved;\n\n return resolved === defaultType && !options.method ? undefined : resolved;\n }\n\n // The data option, kept as extraData and encoded, or undefined without one.\n function extraQuery(fields, options, traditional) {\n if (!options.data) {\n return undefined;\n }\n\n var optionsData = typeof options.data === \"function\" ? options.data(fields) : options.data;\n\n if (typeof optionsData === \"string\") {\n if (options.requestFormat === \"json\") {\n throw new Error(\n 'jquery.form: requestFormat \"json\" needs object data; a string data option is a query string'\n );\n }\n\n // a query string: sent as-is when urlencoded, as its own fields otherwise\n options.extraData = queryPairs(optionsData);\n\n return optionsData;\n }\n\n options.extraData = optionsData;\n\n return $.param(optionsData, traditional);\n }\n\n // Sets a key as an own data property, so a name like __proto__ is an ordinary key.\n function defineKey(object, key, value) {\n Object.defineProperty(object, key, {\n value: value,\n enumerable: true,\n writable: true,\n configurable: true,\n });\n }\n\n /**\n * requestFormat \"json\" (#545): the fields as an object (a repeated name gives an array), merged\n * with object data, sent as a JSON body. Based on the idea in PR #557 by zhangciwu.\n */\n function jsonBody(options, fields) {\n if (/^get$/i.test(options.type)) {\n throw new Error('jquery.form: requestFormat \"json\" needs a method with a body, such as POST');\n }\n\n var body = {};\n var own = Object.prototype.hasOwnProperty;\n\n for (var i = 0; i < fields.length; i++) {\n var name = fields[i].name;\n\n if (!own.call(body, name)) {\n defineKey(body, name, fields[i].value);\n } else if (Array.isArray(body[name])) {\n body[name].push(fields[i].value);\n } else {\n defineKey(body, name, [body[name], fields[i].value]);\n }\n }\n\n var extra = options.extraData;\n\n for (var key in extra) {\n if (own.call(extra, key)) {\n defineKey(body, key, extra[key]);\n }\n }\n\n options.data = JSON.stringify(body);\n options.contentType = \"application/json; charset=UTF-8\";\n }\n\n // The fields of a query string, as the { name, value } list $.param takes.\n function queryPairs(query) {\n var pairs = [];\n var parts = query.split(\"&\");\n\n for (var i = 0; i < parts.length; i++) {\n if (parts[i]) {\n var at = parts[i].indexOf(\"=\");\n var name = at < 0 ? parts[i] : parts[i].slice(0, at);\n var value = at < 0 ? \"\" : parts[i].slice(at + 1);\n\n pairs.push({ name: decodeQuery(name), value: decodeQuery(value) });\n }\n }\n\n return pairs;\n }\n\n function decodeQuery(text) {\n return decodeURIComponent(text.replace(/\\+/g, \" \"));\n }\n\n // Puts the encoded fields in the url for a get, and in the data otherwise.\n function encode(options, q, qx) {\n if (qx) {\n q = q ? q + \"&\" + qx : qx;\n }\n\n if (options.type.toUpperCase() === \"GET\") {\n // the query goes before any fragment in the url option\n var hashAt = options.url.indexOf(\"#\");\n var base = hashAt < 0 ? options.url : options.url.slice(0, hashAt);\n\n options.url =\n base + (base.indexOf(\"?\") >= 0 ? \"&\" : \"?\") + q + options.url.slice(base.length);\n options.data = null; // data is null for 'get'\n } else {\n options.data = q; // data is the query string for 'post'\n }\n }\n\n // A callback option as a list: an array as given, one function, or none.\n function callbackList(callback) {\n if (Array.isArray(callback)) {\n return callback;\n }\n\n return callback ? [callback] : [];\n }\n\n // Calls each callback in order with the same this and arguments.\n function callEach(callbacks, context, args) {\n for (var i = 0; i < callbacks.length; i++) {\n callbacks[i].apply(context, args);\n }\n }\n\n /**\n * Resolves the options, serializes the form, and runs the vetoes: the Submission, or null when\n * an event or callback stopped it.\n */\n function prepare($set, options) {\n $set.each(function () {\n assertRealParent(this);\n });\n\n var form = $set[0];\n var method = options.method || options.type || forms.property(form, \"method\");\n\n options = withDefaults(form, options, method);\n\n // the ajax default type, when neither the caller nor the form gave a method\n var defaultType = method ? undefined : options.type;\n\n // hook for manipulating the form data before it is extracted;\n // convenient for use with rich editors like tinyMCE or FCKEditor\n var veto = {};\n\n $set.trigger(\"form-pre-serialize\", [$set, options, veto]);\n if (veto.veto) {\n return refuse(\"ajaxSubmit: submit vetoed via form-pre-serialize trigger\");\n }\n\n // provide opportunity to alter form data before it is serialized\n if (options.beforeSerialize && options.beforeSerialize($set, options) === false) {\n return refuse(\"ajaxSubmit: submit aborted via beforeSerialize callback\");\n }\n\n var traditional = options.traditional;\n\n if (typeof traditional === \"undefined\") {\n traditional = $.ajaxSettings.traditional;\n }\n\n var collected = serialization.collect($set[0], options.semantic, options.filtering);\n var fields = collected.fields;\n var controls = collected.controls;\n var qx = extraQuery(fields, options, traditional);\n\n // give pre-submit callback an opportunity to abort the submit\n if (options.beforeSubmit && options.beforeSubmit(fields, $set, options) === false) {\n return refuse(\"ajaxSubmit: submit aborted via beforeSubmit callback\");\n }\n\n // fire vetoable 'validate' event\n $set.trigger(\"form-submit-validate\", [fields, $set, options, veto]);\n if (veto.veto) {\n return refuse(\"ajaxSubmit: submit vetoed via form-submit-validate trigger\");\n }\n\n method = resolveMethod(options, defaultType);\n\n if (options.requestFormat === \"json\") {\n jsonBody(options, fields);\n } else {\n encode(options, urlencode(fields, traditional), qx);\n }\n\n return {\n form: form,\n $form: $set,\n fields: fields,\n controls: controls,\n options: options,\n method: method,\n traditional: traditional,\n };\n }\n\n /**\n * Wraps success, error and complete (a function or an array of them, as $.ajax takes) so each\n * also receives the form, and adds the resetForm,\n * clearForm and target steps before the success callbacks.\n */\n function deliver(submission) {\n var $set = submission.$form;\n var options = submission.options;\n var callbacks = [];\n\n if (options.resetForm) {\n callbacks.push(function () {\n $set.resetForm();\n });\n }\n\n if (options.clearForm) {\n callbacks.push(function () {\n $set.clearForm(options.includeHidden);\n });\n }\n\n // perform a load on the target only if dataType is not provided\n if (!options.dataType && options.target) {\n var successes = callbackList(options.success);\n\n callbacks.push(function (data, textStatus, jqXHR) {\n var successArguments = arguments,\n fn = options.replaceTarget ? \"replaceWith\" : \"html\",\n $target = $(options.target);\n\n // Only a string response is inserted. jQuery has already parsed a JSON or XML response,\n // and inserting it would parse each of its strings as HTML.\n if (typeof data === \"string\") {\n $target[fn](data);\n } else {\n log(\"target: the response was parsed by jQuery, so it is not inserted\");\n }\n\n if (!$target.length) {\n // nothing to fill: success still runs once, with the normal context\n callEach(successes, this, successArguments);\n }\n\n $target.each(function () {\n callEach(successes, this, successArguments);\n });\n });\n } else {\n $.merge(callbacks, callbackList(options.success));\n }\n\n options.success = function (data, status, xhr) {\n // jQuery 1.4+ passes xhr as 3rd arg\n var context = options.context || this; // jQuery 1.4+ supports scope context\n\n for (var i = 0, max = callbacks.length; i < max; i++) {\n callbacks[i].apply(context, [data, status, xhr || $set, $set]);\n }\n };\n\n if (options.error) {\n var errors = callbackList(options.error);\n\n options.error = function (xhr, status, error) {\n callEach(errors, options.context || this, [xhr, status, error, $set]);\n };\n }\n\n if (options.complete) {\n var completes = callbackList(options.complete);\n\n options.complete = function (xhr, status) {\n callEach(completes, options.context || this, [xhr, status, $set]);\n };\n }\n }\n\n /**\n * The transport for a submission: \"iframe\" for files without the File API or when forced,\n * \"formdata\" for files with it, \"ajax\" otherwise.\n */\n function chooseTransport(submission) {\n var $set = submission.$form;\n var options = submission.options;\n\n // [value] (issue #113), also see comment:\n // https://github.com/malsup/form/commit/588306aedba1de01388032d5f42a60159eea9228#commitcomment-2180219\n // and the file inputs outside the form that belong to it through their form attribute\n var fileInputs = $(\"input[type=file]:enabled\", $set)\n .add($(submission.controls).filter(\"input[type=file]\"))\n .filter(function () {\n return $(this).val() !== \"\";\n });\n var hasFileInputs = fileInputs.length > 0;\n // compared as the browser does: ASCII case-insensitive, without surrounding whitespace\n var mp = /^[\\t\\n\\f\\r ]*multipart\\/form-data[\\t\\n\\f\\r ]*$/i;\n var multipart =\n mp.test(forms.attribute($set[0], \"enctype\")) || mp.test(forms.attribute($set[0], \"encoding\"));\n var fileAPI = feature.fileapi && feature.formdata;\n\n log(\"fileAPI :\" + fileAPI);\n\n var shouldUseFrame = (hasFileInputs || multipart) && !fileAPI;\n\n var transport = (hasFileInputs || multipart) && fileAPI ? \"formdata\" : \"ajax\";\n\n // options.iframe allows user to force iframe mode\n // 06-NOV-09: now defaulting to iframe mode if file input is detected\n if (options.iframe !== false && (options.iframe || shouldUseFrame)) {\n transport = \"iframe\";\n }\n\n if (transport === \"iframe\" && !options.iframe) {\n deprecate(\n \"iframe\",\n \"choosing the iframe transport automatically without FormData is deprecated, set iframe: true\"\n );\n }\n\n if (transport !== \"ajax\" && options.requestFormat === \"json\") {\n throw new Error(\n 'jquery.form: requestFormat \"json\" cannot send files or use the iframe transport'\n );\n }\n\n return transport;\n }\n\n return { prepare: prepare, deliver: deliver, chooseTransport: chooseTransport };\n}\n","/*!\n * jQuery Form Plugin\n * version: 4.5.0\n * Requires jQuery v1.7.2 or later\n * Project repository: https://github.com/jquery-form/form\n\n * Copyright 2017 Kevin Morris\n * Copyright 2006 M. Alsup\n\n * Dual licensed under the LGPL-2.1+ or MIT licenses\n * https://github.com/jquery-form/form#license\n\n * This library is free software; you can redistribute it and/or\n * modify it under the terms of the GNU Lesser General Public\n * License as published by the Free Software Foundation; either\n * version 2.1 of the License, or (at your option) any later version.\n * This library is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n */\nimport { ajaxForm, ajaxFormUnbind } from \"./ajax-form.js\";\nimport { callFormMethod, tagName } from \"./form-members.js\";\nimport {\n createSuccessfulControls,\n isSuccessful,\n urlencode,\n valueOf,\n} from \"./successful-controls.js\";\nimport { deprecate, deprecateOldJQuery, log } from \"./diagnostics.js\";\nimport { sendAjax, sendFormData } from \"./xhr-transport.js\";\nimport { createIframeTransport } from \"./iframe-transport.js\";\nimport { createSubmission } from \"./submission.js\";\nimport { formAttribute } from \"./form-attributes.js\";\nimport jQuery from \"jquery\";\nimport { submitOptions } from \"./options.js\";\nimport { submitterElement } from \"./submitter.js\";\n\n(function ($) {\n \"use strict\";\n\n /*\n\t\tUsage Note:\n\t\t-----------\n\t\tDo not use both ajaxSubmit and ajaxForm on the same form. These\n\t\tfunctions are mutually exclusive. Use ajaxSubmit if you want\n\t\tto bind your own submit handler to the form. For example,\n\n\t\t$(document).ready(function() {\n\t\t\t$('#myForm').on('submit', function(e) {\n\t\t\t\te.preventDefault(); // <-- important\n\t\t\t\t$(this).ajaxSubmit({\n\t\t\t\t\ttarget: '#output'\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\n\t\tUse ajaxForm when you want the plugin to manage all the event binding\n\t\tfor you. For example,\n\n\t\t$(document).ready(function() {\n\t\t\t$('#myForm').ajaxForm({\n\t\t\t\ttarget: '#output'\n\t\t\t});\n\t\t});\n\n\t\tYou can also use ajaxForm with delegation (requires jQuery v1.7+), so the\n\t\tform does not have to exist when you invoke ajaxForm:\n\n\t\t$('#myForm').ajaxForm({\n\t\t\tdelegation: true,\n\t\t\ttarget: '#output'\n\t\t});\n\n\t\tWhen using ajaxForm, the ajaxSubmit function will be invoked for you\n\t\tat the appropriate time.\n\t*/\n\n /**\n * Feature detection\n */\n var feature = {};\n\n feature.fileapi = $('').get(0).files !== undefined;\n feature.formdata = typeof window.FormData !== \"undefined\";\n\n var hasProp = !!$.fn.prop;\n // What attr2 returns for a form: the property when it is a string, otherwise the attribute. The\n // property is read plainly on purpose: a control named like it shadows it, and then the raw\n // attribute is used.\n function formProperty(form, name) {\n var value = hasProp ? form[name] : undefined;\n\n return typeof value === \"string\" ? value : formAttribute(form, name);\n }\n\n var forms = { attribute: formAttribute, property: formProperty };\n var serialization = createSuccessfulControls(feature);\n var steps = createSubmission(feature, forms, serialization);\n var transports = {\n iframe: createIframeTransport(hasProp, forms),\n formdata: sendFormData,\n ajax: sendAjax,\n };\n\n // attr2 uses prop when it can but checks the return type for\n // an expected string. This accounts for the case where a form\n // contains inputs with names like \"action\" or \"method\"; in those\n // cases \"prop\" returns the element\n $.fn.attr2 = function () {\n deprecate(\"attr2\", \"attr2 is deprecated, use .prop() or .attr()\");\n\n if (!hasProp) {\n return this.attr.apply(this, arguments);\n }\n\n var val = this.prop.apply(this, arguments);\n\n if ((val && val.jquery) || typeof val === \"string\") {\n return val;\n }\n\n return this.attr.apply(this, arguments);\n };\n\n /**\n * ajaxSubmit() provides a mechanism for immediately submitting\n * an HTML form using AJAX.\n *\n * @param\t{object|string}\toptions\t\tjquery.form.js parameters or custom url for submission\n * @param\t{object}\t\tdata\t\textraData\n * @param\t{string}\t\tdataType\tajax dataType\n * @param\t{function}\t\tonSuccess\tajax success callback function\n */\n $.fn.ajaxSubmit = function (options, data, dataType, onSuccess) {\n deprecateOldJQuery($.fn.jquery);\n\n // fast fail if nothing selected (http://dev.jquery.com/ticket/2752)\n if (!this.length) {\n log(\"ajaxSubmit: skipping submit process - no element selected\");\n\n return this;\n }\n\n // #541: jQuery's slim build has no $.ajax\n if (!$.ajax) {\n throw new Error(\n \"jquery.form: ajaxSubmit needs the full jQuery build; this jQuery has no $.ajax\"\n );\n }\n\n var submission = steps.prepare(this, submitOptions(options, data, dataType, onSuccess));\n\n if (!submission) {\n return this;\n }\n\n steps.deliver(submission);\n\n var jqxhr = transports[steps.chooseTransport(submission)](submission);\n\n this.removeData(\"jqxhr\").data(\"jqxhr\", jqxhr);\n\n // clear element array\n for (var k = 0; k < submission.controls.length; k++) {\n submission.controls[k] = null;\n }\n\n // fire 'notify' event\n this.trigger(\"form-submit-notify\", [this, submission.options]);\n\n return this;\n };\n\n $.fn.ajaxForm = ajaxForm;\n $.fn.ajaxFormUnbind = ajaxFormUnbind;\n\n /**\n * formToArray() gathers form element data into an array of objects that can\n * be passed to any of the following ajax functions: $.get, $.post, or load.\n * Each object in the array has both a 'name' and 'value' property. An example of\n * an array for a simple login form might be:\n *\n * [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ]\n *\n * It is this array that is passed to pre-submit callback functions provided to the\n * ajaxSubmit() and ajaxForm() methods.\n */\n $.fn.formToArray = function (semantic, elements, filtering) {\n var collected = serialization.collect(this[0], semantic, filtering);\n\n if (elements) {\n elements.push.apply(elements, collected.controls);\n }\n\n return collected.fields;\n };\n\n /**\n * Serializes form data into a 'submittable' string. This method will return a string\n * in the format: name1=value1&name2=value2\n */\n $.fn.formSerialize = function (semantic) {\n // hand off to jQuery.param for proper encoding\n return urlencode(this.formToArray(semantic));\n };\n\n /**\n * Serializes all field elements in the jQuery object into a query string.\n * This method will return a string in the format: name1=value1&name2=value2\n */\n $.fn.fieldSerialize = function (successful) {\n var a = [];\n\n this.each(function () {\n var n = this.name;\n\n // a form is not a field, though it may have a name\n if (!n || tagName(this) === \"form\") {\n return;\n }\n\n var v = $.fieldValue(this, successful);\n\n if (v && v.constructor === Array) {\n for (var i = 0, max = v.length; i < max; i++) {\n a.push({ name: n, value: v[i] });\n }\n } else if (v !== null && typeof v !== \"undefined\") {\n a.push({ name: this.name, value: v });\n }\n });\n\n // hand off to jQuery.param for proper encoding\n return urlencode(a);\n };\n\n /**\n * Returns the value(s) of the element in the matched set. For example, consider the following form:\n *\n *\t
\n *\t\t\n *\t\t\n *\t\t\n *\t\t\n *\t\t\n *\t\t\n *\t
\n *\n *\tvar v = $('input[type=text]').fieldValue();\n *\t// if no values are entered into the text inputs\n *\tv === ['','']\n *\t// if values entered into the text inputs are 'foo' and 'bar'\n *\tv === ['foo','bar']\n *\n *\tvar v = $('input[type=checkbox]').fieldValue();\n *\t// if neither checkbox is checked\n *\tv === undefined\n *\t// if both checkboxes are checked\n *\tv === ['B1', 'B2']\n *\n *\tvar v = $('input[type=radio]').fieldValue();\n *\t// if neither radio is checked\n *\tv === undefined\n *\t// if first radio is checked\n *\tv === ['C1']\n *\n * The successful argument controls whether or not the field element must be 'successful'\n * (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls).\n * The default value of the successful argument is true. If this value is false the value(s)\n * for each element is returned.\n *\n * Note: This method *always* returns an array. If no valid value can be determined the\n *\tarray will be empty, otherwise it will contain one or more values.\n */\n $.fn.fieldValue = function (successful) {\n for (var val = [], i = 0, max = this.length; i < max; i++) {\n var el = this[i];\n var v = $.fieldValue(el, successful);\n\n if (v === null || typeof v === \"undefined\" || (v.constructor === Array && !v.length)) {\n continue;\n }\n\n if (v.constructor === Array) {\n $.merge(val, v);\n } else {\n val.push(v);\n }\n }\n\n return val;\n };\n\n /**\n * Returns the value of the field element.\n */\n $.fieldValue = function (el, successful) {\n var required = typeof successful === \"undefined\" || successful;\n\n if (required && !isSuccessful(el, submitterElement(el.form))) {\n return null;\n }\n\n return valueOf(el);\n };\n\n /**\n * Clears the form data. Takes the following actions on the form's input fields:\n * - input text fields will have their 'value' property set to the empty string\n * - select elements will have their 'selectedIndex' property set to -1\n * - checkbox and radio inputs will have their 'checked' property set to false\n * - inputs of type submit, button, reset, and hidden will *not* be effected\n * - button elements will *not* be effected\n */\n $.fn.clearForm = function (includeHidden) {\n return this.each(function () {\n $(\"input,select,textarea\", this).clearFields(includeHidden);\n });\n };\n\n /**\n * Clears the selected form elements.\n */\n $.fn.clearInputs = function (includeHidden) {\n deprecate(\"clearInputs\", \"clearInputs is deprecated, use clearFields\");\n\n return this.clearFields(includeHidden);\n };\n\n $.fn.clearFields = function (includeHidden) {\n var re =\n /^(?:color|date|datetime|datetime-local|email|month|number|password|range|search|tel|text|time|url|week)$/i; // 'hidden' is not in this list\n\n return this.each(function () {\n var t = this.type,\n tag = tagName(this);\n\n if (re.test(t) || tag === \"textarea\") {\n this.value = \"\";\n } else if (t === \"checkbox\" || t === \"radio\") {\n this.checked = false;\n } else if (tag === \"select\") {\n this.selectedIndex = -1;\n } else if (t === \"file\") {\n if (/MSIE/.test(navigator.userAgent)) {\n $(this).replaceWith($(this).clone(true));\n } else {\n $(this).val(\"\");\n }\n } else if (includeHidden) {\n // includeHidden can be the value true, or it can be a selector string\n // indicating a special test; for example:\n // $('#myForm').clearForm('.special:hidden')\n // the above would clean hidden inputs that have the class of 'special'\n if (\n (includeHidden === true && /hidden/.test(t)) ||\n (typeof includeHidden === \"string\" && $(this).is(includeHidden))\n ) {\n this.value = \"\";\n }\n }\n });\n };\n\n /**\n * Resets the form data or individual elements. Takes the following actions\n * on the selected tags:\n * - all fields within form elements will be reset to their original value\n * - input / textarea / select fields will be reset to their original value\n * - option / optgroup fields (for multi-selects) will defaulted individually\n * - non-multiple options will find the right select to default\n * - label elements will be searched against its 'for' attribute\n * - all others will be searched for appropriate children to default\n */\n $.fn.resetForm = function () {\n return this.each(function () {\n var el = $(this);\n var tag = tagName(this);\n\n switch (tag) {\n case \"input\":\n this.checked = this.defaultChecked;\n\n // as the native reset: types whose value is the value attribute keep it\n if (this.type === \"file\") {\n // a file input cannot take its value attribute; the native reset empties it\n this.value = \"\";\n } else if (!/^(?:checkbox|radio|hidden|submit|reset|button|image)$/.test(this.type)) {\n this.value = this.defaultValue;\n }\n\n return true;\n\n case \"textarea\":\n this.value = this.defaultValue;\n\n return true;\n\n case \"option\":\n case \"optgroup\":\n var select = el.parents(\"select\");\n\n if (select.length && select[0].multiple) {\n if (tag === \"option\") {\n this.selected = this.defaultSelected;\n } else {\n el.find(\"option\").resetForm();\n }\n } else {\n select.resetForm();\n }\n\n return true;\n\n case \"select\":\n // in order, as the native reset: of several default options, a single select keeps the last\n el.find(\"option\").each(function () {\n this.selected = this.defaultSelected;\n });\n\n return true;\n\n case \"label\":\n // The control whose id the for attribute names, and the controls inside the label. The\n // filter keeps a for that names an ancestor from resetting the label again.\n var forEl = this.htmlFor && this.ownerDocument.getElementById(this.htmlFor);\n\n el.find(\"input,select,textarea\").add(forEl).filter(\"input,select,textarea\").resetForm();\n\n return true;\n\n case \"form\":\n // through the prototype: a control named reset shadows the method\n callFormMethod(this, \"reset\");\n\n return true;\n\n default:\n el.find(\"form,input,label,select,textarea\").resetForm();\n\n return true;\n }\n });\n };\n\n /**\n * Enables or disables any matching elements.\n */\n $.fn.enable = function (b) {\n if (typeof b === \"undefined\") {\n b = true;\n }\n\n return this.each(function () {\n this.disabled = !b;\n });\n };\n\n /**\n * Checks/unchecks any matching checkboxes or radio buttons and\n * selects/deselects and matching option elements.\n */\n $.fn.selected = function (select) {\n if (typeof select === \"undefined\") {\n select = true;\n }\n\n return this.each(function () {\n var t = this.type;\n\n if (t === \"checkbox\" || t === \"radio\") {\n this.checked = select;\n } else if (tagName(this) === \"option\") {\n var $sel = $(this).parent(\"select\");\n\n if (select && $sel[0] && $sel[0].type === \"select-one\") {\n // deselect all other options\n $sel.find(\"option\").selected(false);\n }\n\n this.selected = select;\n }\n });\n };\n\n // expose debug var\n $.fn.ajaxSubmit.debug = false;\n})(jQuery);\n\nexport default jQuery;\n"],"names":["owners","plainForm","document","createElement","findDescriptor","name","i","length","owner","window","descriptor","Object","getOwnPropertyDescriptor","prototype","formMember","form","get","call","e","callFormMethod","value","apply","Array","slice","arguments","tagName","el","toLowerCase","isElement","node","assertRealParent","parentNode","Error","closestByTag","names","indexOf","storeKey","setExpando","ignore","expando","els","namedItem","undefined","record","x","y","jQuery","data","type","setTimeout","captureSubmitter","target","point","offsetX","offsetY","fn","offset","pageX","left","pageY","top","offsetLeft","offsetTop","imagePoint","submitterOf","stored","log","ajaxSubmit","debug","msg","join","console","opera","postError","warned","deprecate","id","message","warn","deprecateOldJQuery","version","parts","String","split","major","Number","beforeJQuery35","shorthandOptions","options","dataType","onSuccess","result","url","success","submitOptions","key","hasOwnProperty","withoutUrl","keepContext","settings","sources","context","submitWith","isDefaultPrevented","preventDefault","originalEvent","submitter","captureEventSubmitter","doAjaxSubmit","captureSubmittingElement","this","bindDelegated","$sel","selector","off","on","closestMatch","Element","closest","is","delegated","unbindSelector","handlers","submit","click","selectionOnly","ajaxForm","jquery","delegation","bindSelector","beforeFormUnbind","ajaxFormUnbind","o","s","c","isReady","bindLater","formAttribute","attr","rLineBreak","rCR","rUnsubmittable","isDisabled","matches","disabled","valueOf","index","selectedIndex","a","ops","one","max","op","selected","v","attributes","specified","text","push","selectValue","val","raw","replace","loneSurrogate","wellFormed","match","before","urlencode","fields","traditional","param","map","field","urlencodedFields","createSuccessfulControls","feature","$","controlsOf","semantic","formId","getElementsByTagName","makeArray","grep","ownedBy","test","navigator","userAgent","concat","filter","getAttribute","inArray","outsideControls","fieldsOf","n","fieldValue","constructor","fileapi","files","file","required","imageFields","sub","input","addCandidate","collected","own","controls","collect","filtering","addClickedImage","deepSerialize","extraData","part","serialized","len","decodeURIComponent","sendFormData","submission","formdata","FormData","append","serializedData","extend","ajaxSettings","contentType","processData","cache","method","uploadProgress","createXhr","xhr","upload","addEventListener","event","percent","position","loaded","total","lengthComputable","Math","ceil","beforeSend","formData","ajax","sendAjax","uploadAttributes","hasOwn","isGet","addSubmitterFields","submitterFields","addCsrfField","forms","origin","csrf_token","csrf_param","posts","property","href","location","protocol","host","setFormAttribute","getDoc","frame","doc","contentWindow","err","contentDocument","readStatus","status","statusText","readResponse","retry","errMsg","isXml","XMLDocument","isXMLDoc","body","innerHTML","docRoot","documentElement","responseText","responseXML","getResponseHeader","header","readDocument","dt","scr","textarea","ta","pre","b","textContent","innerText","readEmbedded","ct","xml","nodeName","error","dataFilter","JSON","parse","globalEval","httpData","createLifecycle","g","timeoutHandle","callbackProcessed","deferred","Deferred","aborted","getAllResponseHeaders","setRequestHeader","abort","done","rejection","textStatus","stop","reject","trigger","complete","endGlobalEvents","active","clearTimeout","release","settle","failure","resolve","succeed","start","global","fail","startTimer","onTimeout","timeout","stopTimer","createIframeTransport","hasProp","frameCount","fileUploadIframe","ownerDocument","$body","$io","iframeTarget","each","nameWindow","io","setAttribute","iframeSrc","css","createFrame","Date","getTime","life","execCommand","remove","frameHooks","domCheckCount","checkState","state","readyState","cb","doSubmit","saved","saveAttributes","mp","skipEncodingOverride","setUploadAttributes","extraInputs","added","addHiddenInput","appendTo","isPlainObject","single","f","addExtraInputs","root","contains","notInDocument","attachEvent","listen","submitForm","restoreAttributes","detachEvent","removeEventListener","unlisten","post","forceSync","jqxhr","elements","prop","removeAttr","enableControls","closeKeepAlive","createSubmission","serialization","refuse","extraQuery","optionsData","requestFormat","query","pairs","at","decodeQuery","queryPairs","defineKey","object","defineProperty","enumerable","writable","configurable","callbackList","callback","isArray","callEach","callbacks","args","prepare","$set","action","trim","URL","withDefaults","defaultType","veto","beforeSerialize","qx","beforeSubmit","resolved","resolveMethod","extra","stringify","jsonBody","q","toUpperCase","hashAt","base","encode","$form","deliver","resetForm","clearForm","includeHidden","successes","jqXHR","successArguments","replaceTarget","$target","merge","errors","completes","chooseTransport","hasFileInputs","add","multipart","attribute","fileAPI","shouldUseFrame","transport","iframe","steps","transports","attr2","removeData","k","formToArray","formSerialize","fieldSerialize","successful","t","checked","isSuccessful","clearFields","clearInputs","re","tag","replaceWith","clone","defaultChecked","defaultValue","select","parents","multiple","defaultSelected","find","forEl","htmlFor","getElementById","enable","parent"],"mappings":";;;;;;;;;;;;;;;;;;;;;4ZAMIA,EAAS,CAAC,kBAAmB,cAAe,UAAW,QAGvDC,EAAYC,EAASC,cAAc,QAEvC,SAASC,EAAeC,GACtB,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AKtB,YAJiB,IAANA,IACTA,GAAI,GAGCrL,KAAK0O,KAAK,WACf1O,KAAKkC,UAAYmJ,CACnB,EACF,EAMAnH,EAAEzH,GAAGkG,SAAW,SAAUuU,GAKxB,YAJsB,IAAXA,IACTA,GAAS,GAGJlX,KAAK0O,KAAK,WACf,IAAI6H,EAAIvW,KAAK9D,KAEb,GAAU,aAANqa,GAA0B,UAANA,EACtBvW,KAAKwW,QAAUU,OACV,GAAsB,WAAlBvc,EAAQqF,MAAoB,CACrC,IAAIE,EAAOgE,EAAElE,MAAM2X,OAAO,UAEtBT,GAAUhX,EAAK,IAAuB,eAAjBA,EAAK,GAAGhE,MAE/BgE,EAAKoX,KAAK,UAAU3U,UAAS,GAG/B3C,KAAK2C,SAAWuU,CAClB,CACF,EACF,EAGAhT,EAAEzH,GAAGY,WAAWC,OAAQ,CACzB,CAlcD,CAkcGtB"} \ No newline at end of file +{"version":3,"file":"jquery.form.min.js","sources":["../src/form-members.js","../src/submitter.js","../src/diagnostics.js","../src/options.js","../src/ajax-form.js","../src/form-attributes.js","../src/successful-controls.js","../src/xhr-transport.js","../src/iframe-post.js","../src/iframe-response.js","../src/iframe-lifecycle.js","../src/iframe-transport.js","../src/submission.js","../src/jquery.form.js"],"sourcesContent":["// Form members: the properties and methods the plugin reads or calls on a form. A control named\n// like a member (elements, setAttribute) shadows that member on the form itself, so members are\n// read through the DOM prototypes, which a control cannot shadow.\n\n// The prototype chain of a form, nearest first. Looked up on every call: old browsers have no\n// DOM prototypes, and tests remove them.\nvar owners = [\"HTMLFormElement\", \"HTMLElement\", \"Element\", \"Node\"];\n\n// A form no control can shadow, for methods when the DOM has no prototypes to read them from.\nvar plainForm = document.createElement(\"form\");\n\nfunction findDescriptor(name) {\n for (var i = 0; i < owners.length; i++) {\n var owner = window[owners[i]];\n var descriptor = owner && Object.getOwnPropertyDescriptor(owner.prototype, name);\n\n if (descriptor) {\n return descriptor;\n }\n }\n\n return null;\n}\n\n/**\n * Reads a member of a form through its prototype getter.\n * Falls back to the plain property without DOM prototypes, or on an element the getter does not\n * accept (such as a fieldset for `elements`).\n */\nexport function formMember(form, name) {\n var descriptor = findDescriptor(name);\n\n try {\n return descriptor.get.call(form);\n } catch (e) {\n return form[name];\n }\n}\n\n/**\n * Calls a method of a form through its prototype, or through an unshadowed form without DOM\n * prototypes.\n */\nexport function callFormMethod(form, name) {\n var descriptor = findDescriptor(name);\n var method = descriptor ? descriptor.value : plainForm[name];\n\n return method.apply(form, Array.prototype.slice.call(arguments, 2));\n}\n\n// Nodes such as the document and text nodes have no tag name (#600).\nexport function tagName(el) {\n var name = formMember(el, \"tagName\");\n\n return typeof name === \"string\" ? name.toLowerCase() : \"\";\n}\n\n/**\n * Whether a control or option is disabled, also through a disabled fieldset or optgroup. Without\n * selector matching, only its own disabled property is read.\n */\nexport function isDisabled(el) {\n return typeof el.matches === \"function\" ? el.matches(\":disabled\") : !!el.disabled;\n}\n\n// Elements only: the subject of formToArray may also be the document or a plain object.\nexport function isElement(node) {\n return formMember(node, \"nodeType\") === 1;\n}\n\n// A control named parentNode makes every parentNode walk (jQuery's trigger and closest among\n// them) cycle between the form and the control.\nexport function assertRealParent(el) {\n if (el.parentNode !== formMember(el, \"parentNode\")) {\n throw new Error(\n 'jquery.form: a form control named \"parentNode\" hides the form\\'s parentNode; rename the control'\n );\n }\n}\n\n// The element itself or its nearest ancestor with one of the tag names, through the real tree.\nexport function closestByTag(el, names) {\n for (var node = el; node; node = formMember(node, \"parentNode\")) {\n if (names.indexOf(tagName(node)) >= 0) {\n return node;\n }\n }\n\n return null;\n}\n","import { closestByTag, formMember, isDisabled } from \"./form-members.js\";\nimport jQuery from \"jquery\";\n\n// The submitter: the button that submitted a form, captured from ajaxForm's clicks. It is kept in\n// a private store and cleared shortly after the click. The form's clk, clk_x and clk_y properties\n// are still written for pages that read them, and read when the store has none.\n\nvar storeKey = \"jqFormSubmitter\";\n\n// Writes a property on the form; a control with that name makes it read-only.\nfunction setExpando(form, name, value) {\n try {\n form[name] = value;\n } catch (ignore) {\n // the control keeps the name; the store has the submitter\n }\n}\n\n// A property the page set on the form, never a control of the form with that name.\nfunction expando(form, name) {\n var value = form[name];\n var els = formMember(form, \"elements\");\n\n return els && value && els.namedItem(name) === value ? undefined : value;\n}\n\n// Records a submitter for a form until the click window ends.\nfunction record(form, el, x, y) {\n jQuery.data(form, storeKey, { el: el, x: x, y: y });\n setExpando(form, \"clk\", el);\n\n if (el.type === \"image\") {\n setExpando(form, \"clk_x\", x);\n setExpando(form, \"clk_y\", y);\n }\n\n // clear form vars\n setTimeout(function () {\n jQuery.data(form, storeKey, null);\n setExpando(form, \"clk\", null);\n setExpando(form, \"clk_x\", null);\n setExpando(form, \"clk_y\", null);\n }, 100);\n}\n\n// The clicked point of an image button, relative to the image.\nfunction imagePoint(e, target) {\n if (typeof e.offsetX !== \"undefined\") {\n return [e.offsetX, e.offsetY];\n }\n\n if (typeof jQuery.fn.offset === \"function\") {\n var offset = jQuery(target).offset();\n\n return [e.pageX - offset.left, e.pageY - offset.top];\n }\n\n return [e.pageX - target.offsetLeft, e.pageY - target.offsetTop];\n}\n\n/**\n * Records the submit or image button a click event reached, for the form it belongs to.\n */\nexport function captureSubmitter(e) {\n // the clicked control, or the button around the clicked content (ex: a span within a button)\n var target = closestByTag(e.target, [\"button\", \"input\"]);\n\n // the type property, unlike the attribute, is \"submit\" for a button without a type (#588)\n if (!target || (target.type !== \"submit\" && target.type !== \"image\")) {\n return;\n }\n\n var form = target.form;\n\n if (!form) {\n // a submit control that belongs to no form\n return;\n }\n\n var point = target.type === \"image\" ? imagePoint(e, target) : [];\n\n record(form, target, point[0], point[1]);\n}\n\n/**\n * Records the submitter a submit event names (SubmitEvent.submitter), when no click was captured.\n * An image submitter gets the point 0,0, as native submission sends it without a click.\n */\nexport function captureEventSubmitter(e, form) {\n var el = e.originalEvent && e.originalEvent.submitter;\n\n if (el && !submitterOf(form)) {\n record(form, el, 0, 0);\n }\n}\n\n/**\n * The form's submitter as { el, x, y } (x and y for an image button), or null.\n */\nexport function submitterOf(form) {\n if (!form) {\n return null;\n }\n\n var stored = jQuery.data(form, storeKey);\n\n if (stored) {\n return stored;\n }\n\n var el = expando(form, \"clk\");\n\n return el ? { el: el, x: expando(form, \"clk_x\"), y: expando(form, \"clk_y\") } : null;\n}\n\n/**\n * The submitter's fields for a post that adds them itself (the iframe upload), as name β†’ value.\n */\nexport function submitterFields(form) {\n var fields = {};\n var sub = submitterOf(form);\n var el = sub && sub.el;\n\n // a disabled button is not sent, also when a disabled fieldset disables it\n if (el && el.name && !isDisabled(el)) {\n fields[el.name] = el.value;\n if (el.type === \"image\") {\n fields[el.name + \".x\"] = sub.x;\n fields[el.name + \".y\"] = sub.y;\n }\n }\n\n return fields;\n}\n\n/**\n * The form's submitter element, or null.\n */\nexport function submitterElement(form) {\n var sub = submitterOf(form);\n\n return sub ? sub.el : null;\n}\n","import jQuery from \"jquery\";\n\n// Debug logging, switched on by $.fn.ajaxSubmit.debug. The flag is read on every call, so it can\n// be turned on after the plugin loads.\nexport function log() {\n if (!jQuery.fn.ajaxSubmit.debug) {\n return;\n }\n\n var msg = \"[jquery.form] \" + Array.prototype.join.call(arguments, \"\");\n\n if (window.console && window.console.log) {\n window.console.log(msg);\n } else if (window.opera && window.opera.postError) {\n window.opera.postError(msg);\n }\n}\n\nvar warned = {};\n\n/**\n * A deprecation warning: console.warn, only while debug is on, once per id per page. The message\n * names the replacement; the warning adds that the feature is removed in 5.0.\n */\nexport function deprecate(id, message) {\n if (!jQuery.fn.ajaxSubmit.debug || warned[id]) {\n return;\n }\n\n warned[id] = true;\n\n if (window.console && typeof window.console.warn === \"function\") {\n window.console.warn(\"[jquery.form] \" + message + \" (removed in 5.0)\");\n }\n}\n\n// Forgets which deprecations have warned (for tests).\nexport function resetDeprecations() {\n warned = {};\n}\n\n// True for a jQuery version string older than 3.5.\nexport function beforeJQuery35(version) {\n var parts = String(version).split(\".\");\n var major = Number(parts[0]);\n\n return major < 3 || (major === 3 && Number(parts[1]) < 5);\n}\n\n// 5.0 needs jQuery 3.5 or later: warned on the first ajaxSubmit or ajaxForm, given jQuery's version.\nexport function deprecateOldJQuery(version) {\n if (beforeJQuery35(version)) {\n deprecate(\n \"jquery\",\n \"support for jQuery \" + version + \" is deprecated, 5.0 needs jQuery 3.5 or later\"\n );\n }\n}\n","// The arguments ajaxSubmit and ajaxForm accept in place of an options object.\n\n/**\n * Turns the (url, data, dataType, success) shorthand into options. A url of false is kept as\n * the url; anything else is returned as given.\n */\nexport function shorthandOptions(options, data, dataType, onSuccess) {\n if (typeof options !== \"string\" && options !== false) {\n return options;\n }\n\n var result = { url: options, data: data, dataType: dataType };\n\n if (typeof onSuccess === \"function\") {\n result.success = onSuccess;\n }\n\n return result;\n}\n\n// A copy of options without its url, so the form action is used.\nfunction withoutUrl(options) {\n var result = {};\n\n for (var key in options) {\n if (key !== \"url\" && Object.prototype.hasOwnProperty.call(options, key)) {\n result[key] = options[key];\n }\n }\n\n return result;\n}\n\n/**\n * The options ajaxSubmit starts from: a function is the success callback, the shorthand is\n * expanded, and no options at all is an empty object. A url of false or \"\" means the form action.\n */\nexport function submitOptions(options, data, dataType, onSuccess) {\n if (typeof options === \"function\") {\n return { success: options };\n }\n\n options = shorthandOptions(options, data, dataType, onSuccess);\n\n if (typeof options === \"undefined\") {\n return {};\n }\n\n return options.url === false || options.url === \"\" ? withoutUrl(options) : options;\n}\n\n/**\n * jQuery treats `context` as a flat option: after a deep merge, the settings get back the\n * caller's own object from the last source that has one, so `this` in callbacks is that object.\n */\nexport function keepContext(settings, sources) {\n for (var i = 0; i < sources.length; i++) {\n if (sources[i].context !== undefined) {\n settings.context = sources[i].context;\n }\n }\n\n return settings;\n}\n","import { assertRealParent, closestByTag, formMember, isElement } from \"./form-members.js\";\nimport { captureEventSubmitter, captureSubmitter } from \"./submitter.js\";\nimport { deprecate, deprecateOldJQuery, log } from \"./diagnostics.js\";\nimport jQuery from \"jquery\";\nimport { shorthandOptions } from \"./options.js\";\n\n// ajaxForm binding: the submit and click handlers that send a form through ajaxSubmit. The\n// handlers look up $.fn.ajaxSubmit when they run, so a replacement installed later is used.\n\n// Sends the submit event's form with ajaxSubmit, unless an earlier handler cancelled it.\nfunction submitWith(e, options) {\n if (!e.isDefaultPrevented()) {\n // if event has been canceled, don't proceed\n e.preventDefault();\n // the form is found through the real tree: a control named nodeType misleads jQuery's closest\n var form = closestByTag(e.target, [\"form\"]);\n\n // a button outside the form (form attribute), or requestSubmit(button), sends no click here\n captureEventSubmitter(e, form);\n jQuery(form).ajaxSubmit(options); // #365\n }\n}\n\nfunction doAjaxSubmit(e) {\n submitWith(e, e.data);\n}\n\nfunction captureSubmittingElement(e) {\n /* jshint validthis:true */\n assertRealParent(this);\n captureSubmitter(e);\n}\n\n// An empty selection: queued until the DOM is ready (old jQuery keeps the selector), or dropped.\nfunction bindLater($sel, options) {\n var o = { s: $sel.selector, c: $sel.context };\n\n if (!jQuery.isReady && o.s) {\n log(\"DOM not ready, queuing ajaxForm\");\n deprecate(\n \"queue\",\n \"queuing ajaxForm until the DOM is ready is deprecated, call ajaxForm inside $(fn) \" +\n 'or use delegation: \"\"'\n );\n jQuery(function () {\n jQuery(o.s, o.c).ajaxForm(options);\n });\n\n return $sel;\n }\n\n // is your DOM ready? http://docs.jquery.com/Tutorials:Introducing_$(document).ready()\n log(\"terminating; zero elements found by selector\" + (jQuery.isReady ? \"\" : \" (DOM not ready)\"));\n\n return $sel;\n}\n\n// delegation: true on jQuery 3 and later, where the selection has no selector: always warned,\n// debug or not, once per ajaxForm call.\nfunction warnUnscoped() {\n var console = window.console || {};\n\n if (typeof console.warn === \"function\") {\n console.warn(\n \"[jquery.form] delegation: true binds every form on the page on jQuery 3 and later; \" +\n 'pass a selector instead, e.g. delegation: \"form.ajax\"'\n );\n }\n}\n\nfunction bindDelegated($sel, options) {\n if ($sel.selector === undefined) {\n warnUnscoped();\n }\n\n jQuery(document)\n .off(\"submit.form-plugin\", $sel.selector, doAjaxSubmit)\n .off(\"click.form-plugin\", $sel.selector, captureSubmittingElement)\n .on(\"submit.form-plugin\", $sel.selector, options, doAjaxSubmit)\n .on(\"click.form-plugin\", $sel.selector, options, captureSubmittingElement);\n\n return $sel;\n}\n\n// The element itself or its nearest ancestor that matches the selector. The walk never reads a\n// parentNode a control can hide (jQuery's delegated walk does, and cycles on such a form).\nfunction closestMatch(el, selector) {\n if (!isElement(el)) {\n return null;\n }\n\n if (window.Element && Element.prototype.closest) {\n return Element.prototype.closest.call(el, selector);\n }\n\n for (var node = el; node && isElement(node); node = formMember(node, \"parentNode\")) {\n if (jQuery(node).is(selector)) {\n return node;\n }\n }\n\n return null;\n}\n\n// The document handlers bound for each delegation selector, keyed by \"s\" + selector.\nvar delegated = {};\n\nfunction unbindSelector(selector) {\n var handlers = delegated[\"s\" + selector];\n\n if (handlers) {\n jQuery(document)\n .off(\"submit.form-plugin\", handlers.submit)\n .off(\"click.form-plugin\", handlers.click);\n delete delegated[\"s\" + selector];\n }\n}\n\n// delegation: \"\": one handler pair on the document, scoped to the selector.\nfunction bindSelector($sel, selector, options) {\n if (!selector) {\n throw new Error(\"jquery.form: delegation needs a selector, or true\");\n }\n\n var handlers = {\n submit: function (e) {\n if (closestMatch(e.target, selector)) {\n submitWith(e, options);\n }\n },\n click: function (e) {\n if (closestMatch(e.target, selector)) {\n captureSubmitter(e);\n }\n },\n };\n\n unbindSelector(selector);\n delegated[\"s\" + selector] = handlers;\n jQuery(document)\n .on(\"submit.form-plugin\", handlers.submit)\n .on(\"click.form-plugin\", handlers.click);\n\n return $sel;\n}\n\n// Passed by ajaxForm's own rebind: unbind the selection only, never the document handlers.\nvar selectionOnly = {};\n\n/**\n * ajaxForm() binds the selected forms so a submit is sent with ajaxSubmit, with the clicked\n * submit button (and image coordinates) included. The options work as for ajaxSubmit.\n */\nexport function ajaxForm(options, data, dataType, onSuccess) {\n deprecateOldJQuery(jQuery.fn.jquery);\n options = shorthandOptions(options, data, dataType, onSuccess) || {};\n\n if (typeof options.delegation === \"string\") {\n return bindSelector(this, options.delegation, options);\n }\n\n options.delegation = options.delegation && typeof jQuery.fn.on === \"function\";\n\n if (!options.delegation && this.length === 0) {\n return bindLater(this, options);\n }\n\n if (options.delegation) {\n return bindDelegated(this, options);\n }\n\n if (options.beforeFormUnbind) {\n options.beforeFormUnbind(this, options);\n }\n\n return this.ajaxFormUnbind(selectionOnly)\n .on(\"submit.form-plugin\", options, doAjaxSubmit)\n .on(\"click.form-plugin\", options, captureSubmittingElement);\n}\n\n/**\n * ajaxFormUnbind() removes the handlers ajaxForm bound on the selection and every delegated\n * binding on the document. ajaxFormUnbind(selector) removes only that delegation selector.\n */\nexport function ajaxFormUnbind(selector) {\n if (typeof selector === \"string\") {\n unbindSelector(selector);\n\n return this;\n }\n\n if (selector !== selectionOnly) {\n delegated = {};\n jQuery(document).off(\"submit.form-plugin click.form-plugin\");\n }\n\n return this.off(\"submit.form-plugin click.form-plugin\");\n}\n","import { callFormMethod, isElement } from \"./form-members.js\";\nimport jQuery from \"jquery\";\n\n/**\n * An attribute of a form, or undefined when it is absent, as jQuery's attr returns it. The\n * subject may also be the document or a plain object, read through jQuery.\n */\nexport function formAttribute(form, name) {\n if (!isElement(form)) {\n return jQuery(form).attr(name);\n }\n\n var value = callFormMethod(form, \"getAttribute\", name);\n\n return value === null ? undefined : value;\n}\n","import { callFormMethod, formMember, isDisabled, isElement, tagName } from \"./form-members.js\";\nimport { formAttribute } from \"./form-attributes.js\";\nimport jQuery from \"jquery\";\nimport { submitterOf } from \"./submitter.js\";\n\n// Successful controls: which controls of a form are sent, and as which name/value fields\n// (https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#constructing-the-form-data-set).\n\n// Line breaks, sent as CRLF\nvar rLineBreak = /\\r\\n|\\r|\\n/g;\nvar rCR = /\\r/g;\n\n// Listed form elements that are never submitted.\nvar rUnsubmittable = /^(?:fieldset|object|output)$/;\n\n/**\n * The successful-control rule: whether a control is sent. `submitter` is the button that\n * submitted the control's form; other submit and image buttons of a form are not sent.\n */\nexport function isSuccessful(el, submitter) {\n var t = el.type;\n\n if (!el.name || isDisabled(el) || t === \"reset\" || t === \"button\") {\n return false;\n }\n\n if (t === \"checkbox\" || t === \"radio\") {\n return !!el.checked;\n }\n\n if (t === \"submit\" || t === \"image\") {\n return !el.form || submitter === el;\n }\n\n return tagName(el) !== \"select\" || el.selectedIndex !== -1;\n}\n\n// The value of a select: the selected option's value for one, a list for several.\nfunction selectValue(el) {\n var index = el.selectedIndex;\n\n if (index < 0) {\n return null;\n }\n\n var a = [],\n ops = el.options;\n var one = el.type === \"select-one\";\n var max = one ? index + 1 : ops.length;\n\n for (var i = one ? index : 0; i < max; i++) {\n var op = ops[i];\n\n if (op.selected && !isDisabled(op)) {\n var v = op.value;\n\n if (!v) {\n // extra pain for IE...\n v =\n op.attributes && op.attributes.value && !op.attributes.value.specified\n ? op.text\n : op.value;\n }\n\n if (one) {\n return v;\n }\n\n a.push(v);\n }\n }\n\n return a;\n}\n\n/**\n * The value of a control, whether or not it is successful: a list for a multiple select, null\n * for a select with nothing selected, otherwise a string with CRLF line breaks (a lone CR or LF\n * included).\n */\nexport function valueOf(el) {\n if (tagName(el) === \"select\") {\n return selectValue(el);\n }\n\n var v = jQuery(el).val();\n var raw = el.value;\n\n // jQuery before 4.0 drops carriage returns from .val(); read them from the value itself\n if (typeof raw === \"string\" && raw.replace(rCR, \"\") === v) {\n v = raw;\n }\n\n return v.replace(rLineBreak, \"\\r\\n\");\n}\n\n/**\n * The fields as a urlencoded body sends them: a selected file as its name.\n */\n// A lone surrogate becomes U+FFFD, as in a native submission; jQuery.param would throw.\nvar loneSurrogate = /[\\uD800-\\uDBFF](?![\\uDC00-\\uDFFF])|([^\\uD800-\\uDBFF]|^)([\\uDC00-\\uDFFF])/g;\n\nexport function wellFormed(value) {\n return typeof value === \"string\"\n ? value.replace(loneSurrogate, function (match, before) {\n return (before || \"\") + \"\\uFFFD\";\n })\n : value;\n}\n\n// jQuery 3 dropped $.param's \"+\" for a space; a native submission still sends \"+\". Only a space\n// encodes as %20, since a literal % encodes as %25.\nexport function urlencode(fields, traditional) {\n return jQuery.param(urlencodedFields(fields), traditional).replace(/%20/g, \"+\");\n}\n\nexport function urlencodedFields(fields) {\n return jQuery.map(fields, function (field) {\n var value =\n field.type === \"file\" && typeof field.value !== \"string\" ? field.value.name : field.value;\n var name = wellFormed(field.name);\n value = wellFormed(value);\n\n return name === field.name && value === field.value ? field : { name: name, value: value };\n });\n}\n\n/**\n * The serialization steps. `feature` holds what the entry detected at load (fileapi).\n */\nexport function createSuccessfulControls(feature) {\n var $ = jQuery;\n\n // #386; inputs that name the form in their form attribute, other than the candidates found.\n // A form only gets the ones it owns.\n function outsideControls(formId, els, owner) {\n // hat tip @thet; the id is compared, never built into a selector\n return $(\":input[form]\")\n .filter(function () {\n return (\n this.getAttribute(\"form\") === formId &&\n (!owner || this.form === owner) &&\n $.inArray(this, els) < 0\n );\n })\n .get();\n }\n\n // A descendant of a form is a candidate unless it is a control another form owns.\n function ownedBy(els, owner) {\n return $.grep(els, function (el) {\n return typeof el.form === \"undefined\" || el.form === owner;\n });\n }\n\n /**\n * The candidate controls of a form, in order: its elements, or every descendant it owns in\n * semantic mode, then the outside controls it owns that name it.\n */\n function controlsOf(form, semantic) {\n var formId = formAttribute(form, \"id\");\n var els = formMember(form, \"elements\");\n\n if (semantic || typeof els === \"undefined\") {\n // the document is not an element; it has its own getElementsByTagName\n els = isElement(form)\n ? callFormMethod(form, \"getElementsByTagName\", \"*\")\n : form.getElementsByTagName(\"*\");\n }\n\n els = $.makeArray(els);\n\n // the subject may also be a fieldset, the document or another container\n var owner = tagName(form) === \"form\" ? form : null;\n\n if (semantic && owner) {\n els = ownedBy(els, owner);\n }\n\n // FinesseRus: in non-IE browsers outside fields are already included in form.elements.\n if (formId && (semantic || /(Edge|Trident)\\//.test(navigator.userAgent))) {\n els = els.concat(outsideControls(formId, els, owner));\n }\n\n return els;\n }\n\n // The fields of a control's value, or null when the control is not sent.\n function fieldsOf(el) {\n var n = el.name;\n // read at call time, so a page that replaces $.fieldValue changes what is sent\n var v = $.fieldValue(el, true);\n\n if (v && v.constructor === Array) {\n return $.map(v, function (value) {\n return { name: n, value: value };\n });\n }\n\n if (feature.fileapi && el.type === \"file\") {\n var files = el.files;\n\n // #180: an empty field when no file is selected\n return files.length\n ? $.map(files, function (file) {\n return { name: n, value: file, type: el.type };\n })\n : [{ name: n, value: \"\", type: el.type }];\n }\n\n if (v === null || typeof v === \"undefined\") {\n return null;\n }\n\n return [{ name: n, value: v, type: el.type, required: el.required }];\n }\n\n // The clicked image's value and coordinates.\n function imageFields(sub, input, type) {\n var n = input.name;\n var value = { name: n, value: $(input).val() };\n\n if (type) {\n value.type = type;\n }\n\n return [value, { name: n + \".x\", value: sub.x }, { name: n + \".y\", value: sub.y }];\n }\n\n // Adds one candidate control's fields, and the control when it has a value to send.\n function addCandidate(collected, form, el, semantic) {\n if (!el.name || isDisabled(el) || rUnsubmittable.test(tagName(el))) {\n return;\n }\n\n var sub = semantic && el.type === \"image\" && submitterOf(form);\n\n if (sub) {\n // handle image inputs on the fly when semantic == true\n if (sub.el === el) {\n collected.fields.push.apply(collected.fields, imageFields(sub, el, el.type));\n }\n\n return;\n }\n\n var own = fieldsOf(el);\n\n if (own) {\n collected.controls.push(el);\n collected.fields.push.apply(collected.fields, own);\n }\n }\n\n // input type=='image' are not found in elements array! handle it here\n function addClickedImage(collected, form) {\n var sub = submitterOf(form);\n var input = sub && $(sub.el)[0];\n\n if (input && input.name && !isDisabled(input) && input.type === \"image\") {\n collected.fields.push.apply(collected.fields, imageFields(sub, input));\n }\n }\n\n /**\n * The fields of a form, as formToArray returns them, and the controls they came from.\n */\n function collect(form, semantic, filtering) {\n var collected = { fields: [], controls: [] };\n\n if (!form) {\n return collected;\n }\n\n var els = controlsOf(form, semantic);\n\n if (typeof filtering === \"function\") {\n els = $.map(els, filtering);\n }\n\n for (var i = 0; i < els.length; i++) {\n addCandidate(collected, form, els[i], semantic);\n }\n\n if (!semantic) {\n addClickedImage(collected, form);\n }\n\n return collected;\n }\n\n return {\n controlsOf: controlsOf,\n fieldsOf: fieldsOf,\n collect: collect,\n };\n}\n","import jQuery from \"jquery\";\nimport { keepContext } from \"./options.js\";\n\n// The XMLHttpRequest transports: $.ajax with the encoded fields, or FormData for file uploads.\nvar $ = jQuery;\n\n// utility fn for deep serialization: [name, value] pairs, as $.param encodes them\nexport function deepSerialize(extraData, traditional) {\n var param = $.param(extraData, traditional);\n var serialized = param ? param.split(\"&\") : [];\n var len = serialized.length;\n var result = [];\n var i, part;\n\n for (i = 0; i < len; i++) {\n // #252; undo param space replacement\n serialized[i] = serialized[i].replace(/\\+/g, \" \");\n part = serialized[i].split(\"=\");\n // #278; use array instead of object storage, favoring array serializations\n result.push([decodeURIComponent(part[0]), decodeURIComponent(part[1])]);\n }\n\n return result;\n}\n\n/**\n * Posts the fields and extraData as FormData, for files with the File API.\n * XMLHttpRequest Level 2 file uploads (big hat tip to francois2metz)\n */\nexport function sendFormData(submission) {\n var options = submission.options;\n var a = submission.fields;\n\n var formdata = new FormData();\n\n for (var i = 0; i < a.length; i++) {\n formdata.append(a[i].name, a[i].value);\n }\n\n if (options.extraData) {\n var serializedData = deepSerialize(options.extraData, submission.traditional);\n\n for (i = 0; i < serializedData.length; i++) {\n formdata.append(serializedData[i][0], serializedData[i][1]);\n }\n }\n\n options.data = null;\n\n var s = $.extend(true, {}, $.ajaxSettings, options, {\n contentType: false,\n processData: false,\n cache: false,\n type: submission.method || \"POST\",\n });\n\n keepContext(s, [$.ajaxSettings, options]);\n\n if (options.uploadProgress) {\n // workaround because jqXHR does not expose upload property: wraps the xhr factory, the\n // caller's or jQuery's\n var createXhr = s.xhr;\n\n s.xhr = function () {\n var xhr = createXhr.call(this);\n\n if (xhr.upload) {\n xhr.upload.addEventListener(\n \"progress\",\n function (event) {\n var percent = 0;\n // event.position is the deprecated name, read only when loaded is missing\n var position = event.loaded !== undefined ? event.loaded : event.position;\n var total = event.total;\n\n if (event.lengthComputable) {\n percent = Math.ceil((position / total) * 100);\n }\n\n options.uploadProgress(event, position, total, percent);\n },\n false\n );\n }\n\n return xhr;\n };\n }\n\n s.data = null;\n\n var beforeSend = s.beforeSend;\n\n s.beforeSend = function (xhr, o) {\n // Send FormData() provided by user\n if (options.formData) {\n o.data = options.formData;\n } else {\n o.data = formdata;\n }\n\n // a veto (false) cancels the upload, as on the other transports\n return beforeSend ? beforeSend.call(this, xhr, o) : undefined;\n };\n\n return $.ajax(s);\n}\n\n/**\n * Sends the encoded fields with $.ajax.\n */\nexport function sendAjax(submission) {\n return $.ajax(submission.options);\n}\n","import { callFormMethod } from \"./form-members.js\";\nimport { deepSerialize } from \"./xhr-transport.js\";\nimport jQuery from \"jquery\";\nimport { submitterFields } from \"./submitter.js\";\nimport { wellFormed } from \"./successful-controls.js\";\n\n// The iframe form post: the extra fields (submitter, CSRF, data), the form attributes set while\n// posting and restored after, and the native submit.\nvar $ = jQuery;\n\n// The form attributes an iframe upload changes while it posts.\nvar uploadAttributes = [\"action\", \"target\", \"method\", \"enctype\", \"encoding\"];\n\n// Called through the prototype: an extraData key or a form field may be named hasOwnProperty.\nvar hasOwn = Object.prototype.hasOwnProperty;\n\nfunction isGet(method) {\n return /^get$/i.test(method);\n}\n\n// Resolves both URLs through anchors, as jQuery does for crossDomain, so IE's anchor quirks\n// apply to both sides of the comparison.\nfunction isSameOrigin(url) {\n var origin = document.createElement(\"a\");\n var target = document.createElement(\"a\");\n\n origin.href = window.location.href;\n target.href = url;\n // IE fills in the host of a relative URL only once the resolved href is assigned back\n target.href = target.href; // eslint-disable-line no-self-assign\n\n return origin.protocol + \"//\" + origin.host === target.protocol + \"//\" + target.host;\n}\n\n/** Adds the clicked submitter (and an image's coordinates) to s.extraData. */\nexport function addSubmitterFields(s, form) {\n // add submitting element to data if we know it\n var fields = submitterFields(form);\n\n for (var n in fields) {\n s.extraData = s.extraData || {};\n s.extraData[wellFormed(n)] = wellFormed(fields[n]);\n }\n}\n\n/** Adds the page's CSRF token to s.extraData when the form is posted to the page's origin. */\nexport function addCsrfField(s, form, method, forms) {\n // Rails CSRF hack (thanks to Yvan Barthelemy); like jquery-ujs, only for the page's origin and\n // only when the form is posted, since a get form would put the token in the url\n var csrf_token = $(\"meta[name=csrf-token]\").attr(\"content\");\n var csrf_param = $(\"meta[name=csrf-param]\").attr(\"content\");\n var posts =\n !isGet(method) &&\n (!method || /post/i.test(method) || /post/i.test(forms.property(form, \"method\")));\n\n if (csrf_param && csrf_token && posts && isSameOrigin(s.url)) {\n s.extraData = s.extraData || {};\n s.extraData[csrf_param] = csrf_token;\n }\n}\n\nfunction setFormAttribute(form, name, value) {\n callFormMethod(form, \"setAttribute\", name, value);\n}\n\n/** The raw attributes the upload changes, null when absent, to put back exactly (#380). */\nexport function saveAttributes(form) {\n var saved = {};\n\n $.each(uploadAttributes, function (i, name) {\n saved[name] = callFormMethod(form, \"hasAttribute\", name)\n ? callFormMethod(form, \"getAttribute\", name)\n : null;\n });\n\n return saved;\n}\n\n/** Puts back the attributes saveAttributes recorded, removing those that were absent. */\nexport function restoreAttributes(form, saved) {\n $.each(uploadAttributes, function (i, name) {\n if (saved[name] === null) {\n callFormMethod(form, \"removeAttribute\", name);\n } else {\n setFormAttribute(form, name, saved[name]);\n }\n });\n}\n\n/** Points the form at the frame `target` with the upload's url, method and encoding. */\nexport function setUploadAttributes(form, target, method, s, forms) {\n var mp = \"multipart/form-data\";\n\n // update form attrs in IE friendly way\n setFormAttribute(form, \"target\", target);\n if (!method || /post/i.test(method)) {\n setFormAttribute(form, \"method\", \"POST\");\n } else if (isGet(method) && !isGet(forms.property(form, \"method\"))) {\n // a form posts natively only with GET or POST; other verbs keep the form's own method\n setFormAttribute(form, \"method\", \"GET\");\n }\n setFormAttribute(form, \"action\", s.url);\n\n // ie borks in some cases when setting encoding\n if (!s.skipEncodingOverride && (!method || /post/i.test(method))) {\n setFormAttribute(form, \"encoding\", mp);\n setFormAttribute(form, \"enctype\", mp);\n }\n}\n\n/** Appends a hidden input per extraData field to the form; each input is pushed onto `added`. */\nexport function addExtraInputs(form, ownerDocument, extraData, traditional, added) {\n // Builds the input with DOM properties: a name is never parsed as HTML.\n function addHiddenInput(name, value) {\n var input = ownerDocument.createElement(\"input\");\n\n input.type = \"hidden\";\n input.name = name;\n added.push($(input).val(value).appendTo(form)[0]);\n }\n\n if (extraData) {\n for (var n in extraData) {\n if (hasOwn.call(extraData, n)) {\n // if using the $.param format that allows for multiple values with the same name\n if (\n $.isPlainObject(extraData[n]) &&\n hasOwn.call(extraData[n], \"name\") &&\n hasOwn.call(extraData[n], \"value\")\n ) {\n addHiddenInput(extraData[n].name, extraData[n].value);\n } else {\n // arrays and objects become one field per value, as $.param sends them (#597)\n var single = {};\n\n single[n] = extraData[n];\n var fields = deepSerialize(single, traditional);\n\n for (var f = 0; f < fields.length; f++) {\n addHiddenInput(fields[f][0], fields[f][1]);\n }\n }\n }\n }\n }\n}\n\n/** Submits the form natively, even when a control named submit hides the method. */\nexport function submitForm(form) {\n try {\n form.submit();\n } catch (err) {\n // just in case form has element with name/id of 'submit'\n callFormMethod(form, \"submit\");\n }\n}\n","import jQuery from \"jquery\";\nimport { log } from \"./diagnostics.js\";\n\n// The iframe response reader: turns the frame's document into the mock xhr's text, XML, status\n// and dataType, then parses it as $.ajax would (dataFilter, JSON, script).\nvar $ = jQuery;\n\n/** The frame's document, or null when the browser denies access to it. */\nexport function getDoc(frame) {\n /* it looks like contentWindow or contentDocument do not\n * carry the protocol property in ie8, when running under ssl\n * frame.document is the only valid response document, since\n * the protocol is know but not on the other two objects. strange?\n * \"Same origin policy\" http://en.wikipedia.org/wiki/Same_origin_policy\n */\n\n var doc = null;\n\n // IE8 cascading access check\n try {\n if (frame.contentWindow) {\n doc = frame.contentWindow.document;\n }\n } catch (err) {\n // IE8 access denied under ssl & missing protocol\n log(\"cannot get iframe.contentWindow document: \" + err);\n }\n\n if (doc) {\n // successful getting content\n return doc;\n }\n\n try {\n // simply checking may throw in ie8 under ssl or mismatched protocol\n doc = frame.contentDocument ? frame.contentDocument : frame.document;\n } catch (err) {\n // last attempt\n log(\"cannot get iframe.contentDocument: \" + err);\n doc = frame.document;\n }\n\n return doc;\n}\n\n/** Parses the response text or XML for the given (lowercase) dataType. */\nexport function httpData(xhr, type, s) {\n // mostly lifted from jq1.4.4\n\n var ct = xhr.getResponseHeader(\"content-type\") || \"\",\n xml = (type === \"xml\" || !type) && ct.indexOf(\"xml\") >= 0,\n data = xml ? xhr.responseXML : xhr.responseText;\n\n if (xml && data.documentElement.nodeName === \"parsererror\") {\n if ($.error) {\n $.error(\"parsererror\");\n }\n }\n if (s && s.dataFilter) {\n data = s.dataFilter(data, type);\n }\n if (typeof data === \"string\") {\n if ((type === \"json\" || !type) && ct.indexOf(\"json\") >= 0) {\n data = JSON.parse(data);\n } else if (type === \"script\") {\n $.globalEval(data);\n }\n }\n\n return data;\n}\n\n// Copies the status and statusText attributes of an element onto the mock xhr.\nfunction readStatus(xhr, el) {\n // support for XHR 'status' & 'statusText' emulation :\n xhr.status = Number(el.getAttribute(\"status\")) || xhr.status;\n xhr.statusText = el.getAttribute(\"statusText\") || xhr.statusText;\n}\n\n// Fills the mock xhr from the document itself.\nfunction readDocument(doc, xhr, s, isXml) {\n var docRoot = doc.body ? doc.body : doc.documentElement;\n\n xhr.responseText = docRoot ? docRoot.innerHTML : null;\n xhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc;\n if (isXml) {\n s.dataType = \"xml\";\n }\n xhr.getResponseHeader = function (header) {\n // the dataType in lowercase, as $.ajax reads it\n var headers = { \"content-type\": s.dataType && s.dataType.toLowerCase() };\n\n return headers[header.toLowerCase()];\n };\n if (docRoot) {\n readStatus(xhr, docRoot);\n }\n}\n\n// A response embedded in a textarea, or text wrapped in pre or body, replaces responseText.\nfunction readEmbedded(doc, xhr, dt, s) {\n var scr = /(json|script|text)/.test(dt);\n\n if (!scr && !s.textarea) {\n return;\n }\n // see if user embedded response in textarea\n var ta = doc.getElementsByTagName(\"textarea\")[0];\n\n if (ta) {\n xhr.responseText = ta.value;\n readStatus(xhr, ta);\n } else if (scr) {\n // account for browsers injecting pre around json response\n var pre = doc.getElementsByTagName(\"pre\")[0];\n var b = doc.getElementsByTagName(\"body\")[0];\n\n if (pre) {\n xhr.responseText = pre.textContent ? pre.textContent : pre.innerText;\n } else if (b) {\n xhr.responseText = b.textContent ? b.textContent : b.innerText;\n }\n }\n}\n\n/**\n * Reads and parses the response document into the mock xhr. Returns {status, data, errMsg}, or\n * null when `retry()` asks to read the document again later (Opera's untraversable DOM).\n */\nexport function readResponse(doc, xhr, s, retry) {\n var status = \"success\",\n data,\n errMsg;\n\n try {\n var isXml = /^xml$/i.test(s.dataType) || doc.XMLDocument || $.isXMLDoc(doc);\n\n log(\"isXml=\" + isXml);\n\n if (!isXml && window.opera && (doc.body === null || !doc.body.innerHTML)) {\n // in some browsers (Opera) the iframe DOM is not always traversable when\n // the onload callback fires, so we loop a bit to accommodate\n if (retry()) {\n return null;\n }\n // let this fall through because server response could be an empty document\n }\n\n readDocument(doc, xhr, s, isXml);\n\n var dt = (s.dataType || \"\").toLowerCase();\n\n readEmbedded(doc, xhr, dt, s);\n\n try {\n data = httpData(xhr, dt, s);\n } catch (err) {\n status = \"parsererror\";\n xhr.error = errMsg = err || status;\n }\n } catch (err) {\n log(\"error caught: \", err);\n status = \"error\";\n xhr.error = errMsg = err;\n }\n\n return { status: status, data: data, errMsg: errMsg };\n}\n","import jQuery from \"jquery\";\nimport { log } from \"./diagnostics.js\";\n\n// The iframe upload's lifecycle: the mock xhr and the Deferred, the global ajax events, the\n// beforeSend veto, the timeout, abort and settling.\nvar $ = jQuery;\n\n/**\n * Creates the lifecycle of one upload with the merged settings `s`. `frame.stop()` stops the\n * frame's load and `frame.release()` removes or resets the frame after the upload.\n */\nexport function createLifecycle(s, frame) {\n var g,\n timeoutHandle,\n callbackProcessed,\n deferred = $.Deferred();\n\n var xhr = {\n // mock object\n aborted: 0,\n responseText: null,\n responseXML: null,\n status: 0,\n statusText: \"n/a\",\n getAllResponseHeaders: function () {},\n getResponseHeader: function () {},\n setRequestHeader: function () {},\n abort: function (status) {\n abort(status, [xhr, \"aborted\", status]);\n },\n };\n\n // #341\n deferred.abort = function (status) {\n xhr.abort(status);\n };\n\n function done() {\n return xhr.aborted || callbackProcessed;\n }\n\n // Completes an aborted upload once and rejects the Deferred with `rejection`.\n // `textStatus` replaces the default \"timeout\"/\"aborted\" text status.\n function abort(status, rejection, textStatus) {\n var e = textStatus || (status === \"timeout\" ? \"timeout\" : \"aborted\");\n\n if (done()) {\n return;\n }\n\n log(\"aborting upload... \" + e);\n xhr.aborted = 1;\n frame.stop();\n xhr.error = e;\n if (s.error) {\n s.error.call(s.context, xhr, e, status);\n }\n deferred.reject.apply(deferred, rejection);\n\n if (g) {\n $.event.trigger(\"ajaxError\", [xhr, s, e]);\n }\n\n complete(e);\n }\n\n // The global events that end every upload, cancelled ones included.\n function endGlobalEvents() {\n if (g) {\n $.event.trigger(\"ajaxComplete\", [xhr, s]);\n }\n\n if (g && !--$.active) {\n $.event.trigger(\"ajaxStop\");\n }\n }\n\n // The steps every finished or aborted upload ends with, in $.ajax order.\n function complete(status) {\n if (s.complete) {\n s.complete.call(s.context, xhr, status);\n }\n\n endGlobalEvents();\n clearTimeout(timeoutHandle);\n\n // clean up\n setTimeout(function () {\n frame.release();\n xhr.responseXML = null;\n }, 100);\n }\n\n // A beforeSend veto ends the upload as $.ajax cancels a request: no callbacks, the global\n // events end with ajaxError \"canceled\".\n function cancel() {\n if (done()) {\n return;\n }\n\n callbackProcessed = true;\n deferred.reject();\n if (g) {\n $.event.trigger(\"ajaxError\", [xhr, s, \"canceled\"]);\n }\n endGlobalEvents();\n }\n\n // Fires the start events and beforeSend; false when the upload must not be posted.\n function start() {\n g = s.global;\n // trigger ajax global events so that activity/block indicators work like normal\n if (g && $.active++ === 0) {\n $.event.trigger(\"ajaxStart\");\n }\n\n if (s.beforeSend && s.beforeSend.call(s.context, xhr, s) === false) {\n cancel();\n\n return false;\n }\n\n if (xhr.aborted) {\n // abort() in beforeSend already completed the upload\n return false;\n }\n\n if (g) {\n $.event.trigger(\"ajaxSend\", [xhr, s]);\n }\n\n // an ajaxSend handler may abort too\n return !xhr.aborted;\n }\n\n // Resolves the upload; returns {error} when the success callback threw.\n function succeed(data) {\n var failure;\n\n try {\n s.success.call(s.context, data, \"success\", xhr);\n } catch (err) {\n failure = { error: err };\n }\n\n deferred.resolve(xhr.responseText, \"success\", xhr);\n\n if (g) {\n $.event.trigger(\"ajaxSuccess\", [xhr, s, data]);\n }\n\n return failure;\n }\n\n // Settles the upload with the response reader's {status, data, errMsg}.\n function settle(result) {\n var status = result.status,\n errMsg = result.errMsg;\n\n if (xhr.aborted) {\n // abort() completed the upload while its response was processed\n log(\"upload aborted\");\n\n return;\n }\n\n // an emulated HTTP error status wins with the statusText, as in $.ajax; a parse error is\n // kept otherwise\n if (xhr.status && !((xhr.status >= 200 && xhr.status < 300) || xhr.status === 304)) {\n if (status === \"parsererror\") {\n errMsg = undefined;\n }\n status = \"error\";\n }\n\n callbackProcessed = true;\n\n // ordering of these callbacks/triggers is odd, but that's how $.ajax does it\n if (status === \"success\") {\n var failure = succeed(result.data);\n\n complete(status);\n if (failure) {\n // the upload is settled; the success callback's exception still reaches the console\n throw failure.error;\n }\n\n return;\n }\n\n if (typeof errMsg === \"undefined\") {\n errMsg = xhr.statusText;\n }\n if (s.error) {\n s.error.call(s.context, xhr, status, errMsg);\n }\n deferred.reject(xhr, status, errMsg);\n if (g) {\n $.event.trigger(\"ajaxError\", [xhr, s, errMsg]);\n }\n\n complete(status);\n }\n\n return {\n xhr: xhr,\n deferred: deferred,\n start: start,\n done: done,\n abort: abort,\n settle: settle,\n // Settles an upload that failed with an exception (ignored once aborted).\n fail: function (err) {\n settle({ status: \"error\", errMsg: err });\n },\n // Runs `onTimeout` after s.timeout, when set.\n startTimer: function (onTimeout) {\n if (s.timeout) {\n timeoutHandle = setTimeout(onTimeout, s.timeout);\n }\n },\n stopTimer: function () {\n clearTimeout(timeoutHandle);\n timeoutHandle = undefined;\n },\n };\n}\n","import {\n addCsrfField,\n addExtraInputs,\n addSubmitterFields,\n restoreAttributes,\n saveAttributes,\n setUploadAttributes,\n submitForm,\n} from \"./iframe-post.js\";\nimport { closestByTag, formMember } from \"./form-members.js\";\nimport { deprecate, log } from \"./diagnostics.js\";\nimport { getDoc, readResponse } from \"./iframe-response.js\";\nimport { createLifecycle } from \"./iframe-lifecycle.js\";\nimport jQuery from \"jquery\";\nimport { keepContext } from \"./options.js\";\n\n// The iframe transport: posts the form itself into a hidden frame and reads the response from it,\n// for file uploads without the File API or when the iframe option asks for it.\nvar $ = jQuery;\n\n/**\n * The iframe send step. `hasProp` is what the entry detected at load; `forms.property` reads a\n * form property as attr2 does.\n */\nexport function createIframeTransport(hasProp, forms) {\n var CLIENT_TIMEOUT_ABORT = 1;\n var SERVER_ABORT = 2;\n // tells apart the frames of uploads that start in the same millisecond\n var frameCount = 0;\n\n // ensure that every serialized input is still enabled\n function enableControls(elements) {\n for (var i = 0; i < elements.length; i++) {\n var el = $(elements[i]);\n\n if (hasProp) {\n el.prop(\"disabled\", false);\n } else {\n el.removeAttr(\"disabled\");\n }\n }\n }\n\n // Names the frame's window, when the page may: a cross-origin or sandboxed frame refuses.\n function nameWindow(frame, name) {\n try {\n if (frame.contentWindow) {\n frame.contentWindow.name = name;\n }\n } catch (ignore) {}\n }\n\n // The frame the form posts into: the iframeTarget, named `id` when it has no name, or a new\n // hidden frame named `id`. Returns the frame and the name the form targets.\n function createFrame(s, id, ownerDocument) {\n var $io, n;\n\n if (s.iframeTarget) {\n $io = $(s.iframeTarget, ownerDocument);\n n = $io.attr(\"name\");\n if (!n) {\n $io.attr(\"name\", id);\n // a frame already in the page keeps the browsing context name it was inserted with\n $io.each(function () {\n nameWindow(this, id);\n });\n } else {\n id = n;\n }\n } else {\n var io = ownerDocument.createElement(\"iframe\");\n\n io.setAttribute(\"name\", id);\n io.setAttribute(\"src\", s.iframeSrc);\n $io = $(io);\n $io.css({ position: \"absolute\", top: \"-1000px\", left: \"-1000px\" });\n }\n\n return { $io: $io, id: id };\n }\n\n // The frame hooks the lifecycle calls: stop a load in progress, and release after the upload.\n function frameHooks(s, $io) {\n return {\n stop: function () {\n try {\n // #214, #257\n if ($io[0].contentWindow.document.execCommand) {\n $io[0].contentWindow.document.execCommand(\"Stop\");\n }\n } catch (ignore) {}\n\n $io.attr(\"src\", s.iframeSrc); // abort op in progress\n },\n release: function () {\n if (!s.iframeTarget) {\n $io.remove();\n } else {\n // adding else to clean up existing iframe response.\n $io.attr(\"src\", s.iframeSrc);\n }\n },\n };\n }\n\n function listen(io, cb) {\n if (io.attachEvent) {\n io.attachEvent(\"onload\", cb);\n } else {\n io.addEventListener(\"load\", cb, false);\n }\n }\n\n function unlisten(io, cb) {\n if (io.detachEvent) {\n io.detachEvent(\"onload\", cb);\n } else {\n io.removeEventListener(\"load\", cb, false);\n }\n }\n\n // private function for handling file uploads (hat tip to YAHOO!)\n function fileUploadIframe(submission) {\n var form = submission.form,\n method = submission.method;\n\n var s = keepContext($.extend(true, {}, $.ajaxSettings, submission.options), [\n $.ajaxSettings,\n submission.options,\n ]);\n\n s.context = s.context || s;\n var ownerDocument = formMember(form, \"ownerDocument\");\n var $body = $(closestByTag(form, [\"body\"]));\n var frame = createFrame(s, \"jqFormIO\" + new Date().getTime() + frameCount++, ownerDocument);\n var $io = frame.$io,\n io = $io[0];\n var life = createLifecycle(s, frameHooks(s, $io));\n var domCheckCount = 50;\n\n if (!life.start()) {\n return life.deferred;\n }\n\n addSubmitterFields(s, form);\n addCsrfField(s, form, method, forms);\n\n // look for server aborts\n function checkState() {\n try {\n var state = getDoc(io).readyState;\n\n log(\"state = \" + state);\n if (state && state.toLowerCase() === \"uninitialized\") {\n setTimeout(checkState, 50);\n }\n } catch (e) {\n log(\"Server abort: \", e, \" (\", e.name, \")\");\n cb(SERVER_ABORT);\n life.stopTimer();\n }\n }\n\n // take a breath so that pending repaints get some cpu time before the upload starts\n function doSubmit() {\n var saved = saveAttributes(form);\n\n setUploadAttributes(form, frame.id, method, s, forms);\n\n // support timout\n life.startTimer(function () {\n cb(CLIENT_TIMEOUT_ABORT);\n });\n\n // add \"extra\" data to form if provided in options\n var extraInputs = [];\n\n try {\n addExtraInputs(form, ownerDocument, s.extraData, submission.traditional, extraInputs);\n\n if (!s.iframeTarget) {\n // add iframe to doc and submit the form\n $io.appendTo($body);\n }\n\n // A connected form posting into a frame outside the document opens a new window.\n var root = ownerDocument.documentElement;\n\n if (io && $.contains(root, form) && !$.contains(root, io)) {\n var notInDocument = \"jquery.form: the upload frame is not in the document\";\n\n life.abort(notInDocument, [life.xhr, \"error\", notInDocument], \"error\");\n\n return;\n }\n\n listen(io, cb);\n setTimeout(checkState, 15);\n submitForm(form);\n } finally {\n // reset attrs and remove \"extra\" input elements\n restoreAttributes(form, saved);\n $(extraInputs).remove();\n }\n }\n\n // Reads the next document by Opera's rules: false once the retries are used up.\n function retry() {\n if (--domCheckCount) {\n log(\"requeing onLoad callback, DOM not available\");\n setTimeout(cb, 250);\n\n return true;\n }\n\n return false;\n }\n\n function cb(e) {\n if (life.done()) {\n return;\n }\n\n var doc = getDoc(io);\n\n if (!doc) {\n log(\"cannot access response document\");\n e = SERVER_ABORT;\n }\n if (e === CLIENT_TIMEOUT_ABORT) {\n life.abort(\"timeout\", [life.xhr, \"timeout\"]);\n\n return;\n }\n if (e === SERVER_ABORT) {\n life.abort(\"server abort\", [life.xhr, \"error\", \"server abort\"]);\n\n return;\n }\n\n if (doc.location.href === s.iframeSrc) {\n // response not received yet\n return;\n }\n\n unlisten(io, cb);\n\n var result = readResponse(doc, life.xhr, s, retry);\n\n if (result) {\n life.settle(result);\n }\n }\n\n // An exception while posting settles the upload with \"error\" and the exception.\n function post() {\n if (life.done()) {\n // aborted before the delayed post\n return;\n }\n\n try {\n doSubmit();\n } catch (err) {\n log(\"upload failed: \", err);\n life.fail(err);\n }\n }\n\n if (s.forceSync) {\n post();\n } else {\n setTimeout(post, 10); // this lets dom updates render\n }\n\n return life.deferred;\n }\n\n return function sendIframe(submission) {\n var jqxhr;\n\n // now, while the controls are still listed: ajaxSubmit clears the list when it returns,\n // before a closeKeepAlive request completes\n enableControls(submission.controls);\n\n // hack to fix Safari hang (thanks to Tim Molendijk for this)\n // see: http://groups.google.com/group/jquery-dev/browse_thread/thread/36395b7ab510dd5d\n if (submission.options.closeKeepAlive) {\n deprecate(\"closeKeepAlive\", \"closeKeepAlive works around a Safari 3/4 bug and is deprecated\");\n $.get(submission.options.closeKeepAlive, function () {\n jqxhr = fileUploadIframe(submission);\n });\n } else {\n jqxhr = fileUploadIframe(submission);\n }\n\n return jqxhr;\n };\n}\n","import { deprecate, log } from \"./diagnostics.js\";\nimport { assertRealParent } from \"./form-members.js\";\nimport jQuery from \"jquery\";\nimport { keepContext } from \"./options.js\";\nimport { urlencode } from \"./successful-controls.js\";\n\n// A Submission is one ajaxSubmit call once its vetoes have passed:\n// { form, $form, fields, controls, options, method, traditional }. `options` is the object the\n// callbacks and events receive; later steps change it in place.\n\n/**\n * The submission steps. `feature` holds what the entry detected at load (fileapi, formdata), and\n * `forms` reads form attributes and attr2-style properties (attribute, property), and\n * `serialization` collects the form's fields and controls.\n */\nexport function createSubmission(feature, forms, serialization) {\n var $ = jQuery;\n\n function refuse(message) {\n log(message);\n\n return null;\n }\n\n // The options merged over the form's action, the method, and the ajax defaults.\n function withDefaults(form, options, method) {\n var action = options.url || forms.property(form, \"action\");\n var url = typeof action === \"string\" ? action.trim() : \"\";\n\n // clean url (don't include hash value); an action that is only a fragment means this page\n url = url.split(\"#\")[0] || window.location.href.split(\"#\")[0];\n // IE requires javascript:false in https, but this breaks chrome >83 and goes against spec.\n // Instead of using javascript:false always, let's only apply it for IE.\n var isMsie = /(MSIE|Trident)/.test(navigator.userAgent || \"\");\n var iframeSrc = isMsie && /^https/i.test(document.URL) ? \"javascript:false\" : \"about:blank\"; // eslint-disable-line no-script-url\n\n var merged = $.extend(\n true,\n {\n url: url,\n success: $.ajaxSettings.success,\n type: method || $.ajaxSettings.type,\n iframeSrc: iframeSrc,\n },\n options\n );\n\n return keepContext(merged, [options]);\n }\n\n /**\n * The one method every transport sends, read after the hooks: `method` wins over `type`, and\n * `type` is set to it. Undefined when only the ajax default applies, so each transport keeps\n * its own default.\n */\n function resolveMethod(options, defaultType) {\n var resolved = options.method || options.type;\n\n options.type = resolved;\n\n return resolved === defaultType && !options.method ? undefined : resolved;\n }\n\n // The data option, kept as extraData and encoded, or undefined without one.\n function extraQuery(fields, options, traditional) {\n if (!options.data) {\n return undefined;\n }\n\n var optionsData = typeof options.data === \"function\" ? options.data(fields) : options.data;\n\n if (typeof optionsData === \"string\") {\n if (options.requestFormat === \"json\") {\n throw new Error(\n 'jquery.form: requestFormat \"json\" needs object data; a string data option is a query string'\n );\n }\n\n // a query string: sent as-is when urlencoded, as its own fields otherwise\n options.extraData = queryPairs(optionsData);\n\n return optionsData;\n }\n\n options.extraData = optionsData;\n\n return $.param(optionsData, traditional);\n }\n\n // Sets a key as an own data property, so a name like __proto__ is an ordinary key.\n function defineKey(object, key, value) {\n Object.defineProperty(object, key, {\n value: value,\n enumerable: true,\n writable: true,\n configurable: true,\n });\n }\n\n /**\n * requestFormat \"json\" (#545): the fields as an object (a repeated name gives an array), merged\n * with object data, sent as a JSON body. Based on the idea in PR #557 by zhangciwu.\n */\n function jsonBody(options, fields) {\n if (/^get$/i.test(options.type)) {\n throw new Error('jquery.form: requestFormat \"json\" needs a method with a body, such as POST');\n }\n\n var body = {};\n var own = Object.prototype.hasOwnProperty;\n\n for (var i = 0; i < fields.length; i++) {\n var name = fields[i].name;\n\n if (!own.call(body, name)) {\n defineKey(body, name, fields[i].value);\n } else if (Array.isArray(body[name])) {\n body[name].push(fields[i].value);\n } else {\n defineKey(body, name, [body[name], fields[i].value]);\n }\n }\n\n var extra = options.extraData;\n\n for (var key in extra) {\n if (own.call(extra, key)) {\n defineKey(body, key, extra[key]);\n }\n }\n\n options.data = JSON.stringify(body);\n options.contentType = \"application/json; charset=UTF-8\";\n }\n\n // The fields of a query string, as the { name, value } list $.param takes.\n function queryPairs(query) {\n var pairs = [];\n var parts = query.split(\"&\");\n\n for (var i = 0; i < parts.length; i++) {\n if (parts[i]) {\n var at = parts[i].indexOf(\"=\");\n var name = at < 0 ? parts[i] : parts[i].slice(0, at);\n var value = at < 0 ? \"\" : parts[i].slice(at + 1);\n\n pairs.push({ name: decodeQuery(name), value: decodeQuery(value) });\n }\n }\n\n return pairs;\n }\n\n function decodeQuery(text) {\n return decodeURIComponent(text.replace(/\\+/g, \" \"));\n }\n\n // Puts the encoded fields in the url for a get, and in the data otherwise.\n function encode(options, q, qx) {\n if (qx) {\n q = q ? q + \"&\" + qx : qx;\n }\n\n if (options.type.toUpperCase() === \"GET\") {\n // the query goes before any fragment in the url option\n var hashAt = options.url.indexOf(\"#\");\n var base = hashAt < 0 ? options.url : options.url.slice(0, hashAt);\n\n options.url =\n base + (base.indexOf(\"?\") >= 0 ? \"&\" : \"?\") + q + options.url.slice(base.length);\n options.data = null; // data is null for 'get'\n } else {\n options.data = q; // data is the query string for 'post'\n }\n }\n\n // A callback option as a list: an array as given, one function, or none.\n function callbackList(callback) {\n if (Array.isArray(callback)) {\n return callback;\n }\n\n return callback ? [callback] : [];\n }\n\n // Calls each callback in order with the same this and arguments.\n function callEach(callbacks, context, args) {\n for (var i = 0; i < callbacks.length; i++) {\n callbacks[i].apply(context, args);\n }\n }\n\n /**\n * Resolves the options, serializes the form, and runs the vetoes: the Submission, or null when\n * an event or callback stopped it.\n */\n function prepare($set, options) {\n $set.each(function () {\n assertRealParent(this);\n });\n\n var form = $set[0];\n var method = options.method || options.type || forms.property(form, \"method\");\n\n options = withDefaults(form, options, method);\n\n // the ajax default type, when neither the caller nor the form gave a method\n var defaultType = method ? undefined : options.type;\n\n // hook for manipulating the form data before it is extracted;\n // convenient for use with rich editors like tinyMCE or FCKEditor\n var veto = {};\n\n $set.trigger(\"form-pre-serialize\", [$set, options, veto]);\n if (veto.veto) {\n return refuse(\"ajaxSubmit: submit vetoed via form-pre-serialize trigger\");\n }\n\n // provide opportunity to alter form data before it is serialized\n if (options.beforeSerialize && options.beforeSerialize($set, options) === false) {\n return refuse(\"ajaxSubmit: submit aborted via beforeSerialize callback\");\n }\n\n var traditional = options.traditional;\n\n if (typeof traditional === \"undefined\") {\n traditional = $.ajaxSettings.traditional;\n }\n\n var collected = serialization.collect($set[0], options.semantic, options.filtering);\n var fields = collected.fields;\n var controls = collected.controls;\n var qx = extraQuery(fields, options, traditional);\n\n // give pre-submit callback an opportunity to abort the submit\n if (options.beforeSubmit && options.beforeSubmit(fields, $set, options) === false) {\n return refuse(\"ajaxSubmit: submit aborted via beforeSubmit callback\");\n }\n\n // fire vetoable 'validate' event\n $set.trigger(\"form-submit-validate\", [fields, $set, options, veto]);\n if (veto.veto) {\n return refuse(\"ajaxSubmit: submit vetoed via form-submit-validate trigger\");\n }\n\n method = resolveMethod(options, defaultType);\n\n if (options.requestFormat === \"json\") {\n jsonBody(options, fields);\n } else {\n encode(options, urlencode(fields, traditional), qx);\n }\n\n return {\n form: form,\n $form: $set,\n fields: fields,\n controls: controls,\n options: options,\n method: method,\n traditional: traditional,\n };\n }\n\n /**\n * Wraps success, error and complete (a function or an array of them, as $.ajax takes) so each\n * also receives the form, and adds the resetForm,\n * clearForm and target steps before the success callbacks.\n */\n function deliver(submission) {\n var $set = submission.$form;\n var options = submission.options;\n var callbacks = [];\n\n if (options.resetForm) {\n callbacks.push(function () {\n $set.resetForm();\n });\n }\n\n if (options.clearForm) {\n callbacks.push(function () {\n $set.clearForm(options.includeHidden);\n });\n }\n\n // perform a load on the target only if dataType is not provided\n if (!options.dataType && options.target) {\n var successes = callbackList(options.success);\n\n callbacks.push(function (data, textStatus, jqXHR) {\n var successArguments = arguments,\n fn = options.replaceTarget ? \"replaceWith\" : \"html\",\n $target = $(options.target);\n\n // Only a string response is inserted. jQuery has already parsed a JSON or XML response,\n // and inserting it would parse each of its strings as HTML.\n if (typeof data === \"string\") {\n $target[fn](data);\n } else {\n log(\"target: the response was parsed by jQuery, so it is not inserted\");\n }\n\n if (!$target.length) {\n // nothing to fill: success still runs once, with the normal context\n callEach(successes, this, successArguments);\n }\n\n $target.each(function () {\n callEach(successes, this, successArguments);\n });\n });\n } else {\n $.merge(callbacks, callbackList(options.success));\n }\n\n options.success = function (data, status, xhr) {\n // jQuery 1.4+ passes xhr as 3rd arg\n var context = options.context || this; // jQuery 1.4+ supports scope context\n\n for (var i = 0, max = callbacks.length; i < max; i++) {\n callbacks[i].apply(context, [data, status, xhr || $set, $set]);\n }\n };\n\n if (options.error) {\n var errors = callbackList(options.error);\n\n options.error = function (xhr, status, error) {\n callEach(errors, options.context || this, [xhr, status, error, $set]);\n };\n }\n\n if (options.complete) {\n var completes = callbackList(options.complete);\n\n options.complete = function (xhr, status) {\n callEach(completes, options.context || this, [xhr, status, $set]);\n };\n }\n }\n\n /**\n * The transport for a submission: \"iframe\" for files without the File API or when forced,\n * \"formdata\" for files with it, \"ajax\" otherwise.\n */\n function chooseTransport(submission) {\n var $set = submission.$form;\n var options = submission.options;\n\n // [value] (issue #113), also see comment:\n // https://github.com/malsup/form/commit/588306aedba1de01388032d5f42a60159eea9228#commitcomment-2180219\n // and the file inputs outside the form that belong to it through their form attribute\n var fileInputs = $(\"input[type=file]:enabled\", $set)\n .add($(submission.controls).filter(\"input[type=file]\"))\n .filter(function () {\n return $(this).val() !== \"\";\n });\n var hasFileInputs = fileInputs.length > 0;\n // compared as the browser does: ASCII case-insensitive, without surrounding whitespace\n var mp = /^[\\t\\n\\f\\r ]*multipart\\/form-data[\\t\\n\\f\\r ]*$/i;\n var multipart =\n mp.test(forms.attribute($set[0], \"enctype\")) || mp.test(forms.attribute($set[0], \"encoding\"));\n var fileAPI = feature.fileapi && feature.formdata;\n\n log(\"fileAPI :\" + fileAPI);\n\n var shouldUseFrame = (hasFileInputs || multipart) && !fileAPI;\n\n var transport = (hasFileInputs || multipart) && fileAPI ? \"formdata\" : \"ajax\";\n\n // options.iframe allows user to force iframe mode\n // 06-NOV-09: now defaulting to iframe mode if file input is detected\n if (options.iframe !== false && (options.iframe || shouldUseFrame)) {\n transport = \"iframe\";\n }\n\n if (transport === \"iframe\" && !options.iframe) {\n deprecate(\n \"iframe\",\n \"choosing the iframe transport automatically without FormData is deprecated, set iframe: true\"\n );\n }\n\n if (transport !== \"ajax\" && options.requestFormat === \"json\") {\n throw new Error(\n 'jquery.form: requestFormat \"json\" cannot send files or use the iframe transport'\n );\n }\n\n return transport;\n }\n\n return { prepare: prepare, deliver: deliver, chooseTransport: chooseTransport };\n}\n","/*!\n * jQuery Form Plugin\n * version: 4.5.0\n * Requires jQuery v1.7.2 or later\n * Project repository: https://github.com/jquery-form/form\n\n * Copyright 2017 Kevin Morris\n * Copyright 2006 M. Alsup\n\n * Dual licensed under the LGPL-2.1+ or MIT licenses\n * https://github.com/jquery-form/form#license\n\n * This library is free software; you can redistribute it and/or\n * modify it under the terms of the GNU Lesser General Public\n * License as published by the Free Software Foundation; either\n * version 2.1 of the License, or (at your option) any later version.\n * This library is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n */\nimport { ajaxForm, ajaxFormUnbind } from \"./ajax-form.js\";\nimport { callFormMethod, tagName } from \"./form-members.js\";\nimport {\n createSuccessfulControls,\n isSuccessful,\n urlencode,\n valueOf,\n} from \"./successful-controls.js\";\nimport { deprecate, deprecateOldJQuery, log } from \"./diagnostics.js\";\nimport { sendAjax, sendFormData } from \"./xhr-transport.js\";\nimport { createIframeTransport } from \"./iframe-transport.js\";\nimport { createSubmission } from \"./submission.js\";\nimport { formAttribute } from \"./form-attributes.js\";\nimport jQuery from \"jquery\";\nimport { submitOptions } from \"./options.js\";\nimport { submitterElement } from \"./submitter.js\";\n\n(function ($) {\n \"use strict\";\n\n /*\n\t\tUsage Note:\n\t\t-----------\n\t\tDo not use both ajaxSubmit and ajaxForm on the same form. These\n\t\tfunctions are mutually exclusive. Use ajaxSubmit if you want\n\t\tto bind your own submit handler to the form. For example,\n\n\t\t$(document).ready(function() {\n\t\t\t$('#myForm').on('submit', function(e) {\n\t\t\t\te.preventDefault(); // <-- important\n\t\t\t\t$(this).ajaxSubmit({\n\t\t\t\t\ttarget: '#output'\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\n\t\tUse ajaxForm when you want the plugin to manage all the event binding\n\t\tfor you. For example,\n\n\t\t$(document).ready(function() {\n\t\t\t$('#myForm').ajaxForm({\n\t\t\t\ttarget: '#output'\n\t\t\t});\n\t\t});\n\n\t\tYou can also use ajaxForm with delegation (requires jQuery v1.7+), so the\n\t\tform does not have to exist when you invoke ajaxForm:\n\n\t\t$('#myForm').ajaxForm({\n\t\t\tdelegation: true,\n\t\t\ttarget: '#output'\n\t\t});\n\n\t\tWhen using ajaxForm, the ajaxSubmit function will be invoked for you\n\t\tat the appropriate time.\n\t*/\n\n /**\n * Feature detection\n */\n var feature = {};\n\n feature.fileapi = $('').get(0).files !== undefined;\n feature.formdata = typeof window.FormData !== \"undefined\";\n\n var hasProp = !!$.fn.prop;\n // What attr2 returns for a form: the property when it is a string, otherwise the attribute. The\n // property is read plainly on purpose: a control named like it shadows it, and then the raw\n // attribute is used.\n function formProperty(form, name) {\n var value = hasProp ? form[name] : undefined;\n\n return typeof value === \"string\" ? value : formAttribute(form, name);\n }\n\n var forms = { attribute: formAttribute, property: formProperty };\n var serialization = createSuccessfulControls(feature);\n var steps = createSubmission(feature, forms, serialization);\n var transports = {\n iframe: createIframeTransport(hasProp, forms),\n formdata: sendFormData,\n ajax: sendAjax,\n };\n\n // attr2 uses prop when it can but checks the return type for\n // an expected string. This accounts for the case where a form\n // contains inputs with names like \"action\" or \"method\"; in those\n // cases \"prop\" returns the element\n $.fn.attr2 = function () {\n deprecate(\"attr2\", \"attr2 is deprecated, use .prop() or .attr()\");\n\n if (!hasProp) {\n return this.attr.apply(this, arguments);\n }\n\n var val = this.prop.apply(this, arguments);\n\n if ((val && val.jquery) || typeof val === \"string\") {\n return val;\n }\n\n return this.attr.apply(this, arguments);\n };\n\n /**\n * ajaxSubmit() provides a mechanism for immediately submitting\n * an HTML form using AJAX.\n *\n * @param\t{object|string}\toptions\t\tjquery.form.js parameters or custom url for submission\n * @param\t{object}\t\tdata\t\textraData\n * @param\t{string}\t\tdataType\tajax dataType\n * @param\t{function}\t\tonSuccess\tajax success callback function\n */\n $.fn.ajaxSubmit = function (options, data, dataType, onSuccess) {\n deprecateOldJQuery($.fn.jquery);\n\n // fast fail if nothing selected (http://dev.jquery.com/ticket/2752)\n if (!this.length) {\n log(\"ajaxSubmit: skipping submit process - no element selected\");\n\n return this;\n }\n\n // #541: jQuery's slim build has no $.ajax\n if (!$.ajax) {\n throw new Error(\n \"jquery.form: ajaxSubmit needs the full jQuery build; this jQuery has no $.ajax\"\n );\n }\n\n var submission = steps.prepare(this, submitOptions(options, data, dataType, onSuccess));\n\n if (!submission) {\n return this;\n }\n\n steps.deliver(submission);\n\n var jqxhr = transports[steps.chooseTransport(submission)](submission);\n\n this.removeData(\"jqxhr\").data(\"jqxhr\", jqxhr);\n\n // clear element array\n for (var k = 0; k < submission.controls.length; k++) {\n submission.controls[k] = null;\n }\n\n // fire 'notify' event\n this.trigger(\"form-submit-notify\", [this, submission.options]);\n\n return this;\n };\n\n $.fn.ajaxForm = ajaxForm;\n $.fn.ajaxFormUnbind = ajaxFormUnbind;\n\n /**\n * formToArray() gathers form element data into an array of objects that can\n * be passed to any of the following ajax functions: $.get, $.post, or load.\n * Each object in the array has both a 'name' and 'value' property. An example of\n * an array for a simple login form might be:\n *\n * [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ]\n *\n * It is this array that is passed to pre-submit callback functions provided to the\n * ajaxSubmit() and ajaxForm() methods.\n */\n $.fn.formToArray = function (semantic, elements, filtering) {\n var collected = serialization.collect(this[0], semantic, filtering);\n\n if (elements) {\n elements.push.apply(elements, collected.controls);\n }\n\n return collected.fields;\n };\n\n /**\n * Serializes form data into a 'submittable' string. This method will return a string\n * in the format: name1=value1&name2=value2\n */\n $.fn.formSerialize = function (semantic) {\n // hand off to jQuery.param for proper encoding\n return urlencode(this.formToArray(semantic));\n };\n\n /**\n * Serializes all field elements in the jQuery object into a query string.\n * This method will return a string in the format: name1=value1&name2=value2\n */\n $.fn.fieldSerialize = function (successful) {\n var a = [];\n\n this.each(function () {\n var n = this.name;\n\n // a form is not a field, though it may have a name\n if (!n || tagName(this) === \"form\") {\n return;\n }\n\n var v = $.fieldValue(this, successful);\n\n if (v && v.constructor === Array) {\n for (var i = 0, max = v.length; i < max; i++) {\n a.push({ name: n, value: v[i] });\n }\n } else if (v !== null && typeof v !== \"undefined\") {\n a.push({ name: this.name, value: v });\n }\n });\n\n // hand off to jQuery.param for proper encoding\n return urlencode(a);\n };\n\n /**\n * Returns the value(s) of the element in the matched set. For example, consider the following form:\n *\n *\t
\n *\t\t\n *\t\t\n *\t\t\n *\t\t\n *\t\t\n *\t\t\n *\t
\n *\n *\tvar v = $('input[type=text]').fieldValue();\n *\t// if no values are entered into the text inputs\n *\tv === ['','']\n *\t// if values entered into the text inputs are 'foo' and 'bar'\n *\tv === ['foo','bar']\n *\n *\tvar v = $('input[type=checkbox]').fieldValue();\n *\t// if neither checkbox is checked\n *\tv === undefined\n *\t// if both checkboxes are checked\n *\tv === ['B1', 'B2']\n *\n *\tvar v = $('input[type=radio]').fieldValue();\n *\t// if neither radio is checked\n *\tv === undefined\n *\t// if first radio is checked\n *\tv === ['C1']\n *\n * The successful argument controls whether or not the field element must be 'successful'\n * (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls).\n * The default value of the successful argument is true. If this value is false the value(s)\n * for each element is returned.\n *\n * Note: This method *always* returns an array. If no valid value can be determined the\n *\tarray will be empty, otherwise it will contain one or more values.\n */\n $.fn.fieldValue = function (successful) {\n for (var val = [], i = 0, max = this.length; i < max; i++) {\n var el = this[i];\n var v = $.fieldValue(el, successful);\n\n if (v === null || typeof v === \"undefined\" || (v.constructor === Array && !v.length)) {\n continue;\n }\n\n if (v.constructor === Array) {\n $.merge(val, v);\n } else {\n val.push(v);\n }\n }\n\n return val;\n };\n\n /**\n * Returns the value of the field element.\n */\n $.fieldValue = function (el, successful) {\n var required = typeof successful === \"undefined\" || successful;\n\n if (required && !isSuccessful(el, submitterElement(el.form))) {\n return null;\n }\n\n return valueOf(el);\n };\n\n /**\n * Clears the form data. Takes the following actions on the form's input fields:\n * - input text fields will have their 'value' property set to the empty string\n * - select elements will have their 'selectedIndex' property set to -1\n * - checkbox and radio inputs will have their 'checked' property set to false\n * - inputs of type submit, button, reset, and hidden will *not* be effected\n * - button elements will *not* be effected\n */\n $.fn.clearForm = function (includeHidden) {\n return this.each(function () {\n $(\"input,select,textarea\", this).clearFields(includeHidden);\n });\n };\n\n /**\n * Clears the selected form elements.\n */\n $.fn.clearInputs = function (includeHidden) {\n deprecate(\"clearInputs\", \"clearInputs is deprecated, use clearFields\");\n\n return this.clearFields(includeHidden);\n };\n\n $.fn.clearFields = function (includeHidden) {\n var re =\n /^(?:color|date|datetime|datetime-local|email|month|number|password|range|search|tel|text|time|url|week)$/i; // 'hidden' is not in this list\n\n return this.each(function () {\n var t = this.type,\n tag = tagName(this);\n\n if (re.test(t) || tag === \"textarea\") {\n this.value = \"\";\n } else if (t === \"checkbox\" || t === \"radio\") {\n this.checked = false;\n } else if (tag === \"select\") {\n this.selectedIndex = -1;\n } else if (t === \"file\") {\n if (/MSIE/.test(navigator.userAgent)) {\n $(this).replaceWith($(this).clone(true));\n } else {\n $(this).val(\"\");\n }\n } else if (includeHidden) {\n // includeHidden can be the value true, or it can be a selector string\n // indicating a special test; for example:\n // $('#myForm').clearForm('.special:hidden')\n // the above would clean hidden inputs that have the class of 'special'\n if (\n (includeHidden === true && /hidden/.test(t)) ||\n (typeof includeHidden === \"string\" && $(this).is(includeHidden))\n ) {\n this.value = \"\";\n }\n }\n });\n };\n\n /**\n * Resets the form data or individual elements. Takes the following actions\n * on the selected tags:\n * - all fields within form elements will be reset to their original value\n * - input / textarea / select fields will be reset to their original value\n * - option / optgroup fields (for multi-selects) will defaulted individually\n * - non-multiple options will find the right select to default\n * - label elements will be searched against its 'for' attribute\n * - all others will be searched for appropriate children to default\n */\n $.fn.resetForm = function () {\n return this.each(function () {\n var el = $(this);\n var tag = tagName(this);\n\n switch (tag) {\n case \"input\":\n this.checked = this.defaultChecked;\n\n // as the native reset: types whose value is the value attribute keep it\n if (this.type === \"file\") {\n // a file input cannot take its value attribute; the native reset empties it\n this.value = \"\";\n } else if (!/^(?:checkbox|radio|hidden|submit|reset|button|image)$/.test(this.type)) {\n this.value = this.defaultValue;\n }\n\n return true;\n\n case \"textarea\":\n this.value = this.defaultValue;\n\n return true;\n\n case \"option\":\n case \"optgroup\":\n var select = el.parents(\"select\");\n\n if (select.length && select[0].multiple) {\n if (tag === \"option\") {\n this.selected = this.defaultSelected;\n } else {\n el.find(\"option\").resetForm();\n }\n } else {\n select.resetForm();\n }\n\n return true;\n\n case \"select\":\n // in order, as the native reset: of several default options, a single select keeps the last\n el.find(\"option\").each(function () {\n this.selected = this.defaultSelected;\n });\n\n return true;\n\n case \"label\":\n // The control whose id the for attribute names, and the controls inside the label. The\n // filter keeps a for that names an ancestor from resetting the label again.\n var forEl = this.htmlFor && this.ownerDocument.getElementById(this.htmlFor);\n\n el.find(\"input,select,textarea\").add(forEl).filter(\"input,select,textarea\").resetForm();\n\n return true;\n\n case \"form\":\n // through the prototype: a control named reset shadows the method\n callFormMethod(this, \"reset\");\n\n return true;\n\n default:\n el.find(\"form,input,label,select,textarea\").resetForm();\n\n return true;\n }\n });\n };\n\n /**\n * Enables or disables any matching elements.\n */\n $.fn.enable = function (b) {\n if (typeof b === \"undefined\") {\n b = true;\n }\n\n return this.each(function () {\n this.disabled = !b;\n });\n };\n\n /**\n * Checks/unchecks any matching checkboxes or radio buttons and\n * selects/deselects and matching option elements.\n */\n $.fn.selected = function (select) {\n if (typeof select === \"undefined\") {\n select = true;\n }\n\n return this.each(function () {\n var t = this.type;\n\n if (t === \"checkbox\" || t === \"radio\") {\n this.checked = select;\n } else if (tagName(this) === \"option\") {\n var $sel = $(this).parent(\"select\");\n\n if (select && $sel[0] && $sel[0].type === \"select-one\") {\n // deselect all other options\n $sel.find(\"option\").selected(false);\n }\n\n this.selected = select;\n }\n });\n };\n\n // expose debug var\n $.fn.ajaxSubmit.debug = false;\n})(jQuery);\n\nexport default jQuery;\n"],"names":["owners","plainForm","document","createElement","findDescriptor","name","i","length","owner","window","descriptor","Object","getOwnPropertyDescriptor","prototype","formMember","form","get","call","e","callFormMethod","value","apply","Array","slice","arguments","tagName","el","toLowerCase","isDisabled","matches","disabled","isElement","node","assertRealParent","parentNode","Error","closestByTag","names","indexOf","storeKey","setExpando","ignore","expando","els","namedItem","undefined","record","x","y","jQuery","data","type","setTimeout","captureSubmitter","target","point","offsetX","offsetY","fn","offset","pageX","left","pageY","top","offsetLeft","offsetTop","imagePoint","submitterOf","stored","log","ajaxSubmit","debug","msg","join","console","opera","postError","warned","deprecate","id","message","warn","deprecateOldJQuery","version","parts","String","split","major","Number","beforeJQuery35","shorthandOptions","options","dataType","onSuccess","result","url","success","submitOptions","key","hasOwnProperty","withoutUrl","keepContext","settings","sources","context","submitWith","isDefaultPrevented","preventDefault","originalEvent","submitter","captureEventSubmitter","doAjaxSubmit","captureSubmittingElement","this","bindDelegated","$sel","selector","off","on","closestMatch","Element","closest","is","delegated","unbindSelector","handlers","submit","click","selectionOnly","ajaxForm","jquery","delegation","bindSelector","beforeFormUnbind","ajaxFormUnbind","o","s","c","isReady","bindLater","formAttribute","attr","rLineBreak","rCR","rUnsubmittable","valueOf","index","selectedIndex","a","ops","one","max","op","selected","v","attributes","specified","text","push","selectValue","val","raw","replace","loneSurrogate","wellFormed","match","before","urlencode","fields","traditional","param","map","field","urlencodedFields","createSuccessfulControls","feature","$","controlsOf","semantic","formId","getElementsByTagName","makeArray","grep","ownedBy","test","navigator","userAgent","concat","filter","getAttribute","inArray","outsideControls","fieldsOf","n","fieldValue","constructor","fileapi","files","file","required","imageFields","sub","input","addCandidate","collected","own","controls","collect","filtering","addClickedImage","deepSerialize","extraData","part","serialized","len","decodeURIComponent","sendFormData","submission","formdata","FormData","append","serializedData","extend","ajaxSettings","contentType","processData","cache","method","uploadProgress","createXhr","xhr","upload","addEventListener","event","percent","position","loaded","total","lengthComputable","Math","ceil","beforeSend","formData","ajax","sendAjax","uploadAttributes","hasOwn","isGet","addSubmitterFields","submitterFields","addCsrfField","forms","origin","csrf_token","csrf_param","posts","property","href","location","protocol","host","setFormAttribute","getDoc","frame","doc","contentWindow","err","contentDocument","readStatus","status","statusText","readResponse","retry","errMsg","isXml","XMLDocument","isXMLDoc","body","innerHTML","docRoot","documentElement","responseText","responseXML","getResponseHeader","header","readDocument","dt","scr","textarea","ta","pre","b","textContent","innerText","readEmbedded","ct","xml","nodeName","error","dataFilter","JSON","parse","globalEval","httpData","createLifecycle","g","timeoutHandle","callbackProcessed","deferred","Deferred","aborted","getAllResponseHeaders","setRequestHeader","abort","done","rejection","textStatus","stop","reject","trigger","complete","endGlobalEvents","active","clearTimeout","release","settle","failure","resolve","succeed","start","global","fail","startTimer","onTimeout","timeout","stopTimer","createIframeTransport","hasProp","frameCount","fileUploadIframe","ownerDocument","$body","$io","iframeTarget","each","nameWindow","io","setAttribute","iframeSrc","css","createFrame","Date","getTime","life","execCommand","remove","frameHooks","domCheckCount","checkState","state","readyState","cb","doSubmit","saved","saveAttributes","mp","skipEncodingOverride","setUploadAttributes","extraInputs","added","addHiddenInput","appendTo","isPlainObject","single","f","addExtraInputs","root","contains","notInDocument","attachEvent","listen","submitForm","restoreAttributes","detachEvent","removeEventListener","unlisten","post","forceSync","jqxhr","elements","prop","removeAttr","enableControls","closeKeepAlive","createSubmission","serialization","refuse","extraQuery","optionsData","requestFormat","query","pairs","at","decodeQuery","queryPairs","defineKey","object","defineProperty","enumerable","writable","configurable","callbackList","callback","isArray","callEach","callbacks","args","prepare","$set","action","trim","URL","withDefaults","defaultType","veto","beforeSerialize","qx","beforeSubmit","resolved","resolveMethod","extra","stringify","jsonBody","q","toUpperCase","hashAt","base","encode","$form","deliver","resetForm","clearForm","includeHidden","successes","jqXHR","successArguments","replaceTarget","$target","merge","errors","completes","chooseTransport","hasFileInputs","add","multipart","attribute","fileAPI","shouldUseFrame","transport","iframe","steps","transports","attr2","removeData","k","formToArray","formSerialize","fieldSerialize","successful","t","checked","isSuccessful","clearFields","clearInputs","re","tag","replaceWith","clone","defaultChecked","defaultValue","select","parents","multiple","defaultSelected","find","forEl","htmlFor","getElementById","enable","parent"],"mappings":";;;;;;;;;;;;;;;;;;;;;4ZAMIA,EAAS,CAAC,kBAAmB,cAAe,UAAW,QAGvDC,EAAYC,EAASC,cAAc,QAEvC,SAASC,EAAeC,GACtB,IAAK,IAAIC,EAAI,EAAGA,EAAIN,EAAOO,OAAQD,IAAK,CACtC,IAAIE,EAAQC,EAAOT,EAAOM,IACtBI,EAAaF,GAASG,OAAOC,yBAAyBJ,EAAMK,UAAWR,GAE3E,GAAIK,EACF,OAAOA,CAEX,CAEA,OAAO,IACT,CAOO,SAASI,EAAWC,EAAMV,GAC/B,IAAIK,EAAaN,EAAeC,GAEhC,IACE,OAAOK,EAAWM,IAAIC,KAAKF,EAC7B,CAAE,MAAOG,GACP,OAAOH,EAAKV,EACd,CACF,CAMO,SAASc,EAAeJ,EAAMV,GACnC,IAAIK,EAAaN,EAAeC,GAGhC,OAFaK,EAAaA,EAAWU,MAAQnB,EAAUI,IAEzCgB,MAAMN,EAAMO,MAAMT,UAAUU,MAAMN,KAAKO,UAAW,GAClE,CAGO,SAASC,EAAQC,GACtB,IAAIrB,EAAOS,EAAWY,EAAI,WAE1B,MAAuB,iBAATrB,EAAoBA,EAAKsB,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mjs b/dist/jquery.form.mjs index e3cbd7c..e95ede5 100644 --- a/dist/jquery.form.mjs +++ b/dist/jquery.form.mjs @@ -80,6 +80,14 @@ function tagName(el) { return typeof name === "string" ? name.toLowerCase() : ""; } +/** + * Whether a control or option is disabled, also through a disabled fieldset or optgroup. Without + * selector matching, only its own disabled property is read. + */ +function isDisabled(el) { + return typeof el.matches === "function" ? el.matches(":disabled") : !!el.disabled; +} + // Elements only: the subject of formToArray may also be the document or a plain object. function isElement(node) { return formMember(node, "nodeType") === 1; @@ -226,7 +234,8 @@ function submitterFields(form) { var sub = submitterOf(form); var el = sub && sub.el; - if (el && el.name && !el.disabled) { + // a disabled button is not sent, also when a disabled fieldset disables it + if (el && el.name && !isDisabled(el)) { fields[el.name] = el.value; if (el.type === "image") { fields[el.name + ".x"] = sub.x; @@ -580,14 +589,6 @@ var rCR = /\r/g; // Listed form elements that are never submitted. var rUnsubmittable = /^(?:fieldset|object|output)$/; -/** - * Whether a control or option is disabled, also through a disabled fieldset or optgroup. Without - * selector matching, only its own disabled property is read. - */ -function isDisabled(el) { - return typeof el.matches === "function" ? el.matches(":disabled") : !!el.disabled; -} - /** * The successful-control rule: whether a control is sent. `submitter` is the button that * submitted the control's form; other submit and image buttons of a form are not sent. diff --git a/docs/research/4x-behavior-changes.md b/docs/research/4x-behavior-changes.md index 2d0927e..e165394 100644 --- a/docs/research/4x-behavior-changes.md +++ b/docs/research/4x-behavior-changes.md @@ -120,6 +120,7 @@ Collected as the modernization proceeds. Each entry is a change a consumer could - **The CommonJS factory uses the window it is given.** `require("jquery-form")(root, $)` read the global `window` and `document`, so it threw in Node unless a DOM was global (as in jest-environment-jsdom). The classic build now takes `window`, `document`, `navigator`, `Element` and `FormData` from `root`, falling back to the global window. jQuery 4 itself still needs a global window when required without one. - **Spaces encode as `+` on every jQuery version.** jQuery 3 and later made `$.param` write a space as `%20`, so `formSerialize`, `fieldSerialize`, a GET query string and the `data` that `beforeSend` sees used `%20`, while jQuery 1 and 2 and a native form submission use `+`. They now use `+` everywhere. Servers decode both the same way; only code that compares the strings sees a difference. A string `data` option is passed through unchanged. - **An iframe response that cannot be parsed rejects with `parsererror`.** The Deferred of an iframe upload rejected with `"error"` when the response did not parse for the `dataType`, while `error`, `complete` and an XHR request report `"parsererror"`; it now rejects with `"parsererror"` too. When the response also carries an emulated error status (a `status` attribute outside 2xx), `error`, `ajaxError` and the rejection now receive the `statusText` attribute, as `$.ajax` reports a server error, instead of the parse exception; the status stays `"error"`. +- **An iframe upload no longer sends a button disabled by its fieldset.** The clicked button (from a click, `form.clk` or `requestSubmit(button)`) was added to an iframe upload when a disabled `
` disabled it; only its own `disabled` was checked. It is now left out, as the XHR transports and a native submission do. A button in the first `` of a disabled fieldset is still sent. The submitter's fields still come after the form's own. ## Known behavior, not changed diff --git a/src/form-members.js b/src/form-members.js index 835f722..130ee10 100644 --- a/src/form-members.js +++ b/src/form-members.js @@ -55,6 +55,14 @@ export function tagName(el) { return typeof name === "string" ? name.toLowerCase() : ""; } +/** + * Whether a control or option is disabled, also through a disabled fieldset or optgroup. Without + * selector matching, only its own disabled property is read. + */ +export function isDisabled(el) { + return typeof el.matches === "function" ? el.matches(":disabled") : !!el.disabled; +} + // Elements only: the subject of formToArray may also be the document or a plain object. export function isElement(node) { return formMember(node, "nodeType") === 1; diff --git a/src/submitter.js b/src/submitter.js index 2fe7cd3..09f4ae1 100644 --- a/src/submitter.js +++ b/src/submitter.js @@ -1,4 +1,4 @@ -import { closestByTag, formMember } from "./form-members.js"; +import { closestByTag, formMember, isDisabled } from "./form-members.js"; import jQuery from "jquery"; // The submitter: the button that submitted a form, captured from ajaxForm's clicks. It is kept in @@ -121,7 +121,8 @@ export function submitterFields(form) { var sub = submitterOf(form); var el = sub && sub.el; - if (el && el.name && !el.disabled) { + // a disabled button is not sent, also when a disabled fieldset disables it + if (el && el.name && !isDisabled(el)) { fields[el.name] = el.value; if (el.type === "image") { fields[el.name + ".x"] = sub.x; diff --git a/src/successful-controls.js b/src/successful-controls.js index 3a8b999..f65e330 100644 --- a/src/successful-controls.js +++ b/src/successful-controls.js @@ -1,4 +1,4 @@ -import { callFormMethod, formMember, isElement, tagName } from "./form-members.js"; +import { callFormMethod, formMember, isDisabled, isElement, tagName } from "./form-members.js"; import { formAttribute } from "./form-attributes.js"; import jQuery from "jquery"; import { submitterOf } from "./submitter.js"; @@ -13,14 +13,6 @@ var rCR = /\r/g; // Listed form elements that are never submitted. var rUnsubmittable = /^(?:fieldset|object|output)$/; -/** - * Whether a control or option is disabled, also through a disabled fieldset or optgroup. Without - * selector matching, only its own disabled property is read. - */ -function isDisabled(el) { - return typeof el.matches === "function" ? el.matches(":disabled") : !!el.disabled; -} - /** * The successful-control rule: whether a control is sent. `submitter` is the button that * submitted the control's form; other submit and image buttons of a form are not sent. diff --git a/test/e2e/harness.js b/test/e2e/harness.js index e4f3f5e..fc2436b 100644 --- a/test/e2e/harness.js +++ b/test/e2e/harness.js @@ -71,11 +71,11 @@ const E2E_DIFFERENCES = [ }, { id: "IFRAME-SUBMITTER", - description: - "an iframe upload appends the submitter's fields after the form's, also for a disabled submitter", + description: "an iframe upload appends the submitter's fields after the form's", normalize: (pair, ctx) => { const sub = ctx.submitter; - if (!ctx.transport.iframe || !sub || !sub.name) { + // a disabled submitter is sent by neither, so any field of it fails the comparison + if (!ctx.transport.iframe || !sub || !sub.name || isDisabled(sub)) { return pair; } // The extra inputs go at the end of the form, before outside controls that follow it. @@ -85,16 +85,13 @@ const E2E_DIFFERENCES = [ const index = plugin.map((e) => e[0] === n).lastIndexOf(true); plugin = plugin.filter((e, i) => i !== index); }); - let native = pair.native; - if (!isDisabled(sub)) { - const own = isImage(sub) - ? (e) => e[0] === names[1] || e[0] === names[2] - : (e) => e[0] === sub.name; - const index = isImage(sub) ? -1 : native.map((e) => own(e)).lastIndexOf(true); - native = isImage(sub) - ? native.filter((e) => !own(e)) - : native.filter((e, i) => i !== index); - } + const own = isImage(sub) + ? (e) => e[0] === names[1] || e[0] === names[2] + : (e) => e[0] === sub.name; + const index = isImage(sub) ? -1 : pair.native.map((e) => own(e)).lastIndexOf(true); + const native = isImage(sub) + ? pair.native.filter((e) => !own(e)) + : pair.native.filter((e, i) => i !== index); return { plugin: plugin, native: native }; }, }, diff --git a/test/suite/iframe-transport.test.js b/test/suite/iframe-transport.test.js index 3aac9a1..dac4494 100644 --- a/test/suite/iframe-transport.test.js +++ b/test/suite/iframe-transport.test.js @@ -1993,6 +1993,82 @@ describe("form", function () { assert.deepEqual(fields, []); }); + it("should not post a clicked button in a disabled fieldset", function () { + const $form = createIframeForm("ajax/iframe-text.html"); + const $fieldset = $("
").appendTo($form); + $form[0].clk = $(' @@ -205,7 +205,7 @@ function showResponse(responseText, statusText, xhr, $form) { } ``` -
+
@@ -253,7 +253,7 @@ function showResponse(responseText, statusText, xhr, $form) {
Name:
- +
#### Output Div (#output2): @@ -271,7 +271,7 @@ The following login form is used for each of the examples that follow. Each exam #### Form Markup: ```html -
+ Username: Password: @@ -290,7 +290,7 @@ $(document).ready(function () { #### Validate Using the `formData` Argument -
+
Username: Password: @@ -322,7 +322,7 @@ function validate(formData, jqForm, options) { #### Validate Using the `jqForm` Argument -
+
Username: Password: @@ -347,7 +347,7 @@ function validate(formData, jqForm, options) { #### Validate Using the `fieldValue` Method -
+
Username: Password: @@ -387,13 +387,13 @@ This page shows how to handle JSON data returned from the server. The form below #### Form markup: ```html - + Message: ``` -
+
Message:
@@ -439,13 +439,13 @@ This page shows how to handle XML data returned from the server. The form below #### Form markup: ```html -
+ Message:
``` -
+
Message:
@@ -497,13 +497,13 @@ This page shows how to handle HTML data returned from the server. The form below #### Form markup: ```html -
+ Message:
``` -
+
Message:
@@ -572,7 +572,7 @@ if (!$xhr) The form below provides an input element of type "file" along with a select element to specify the dataType of the response. The form is submitted to `files.php` which uses the dataType to determine what type of response to return. -
+ File: Return Type: (ie: textarea, [@type='hidden'], :radio, :checkbox, etc)
- [Successful controls](https://www.w3.org/TR/html5/forms.html#constructing-form-data-set) only
+ Successful controls only
@@ -72,7 +72,7 @@ var queryString = $("#myForm :text").fieldSerialize();
-By default, `fieldValue` and `fieldSerialize` only function on '[successful controls](https://www.w3.org/TR/html5/forms.html#constructing-form-data-set)'. This means that if you run the following code on a checkbox that is not checked, the result will be an empty array. +By default, `fieldValue` and `fieldSerialize` only function on '[successful controls](https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#constructing-the-form-data-set)'. This means that if you run the following code on a checkbox that is not checked, the result will be an empty array. ```javascript // value will be an empty array if checkbox is not checked: diff --git a/docs/options.md b/docs/options.md index f05c8a8..e4eb022 100644 --- a/docs/options.md +++ b/docs/options.md @@ -108,7 +108,7 @@ Boolean value. Set to true to remove short delay before posting form when upload ### iframe Default: `false` -Boolean flag indicating whether the form should always target the server response to an iframe. This is useful in conjuction with file uploads. See the _File Uploads_ documentation on the [Code Samples](#code-samples) page for more info. +Boolean flag indicating whether the form should always target the server response to an iframe. This is useful in conjuction with file uploads. See the [file upload example](examples.md#file-upload). Without `FormData`, a form with a selected file or a multipart `enctype` also uses the iframe. Choosing it automatically is deprecated (a `debug` warning); 5.0 uses the iframe only when `iframe: true` is set. @@ -145,7 +145,7 @@ Optionally used along with the the [`target`](#target) option. Set to `true` if ### requestFormat Default: `null` -Set to `"json"` to send the form as a JSON body instead of a urlencoded one (#545). The fields become an object, a name used more than once becomes an array of its values, and an object [`data`](#data) option is merged over them. The request is sent with `contentType: "application/json; charset=UTF-8"`, replacing any `contentType` you pass. It needs a method with a body: a `GET` method (including a form without a `method` attribute) throws an error, as do a string `data` option, a selected file, a multipart form and the [`iframe`](#iframe) option. **(version added: 4.5.0)** Based on the idea in PR #557 by zhangciwu (changwei). +Set to `"json"` to send the form as a JSON body instead of a urlencoded one ([#545](https://github.com/jquery-form/form/issues/545)). The fields become an object, a name used more than once becomes an array of its values, and an object [`data`](#data) option is merged over them. The request is sent with `contentType: "application/json; charset=UTF-8"`, replacing any `contentType` you pass. It needs a method with a body: a `GET` method (including a form without a `method` attribute) throws an error, as do a string `data` option, a selected file, a multipart form and the [`iframe`](#iframe) option. **(version added: 4.5.0)** Based on the idea in PR [#557](https://github.com/jquery-form/form/pull/557) by zhangciwu (changwei). ### resetForm From 29b3b5435e104b30a3e0cdb0e81e89865bc87af4 Mon Sep 17 00:00:00 2001 From: Kevin Morris Date: Tue, 10 Nov 2026 20:09:08 -0500 Subject: [PATCH 72/78] docs: fix the CONTRIBUTORS heading levels and the trailing blank line in SECURITY --- CONTRIBUTORS.md | 6 ++++-- SECURITY.md | 1 - 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 456cea4..3831e2f 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -1,10 +1,12 @@ # Contributors -### Copyright 2017 Kevin Morris +## Copyright 2017 Kevin Morris + Continuing Work [jQuery Form](https://github.com/jquery-form/form/) by Kevin Morris Project Home: [github.com/jquery-form/form](https://github.com/jquery-form/form/) -### Copyright 2006-2014 Mike Alsup +## Copyright 2006-2014 Mike Alsup + Original work [jQuery Form](https://github.com/malsup/form/) by Mike Alsup Project Home: [malsup.com/jquery/form](https://malsup.com/jquery/form/) The jQuery Form Plugin allows you to easily and unobtrusively upgrade HTML forms to use AJAX. diff --git a/SECURITY.md b/SECURITY.md index 570dafb..1a48aa2 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -18,4 +18,3 @@ Report them privately through GitHub: open the repository's **Security** tab and Include the plugin and jQuery versions, the options used, and a minimal reproduction. Reporters are credited in the advisory unless they ask not to be. - From c6c930027719bd9515f67f696a5e6a71a4525ed6 Mon Sep 17 00:00:00 2001 From: Kevin Morris Date: Tue, 10 Nov 2026 20:09:08 -0500 Subject: [PATCH 73/78] docs: escape the pipes that split a tooling-research table row --- docs/research/tooling-research.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/research/tooling-research.md b/docs/research/tooling-research.md index 4868987..ee103b1 100644 --- a/docs/research/tooling-research.md +++ b/docs/research/tooling-research.md @@ -127,7 +127,7 @@ Line numbers from current `src/jquery.form.js` (1540 lines). Best option for 100 | 688-690 | `io.attachEvent` (IE<9) vs `addEventListener` | dead branch | remove | | 751-800 | iframe response handling: `doc.XMLDocument`, Opera retry (775-785), `xhr.responseXML = doc.XMLDocument ?...` (771, 793) | IE/Opera only | remove Opera/XMLDocument parts | | 914-918 | `window.ActiveXObject` / `Microsoft.XMLDOM` for `toXml` | IE only | use `DOMParser` | -| 925-928 | `$.parseJSON | | ` fallback | dead on 4, jQuery 3 has it | `JSON.parse` | +| 925-928 | `$.parseJSON \|\|` fallback | dead on 4, jQuery 3 has it | `JSON.parse` | | 1115 | `/(Edge\|Trident)\//.test(navigator.userAgent)` in `formToArray` form-attribute handling | legacy Edge/IE UA | remove; verify `form=` attribute works in modern browsers | | 1157 | `feature.fileapi && el.type === 'file'` | always true | simplify | | 1379 | `/MSIE/.test(navigator.userAgent)` in `clearFields` file input (clone/replace) | IE only | `$(this).val('')` | From 2197184d28eeea97cc6421382fecc2bacf075e6c Mon Sep 17 00:00:00 2001 From: Kevin Morris Date: Sat, 14 Nov 2026 08:39:39 -0500 Subject: [PATCH 74/78] chore: release 4.6.0 --- dist/jquery.form.js | 2 +- dist/jquery.form.min.js | 2 +- dist/jquery.form.min.js.map | 2 +- dist/jquery.form.mjs | 2 +- form.jquery.json | 2 +- package-lock.json | 4 ++-- package.json | 2 +- src/jquery.form.js | 2 +- 8 files changed, 9 insertions(+), 9 deletions(-) diff --git a/dist/jquery.form.js b/dist/jquery.form.js index 1a48567..eb1af99 100644 --- a/dist/jquery.form.js +++ b/dist/jquery.form.js @@ -1,6 +1,6 @@ /*! * jQuery Form Plugin - * version: 4.5.0 + * version: 4.6.0 * Requires jQuery v1.7.2 or later * Project repository: https://github.com/jquery-form/form diff --git a/dist/jquery.form.min.js b/dist/jquery.form.min.js index 0503038..68d39c1 100644 --- a/dist/jquery.form.min.js +++ b/dist/jquery.form.min.js @@ -1,6 +1,6 @@ /*! * jQuery Form Plugin - * version: 4.5.0 + * version: 4.6.0 * Requires jQuery v1.7.2 or later * Project repository: https://github.com/jquery-form/form diff --git a/dist/jquery.form.min.js.map b/dist/jquery.form.min.js.map index 3355517..f9fcc2b 100644 --- a/dist/jquery.form.min.js.map +++ b/dist/jquery.form.min.js.map @@ -1 +1 @@ -{"version":3,"file":"jquery.form.min.js","sources":["../src/form-members.js","../src/submitter.js","../src/diagnostics.js","../src/options.js","../src/ajax-form.js","../src/form-attributes.js","../src/successful-controls.js","../src/xhr-transport.js","../src/iframe-post.js","../src/iframe-response.js","../src/iframe-lifecycle.js","../src/iframe-transport.js","../src/submission.js","../src/jquery.form.js"],"sourcesContent":["// Form members: the properties and methods the plugin reads or calls on a form. A control named\n// like a member (elements, setAttribute) shadows that member on the form itself, so members are\n// read through the DOM prototypes, which a control cannot shadow.\n\n// The prototype chain of a form, nearest first. Looked up on every call: old browsers have no\n// DOM prototypes, and tests remove them.\nvar owners = [\"HTMLFormElement\", \"HTMLElement\", \"Element\", \"Node\"];\n\n// A form no control can shadow, for methods when the DOM has no prototypes to read them from.\nvar plainForm = document.createElement(\"form\");\n\nfunction findDescriptor(name) {\n for (var i = 0; i < owners.length; i++) {\n var owner = window[owners[i]];\n var descriptor = owner && Object.getOwnPropertyDescriptor(owner.prototype, name);\n\n if (descriptor) {\n return descriptor;\n }\n }\n\n return null;\n}\n\n/**\n * Reads a member of a form through its prototype getter.\n * Falls back to the plain property without DOM prototypes, or on an element the getter does not\n * accept (such as a fieldset for `elements`).\n */\nexport function formMember(form, name) {\n var descriptor = findDescriptor(name);\n\n try {\n return descriptor.get.call(form);\n } catch (e) {\n return form[name];\n }\n}\n\n/**\n * Calls a method of a form through its prototype, or through an unshadowed form without DOM\n * prototypes.\n */\nexport function callFormMethod(form, name) {\n var descriptor = findDescriptor(name);\n var method = descriptor ? descriptor.value : plainForm[name];\n\n return method.apply(form, Array.prototype.slice.call(arguments, 2));\n}\n\n// Nodes such as the document and text nodes have no tag name (#600).\nexport function tagName(el) {\n var name = formMember(el, \"tagName\");\n\n return typeof name === \"string\" ? name.toLowerCase() : \"\";\n}\n\n/**\n * Whether a control or option is disabled, also through a disabled fieldset or optgroup. Without\n * selector matching, only its own disabled property is read.\n */\nexport function isDisabled(el) {\n return typeof el.matches === \"function\" ? el.matches(\":disabled\") : !!el.disabled;\n}\n\n// Elements only: the subject of formToArray may also be the document or a plain object.\nexport function isElement(node) {\n return formMember(node, \"nodeType\") === 1;\n}\n\n// A control named parentNode makes every parentNode walk (jQuery's trigger and closest among\n// them) cycle between the form and the control.\nexport function assertRealParent(el) {\n if (el.parentNode !== formMember(el, \"parentNode\")) {\n throw new Error(\n 'jquery.form: a form control named \"parentNode\" hides the form\\'s parentNode; rename the control'\n );\n }\n}\n\n// The element itself or its nearest ancestor with one of the tag names, through the real tree.\nexport function closestByTag(el, names) {\n for (var node = el; node; node = formMember(node, \"parentNode\")) {\n if (names.indexOf(tagName(node)) >= 0) {\n return node;\n }\n }\n\n return null;\n}\n","import { closestByTag, formMember, isDisabled } from \"./form-members.js\";\nimport jQuery from \"jquery\";\n\n// The submitter: the button that submitted a form, captured from ajaxForm's clicks. It is kept in\n// a private store and cleared shortly after the click. The form's clk, clk_x and clk_y properties\n// are still written for pages that read them, and read when the store has none.\n\nvar storeKey = \"jqFormSubmitter\";\n\n// Writes a property on the form; a control with that name makes it read-only.\nfunction setExpando(form, name, value) {\n try {\n form[name] = value;\n } catch (ignore) {\n // the control keeps the name; the store has the submitter\n }\n}\n\n// A property the page set on the form, never a control of the form with that name.\nfunction expando(form, name) {\n var value = form[name];\n var els = formMember(form, \"elements\");\n\n return els && value && els.namedItem(name) === value ? undefined : value;\n}\n\n// Records a submitter for a form until the click window ends.\nfunction record(form, el, x, y) {\n jQuery.data(form, storeKey, { el: el, x: x, y: y });\n setExpando(form, \"clk\", el);\n\n if (el.type === \"image\") {\n setExpando(form, \"clk_x\", x);\n setExpando(form, \"clk_y\", y);\n }\n\n // clear form vars\n setTimeout(function () {\n jQuery.data(form, storeKey, null);\n setExpando(form, \"clk\", null);\n setExpando(form, \"clk_x\", null);\n setExpando(form, \"clk_y\", null);\n }, 100);\n}\n\n// The clicked point of an image button, relative to the image.\nfunction imagePoint(e, target) {\n if (typeof e.offsetX !== \"undefined\") {\n return [e.offsetX, e.offsetY];\n }\n\n if (typeof jQuery.fn.offset === \"function\") {\n var offset = jQuery(target).offset();\n\n return [e.pageX - offset.left, e.pageY - offset.top];\n }\n\n return [e.pageX - target.offsetLeft, e.pageY - target.offsetTop];\n}\n\n/**\n * Records the submit or image button a click event reached, for the form it belongs to.\n */\nexport function captureSubmitter(e) {\n // the clicked control, or the button around the clicked content (ex: a span within a button)\n var target = closestByTag(e.target, [\"button\", \"input\"]);\n\n // the type property, unlike the attribute, is \"submit\" for a button without a type (#588)\n if (!target || (target.type !== \"submit\" && target.type !== \"image\")) {\n return;\n }\n\n var form = target.form;\n\n if (!form) {\n // a submit control that belongs to no form\n return;\n }\n\n var point = target.type === \"image\" ? imagePoint(e, target) : [];\n\n record(form, target, point[0], point[1]);\n}\n\n/**\n * Records the submitter a submit event names (SubmitEvent.submitter), when no click was captured.\n * An image submitter gets the point 0,0, as native submission sends it without a click.\n */\nexport function captureEventSubmitter(e, form) {\n var el = e.originalEvent && e.originalEvent.submitter;\n\n if (el && !submitterOf(form)) {\n record(form, el, 0, 0);\n }\n}\n\n/**\n * The form's submitter as { el, x, y } (x and y for an image button), or null.\n */\nexport function submitterOf(form) {\n if (!form) {\n return null;\n }\n\n var stored = jQuery.data(form, storeKey);\n\n if (stored) {\n return stored;\n }\n\n var el = expando(form, \"clk\");\n\n return el ? { el: el, x: expando(form, \"clk_x\"), y: expando(form, \"clk_y\") } : null;\n}\n\n/**\n * The submitter's fields for a post that adds them itself (the iframe upload), as name β†’ value.\n */\nexport function submitterFields(form) {\n var fields = {};\n var sub = submitterOf(form);\n var el = sub && sub.el;\n\n // a disabled button is not sent, also when a disabled fieldset disables it\n if (el && el.name && !isDisabled(el)) {\n fields[el.name] = el.value;\n if (el.type === \"image\") {\n fields[el.name + \".x\"] = sub.x;\n fields[el.name + \".y\"] = sub.y;\n }\n }\n\n return fields;\n}\n\n/**\n * The form's submitter element, or null.\n */\nexport function submitterElement(form) {\n var sub = submitterOf(form);\n\n return sub ? sub.el : null;\n}\n","import jQuery from \"jquery\";\n\n// Debug logging, switched on by $.fn.ajaxSubmit.debug. The flag is read on every call, so it can\n// be turned on after the plugin loads.\nexport function log() {\n if (!jQuery.fn.ajaxSubmit.debug) {\n return;\n }\n\n var msg = \"[jquery.form] \" + Array.prototype.join.call(arguments, \"\");\n\n if (window.console && window.console.log) {\n window.console.log(msg);\n } else if (window.opera && window.opera.postError) {\n window.opera.postError(msg);\n }\n}\n\nvar warned = {};\n\n/**\n * A deprecation warning: console.warn, only while debug is on, once per id per page. The message\n * names the replacement; the warning adds that the feature is removed in 5.0.\n */\nexport function deprecate(id, message) {\n if (!jQuery.fn.ajaxSubmit.debug || warned[id]) {\n return;\n }\n\n warned[id] = true;\n\n if (window.console && typeof window.console.warn === \"function\") {\n window.console.warn(\"[jquery.form] \" + message + \" (removed in 5.0)\");\n }\n}\n\n// Forgets which deprecations have warned (for tests).\nexport function resetDeprecations() {\n warned = {};\n}\n\n// True for a jQuery version string older than 3.5.\nexport function beforeJQuery35(version) {\n var parts = String(version).split(\".\");\n var major = Number(parts[0]);\n\n return major < 3 || (major === 3 && Number(parts[1]) < 5);\n}\n\n// 5.0 needs jQuery 3.5 or later: warned on the first ajaxSubmit or ajaxForm, given jQuery's version.\nexport function deprecateOldJQuery(version) {\n if (beforeJQuery35(version)) {\n deprecate(\n \"jquery\",\n \"support for jQuery \" + version + \" is deprecated, 5.0 needs jQuery 3.5 or later\"\n );\n }\n}\n","import jQuery from \"jquery\";\nimport { log } from \"./diagnostics.js\";\n\n// The arguments ajaxSubmit and ajaxForm accept in place of an options object.\n\n/**\n * Turns the (url, data, dataType, success) shorthand into options. A url of false is kept as\n * the url; anything else is returned as given.\n */\nexport function shorthandOptions(options, data, dataType, onSuccess) {\n if (typeof options !== \"string\" && options !== false) {\n return options;\n }\n\n var result = { url: options, data: data, dataType: dataType };\n\n if (typeof onSuccess === \"function\") {\n result.success = onSuccess;\n }\n\n return result;\n}\n\n// A copy of options without its url, so the form action is used.\nfunction withoutUrl(options) {\n var result = {};\n\n for (var key in options) {\n if (key !== \"url\" && Object.prototype.hasOwnProperty.call(options, key)) {\n result[key] = options[key];\n }\n }\n\n return result;\n}\n\n/**\n * The options ajaxSubmit starts from: a function is the success callback, the shorthand is\n * expanded, and no options at all is an empty object. A url of false or \"\" means the form action.\n */\nexport function submitOptions(options, data, dataType, onSuccess) {\n if (typeof options === \"function\") {\n return { success: options };\n }\n\n options = shorthandOptions(options, data, dataType, onSuccess);\n\n if (typeof options === \"undefined\") {\n return {};\n }\n\n return options.url === false || options.url === \"\" ? withoutUrl(options) : options;\n}\n\n/**\n * jQuery treats `context` as a flat option: after a deep merge, the settings get back the\n * caller's own object from the last source that has one, so `this` in callbacks is that object.\n */\nexport function keepContext(settings, sources) {\n for (var i = 0; i < sources.length; i++) {\n if (sources[i].context !== undefined) {\n settings.context = sources[i].context;\n }\n }\n\n return settings;\n}\n\n/**\n * The elements a selector option (target, iframeTarget) names. A string is only ever a selector,\n * looked up in the document, so jQuery never builds elements from it; a string starting with \"<\"\n * is HTML, not a selector, and matches nothing. Elements and jQuery objects are used as given.\n */\nexport function selectorOption(value, ownerDocument) {\n if (typeof value !== \"string\") {\n return jQuery(value);\n }\n\n if (/^\\s*\"'\n );\n jQuery(function () {\n jQuery(o.s, o.c).ajaxForm(options);\n });\n\n return $sel;\n }\n\n // is your DOM ready? http://docs.jquery.com/Tutorials:Introducing_$(document).ready()\n log(\"terminating; zero elements found by selector\" + (jQuery.isReady ? \"\" : \" (DOM not ready)\"));\n\n return $sel;\n}\n\n// delegation: true on jQuery 3 and later, where the selection has no selector: always warned,\n// debug or not, once per ajaxForm call.\nfunction warnUnscoped() {\n var console = window.console || {};\n\n if (typeof console.warn === \"function\") {\n console.warn(\n \"[jquery.form] delegation: true binds every form on the page on jQuery 3 and later; \" +\n 'pass a selector instead, e.g. delegation: \"form.ajax\"'\n );\n }\n}\n\nfunction bindDelegated($sel, options) {\n if ($sel.selector === undefined) {\n warnUnscoped();\n }\n\n jQuery(document)\n .off(\"submit.form-plugin\", $sel.selector, doAjaxSubmit)\n .off(\"click.form-plugin\", $sel.selector, captureSubmittingElement)\n .on(\"submit.form-plugin\", $sel.selector, options, doAjaxSubmit)\n .on(\"click.form-plugin\", $sel.selector, options, captureSubmittingElement);\n\n return $sel;\n}\n\n// The element itself or its nearest ancestor that matches the selector. The walk never reads a\n// parentNode a control can hide (jQuery's delegated walk does, and cycles on such a form).\nfunction closestMatch(el, selector) {\n if (!isElement(el)) {\n return null;\n }\n\n if (window.Element && Element.prototype.closest) {\n return Element.prototype.closest.call(el, selector);\n }\n\n for (var node = el; node && isElement(node); node = formMember(node, \"parentNode\")) {\n if (jQuery(node).is(selector)) {\n return node;\n }\n }\n\n return null;\n}\n\n// The document handlers bound for each delegation selector, keyed by \"s\" + selector.\nvar delegated = {};\n\nfunction unbindSelector(selector) {\n var handlers = delegated[\"s\" + selector];\n\n if (handlers) {\n jQuery(document)\n .off(\"submit.form-plugin\", handlers.submit)\n .off(\"click.form-plugin\", handlers.click);\n delete delegated[\"s\" + selector];\n }\n}\n\n// delegation: \"\": one handler pair on the document, scoped to the selector.\nfunction bindSelector($sel, selector, options) {\n if (!selector) {\n throw new Error(\"jquery.form: delegation needs a selector, or true\");\n }\n\n var handlers = {\n submit: function (e) {\n if (closestMatch(e.target, selector)) {\n submitWith(e, options);\n }\n },\n click: function (e) {\n if (closestMatch(e.target, selector)) {\n captureSubmitter(e);\n }\n },\n };\n\n unbindSelector(selector);\n delegated[\"s\" + selector] = handlers;\n jQuery(document)\n .on(\"submit.form-plugin\", handlers.submit)\n .on(\"click.form-plugin\", handlers.click);\n\n return $sel;\n}\n\n// Passed by ajaxForm's own rebind: unbind the selection only, never the document handlers.\nvar selectionOnly = {};\n\n/**\n * ajaxForm() binds the selected forms so a submit is sent with ajaxSubmit, with the clicked\n * submit button (and image coordinates) included. The options work as for ajaxSubmit.\n */\nexport function ajaxForm(options, data, dataType, onSuccess) {\n deprecateOldJQuery(jQuery.fn.jquery);\n options = shorthandOptions(options, data, dataType, onSuccess) || {};\n\n if (typeof options.delegation === \"string\") {\n return bindSelector(this, options.delegation, options);\n }\n\n options.delegation = options.delegation && typeof jQuery.fn.on === \"function\";\n\n if (!options.delegation && this.length === 0) {\n return bindLater(this, options);\n }\n\n if (options.delegation) {\n return bindDelegated(this, options);\n }\n\n if (options.beforeFormUnbind) {\n options.beforeFormUnbind(this, options);\n }\n\n return this.ajaxFormUnbind(selectionOnly)\n .on(\"submit.form-plugin\", options, doAjaxSubmit)\n .on(\"click.form-plugin\", options, captureSubmittingElement);\n}\n\n/**\n * ajaxFormUnbind() removes the handlers ajaxForm bound on the selection and every delegated\n * binding on the document. ajaxFormUnbind(selector) removes only that delegation selector.\n */\nexport function ajaxFormUnbind(selector) {\n if (typeof selector === \"string\") {\n unbindSelector(selector);\n\n return this;\n }\n\n if (selector !== selectionOnly) {\n delegated = {};\n jQuery(document).off(\"submit.form-plugin click.form-plugin\");\n }\n\n return this.off(\"submit.form-plugin click.form-plugin\");\n}\n","import { callFormMethod, isElement } from \"./form-members.js\";\nimport jQuery from \"jquery\";\n\n/**\n * An attribute of a form, or undefined when it is absent, as jQuery's attr returns it. The\n * subject may also be the document or a plain object, read through jQuery.\n */\nexport function formAttribute(form, name) {\n if (!isElement(form)) {\n return jQuery(form).attr(name);\n }\n\n var value = callFormMethod(form, \"getAttribute\", name);\n\n return value === null ? undefined : value;\n}\n","import { callFormMethod, formMember, isDisabled, isElement, tagName } from \"./form-members.js\";\nimport { submitterElement, submitterOf } from \"./submitter.js\";\nimport { deprecate } from \"./diagnostics.js\";\nimport { formAttribute } from \"./form-attributes.js\";\nimport jQuery from \"jquery\";\n\n// Successful controls: which controls of a form are sent, and as which name/value fields\n// (https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#constructing-the-form-data-set).\n\n// Line breaks, sent as CRLF\nvar rLineBreak = /\\r\\n|\\r|\\n/g;\nvar rCR = /\\r/g;\n\n// Listed form elements that are never submitted.\nvar rUnsubmittable = /^(?:fieldset|object|output)$/;\n\n/**\n * The successful-control rule: whether a control is sent. `submitter` is the button that\n * submitted the control's form; other submit and image buttons of a form are not sent.\n */\nexport function isSuccessful(el, submitter) {\n var t = el.type;\n\n if (!el.name || isDisabled(el) || t === \"reset\" || t === \"button\") {\n return false;\n }\n\n if (t === \"checkbox\" || t === \"radio\") {\n return !!el.checked;\n }\n\n if (t === \"submit\" || t === \"image\") {\n return !el.form || submitter === el;\n }\n\n return tagName(el) !== \"select\" || el.selectedIndex !== -1;\n}\n\n// The value of a select: the selected option's value for one, a list for several.\nfunction selectValue(el) {\n var index = el.selectedIndex;\n\n if (index < 0) {\n return null;\n }\n\n var a = [],\n ops = el.options;\n var one = el.type === \"select-one\";\n var max = one ? index + 1 : ops.length;\n\n for (var i = one ? index : 0; i < max; i++) {\n var op = ops[i];\n\n if (op.selected && !isDisabled(op)) {\n var v = op.value;\n\n if (!v) {\n // extra pain for IE...\n v =\n op.attributes && op.attributes.value && !op.attributes.value.specified\n ? op.text\n : op.value;\n }\n\n if (one) {\n return v;\n }\n\n a.push(v);\n }\n }\n\n return a;\n}\n\n/**\n * The value of a control, whether or not it is successful: a list for a multiple select, null\n * for a select with nothing selected, otherwise a string with CRLF line breaks (a lone CR or LF\n * included).\n */\nexport function valueOf(el) {\n if (tagName(el) === \"select\") {\n return selectValue(el);\n }\n\n var v = jQuery(el).val();\n var raw = el.value;\n\n // jQuery before 4.0 drops carriage returns from .val(); read them from the value itself\n if (typeof raw === \"string\" && raw.replace(rCR, \"\") === v) {\n v = raw;\n }\n\n return v.replace(rLineBreak, \"\\r\\n\");\n}\n\n/**\n * The plugin's own $.fieldValue: the value of a control, or null when `successful` is true or\n * missing and the control is not sent.\n */\nexport function fieldValue(el, successful) {\n var required = typeof successful === \"undefined\" || successful;\n\n if (required && !isSuccessful(el, submitterElement(el.form))) {\n return null;\n }\n\n return valueOf(el);\n}\n\n// 5.0 serializes without $.fieldValue, so a page that replaces it is warned (under debug) when\n// formToArray, formSerialize, fieldSerialize or ajaxSubmit reads values through the replacement.\nexport function deprecateFieldValueOverride() {\n if (jQuery.fieldValue !== fieldValue) {\n deprecate(\n \"fieldValue-override\",\n \"replacing $.fieldValue to change what is serialized is deprecated, use jQuery valHooks\"\n );\n }\n}\n\n/**\n * The fields as a urlencoded body sends them: a selected file as its name.\n */\n// A lone surrogate becomes U+FFFD, as in a native submission; jQuery.param would throw.\nvar loneSurrogate = /[\\uD800-\\uDBFF](?![\\uDC00-\\uDFFF])|([^\\uD800-\\uDBFF]|^)([\\uDC00-\\uDFFF])/g;\n\nexport function wellFormed(value) {\n return typeof value === \"string\"\n ? value.replace(loneSurrogate, function (match, before) {\n return (before || \"\") + \"\\uFFFD\";\n })\n : value;\n}\n\n// Sets an own enumerable key, so a key like __proto__ stays an ordinary key.\nfunction setKey(object, key, value) {\n Object.defineProperty(object, key, {\n value: value,\n enumerable: true,\n writable: true,\n configurable: true,\n });\n}\n\n/**\n * Data for $.param (the data option or extraData) with lone surrogates in its keys and string\n * values made well formed. Arrays and objects are walked as $.param walks them, inherited keys\n * included; they are copied only when something changes.\n */\nexport function wellFormedData(data) {\n var isArray = Array.isArray(data);\n\n if (!isArray && Object.prototype.toString.call(data) !== \"[object Object]\") {\n return wellFormed(data);\n }\n\n var copy = isArray ? [] : {};\n var changed = false;\n\n if (isArray) {\n for (var i = 0; i < data.length; i++) {\n copy[i] = wellFormedData(data[i]);\n changed = changed || copy[i] !== data[i];\n }\n } else {\n for (var key in data) {\n var name = wellFormed(key);\n var value = wellFormedData(data[key]);\n\n changed = changed || name !== key || value !== data[key];\n setKey(copy, name, value);\n }\n }\n\n return changed ? copy : data;\n}\n\n// jQuery 3 dropped $.param's \"+\" for a space; a native submission still sends \"+\". Only a space\n// encodes as %20, since a literal % encodes as %25.\nexport function urlencode(fields, traditional) {\n return jQuery.param(urlencodedFields(fields), traditional).replace(/%20/g, \"+\");\n}\n\nexport function urlencodedFields(fields) {\n return jQuery.map(fields, function (field) {\n var value =\n field.type === \"file\" && typeof field.value !== \"string\" ? field.value.name : field.value;\n var name = wellFormed(field.name);\n value = wellFormed(value);\n\n return name === field.name && value === field.value ? field : { name: name, value: value };\n });\n}\n\n/**\n * The serialization steps. `feature` holds what the entry detected at load (fileapi).\n */\nexport function createSuccessfulControls(feature) {\n var $ = jQuery;\n\n // #386; inputs that name the form in their form attribute, other than the candidates found.\n // A form only gets the ones it owns.\n function outsideControls(formId, els, owner) {\n // hat tip @thet; the id is compared, never built into a selector\n return $(\":input[form]\")\n .filter(function () {\n return (\n this.getAttribute(\"form\") === formId &&\n (!owner || this.form === owner) &&\n $.inArray(this, els) < 0\n );\n })\n .get();\n }\n\n // A descendant of a form is a candidate unless it is a control another form owns.\n function ownedBy(els, owner) {\n return $.grep(els, function (el) {\n return typeof el.form === \"undefined\" || el.form === owner;\n });\n }\n\n /**\n * The candidate controls of a form, in order: its elements, or every descendant it owns in\n * semantic mode, then the outside controls it owns that name it.\n */\n function controlsOf(form, semantic) {\n var formId = formAttribute(form, \"id\");\n var els = formMember(form, \"elements\");\n\n if (semantic || typeof els === \"undefined\") {\n // the document is not an element; it has its own getElementsByTagName\n els = isElement(form)\n ? callFormMethod(form, \"getElementsByTagName\", \"*\")\n : form.getElementsByTagName(\"*\");\n }\n\n els = $.makeArray(els);\n\n // the subject may also be a fieldset, the document or another container\n var owner = tagName(form) === \"form\" ? form : null;\n\n if (semantic && owner) {\n els = ownedBy(els, owner);\n }\n\n // FinesseRus: in non-IE browsers outside fields are already included in form.elements.\n if (formId && (semantic || /(Edge|Trident)\\//.test(navigator.userAgent))) {\n els = els.concat(outsideControls(formId, els, owner));\n }\n\n return els;\n }\n\n // The fields of a control's value, or null when the control is not sent.\n function fieldsOf(el) {\n var n = el.name;\n // read at call time, so a page that replaces $.fieldValue changes what is sent\n var v = $.fieldValue(el, true);\n\n if (v && v.constructor === Array) {\n return $.map(v, function (value) {\n return { name: n, value: value };\n });\n }\n\n if (feature.fileapi && el.type === \"file\") {\n var files = el.files;\n\n // #180: an empty field when no file is selected\n return files.length\n ? $.map(files, function (file) {\n return { name: n, value: file, type: el.type };\n })\n : [{ name: n, value: \"\", type: el.type }];\n }\n\n if (v === null || typeof v === \"undefined\") {\n return null;\n }\n\n return [{ name: n, value: v, type: el.type, required: el.required }];\n }\n\n // The clicked image's value and coordinates.\n function imageFields(sub, input, type) {\n var n = input.name;\n var value = { name: n, value: $(input).val() };\n\n if (type) {\n value.type = type;\n }\n\n return [value, { name: n + \".x\", value: sub.x }, { name: n + \".y\", value: sub.y }];\n }\n\n // Adds one candidate control's fields, and the control when it has a value to send.\n function addCandidate(collected, form, el, semantic) {\n if (!el.name || isDisabled(el) || rUnsubmittable.test(tagName(el))) {\n return;\n }\n\n var sub = semantic && el.type === \"image\" && submitterOf(form);\n\n if (sub) {\n // handle image inputs on the fly when semantic == true\n if (sub.el === el) {\n collected.fields.push.apply(collected.fields, imageFields(sub, el, el.type));\n }\n\n return;\n }\n\n var own = fieldsOf(el);\n\n if (own) {\n collected.controls.push(el);\n collected.fields.push.apply(collected.fields, own);\n }\n }\n\n // input type=='image' are not found in elements array! handle it here\n function addClickedImage(collected, form) {\n var sub = submitterOf(form);\n var input = sub && $(sub.el)[0];\n\n if (input && input.name && !isDisabled(input) && input.type === \"image\") {\n collected.fields.push.apply(collected.fields, imageFields(sub, input));\n }\n }\n\n /**\n * The fields of a form, as formToArray returns them, and the controls they came from.\n */\n function collect(form, semantic, filtering) {\n var collected = { fields: [], controls: [] };\n\n if (!form) {\n return collected;\n }\n\n deprecateFieldValueOverride();\n\n var els = controlsOf(form, semantic);\n\n if (typeof filtering === \"function\") {\n els = $.map(els, filtering);\n }\n\n for (var i = 0; i < els.length; i++) {\n addCandidate(collected, form, els[i], semantic);\n }\n\n if (!semantic) {\n addClickedImage(collected, form);\n }\n\n return collected;\n }\n\n return {\n controlsOf: controlsOf,\n fieldsOf: fieldsOf,\n collect: collect,\n };\n}\n","import jQuery from \"jquery\";\nimport { keepContext } from \"./options.js\";\nimport { wellFormedData } from \"./successful-controls.js\";\n\n// The XMLHttpRequest transports: $.ajax with the encoded fields, or FormData for file uploads.\nvar $ = jQuery;\n\n// utility fn for deep serialization: [name, value] pairs, as $.param encodes them\nexport function deepSerialize(extraData, traditional) {\n var param = $.param(wellFormedData(extraData), traditional);\n var serialized = param ? param.split(\"&\") : [];\n var len = serialized.length;\n var result = [];\n var i, part;\n\n for (i = 0; i < len; i++) {\n // #252; undo param space replacement\n serialized[i] = serialized[i].replace(/\\+/g, \" \");\n part = serialized[i].split(\"=\");\n // #278; use array instead of object storage, favoring array serializations\n result.push([decodeURIComponent(part[0]), decodeURIComponent(part[1])]);\n }\n\n return result;\n}\n\n/**\n * Posts the fields and extraData as FormData, for files with the File API.\n * XMLHttpRequest Level 2 file uploads (big hat tip to francois2metz)\n */\nexport function sendFormData(submission) {\n var options = submission.options;\n var a = submission.fields;\n\n var formdata = new FormData();\n\n for (var i = 0; i < a.length; i++) {\n formdata.append(a[i].name, a[i].value);\n }\n\n if (options.extraData) {\n var serializedData = deepSerialize(options.extraData, submission.traditional);\n\n for (i = 0; i < serializedData.length; i++) {\n formdata.append(serializedData[i][0], serializedData[i][1]);\n }\n }\n\n options.data = null;\n\n var s = $.extend(true, {}, $.ajaxSettings, options, {\n contentType: false,\n processData: false,\n cache: false,\n type: submission.method || \"POST\",\n });\n\n keepContext(s, [$.ajaxSettings, options]);\n\n if (options.uploadProgress) {\n // workaround because jqXHR does not expose upload property: wraps the xhr factory, the\n // caller's or jQuery's\n var createXhr = s.xhr;\n\n s.xhr = function () {\n var xhr = createXhr.call(this);\n\n if (xhr.upload) {\n xhr.upload.addEventListener(\n \"progress\",\n function (event) {\n var percent = 0;\n // event.position is the deprecated name, read only when loaded is missing\n var position = event.loaded !== undefined ? event.loaded : event.position;\n var total = event.total;\n\n if (event.lengthComputable) {\n percent = Math.ceil((position / total) * 100);\n }\n\n options.uploadProgress(event, position, total, percent);\n },\n false\n );\n }\n\n return xhr;\n };\n }\n\n s.data = null;\n\n var beforeSend = s.beforeSend;\n\n s.beforeSend = function (xhr, o) {\n // Send FormData() provided by user\n if (options.formData) {\n o.data = options.formData;\n } else {\n o.data = formdata;\n }\n\n // a veto (false) cancels the upload, as on the other transports\n return beforeSend ? beforeSend.call(this, xhr, o) : undefined;\n };\n\n return $.ajax(s);\n}\n\n/**\n * Sends the encoded fields with $.ajax.\n */\nexport function sendAjax(submission) {\n return $.ajax(submission.options);\n}\n","import { callFormMethod } from \"./form-members.js\";\nimport { deepSerialize } from \"./xhr-transport.js\";\nimport jQuery from \"jquery\";\nimport { submitterFields } from \"./submitter.js\";\nimport { wellFormed } from \"./successful-controls.js\";\n\n// The iframe form post: the extra fields (submitter, CSRF, data), the form attributes set while\n// posting and restored after, and the native submit.\nvar $ = jQuery;\n\n// The form attributes an iframe upload changes while it posts.\nvar uploadAttributes = [\"action\", \"target\", \"method\", \"enctype\", \"encoding\"];\n\n// Called through the prototype: an extraData key or a form field may be named hasOwnProperty.\nvar hasOwn = Object.prototype.hasOwnProperty;\n\nfunction isGet(method) {\n return /^get$/i.test(method);\n}\n\n// Resolves both URLs through anchors, as jQuery does for crossDomain, so IE's anchor quirks\n// apply to both sides of the comparison.\nfunction isSameOrigin(url) {\n var origin = document.createElement(\"a\");\n var target = document.createElement(\"a\");\n\n origin.href = window.location.href;\n target.href = url;\n // IE fills in the host of a relative URL only once the resolved href is assigned back\n target.href = target.href; // eslint-disable-line no-self-assign\n\n return origin.protocol + \"//\" + origin.host === target.protocol + \"//\" + target.host;\n}\n\n/** Adds the clicked submitter (and an image's coordinates) to s.extraData. */\nexport function addSubmitterFields(s, form) {\n // add submitting element to data if we know it\n var fields = submitterFields(form);\n\n for (var n in fields) {\n s.extraData = s.extraData || {};\n s.extraData[wellFormed(n)] = wellFormed(fields[n]);\n }\n}\n\n/** Adds the page's CSRF token to s.extraData when the form is posted to the page's origin. */\nexport function addCsrfField(s, form, method, forms) {\n // Rails CSRF hack (thanks to Yvan Barthelemy); like jquery-ujs, only for the page's origin and\n // only when the form is posted, since a get form would put the token in the url\n var csrf_token = $(\"meta[name=csrf-token]\").attr(\"content\");\n var csrf_param = $(\"meta[name=csrf-param]\").attr(\"content\");\n var posts =\n !isGet(method) &&\n (!method || /post/i.test(method) || /post/i.test(forms.property(form, \"method\")));\n\n if (csrf_param && csrf_token && posts && isSameOrigin(s.url)) {\n s.extraData = s.extraData || {};\n s.extraData[csrf_param] = csrf_token;\n }\n}\n\nfunction setFormAttribute(form, name, value) {\n callFormMethod(form, \"setAttribute\", name, value);\n}\n\n/** The raw attributes the upload changes, null when absent, to put back exactly (#380). */\nexport function saveAttributes(form) {\n var saved = {};\n\n $.each(uploadAttributes, function (i, name) {\n saved[name] = callFormMethod(form, \"hasAttribute\", name)\n ? callFormMethod(form, \"getAttribute\", name)\n : null;\n });\n\n return saved;\n}\n\n/** Puts back the attributes saveAttributes recorded, removing those that were absent. */\nexport function restoreAttributes(form, saved) {\n $.each(uploadAttributes, function (i, name) {\n if (saved[name] === null) {\n callFormMethod(form, \"removeAttribute\", name);\n } else {\n setFormAttribute(form, name, saved[name]);\n }\n });\n}\n\n/** Points the form at the frame `target` with the upload's url, method and encoding. */\nexport function setUploadAttributes(form, target, method, s, forms) {\n var mp = \"multipart/form-data\";\n\n // update form attrs in IE friendly way\n setFormAttribute(form, \"target\", target);\n if (!method || /post/i.test(method)) {\n setFormAttribute(form, \"method\", \"POST\");\n } else if (isGet(method) && !isGet(forms.property(form, \"method\"))) {\n // a form posts natively only with GET or POST; other verbs keep the form's own method\n setFormAttribute(form, \"method\", \"GET\");\n }\n setFormAttribute(form, \"action\", s.url);\n\n // ie borks in some cases when setting encoding\n if (!s.skipEncodingOverride && (!method || /post/i.test(method))) {\n setFormAttribute(form, \"encoding\", mp);\n setFormAttribute(form, \"enctype\", mp);\n }\n}\n\n/** Appends a hidden input per extraData field to the form; each input is pushed onto `added`. */\nexport function addExtraInputs(form, ownerDocument, extraData, traditional, added) {\n // Builds the input with DOM properties: a name is never parsed as HTML.\n function addHiddenInput(name, value) {\n var input = ownerDocument.createElement(\"input\");\n\n input.type = \"hidden\";\n input.name = name;\n added.push($(input).val(value).appendTo(form)[0]);\n }\n\n if (extraData) {\n for (var n in extraData) {\n if (hasOwn.call(extraData, n)) {\n // if using the $.param format that allows for multiple values with the same name\n if (\n $.isPlainObject(extraData[n]) &&\n hasOwn.call(extraData[n], \"name\") &&\n hasOwn.call(extraData[n], \"value\")\n ) {\n addHiddenInput(wellFormed(extraData[n].name), wellFormed(extraData[n].value));\n } else {\n // arrays and objects become one field per value, as $.param sends them (#597)\n var single = {};\n\n single[n] = extraData[n];\n var fields = deepSerialize(single, traditional);\n\n for (var f = 0; f < fields.length; f++) {\n addHiddenInput(fields[f][0], fields[f][1]);\n }\n }\n }\n }\n }\n}\n\n/** Submits the form natively, even when a control named submit hides the method. */\nexport function submitForm(form) {\n try {\n form.submit();\n } catch (err) {\n // just in case form has element with name/id of 'submit'\n callFormMethod(form, \"submit\");\n }\n}\n","import jQuery from \"jquery\";\nimport { log } from \"./diagnostics.js\";\n\n// The iframe response reader: turns the frame's document into the mock xhr's text, XML, status\n// and dataType, then parses it as $.ajax would (dataFilter, JSON, script).\nvar $ = jQuery;\n\n/** The frame's document, or null when the browser denies access to it. */\nexport function getDoc(frame) {\n /* it looks like contentWindow or contentDocument do not\n * carry the protocol property in ie8, when running under ssl\n * frame.document is the only valid response document, since\n * the protocol is know but not on the other two objects. strange?\n * \"Same origin policy\" http://en.wikipedia.org/wiki/Same_origin_policy\n */\n\n var doc = null;\n\n // IE8 cascading access check\n try {\n if (frame.contentWindow) {\n doc = frame.contentWindow.document;\n }\n } catch (err) {\n // IE8 access denied under ssl & missing protocol\n log(\"cannot get iframe.contentWindow document: \" + err);\n }\n\n if (doc) {\n // successful getting content\n return doc;\n }\n\n try {\n // simply checking may throw in ie8 under ssl or mismatched protocol\n doc = frame.contentDocument ? frame.contentDocument : frame.document;\n } catch (err) {\n // last attempt\n log(\"cannot get iframe.contentDocument: \" + err);\n doc = frame.document;\n }\n\n return doc;\n}\n\n/** Parses the response text or XML for the given (lowercase) dataType. */\nexport function httpData(xhr, type, s) {\n // mostly lifted from jq1.4.4\n\n var ct = xhr.getResponseHeader(\"content-type\") || \"\",\n xml = (type === \"xml\" || !type) && ct.indexOf(\"xml\") >= 0,\n data = xml ? xhr.responseXML : xhr.responseText;\n\n if (xml && data.documentElement.nodeName === \"parsererror\") {\n if ($.error) {\n $.error(\"parsererror\");\n }\n }\n if (s && s.dataFilter) {\n data = s.dataFilter(data, type);\n }\n if (typeof data === \"string\") {\n if ((type === \"json\" || !type) && ct.indexOf(\"json\") >= 0) {\n data = JSON.parse(data);\n } else if (type === \"script\") {\n $.globalEval(data);\n }\n }\n\n return data;\n}\n\n// Copies the status and statusText attributes of an element onto the mock xhr.\nfunction readStatus(xhr, el) {\n // support for XHR 'status' & 'statusText' emulation :\n xhr.status = Number(el.getAttribute(\"status\")) || xhr.status;\n xhr.statusText = el.getAttribute(\"statusText\") || xhr.statusText;\n}\n\n// Fills the mock xhr from the document itself.\nfunction readDocument(doc, xhr, s, isXml) {\n var docRoot = doc.body ? doc.body : doc.documentElement;\n\n xhr.responseText = docRoot ? docRoot.innerHTML : null;\n xhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc;\n if (isXml) {\n s.dataType = \"xml\";\n }\n xhr.getResponseHeader = function (header) {\n // the dataType in lowercase, as $.ajax reads it\n var headers = { \"content-type\": s.dataType && s.dataType.toLowerCase() };\n\n return headers[header.toLowerCase()];\n };\n if (docRoot) {\n readStatus(xhr, docRoot);\n }\n}\n\n// A response embedded in a textarea, or text wrapped in pre or body, replaces responseText.\nfunction readEmbedded(doc, xhr, dt, s) {\n var scr = /(json|script|text)/.test(dt);\n\n if (!scr && !s.textarea) {\n return;\n }\n // see if user embedded response in textarea\n var ta = doc.getElementsByTagName(\"textarea\")[0];\n\n if (ta) {\n xhr.responseText = ta.value;\n readStatus(xhr, ta);\n } else if (scr) {\n // account for browsers injecting pre around json response\n var pre = doc.getElementsByTagName(\"pre\")[0];\n var b = doc.getElementsByTagName(\"body\")[0];\n\n if (pre) {\n xhr.responseText = pre.textContent ? pre.textContent : pre.innerText;\n } else if (b) {\n xhr.responseText = b.textContent ? b.textContent : b.innerText;\n }\n }\n}\n\n/**\n * Reads and parses the response document into the mock xhr. Returns {status, data, errMsg}, or\n * null when `retry()` asks to read the document again later (Opera's untraversable DOM).\n */\nexport function readResponse(doc, xhr, s, retry) {\n var status = \"success\",\n data,\n errMsg;\n\n try {\n var isXml = /^xml$/i.test(s.dataType) || doc.XMLDocument || $.isXMLDoc(doc);\n\n log(\"isXml=\" + isXml);\n\n if (!isXml && window.opera && (doc.body === null || !doc.body.innerHTML)) {\n // in some browsers (Opera) the iframe DOM is not always traversable when\n // the onload callback fires, so we loop a bit to accommodate\n if (retry()) {\n return null;\n }\n // let this fall through because server response could be an empty document\n }\n\n readDocument(doc, xhr, s, isXml);\n\n var dt = (s.dataType || \"\").toLowerCase();\n\n readEmbedded(doc, xhr, dt, s);\n\n try {\n data = httpData(xhr, dt, s);\n } catch (err) {\n status = \"parsererror\";\n xhr.error = errMsg = err || status;\n }\n } catch (err) {\n log(\"error caught: \", err);\n status = \"error\";\n xhr.error = errMsg = err;\n }\n\n return { status: status, data: data, errMsg: errMsg };\n}\n","import jQuery from \"jquery\";\nimport { log } from \"./diagnostics.js\";\n\n// The iframe upload's lifecycle: the mock xhr and the Deferred, the global ajax events, the\n// beforeSend veto, the timeout, abort and settling.\nvar $ = jQuery;\n\n/**\n * Creates the lifecycle of one upload with the merged settings `s`. `frame.stop()` stops the\n * frame's load and `frame.release()` removes or resets the frame after the upload.\n */\nexport function createLifecycle(s, frame) {\n var g,\n timeoutHandle,\n callbackProcessed,\n deferred = $.Deferred();\n\n var xhr = {\n // mock object\n aborted: 0,\n responseText: null,\n responseXML: null,\n status: 0,\n statusText: \"n/a\",\n getAllResponseHeaders: function () {},\n getResponseHeader: function () {},\n setRequestHeader: function () {},\n abort: function (status) {\n abort(status, [xhr, \"aborted\", status]);\n },\n };\n\n // #341\n deferred.abort = function (status) {\n xhr.abort(status);\n };\n\n function done() {\n return xhr.aborted || callbackProcessed;\n }\n\n // Completes an aborted upload once and rejects the Deferred with `rejection`.\n // `textStatus` replaces the default \"timeout\"/\"aborted\" text status.\n function abort(status, rejection, textStatus) {\n var e = textStatus || (status === \"timeout\" ? \"timeout\" : \"aborted\");\n\n if (done()) {\n return;\n }\n\n log(\"aborting upload... \" + e);\n xhr.aborted = 1;\n frame.stop();\n xhr.error = e;\n if (s.error) {\n s.error.call(s.context, xhr, e, status);\n }\n deferred.reject.apply(deferred, rejection);\n\n if (g) {\n $.event.trigger(\"ajaxError\", [xhr, s, e]);\n }\n\n complete(e);\n }\n\n // The global events that end every upload, cancelled ones included.\n function endGlobalEvents() {\n if (g) {\n $.event.trigger(\"ajaxComplete\", [xhr, s]);\n }\n\n if (g && !--$.active) {\n $.event.trigger(\"ajaxStop\");\n }\n }\n\n // The steps every finished or aborted upload ends with, in $.ajax order.\n function complete(status) {\n if (s.complete) {\n s.complete.call(s.context, xhr, status);\n }\n\n endGlobalEvents();\n clearTimeout(timeoutHandle);\n\n // clean up\n setTimeout(function () {\n frame.release();\n xhr.responseXML = null;\n }, 100);\n }\n\n // A beforeSend veto ends the upload as $.ajax cancels a request: no callbacks, the global\n // events end with ajaxError \"canceled\".\n function cancel() {\n if (done()) {\n return;\n }\n\n callbackProcessed = true;\n deferred.reject();\n if (g) {\n $.event.trigger(\"ajaxError\", [xhr, s, \"canceled\"]);\n }\n endGlobalEvents();\n }\n\n // Fires the start events and beforeSend; false when the upload must not be posted.\n function start() {\n g = s.global;\n // trigger ajax global events so that activity/block indicators work like normal\n if (g && $.active++ === 0) {\n $.event.trigger(\"ajaxStart\");\n }\n\n if (s.beforeSend && s.beforeSend.call(s.context, xhr, s) === false) {\n cancel();\n\n return false;\n }\n\n if (xhr.aborted) {\n // abort() in beforeSend already completed the upload\n return false;\n }\n\n if (g) {\n $.event.trigger(\"ajaxSend\", [xhr, s]);\n }\n\n // an ajaxSend handler may abort too\n return !xhr.aborted;\n }\n\n // Resolves the upload; returns {error} when the success callback threw.\n function succeed(data) {\n var failure;\n\n try {\n s.success.call(s.context, data, \"success\", xhr);\n } catch (err) {\n failure = { error: err };\n }\n\n deferred.resolve(xhr.responseText, \"success\", xhr);\n\n if (g) {\n $.event.trigger(\"ajaxSuccess\", [xhr, s, data]);\n }\n\n return failure;\n }\n\n // Settles the upload with the response reader's {status, data, errMsg}.\n function settle(result) {\n var status = result.status,\n errMsg = result.errMsg;\n\n if (xhr.aborted) {\n // abort() completed the upload while its response was processed\n log(\"upload aborted\");\n\n return;\n }\n\n // an emulated HTTP error status wins with the statusText, as in $.ajax; a parse error is\n // kept otherwise\n if (xhr.status && !((xhr.status >= 200 && xhr.status < 300) || xhr.status === 304)) {\n if (status === \"parsererror\") {\n errMsg = undefined;\n }\n status = \"error\";\n }\n\n callbackProcessed = true;\n\n // ordering of these callbacks/triggers is odd, but that's how $.ajax does it\n if (status === \"success\") {\n var failure = succeed(result.data);\n\n complete(status);\n if (failure) {\n // the upload is settled; the success callback's exception still reaches the console\n throw failure.error;\n }\n\n return;\n }\n\n if (typeof errMsg === \"undefined\") {\n errMsg = xhr.statusText;\n }\n if (s.error) {\n s.error.call(s.context, xhr, status, errMsg);\n }\n deferred.reject(xhr, status, errMsg);\n if (g) {\n $.event.trigger(\"ajaxError\", [xhr, s, errMsg]);\n }\n\n complete(status);\n }\n\n return {\n xhr: xhr,\n deferred: deferred,\n start: start,\n done: done,\n abort: abort,\n settle: settle,\n // Settles an upload that failed with an exception (ignored once aborted).\n fail: function (err) {\n settle({ status: \"error\", errMsg: err });\n },\n // Runs `onTimeout` after s.timeout, when set.\n startTimer: function (onTimeout) {\n if (s.timeout) {\n timeoutHandle = setTimeout(onTimeout, s.timeout);\n }\n },\n stopTimer: function () {\n clearTimeout(timeoutHandle);\n timeoutHandle = undefined;\n },\n };\n}\n","import {\n addCsrfField,\n addExtraInputs,\n addSubmitterFields,\n restoreAttributes,\n saveAttributes,\n setUploadAttributes,\n submitForm,\n} from \"./iframe-post.js\";\nimport { closestByTag, formMember } from \"./form-members.js\";\nimport { deprecate, log } from \"./diagnostics.js\";\nimport { getDoc, readResponse } from \"./iframe-response.js\";\nimport { keepContext, selectorOption } from \"./options.js\";\nimport { createLifecycle } from \"./iframe-lifecycle.js\";\nimport jQuery from \"jquery\";\n\n// The iframe transport: posts the form itself into a hidden frame and reads the response from it,\n// for file uploads without the File API or when the iframe option asks for it.\nvar $ = jQuery;\n\n/**\n * The iframe send step. `hasProp` is what the entry detected at load; `forms.property` reads a\n * form property as attr2 does.\n */\nexport function createIframeTransport(hasProp, forms) {\n var CLIENT_TIMEOUT_ABORT = 1;\n var SERVER_ABORT = 2;\n // tells apart the frames of uploads that start in the same millisecond\n var frameCount = 0;\n\n // ensure that every serialized input is still enabled\n function enableControls(elements) {\n for (var i = 0; i < elements.length; i++) {\n var el = $(elements[i]);\n\n if (hasProp) {\n el.prop(\"disabled\", false);\n } else {\n el.removeAttr(\"disabled\");\n }\n }\n }\n\n // Names the frame's window, when the page may: a cross-origin or sandboxed frame refuses.\n function nameWindow(frame, name) {\n try {\n if (frame.contentWindow) {\n frame.contentWindow.name = name;\n }\n } catch (ignore) {}\n }\n\n // The frame the form posts into: the iframeTarget, named `id` when it has no name, or a new\n // hidden frame named `id`. Returns the frame and the name the form targets.\n function createFrame(s, id, ownerDocument) {\n var $io, n;\n\n if (s.iframeTarget) {\n $io = selectorOption(s.iframeTarget, ownerDocument);\n n = $io.attr(\"name\");\n if (!n) {\n $io.attr(\"name\", id);\n // a frame already in the page keeps the browsing context name it was inserted with\n $io.each(function () {\n nameWindow(this, id);\n });\n } else {\n id = n;\n }\n } else {\n var io = ownerDocument.createElement(\"iframe\");\n\n io.setAttribute(\"name\", id);\n io.setAttribute(\"src\", s.iframeSrc);\n $io = $(io);\n $io.css({ position: \"absolute\", top: \"-1000px\", left: \"-1000px\" });\n }\n\n return { $io: $io, id: id };\n }\n\n // The frame hooks the lifecycle calls: stop a load in progress, and release after the upload.\n function frameHooks(s, $io) {\n return {\n stop: function () {\n try {\n // #214, #257\n if ($io[0].contentWindow.document.execCommand) {\n $io[0].contentWindow.document.execCommand(\"Stop\");\n }\n } catch (ignore) {}\n\n $io.attr(\"src\", s.iframeSrc); // abort op in progress\n },\n release: function () {\n if (!s.iframeTarget) {\n $io.remove();\n } else {\n // adding else to clean up existing iframe response.\n $io.attr(\"src\", s.iframeSrc);\n }\n },\n };\n }\n\n function listen(io, cb) {\n if (io.attachEvent) {\n io.attachEvent(\"onload\", cb);\n } else {\n io.addEventListener(\"load\", cb, false);\n }\n }\n\n function unlisten(io, cb) {\n if (io.detachEvent) {\n io.detachEvent(\"onload\", cb);\n } else {\n io.removeEventListener(\"load\", cb, false);\n }\n }\n\n // private function for handling file uploads (hat tip to YAHOO!)\n function fileUploadIframe(submission) {\n var form = submission.form,\n method = submission.method;\n\n var s = keepContext($.extend(true, {}, $.ajaxSettings, submission.options), [\n $.ajaxSettings,\n submission.options,\n ]);\n\n s.context = s.context || s;\n var ownerDocument = formMember(form, \"ownerDocument\");\n var $body = $(closestByTag(form, [\"body\"]));\n var frame = createFrame(s, \"jqFormIO\" + new Date().getTime() + frameCount++, ownerDocument);\n var $io = frame.$io,\n io = $io[0];\n var life = createLifecycle(s, frameHooks(s, $io));\n var domCheckCount = 50;\n\n if (!life.start()) {\n return life.deferred;\n }\n\n addSubmitterFields(s, form);\n addCsrfField(s, form, method, forms);\n\n // look for server aborts\n function checkState() {\n try {\n var state = getDoc(io).readyState;\n\n log(\"state = \" + state);\n if (state && state.toLowerCase() === \"uninitialized\") {\n setTimeout(checkState, 50);\n }\n } catch (e) {\n log(\"Server abort: \", e, \" (\", e.name, \")\");\n cb(SERVER_ABORT);\n life.stopTimer();\n }\n }\n\n // take a breath so that pending repaints get some cpu time before the upload starts\n function doSubmit() {\n var saved = saveAttributes(form);\n\n setUploadAttributes(form, frame.id, method, s, forms);\n\n // support timout\n life.startTimer(function () {\n cb(CLIENT_TIMEOUT_ABORT);\n });\n\n // add \"extra\" data to form if provided in options\n var extraInputs = [];\n\n try {\n addExtraInputs(form, ownerDocument, s.extraData, submission.traditional, extraInputs);\n\n if (!s.iframeTarget) {\n // add iframe to doc and submit the form\n $io.appendTo($body);\n }\n\n // A connected form posting into a frame outside the document opens a new window.\n var root = ownerDocument.documentElement;\n\n if (io && $.contains(root, form) && !$.contains(root, io)) {\n var notInDocument = \"jquery.form: the upload frame is not in the document\";\n\n life.abort(notInDocument, [life.xhr, \"error\", notInDocument], \"error\");\n\n return;\n }\n\n listen(io, cb);\n setTimeout(checkState, 15);\n submitForm(form);\n } finally {\n // reset attrs and remove \"extra\" input elements\n restoreAttributes(form, saved);\n $(extraInputs).remove();\n }\n }\n\n // Reads the next document by Opera's rules: false once the retries are used up.\n function retry() {\n if (--domCheckCount) {\n log(\"requeing onLoad callback, DOM not available\");\n setTimeout(cb, 250);\n\n return true;\n }\n\n return false;\n }\n\n function cb(e) {\n if (life.done()) {\n return;\n }\n\n var doc = getDoc(io);\n\n if (!doc) {\n log(\"cannot access response document\");\n e = SERVER_ABORT;\n }\n if (e === CLIENT_TIMEOUT_ABORT) {\n life.abort(\"timeout\", [life.xhr, \"timeout\"]);\n\n return;\n }\n if (e === SERVER_ABORT) {\n life.abort(\"server abort\", [life.xhr, \"error\", \"server abort\"]);\n\n return;\n }\n\n if (doc.location.href === s.iframeSrc) {\n // response not received yet\n return;\n }\n\n unlisten(io, cb);\n\n var result = readResponse(doc, life.xhr, s, retry);\n\n if (result) {\n life.settle(result);\n }\n }\n\n // An exception while posting settles the upload with \"error\" and the exception.\n function post() {\n if (life.done()) {\n // aborted before the delayed post\n return;\n }\n\n try {\n doSubmit();\n } catch (err) {\n log(\"upload failed: \", err);\n life.fail(err);\n }\n }\n\n if (s.forceSync) {\n post();\n } else {\n setTimeout(post, 10); // this lets dom updates render\n }\n\n return life.deferred;\n }\n\n return function sendIframe(submission) {\n var jqxhr;\n\n // now, while the controls are still listed: ajaxSubmit clears the list when it returns,\n // before a closeKeepAlive request completes\n enableControls(submission.controls);\n\n // hack to fix Safari hang (thanks to Tim Molendijk for this)\n // see: http://groups.google.com/group/jquery-dev/browse_thread/thread/36395b7ab510dd5d\n if (submission.options.closeKeepAlive) {\n deprecate(\"closeKeepAlive\", \"closeKeepAlive works around a Safari 3/4 bug and is deprecated\");\n $.get(submission.options.closeKeepAlive, function () {\n jqxhr = fileUploadIframe(submission);\n });\n } else {\n jqxhr = fileUploadIframe(submission);\n }\n\n return jqxhr;\n };\n}\n","import { deprecate, log } from \"./diagnostics.js\";\nimport { keepContext, selectorOption } from \"./options.js\";\nimport { urlencode, wellFormedData } from \"./successful-controls.js\";\nimport { assertRealParent } from \"./form-members.js\";\nimport jQuery from \"jquery\";\n\n// A Submission is one ajaxSubmit call once its vetoes have passed:\n// { form, $form, fields, controls, options, method, traditional }. `options` is the object the\n// callbacks and events receive; later steps change it in place.\n\n/**\n * The submission steps. `feature` holds what the entry detected at load (fileapi, formdata), and\n * `forms` reads form attributes and attr2-style properties (attribute, property), and\n * `serialization` collects the form's fields and controls.\n */\nexport function createSubmission(feature, forms, serialization) {\n var $ = jQuery;\n\n function refuse(message) {\n log(message);\n\n return null;\n }\n\n // The options merged over the form's action, the method, and the ajax defaults.\n function withDefaults(form, options, method) {\n var action = options.url || forms.property(form, \"action\");\n var url = typeof action === \"string\" ? action.trim() : \"\";\n\n // clean url (don't include hash value); an action that is only a fragment means this page\n url = url.split(\"#\")[0] || window.location.href.split(\"#\")[0];\n // IE requires javascript:false in https, but this breaks chrome >83 and goes against spec.\n // Instead of using javascript:false always, let's only apply it for IE.\n var isMsie = /(MSIE|Trident)/.test(navigator.userAgent || \"\");\n var iframeSrc = isMsie && /^https/i.test(document.URL) ? \"javascript:false\" : \"about:blank\"; // eslint-disable-line no-script-url\n\n var merged = $.extend(\n true,\n {\n url: url,\n success: $.ajaxSettings.success,\n type: method || $.ajaxSettings.type,\n iframeSrc: iframeSrc,\n },\n options\n );\n\n return keepContext(merged, [options]);\n }\n\n /**\n * The one method every transport sends, read after the hooks: `method` wins over `type`, and\n * `type` is set to it. Undefined when only the ajax default applies, so each transport keeps\n * its own default.\n */\n function resolveMethod(options, defaultType) {\n var resolved = options.method || options.type;\n\n options.type = resolved;\n\n return resolved === defaultType && !options.method ? undefined : resolved;\n }\n\n // The data option, kept as extraData and encoded, or undefined without one.\n function extraQuery(fields, options, traditional) {\n if (!options.data) {\n return undefined;\n }\n\n var optionsData = typeof options.data === \"function\" ? options.data(fields) : options.data;\n\n if (typeof optionsData === \"string\") {\n if (options.requestFormat === \"json\") {\n throw new Error(\n 'jquery.form: requestFormat \"json\" needs object data; a string data option is a query string'\n );\n }\n\n // a query string: sent as-is when urlencoded, as its own fields otherwise\n options.extraData = queryPairs(optionsData);\n\n return optionsData;\n }\n\n options.extraData = optionsData;\n\n return $.param(wellFormedData(optionsData), traditional);\n }\n\n // Sets a key as an own data property, so a name like __proto__ is an ordinary key.\n function defineKey(object, key, value) {\n Object.defineProperty(object, key, {\n value: value,\n enumerable: true,\n writable: true,\n configurable: true,\n });\n }\n\n /**\n * requestFormat \"json\" (#545): the fields as an object (a repeated name gives an array), merged\n * with object data, sent as a JSON body. Based on the idea in PR #557 by zhangciwu.\n */\n function jsonBody(options, fields) {\n if (/^get$/i.test(options.type)) {\n throw new Error('jquery.form: requestFormat \"json\" needs a method with a body, such as POST');\n }\n\n var body = {};\n var own = Object.prototype.hasOwnProperty;\n\n for (var i = 0; i < fields.length; i++) {\n var name = fields[i].name;\n\n if (!own.call(body, name)) {\n defineKey(body, name, fields[i].value);\n } else if (Array.isArray(body[name])) {\n body[name].push(fields[i].value);\n } else {\n defineKey(body, name, [body[name], fields[i].value]);\n }\n }\n\n var extra = options.extraData;\n\n for (var key in extra) {\n if (own.call(extra, key)) {\n defineKey(body, key, extra[key]);\n }\n }\n\n options.data = JSON.stringify(body);\n options.contentType = \"application/json; charset=UTF-8\";\n }\n\n // The fields of a query string, as the { name, value } list $.param takes.\n function queryPairs(query) {\n var pairs = [];\n var parts = query.split(\"&\");\n\n for (var i = 0; i < parts.length; i++) {\n if (parts[i]) {\n var at = parts[i].indexOf(\"=\");\n var name = at < 0 ? parts[i] : parts[i].slice(0, at);\n var value = at < 0 ? \"\" : parts[i].slice(at + 1);\n\n pairs.push({ name: decodeQuery(name), value: decodeQuery(value) });\n }\n }\n\n return pairs;\n }\n\n function decodeQuery(text) {\n return decodeURIComponent(text.replace(/\\+/g, \" \"));\n }\n\n // Puts the encoded fields in the url for a get, and in the data otherwise.\n function encode(options, q, qx) {\n if (qx) {\n q = q ? q + \"&\" + qx : qx;\n }\n\n if (options.type.toUpperCase() === \"GET\") {\n // the query goes before any fragment in the url option\n var hashAt = options.url.indexOf(\"#\");\n var base = hashAt < 0 ? options.url : options.url.slice(0, hashAt);\n\n options.url =\n base + (base.indexOf(\"?\") >= 0 ? \"&\" : \"?\") + q + options.url.slice(base.length);\n options.data = null; // data is null for 'get'\n } else {\n options.data = q; // data is the query string for 'post'\n }\n }\n\n // A callback option as a list: an array as given, one function, or none.\n function callbackList(callback) {\n if (Array.isArray(callback)) {\n return callback;\n }\n\n return callback ? [callback] : [];\n }\n\n // Calls each callback in order with the same this and arguments.\n function callEach(callbacks, context, args) {\n for (var i = 0; i < callbacks.length; i++) {\n callbacks[i].apply(context, args);\n }\n }\n\n /**\n * Resolves the options, serializes the form, and runs the vetoes: the Submission, or null when\n * an event or callback stopped it.\n */\n function prepare($set, options) {\n $set.each(function () {\n assertRealParent(this);\n });\n\n var form = $set[0];\n var method = options.method || options.type || forms.property(form, \"method\");\n\n options = withDefaults(form, options, method);\n\n // the ajax default type, when neither the caller nor the form gave a method\n var defaultType = method ? undefined : options.type;\n\n // hook for manipulating the form data before it is extracted;\n // convenient for use with rich editors like tinyMCE or FCKEditor\n var veto = {};\n\n $set.trigger(\"form-pre-serialize\", [$set, options, veto]);\n if (veto.veto) {\n return refuse(\"ajaxSubmit: submit vetoed via form-pre-serialize trigger\");\n }\n\n // provide opportunity to alter form data before it is serialized\n if (options.beforeSerialize && options.beforeSerialize($set, options) === false) {\n return refuse(\"ajaxSubmit: submit aborted via beforeSerialize callback\");\n }\n\n var traditional = options.traditional;\n\n if (typeof traditional === \"undefined\") {\n traditional = $.ajaxSettings.traditional;\n }\n\n var collected = serialization.collect($set[0], options.semantic, options.filtering);\n var fields = collected.fields;\n var controls = collected.controls;\n var qx = extraQuery(fields, options, traditional);\n\n // give pre-submit callback an opportunity to abort the submit\n if (options.beforeSubmit && options.beforeSubmit(fields, $set, options) === false) {\n return refuse(\"ajaxSubmit: submit aborted via beforeSubmit callback\");\n }\n\n // fire vetoable 'validate' event\n $set.trigger(\"form-submit-validate\", [fields, $set, options, veto]);\n if (veto.veto) {\n return refuse(\"ajaxSubmit: submit vetoed via form-submit-validate trigger\");\n }\n\n method = resolveMethod(options, defaultType);\n\n if (options.requestFormat === \"json\") {\n jsonBody(options, fields);\n } else {\n encode(options, urlencode(fields, traditional), qx);\n }\n\n return {\n form: form,\n $form: $set,\n fields: fields,\n controls: controls,\n options: options,\n method: method,\n traditional: traditional,\n };\n }\n\n /**\n * Wraps success, error and complete (a function or an array of them, as $.ajax takes) so each\n * also receives the form, and adds the resetForm,\n * clearForm and target steps before the success callbacks.\n */\n function deliver(submission) {\n var $set = submission.$form;\n var options = submission.options;\n var callbacks = [];\n\n if (options.resetForm) {\n callbacks.push(function () {\n $set.resetForm();\n });\n }\n\n if (options.clearForm) {\n callbacks.push(function () {\n $set.clearForm(options.includeHidden);\n });\n }\n\n // perform a load on the target only if dataType is not provided\n if (!options.dataType && options.target) {\n var successes = callbackList(options.success);\n\n callbacks.push(function (data, textStatus, jqXHR) {\n var successArguments = arguments,\n fn = options.replaceTarget ? \"replaceWith\" : \"html\",\n $target = selectorOption(options.target);\n\n // Only a string response is inserted. jQuery has already parsed a JSON or XML response,\n // and inserting it would parse each of its strings as HTML.\n if (typeof data === \"string\") {\n $target[fn](data);\n } else {\n log(\"target: the response was parsed by jQuery, so it is not inserted\");\n }\n\n if (!$target.length) {\n // nothing to fill: success still runs once, with the normal context\n callEach(successes, this, successArguments);\n }\n\n $target.each(function () {\n callEach(successes, this, successArguments);\n });\n });\n } else {\n $.merge(callbacks, callbackList(options.success));\n }\n\n options.success = function (data, status, xhr) {\n // jQuery 1.4+ passes xhr as 3rd arg\n var context = options.context || this; // jQuery 1.4+ supports scope context\n\n for (var i = 0, max = callbacks.length; i < max; i++) {\n callbacks[i].apply(context, [data, status, xhr || $set, $set]);\n }\n };\n\n if (options.error) {\n var errors = callbackList(options.error);\n\n options.error = function (xhr, status, error) {\n callEach(errors, options.context || this, [xhr, status, error, $set]);\n };\n }\n\n if (options.complete) {\n var completes = callbackList(options.complete);\n\n options.complete = function (xhr, status) {\n callEach(completes, options.context || this, [xhr, status, $set]);\n };\n }\n }\n\n /**\n * The transport for a submission: \"iframe\" for files without the File API or when forced,\n * \"formdata\" for files with it, \"ajax\" otherwise.\n */\n function chooseTransport(submission) {\n var $set = submission.$form;\n var options = submission.options;\n\n // [value] (issue #113), also see comment:\n // https://github.com/malsup/form/commit/588306aedba1de01388032d5f42a60159eea9228#commitcomment-2180219\n // and the file inputs outside the form that belong to it through their form attribute\n var fileInputs = $(\"input[type=file]:enabled\", $set)\n .add($(submission.controls).filter(\"input[type=file]\"))\n .filter(function () {\n return $(this).val() !== \"\";\n });\n var hasFileInputs = fileInputs.length > 0;\n // compared as the browser does: ASCII case-insensitive, without surrounding whitespace\n var mp = /^[\\t\\n\\f\\r ]*multipart\\/form-data[\\t\\n\\f\\r ]*$/i;\n var multipart =\n mp.test(forms.attribute($set[0], \"enctype\")) || mp.test(forms.attribute($set[0], \"encoding\"));\n var fileAPI = feature.fileapi && feature.formdata;\n\n log(\"fileAPI :\" + fileAPI);\n\n var shouldUseFrame = (hasFileInputs || multipart) && !fileAPI;\n\n var transport = (hasFileInputs || multipart) && fileAPI ? \"formdata\" : \"ajax\";\n\n // options.iframe allows user to force iframe mode\n // 06-NOV-09: now defaulting to iframe mode if file input is detected\n if (options.iframe !== false && (options.iframe || shouldUseFrame)) {\n transport = \"iframe\";\n }\n\n if (transport === \"iframe\" && !options.iframe) {\n deprecate(\n \"iframe\",\n \"choosing the iframe transport automatically without FormData is deprecated, set iframe: true\"\n );\n }\n\n if (transport !== \"ajax\" && options.requestFormat === \"json\") {\n throw new Error(\n 'jquery.form: requestFormat \"json\" cannot send files or use the iframe transport'\n );\n }\n\n return transport;\n }\n\n return { prepare: prepare, deliver: deliver, chooseTransport: chooseTransport };\n}\n","/*!\n * jQuery Form Plugin\n * version: 4.5.0\n * Requires jQuery v1.7.2 or later\n * Project repository: https://github.com/jquery-form/form\n\n * Copyright 2017 Kevin Morris\n * Copyright 2006 M. Alsup\n\n * Dual licensed under the LGPL-2.1+ or MIT licenses\n * https://github.com/jquery-form/form#license\n\n * This library is free software; you can redistribute it and/or\n * modify it under the terms of the GNU Lesser General Public\n * License as published by the Free Software Foundation; either\n * version 2.1 of the License, or (at your option) any later version.\n * This library is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n */\nimport { ajaxForm, ajaxFormUnbind } from \"./ajax-form.js\";\nimport { callFormMethod, tagName } from \"./form-members.js\";\nimport {\n createSuccessfulControls,\n deprecateFieldValueOverride,\n fieldValue,\n urlencode,\n} from \"./successful-controls.js\";\nimport { deprecate, deprecateOldJQuery, log } from \"./diagnostics.js\";\nimport { sendAjax, sendFormData } from \"./xhr-transport.js\";\nimport { createIframeTransport } from \"./iframe-transport.js\";\nimport { createSubmission } from \"./submission.js\";\nimport { formAttribute } from \"./form-attributes.js\";\nimport jQuery from \"jquery\";\nimport { submitOptions } from \"./options.js\";\n\n(function ($) {\n \"use strict\";\n\n /*\n\t\tUsage Note:\n\t\t-----------\n\t\tDo not use both ajaxSubmit and ajaxForm on the same form. These\n\t\tfunctions are mutually exclusive. Use ajaxSubmit if you want\n\t\tto bind your own submit handler to the form. For example,\n\n\t\t$(document).ready(function() {\n\t\t\t$('#myForm').on('submit', function(e) {\n\t\t\t\te.preventDefault(); // <-- important\n\t\t\t\t$(this).ajaxSubmit({\n\t\t\t\t\ttarget: '#output'\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\n\t\tUse ajaxForm when you want the plugin to manage all the event binding\n\t\tfor you. For example,\n\n\t\t$(document).ready(function() {\n\t\t\t$('#myForm').ajaxForm({\n\t\t\t\ttarget: '#output'\n\t\t\t});\n\t\t});\n\n\t\tYou can also use ajaxForm with delegation (requires jQuery v1.7+), so the\n\t\tform does not have to exist when you invoke ajaxForm:\n\n\t\t$('#myForm').ajaxForm({\n\t\t\tdelegation: true,\n\t\t\ttarget: '#output'\n\t\t});\n\n\t\tWhen using ajaxForm, the ajaxSubmit function will be invoked for you\n\t\tat the appropriate time.\n\t*/\n\n /**\n * Feature detection\n */\n var feature = {};\n\n feature.fileapi = $('').get(0).files !== undefined;\n feature.formdata = typeof window.FormData !== \"undefined\";\n\n var hasProp = !!$.fn.prop;\n // What attr2 returns for a form: the property when it is a string, otherwise the attribute. The\n // property is read plainly on purpose: a control named like it shadows it, and then the raw\n // attribute is used.\n function formProperty(form, name) {\n var value = hasProp ? form[name] : undefined;\n\n return typeof value === \"string\" ? value : formAttribute(form, name);\n }\n\n var forms = { attribute: formAttribute, property: formProperty };\n var serialization = createSuccessfulControls(feature);\n var steps = createSubmission(feature, forms, serialization);\n var transports = {\n iframe: createIframeTransport(hasProp, forms),\n formdata: sendFormData,\n ajax: sendAjax,\n };\n\n // attr2 uses prop when it can but checks the return type for\n // an expected string. This accounts for the case where a form\n // contains inputs with names like \"action\" or \"method\"; in those\n // cases \"prop\" returns the element\n $.fn.attr2 = function () {\n deprecate(\"attr2\", \"attr2 is deprecated, use .prop() or .attr()\");\n\n if (!hasProp) {\n return this.attr.apply(this, arguments);\n }\n\n var val = this.prop.apply(this, arguments);\n\n if ((val && val.jquery) || typeof val === \"string\") {\n return val;\n }\n\n return this.attr.apply(this, arguments);\n };\n\n /**\n * ajaxSubmit() provides a mechanism for immediately submitting\n * an HTML form using AJAX.\n *\n * @param\t{object|string}\toptions\t\tjquery.form.js parameters or custom url for submission\n * @param\t{object}\t\tdata\t\textraData\n * @param\t{string}\t\tdataType\tajax dataType\n * @param\t{function}\t\tonSuccess\tajax success callback function\n */\n $.fn.ajaxSubmit = function (options, data, dataType, onSuccess) {\n deprecateOldJQuery($.fn.jquery);\n\n // fast fail if nothing selected (http://dev.jquery.com/ticket/2752)\n if (!this.length) {\n log(\"ajaxSubmit: skipping submit process - no element selected\");\n\n return this;\n }\n\n // #541: jQuery's slim build has no $.ajax\n if (!$.ajax) {\n throw new Error(\n \"jquery.form: ajaxSubmit needs the full jQuery build; this jQuery has no $.ajax\"\n );\n }\n\n var submission = steps.prepare(this, submitOptions(options, data, dataType, onSuccess));\n\n if (!submission) {\n return this;\n }\n\n steps.deliver(submission);\n\n var jqxhr = transports[steps.chooseTransport(submission)](submission);\n\n this.removeData(\"jqxhr\").data(\"jqxhr\", jqxhr);\n\n // clear element array\n for (var k = 0; k < submission.controls.length; k++) {\n submission.controls[k] = null;\n }\n\n // fire 'notify' event\n this.trigger(\"form-submit-notify\", [this, submission.options]);\n\n return this;\n };\n\n $.fn.ajaxForm = ajaxForm;\n $.fn.ajaxFormUnbind = ajaxFormUnbind;\n\n /**\n * formToArray() gathers form element data into an array of objects that can\n * be passed to any of the following ajax functions: $.get, $.post, or load.\n * Each object in the array has both a 'name' and 'value' property. An example of\n * an array for a simple login form might be:\n *\n * [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ]\n *\n * It is this array that is passed to pre-submit callback functions provided to the\n * ajaxSubmit() and ajaxForm() methods.\n */\n $.fn.formToArray = function (semantic, elements, filtering) {\n var collected = serialization.collect(this[0], semantic, filtering);\n\n if (elements) {\n elements.push.apply(elements, collected.controls);\n }\n\n return collected.fields;\n };\n\n /**\n * Serializes form data into a 'submittable' string. This method will return a string\n * in the format: name1=value1&name2=value2\n */\n $.fn.formSerialize = function (semantic) {\n // hand off to jQuery.param for proper encoding\n return urlencode(this.formToArray(semantic));\n };\n\n /**\n * Serializes all field elements in the jQuery object into a query string.\n * This method will return a string in the format: name1=value1&name2=value2\n */\n $.fn.fieldSerialize = function (successful) {\n var a = [];\n\n deprecateFieldValueOverride();\n\n this.each(function () {\n var n = this.name;\n\n // a form is not a field, though it may have a name\n if (!n || tagName(this) === \"form\") {\n return;\n }\n\n var v = $.fieldValue(this, successful);\n\n if (v && v.constructor === Array) {\n for (var i = 0, max = v.length; i < max; i++) {\n a.push({ name: n, value: v[i] });\n }\n } else if (v !== null && typeof v !== \"undefined\") {\n a.push({ name: this.name, value: v });\n }\n });\n\n // hand off to jQuery.param for proper encoding\n return urlencode(a);\n };\n\n /**\n * Returns the value(s) of the element in the matched set. For example, consider the following form:\n *\n *\t
\n *\t\t\n *\t\t\n *\t\t\n *\t\t\n *\t\t\n *\t\t\n *\t
\n *\n *\tvar v = $('input[type=text]').fieldValue();\n *\t// if no values are entered into the text inputs\n *\tv === ['','']\n *\t// if values entered into the text inputs are 'foo' and 'bar'\n *\tv === ['foo','bar']\n *\n *\tvar v = $('input[type=checkbox]').fieldValue();\n *\t// if neither checkbox is checked\n *\tv === undefined\n *\t// if both checkboxes are checked\n *\tv === ['B1', 'B2']\n *\n *\tvar v = $('input[type=radio]').fieldValue();\n *\t// if neither radio is checked\n *\tv === undefined\n *\t// if first radio is checked\n *\tv === ['C1']\n *\n * The successful argument controls whether or not the field element must be 'successful'\n * (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls).\n * The default value of the successful argument is true. If this value is false the value(s)\n * for each element is returned.\n *\n * Note: This method *always* returns an array. If no valid value can be determined the\n *\tarray will be empty, otherwise it will contain one or more values.\n */\n $.fn.fieldValue = function (successful) {\n for (var val = [], i = 0, max = this.length; i < max; i++) {\n var el = this[i];\n var v = $.fieldValue(el, successful);\n\n if (v === null || typeof v === \"undefined\" || (v.constructor === Array && !v.length)) {\n continue;\n }\n\n if (v.constructor === Array) {\n $.merge(val, v);\n } else {\n val.push(v);\n }\n }\n\n return val;\n };\n\n /**\n * Returns the value of the field element.\n */\n $.fieldValue = fieldValue;\n\n /**\n * Clears the form data. Takes the following actions on the form's input fields:\n * - input text fields will have their 'value' property set to the empty string\n * - select elements will have their 'selectedIndex' property set to -1\n * - checkbox and radio inputs will have their 'checked' property set to false\n * - inputs of type submit, button, reset, and hidden will *not* be effected\n * - button elements will *not* be effected\n */\n $.fn.clearForm = function (includeHidden) {\n return this.each(function () {\n $(\"input,select,textarea\", this).clearFields(includeHidden);\n });\n };\n\n /**\n * Clears the selected form elements.\n */\n $.fn.clearInputs = function (includeHidden) {\n deprecate(\"clearInputs\", \"clearInputs is deprecated, use clearFields\");\n\n return this.clearFields(includeHidden);\n };\n\n $.fn.clearFields = function (includeHidden) {\n var re =\n /^(?:color|date|datetime|datetime-local|email|month|number|password|range|search|tel|text|time|url|week)$/i; // 'hidden' is not in this list\n\n return this.each(function () {\n var t = this.type,\n tag = tagName(this);\n\n if (re.test(t) || tag === \"textarea\") {\n this.value = \"\";\n } else if (t === \"checkbox\" || t === \"radio\") {\n this.checked = false;\n } else if (tag === \"select\") {\n this.selectedIndex = -1;\n } else if (t === \"file\") {\n if (/MSIE/.test(navigator.userAgent)) {\n $(this).replaceWith($(this).clone(true));\n } else {\n $(this).val(\"\");\n }\n } else if (includeHidden) {\n // includeHidden can be the value true, or it can be a selector string\n // indicating a special test; for example:\n // $('#myForm').clearForm('.special:hidden')\n // the above would clean hidden inputs that have the class of 'special'\n if (\n (includeHidden === true && /hidden/.test(t)) ||\n (typeof includeHidden === \"string\" && $(this).is(includeHidden))\n ) {\n this.value = \"\";\n }\n }\n });\n };\n\n /**\n * Resets the form data or individual elements. Takes the following actions\n * on the selected tags:\n * - all fields within form elements will be reset to their original value\n * - input / textarea / select fields will be reset to their original value\n * - option / optgroup fields (for multi-selects) will defaulted individually\n * - non-multiple options will find the right select to default\n * - label elements will be searched against its 'for' attribute\n * - all others will be searched for appropriate children to default\n */\n $.fn.resetForm = function () {\n return this.each(function () {\n var el = $(this);\n var tag = tagName(this);\n\n switch (tag) {\n case \"input\":\n this.checked = this.defaultChecked;\n\n // as the native reset: types whose value is the value attribute keep it\n if (this.type === \"file\") {\n // a file input cannot take its value attribute; the native reset empties it\n this.value = \"\";\n } else if (!/^(?:checkbox|radio|hidden|submit|reset|button|image)$/.test(this.type)) {\n this.value = this.defaultValue;\n }\n\n return true;\n\n case \"textarea\":\n this.value = this.defaultValue;\n\n return true;\n\n case \"option\":\n case \"optgroup\":\n var select = el.parents(\"select\");\n\n if (select.length && select[0].multiple) {\n if (tag === \"option\") {\n this.selected = this.defaultSelected;\n } else {\n el.find(\"option\").resetForm();\n }\n } else {\n select.resetForm();\n }\n\n return true;\n\n case \"select\":\n // in order, as the native reset: of several default options, a single select keeps the last\n el.find(\"option\").each(function () {\n this.selected = this.defaultSelected;\n });\n\n return true;\n\n case \"label\":\n // The control whose id the for attribute names, and the controls inside the label. The\n // filter keeps a for that names an ancestor from resetting the label again.\n var forEl = this.htmlFor && this.ownerDocument.getElementById(this.htmlFor);\n\n el.find(\"input,select,textarea\").add(forEl).filter(\"input,select,textarea\").resetForm();\n\n return true;\n\n case \"form\":\n // through the prototype: a control named reset shadows the method\n callFormMethod(this, \"reset\");\n\n return true;\n\n default:\n el.find(\"form,input,label,select,textarea\").resetForm();\n\n return true;\n }\n });\n };\n\n /**\n * Enables or disables any matching elements.\n */\n $.fn.enable = function (b) {\n if (typeof b === \"undefined\") {\n b = true;\n }\n\n return this.each(function () {\n this.disabled = !b;\n });\n };\n\n /**\n * Checks/unchecks any matching checkboxes or radio buttons and\n * selects/deselects and matching option elements.\n */\n $.fn.selected = function (select) {\n if (typeof select === \"undefined\") {\n select = true;\n }\n\n return this.each(function () {\n var t = this.type;\n\n if (t === \"checkbox\" || t === \"radio\") {\n this.checked = select;\n } else if (tagName(this) === \"option\") {\n var $sel = $(this).parent(\"select\");\n\n if (select && $sel[0] && $sel[0].type === \"select-one\") {\n // deselect all other options\n $sel.find(\"option\").selected(false);\n }\n\n this.selected = select;\n }\n });\n };\n\n // expose debug var\n $.fn.ajaxSubmit.debug = false;\n})(jQuery);\n\nexport default jQuery;\n"],"names":["owners","plainForm","document","createElement","findDescriptor","name","i","length","owner","window","descriptor","Object","getOwnPropertyDescriptor","prototype","formMember","form","get","call","e","callFormMethod","value","apply","Array","slice","arguments","tagName","el","toLowerCase","isDisabled","matches","disabled","isElement","node","assertRealParent","parentNode","Error","closestByTag","names","indexOf","storeKey","setExpando","ignore","expando","els","namedItem","undefined","record","x","y","jQuery","data","type","setTimeout","captureSubmitter","target","point","offsetX","offsetY","fn","offset","pageX","left","pageY","top","offsetLeft","offsetTop","imagePoint","submitterOf","stored","log","ajaxSubmit","debug","msg","join","console","opera","postError","warned","deprecate","id","message","warn","deprecateOldJQuery","version","parts","String","split","major","Number","beforeJQuery35","shorthandOptions","options","dataType","onSuccess","result","url","success","submitOptions","key","hasOwnProperty","withoutUrl","keepContext","settings","sources","context","selectorOption","ownerDocument","test","find","submitWith","isDefaultPrevented","preventDefault","originalEvent","submitter","captureEventSubmitter","doAjaxSubmit","captureSubmittingElement","this","bindDelegated","$sel","selector","off","on","closestMatch","Element","closest","is","delegated","unbindSelector","handlers","submit","click","selectionOnly","ajaxForm","jquery","delegation","bindSelector","beforeFormUnbind","ajaxFormUnbind","o","s","c","isReady","bindLater","formAttribute","attr","rLineBreak","rCR","rUnsubmittable","valueOf","index","selectedIndex","a","ops","one","max","op","selected","v","attributes","specified","text","push","selectValue","val","raw","replace","fieldValue","successful","sub","t","checked","isSuccessful","deprecateFieldValueOverride","loneSurrogate","wellFormed","match","before","setKey","object","defineProperty","enumerable","writable","configurable","wellFormedData","isArray","toString","copy","changed","urlencode","fields","traditional","param","map","field","urlencodedFields","createSuccessfulControls","feature","$","controlsOf","semantic","formId","getElementsByTagName","makeArray","grep","ownedBy","navigator","userAgent","concat","filter","getAttribute","inArray","outsideControls","fieldsOf","n","constructor","fileapi","files","file","required","imageFields","input","addCandidate","collected","own","controls","collect","filtering","addClickedImage","deepSerialize","extraData","part","serialized","len","decodeURIComponent","sendFormData","submission","formdata","FormData","append","serializedData","extend","ajaxSettings","contentType","processData","cache","method","uploadProgress","createXhr","xhr","upload","addEventListener","event","percent","position","loaded","total","lengthComputable","Math","ceil","beforeSend","formData","ajax","sendAjax","uploadAttributes","hasOwn","isGet","addSubmitterFields","submitterFields","addCsrfField","forms","origin","csrf_token","csrf_param","posts","property","href","location","protocol","host","setFormAttribute","getDoc","frame","doc","contentWindow","err","contentDocument","readStatus","status","statusText","readResponse","retry","errMsg","isXml","XMLDocument","isXMLDoc","body","innerHTML","docRoot","documentElement","responseText","responseXML","getResponseHeader","header","readDocument","dt","scr","textarea","ta","pre","b","textContent","innerText","readEmbedded","ct","xml","nodeName","error","dataFilter","JSON","parse","globalEval","httpData","createLifecycle","g","timeoutHandle","callbackProcessed","deferred","Deferred","aborted","getAllResponseHeaders","setRequestHeader","abort","done","rejection","textStatus","stop","reject","trigger","complete","endGlobalEvents","active","clearTimeout","release","settle","failure","resolve","succeed","start","global","fail","startTimer","onTimeout","timeout","stopTimer","createIframeTransport","hasProp","frameCount","fileUploadIframe","$body","$io","iframeTarget","each","nameWindow","io","setAttribute","iframeSrc","css","createFrame","Date","getTime","life","execCommand","remove","frameHooks","domCheckCount","checkState","state","readyState","cb","doSubmit","saved","saveAttributes","mp","skipEncodingOverride","setUploadAttributes","extraInputs","added","addHiddenInput","appendTo","isPlainObject","single","f","addExtraInputs","root","contains","notInDocument","attachEvent","listen","submitForm","restoreAttributes","detachEvent","removeEventListener","unlisten","post","forceSync","jqxhr","elements","prop","removeAttr","enableControls","closeKeepAlive","createSubmission","serialization","refuse","extraQuery","optionsData","requestFormat","query","pairs","at","decodeQuery","queryPairs","defineKey","callbackList","callback","callEach","callbacks","args","prepare","$set","action","trim","URL","withDefaults","defaultType","veto","beforeSerialize","qx","beforeSubmit","resolved","resolveMethod","extra","stringify","jsonBody","q","toUpperCase","hashAt","base","encode","$form","deliver","resetForm","clearForm","includeHidden","successes","jqXHR","successArguments","replaceTarget","$target","merge","errors","completes","chooseTransport","hasFileInputs","add","multipart","attribute","fileAPI","shouldUseFrame","transport","iframe","steps","transports","attr2","removeData","k","formToArray","formSerialize","fieldSerialize","clearFields","clearInputs","re","tag","replaceWith","clone","defaultChecked","defaultValue","select","parents","multiple","defaultSelected","forEl","htmlFor","getElementById","enable","parent"],"mappings":";;;;;;;;;;;;;;;;;;;;;4ZAMIA,EAAS,CAAC,kBAAmB,cAAe,UAAW,QAGvDC,EAAYC,EAASC,cAAc,QAEvC,SAASC,EAAeC,GACtB,IAAK,IAAIC,EAAI,EAAGA,EAAIN,EAAOO,OAAQD,IAAK,CACtC,IAAIE,EAAQC,EAAOT,EAAOM,IACtBI,EAAaF,GAASG,OAAOC,yBAAyBJ,EAAMK,UAAWR,GAE3E,GAAIK,EACF,OAAOA,CAEX,CAEA,OAAO,IACT,CAOO,SAASI,EAAWC,EAAMV,GAC/B,IAAIK,EAAaN,EAAeC,GAEhC,IACE,OAAOK,EAAWM,IAAIC,KAAKF,EAC7B,CAAE,MAAOG,GACP,OAAOH,EAAKV,EACd,CACF,CAMO,SAASc,EAAeJ,EAAMV,GACnC,IAAIK,EAAaN,EAAeC,GAGhC,OAFaK,EAAaA,EAAWU,MAAQnB,EAAUI,IAEzCgB,MAAMN,EAAMO,MAAMT,UAAUU,MAAMN,KAAKO,UAAW,GACl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X,EAET,IAAK,SACL,IAAK,WACH,IAAIC,EAAS9c,EAAG+c,QAAQ,UAYxB,OAVID,EAAOje,QAAUie,EAAO,GAAGE,SACjB,WAARP,EACF9W,KAAKwC,SAAWxC,KAAKsX,gBAErBjd,EAAGkF,KAAK,UAAUwV,YAGpBoC,EAAOpC,aAGF,EAET,IAAK,SAMH,OAJA1a,EAAGkF,KAAK,UAAU8P,KAAK,WACrBrP,KAAKwC,SAAWxC,KAAKsX,eACvB,IAEO,EAET,IAAK,QAGH,IAAIC,EAAQvX,KAAKwX,SAAWxX,KAAKX,cAAcoY,eAAezX,KAAKwX,SAInE,OAFAnd,EAAGkF,KAAK,yBAAyBqW,IAAI2B,GAAO3R,OAAO,yBAAyBmP,aAErE,EAET,IAAK,OAIH,OAFAjb,EAAekG,KAAM,UAEd,EAET,QAGE,OAFA3F,EAAGkF,KAAK,oCAAoCwV,aAErC,EAEb,EACF,EAKA9P,EAAE5I,GAAGqb,OAAS,SAAUzL,GAKtB,YAJiB,IAANA,IACTA,GAAI,GAGCjM,KAAKqP,KAAK,WACfrP,KAAKvF,UAAYwR,CACnB,EACF,EAMAhH,EAAE5I,GAAGmG,SAAW,SAAU2U,GAKxB,YAJsB,IAAXA,IACTA,GAAS,GAGJnX,KAAKqP,KAAK,WACf,IAAIhM,EAAIrD,KAAKlE,KAEb,GAAU,aAANuH,GAA0B,UAANA,EACtBrD,KAAKsD,QAAU6T,OACV,GAAsB,WAAlB/c,EAAQ4F,MAAoB,CACrC,IAAIE,EAAO+E,EAAEjF,MAAM2X,OAAO,UAEtBR,GAAUjX,EAAK,IAAuB,eAAjBA,EAAK,GAAGpE,MAE/BoE,EAAKX,KAAK,UAAUiD,UAAS,GAG/BxC,KAAKwC,SAAW2U,CAClB,CACF,EACF,EAGAlS,EAAE5I,GAAGY,WAAWC,OAAQ,CACzB,CA5bD,CA4bGtB"} \ No newline at end of file +{"version":3,"file":"jquery.form.min.js","sources":["../src/form-members.js","../src/submitter.js","../src/diagnostics.js","../src/options.js","../src/ajax-form.js","../src/form-attributes.js","../src/successful-controls.js","../src/xhr-transport.js","../src/iframe-post.js","../src/iframe-response.js","../src/iframe-lifecycle.js","../src/iframe-transport.js","../src/submission.js","../src/jquery.form.js"],"sourcesContent":["// Form members: the properties and methods the plugin reads or calls on a form. A control named\n// like a member (elements, setAttribute) shadows that member on the form itself, so members are\n// read through the DOM prototypes, which a control cannot shadow.\n\n// The prototype chain of a form, nearest first. Looked up on every call: old browsers have no\n// DOM prototypes, and tests remove them.\nvar owners = [\"HTMLFormElement\", \"HTMLElement\", \"Element\", \"Node\"];\n\n// A form no control can shadow, for methods when the DOM has no prototypes to read them from.\nvar plainForm = document.createElement(\"form\");\n\nfunction findDescriptor(name) {\n for (var i = 0; i < owners.length; i++) {\n var owner = window[owners[i]];\n var descriptor = owner && Object.getOwnPropertyDescriptor(owner.prototype, name);\n\n if (descriptor) {\n return descriptor;\n }\n }\n\n return null;\n}\n\n/**\n * Reads a member of a form through its prototype getter.\n * Falls back to the plain property without DOM prototypes, or on an element the getter does not\n * accept (such as a fieldset for `elements`).\n */\nexport function formMember(form, name) {\n var descriptor = findDescriptor(name);\n\n try {\n return descriptor.get.call(form);\n } catch (e) {\n return form[name];\n }\n}\n\n/**\n * Calls a method of a form through its prototype, or through an unshadowed form without DOM\n * prototypes.\n */\nexport function callFormMethod(form, name) {\n var descriptor = findDescriptor(name);\n var method = descriptor ? descriptor.value : plainForm[name];\n\n return method.apply(form, Array.prototype.slice.call(arguments, 2));\n}\n\n// Nodes such as the document and text nodes have no tag name (#600).\nexport function tagName(el) {\n var name = formMember(el, \"tagName\");\n\n return typeof name === \"string\" ? name.toLowerCase() : \"\";\n}\n\n/**\n * Whether a control or option is disabled, also through a disabled fieldset or optgroup. Without\n * selector matching, only its own disabled property is read.\n */\nexport function isDisabled(el) {\n return typeof el.matches === \"function\" ? el.matches(\":disabled\") : !!el.disabled;\n}\n\n// Elements only: the subject of formToArray may also be the document or a plain object.\nexport function isElement(node) {\n return formMember(node, \"nodeType\") === 1;\n}\n\n// A control named parentNode makes every parentNode walk (jQuery's trigger and closest among\n// them) cycle between the form and the control.\nexport function assertRealParent(el) {\n if (el.parentNode !== formMember(el, \"parentNode\")) {\n throw new Error(\n 'jquery.form: a form control named \"parentNode\" hides the form\\'s parentNode; rename the control'\n );\n }\n}\n\n// The element itself or its nearest ancestor with one of the tag names, through the real tree.\nexport function closestByTag(el, names) {\n for (var node = el; node; node = formMember(node, \"parentNode\")) {\n if (names.indexOf(tagName(node)) >= 0) {\n return node;\n }\n }\n\n return null;\n}\n","import { closestByTag, formMember, isDisabled } from \"./form-members.js\";\nimport jQuery from \"jquery\";\n\n// The submitter: the button that submitted a form, captured from ajaxForm's clicks. It is kept in\n// a private store and cleared shortly after the click. The form's clk, clk_x and clk_y properties\n// are still written for pages that read them, and read when the store has none.\n\nvar storeKey = \"jqFormSubmitter\";\n\n// Writes a property on the form; a control with that name makes it read-only.\nfunction setExpando(form, name, value) {\n try {\n form[name] = value;\n } catch (ignore) {\n // the control keeps the name; the store has the submitter\n }\n}\n\n// A property the page set on the form, never a control of the form with that name.\nfunction expando(form, name) {\n var value = form[name];\n var els = formMember(form, \"elements\");\n\n return els && value && els.namedItem(name) === value ? undefined : value;\n}\n\n// Records a submitter for a form until the click window ends.\nfunction record(form, el, x, y) {\n jQuery.data(form, storeKey, { el: el, x: x, y: y });\n setExpando(form, \"clk\", el);\n\n if (el.type === \"image\") {\n setExpando(form, \"clk_x\", x);\n setExpando(form, \"clk_y\", y);\n }\n\n // clear form vars\n setTimeout(function () {\n jQuery.data(form, storeKey, null);\n setExpando(form, \"clk\", null);\n setExpando(form, \"clk_x\", null);\n setExpando(form, \"clk_y\", null);\n }, 100);\n}\n\n// The clicked point of an image button, relative to the image.\nfunction imagePoint(e, target) {\n if (typeof e.offsetX !== \"undefined\") {\n return [e.offsetX, e.offsetY];\n }\n\n if (typeof jQuery.fn.offset === \"function\") {\n var offset = jQuery(target).offset();\n\n return [e.pageX - offset.left, e.pageY - offset.top];\n }\n\n return [e.pageX - target.offsetLeft, e.pageY - target.offsetTop];\n}\n\n/**\n * Records the submit or image button a click event reached, for the form it belongs to.\n */\nexport function captureSubmitter(e) {\n // the clicked control, or the button around the clicked content (ex: a span within a button)\n var target = closestByTag(e.target, [\"button\", \"input\"]);\n\n // the type property, unlike the attribute, is \"submit\" for a button without a type (#588)\n if (!target || (target.type !== \"submit\" && target.type !== \"image\")) {\n return;\n }\n\n var form = target.form;\n\n if (!form) {\n // a submit control that belongs to no form\n return;\n }\n\n var point = target.type === \"image\" ? imagePoint(e, target) : [];\n\n record(form, target, point[0], point[1]);\n}\n\n/**\n * Records the submitter a submit event names (SubmitEvent.submitter), when no click was captured.\n * An image submitter gets the point 0,0, as native submission sends it without a click.\n */\nexport function captureEventSubmitter(e, form) {\n var el = e.originalEvent && e.originalEvent.submitter;\n\n if (el && !submitterOf(form)) {\n record(form, el, 0, 0);\n }\n}\n\n/**\n * The form's submitter as { el, x, y } (x and y for an image button), or null.\n */\nexport function submitterOf(form) {\n if (!form) {\n return null;\n }\n\n var stored = jQuery.data(form, storeKey);\n\n if (stored) {\n return stored;\n }\n\n var el = expando(form, \"clk\");\n\n return el ? { el: el, x: expando(form, \"clk_x\"), y: expando(form, \"clk_y\") } : null;\n}\n\n/**\n * The submitter's fields for a post that adds them itself (the iframe upload), as name β†’ value.\n */\nexport function submitterFields(form) {\n var fields = {};\n var sub = submitterOf(form);\n var el = sub && sub.el;\n\n // a disabled button is not sent, also when a disabled fieldset disables it\n if (el && el.name && !isDisabled(el)) {\n fields[el.name] = el.value;\n if (el.type === \"image\") {\n fields[el.name + \".x\"] = sub.x;\n fields[el.name + \".y\"] = sub.y;\n }\n }\n\n return fields;\n}\n\n/**\n * The form's submitter element, or null.\n */\nexport function submitterElement(form) {\n var sub = submitterOf(form);\n\n return sub ? sub.el : null;\n}\n","import jQuery from \"jquery\";\n\n// Debug logging, switched on by $.fn.ajaxSubmit.debug. The flag is read on every call, so it can\n// be turned on after the plugin loads.\nexport function log() {\n if (!jQuery.fn.ajaxSubmit.debug) {\n return;\n }\n\n var msg = \"[jquery.form] \" + Array.prototype.join.call(arguments, \"\");\n\n if (window.console && window.console.log) {\n window.console.log(msg);\n } else if (window.opera && window.opera.postError) {\n window.opera.postError(msg);\n }\n}\n\nvar warned = {};\n\n/**\n * A deprecation warning: console.warn, only while debug is on, once per id per page. The message\n * names the replacement; the warning adds that the feature is removed in 5.0.\n */\nexport function deprecate(id, message) {\n if (!jQuery.fn.ajaxSubmit.debug || warned[id]) {\n return;\n }\n\n warned[id] = true;\n\n if (window.console && typeof window.console.warn === \"function\") {\n window.console.warn(\"[jquery.form] \" + message + \" (removed in 5.0)\");\n }\n}\n\n// Forgets which deprecations have warned (for tests).\nexport function resetDeprecations() {\n warned = {};\n}\n\n// True for a jQuery version string older than 3.5.\nexport function beforeJQuery35(version) {\n var parts = String(version).split(\".\");\n var major = Number(parts[0]);\n\n return major < 3 || (major === 3 && Number(parts[1]) < 5);\n}\n\n// 5.0 needs jQuery 3.5 or later: warned on the first ajaxSubmit or ajaxForm, given jQuery's version.\nexport function deprecateOldJQuery(version) {\n if (beforeJQuery35(version)) {\n deprecate(\n \"jquery\",\n \"support for jQuery \" + version + \" is deprecated, 5.0 needs jQuery 3.5 or later\"\n );\n }\n}\n","import jQuery from \"jquery\";\nimport { log } from \"./diagnostics.js\";\n\n// The arguments ajaxSubmit and ajaxForm accept in place of an options object.\n\n/**\n * Turns the (url, data, dataType, success) shorthand into options. A url of false is kept as\n * the url; anything else is returned as given.\n */\nexport function shorthandOptions(options, data, dataType, onSuccess) {\n if (typeof options !== \"string\" && options !== false) {\n return options;\n }\n\n var result = { url: options, data: data, dataType: dataType };\n\n if (typeof onSuccess === \"function\") {\n result.success = onSuccess;\n }\n\n return result;\n}\n\n// A copy of options without its url, so the form action is used.\nfunction withoutUrl(options) {\n var result = {};\n\n for (var key in options) {\n if (key !== \"url\" && Object.prototype.hasOwnProperty.call(options, key)) {\n result[key] = options[key];\n }\n }\n\n return result;\n}\n\n/**\n * The options ajaxSubmit starts from: a function is the success callback, the shorthand is\n * expanded, and no options at all is an empty object. A url of false or \"\" means the form action.\n */\nexport function submitOptions(options, data, dataType, onSuccess) {\n if (typeof options === \"function\") {\n return { success: options };\n }\n\n options = shorthandOptions(options, data, dataType, onSuccess);\n\n if (typeof options === \"undefined\") {\n return {};\n }\n\n return options.url === false || options.url === \"\" ? withoutUrl(options) : options;\n}\n\n/**\n * jQuery treats `context` as a flat option: after a deep merge, the settings get back the\n * caller's own object from the last source that has one, so `this` in callbacks is that object.\n */\nexport function keepContext(settings, sources) {\n for (var i = 0; i < sources.length; i++) {\n if (sources[i].context !== undefined) {\n settings.context = sources[i].context;\n }\n }\n\n return settings;\n}\n\n/**\n * The elements a selector option (target, iframeTarget) names. A string is only ever a selector,\n * looked up in the document, so jQuery never builds elements from it; a string starting with \"<\"\n * is HTML, not a selector, and matches nothing. Elements and jQuery objects are used as given.\n */\nexport function selectorOption(value, ownerDocument) {\n if (typeof value !== \"string\") {\n return jQuery(value);\n }\n\n if (/^\\s*\"'\n );\n jQuery(function () {\n jQuery(o.s, o.c).ajaxForm(options);\n });\n\n return $sel;\n }\n\n // is your DOM ready? http://docs.jquery.com/Tutorials:Introducing_$(document).ready()\n log(\"terminating; zero elements found by selector\" + (jQuery.isReady ? \"\" : \" (DOM not ready)\"));\n\n return $sel;\n}\n\n// delegation: true on jQuery 3 and later, where the selection has no selector: always warned,\n// debug or not, once per ajaxForm call.\nfunction warnUnscoped() {\n var console = window.console || {};\n\n if (typeof console.warn === \"function\") {\n console.warn(\n \"[jquery.form] delegation: true binds every form on the page on jQuery 3 and later; \" +\n 'pass a selector instead, e.g. delegation: \"form.ajax\"'\n );\n }\n}\n\nfunction bindDelegated($sel, options) {\n if ($sel.selector === undefined) {\n warnUnscoped();\n }\n\n jQuery(document)\n .off(\"submit.form-plugin\", $sel.selector, doAjaxSubmit)\n .off(\"click.form-plugin\", $sel.selector, captureSubmittingElement)\n .on(\"submit.form-plugin\", $sel.selector, options, doAjaxSubmit)\n .on(\"click.form-plugin\", $sel.selector, options, captureSubmittingElement);\n\n return $sel;\n}\n\n// The element itself or its nearest ancestor that matches the selector. The walk never reads a\n// parentNode a control can hide (jQuery's delegated walk does, and cycles on such a form).\nfunction closestMatch(el, selector) {\n if (!isElement(el)) {\n return null;\n }\n\n if (window.Element && Element.prototype.closest) {\n return Element.prototype.closest.call(el, selector);\n }\n\n for (var node = el; node && isElement(node); node = formMember(node, \"parentNode\")) {\n if (jQuery(node).is(selector)) {\n return node;\n }\n }\n\n return null;\n}\n\n// The document handlers bound for each delegation selector, keyed by \"s\" + selector.\nvar delegated = {};\n\nfunction unbindSelector(selector) {\n var handlers = delegated[\"s\" + selector];\n\n if (handlers) {\n jQuery(document)\n .off(\"submit.form-plugin\", handlers.submit)\n .off(\"click.form-plugin\", handlers.click);\n delete delegated[\"s\" + selector];\n }\n}\n\n// delegation: \"\": one handler pair on the document, scoped to the selector.\nfunction bindSelector($sel, selector, options) {\n if (!selector) {\n throw new Error(\"jquery.form: delegation needs a selector, or true\");\n }\n\n var handlers = {\n submit: function (e) {\n if (closestMatch(e.target, selector)) {\n submitWith(e, options);\n }\n },\n click: function (e) {\n if (closestMatch(e.target, selector)) {\n captureSubmitter(e);\n }\n },\n };\n\n unbindSelector(selector);\n delegated[\"s\" + selector] = handlers;\n jQuery(document)\n .on(\"submit.form-plugin\", handlers.submit)\n .on(\"click.form-plugin\", handlers.click);\n\n return $sel;\n}\n\n// Passed by ajaxForm's own rebind: unbind the selection only, never the document handlers.\nvar selectionOnly = {};\n\n/**\n * ajaxForm() binds the selected forms so a submit is sent with ajaxSubmit, with the clicked\n * submit button (and image coordinates) included. The options work as for ajaxSubmit.\n */\nexport function ajaxForm(options, data, dataType, onSuccess) {\n deprecateOldJQuery(jQuery.fn.jquery);\n options = shorthandOptions(options, data, dataType, onSuccess) || {};\n\n if (typeof options.delegation === \"string\") {\n return bindSelector(this, options.delegation, options);\n }\n\n options.delegation = options.delegation && typeof jQuery.fn.on === \"function\";\n\n if (!options.delegation && this.length === 0) {\n return bindLater(this, options);\n }\n\n if (options.delegation) {\n return bindDelegated(this, options);\n }\n\n if (options.beforeFormUnbind) {\n options.beforeFormUnbind(this, options);\n }\n\n return this.ajaxFormUnbind(selectionOnly)\n .on(\"submit.form-plugin\", options, doAjaxSubmit)\n .on(\"click.form-plugin\", options, captureSubmittingElement);\n}\n\n/**\n * ajaxFormUnbind() removes the handlers ajaxForm bound on the selection and every delegated\n * binding on the document. ajaxFormUnbind(selector) removes only that delegation selector.\n */\nexport function ajaxFormUnbind(selector) {\n if (typeof selector === \"string\") {\n unbindSelector(selector);\n\n return this;\n }\n\n if (selector !== selectionOnly) {\n delegated = {};\n jQuery(document).off(\"submit.form-plugin click.form-plugin\");\n }\n\n return this.off(\"submit.form-plugin click.form-plugin\");\n}\n","import { callFormMethod, isElement } from \"./form-members.js\";\nimport jQuery from \"jquery\";\n\n/**\n * An attribute of a form, or undefined when it is absent, as jQuery's attr returns it. The\n * subject may also be the document or a plain object, read through jQuery.\n */\nexport function formAttribute(form, name) {\n if (!isElement(form)) {\n return jQuery(form).attr(name);\n }\n\n var value = callFormMethod(form, \"getAttribute\", name);\n\n return value === null ? undefined : value;\n}\n","import { callFormMethod, formMember, isDisabled, isElement, tagName } from \"./form-members.js\";\nimport { submitterElement, submitterOf } from \"./submitter.js\";\nimport { deprecate } from \"./diagnostics.js\";\nimport { formAttribute } from \"./form-attributes.js\";\nimport jQuery from \"jquery\";\n\n// Successful controls: which controls of a form are sent, and as which name/value fields\n// (https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#constructing-the-form-data-set).\n\n// Line breaks, sent as CRLF\nvar rLineBreak = /\\r\\n|\\r|\\n/g;\nvar rCR = /\\r/g;\n\n// Listed form elements that are never submitted.\nvar rUnsubmittable = /^(?:fieldset|object|output)$/;\n\n/**\n * The successful-control rule: whether a control is sent. `submitter` is the button that\n * submitted the control's form; other submit and image buttons of a form are not sent.\n */\nexport function isSuccessful(el, submitter) {\n var t = el.type;\n\n if (!el.name || isDisabled(el) || t === \"reset\" || t === \"button\") {\n return false;\n }\n\n if (t === \"checkbox\" || t === \"radio\") {\n return !!el.checked;\n }\n\n if (t === \"submit\" || t === \"image\") {\n return !el.form || submitter === el;\n }\n\n return tagName(el) !== \"select\" || el.selectedIndex !== -1;\n}\n\n// The value of a select: the selected option's value for one, a list for several.\nfunction selectValue(el) {\n var index = el.selectedIndex;\n\n if (index < 0) {\n return null;\n }\n\n var a = [],\n ops = el.options;\n var one = el.type === \"select-one\";\n var max = one ? index + 1 : ops.length;\n\n for (var i = one ? index : 0; i < max; i++) {\n var op = ops[i];\n\n if (op.selected && !isDisabled(op)) {\n var v = op.value;\n\n if (!v) {\n // extra pain for IE...\n v =\n op.attributes && op.attributes.value && !op.attributes.value.specified\n ? op.text\n : op.value;\n }\n\n if (one) {\n return v;\n }\n\n a.push(v);\n }\n }\n\n return a;\n}\n\n/**\n * The value of a control, whether or not it is successful: a list for a multiple select, null\n * for a select with nothing selected, otherwise a string with CRLF line breaks (a lone CR or LF\n * included).\n */\nexport function valueOf(el) {\n if (tagName(el) === \"select\") {\n return selectValue(el);\n }\n\n var v = jQuery(el).val();\n var raw = el.value;\n\n // jQuery before 4.0 drops carriage returns from .val(); read them from the value itself\n if (typeof raw === \"string\" && raw.replace(rCR, \"\") === v) {\n v = raw;\n }\n\n return v.replace(rLineBreak, \"\\r\\n\");\n}\n\n/**\n * The plugin's own $.fieldValue: the value of a control, or null when `successful` is true or\n * missing and the control is not sent.\n */\nexport function fieldValue(el, successful) {\n var required = typeof successful === \"undefined\" || successful;\n\n if (required && !isSuccessful(el, submitterElement(el.form))) {\n return null;\n }\n\n return valueOf(el);\n}\n\n// 5.0 serializes without $.fieldValue, so a page that replaces it is warned (under debug) when\n// formToArray, formSerialize, fieldSerialize or ajaxSubmit reads values through the replacement.\nexport function deprecateFieldValueOverride() {\n if (jQuery.fieldValue !== fieldValue) {\n deprecate(\n \"fieldValue-override\",\n \"replacing $.fieldValue to change what is serialized is deprecated, use jQuery valHooks\"\n );\n }\n}\n\n/**\n * The fields as a urlencoded body sends them: a selected file as its name.\n */\n// A lone surrogate becomes U+FFFD, as in a native submission; jQuery.param would throw.\nvar loneSurrogate = /[\\uD800-\\uDBFF](?![\\uDC00-\\uDFFF])|([^\\uD800-\\uDBFF]|^)([\\uDC00-\\uDFFF])/g;\n\nexport function wellFormed(value) {\n return typeof value === \"string\"\n ? value.replace(loneSurrogate, function (match, before) {\n return (before || \"\") + \"\\uFFFD\";\n })\n : value;\n}\n\n// Sets an own enumerable key, so a key like __proto__ stays an ordinary key.\nfunction setKey(object, key, value) {\n Object.defineProperty(object, key, {\n value: value,\n enumerable: true,\n writable: true,\n configurable: true,\n });\n}\n\n/**\n * Data for $.param (the data option or extraData) with lone surrogates in its keys and string\n * values made well formed. Arrays and objects are walked as $.param walks them, inherited keys\n * included; they are copied only when something changes.\n */\nexport function wellFormedData(data) {\n var isArray = Array.isArray(data);\n\n if (!isArray && Object.prototype.toString.call(data) !== \"[object Object]\") {\n return wellFormed(data);\n }\n\n var copy = isArray ? [] : {};\n var changed = false;\n\n if (isArray) {\n for (var i = 0; i < data.length; i++) {\n copy[i] = wellFormedData(data[i]);\n changed = changed || copy[i] !== data[i];\n }\n } else {\n for (var key in data) {\n var name = wellFormed(key);\n var value = wellFormedData(data[key]);\n\n changed = changed || name !== key || value !== data[key];\n setKey(copy, name, value);\n }\n }\n\n return changed ? copy : data;\n}\n\n// jQuery 3 dropped $.param's \"+\" for a space; a native submission still sends \"+\". Only a space\n// encodes as %20, since a literal % encodes as %25.\nexport function urlencode(fields, traditional) {\n return jQuery.param(urlencodedFields(fields), traditional).replace(/%20/g, \"+\");\n}\n\nexport function urlencodedFields(fields) {\n return jQuery.map(fields, function (field) {\n var value =\n field.type === \"file\" && typeof field.value !== \"string\" ? field.value.name : field.value;\n var name = wellFormed(field.name);\n value = wellFormed(value);\n\n return name === field.name && value === field.value ? field : { name: name, value: value };\n });\n}\n\n/**\n * The serialization steps. `feature` holds what the entry detected at load (fileapi).\n */\nexport function createSuccessfulControls(feature) {\n var $ = jQuery;\n\n // #386; inputs that name the form in their form attribute, other than the candidates found.\n // A form only gets the ones it owns.\n function outsideControls(formId, els, owner) {\n // hat tip @thet; the id is compared, never built into a selector\n return $(\":input[form]\")\n .filter(function () {\n return (\n this.getAttribute(\"form\") === formId &&\n (!owner || this.form === owner) &&\n $.inArray(this, els) < 0\n );\n })\n .get();\n }\n\n // A descendant of a form is a candidate unless it is a control another form owns.\n function ownedBy(els, owner) {\n return $.grep(els, function (el) {\n return typeof el.form === \"undefined\" || el.form === owner;\n });\n }\n\n /**\n * The candidate controls of a form, in order: its elements, or every descendant it owns in\n * semantic mode, then the outside controls it owns that name it.\n */\n function controlsOf(form, semantic) {\n var formId = formAttribute(form, \"id\");\n var els = formMember(form, \"elements\");\n\n if (semantic || typeof els === \"undefined\") {\n // the document is not an element; it has its own getElementsByTagName\n els = isElement(form)\n ? callFormMethod(form, \"getElementsByTagName\", \"*\")\n : form.getElementsByTagName(\"*\");\n }\n\n els = $.makeArray(els);\n\n // the subject may also be a fieldset, the document or another container\n var owner = tagName(form) === \"form\" ? form : null;\n\n if (semantic && owner) {\n els = ownedBy(els, owner);\n }\n\n // FinesseRus: in non-IE browsers outside fields are already included in form.elements.\n if (formId && (semantic || /(Edge|Trident)\\//.test(navigator.userAgent))) {\n els = els.concat(outsideControls(formId, els, owner));\n }\n\n return els;\n }\n\n // The fields of a control's value, or null when the control is not sent.\n function fieldsOf(el) {\n var n = el.name;\n // read at call time, so a page that replaces $.fieldValue changes what is sent\n var v = $.fieldValue(el, true);\n\n if (v && v.constructor === Array) {\n return $.map(v, function (value) {\n return { name: n, value: value };\n });\n }\n\n if (feature.fileapi && el.type === \"file\") {\n var files = el.files;\n\n // #180: an empty field when no file is selected\n return files.length\n ? $.map(files, function (file) {\n return { name: n, value: file, type: el.type };\n })\n : [{ name: n, value: \"\", type: el.type }];\n }\n\n if (v === null || typeof v === \"undefined\") {\n return null;\n }\n\n return [{ name: n, value: v, type: el.type, required: el.required }];\n }\n\n // The clicked image's value and coordinates.\n function imageFields(sub, input, type) {\n var n = input.name;\n var value = { name: n, value: $(input).val() };\n\n if (type) {\n value.type = type;\n }\n\n return [value, { name: n + \".x\", value: sub.x }, { name: n + \".y\", value: sub.y }];\n }\n\n // Adds one candidate control's fields, and the control when it has a value to send.\n function addCandidate(collected, form, el, semantic) {\n if (!el.name || isDisabled(el) || rUnsubmittable.test(tagName(el))) {\n return;\n }\n\n var sub = semantic && el.type === \"image\" && submitterOf(form);\n\n if (sub) {\n // handle image inputs on the fly when semantic == true\n if (sub.el === el) {\n collected.fields.push.apply(collected.fields, imageFields(sub, el, el.type));\n }\n\n return;\n }\n\n var own = fieldsOf(el);\n\n if (own) {\n collected.controls.push(el);\n collected.fields.push.apply(collected.fields, own);\n }\n }\n\n // input type=='image' are not found in elements array! handle it here\n function addClickedImage(collected, form) {\n var sub = submitterOf(form);\n var input = sub && $(sub.el)[0];\n\n if (input && input.name && !isDisabled(input) && input.type === \"image\") {\n collected.fields.push.apply(collected.fields, imageFields(sub, input));\n }\n }\n\n /**\n * The fields of a form, as formToArray returns them, and the controls they came from.\n */\n function collect(form, semantic, filtering) {\n var collected = { fields: [], controls: [] };\n\n if (!form) {\n return collected;\n }\n\n deprecateFieldValueOverride();\n\n var els = controlsOf(form, semantic);\n\n if (typeof filtering === \"function\") {\n els = $.map(els, filtering);\n }\n\n for (var i = 0; i < els.length; i++) {\n addCandidate(collected, form, els[i], semantic);\n }\n\n if (!semantic) {\n addClickedImage(collected, form);\n }\n\n return collected;\n }\n\n return {\n controlsOf: controlsOf,\n fieldsOf: fieldsOf,\n collect: collect,\n };\n}\n","import jQuery from \"jquery\";\nimport { keepContext } from \"./options.js\";\nimport { wellFormedData } from \"./successful-controls.js\";\n\n// The XMLHttpRequest transports: $.ajax with the encoded fields, or FormData for file uploads.\nvar $ = jQuery;\n\n// utility fn for deep serialization: [name, value] pairs, as $.param encodes them\nexport function deepSerialize(extraData, traditional) {\n var param = $.param(wellFormedData(extraData), traditional);\n var serialized = param ? param.split(\"&\") : [];\n var len = serialized.length;\n var result = [];\n var i, part;\n\n for (i = 0; i < len; i++) {\n // #252; undo param space replacement\n serialized[i] = serialized[i].replace(/\\+/g, \" \");\n part = serialized[i].split(\"=\");\n // #278; use array instead of object storage, favoring array serializations\n result.push([decodeURIComponent(part[0]), decodeURIComponent(part[1])]);\n }\n\n return result;\n}\n\n/**\n * Posts the fields and extraData as FormData, for files with the File API.\n * XMLHttpRequest Level 2 file uploads (big hat tip to francois2metz)\n */\nexport function sendFormData(submission) {\n var options = submission.options;\n var a = submission.fields;\n\n var formdata = new FormData();\n\n for (var i = 0; i < a.length; i++) {\n formdata.append(a[i].name, a[i].value);\n }\n\n if (options.extraData) {\n var serializedData = deepSerialize(options.extraData, submission.traditional);\n\n for (i = 0; i < serializedData.length; i++) {\n formdata.append(serializedData[i][0], serializedData[i][1]);\n }\n }\n\n options.data = null;\n\n var s = $.extend(true, {}, $.ajaxSettings, options, {\n contentType: false,\n processData: false,\n cache: false,\n type: submission.method || \"POST\",\n });\n\n keepContext(s, [$.ajaxSettings, options]);\n\n if (options.uploadProgress) {\n // workaround because jqXHR does not expose upload property: wraps the xhr factory, the\n // caller's or jQuery's\n var createXhr = s.xhr;\n\n s.xhr = function () {\n var xhr = createXhr.call(this);\n\n if (xhr.upload) {\n xhr.upload.addEventListener(\n \"progress\",\n function (event) {\n var percent = 0;\n // event.position is the deprecated name, read only when loaded is missing\n var position = event.loaded !== undefined ? event.loaded : event.position;\n var total = event.total;\n\n if (event.lengthComputable) {\n percent = Math.ceil((position / total) * 100);\n }\n\n options.uploadProgress(event, position, total, percent);\n },\n false\n );\n }\n\n return xhr;\n };\n }\n\n s.data = null;\n\n var beforeSend = s.beforeSend;\n\n s.beforeSend = function (xhr, o) {\n // Send FormData() provided by user\n if (options.formData) {\n o.data = options.formData;\n } else {\n o.data = formdata;\n }\n\n // a veto (false) cancels the upload, as on the other transports\n return beforeSend ? beforeSend.call(this, xhr, o) : undefined;\n };\n\n return $.ajax(s);\n}\n\n/**\n * Sends the encoded fields with $.ajax.\n */\nexport function sendAjax(submission) {\n return $.ajax(submission.options);\n}\n","import { callFormMethod } from \"./form-members.js\";\nimport { deepSerialize } from \"./xhr-transport.js\";\nimport jQuery from \"jquery\";\nimport { submitterFields } from \"./submitter.js\";\nimport { wellFormed } from \"./successful-controls.js\";\n\n// The iframe form post: the extra fields (submitter, CSRF, data), the form attributes set while\n// posting and restored after, and the native submit.\nvar $ = jQuery;\n\n// The form attributes an iframe upload changes while it posts.\nvar uploadAttributes = [\"action\", \"target\", \"method\", \"enctype\", \"encoding\"];\n\n// Called through the prototype: an extraData key or a form field may be named hasOwnProperty.\nvar hasOwn = Object.prototype.hasOwnProperty;\n\nfunction isGet(method) {\n return /^get$/i.test(method);\n}\n\n// Resolves both URLs through anchors, as jQuery does for crossDomain, so IE's anchor quirks\n// apply to both sides of the comparison.\nfunction isSameOrigin(url) {\n var origin = document.createElement(\"a\");\n var target = document.createElement(\"a\");\n\n origin.href = window.location.href;\n target.href = url;\n // IE fills in the host of a relative URL only once the resolved href is assigned back\n target.href = target.href; // eslint-disable-line no-self-assign\n\n return origin.protocol + \"//\" + origin.host === target.protocol + \"//\" + target.host;\n}\n\n/** Adds the clicked submitter (and an image's coordinates) to s.extraData. */\nexport function addSubmitterFields(s, form) {\n // add submitting element to data if we know it\n var fields = submitterFields(form);\n\n for (var n in fields) {\n s.extraData = s.extraData || {};\n s.extraData[wellFormed(n)] = wellFormed(fields[n]);\n }\n}\n\n/** Adds the page's CSRF token to s.extraData when the form is posted to the page's origin. */\nexport function addCsrfField(s, form, method, forms) {\n // Rails CSRF hack (thanks to Yvan Barthelemy); like jquery-ujs, only for the page's origin and\n // only when the form is posted, since a get form would put the token in the url\n var csrf_token = $(\"meta[name=csrf-token]\").attr(\"content\");\n var csrf_param = $(\"meta[name=csrf-param]\").attr(\"content\");\n var posts =\n !isGet(method) &&\n (!method || /post/i.test(method) || /post/i.test(forms.property(form, \"method\")));\n\n if (csrf_param && csrf_token && posts && isSameOrigin(s.url)) {\n s.extraData = s.extraData || {};\n s.extraData[csrf_param] = csrf_token;\n }\n}\n\nfunction setFormAttribute(form, name, value) {\n callFormMethod(form, \"setAttribute\", name, value);\n}\n\n/** The raw attributes the upload changes, null when absent, to put back exactly (#380). */\nexport function saveAttributes(form) {\n var saved = {};\n\n $.each(uploadAttributes, function (i, name) {\n saved[name] = callFormMethod(form, \"hasAttribute\", name)\n ? callFormMethod(form, \"getAttribute\", name)\n : null;\n });\n\n return saved;\n}\n\n/** Puts back the attributes saveAttributes recorded, removing those that were absent. */\nexport function restoreAttributes(form, saved) {\n $.each(uploadAttributes, function (i, name) {\n if (saved[name] === null) {\n callFormMethod(form, \"removeAttribute\", name);\n } else {\n setFormAttribute(form, name, saved[name]);\n }\n });\n}\n\n/** Points the form at the frame `target` with the upload's url, method and encoding. */\nexport function setUploadAttributes(form, target, method, s, forms) {\n var mp = \"multipart/form-data\";\n\n // update form attrs in IE friendly way\n setFormAttribute(form, \"target\", target);\n if (!method || /post/i.test(method)) {\n setFormAttribute(form, \"method\", \"POST\");\n } else if (isGet(method) && !isGet(forms.property(form, \"method\"))) {\n // a form posts natively only with GET or POST; other verbs keep the form's own method\n setFormAttribute(form, \"method\", \"GET\");\n }\n setFormAttribute(form, \"action\", s.url);\n\n // ie borks in some cases when setting encoding\n if (!s.skipEncodingOverride && (!method || /post/i.test(method))) {\n setFormAttribute(form, \"encoding\", mp);\n setFormAttribute(form, \"enctype\", mp);\n }\n}\n\n/** Appends a hidden input per extraData field to the form; each input is pushed onto `added`. */\nexport function addExtraInputs(form, ownerDocument, extraData, traditional, added) {\n // Builds the input with DOM properties: a name is never parsed as HTML.\n function addHiddenInput(name, value) {\n var input = ownerDocument.createElement(\"input\");\n\n input.type = \"hidden\";\n input.name = name;\n added.push($(input).val(value).appendTo(form)[0]);\n }\n\n if (extraData) {\n for (var n in extraData) {\n if (hasOwn.call(extraData, n)) {\n // if using the $.param format that allows for multiple values with the same name\n if (\n $.isPlainObject(extraData[n]) &&\n hasOwn.call(extraData[n], \"name\") &&\n hasOwn.call(extraData[n], \"value\")\n ) {\n addHiddenInput(wellFormed(extraData[n].name), wellFormed(extraData[n].value));\n } else {\n // arrays and objects become one field per value, as $.param sends them (#597)\n var single = {};\n\n single[n] = extraData[n];\n var fields = deepSerialize(single, traditional);\n\n for (var f = 0; f < fields.length; f++) {\n addHiddenInput(fields[f][0], fields[f][1]);\n }\n }\n }\n }\n }\n}\n\n/** Submits the form natively, even when a control named submit hides the method. */\nexport function submitForm(form) {\n try {\n form.submit();\n } catch (err) {\n // just in case form has element with name/id of 'submit'\n callFormMethod(form, \"submit\");\n }\n}\n","import jQuery from \"jquery\";\nimport { log } from \"./diagnostics.js\";\n\n// The iframe response reader: turns the frame's document into the mock xhr's text, XML, status\n// and dataType, then parses it as $.ajax would (dataFilter, JSON, script).\nvar $ = jQuery;\n\n/** The frame's document, or null when the browser denies access to it. */\nexport function getDoc(frame) {\n /* it looks like contentWindow or contentDocument do not\n * carry the protocol property in ie8, when running under ssl\n * frame.document is the only valid response document, since\n * the protocol is know but not on the other two objects. strange?\n * \"Same origin policy\" http://en.wikipedia.org/wiki/Same_origin_policy\n */\n\n var doc = null;\n\n // IE8 cascading access check\n try {\n if (frame.contentWindow) {\n doc = frame.contentWindow.document;\n }\n } catch (err) {\n // IE8 access denied under ssl & missing protocol\n log(\"cannot get iframe.contentWindow document: \" + err);\n }\n\n if (doc) {\n // successful getting content\n return doc;\n }\n\n try {\n // simply checking may throw in ie8 under ssl or mismatched protocol\n doc = frame.contentDocument ? frame.contentDocument : frame.document;\n } catch (err) {\n // last attempt\n log(\"cannot get iframe.contentDocument: \" + err);\n doc = frame.document;\n }\n\n return doc;\n}\n\n/** Parses the response text or XML for the given (lowercase) dataType. */\nexport function httpData(xhr, type, s) {\n // mostly lifted from jq1.4.4\n\n var ct = xhr.getResponseHeader(\"content-type\") || \"\",\n xml = (type === \"xml\" || !type) && ct.indexOf(\"xml\") >= 0,\n data = xml ? xhr.responseXML : xhr.responseText;\n\n if (xml && data.documentElement.nodeName === \"parsererror\") {\n if ($.error) {\n $.error(\"parsererror\");\n }\n }\n if (s && s.dataFilter) {\n data = s.dataFilter(data, type);\n }\n if (typeof data === \"string\") {\n if ((type === \"json\" || !type) && ct.indexOf(\"json\") >= 0) {\n data = JSON.parse(data);\n } else if (type === \"script\") {\n $.globalEval(data);\n }\n }\n\n return data;\n}\n\n// Copies the status and statusText attributes of an element onto the mock xhr.\nfunction readStatus(xhr, el) {\n // support for XHR 'status' & 'statusText' emulation :\n xhr.status = Number(el.getAttribute(\"status\")) || xhr.status;\n xhr.statusText = el.getAttribute(\"statusText\") || xhr.statusText;\n}\n\n// Fills the mock xhr from the document itself.\nfunction readDocument(doc, xhr, s, isXml) {\n var docRoot = doc.body ? doc.body : doc.documentElement;\n\n xhr.responseText = docRoot ? docRoot.innerHTML : null;\n xhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc;\n if (isXml) {\n s.dataType = \"xml\";\n }\n xhr.getResponseHeader = function (header) {\n // the dataType in lowercase, as $.ajax reads it\n var headers = { \"content-type\": s.dataType && s.dataType.toLowerCase() };\n\n return headers[header.toLowerCase()];\n };\n if (docRoot) {\n readStatus(xhr, docRoot);\n }\n}\n\n// A response embedded in a textarea, or text wrapped in pre or body, replaces responseText.\nfunction readEmbedded(doc, xhr, dt, s) {\n var scr = /(json|script|text)/.test(dt);\n\n if (!scr && !s.textarea) {\n return;\n }\n // see if user embedded response in textarea\n var ta = doc.getElementsByTagName(\"textarea\")[0];\n\n if (ta) {\n xhr.responseText = ta.value;\n readStatus(xhr, ta);\n } else if (scr) {\n // account for browsers injecting pre around json response\n var pre = doc.getElementsByTagName(\"pre\")[0];\n var b = doc.getElementsByTagName(\"body\")[0];\n\n if (pre) {\n xhr.responseText = pre.textContent ? pre.textContent : pre.innerText;\n } else if (b) {\n xhr.responseText = b.textContent ? b.textContent : b.innerText;\n }\n }\n}\n\n/**\n * Reads and parses the response document into the mock xhr. Returns {status, data, errMsg}, or\n * null when `retry()` asks to read the document again later (Opera's untraversable DOM).\n */\nexport function readResponse(doc, xhr, s, retry) {\n var status = \"success\",\n data,\n errMsg;\n\n try {\n var isXml = /^xml$/i.test(s.dataType) || doc.XMLDocument || $.isXMLDoc(doc);\n\n log(\"isXml=\" + isXml);\n\n if (!isXml && window.opera && (doc.body === null || !doc.body.innerHTML)) {\n // in some browsers (Opera) the iframe DOM is not always traversable when\n // the onload callback fires, so we loop a bit to accommodate\n if (retry()) {\n return null;\n }\n // let this fall through because server response could be an empty document\n }\n\n readDocument(doc, xhr, s, isXml);\n\n var dt = (s.dataType || \"\").toLowerCase();\n\n readEmbedded(doc, xhr, dt, s);\n\n try {\n data = httpData(xhr, dt, s);\n } catch (err) {\n status = \"parsererror\";\n xhr.error = errMsg = err || status;\n }\n } catch (err) {\n log(\"error caught: \", err);\n status = \"error\";\n xhr.error = errMsg = err;\n }\n\n return { status: status, data: data, errMsg: errMsg };\n}\n","import jQuery from \"jquery\";\nimport { log } from \"./diagnostics.js\";\n\n// The iframe upload's lifecycle: the mock xhr and the Deferred, the global ajax events, the\n// beforeSend veto, the timeout, abort and settling.\nvar $ = jQuery;\n\n/**\n * Creates the lifecycle of one upload with the merged settings `s`. `frame.stop()` stops the\n * frame's load and `frame.release()` removes or resets the frame after the upload.\n */\nexport function createLifecycle(s, frame) {\n var g,\n timeoutHandle,\n callbackProcessed,\n deferred = $.Deferred();\n\n var xhr = {\n // mock object\n aborted: 0,\n responseText: null,\n responseXML: null,\n status: 0,\n statusText: \"n/a\",\n getAllResponseHeaders: function () {},\n getResponseHeader: function () {},\n setRequestHeader: function () {},\n abort: function (status) {\n abort(status, [xhr, \"aborted\", status]);\n },\n };\n\n // #341\n deferred.abort = function (status) {\n xhr.abort(status);\n };\n\n function done() {\n return xhr.aborted || callbackProcessed;\n }\n\n // Completes an aborted upload once and rejects the Deferred with `rejection`.\n // `textStatus` replaces the default \"timeout\"/\"aborted\" text status.\n function abort(status, rejection, textStatus) {\n var e = textStatus || (status === \"timeout\" ? \"timeout\" : \"aborted\");\n\n if (done()) {\n return;\n }\n\n log(\"aborting upload... \" + e);\n xhr.aborted = 1;\n frame.stop();\n xhr.error = e;\n if (s.error) {\n s.error.call(s.context, xhr, e, status);\n }\n deferred.reject.apply(deferred, rejection);\n\n if (g) {\n $.event.trigger(\"ajaxError\", [xhr, s, e]);\n }\n\n complete(e);\n }\n\n // The global events that end every upload, cancelled ones included.\n function endGlobalEvents() {\n if (g) {\n $.event.trigger(\"ajaxComplete\", [xhr, s]);\n }\n\n if (g && !--$.active) {\n $.event.trigger(\"ajaxStop\");\n }\n }\n\n // The steps every finished or aborted upload ends with, in $.ajax order.\n function complete(status) {\n if (s.complete) {\n s.complete.call(s.context, xhr, status);\n }\n\n endGlobalEvents();\n clearTimeout(timeoutHandle);\n\n // clean up\n setTimeout(function () {\n frame.release();\n xhr.responseXML = null;\n }, 100);\n }\n\n // A beforeSend veto ends the upload as $.ajax cancels a request: no callbacks, the global\n // events end with ajaxError \"canceled\".\n function cancel() {\n if (done()) {\n return;\n }\n\n callbackProcessed = true;\n deferred.reject();\n if (g) {\n $.event.trigger(\"ajaxError\", [xhr, s, \"canceled\"]);\n }\n endGlobalEvents();\n }\n\n // Fires the start events and beforeSend; false when the upload must not be posted.\n function start() {\n g = s.global;\n // trigger ajax global events so that activity/block indicators work like normal\n if (g && $.active++ === 0) {\n $.event.trigger(\"ajaxStart\");\n }\n\n if (s.beforeSend && s.beforeSend.call(s.context, xhr, s) === false) {\n cancel();\n\n return false;\n }\n\n if (xhr.aborted) {\n // abort() in beforeSend already completed the upload\n return false;\n }\n\n if (g) {\n $.event.trigger(\"ajaxSend\", [xhr, s]);\n }\n\n // an ajaxSend handler may abort too\n return !xhr.aborted;\n }\n\n // Resolves the upload; returns {error} when the success callback threw.\n function succeed(data) {\n var failure;\n\n try {\n s.success.call(s.context, data, \"success\", xhr);\n } catch (err) {\n failure = { error: err };\n }\n\n deferred.resolve(xhr.responseText, \"success\", xhr);\n\n if (g) {\n $.event.trigger(\"ajaxSuccess\", [xhr, s, data]);\n }\n\n return failure;\n }\n\n // Settles the upload with the response reader's {status, data, errMsg}.\n function settle(result) {\n var status = result.status,\n errMsg = result.errMsg;\n\n if (xhr.aborted) {\n // abort() completed the upload while its response was processed\n log(\"upload aborted\");\n\n return;\n }\n\n // an emulated HTTP error status wins with the statusText, as in $.ajax; a parse error is\n // kept otherwise\n if (xhr.status && !((xhr.status >= 200 && xhr.status < 300) || xhr.status === 304)) {\n if (status === \"parsererror\") {\n errMsg = undefined;\n }\n status = \"error\";\n }\n\n callbackProcessed = true;\n\n // ordering of these callbacks/triggers is odd, but that's how $.ajax does it\n if (status === \"success\") {\n var failure = succeed(result.data);\n\n complete(status);\n if (failure) {\n // the upload is settled; the success callback's exception still reaches the console\n throw failure.error;\n }\n\n return;\n }\n\n if (typeof errMsg === \"undefined\") {\n errMsg = xhr.statusText;\n }\n if (s.error) {\n s.error.call(s.context, xhr, status, errMsg);\n }\n deferred.reject(xhr, status, errMsg);\n if (g) {\n $.event.trigger(\"ajaxError\", [xhr, s, errMsg]);\n }\n\n complete(status);\n }\n\n return {\n xhr: xhr,\n deferred: deferred,\n start: start,\n done: done,\n abort: abort,\n settle: settle,\n // Settles an upload that failed with an exception (ignored once aborted).\n fail: function (err) {\n settle({ status: \"error\", errMsg: err });\n },\n // Runs `onTimeout` after s.timeout, when set.\n startTimer: function (onTimeout) {\n if (s.timeout) {\n timeoutHandle = setTimeout(onTimeout, s.timeout);\n }\n },\n stopTimer: function () {\n clearTimeout(timeoutHandle);\n timeoutHandle = undefined;\n },\n };\n}\n","import {\n addCsrfField,\n addExtraInputs,\n addSubmitterFields,\n restoreAttributes,\n saveAttributes,\n setUploadAttributes,\n submitForm,\n} from \"./iframe-post.js\";\nimport { closestByTag, formMember } from \"./form-members.js\";\nimport { deprecate, log } from \"./diagnostics.js\";\nimport { getDoc, readResponse } from \"./iframe-response.js\";\nimport { keepContext, selectorOption } from \"./options.js\";\nimport { createLifecycle } from \"./iframe-lifecycle.js\";\nimport jQuery from \"jquery\";\n\n// The iframe transport: posts the form itself into a hidden frame and reads the response from it,\n// for file uploads without the File API or when the iframe option asks for it.\nvar $ = jQuery;\n\n/**\n * The iframe send step. `hasProp` is what the entry detected at load; `forms.property` reads a\n * form property as attr2 does.\n */\nexport function createIframeTransport(hasProp, forms) {\n var CLIENT_TIMEOUT_ABORT = 1;\n var SERVER_ABORT = 2;\n // tells apart the frames of uploads that start in the same millisecond\n var frameCount = 0;\n\n // ensure that every serialized input is still enabled\n function enableControls(elements) {\n for (var i = 0; i < elements.length; i++) {\n var el = $(elements[i]);\n\n if (hasProp) {\n el.prop(\"disabled\", false);\n } else {\n el.removeAttr(\"disabled\");\n }\n }\n }\n\n // Names the frame's window, when the page may: a cross-origin or sandboxed frame refuses.\n function nameWindow(frame, name) {\n try {\n if (frame.contentWindow) {\n frame.contentWindow.name = name;\n }\n } catch (ignore) {}\n }\n\n // The frame the form posts into: the iframeTarget, named `id` when it has no name, or a new\n // hidden frame named `id`. Returns the frame and the name the form targets.\n function createFrame(s, id, ownerDocument) {\n var $io, n;\n\n if (s.iframeTarget) {\n $io = selectorOption(s.iframeTarget, ownerDocument);\n n = $io.attr(\"name\");\n if (!n) {\n $io.attr(\"name\", id);\n // a frame already in the page keeps the browsing context name it was inserted with\n $io.each(function () {\n nameWindow(this, id);\n });\n } else {\n id = n;\n }\n } else {\n var io = ownerDocument.createElement(\"iframe\");\n\n io.setAttribute(\"name\", id);\n io.setAttribute(\"src\", s.iframeSrc);\n $io = $(io);\n $io.css({ position: \"absolute\", top: \"-1000px\", left: \"-1000px\" });\n }\n\n return { $io: $io, id: id };\n }\n\n // The frame hooks the lifecycle calls: stop a load in progress, and release after the upload.\n function frameHooks(s, $io) {\n return {\n stop: function () {\n try {\n // #214, #257\n if ($io[0].contentWindow.document.execCommand) {\n $io[0].contentWindow.document.execCommand(\"Stop\");\n }\n } catch (ignore) {}\n\n $io.attr(\"src\", s.iframeSrc); // abort op in progress\n },\n release: function () {\n if (!s.iframeTarget) {\n $io.remove();\n } else {\n // adding else to clean up existing iframe response.\n $io.attr(\"src\", s.iframeSrc);\n }\n },\n };\n }\n\n function listen(io, cb) {\n if (io.attachEvent) {\n io.attachEvent(\"onload\", cb);\n } else {\n io.addEventListener(\"load\", cb, false);\n }\n }\n\n function unlisten(io, cb) {\n if (io.detachEvent) {\n io.detachEvent(\"onload\", cb);\n } else {\n io.removeEventListener(\"load\", cb, false);\n }\n }\n\n // private function for handling file uploads (hat tip to YAHOO!)\n function fileUploadIframe(submission) {\n var form = submission.form,\n method = submission.method;\n\n var s = keepContext($.extend(true, {}, $.ajaxSettings, submission.options), [\n $.ajaxSettings,\n submission.options,\n ]);\n\n s.context = s.context || s;\n var ownerDocument = formMember(form, \"ownerDocument\");\n var $body = $(closestByTag(form, [\"body\"]));\n var frame = createFrame(s, \"jqFormIO\" + new Date().getTime() + frameCount++, ownerDocument);\n var $io = frame.$io,\n io = $io[0];\n var life = createLifecycle(s, frameHooks(s, $io));\n var domCheckCount = 50;\n\n if (!life.start()) {\n return life.deferred;\n }\n\n addSubmitterFields(s, form);\n addCsrfField(s, form, method, forms);\n\n // look for server aborts\n function checkState() {\n try {\n var state = getDoc(io).readyState;\n\n log(\"state = \" + state);\n if (state && state.toLowerCase() === \"uninitialized\") {\n setTimeout(checkState, 50);\n }\n } catch (e) {\n log(\"Server abort: \", e, \" (\", e.name, \")\");\n cb(SERVER_ABORT);\n life.stopTimer();\n }\n }\n\n // take a breath so that pending repaints get some cpu time before the upload starts\n function doSubmit() {\n var saved = saveAttributes(form);\n\n setUploadAttributes(form, frame.id, method, s, forms);\n\n // support timout\n life.startTimer(function () {\n cb(CLIENT_TIMEOUT_ABORT);\n });\n\n // add \"extra\" data to form if provided in options\n var extraInputs = [];\n\n try {\n addExtraInputs(form, ownerDocument, s.extraData, submission.traditional, extraInputs);\n\n if (!s.iframeTarget) {\n // add iframe to doc and submit the form\n $io.appendTo($body);\n }\n\n // A connected form posting into a frame outside the document opens a new window.\n var root = ownerDocument.documentElement;\n\n if (io && $.contains(root, form) && !$.contains(root, io)) {\n var notInDocument = \"jquery.form: the upload frame is not in the document\";\n\n life.abort(notInDocument, [life.xhr, \"error\", notInDocument], \"error\");\n\n return;\n }\n\n listen(io, cb);\n setTimeout(checkState, 15);\n submitForm(form);\n } finally {\n // reset attrs and remove \"extra\" input elements\n restoreAttributes(form, saved);\n $(extraInputs).remove();\n }\n }\n\n // Reads the next document by Opera's rules: false once the retries are used up.\n function retry() {\n if (--domCheckCount) {\n log(\"requeing onLoad callback, DOM not available\");\n setTimeout(cb, 250);\n\n return true;\n }\n\n return false;\n }\n\n function cb(e) {\n if (life.done()) {\n return;\n }\n\n var doc = getDoc(io);\n\n if (!doc) {\n log(\"cannot access response document\");\n e = SERVER_ABORT;\n }\n if (e === CLIENT_TIMEOUT_ABORT) {\n life.abort(\"timeout\", [life.xhr, \"timeout\"]);\n\n return;\n }\n if (e === SERVER_ABORT) {\n life.abort(\"server abort\", [life.xhr, \"error\", \"server abort\"]);\n\n return;\n }\n\n if (doc.location.href === s.iframeSrc) {\n // response not received yet\n return;\n }\n\n unlisten(io, cb);\n\n var result = readResponse(doc, life.xhr, s, retry);\n\n if (result) {\n life.settle(result);\n }\n }\n\n // An exception while posting settles the upload with \"error\" and the exception.\n function post() {\n if (life.done()) {\n // aborted before the delayed post\n return;\n }\n\n try {\n doSubmit();\n } catch (err) {\n log(\"upload failed: \", err);\n life.fail(err);\n }\n }\n\n if (s.forceSync) {\n post();\n } else {\n setTimeout(post, 10); // this lets dom updates render\n }\n\n return life.deferred;\n }\n\n return function sendIframe(submission) {\n var jqxhr;\n\n // now, while the controls are still listed: ajaxSubmit clears the list when it returns,\n // before a closeKeepAlive request completes\n enableControls(submission.controls);\n\n // hack to fix Safari hang (thanks to Tim Molendijk for this)\n // see: http://groups.google.com/group/jquery-dev/browse_thread/thread/36395b7ab510dd5d\n if (submission.options.closeKeepAlive) {\n deprecate(\"closeKeepAlive\", \"closeKeepAlive works around a Safari 3/4 bug and is deprecated\");\n $.get(submission.options.closeKeepAlive, function () {\n jqxhr = fileUploadIframe(submission);\n });\n } else {\n jqxhr = fileUploadIframe(submission);\n }\n\n return jqxhr;\n };\n}\n","import { deprecate, log } from \"./diagnostics.js\";\nimport { keepContext, selectorOption } from \"./options.js\";\nimport { urlencode, wellFormedData } from \"./successful-controls.js\";\nimport { assertRealParent } from \"./form-members.js\";\nimport jQuery from \"jquery\";\n\n// A Submission is one ajaxSubmit call once its vetoes have passed:\n// { form, $form, fields, controls, options, method, traditional }. `options` is the object the\n// callbacks and events receive; later steps change it in place.\n\n/**\n * The submission steps. `feature` holds what the entry detected at load (fileapi, formdata), and\n * `forms` reads form attributes and attr2-style properties (attribute, property), and\n * `serialization` collects the form's fields and controls.\n */\nexport function createSubmission(feature, forms, serialization) {\n var $ = jQuery;\n\n function refuse(message) {\n log(message);\n\n return null;\n }\n\n // The options merged over the form's action, the method, and the ajax defaults.\n function withDefaults(form, options, method) {\n var action = options.url || forms.property(form, \"action\");\n var url = typeof action === \"string\" ? action.trim() : \"\";\n\n // clean url (don't include hash value); an action that is only a fragment means this page\n url = url.split(\"#\")[0] || window.location.href.split(\"#\")[0];\n // IE requires javascript:false in https, but this breaks chrome >83 and goes against spec.\n // Instead of using javascript:false always, let's only apply it for IE.\n var isMsie = /(MSIE|Trident)/.test(navigator.userAgent || \"\");\n var iframeSrc = isMsie && /^https/i.test(document.URL) ? \"javascript:false\" : \"about:blank\"; // eslint-disable-line no-script-url\n\n var merged = $.extend(\n true,\n {\n url: url,\n success: $.ajaxSettings.success,\n type: method || $.ajaxSettings.type,\n iframeSrc: iframeSrc,\n },\n options\n );\n\n return keepContext(merged, [options]);\n }\n\n /**\n * The one method every transport sends, read after the hooks: `method` wins over `type`, and\n * `type` is set to it. Undefined when only the ajax default applies, so each transport keeps\n * its own default.\n */\n function resolveMethod(options, defaultType) {\n var resolved = options.method || options.type;\n\n options.type = resolved;\n\n return resolved === defaultType && !options.method ? undefined : resolved;\n }\n\n // The data option, kept as extraData and encoded, or undefined without one.\n function extraQuery(fields, options, traditional) {\n if (!options.data) {\n return undefined;\n }\n\n var optionsData = typeof options.data === \"function\" ? options.data(fields) : options.data;\n\n if (typeof optionsData === \"string\") {\n if (options.requestFormat === \"json\") {\n throw new Error(\n 'jquery.form: requestFormat \"json\" needs object data; a string data option is a query string'\n );\n }\n\n // a query string: sent as-is when urlencoded, as its own fields otherwise\n options.extraData = queryPairs(optionsData);\n\n return optionsData;\n }\n\n options.extraData = optionsData;\n\n return $.param(wellFormedData(optionsData), traditional);\n }\n\n // Sets a key as an own data property, so a name like __proto__ is an ordinary key.\n function defineKey(object, key, value) {\n Object.defineProperty(object, key, {\n value: value,\n enumerable: true,\n writable: true,\n configurable: true,\n });\n }\n\n /**\n * requestFormat \"json\" (#545): the fields as an object (a repeated name gives an array), merged\n * with object data, sent as a JSON body. Based on the idea in PR #557 by zhangciwu.\n */\n function jsonBody(options, fields) {\n if (/^get$/i.test(options.type)) {\n throw new Error('jquery.form: requestFormat \"json\" needs a method with a body, such as POST');\n }\n\n var body = {};\n var own = Object.prototype.hasOwnProperty;\n\n for (var i = 0; i < fields.length; i++) {\n var name = fields[i].name;\n\n if (!own.call(body, name)) {\n defineKey(body, name, fields[i].value);\n } else if (Array.isArray(body[name])) {\n body[name].push(fields[i].value);\n } else {\n defineKey(body, name, [body[name], fields[i].value]);\n }\n }\n\n var extra = options.extraData;\n\n for (var key in extra) {\n if (own.call(extra, key)) {\n defineKey(body, key, extra[key]);\n }\n }\n\n options.data = JSON.stringify(body);\n options.contentType = \"application/json; charset=UTF-8\";\n }\n\n // The fields of a query string, as the { name, value } list $.param takes.\n function queryPairs(query) {\n var pairs = [];\n var parts = query.split(\"&\");\n\n for (var i = 0; i < parts.length; i++) {\n if (parts[i]) {\n var at = parts[i].indexOf(\"=\");\n var name = at < 0 ? parts[i] : parts[i].slice(0, at);\n var value = at < 0 ? \"\" : parts[i].slice(at + 1);\n\n pairs.push({ name: decodeQuery(name), value: decodeQuery(value) });\n }\n }\n\n return pairs;\n }\n\n function decodeQuery(text) {\n return decodeURIComponent(text.replace(/\\+/g, \" \"));\n }\n\n // Puts the encoded fields in the url for a get, and in the data otherwise.\n function encode(options, q, qx) {\n if (qx) {\n q = q ? q + \"&\" + qx : qx;\n }\n\n if (options.type.toUpperCase() === \"GET\") {\n // the query goes before any fragment in the url option\n var hashAt = options.url.indexOf(\"#\");\n var base = hashAt < 0 ? options.url : options.url.slice(0, hashAt);\n\n options.url =\n base + (base.indexOf(\"?\") >= 0 ? \"&\" : \"?\") + q + options.url.slice(base.length);\n options.data = null; // data is null for 'get'\n } else {\n options.data = q; // data is the query string for 'post'\n }\n }\n\n // A callback option as a list: an array as given, one function, or none.\n function callbackList(callback) {\n if (Array.isArray(callback)) {\n return callback;\n }\n\n return callback ? [callback] : [];\n }\n\n // Calls each callback in order with the same this and arguments.\n function callEach(callbacks, context, args) {\n for (var i = 0; i < callbacks.length; i++) {\n callbacks[i].apply(context, args);\n }\n }\n\n /**\n * Resolves the options, serializes the form, and runs the vetoes: the Submission, or null when\n * an event or callback stopped it.\n */\n function prepare($set, options) {\n $set.each(function () {\n assertRealParent(this);\n });\n\n var form = $set[0];\n var method = options.method || options.type || forms.property(form, \"method\");\n\n options = withDefaults(form, options, method);\n\n // the ajax default type, when neither the caller nor the form gave a method\n var defaultType = method ? undefined : options.type;\n\n // hook for manipulating the form data before it is extracted;\n // convenient for use with rich editors like tinyMCE or FCKEditor\n var veto = {};\n\n $set.trigger(\"form-pre-serialize\", [$set, options, veto]);\n if (veto.veto) {\n return refuse(\"ajaxSubmit: submit vetoed via form-pre-serialize trigger\");\n }\n\n // provide opportunity to alter form data before it is serialized\n if (options.beforeSerialize && options.beforeSerialize($set, options) === false) {\n return refuse(\"ajaxSubmit: submit aborted via beforeSerialize callback\");\n }\n\n var traditional = options.traditional;\n\n if (typeof traditional === \"undefined\") {\n traditional = $.ajaxSettings.traditional;\n }\n\n var collected = serialization.collect($set[0], options.semantic, options.filtering);\n var fields = collected.fields;\n var controls = collected.controls;\n var qx = extraQuery(fields, options, traditional);\n\n // give pre-submit callback an opportunity to abort the submit\n if (options.beforeSubmit && options.beforeSubmit(fields, $set, options) === false) {\n return refuse(\"ajaxSubmit: submit aborted via beforeSubmit callback\");\n }\n\n // fire vetoable 'validate' event\n $set.trigger(\"form-submit-validate\", [fields, $set, options, veto]);\n if (veto.veto) {\n return refuse(\"ajaxSubmit: submit vetoed via form-submit-validate trigger\");\n }\n\n method = resolveMethod(options, defaultType);\n\n if (options.requestFormat === \"json\") {\n jsonBody(options, fields);\n } else {\n encode(options, urlencode(fields, traditional), qx);\n }\n\n return {\n form: form,\n $form: $set,\n fields: fields,\n controls: controls,\n options: options,\n method: method,\n traditional: traditional,\n };\n }\n\n /**\n * Wraps success, error and complete (a function or an array of them, as $.ajax takes) so each\n * also receives the form, and adds the resetForm,\n * clearForm and target steps before the success callbacks.\n */\n function deliver(submission) {\n var $set = submission.$form;\n var options = submission.options;\n var callbacks = [];\n\n if (options.resetForm) {\n callbacks.push(function () {\n $set.resetForm();\n });\n }\n\n if (options.clearForm) {\n callbacks.push(function () {\n $set.clearForm(options.includeHidden);\n });\n }\n\n // perform a load on the target only if dataType is not provided\n if (!options.dataType && options.target) {\n var successes = callbackList(options.success);\n\n callbacks.push(function (data, textStatus, jqXHR) {\n var successArguments = arguments,\n fn = options.replaceTarget ? \"replaceWith\" : \"html\",\n $target = selectorOption(options.target);\n\n // Only a string response is inserted. jQuery has already parsed a JSON or XML response,\n // and inserting it would parse each of its strings as HTML.\n if (typeof data === \"string\") {\n $target[fn](data);\n } else {\n log(\"target: the response was parsed by jQuery, so it is not inserted\");\n }\n\n if (!$target.length) {\n // nothing to fill: success still runs once, with the normal context\n callEach(successes, this, successArguments);\n }\n\n $target.each(function () {\n callEach(successes, this, successArguments);\n });\n });\n } else {\n $.merge(callbacks, callbackList(options.success));\n }\n\n options.success = function (data, status, xhr) {\n // jQuery 1.4+ passes xhr as 3rd arg\n var context = options.context || this; // jQuery 1.4+ supports scope context\n\n for (var i = 0, max = callbacks.length; i < max; i++) {\n callbacks[i].apply(context, [data, status, xhr || $set, $set]);\n }\n };\n\n if (options.error) {\n var errors = callbackList(options.error);\n\n options.error = function (xhr, status, error) {\n callEach(errors, options.context || this, [xhr, status, error, $set]);\n };\n }\n\n if (options.complete) {\n var completes = callbackList(options.complete);\n\n options.complete = function (xhr, status) {\n callEach(completes, options.context || this, [xhr, status, $set]);\n };\n }\n }\n\n /**\n * The transport for a submission: \"iframe\" for files without the File API or when forced,\n * \"formdata\" for files with it, \"ajax\" otherwise.\n */\n function chooseTransport(submission) {\n var $set = submission.$form;\n var options = submission.options;\n\n // [value] (issue #113), also see comment:\n // https://github.com/malsup/form/commit/588306aedba1de01388032d5f42a60159eea9228#commitcomment-2180219\n // and the file inputs outside the form that belong to it through their form attribute\n var fileInputs = $(\"input[type=file]:enabled\", $set)\n .add($(submission.controls).filter(\"input[type=file]\"))\n .filter(function () {\n return $(this).val() !== \"\";\n });\n var hasFileInputs = fileInputs.length > 0;\n // compared as the browser does: ASCII case-insensitive, without surrounding whitespace\n var mp = /^[\\t\\n\\f\\r ]*multipart\\/form-data[\\t\\n\\f\\r ]*$/i;\n var multipart =\n mp.test(forms.attribute($set[0], \"enctype\")) || mp.test(forms.attribute($set[0], \"encoding\"));\n var fileAPI = feature.fileapi && feature.formdata;\n\n log(\"fileAPI :\" + fileAPI);\n\n var shouldUseFrame = (hasFileInputs || multipart) && !fileAPI;\n\n var transport = (hasFileInputs || multipart) && fileAPI ? \"formdata\" : \"ajax\";\n\n // options.iframe allows user to force iframe mode\n // 06-NOV-09: now defaulting to iframe mode if file input is detected\n if (options.iframe !== false && (options.iframe || shouldUseFrame)) {\n transport = \"iframe\";\n }\n\n if (transport === \"iframe\" && !options.iframe) {\n deprecate(\n \"iframe\",\n \"choosing the iframe transport automatically without FormData is deprecated, set iframe: true\"\n );\n }\n\n if (transport !== \"ajax\" && options.requestFormat === \"json\") {\n throw new Error(\n 'jquery.form: requestFormat \"json\" cannot send files or use the iframe transport'\n );\n }\n\n return transport;\n }\n\n return { prepare: prepare, deliver: deliver, chooseTransport: chooseTransport };\n}\n","/*!\n * jQuery Form Plugin\n * version: 4.6.0\n * Requires jQuery v1.7.2 or later\n * Project repository: https://github.com/jquery-form/form\n\n * Copyright 2017 Kevin Morris\n * Copyright 2006 M. Alsup\n\n * Dual licensed under the LGPL-2.1+ or MIT licenses\n * https://github.com/jquery-form/form#license\n\n * This library is free software; you can redistribute it and/or\n * modify it under the terms of the GNU Lesser General Public\n * License as published by the Free Software Foundation; either\n * version 2.1 of the License, or (at your option) any later version.\n * This library is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n */\nimport { ajaxForm, ajaxFormUnbind } from \"./ajax-form.js\";\nimport { callFormMethod, tagName } from \"./form-members.js\";\nimport {\n createSuccessfulControls,\n deprecateFieldValueOverride,\n fieldValue,\n urlencode,\n} from \"./successful-controls.js\";\nimport { deprecate, deprecateOldJQuery, log } from \"./diagnostics.js\";\nimport { sendAjax, sendFormData } from \"./xhr-transport.js\";\nimport { createIframeTransport } from \"./iframe-transport.js\";\nimport { createSubmission } from \"./submission.js\";\nimport { formAttribute } from \"./form-attributes.js\";\nimport jQuery from \"jquery\";\nimport { submitOptions } from \"./options.js\";\n\n(function ($) {\n \"use strict\";\n\n /*\n\t\tUsage Note:\n\t\t-----------\n\t\tDo not use both ajaxSubmit and ajaxForm on the same form. These\n\t\tfunctions are mutually exclusive. Use ajaxSubmit if you want\n\t\tto bind your own submit handler to the form. For example,\n\n\t\t$(document).ready(function() {\n\t\t\t$('#myForm').on('submit', function(e) {\n\t\t\t\te.preventDefault(); // <-- important\n\t\t\t\t$(this).ajaxSubmit({\n\t\t\t\t\ttarget: '#output'\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\n\t\tUse ajaxForm when you want the plugin to manage all the event binding\n\t\tfor you. For example,\n\n\t\t$(document).ready(function() {\n\t\t\t$('#myForm').ajaxForm({\n\t\t\t\ttarget: '#output'\n\t\t\t});\n\t\t});\n\n\t\tYou can also use ajaxForm with delegation (requires jQuery v1.7+), so the\n\t\tform does not have to exist when you invoke ajaxForm:\n\n\t\t$('#myForm').ajaxForm({\n\t\t\tdelegation: true,\n\t\t\ttarget: '#output'\n\t\t});\n\n\t\tWhen using ajaxForm, the ajaxSubmit function will be invoked for you\n\t\tat the appropriate time.\n\t*/\n\n /**\n * Feature detection\n */\n var feature = {};\n\n feature.fileapi = $('').get(0).files !== undefined;\n feature.formdata = typeof window.FormData !== \"undefined\";\n\n var hasProp = !!$.fn.prop;\n // What attr2 returns for a form: the property when it is a string, otherwise the attribute. The\n // property is read plainly on purpose: a control named like it shadows it, and then the raw\n // attribute is used.\n function formProperty(form, name) {\n var value = hasProp ? form[name] : undefined;\n\n return typeof value === \"string\" ? value : formAttribute(form, name);\n }\n\n var forms = { attribute: formAttribute, property: formProperty };\n var serialization = createSuccessfulControls(feature);\n var steps = createSubmission(feature, forms, serialization);\n var transports = {\n iframe: createIframeTransport(hasProp, forms),\n formdata: sendFormData,\n ajax: sendAjax,\n };\n\n // attr2 uses prop when it can but checks the return type for\n // an expected string. This accounts for the case where a form\n // contains inputs with names like \"action\" or \"method\"; in those\n // cases \"prop\" returns the element\n $.fn.attr2 = function () {\n deprecate(\"attr2\", \"attr2 is deprecated, use .prop() or .attr()\");\n\n if (!hasProp) {\n return this.attr.apply(this, arguments);\n }\n\n var val = this.prop.apply(this, arguments);\n\n if ((val && val.jquery) || typeof val === \"string\") {\n return val;\n }\n\n return this.attr.apply(this, arguments);\n };\n\n /**\n * ajaxSubmit() provides a mechanism for immediately submitting\n * an HTML form using AJAX.\n *\n * @param\t{object|string}\toptions\t\tjquery.form.js parameters or custom url for submission\n * @param\t{object}\t\tdata\t\textraData\n * @param\t{string}\t\tdataType\tajax dataType\n * @param\t{function}\t\tonSuccess\tajax success callback function\n */\n $.fn.ajaxSubmit = function (options, data, dataType, onSuccess) {\n deprecateOldJQuery($.fn.jquery);\n\n // fast fail if nothing selected (http://dev.jquery.com/ticket/2752)\n if (!this.length) {\n log(\"ajaxSubmit: skipping submit process - no element selected\");\n\n return this;\n }\n\n // #541: jQuery's slim build has no $.ajax\n if (!$.ajax) {\n throw new Error(\n \"jquery.form: ajaxSubmit needs the full jQuery build; this jQuery has no $.ajax\"\n );\n }\n\n var submission = steps.prepare(this, submitOptions(options, data, dataType, onSuccess));\n\n if (!submission) {\n return this;\n }\n\n steps.deliver(submission);\n\n var jqxhr = transports[steps.chooseTransport(submission)](submission);\n\n this.removeData(\"jqxhr\").data(\"jqxhr\", jqxhr);\n\n // clear element array\n for (var k = 0; k < submission.controls.length; k++) {\n submission.controls[k] = null;\n }\n\n // fire 'notify' event\n this.trigger(\"form-submit-notify\", [this, submission.options]);\n\n return this;\n };\n\n $.fn.ajaxForm = ajaxForm;\n $.fn.ajaxFormUnbind = ajaxFormUnbind;\n\n /**\n * formToArray() gathers form element data into an array of objects that can\n * be passed to any of the following ajax functions: $.get, $.post, or load.\n * Each object in the array has both a 'name' and 'value' property. An example of\n * an array for a simple login form might be:\n *\n * [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ]\n *\n * It is this array that is passed to pre-submit callback functions provided to the\n * ajaxSubmit() and ajaxForm() methods.\n */\n $.fn.formToArray = function (semantic, elements, filtering) {\n var collected = serialization.collect(this[0], semantic, filtering);\n\n if (elements) {\n elements.push.apply(elements, collected.controls);\n }\n\n return collected.fields;\n };\n\n /**\n * Serializes form data into a 'submittable' string. This method will return a string\n * in the format: name1=value1&name2=value2\n */\n $.fn.formSerialize = function (semantic) {\n // hand off to jQuery.param for proper encoding\n return urlencode(this.formToArray(semantic));\n };\n\n /**\n * Serializes all field elements in the jQuery object into a query string.\n * This method will return a string in the format: name1=value1&name2=value2\n */\n $.fn.fieldSerialize = function (successful) {\n var a = [];\n\n deprecateFieldValueOverride();\n\n this.each(function () {\n var n = this.name;\n\n // a form is not a field, though it may have a name\n if (!n || tagName(this) === \"form\") {\n return;\n }\n\n var v = $.fieldValue(this, successful);\n\n if (v && v.constructor === Array) {\n for (var i = 0, max = v.length; i < max; i++) {\n a.push({ name: n, value: v[i] });\n }\n } else if (v !== null && typeof v !== \"undefined\") {\n a.push({ name: this.name, value: v });\n }\n });\n\n // hand off to jQuery.param for proper encoding\n return urlencode(a);\n };\n\n /**\n * Returns the value(s) of the element in the matched set. For example, consider the following form:\n *\n *\t
\n *\t\t\n *\t\t\n *\t\t\n *\t\t\n *\t\t\n *\t\t\n *\t
\n *\n *\tvar v = $('input[type=text]').fieldValue();\n *\t// if no values are entered into the text inputs\n *\tv === ['','']\n *\t// if values entered into the text inputs are 'foo' and 'bar'\n *\tv === ['foo','bar']\n *\n *\tvar v = $('input[type=checkbox]').fieldValue();\n *\t// if neither checkbox is checked\n *\tv === undefined\n *\t// if both checkboxes are checked\n *\tv === ['B1', 'B2']\n *\n *\tvar v = $('input[type=radio]').fieldValue();\n *\t// if neither radio is checked\n *\tv === undefined\n *\t// if first radio is checked\n *\tv === ['C1']\n *\n * The successful argument controls whether or not the field element must be 'successful'\n * (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls).\n * The default value of the successful argument is true. If this value is false the value(s)\n * for each element is returned.\n *\n * Note: This method *always* returns an array. If no valid value can be determined the\n *\tarray will be empty, otherwise it will contain one or more values.\n */\n $.fn.fieldValue = function (successful) {\n for (var val = [], i = 0, max = this.length; i < max; i++) {\n var el = this[i];\n var v = $.fieldValue(el, successful);\n\n if (v === null || typeof v === \"undefined\" || (v.constructor === Array && !v.length)) {\n continue;\n }\n\n if (v.constructor === Array) {\n $.merge(val, v);\n } else {\n val.push(v);\n }\n }\n\n return val;\n };\n\n /**\n * Returns the value of the field element.\n */\n $.fieldValue = fieldValue;\n\n /**\n * Clears the form data. Takes the following actions on the form's input fields:\n * - input text fields will have their 'value' property set to the empty string\n * - select elements will have their 'selectedIndex' property set to -1\n * - checkbox and radio inputs will have their 'checked' property set to false\n * - inputs of type submit, button, reset, and hidden will *not* be effected\n * - button elements will *not* be effected\n */\n $.fn.clearForm = function (includeHidden) {\n return this.each(function () {\n $(\"input,select,textarea\", this).clearFields(includeHidden);\n });\n };\n\n /**\n * Clears the selected form elements.\n */\n $.fn.clearInputs = function (includeHidden) {\n deprecate(\"clearInputs\", \"clearInputs is deprecated, use clearFields\");\n\n return this.clearFields(includeHidden);\n };\n\n $.fn.clearFields = function (includeHidden) {\n var re =\n /^(?:color|date|datetime|datetime-local|email|month|number|password|range|search|tel|text|time|url|week)$/i; // 'hidden' is not in this list\n\n return this.each(function () {\n var t = this.type,\n tag = tagName(this);\n\n if (re.test(t) || tag === \"textarea\") {\n this.value = \"\";\n } else if (t === \"checkbox\" || t === \"radio\") {\n this.checked = false;\n } else if (tag === \"select\") {\n this.selectedIndex = -1;\n } else if (t === \"file\") {\n if (/MSIE/.test(navigator.userAgent)) {\n $(this).replaceWith($(this).clone(true));\n } else {\n $(this).val(\"\");\n }\n } else if (includeHidden) {\n // includeHidden can be the value true, or it can be a selector string\n // indicating a special test; for example:\n // $('#myForm').clearForm('.special:hidden')\n // the above would clean hidden inputs that have the class of 'special'\n if (\n (includeHidden === true && /hidden/.test(t)) ||\n (typeof includeHidden === \"string\" && $(this).is(includeHidden))\n ) {\n this.value = \"\";\n }\n }\n });\n };\n\n /**\n * Resets the form data or individual elements. Takes the following actions\n * on the selected tags:\n * - all fields within form elements will be reset to their original value\n * - input / textarea / select fields will be reset to their original value\n * - option / optgroup fields (for multi-selects) will defaulted individually\n * - non-multiple options will find the right select to default\n * - label elements will be searched against its 'for' attribute\n * - all others will be searched for appropriate children to default\n */\n $.fn.resetForm = function () {\n return this.each(function () {\n var el = $(this);\n var tag = tagName(this);\n\n switch (tag) {\n case \"input\":\n this.checked = this.defaultChecked;\n\n // as the native reset: types whose value is the value attribute keep it\n if (this.type === \"file\") {\n // a file input cannot take its value attribute; the native reset empties it\n this.value = \"\";\n } else if (!/^(?:checkbox|radio|hidden|submit|reset|button|image)$/.test(this.type)) {\n this.value = this.defaultValue;\n }\n\n return true;\n\n case \"textarea\":\n this.value = this.defaultValue;\n\n return true;\n\n case \"option\":\n case \"optgroup\":\n var select = el.parents(\"select\");\n\n if (select.length && select[0].multiple) {\n if (tag === \"option\") {\n this.selected = this.defaultSelected;\n } else {\n el.find(\"option\").resetForm();\n }\n } else {\n select.resetForm();\n }\n\n return true;\n\n case \"select\":\n // in order, as the native reset: of several default options, a single select keeps the last\n el.find(\"option\").each(function () {\n this.selected = this.defaultSelected;\n });\n\n return true;\n\n case \"label\":\n // The control whose id the for attribute names, and the controls inside the label. The\n // filter keeps a for that names an ancestor from resetting the label again.\n var forEl = this.htmlFor && this.ownerDocument.getElementById(this.htmlFor);\n\n el.find(\"input,select,textarea\").add(forEl).filter(\"input,select,textarea\").resetForm();\n\n return true;\n\n case \"form\":\n // through the prototype: a control named reset shadows the method\n callFormMethod(this, \"reset\");\n\n return true;\n\n default:\n el.find(\"form,input,label,select,textarea\").resetForm();\n\n return true;\n }\n });\n };\n\n /**\n * Enables or disables any matching elements.\n */\n $.fn.enable = function (b) {\n if (typeof b === \"undefined\") {\n b = true;\n }\n\n return this.each(function () {\n this.disabled = !b;\n });\n };\n\n /**\n * Checks/unchecks any matching checkboxes or radio buttons and\n * selects/deselects and matching option elements.\n */\n $.fn.selected = function (select) {\n if (typeof select === \"undefined\") {\n select = true;\n }\n\n return this.each(function () {\n var t = this.type;\n\n if (t === \"checkbox\" || t === \"radio\") {\n this.checked = select;\n } else if (tagName(this) === \"option\") {\n var $sel = $(this).parent(\"select\");\n\n if (select && $sel[0] && $sel[0].type === \"select-one\") {\n // deselect all other options\n $sel.find(\"option\").selected(false);\n }\n\n this.selected = select;\n }\n });\n };\n\n // expose debug var\n $.fn.ajaxSubmit.debug = false;\n})(jQuery);\n\nexport default jQuery;\n"],"names":["owners","plainForm","document","createElement","findDescriptor","name","i","length","owner","window","descriptor","Object","getOwnPropertyDescriptor","prototype","formMember","form","get","call","e","callFormMethod","value","apply","Array","slice","arguments","tagName","el","toLowerCase","isDisabled","matches","disabled","isElement","node","assertRealParent","parentNode","Error","closestByTag","names","indexOf","storeKey","setExpando","ignore","expando","els","namedItem","undefined","record","x","y","jQuery","data","type","setTimeout","captureSubmitter","target","point","offsetX","offsetY","fn","offset","pageX","left","pageY","top","offsetLeft","offsetTop","imagePoint","submitterOf","stored","log","ajaxSubmit","debug","msg","join","console","opera","postError","warned","deprecate","id","message","warn","deprecateOldJQuery","version","parts","String","split","major","Number","beforeJQuery35","shorthandOptions","options","dataType","onSuccess","result","url","success","submitOptions","key","hasOwnProperty","withoutUrl","keepContext","settings","sources","context","selectorOption","ownerDocument","test","find","submitWith","isDefaultPrevented","preventDefault","originalEvent","submitter","captureEventSubmitter","doAjaxSubmit","captureSubmittingElement","this","bindDelegated","$sel","selector","off","on","closestMatch","Element","closest","is","delegated","unbindSelector","handlers","submit","click","selectionOnly","ajaxForm","jquery","delegation","bindSelector","beforeFormUnbind","ajaxFormUnbind","o","s","c","isReady","bindLater","formAttribute","attr","rLineBreak","rCR","rUnsubmittable","valueOf","index","selectedIndex","a","ops","one","max","op","selected","v","attributes","specified","text","push","selectValue","val","raw","replace","fieldValue","successful","sub","t","checked","isSuccessful","deprecateFieldValueOverride","loneSurrogate","wellFormed","match","before","setKey","object","defineProperty","enumerable","writable","configurable","wellFormedData","isArray","toString","copy","changed","urlencode","fields","traditional","param","map","field","urlencodedFields","createSuccessfulControls","feature","$","controlsOf","semantic","formId","getElementsByTagName","makeArray","grep","ownedBy","navigator","userAgent","concat","filter","getAttribute","inArray","outsideControls","fieldsOf","n","constructor","fileapi","files","file","required","imageFields","input","addCandidate","collected","own","controls","collect","filtering","addClickedImage","deepSerialize","extraData","part","serialized","len","decodeURIComponent","sendFormData","submission","formdata","FormData","append","serializedData","extend","ajaxSettings","contentType","processData","cache","method","uploadProgress","createXhr","xhr","upload","addEventListener","event","percent","position","loaded","total","lengthComputable","Math","ceil","beforeSend","formData","ajax","sendAjax","uploadAttributes","hasOwn","isGet","addSubmitterFields","submitterFields","addCsrfField","forms","origin","csrf_token","csrf_param","posts","property","href","location","protocol","host","setFormAttribute","getDoc","frame","doc","contentWindow","err","contentDocument","readStatus","status","statusText","readResponse","retry","errMsg","isXml","XMLDocument","isXMLDoc","body","innerHTML","docRoot","documentElement","responseText","responseXML","getResponseHeader","header","readDocument","dt","scr","textarea","ta","pre","b","textContent","innerText","readEmbedded","ct","xml","nodeName","error","dataFilter","JSON","parse","globalEval","httpData","createLifecycle","g","timeoutHandle","callbackProcessed","deferred","Deferred","aborted","getAllResponseHeaders","setRequestHeader","abort","done","rejection","textStatus","stop","reject","trigger","complete","endGlobalEvents","active","clearTimeout","release","settle","failure","resolve","succeed","start","global","fail","startTimer","onTimeout","timeout","stopTimer","createIframeTransport","hasProp","frameCount","fileUploadIframe","$body","$io","iframeTarget","each","nameWindow","io","setAttribute","iframeSrc","css","createFrame","Date","getTime","life","execCommand","remove","frameHooks","domCheckCount","checkState","state","readyState","cb","doSubmit","saved","saveAttributes","mp","skipEncodingOverride","setUploadAttributes","extraInputs","added","addHiddenInput","appendTo","isPlainObject","single","f","addExtraInputs","root","contains","notInDocument","attachEvent","listen","submitForm","restoreAttributes","detachEvent","removeEventListener","unlisten","post","forceSync","jqxhr","elements","prop","removeAttr","enableControls","closeKeepAlive","createSubmission","serialization","refuse","extraQuery","optionsData","requestFormat","query","pairs","at","decodeQuery","queryPairs","defineKey","callbackList","callback","callEach","callbacks","args","prepare","$set","action","trim","URL","withDefaults","defaultType","veto","beforeSerialize","qx","beforeSubmit","resolved","resolveMethod","extra","stringify","jsonBody","q","toUpperCase","hashAt","base","encode","$form","deliver","resetForm","clearForm","includeHidden","successes","jqXHR","successArguments","replaceTarget","$target","merge","errors","completes","chooseTransport","hasFileInputs","add","multipart","attribute","fileAPI","shouldUseFrame","transport","iframe","steps","transports","attr2","removeData","k","formToArray","formSerialize","fieldSerialize","clearFields","clearInputs","re","tag","replaceWith","clone","defaultChecked","defaultValue","select","parents","multiple","defaultSelected","forEl","htmlFor","getElementById","enable","parent"],"mappings":";;;;;;;;;;;;;;;;;;;;;4ZAMIA,EAAS,CAAC,kBAAmB,cAAe,UAAW,QAGvDC,EAAYC,EAASC,cAAc,QAEvC,SAASC,EAAeC,GACtB,IAAK,IAAIC,EAAI,EAAGA,EAAIN,EAAOO,OAAQD,IAAK,CACtC,IAAIE,EAAQC,EAAOT,EAAOM,IACtBI,EAAaF,GAASG,OAAOC,yBAAyBJ,EAAMK,UAAWR,GAE3E,GAAIK,EACF,OAAOA,CAEX,CAEA,OAAO,IACT,CAOO,SAASI,EAAWC,EAAMV,GAC/B,IAAIK,EAAaN,EAAeC,GAEhC,IACE,OAAOK,EAAWM,IAAIC,KAAKF,EAC7B,CAAE,MAAOG,GACP,OAAOH,EAAKV,EACd,CACF,CAMO,SAASc,EAAeJ,EAAMV,GACnC,IAAIK,EAAaN,EAAeC,GAGhC,OAFaK,EAAaA,EAAWU,MAAQnB,EAAUI,IAEzCgB,MAAMN,EAAMO,MAAMT,UAAUU,MAAMN,KAAKO,UAAW,GAClE,CAGO,SAASC,EAAQC,GACtB,IAAIrB,EAAOS,EAAWY,EAAI,WAE1B,MAAuB,iBAATrB,EAAoBA,EAAKsB,cAAgB,EACzD,CAMO,SAASC,EAAWF,GACzB,MAA6B,mBAAfA,EAAGG,QAAyBH,EAAGG,QAAQ,eAAiBH,EAAGI,QAC3E,CAGO,SAASC,EAAUC,GACxB,OAAwC,IAAjClB,EAAWkB,EAAM,WAC1B,CAIO,SAAS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AWxC,KAAKsX,eACvB,IAEO,EAET,IAAK,QAGH,IAAIC,EAAQvX,KAAKwX,SAAWxX,KAAKX,cAAcoY,eAAezX,KAAKwX,SAInE,OAFAnd,EAAGkF,KAAK,yBAAyBqW,IAAI2B,GAAO3R,OAAO,yBAAyBmP,aAErE,EAET,IAAK,OAIH,OAFAjb,EAAekG,KAAM,UAEd,EAET,QAGE,OAFA3F,EAAGkF,KAAK,oCAAoCwV,aAErC,EAEb,EACF,EAKA9P,EAAE5I,GAAGqb,OAAS,SAAUzL,GAKtB,YAJiB,IAANA,IACTA,GAAI,GAGCjM,KAAKqP,KAAK,WACfrP,KAAKvF,UAAYwR,CACnB,EACF,EAMAhH,EAAE5I,GAAGmG,SAAW,SAAU2U,GAKxB,YAJsB,IAAXA,IACTA,GAAS,GAGJnX,KAAKqP,KAAK,WACf,IAAIhM,EAAIrD,KAAKlE,KAEb,GAAU,aAANuH,GAA0B,UAANA,EACtBrD,KAAKsD,QAAU6T,OACV,GAAsB,WAAlB/c,EAAQ4F,MAAoB,CACrC,IAAIE,EAAO+E,EAAEjF,MAAM2X,OAAO,UAEtBR,GAAUjX,EAAK,IAAuB,eAAjBA,EAAK,GAAGpE,MAE/BoE,EAAKX,KAAK,UAAUiD,UAAS,GAG/BxC,KAAKwC,SAAW2U,CAClB,CACF,EACF,EAGAlS,EAAE5I,GAAGY,WAAWC,OAAQ,CACzB,CA5bD,CA4bGtB"} \ No newline at end of file diff --git a/dist/jquery.form.mjs b/dist/jquery.form.mjs index 20d98da..faa9fab 100644 --- a/dist/jquery.form.mjs +++ b/dist/jquery.form.mjs @@ -1,6 +1,6 @@ /*! * jQuery Form Plugin - * version: 4.5.0 + * version: 4.6.0 * Requires jQuery v1.7.2 or later * Project repository: https://github.com/jquery-form/form diff --git a/form.jquery.json b/form.jquery.json index 962e373..4a65eff 100644 --- a/form.jquery.json +++ b/form.jquery.json @@ -1,7 +1,7 @@ { "name": "form", "title": "jQuery Form", - "version": "4.5.0", + "version": "4.6.0", "author": { "name": "Kevin Morris", "url": "https://github.com/kevindb/" diff --git a/package-lock.json b/package-lock.json index fdd08da..67b45a2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "jquery-form", - "version": "4.5.0", + "version": "4.6.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "jquery-form", - "version": "4.5.0", + "version": "4.6.0", "license": "(LGPL-2.1-or-later OR MIT)", "dependencies": { "jquery": ">=1.7.2" diff --git a/package.json b/package.json index 561af94..c3117b4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "jquery-form", - "version": "4.5.0", + "version": "4.6.0", "description": "The jQuery Form Plugin allows you to easily and unobtrusively upgrade HTML forms to use AJAX.", "keywords": [ "jquery", diff --git a/src/jquery.form.js b/src/jquery.form.js index b050e76..b1c8b94 100644 --- a/src/jquery.form.js +++ b/src/jquery.form.js @@ -1,6 +1,6 @@ /*! * jQuery Form Plugin - * version: 4.5.0 + * version: 4.6.0 * Requires jQuery v1.7.2 or later * Project repository: https://github.com/jquery-form/form From c9a17dbcebb51d28356cbc8a437832be6b0410f5 Mon Sep 17 00:00:00 2001 From: Kevin Morris Date: Sat, 14 Nov 2026 08:39:39 -0500 Subject: [PATCH 75/78] docs: record the 4.6.0 release metrics and plan status --- docs/metrics.md | 70 +++++++++++++++++++------------------ docs/plans/modernization.md | 9 ++--- 2 files changed, 41 insertions(+), 38 deletions(-) diff --git a/docs/metrics.md b/docs/metrics.md index 852dc26..dcf8115 100644 --- a/docs/metrics.md +++ b/docs/metrics.md @@ -4,40 +4,40 @@ Before-and-after numbers for the v4 and v5 release announcements. Add a column w Machine: Apple Silicon Mac, Node v24.11.0 (baseline), Node v26.12.1 (Phase 3 onward). -| Metric | v4.3.0 baseline (2026-10-25) | Phase 3 toolchain (2026-10-25) | Phase 3B CI baseline (2026-10-25) | Playwright cache (2026-10-25) | Phase 4B test rewrite (2026-10-25) | Phase 5 coverage (2026-10-25) | Phase 6 deps (2026-10-25) | Phase 7 triage (2026-10-29) | Phase 8 review (2026-10-31) | Phase 9 coverage (2026-10-31) | Phase 10 public fixes (2026-10-31) | 4.4.0 release (2026-11-07) | Phase 12 (local, form members) (2026-11-01) | Phase 12 (local, submission) (2026-11-01) | Phase 12 (local, submission fixes) (2026-11-01) | Phase 12 (local, iframe lifecycle) (2026-11-01) | Phase 12 (local, successful controls) (2026-11-01) | Phase 12 (local, submitter) (2026-11-01) | Phase 12 (local, ajaxForm binding) (2026-11-01) | Phase 12 (local, final) (2026-11-01) | 4.5.0 release (2026-11-10) | Phase 13 (local, 4.x test hardening) (2026-11-02) | -| ------------------------------------------------------- | --------------------------------------------------------------------- | ---------------------------------------------------------------- | ------------------------------------------------------ | ----------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| Test runner | Mocha 7 in PhantomJS via Grunt | Vitest 5 browser mode (Chromium via Playwright) | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged | Vitest 5 browser mode on Chromium, WebKit and Firefox (Firefox in Docker); Playwright Test 1.64.1 and `node:test` for end-to-end and published-file tests | -| Tests | 59 (async tests do not await their assertions) | 64: the same 59, unmodified, plus 5 publish-surface smoke tests | Unchanged | Unchanged | 64: the same 59 rewritten as BDD/AAA with async assertions awaited, plus 5 surface tests | 194: 189 suite (6 are `it.fails` bug records) plus 5 surface tests | 199: 188 suite (6 are `it.fails`), 5 publish-surface, 6 manifest | 204: 192 suite (10 are `it.fails`, 4 new for open issues), 5 publish-surface, 7 manifest and dist (1 `it.fails`) | Unchanged | 206: 194 suite (9 are `it.fails`; the script response record is now an `it`, plus 2 new tests), 5 publish-surface, 7 manifest and dist (1 `it.fails`) | 229: 217 suite (3 are `it.fails`; 6 records are now `it`, plus 23 new tests), 5 publish-surface, 7 manifest and dist (the #553 record is now an `it`) | 245: 233 suite (1 `it.fails`, delegation; the label and #597 records are now `it`, plus 16 new tests), 5 publish-surface, 7 manifest and dist | 790 suite per jQuery version (1.7.2: 12 skipped; 3.7.1: 1 skipped; 4.0.0: none), 58 `it.fails` on 3.7.1 (10 records are now `it`, plus 19 new tests), 6 publish-surface (1 new: the classic factory is strict), 7 manifest and dist | 793 suite per jQuery version, names identical to before the slice (1.7.2: 12 skipped; 3.7.1: 1 skipped; 4.0.0: none), 58 `it.fails` unchanged, surfaces unchanged | 820 suite per jQuery version (1.7.2: 12 skipped; 3.7.1: 1 skipped; 4.0.0: none), 35 `it.fails` (58 β†’ 35, 23 flipped), surfaces unchanged | 831 suite per jQuery version (1.7.2: 12 skipped; 3.7.1: 1 skipped; 4.0.0: none), 24 `it.fails` (35 β†’ 24, 11 flipped), surfaces unchanged | 849 suite per jQuery version (1.7.2: 12 skipped; 3.7.1: 1 skipped; 4.0.0: none), 17 `it.fails` (23 β†’ 17, 6 flipped), surfaces unchanged | 854 suite per jQuery version (1.7.2: 12 skipped; 3.7.1: 1 skipped; 4.0.0: none), 13 `it.fails` (17 β†’ 13, 4 flipped), surfaces unchanged | 880 suite per jQuery version (1.7.2: 12 skipped; 3.7.1: 1 skipped; 4.0.0: none), 12 `it.fails` (13 β†’ 12, 1 flipped), surfaces unchanged | 900 suite per jQuery version (1.7.2: 14 skipped; 3.7.1: 1 skipped; 4.0.0: none), 2 `it.fails` (12 β†’ 2, 10 flipped), surfaces 5, unchanged | 915 (912 pass, 2 `it.fails` for IFR-122/123, 1 skipped); suite per jQuery version 902 (1.7.2: 14 skipped; 3.7.1: 1 skipped; 4.0.0: none) | 1207 suite per jQuery version (1.7.2: 48 skipped; 3.7.1: 35; 4.0.0: 34; most skips are oracle seeds with no submitter), 0 `it.fails` (2 flipped), surfaces 5; plus 237 end-to-end tests per browser and 13 Node published-file tests. Mutation score 91.67% β†’ 94.34% (Stryker, one-off, local) | -| Suite time | 0.81 s in-browser, 7.0 s wall (`npx grunt mocha`) | 0.53 s in-runner, 0.9 s wall (`npx vitest run`) | Unchanged | Unchanged | 1.15 s in-runner (all projects), includes about 0.6 s of deliberate waits | 3.35 s in-runner (all projects), includes deliberate waits and iframe round trips | 3.35 s in-runner (all projects), 3.8 s wall (`npx vitest run`) | Unchanged | Unchanged | 3.45 s in-runner (all projects), 3.9 s wall (`npx vitest run`) | 3.23 s in-runner (all projects), 3.6 s wall (`npx vitest run`) | 4.69 s wall (`npx vitest run`) | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | 4.5 s in-runner (`npx vitest run --project suite`, jQuery 3.7.1) | 4.75 s in-runner (`npx vitest run --project suite`, jQuery 3.7.1) | 4.5 s in-runner (`npx vitest run --project suite-chromium`, jQuery 3.7.1) | -| Full `npm test` | Not defined | 1.5 s wall (lint, build, tests, coverage) | Unchanged | Unchanged | 2.6 s wall | 4.75 s wall | 6.6 s wall | 6.9 s wall | Unchanged | 5.0 s wall | 4.7 s wall | 8.1 s wall | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | 7.0 s wall (lint, format check, build, Vitest with coverage) | 7.8 s wall | 12.3 s wall (adds a WebKit run); `npm run test:e2e` 26.5 s wall | -| Line coverage of `src` | Not measured by the toolchain (about 60% under the prototype runners) | 35.4% | Unchanged | Unchanged | 35.95% | 98.14% | 98.13% | Unchanged | Unchanged | 100% | Unchanged | Unchanged | 100% (`src/*.js`, 2 files) | 100% (`src/*.js`, 7 files) | 100% (`src/*.js`, 7 files) | 100% (`src/*.js`, 10 files) | 100% (`src/*.js`, 12 files) | 100% (`src/*.js`, 13 files) | 100% (`src/*.js`, 14 files) | 100% (`src/*.js`, 14 files) | 100% | 100% (`src/*.js`, 14 files) | -| Branch coverage of `src` | Not measured (about 53% under the prototype runners) | 33.9% | Unchanged | Unchanged | Unchanged | 96.41% | 96.40% | Unchanged | Unchanged | 100% | Unchanged | Unchanged | 100% | 100% | 100% | 100% | 100% | 100% | 100% | 100% | 100% | 100% | -| Function coverage of `src` | Not measured | Not recorded | Unchanged | Unchanged | 43.10% | 98.27% | 98.24% | Unchanged | Unchanged | 100% | Unchanged | Unchanged | 100% | 100% | 100% | 100% | 100% | 100% | 100% | 100% | 100% | 100% | -| Statement coverage of `src` | Not measured | Not recorded | Unchanged | Unchanged | 36.77% | 98.17% | 98.16% | Unchanged | Unchanged | 100% | Unchanged | Unchanged | 100% | 100% | 100% | 100% | 100% | 100% | 100% | 100% | 100% | 100% | -| Coverage enforced | No | No (reported on every run) | Unchanged | Unchanged | Unchanged | Yes: lines 98.14%, branches 96.41%, functions 98.27%, statements 98.17% | Yes: lines 98.13%, branches 96.4%, functions 98.24%, statements 98.16% (same uncovered code; the `eval` fallback is gone) | Unchanged | Unchanged | Yes: 100% on all four | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged | -| `dist/jquery.form.min.js` | 17.09 kB min, 6.57 kB gzip | 17.18 kB min, 6.57 kB gzip | Unchanged | Unchanged | Unchanged | Unchanged | 17.15 kB min, 6.55 kB gzip | Unchanged | Unchanged | 16.70 kB min, 6.38 kB gzip | 17.10 kB min, 6.57 kB gzip | 17.45 kB min, 6.67 kB gzip | 18.08 kB min, 7.00 kB gzip | 18.93 kB min, 7.36 kB gzip | 20.25 kB min, 7.80 kB gzip | 21.41 kB min, 8.14 kB gzip | 22.26 kB min, 8.46 kB gzip | 22.88 kB min, 8.70 kB gzip | 23.92 kB min, 9.02 kB gzip | 25.49 kB min, 9.59 kB gzip | 25.58 kB min, 9.63 kB gzip | 26.24 kB min, 9.93 kB gzip | -| `npm audit` | 51 (11 critical, 25 high, 10 moderate, 5 low) | 0 | Unchanged | Unchanged | Unchanged | Unchanged | 0 vulnerabilities | Unchanged | Unchanged | Unchanged | 6 moderate, dev only (`minimatch` via ESLint, GHSA-g3hv-75wg-m249); 0 with `--omit=dev` | 0 (`minimatch` override, PR #638) | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | 0 | 0 (`minimatch` overridden to 11.0.4, CVE-2026-118764) | -| Dev dependencies (direct) | 8 | 15 | Unchanged | Unchanged | Unchanged | Unchanged | 15 (no upgrades were available; see `docs/research/jquery-matrix.md`) | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged | 17 (adds `@playwright/test` and `jsdom`) | -| jQuery versions tested | 3.5.1 only (from the CDN) | 3.7.1 (suite and surfaces), 4.0.0 (ESM surface only) | Unchanged | Unchanged | Unchanged | Unchanged | 1.7.2, 3.7.1 and 4.0.0, all gating in CI; the ESM surface test also loads 4.0.0 | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged (plus a slim-build fixture for 3.7.1 and 4.0.0) | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged versions, now on Chromium, WebKit and Firefox; plus the packed package by script tag, RequireJS, import map, CommonJS and ESM | -| CI | Travis and CircleCI configs (inactive) | GitHub Actions (duration recorded after the first run on `main`) | 6 warm runs, median (min–max); 1 cold run. Steps below | 6 warm runs, 1 cold run; steps below | Unchanged | 1 warm run; steps below | Run 40992583331 (warm); the `jquery` matrix jobs run in parallel with `test` | Run 40999832492 (PR, warm) | Run 41227104628 (PR, warm) | Run 41258062402 (PR, warm) | Run 41263541622 (PR, warm) | Run 42332118377 (release PR, warm) | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | Run 42496815963 (release PR before the version bump, warm) | Adds WebKit and Firefox to the jQuery matrix and an end-to-end job (3 browsers Γ— 3 jQuery); not run until pushed | -| Open issues / PRs | 27 / 8 | 27 / 8 | 27 / 8 | 27 / 8 | Unchanged | 27 / 9 (includes PR #626) | 27 / 9 (includes PR #627) | 12 / 3 (15 issues and 5 PRs closed; closures posted 2026-10-30) | 13 / 1 (#629 opened; PRs #586 and #611 closed) | Unchanged | Unchanged | Unchanged until the release closures | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | 5 / 2 before the release closures | not re-measured | -| CI queue time | β€” | β€” | 3 s (2–3 s) | 3 s (2–3 s) | Unchanged | 3 s | 2 s | 3 s | 3 s | 3 s | 3 s | 2 s | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | 2 s | not re-measured | -| CI total wall time | β€” | β€” | 31 s (27–33 s); cold 32 s | 27 s (22–31 s); cold 36 s | Unchanged | 35 s | 31 s (`test` job) | 29 s (`test` job) | 26 s (`test` job) | 27 s (`test` job) | 32 s (`test` job) | 30 s (`test` job) | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | 33 s (`test` job) | not re-measured | -| CI step: setup-node (npm cache) | β€” | β€” | 6.5 s (5–8 s); cold 5 s | 6.5 s (6–7 s); cold 6 s | Unchanged | 7 s | 6 s | 5 s | 5 s | 6 s | 5 s | 5 s | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | 5 s | not re-measured | -| CI step: `npm ci` | β€” | β€” | 1 s (1–2 s); cold 2 s | 1 s (0–2 s); cold 2 s | Unchanged | 2 s | 2 s | 2 s | 1 s | 1 s | 2 s | 2 s | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | 2 s | not re-measured | -| CI step: Playwright Chromium install | β€” | β€” | 8 s (7–10 s); cold 10 s | 1 s (0–1 s) plus 3 s cache restore; cold 10 s plus 4 s cache save | Unchanged | 1 s plus 4 s cache restore | 1 s (cache 3 s) | 1 s (cache 3 s) | 1 s (cache 2 s) | 1 s (cache 3 s) | 0 s (cache 3 s) | 1 s (cache 3 s) | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | 1 s (cache 2 s) | not re-measured | -| CI step: lint | β€” | β€” | 1 s (0–1 s) | 0 s (0–1 s) | Unchanged | 1 s | 1 s | 1 s | 1 s | 0 s | 1 s | 1 s | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | 2 s | not re-measured | -| CI step: format check | β€” | β€” | 1 s (0–1 s) | 1 s (1–2 s) | Unchanged | 1 s | 1 s | 2 s | 1 s | 1 s | 2 s | 1 s | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | 2 s | not re-measured | -| CI step: build | β€” | β€” | 0.5 s (0–1 s) | 1 s (0–1 s) | Unchanged | 1 s | 1 s | 0 s | 1 s | 1 s | 1 s | 1 s | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | 1 s | not re-measured | -| CI step: Vitest with coverage | β€” | β€” | 3 s (3–4 s) | 2.5 s (1–4 s) | Unchanged | 6 s | 6 s | 7 s | 6 s | 5 s | 8 s | 8 s | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | 9 s | not re-measured | -| CI step: checkout, job setup, dist check, report upload | β€” | β€” | about 1 s each | about 1 s each | Unchanged | 0–2 s each | 0–1 s each | 0–1 s each | 0–1 s each | 0–1 s each | 0–2 s each | 0–1 s each | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | 0–1 s each | not re-measured | -| Source lines: physical / code / comment-only | 1592 / 1050 / 289 | β€” | β€” | β€” | β€” | β€” | β€” | β€” | 1562 / 1029 / 279 | 1529 / 999 / 278 | 1584 / 1029 / 292 | 1607 / 1040 / 300 | 1696 / 1086 / 321 (2 files) | 1844 / 1159 / 367 (7 files) | 2023 / 1279 / 391 (7 files) | 2266 / 1432 / 432 (10 files) | 2407 / 1495 / 476 (12 files) | 2517 / 1555 / 502 (13 files) | 2629 / 1642 / 502 (14 files) | 2703 / 1687 / 516 (14 files) | 2704 / 1688 / 516 (14 files) | 2774 / 1736 / 527 (14 files) | -| Functions | 60 | β€” | β€” | β€” | β€” | β€” | β€” | β€” | 57 | 56 | 62 | 64 | 74 | 87 | 96 | 128 | 146 | 155 | 164 | 169 | 169 | 174 | -| Cyclomatic complexity: total / mean / max | 417 / 6.95 / 62 | β€” | β€” | β€” | β€” | β€” | β€” | β€” | 407 / 7.14 / 62 | 386 / 6.89 / 54 | 400 / 6.45 / 52 | 407 / 6.36 / 52 | 421 / 5.69 / 52 | 434 / 4.99 / 48 (`ajaxSubmit` 52 β†’ 4) | 474 / 4.94 / 48 | 510 / 3.98 / 37 | 537 / 3.68 / 15 | 558 / 3.60 / 15 | 583 / 3.55 / 15 | 597 / 3.53 / 15 | 597 / 3.53 / 15 | 617 / 3.55 / 15 | -| Functions with complexity > 10 | 10 | β€” | β€” | β€” | β€” | β€” | β€” | β€” | 10 | 10 | Unchanged | 10 | Unchanged | 9 | 10 | 9 | 9 | 9 | 9 | 9 | 9 | 10 | -| Max block nesting depth | 5 | β€” | β€” | β€” | β€” | β€” | β€” | β€” | 5 | 5 | Unchanged | 6 | 6 | 6 | 6 | 5 | 5 | 5 | 5 | 5 | 5 | 5 | -| Public API: `$.fn` / `$` members | 14 / 1 | β€” | β€” | β€” | β€” | β€” | β€” | β€” | 14 / 1 | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged (`ajaxFormUnbind` takes an optional selector) | Unchanged | Unchanged | Unchanged | -| CodeQL alerts (open) | β€” | β€” | β€” | β€” | β€” | β€” | β€” | β€” | 3 in `src/` on `main` (alerts 1, 4 and 7) | Unchanged | Unchanged (the PR adds none) | 1 expected (alert 7, `iframeTarget`); alerts 1 and 4 close | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged | 0 (alert 10, the `target` lookup moved by the module split, dismissed; 4.6.0 removes it) | Unchanged | +| Metric | v4.3.0 baseline (2026-10-25) | Phase 3 toolchain (2026-10-25) | Phase 3B CI baseline (2026-10-25) | Playwright cache (2026-10-25) | Phase 4B test rewrite (2026-10-25) | Phase 5 coverage (2026-10-25) | Phase 6 deps (2026-10-25) | Phase 7 triage (2026-10-29) | Phase 8 review (2026-10-31) | Phase 9 coverage (2026-10-31) | Phase 10 public fixes (2026-10-31) | 4.4.0 release (2026-11-07) | Phase 12 (local, form members) (2026-11-01) | Phase 12 (local, submission) (2026-11-01) | Phase 12 (local, submission fixes) (2026-11-01) | Phase 12 (local, iframe lifecycle) (2026-11-01) | Phase 12 (local, successful controls) (2026-11-01) | Phase 12 (local, submitter) (2026-11-01) | Phase 12 (local, ajaxForm binding) (2026-11-01) | Phase 12 (local, final) (2026-11-01) | 4.5.0 release (2026-11-10) | Phase 13 (local, 4.x test hardening) (2026-11-02) | 4.6.0 release (2026-11-14) | +| ------------------------------------------------------- | --------------------------------------------------------------------- | ---------------------------------------------------------------- | ------------------------------------------------------ | ----------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | +| Test runner | Mocha 7 in PhantomJS via Grunt | Vitest 5 browser mode (Chromium via Playwright) | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged | Vitest 5 browser mode on Chromium, WebKit and Firefox (Firefox in Docker); Playwright Test 1.64.1 and `node:test` for end-to-end and published-file tests | Unchanged | +| Tests | 59 (async tests do not await their assertions) | 64: the same 59, unmodified, plus 5 publish-surface smoke tests | Unchanged | Unchanged | 64: the same 59 rewritten as BDD/AAA with async assertions awaited, plus 5 surface tests | 194: 189 suite (6 are `it.fails` bug records) plus 5 surface tests | 199: 188 suite (6 are `it.fails`), 5 publish-surface, 6 manifest | 204: 192 suite (10 are `it.fails`, 4 new for open issues), 5 publish-surface, 7 manifest and dist (1 `it.fails`) | Unchanged | 206: 194 suite (9 are `it.fails`; the script response record is now an `it`, plus 2 new tests), 5 publish-surface, 7 manifest and dist (1 `it.fails`) | 229: 217 suite (3 are `it.fails`; 6 records are now `it`, plus 23 new tests), 5 publish-surface, 7 manifest and dist (the #553 record is now an `it`) | 245: 233 suite (1 `it.fails`, delegation; the label and #597 records are now `it`, plus 16 new tests), 5 publish-surface, 7 manifest and dist | 790 suite per jQuery version (1.7.2: 12 skipped; 3.7.1: 1 skipped; 4.0.0: none), 58 `it.fails` on 3.7.1 (10 records are now `it`, plus 19 new tests), 6 publish-surface (1 new: the classic factory is strict), 7 manifest and dist | 793 suite per jQuery version, names identical to before the slice (1.7.2: 12 skipped; 3.7.1: 1 skipped; 4.0.0: none), 58 `it.fails` unchanged, surfaces unchanged | 820 suite per jQuery version (1.7.2: 12 skipped; 3.7.1: 1 skipped; 4.0.0: none), 35 `it.fails` (58 β†’ 35, 23 flipped), surfaces unchanged | 831 suite per jQuery version (1.7.2: 12 skipped; 3.7.1: 1 skipped; 4.0.0: none), 24 `it.fails` (35 β†’ 24, 11 flipped), surfaces unchanged | 849 suite per jQuery version (1.7.2: 12 skipped; 3.7.1: 1 skipped; 4.0.0: none), 17 `it.fails` (23 β†’ 17, 6 flipped), surfaces unchanged | 854 suite per jQuery version (1.7.2: 12 skipped; 3.7.1: 1 skipped; 4.0.0: none), 13 `it.fails` (17 β†’ 13, 4 flipped), surfaces unchanged | 880 suite per jQuery version (1.7.2: 12 skipped; 3.7.1: 1 skipped; 4.0.0: none), 12 `it.fails` (13 β†’ 12, 1 flipped), surfaces unchanged | 900 suite per jQuery version (1.7.2: 14 skipped; 3.7.1: 1 skipped; 4.0.0: none), 2 `it.fails` (12 β†’ 2, 10 flipped), surfaces 5, unchanged | 915 (912 pass, 2 `it.fails` for IFR-122/123, 1 skipped); suite per jQuery version 902 (1.7.2: 14 skipped; 3.7.1: 1 skipped; 4.0.0: none) | 1207 suite per jQuery version (1.7.2: 48 skipped; 3.7.1: 35; 4.0.0: 34; most skips are oracle seeds with no submitter), 0 `it.fails` (2 flipped), surfaces 5; plus 237 end-to-end tests per browser and 13 Node published-file tests. Mutation score 91.67% β†’ 94.34% (Stryker, one-off, local) | 1219 suite per jQuery version (1.7.2: 48 skipped; 3.7.1: 35; 4.0.0: 34), 0 `it.fails`, surfaces 5; end-to-end on 3 browsers Γ— 3 jQuery versions in CI | +| Suite time | 0.81 s in-browser, 7.0 s wall (`npx grunt mocha`) | 0.53 s in-runner, 0.9 s wall (`npx vitest run`) | Unchanged | Unchanged | 1.15 s in-runner (all projects), includes about 0.6 s of deliberate waits | 3.35 s in-runner (all projects), includes deliberate waits and iframe round trips | 3.35 s in-runner (all projects), 3.8 s wall (`npx vitest run`) | Unchanged | Unchanged | 3.45 s in-runner (all projects), 3.9 s wall (`npx vitest run`) | 3.23 s in-runner (all projects), 3.6 s wall (`npx vitest run`) | 4.69 s wall (`npx vitest run`) | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | 4.5 s in-runner (`npx vitest run --project suite`, jQuery 3.7.1) | 4.75 s in-runner (`npx vitest run --project suite`, jQuery 3.7.1) | 4.5 s in-runner (`npx vitest run --project suite-chromium`, jQuery 3.7.1) | 4.72 s in-runner (`npx vitest run --project suite-chromium`, jQuery 3.7.1) | +| Full `npm test` | Not defined | 1.5 s wall (lint, build, tests, coverage) | Unchanged | Unchanged | 2.6 s wall | 4.75 s wall | 6.6 s wall | 6.9 s wall | Unchanged | 5.0 s wall | 4.7 s wall | 8.1 s wall | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | 7.0 s wall (lint, format check, build, Vitest with coverage) | 7.8 s wall | 12.3 s wall (adds a WebKit run); `npm run test:e2e` 26.5 s wall | 13 s wall (without the untracked probe files) | +| Line coverage of `src` | Not measured by the toolchain (about 60% under the prototype runners) | 35.4% | Unchanged | Unchanged | 35.95% | 98.14% | 98.13% | Unchanged | Unchanged | 100% | Unchanged | Unchanged | 100% (`src/*.js`, 2 files) | 100% (`src/*.js`, 7 files) | 100% (`src/*.js`, 7 files) | 100% (`src/*.js`, 10 files) | 100% (`src/*.js`, 12 files) | 100% (`src/*.js`, 13 files) | 100% (`src/*.js`, 14 files) | 100% (`src/*.js`, 14 files) | 100% | 100% (`src/*.js`, 14 files) | 100% | +| Branch coverage of `src` | Not measured (about 53% under the prototype runners) | 33.9% | Unchanged | Unchanged | Unchanged | 96.41% | 96.40% | Unchanged | Unchanged | 100% | Unchanged | Unchanged | 100% | 100% | 100% | 100% | 100% | 100% | 100% | 100% | 100% | 100% | 100% | +| Function coverage of `src` | Not measured | Not recorded | Unchanged | Unchanged | 43.10% | 98.27% | 98.24% | Unchanged | Unchanged | 100% | Unchanged | Unchanged | 100% | 100% | 100% | 100% | 100% | 100% | 100% | 100% | 100% | 100% | 100% | +| Statement coverage of `src` | Not measured | Not recorded | Unchanged | Unchanged | 36.77% | 98.17% | 98.16% | Unchanged | Unchanged | 100% | Unchanged | Unchanged | 100% | 100% | 100% | 100% | 100% | 100% | 100% | 100% | 100% | 100% | 100% | +| Coverage enforced | No | No (reported on every run) | Unchanged | Unchanged | Unchanged | Yes: lines 98.14%, branches 96.41%, functions 98.27%, statements 98.17% | Yes: lines 98.13%, branches 96.4%, functions 98.24%, statements 98.16% (same uncovered code; the `eval` fallback is gone) | Unchanged | Unchanged | Yes: 100% on all four | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged | +| `dist/jquery.form.min.js` | 17.09 kB min, 6.57 kB gzip | 17.18 kB min, 6.57 kB gzip | Unchanged | Unchanged | Unchanged | Unchanged | 17.15 kB min, 6.55 kB gzip | Unchanged | Unchanged | 16.70 kB min, 6.38 kB gzip | 17.10 kB min, 6.57 kB gzip | 17.45 kB min, 6.67 kB gzip | 18.08 kB min, 7.00 kB gzip | 18.93 kB min, 7.36 kB gzip | 20.25 kB min, 7.80 kB gzip | 21.41 kB min, 8.14 kB gzip | 22.26 kB min, 8.46 kB gzip | 22.88 kB min, 8.70 kB gzip | 23.92 kB min, 9.02 kB gzip | 25.49 kB min, 9.59 kB gzip | 25.58 kB min, 9.63 kB gzip | 26.24 kB min, 9.93 kB gzip | 26.54 kB min, 10.09 kB gzip | +| `npm audit` | 51 (11 critical, 25 high, 10 moderate, 5 low) | 0 | Unchanged | Unchanged | Unchanged | Unchanged | 0 vulnerabilities | Unchanged | Unchanged | Unchanged | 6 moderate, dev only (`minimatch` via ESLint, GHSA-g3hv-75wg-m249); 0 with `--omit=dev` | 0 (`minimatch` override, PR #638) | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | 0 | 0 (`minimatch` overridden to 11.0.4, CVE-2026-118764) | 0 | +| Dev dependencies (direct) | 8 | 15 | Unchanged | Unchanged | Unchanged | Unchanged | 15 (no upgrades were available; see `docs/research/jquery-matrix.md`) | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged | 17 (adds `@playwright/test` and `jsdom`) | Unchanged (17) | +| jQuery versions tested | 3.5.1 only (from the CDN) | 3.7.1 (suite and surfaces), 4.0.0 (ESM surface only) | Unchanged | Unchanged | Unchanged | Unchanged | 1.7.2, 3.7.1 and 4.0.0, all gating in CI; the ESM surface test also loads 4.0.0 | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged (plus a slim-build fixture for 3.7.1 and 4.0.0) | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged versions, now on Chromium, WebKit and Firefox; plus the packed package by script tag, RequireJS, import map, CommonJS and ESM | Unchanged | +| CI | Travis and CircleCI configs (inactive) | GitHub Actions (duration recorded after the first run on `main`) | 6 warm runs, median (min–max); 1 cold run. Steps below | 6 warm runs, 1 cold run; steps below | Unchanged | 1 warm run; steps below | Run 40992583331 (warm); the `jquery` matrix jobs run in parallel with `test` | Run 40999832492 (PR, warm) | Run 41227104628 (PR, warm) | Run 41258062402 (PR, warm) | Run 41263541622 (PR, warm) | Run 42332118377 (release PR, warm) | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | Run 42496815963 (release PR before the version bump, warm) | Adds WebKit and Firefox to the jQuery matrix and an end-to-end job (3 browsers Γ— 3 jQuery); not run until pushed | Run 42936871916 (release PR before the version bump, warm); the first CI run of the WebKit, Firefox and end-to-end jobs, all passing | +| Open issues / PRs | 27 / 8 | 27 / 8 | 27 / 8 | 27 / 8 | Unchanged | 27 / 9 (includes PR #626) | 27 / 9 (includes PR #627) | 12 / 3 (15 issues and 5 PRs closed; closures posted 2026-10-30) | 13 / 1 (#629 opened; PRs #586 and #611 closed) | Unchanged | Unchanged | Unchanged until the release closures | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | 5 / 2 before the release closures | not re-measured | 3 / 1 (the release PR) before the release closures | +| CI queue time | β€” | β€” | 3 s (2–3 s) | 3 s (2–3 s) | Unchanged | 3 s | 2 s | 3 s | 3 s | 3 s | 3 s | 2 s | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | 2 s | not re-measured | 10 s | +| CI total wall time | β€” | β€” | 31 s (27–33 s); cold 32 s | 27 s (22–31 s); cold 36 s | Unchanged | 35 s | 31 s (`test` job) | 29 s (`test` job) | 26 s (`test` job) | 27 s (`test` job) | 32 s (`test` job) | 30 s (`test` job) | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | 33 s (`test` job) | not re-measured | 96 s (`test` job) | +| CI step: setup-node (npm cache) | β€” | β€” | 6.5 s (5–8 s); cold 5 s | 6.5 s (6–7 s); cold 6 s | Unchanged | 7 s | 6 s | 5 s | 5 s | 6 s | 5 s | 5 s | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | 5 s | not re-measured | 7 s | +| CI step: `npm ci` | β€” | β€” | 1 s (1–2 s); cold 2 s | 1 s (0–2 s); cold 2 s | Unchanged | 2 s | 2 s | 2 s | 1 s | 1 s | 2 s | 2 s | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | 2 s | not re-measured | 2 s | +| CI step: Playwright Chromium install | β€” | β€” | 8 s (7–10 s); cold 10 s | 1 s (0–1 s) plus 3 s cache restore; cold 10 s plus 4 s cache save | Unchanged | 1 s plus 4 s cache restore | 1 s (cache 3 s) | 1 s (cache 3 s) | 1 s (cache 2 s) | 1 s (cache 3 s) | 0 s (cache 3 s) | 1 s (cache 3 s) | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | 1 s (cache 2 s) | not re-measured | 49 s (Chromium and WebKit with system dependencies; cache 5 s) | +| CI step: lint | β€” | β€” | 1 s (0–1 s) | 0 s (0–1 s) | Unchanged | 1 s | 1 s | 1 s | 1 s | 0 s | 1 s | 1 s | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | 2 s | not re-measured | 1 s | +| CI step: format check | β€” | β€” | 1 s (0–1 s) | 1 s (1–2 s) | Unchanged | 1 s | 1 s | 2 s | 1 s | 1 s | 2 s | 1 s | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | 2 s | not re-measured | 2 s | +| CI step: build | β€” | β€” | 0.5 s (0–1 s) | 1 s (0–1 s) | Unchanged | 1 s | 1 s | 0 s | 1 s | 1 s | 1 s | 1 s | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | 1 s | not re-measured | 1 s | +| CI step: Vitest with coverage | β€” | β€” | 3 s (3–4 s) | 2.5 s (1–4 s) | Unchanged | 6 s | 6 s | 7 s | 6 s | 5 s | 8 s | 8 s | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | 9 s | not re-measured | 8 s, plus 12 s for the WebKit suite | +| CI step: checkout, job setup, dist check, report upload | β€” | β€” | about 1 s each | about 1 s each | Unchanged | 0–2 s each | 0–1 s each | 0–1 s each | 0–1 s each | 0–1 s each | 0–2 s each | 0–1 s each | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | not re-measured | 0–1 s each | not re-measured | 0–1 s each | +| Source lines: physical / code / comment-only | 1592 / 1050 / 289 | β€” | β€” | β€” | β€” | β€” | β€” | β€” | 1562 / 1029 / 279 | 1529 / 999 / 278 | 1584 / 1029 / 292 | 1607 / 1040 / 300 | 1696 / 1086 / 321 (2 files) | 1844 / 1159 / 367 (7 files) | 2023 / 1279 / 391 (7 files) | 2266 / 1432 / 432 (10 files) | 2407 / 1495 / 476 (12 files) | 2517 / 1555 / 502 (13 files) | 2629 / 1642 / 502 (14 files) | 2703 / 1687 / 516 (14 files) | 2704 / 1688 / 516 (14 files) | 2774 / 1736 / 527 (14 files) | 2817 / 1759 / 538 (14 files) | +| Functions | 60 | β€” | β€” | β€” | β€” | β€” | β€” | β€” | 57 | 56 | 62 | 64 | 74 | 87 | 96 | 128 | 146 | 155 | 164 | 169 | 169 | 174 | 176 | +| Cyclomatic complexity: total / mean / max | 417 / 6.95 / 62 | β€” | β€” | β€” | β€” | β€” | β€” | β€” | 407 / 7.14 / 62 | 386 / 6.89 / 54 | 400 / 6.45 / 52 | 407 / 6.36 / 52 | 421 / 5.69 / 52 | 434 / 4.99 / 48 (`ajaxSubmit` 52 β†’ 4) | 474 / 4.94 / 48 | 510 / 3.98 / 37 | 537 / 3.68 / 15 | 558 / 3.60 / 15 | 583 / 3.55 / 15 | 597 / 3.53 / 15 | 597 / 3.53 / 15 | 617 / 3.55 / 15 | 623 / 3.54 / 15 | +| Functions with complexity > 10 | 10 | β€” | β€” | β€” | β€” | β€” | β€” | β€” | 10 | 10 | Unchanged | 10 | Unchanged | 9 | 10 | 9 | 9 | 9 | 9 | 9 | 9 | 10 | 10 | +| Max block nesting depth | 5 | β€” | β€” | β€” | β€” | β€” | β€” | β€” | 5 | 5 | Unchanged | 6 | 6 | 6 | 6 | 5 | 5 | 5 | 5 | 5 | 5 | 5 | 5 | +| Public API: `$.fn` / `$` members | 14 / 1 | β€” | β€” | β€” | β€” | β€” | β€” | β€” | 14 / 1 | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged (`ajaxFormUnbind` takes an optional selector) | Unchanged | Unchanged | Unchanged | Unchanged | +| CodeQL alerts (open) | β€” | β€” | β€” | β€” | β€” | β€” | β€” | β€” | 3 in `src/` on `main` (alerts 1, 4 and 7) | Unchanged | Unchanged (the PR adds none) | 1 expected (alert 7, `iframeTarget`); alerts 1 and 4 close | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged | Unchanged | 0 (alert 10, the `target` lookup moved by the module split, dismissed; 4.6.0 removes it) | Unchanged | 0 | How measured: CI timings from `scripts/ci-timings.sh ` (GitHub job step timestamps, whole seconds) over run 40225846996 (Phase 3B baseline; the Playwright cache column is run 40227654269, attempt 1 cold and attempts 2–7 warm; the Phase 5 column is run 40233863662, attempt 1, warm), attempts 3–8 warm (npm cache hit) and attempt 2 cold (after `gh cache delete --all`); suite time from runner output and `time`; coverage from `npm test` (v8); gzip via `gzip -c | wc -c`; issue and PR counts via `gh issue list` and `gh pr list`. @@ -64,3 +64,5 @@ The Phase 12 (local, final) column is the same branch after the last Phase 12 co The 4.5.0 release column is the `release-4.5.0` branch with the version bump. Times are from `npm test` and the suite project on each jQuery version, one warm run each on Node v26.12.1. The CI rows are the last PR run before the bump, which changed only the version strings. CodeQL alert 10 was dismissed on 2026-11-10 because the `target` and `iframeTarget` options are trusted input; 4.6.0 looks their strings up only as selectors. The Phase 13 column is the local `phase-13` branch after the test-hardening steps and the 4.6.0 fixes, on Node v26.12.1, one warm run each. Test counts are from the Chromium suite on each jQuery version; the same counts pass on WebKit and on Firefox (in Docker, `npm run test:docker`). `npm test` now also runs the suite on WebKit, which is most of the added time. The end-to-end time is `npm run test:e2e` on Chromium and WebKit with jQuery 3.7.1. The mutation score is from one local Stryker 10 run over `src/*.js` against the Chromium suite on jQuery 3.7.1 (2151 mutants; timeouts count as detected); Stryker is not a dependency. + +The 4.6.0 release column is the `release-4.6.0` branch with the version bump, on Node v26.12.1, one warm run each. Test counts are from the Chromium suite on each jQuery version; the suite has 12 more tests than in the Phase 13 column. `npm test` was run without the untracked probe files (lint and format check over tracked files only). The CI rows are the last PR run before the bump, which changed only the version strings; the Playwright install step now installs Chromium and WebKit with their system dependencies, which is most of the added CI time. CodeQL alert 10 (dismissed in 4.5.0) has no code left to flag: `target` and `iframeTarget` strings are looked up only as selectors. diff --git a/docs/plans/modernization.md b/docs/plans/modernization.md index 8d55197..0d52899 100644 --- a/docs/plans/modernization.md +++ b/docs/plans/modernization.md @@ -490,10 +490,11 @@ The Phase 12 sweep found about 70 bugs that 100% coverage had not caught. This p tests the suite does not have yet, so that 5.0 starts from a stronger contract. It runs on the local `phase-13` branch, which starts after the 4.5.0 cut on `phase-12`. -Status: done locally, waiting for the 4.4.0 and 4.5.0 releases before it ships as 4.6.0. All five -kinds of tests are in place and pass on Chromium, WebKit and Firefox with jQuery 1.7.2, 3.7.1 and -4.0.0; no `it.fails` remain. The mutation score went from 91.67% to 94.34%. The new CI jobs have not -run yet, because the branch is not pushed. +Status: done, and in the 4.6.0 release PR (#644, branch `release-4.6.0`). All five kinds of tests +are in place and pass on Chromium, WebKit and Firefox with jQuery 1.7.2, 3.7.1 and 4.0.0; no +`it.fails` remain. The mutation score went from 91.67% to 94.34%. The new WebKit, Firefox and +end-to-end CI jobs ran for the first time on the PR and pass. The `release.yml` rehearsal on the +branch passed on 2026-11-14 (run 43600588779), and the version bump is in. - Run the suite on Firefox and WebKit as well as Chromium (Vitest browser instances), locally and in CI. From 7b84e09b1ac6a193976489f457c02f914157bf2a Mon Sep 17 00:00:00 2001 From: Kevin Morris Date: Sat, 14 Nov 2026 08:39:39 -0500 Subject: [PATCH 76/78] docs: point the CDN snippets and dist link at 4.6.0 --- README.md | 8 ++++---- docs/index.md | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 7a3505a..8f96dcf 100644 --- a/README.md +++ b/README.md @@ -16,19 +16,19 @@ jQuery is a dependency of the package and is installed with it. ## Download * **npm:** [jquery-form](https://www.npmjs.com/package/jquery-form). `dist/jquery.form.min.js` is the minified build, `dist/jquery.form.js` the readable one. -* **GitHub:** each version's built files are in the `dist` folder of its tag, such as [`v4.5.0/dist`](https://github.com/jquery-form/form/tree/v4.5.0/dist); see the [releases](https://github.com/jquery-form/form/releases). The `dist` folder on `main` holds unreleased code. +* **GitHub:** each version's built files are in the `dist` folder of its tag, such as [`v4.6.0/dist`](https://github.com/jquery-form/form/tree/v4.6.0/dist); see the [releases](https://github.com/jquery-form/form/releases). The `dist` folder on `main` holds unreleased code. ### CDN From jsDelivr: ```html - + ``` Or from cdnjs: ```html - + ``` ## Usage @@ -36,7 +36,7 @@ With a script tag, load the plugin after jQuery: ```html - + ``` With a bundler, importing the module registers the plugin on the jQuery that `import "jquery"` resolves to, so `jquery` must be importable: diff --git a/docs/index.md b/docs/index.md index aa1307b..5b90bb8 100644 --- a/docs/index.md +++ b/docs/index.md @@ -26,8 +26,8 @@ The jQuery Form Plugin allows you to easily and unobtrusively upgrade HTML forms crossorigin="anonymous" > From e3fc766cf0cf68db764d9d8e4650906804427b30 Mon Sep 17 00:00:00 2001 From: Kevin Morris Date: Sat, 14 Nov 2026 08:52:56 -0500 Subject: [PATCH 77/78] ci: key the Playwright browser cache on the runner image ubuntu-latest moved to 26.04 and restored a WebKit build for 24.04 that cannot load its libraries. --- .github/workflows/ci.yml | 21 +++++++++++++++------ .github/workflows/release.yml | 7 +++++-- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bcfded0..8455c29 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -59,13 +59,16 @@ jobs: - name: Get Playwright version id: playwright if: env.CODE == 'true' - run: echo "version=$(node -p "require('playwright/package.json').version")" >> "$GITHUB_OUTPUT" + # The runner image is in the key: a browser cached on one Ubuntu release can miss libraries on the next. + run: | + echo "version=$(node -p "require('playwright/package.json').version")" >> "$GITHUB_OUTPUT" + echo "image=$ImageOS" >> "$GITHUB_OUTPUT" - name: Cache Playwright browsers if: env.CODE == 'true' uses: actions/cache@v6 with: path: ~/.cache/ms-playwright - key: playwright-${{ runner.os }}-${{ steps.playwright.outputs.version }} + key: playwright-${{ runner.os }}-${{ steps.playwright.outputs.image }}-${{ steps.playwright.outputs.version }} - name: Install Chromium and WebKit if: env.CODE == 'true' run: | @@ -164,13 +167,16 @@ jobs: - name: Get Playwright version id: playwright if: env.CODE == 'true' - run: echo "version=$(node -p "require('playwright/package.json').version")" >> "$GITHUB_OUTPUT" + # The runner image is in the key: a browser cached on one Ubuntu release can miss libraries on the next. + run: | + echo "version=$(node -p "require('playwright/package.json').version")" >> "$GITHUB_OUTPUT" + echo "image=$ImageOS" >> "$GITHUB_OUTPUT" - name: Cache Playwright browsers if: env.CODE == 'true' uses: actions/cache@v6 with: path: ~/.cache/ms-playwright - key: playwright-${{ runner.os }}-${{ steps.playwright.outputs.version }}-${{ matrix.browser }} + key: playwright-${{ runner.os }}-${{ steps.playwright.outputs.image }}-${{ steps.playwright.outputs.version }}-${{ matrix.browser }} - run: npx playwright install --with-deps ${{ matrix.browser }} if: env.CODE == 'true' - name: Fetch jQuery 1.7.2 @@ -209,12 +215,15 @@ jobs: - run: npm ci - name: Get Playwright version id: playwright - run: echo "version=$(node -p "require('playwright/package.json').version")" >> "$GITHUB_OUTPUT" + # The runner image is in the key: a browser cached on one Ubuntu release can miss libraries on the next. + run: | + echo "version=$(node -p "require('playwright/package.json').version")" >> "$GITHUB_OUTPUT" + echo "image=$ImageOS" >> "$GITHUB_OUTPUT" - name: Cache Playwright browsers uses: actions/cache@v6 with: path: ~/.cache/ms-playwright - key: playwright-${{ runner.os }}-${{ steps.playwright.outputs.version }}-${{ matrix.browser }} + key: playwright-${{ runner.os }}-${{ steps.playwright.outputs.image }}-${{ steps.playwright.outputs.version }}-${{ matrix.browser }} - run: npx playwright install --with-deps ${{ matrix.browser }} - name: Fetch jQuery 1.7.2 if: matrix.jquery == '1.7.2' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index bc3f15f..ef6c9cb 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -28,12 +28,15 @@ jobs: - run: npm ci - name: Get Playwright version id: playwright - run: echo "version=$(node -p "require('playwright/package.json').version")" >> "$GITHUB_OUTPUT" + # The runner image is in the key: a browser cached on one Ubuntu release can miss libraries on the next. + run: | + echo "version=$(node -p "require('playwright/package.json').version")" >> "$GITHUB_OUTPUT" + echo "image=$ImageOS" >> "$GITHUB_OUTPUT" - name: Cache Playwright browsers uses: actions/cache@v6 with: path: ~/.cache/ms-playwright - key: playwright-${{ runner.os }}-${{ steps.playwright.outputs.version }} + key: playwright-${{ runner.os }}-${{ steps.playwright.outputs.image }}-${{ steps.playwright.outputs.version }} # npm test runs the suite in Chromium and WebKit; WebKit needs its system libraries. - run: npx playwright install --with-deps chromium webkit - run: npm test From 90730fe8622cee936ff9491d980849d13b09a91a Mon Sep 17 00:00:00 2001 From: Kevin Morris Date: Sat, 14 Nov 2026 09:03:44 -0500 Subject: [PATCH 78/78] docs: record the new required checks and the e2e follow-up --- docs/plans/modernization.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/plans/modernization.md b/docs/plans/modernization.md index 0d52899..96a21c6 100644 --- a/docs/plans/modernization.md +++ b/docs/plans/modernization.md @@ -438,6 +438,11 @@ The order: on `main` (`jQuery 1.7.2`, `jQuery 3.7.1`, `jQuery 4.0.0`) never report and the PR stays blocked. Update branch protection to the new names (or a subset, such as the Chromium ones) when the PR's first run shows them. + - Done 2026-11-14: `main` requires `test` and the nine `jQuery on ` checks. + The end-to-end checks stay optional until they have a few weeks of clean runs (about + 2026-12-05); then add the nine `e2e on jQuery on ` checks too. + - `ubuntu-latest` moved to 26.04 on 2026-11-14 and the Playwright cache restored a 24.04 WebKit + that could not load its libraries. The cache keys now include the runner image (`ImageOS`). 6. **5.0** (Phase 14) after 4.6.0. Cut `release/4.x` from the 4.6.0 tag first (ADR-0002). Each release adds its column to `docs/metrics.md` and its section to the GitHub release notes.