tfcconnection-zola/.shadow-cljs/builds/app/dev/goog-js/goog.dom.forms.js

1 line
53 KiB
JavaScript

["^ ","~:resource-id",["~:shadow.build.classpath/resource","goog/dom/forms.js"],"~:js","goog.provide(\"goog.dom.forms\");\ngoog.require(\"goog.dom.InputType\");\ngoog.require(\"goog.dom.TagName\");\ngoog.require(\"goog.dom.safe\");\ngoog.require(\"goog.structs.Map\");\ngoog.require(\"goog.window\");\ngoog.dom.forms.submitFormInNewWindow = function(form, opt_submitElement) {\n var formData = goog.dom.forms.getFormDataMap(form);\n var action = form.action;\n var method = form.method;\n if (opt_submitElement) {\n if (goog.dom.InputType.SUBMIT != opt_submitElement.type.toLowerCase()) {\n throw new Error(\"opt_submitElement does not have a valid type.\");\n }\n var submitValue = goog.dom.forms.getValue(opt_submitElement);\n if (submitValue != null) {\n goog.dom.forms.addFormDataToMap_(formData, opt_submitElement.name, submitValue);\n }\n if (opt_submitElement.getAttribute(\"formaction\")) {\n action = opt_submitElement.getAttribute(\"formaction\");\n }\n if (opt_submitElement.getAttribute(\"formmethod\")) {\n method = opt_submitElement.getAttribute(\"formmethod\");\n }\n }\n return goog.dom.forms.submitFormDataInNewWindow(action, method, formData);\n};\ngoog.dom.forms.submitFormDataInNewWindow = function(actionUri, method, formData) {\n var newWin = goog.window.openBlank(\"\", {noreferrer:true});\n if (!newWin) {\n return false;\n }\n var newDocument = newWin.document;\n var newForm = newDocument.createElement(\"form\");\n newForm.method = method;\n goog.dom.safe.setFormElementAction(newForm, actionUri);\n formData.forEach(function(fieldValues, fieldName) {\n for (var i = 0; i < fieldValues.length; i++) {\n var fieldValue = fieldValues[i];\n var newInput = newDocument.createElement(\"input\");\n newInput.name = fieldName;\n newInput.value = fieldValue;\n newInput.type = \"hidden\";\n HTMLFormElement.prototype.appendChild.call(newForm, newInput);\n }\n });\n HTMLFormElement.prototype.submit.call(newForm);\n return true;\n};\ngoog.dom.forms.getFormDataMap = function(form) {\n var map = new goog.structs.Map();\n goog.dom.forms.getFormDataHelper_(form, map, goog.dom.forms.addFormDataToMap_);\n return map;\n};\ngoog.dom.forms.getFormDataString = function(form) {\n var sb = [];\n goog.dom.forms.getFormDataHelper_(form, sb, goog.dom.forms.addFormDataToStringBuffer_);\n return sb.join(\"\\x26\");\n};\ngoog.dom.forms.getFormDataHelper_ = function(form, result, fnAppend) {\n var els = form.elements;\n for (var el, i = 0; el = els.item(i); i++) {\n if (el.form != form || el.disabled || el.tagName == goog.dom.TagName.FIELDSET) {\n continue;\n }\n var name = el.name;\n switch(el.type.toLowerCase()) {\n case goog.dom.InputType.FILE:\n case goog.dom.InputType.SUBMIT:\n case goog.dom.InputType.RESET:\n case goog.dom.InputType.BUTTON:\n break;\n case goog.dom.InputType.SELECT_MULTIPLE:\n var values = goog.dom.forms.getValue(el);\n if (values != null) {\n for (var value, j = 0; value = values[j]; j++) {\n fnAppend(result, name, value);\n }\n }\n break;\n default:\n var value = goog.dom.forms.getValue(el);\n if (value != null) {\n fnAppend(result, name, value);\n }\n }\n }\n var inputs = form.getElementsByTagName(String(goog.dom.TagName.INPUT));\n for (var input, i = 0; input = inputs[i]; i++) {\n if (input.form == form && input.type.toLowerCase() == goog.dom.InputType.IMAGE) {\n name = input.name;\n fnAppend(result, name, input.value);\n fnAppend(result, name + \".x\", \"0\");\n fnAppend(result, name + \".y\", \"0\");\n }\n }\n};\ngoog.dom.forms.addFormDataToMap_ = function(map, name, value) {\n var array = map.get(name);\n if (!array) {\n array = [];\n map.set(name, array);\n }\n array.push(value);\n};\ngoog.dom.forms.addFormDataToStringBuffer_ = function(sb, name, value) {\n sb.push(encodeURIComponent(name) + \"\\x3d\" + encodeURIComponent(value));\n};\ngoog.dom.forms.hasFileInput = function(form) {\n var els = form.elements;\n for (var el, i = 0; el = els[i]; i++) {\n if (!el.disabled && el.type && el.type.toLowerCase() == goog.dom.InputType.FILE) {\n return true;\n }\n }\n return false;\n};\ngoog.dom.forms.setDisabled = function(el, disabled) {\n if (el.tagName == goog.dom.TagName.FORM) {\n var els = el.elements;\n for (var i = 0; el = els.item(i); i++) {\n goog.dom.forms.setDisabled(el, disabled);\n }\n } else {\n if (disabled == true) {\n el.blur();\n }\n el.disabled = disabled;\n }\n};\ngoog.dom.forms.focusAndSelect = function(el) {\n el.focus();\n if (el.select) {\n el.select();\n }\n};\ngoog.dom.forms.hasValue = function(el) {\n var value = goog.dom.forms.getValue(el);\n return !!value;\n};\ngoog.dom.forms.hasValueByName = function(form, name) {\n var value = goog.dom.forms.getValueByName(form, name);\n return !!value;\n};\ngoog.dom.forms.getValue = function(input) {\n var type = input.type;\n if (typeof type === \"string\") {\n var el = input;\n switch(type.toLowerCase()) {\n case goog.dom.InputType.CHECKBOX:\n case goog.dom.InputType.RADIO:\n return goog.dom.forms.getInputChecked_(el);\n case goog.dom.InputType.SELECT_ONE:\n return goog.dom.forms.getSelectSingle_(el);\n case goog.dom.InputType.SELECT_MULTIPLE:\n return goog.dom.forms.getSelectMultiple_(el);\n default:\n }\n }\n return input.value != null ? input.value : null;\n};\ngoog.dom.forms.getValueByName = function(form, name) {\n var els = form.elements[name];\n if (!els) {\n return null;\n } else if (els.type) {\n return goog.dom.forms.getValue(els);\n } else {\n for (var i = 0; i < els.length; i++) {\n var val = goog.dom.forms.getValue(els[i]);\n if (val) {\n return val;\n }\n }\n return null;\n }\n};\ngoog.dom.forms.getInputChecked_ = function(el) {\n return el.checked ? el.value : null;\n};\ngoog.dom.forms.getSelectSingle_ = function(el) {\n var selectedIndex = el.selectedIndex;\n return selectedIndex >= 0 ? el.options[selectedIndex].value : null;\n};\ngoog.dom.forms.getSelectMultiple_ = function(el) {\n var values = [];\n for (var option, i = 0; option = el.options[i]; i++) {\n if (option.selected) {\n values.push(option.value);\n }\n }\n return values.length ? values : null;\n};\ngoog.dom.forms.setValue = function(el, opt_value) {\n var type = el.type;\n switch(typeof type === \"string\" && type.toLowerCase()) {\n case goog.dom.InputType.CHECKBOX:\n case goog.dom.InputType.RADIO:\n goog.dom.forms.setInputChecked_(el, opt_value);\n return;\n case goog.dom.InputType.SELECT_ONE:\n goog.dom.forms.setSelectSingle_(el, opt_value);\n return;\n case goog.dom.InputType.SELECT_MULTIPLE:\n goog.dom.forms.setSelectMultiple_(el, opt_value);\n return;\n default:\n el.value = opt_value != null ? opt_value : \"\";\n }\n};\ngoog.dom.forms.setInputChecked_ = function(el, opt_value) {\n el.checked = opt_value;\n};\ngoog.dom.forms.setSelectSingle_ = function(el, opt_value) {\n el.selectedIndex = -1;\n if (typeof opt_value === \"string\") {\n for (var option, i = 0; option = el.options[i]; i++) {\n if (option.value == opt_value) {\n option.selected = true;\n break;\n }\n }\n }\n};\ngoog.dom.forms.setSelectMultiple_ = function(el, opt_value) {\n if (typeof opt_value === \"string\") {\n opt_value = [opt_value];\n }\n for (var option, i = 0; option = el.options[i]; i++) {\n option.selected = false;\n if (opt_value) {\n for (var value, j = 0; value = opt_value[j]; j++) {\n if (option.value == value) {\n option.selected = true;\n }\n }\n }\n }\n};\n","~:source","/**\n * @license\n * Copyright The Closure Library Authors.\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * @fileoverview Utilities for manipulating a form and elements.\n *\n * @suppress {strictMissingProperties}\n */\n\ngoog.provide('goog.dom.forms');\n\ngoog.require('goog.dom.InputType');\ngoog.require('goog.dom.TagName');\ngoog.require('goog.dom.safe');\ngoog.require('goog.structs.Map');\ngoog.require('goog.window');\n\n\n/**\n * Submits form data via a new window. This hides references to the parent\n * window and should be used when submitting forms to untrusted 3rd party urls.\n * By default, this uses the action and method of the specified form\n * element. It is possible to override the default action and method if an\n * optional submit element with formaction and/or formmethod attributes is\n * provided.\n * @param {!HTMLFormElement} form The form.\n * @param {!HTMLElement=} opt_submitElement The `<button>` or `<input>` element\n * used to submit the form. The element should have a submit type.\n * @return {boolean} true If the form was submitted succesfully.\n * @throws {!Error} If opt_submitElement is not a valid form submit element.\n */\ngoog.dom.forms.submitFormInNewWindow = function(form, opt_submitElement) {\n 'use strict';\n var formData = goog.dom.forms.getFormDataMap(form);\n var action = form.action;\n var method = form.method;\n\n if (opt_submitElement) {\n if (goog.dom.InputType.SUBMIT != opt_submitElement.type.toLowerCase()) {\n throw new Error('opt_submitElement does not have a valid type.');\n }\n\n\n var submitValue =\n /** @type {?string} */ (goog.dom.forms.getValue(opt_submitElement));\n if (submitValue != null) {\n goog.dom.forms.addFormDataToMap_(\n formData, opt_submitElement.name, submitValue);\n }\n\n if (opt_submitElement.getAttribute('formaction')) {\n action = opt_submitElement.getAttribute('formaction');\n }\n\n if (opt_submitElement.getAttribute('formmethod')) {\n method = opt_submitElement.getAttribute('formmethod');\n }\n }\n\n return goog.dom.forms.submitFormDataInNewWindow(action, method, formData);\n};\n\n/**\n * Submits form data via a new window. This hides references to the parent\n * window and should be used when submitting forms to untrusted 3rd party urls.\n * @param {string} actionUri uri to submit form content to.\n * @param {string} method HTTP method used to submit the form.\n * @param {!goog.structs.Map<string, !Array<string>>} formData A map of the form\n * data as field name to arrays of values.\n * @return {boolean} true If the form was submitted succesfully.\n */\ngoog.dom.forms.submitFormDataInNewWindow = function(\n actionUri, method, formData) {\n 'use strict';\n var newWin = goog.window.openBlank('', {noreferrer: true});\n\n // This could be null if a new window could not be opened. e.g. if it was\n // stopped by a popup blocker.\n if (!newWin) {\n return false;\n }\n\n var newDocument = newWin.document;\n\n var newForm =\n /** @type {!HTMLFormElement} */ (newDocument.createElement('form'));\n newForm.method = method;\n goog.dom.safe.setFormElementAction(newForm, actionUri);\n\n // After this point, do not directly reference the form object's functions as\n // field names can shadow the form's properties.\n\n formData.forEach(function(fieldValues, fieldName) {\n 'use strict';\n for (var i = 0; i < fieldValues.length; i++) {\n var fieldValue = fieldValues[i];\n var newInput = newDocument.createElement('input');\n newInput.name = fieldName;\n newInput.value = fieldValue;\n newInput.type = 'hidden';\n HTMLFormElement.prototype.appendChild.call(newForm, newInput);\n }\n });\n\n HTMLFormElement.prototype.submit.call(newForm);\n return true;\n};\n\n\n/**\n * Returns form data as a map of name to value arrays. This doesn't\n * support file inputs.\n * @param {HTMLFormElement} form The form.\n * @return {!goog.structs.Map<string, !Array<string>>} A map of the form data\n * as field name to arrays of values.\n */\ngoog.dom.forms.getFormDataMap = function(form) {\n 'use strict';\n var map = new goog.structs.Map();\n goog.dom.forms.getFormDataHelper_(\n form, map, goog.dom.forms.addFormDataToMap_);\n return map;\n};\n\n\n/**\n * Returns the form data as an application/x-www-url-encoded string. This\n * doesn't support file inputs.\n * @param {HTMLFormElement} form The form.\n * @return {string} An application/x-www-url-encoded string.\n */\ngoog.dom.forms.getFormDataString = function(form) {\n 'use strict';\n var sb = [];\n goog.dom.forms.getFormDataHelper_(\n form, sb, goog.dom.forms.addFormDataToStringBuffer_);\n return sb.join('&');\n};\n\n\n/**\n * Returns the form data as a map or an application/x-www-url-encoded\n * string. This doesn't support file inputs.\n * @param {HTMLFormElement} form The form.\n * @param {Object} result The object form data is being put in.\n * @param {Function} fnAppend Function that takes `result`, an element\n * name, and an element value, and adds the name/value pair to the result\n * object.\n * @private\n */\ngoog.dom.forms.getFormDataHelper_ = function(form, result, fnAppend) {\n 'use strict';\n var els = form.elements;\n for (var el, i = 0; el = els.item(i); i++) {\n if ( // Make sure we don't include elements that are not part of the form.\n // Some browsers include non-form elements. Check for 'form' property.\n // See http://code.google.com/p/closure-library/issues/detail?id=227\n // and\n // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#the-input-element\n (el.form != form) || el.disabled ||\n // HTMLFieldSetElement has a form property but no value.\n el.tagName == goog.dom.TagName.FIELDSET) {\n continue;\n }\n\n var name = el.name;\n switch (el.type.toLowerCase()) {\n case goog.dom.InputType.FILE:\n // file inputs are not supported\n case goog.dom.InputType.SUBMIT:\n case goog.dom.InputType.RESET:\n case goog.dom.InputType.BUTTON:\n // don't submit these\n break;\n case goog.dom.InputType.SELECT_MULTIPLE:\n var values = goog.dom.forms.getValue(el);\n if (values != null) {\n for (var value, j = 0; value = values[j]; j++) {\n fnAppend(result, name, value);\n }\n }\n break;\n default:\n var value = goog.dom.forms.getValue(el);\n if (value != null) {\n fnAppend(result, name, value);\n }\n }\n }\n\n // input[type=image] are not included in the elements collection\n var inputs = form.getElementsByTagName(String(goog.dom.TagName.INPUT));\n for (var input, i = 0; input = inputs[i]; i++) {\n if (input.form == form &&\n input.type.toLowerCase() == goog.dom.InputType.IMAGE) {\n name = input.name;\n fnAppend(result, name, input.value);\n fnAppend(result, name + '.x', '0');\n fnAppend(result, name + '.y', '0');\n }\n }\n};\n\n\n/**\n * Adds the name/value pair to the map.\n * @param {!goog.structs.Map<string, !Array<string>>} map The map to add to.\n * @param {string} name The name.\n * @param {string} value The value.\n * @private\n */\ngoog.dom.forms.addFormDataToMap_ = function(map, name, value) {\n 'use strict';\n var array = map.get(name);\n if (!array) {\n array = [];\n map.set(name, array);\n }\n array.push(value);\n};\n\n\n/**\n * Adds a name/value pair to an string buffer array in the form 'name=value'.\n * @param {Array<string>} sb The string buffer array for storing data.\n * @param {string} name The name.\n * @param {string} value The value.\n * @private\n */\ngoog.dom.forms.addFormDataToStringBuffer_ = function(sb, name, value) {\n 'use strict';\n sb.push(encodeURIComponent(name) + '=' + encodeURIComponent(value));\n};\n\n\n/**\n * Whether the form has a file input.\n * @param {HTMLFormElement} form The form.\n * @return {boolean} Whether the form has a file input.\n */\ngoog.dom.forms.hasFileInput = function(form) {\n 'use strict';\n var els = form.elements;\n for (var el, i = 0; el = els[i]; i++) {\n if (!el.disabled && el.type &&\n el.type.toLowerCase() == goog.dom.InputType.FILE) {\n return true;\n }\n }\n return false;\n};\n\n\n/**\n * Enables or disables either all elements in a form or a single form element.\n * @param {Element} el The element, either a form or an element within a form.\n * @param {boolean} disabled Whether the element should be disabled.\n */\ngoog.dom.forms.setDisabled = function(el, disabled) {\n 'use strict';\n // disable all elements in a form\n if (el.tagName == goog.dom.TagName.FORM) {\n var els = /** @type {!HTMLFormElement} */ (el).elements;\n for (var i = 0; el = els.item(i); i++) {\n goog.dom.forms.setDisabled(el, disabled);\n }\n } else {\n // makes sure to blur buttons, multi-selects, and any elements which\n // maintain keyboard/accessibility focus when disabled\n if (disabled == true) {\n el.blur();\n }\n el.disabled = disabled;\n }\n};\n\n\n/**\n * Focuses, and optionally selects the content of, a form element.\n * @param {Element} el The form element.\n */\ngoog.dom.forms.focusAndSelect = function(el) {\n 'use strict';\n el.focus();\n if (el.select) {\n el.select();\n }\n};\n\n\n/**\n * Whether a form element has a value.\n * @param {Element} el The element.\n * @return {boolean} Whether the form has a value.\n */\ngoog.dom.forms.hasValue = function(el) {\n 'use strict';\n var value = goog.dom.forms.getValue(el);\n return !!value;\n};\n\n\n/**\n * Whether a named form field has a value.\n * @param {HTMLFormElement} form The form element.\n * @param {string} name Name of an input to the form.\n * @return {boolean} Whether the form has a value.\n */\ngoog.dom.forms.hasValueByName = function(form, name) {\n 'use strict';\n var value = goog.dom.forms.getValueByName(form, name);\n return !!value;\n};\n\n\n/**\n * Gets the current value of any element with a type.\n * @param {null|!Element|!RadioNodeList<?>} input The element.\n * @return {string|Array<string>|null} The current value of the element\n * (or null).\n */\ngoog.dom.forms.getValue = function(input) {\n 'use strict';\n // Elements with a type may need more specialized logic.\n var type = /** {{type: (string|undefined)}} */ (input).type;\n\n if (typeof type === 'string') {\n var el = /** @type {!Element} */ (input);\n\n switch (type.toLowerCase()) {\n case goog.dom.InputType.CHECKBOX:\n case goog.dom.InputType.RADIO:\n return goog.dom.forms.getInputChecked_(el);\n case goog.dom.InputType.SELECT_ONE:\n return goog.dom.forms.getSelectSingle_(el);\n case goog.dom.InputType.SELECT_MULTIPLE:\n return goog.dom.forms.getSelectMultiple_(el);\n default:\n // Not every element with a value has a type (e.g. meter and progress).\n }\n }\n\n // Coerce `undefined` to `null`.\n return input.value != null ? input.value : null;\n};\n\n\n/**\n * Returns the value of the named form field. In the case of radio buttons,\n * returns the value of the checked button with the given name.\n *\n * @param {HTMLFormElement} form The form element.\n * @param {string} name Name of an input to the form.\n *\n * @return {Array<string>|string|null} The value of the form element, or\n * null if the form element does not exist or has no value.\n */\ngoog.dom.forms.getValueByName = function(form, name) {\n 'use strict';\n var els = form.elements[name];\n\n if (!els) {\n return null;\n } else if (els.type) {\n return goog.dom.forms.getValue(/** @type {!Element} */ (els));\n } else {\n for (var i = 0; i < els.length; i++) {\n var val = goog.dom.forms.getValue(els[i]);\n if (val) {\n return val;\n }\n }\n return null;\n }\n};\n\n\n/**\n * Gets the current value of a checkable input element.\n * @param {Element} el The element.\n * @return {?string} The value of the form element (or null).\n * @private\n */\ngoog.dom.forms.getInputChecked_ = function(el) {\n 'use strict';\n return el.checked ? /** @type {?} */ (el).value : null;\n};\n\n\n/**\n * Gets the current value of a select-one element.\n * @param {Element} el The element.\n * @return {?string} The value of the form element (or null).\n * @private\n */\ngoog.dom.forms.getSelectSingle_ = function(el) {\n 'use strict';\n var selectedIndex = /** @type {!HTMLSelectElement} */ (el).selectedIndex;\n return selectedIndex >= 0 ?\n /** @type {!HTMLSelectElement} */ (el).options[selectedIndex].value :\n null;\n};\n\n\n/**\n * Gets the current value of a select-multiple element.\n * @param {Element} el The element.\n * @return {Array<string>?} The value of the form element (or null).\n * @private\n */\ngoog.dom.forms.getSelectMultiple_ = function(el) {\n 'use strict';\n var values = [];\n for (var option, i = 0;\n option = /** @type {!HTMLSelectElement} */ (el).options[i]; i++) {\n if (option.selected) {\n values.push(option.value);\n }\n }\n return values.length ? values : null;\n};\n\n\n/**\n * Sets the current value of any element with a type.\n * @param {Element} el The element.\n * @param {*=} opt_value The value to give to the element, which will be coerced\n * by the browser in the default case using toString. This value should be\n * an array for setting the value of select multiple elements.\n */\ngoog.dom.forms.setValue = function(el, opt_value) {\n 'use strict';\n // Elements with a type may need more specialized logic.\n var type = /** @type {!HTMLInputElement} */ (el).type;\n switch (typeof type === 'string' && type.toLowerCase()) {\n case goog.dom.InputType.CHECKBOX:\n case goog.dom.InputType.RADIO:\n goog.dom.forms.setInputChecked_(\n el,\n /** @type {string} */ (opt_value));\n return;\n case goog.dom.InputType.SELECT_ONE:\n goog.dom.forms.setSelectSingle_(\n el,\n /** @type {string} */ (opt_value));\n return;\n case goog.dom.InputType.SELECT_MULTIPLE:\n goog.dom.forms.setSelectMultiple_(\n el,\n /** @type {!Array<string>} */ (opt_value));\n return;\n default:\n // Not every element with a value has a type (e.g. meter and progress).\n el.value = opt_value != null ? opt_value : '';\n }\n};\n\n\n/**\n * Sets a checkable input element's checked property.\n * #TODO(user): This seems potentially unintuitive since it doesn't set\n * the value property but my hunch is that the primary use case is to check a\n * checkbox, not to reset its value property.\n * @param {Element} el The element.\n * @param {string|boolean=} opt_value The value, sets the element checked if\n * val is set.\n * @private\n */\ngoog.dom.forms.setInputChecked_ = function(el, opt_value) {\n 'use strict';\n el.checked = opt_value;\n};\n\n\n/**\n * Sets the value of a select-one element.\n * @param {Element} el The element.\n * @param {string=} opt_value The value of the selected option element.\n * @private\n */\ngoog.dom.forms.setSelectSingle_ = function(el, opt_value) {\n 'use strict';\n // unset any prior selections\n el.selectedIndex = -1;\n if (typeof opt_value === 'string') {\n for (var option, i = 0;\n option = /** @type {!HTMLSelectElement} */ (el).options[i]; i++) {\n if (option.value == opt_value) {\n option.selected = true;\n break;\n }\n }\n }\n};\n\n\n/**\n * Sets the value of a select-multiple element.\n * @param {Element} el The element.\n * @param {Array<string>|string=} opt_value The value of the selected option\n * element(s).\n * @private\n */\ngoog.dom.forms.setSelectMultiple_ = function(el, opt_value) {\n 'use strict';\n // reset string opt_values as an array\n if (typeof opt_value === 'string') {\n opt_value = [opt_value];\n }\n for (var option, i = 0;\n option = /** @type {!HTMLSelectElement} */ (el).options[i]; i++) {\n // we have to reset the other options to false for select-multiple\n option.selected = false;\n if (opt_value) {\n for (var value, j = 0; value = opt_value[j]; j++) {\n if (option.value == value) {\n option.selected = true;\n }\n }\n }\n }\n};\n","~:compiled-at",1684858198041,"~:source-map-json","{\n\"version\":3,\n\"file\":\"goog.dom.forms.js\",\n\"lineCount\":240,\n\"mappings\":\"AAYAA,IAAKC,CAAAA,OAAL,CAAa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A,EADjE,CACsE;AAEpEgF,UAAOC,CAAAA,QAAP,GAAkB,KAAlB;AACA,QAAIG,SAAJ;AACE,WAAK,IAAIhF,KAAJ,EAAWgC,IAAI,CAApB,EAAuBhC,KAAvB,GAA+BgF,SAAA,CAAUhD,CAAV,CAA/B,EAA6CA,CAAA,EAA7C;AACE,YAAI4C,MAAO5E,CAAAA,KAAX,IAAoBA,KAApB;AACE4E,gBAAOC,CAAAA,QAAP,GAAkB,IAAlB;AADF;AADF;AADF;AAHoE;AAPZ,CAA5D;;\",\n\"sources\":[\"goog/dom/forms.js\"],\n\"sourcesContent\":[\"/**\\n * @license\\n * Copyright The Closure Library Authors.\\n * SPDX-License-Identifier: Apache-2.0\\n */\\n\\n/**\\n * @fileoverview Utilities for manipulating a form and elements.\\n *\\n * @suppress {strictMissingProperties}\\n */\\n\\ngoog.provide('goog.dom.forms');\\n\\ngoog.require('goog.dom.InputType');\\ngoog.require('goog.dom.TagName');\\ngoog.require('goog.dom.safe');\\ngoog.require('goog.structs.Map');\\ngoog.require('goog.window');\\n\\n\\n/**\\n * Submits form data via a new window. This hides references to the parent\\n * window and should be used when submitting forms to untrusted 3rd party urls.\\n * By default, this uses the action and method of the specified form\\n * element. It is possible to override the default action and method if an\\n * optional submit element with formaction and/or formmethod attributes is\\n * provided.\\n * @param {!HTMLFormElement} form The form.\\n * @param {!HTMLElement=} opt_submitElement The `<button>` or `<input>` element\\n * used to submit the form. The element should have a submit type.\\n * @return {boolean} true If the form was submitted succesfully.\\n * @throws {!Error} If opt_submitElement is not a valid form submit element.\\n */\\ngoog.dom.forms.submitFormInNewWindow = function(form, opt_submitElement) {\\n 'use strict';\\n var formData = goog.dom.forms.getFormDataMap(form);\\n var action = form.action;\\n var method = form.method;\\n\\n if (opt_submitElement) {\\n if (goog.dom.InputType.SUBMIT != opt_submitElement.type.toLowerCase()) {\\n throw new Error('opt_submitElement does not have a valid type.');\\n }\\n\\n\\n var submitValue =\\n /** @type {?string} */ (goog.dom.forms.getValue(opt_submitElement));\\n if (submitValue != null) {\\n goog.dom.forms.addFormDataToMap_(\\n formData, opt_submitElement.name, submitValue);\\n }\\n\\n if (opt_submitElement.getAttribute('formaction')) {\\n action = opt_submitElement.getAttribute('formaction');\\n }\\n\\n if (opt_submitElement.getAttribute('formmethod')) {\\n method = opt_submitElement.getAttribute('formmethod');\\n }\\n }\\n\\n return goog.dom.forms.submitFormDataInNewWindow(action, method, formData);\\n};\\n\\n/**\\n * Submits form data via a new window. This hides references to the parent\\n * window and should be used when submitting forms to untrusted 3rd party urls.\\n * @param {string} actionUri uri to submit form content to.\\n * @param {string} method HTTP method used to submit the form.\\n * @param {!goog.structs.Map<string, !Array<string>>} formData A map of the form\\n * data as field name to arrays of values.\\n * @return {boolean} true If the form was submitted succesfully.\\n */\\ngoog.dom.forms.submitFormDataInNewWindow = function(\\n actionUri, method, formData) {\\n 'use strict';\\n var newWin = goog.window.openBlank('', {noreferrer: true});\\n\\n // This could be null if a new window could not be opened. e.g. if it was\\n // stopped by a popup blocker.\\n if (!newWin) {\\n return false;\\n }\\n\\n var newDocument = newWin.document;\\n\\n var newForm =\\n /** @type {!HTMLFormElement} */ (newDocument.createElement('form'));\\n newForm.method = method;\\n goog.dom.safe.setFormElementAction(newForm, actionUri);\\n\\n // After this point, do not directly reference the form object's functions as\\n // field names can shadow the form's properties.\\n\\n formData.forEach(function(fieldValues, fieldName) {\\n 'use strict';\\n for (var i = 0; i < fieldValues.length; i++) {\\n var fieldValue = fieldValues[i];\\n var newInput = newDocument.createElement('input');\\n newInput.name = fieldName;\\n newInput.value = fieldValue;\\n newInput.type = 'hidden';\\n HTMLFormElement.prototype.appendChild.call(newForm, newInput);\\n }\\n });\\n\\n HTMLFormElement.prototype.submit.call(newForm);\\n return true;\\n};\\n\\n\\n/**\\n * Returns form data as a map of name to value arrays. This doesn't\\n * support file inputs.\\n * @param {HTMLFormElement} form The form.\\n * @return {!goog.structs.Map<string, !Array<string>>} A map of the form data\\n * as field name to arrays of values.\\n */\\ngoog.dom.forms.getFormDataMap = function(form) {\\n 'use strict';\\n var map = new goog.structs.Map();\\n goog.dom.forms.getFormDataHelper_(\\n form, map, goog.dom.forms.addFormDataToMap_);\\n return map;\\n};\\n\\n\\n/**\\n * Returns the form data as an application/x-www-url-encoded string. This\\n * doesn't support file inputs.\\n * @param {HTMLFormElement} form The form.\\n * @return {string} An application/x-www-url-encoded string.\\n */\\ngoog.dom.forms.getFormDataString = function(form) {\\n 'use strict';\\n var sb = [];\\n goog.dom.forms.getFormDataHelper_(\\n form, sb, goog.dom.forms.addFormDataToStringBuffer_);\\n return sb.join('&');\\n};\\n\\n\\n/**\\n * Returns the form data as a map or an application/x-www-url-encoded\\n * string. This doesn't support file inputs.\\n * @param {HTMLFormElement} form The form.\\n * @param {Object} result The object form data is being put in.\\n * @param {Function} fnAppend Function that takes `result`, an element\\n * name, and an element value, and adds the name/value pair to the result\\n * object.\\n * @private\\n */\\ngoog.dom.forms.getFormDataHelper_ = function(form, result, fnAppend) {\\n 'use strict';\\n var els = form.elements;\\n for (var el, i = 0; el = els.item(i); i++) {\\n if ( // Make sure we don't include elements that are not part of the form.\\n // Some browsers include non-form elements. Check for 'form' property.\\n // See http://code.google.com/p/closure-library/issues/detail?id=227\\n // and\\n // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#the-input-element\\n (el.form != form) || el.disabled ||\\n // HTMLFieldSetElement has a form property but no value.\\n el.tagName == goog.dom.TagName.FIELDSET) {\\n continue;\\n }\\n\\n var name = el.name;\\n switch (el.type.toLowerCase()) {\\n case goog.dom.InputType.FILE:\\n // file inputs are not supported\\n case goog.dom.InputType.SUBMIT:\\n case goog.dom.InputType.RESET:\\n case goog.dom.InputType.BUTTON:\\n // don't submit these\\n break;\\n case goog.dom.InputType.SELECT_MULTIPLE:\\n var values = goog.dom.forms.getValue(el);\\n if (values != null) {\\n for (var value, j = 0; value = values[j]; j++) {\\n fnAppend(result, name, value);\\n }\\n }\\n break;\\n default:\\n var value = goog.dom.forms.getValue(el);\\n if (value != null) {\\n fnAppend(result, name, value);\\n }\\n }\\n }\\n\\n // input[type=image] are not included in the elements collection\\n var inputs = form.getElementsByTagName(String(goog.dom.TagName.INPUT));\\n for (var input, i = 0; input = inputs[i]; i++) {\\n if (input.form == form &&\\n input.type.toLowerCase() == goog.dom.InputType.IMAGE) {\\n name = input.name;\\n fnAppend(result, name, input.value);\\n fnAppend(result, name + '.x', '0');\\n fnAppend(result, name + '.y', '0');\\n }\\n }\\n};\\n\\n\\n/**\\n * Adds the name/value pair to the map.\\n * @param {!goog.structs.Map<string, !Array<string>>} map The map to add to.\\n * @param {string} name The name.\\n * @param {string} value The value.\\n * @private\\n */\\ngoog.dom.forms.addFormDataToMap_ = function(map, name, value) {\\n 'use strict';\\n var array = map.get(name);\\n if (!array) {\\n array = [];\\n map.set(name, array);\\n }\\n array.push(value);\\n};\\n\\n\\n/**\\n * Adds a name/value pair to an string buffer array in the form 'name=value'.\\n * @param {Array<string>} sb The string buffer array for storing data.\\n * @param {string} name The name.\\n * @param {string} value The value.\\n * @private\\n */\\ngoog.dom.forms.addFormDataToStringBuffer_ = function(sb, name, value) {\\n 'use strict';\\n sb.push(encodeURIComponent(name) + '=' + encodeURIComponent(value));\\n};\\n\\n\\n/**\\n * Whether the form has a file input.\\n * @param {HTMLFormElement} form The form.\\n * @return {boolean} Whether the form has a file input.\\n */\\ngoog.dom.forms.hasFileInput = function(form) {\\n 'use strict';\\n var els = form.elements;\\n for (var el, i = 0; el = els[i]; i++) {\\n if (!el.disabled && el.type &&\\n el.type.toLowerCase() == goog.dom.InputType.FILE) {\\n return true;\\n }\\n }\\n return false;\\n};\\n\\n\\n/**\\n * Enables or disables either all elements in a form or a single form element.\\n * @param {Element} el The element, either a form or an element within a form.\\n * @param {boolean} disabled Whether the element should be disabled.\\n */\\ngoog.dom.forms.setDisabled = function(el, disabled) {\\n 'use strict';\\n // disable all elements in a form\\n if (el.tagName == goog.dom.TagName.FORM) {\\n var els = /** @type {!HTMLFormElement} */ (el).elements;\\n for (var i = 0; el = els.item(i); i++) {\\n goog.dom.forms.setDisabled(el, disabled);\\n }\\n } else {\\n // makes sure to blur buttons, multi-selects, and any elements which\\n // maintain keyboard/accessibility focus when disabled\\n if (disabled == true) {\\n el.blur();\\n }\\n el.disabled = disabled;\\n }\\n};\\n\\n\\n/**\\n * Focuses, and optionally selects the content of, a form element.\\n * @param {Element} el The form element.\\n */\\ngoog.dom.forms.focusAndSelect = function(el) {\\n 'use strict';\\n el.focus();\\n if (el.select) {\\n el.select();\\n }\\n};\\n\\n\\n/**\\n * Whether a form element has a value.\\n * @param {Element} el The element.\\n * @return {boolean} Whether the form has a value.\\n */\\ngoog.dom.forms.hasValue = function(el) {\\n 'use strict';\\n var value = goog.dom.forms.getValue(el);\\n return !!value;\\n};\\n\\n\\n/**\\n * Whether a named form field has a value.\\n * @param {HTMLFormElement} form The form element.\\n * @param {string} name Name of an input to the form.\\n * @return {boolean} Whether the form has a value.\\n */\\ngoog.dom.forms.hasValueByName = function(form, name) {\\n 'use strict';\\n var value = goog.dom.forms.getValueByName(form, name);\\n return !!value;\\n};\\n\\n\\n/**\\n * Gets the current value of any element with a type.\\n * @param {null|!Element|!RadioNodeList<?>} input The element.\\n * @return {string|Array<string>|null} The current value of the element\\n * (or null).\\n */\\ngoog.dom.forms.getValue = function(input) {\\n 'use strict';\\n // Elements with a type may need more specialized logic.\\n var type = /** {{type: (string|undefined)}} */ (input).type;\\n\\n if (typeof type === 'string') {\\n var el = /** @type {!Element} */ (input);\\n\\n switch (type.toLowerCase()) {\\n case goog.dom.InputType.CHECKBOX:\\n case goog.dom.InputType.RADIO:\\n return goog.dom.forms.getInputChecked_(el);\\n case goog.dom.InputType.SELECT_ONE:\\n return goog.dom.forms.getSelectSingle_(el);\\n case goog.dom.InputType.SELECT_MULTIPLE:\\n return goog.dom.forms.getSelectMultiple_(el);\\n default:\\n // Not every element with a value has a type (e.g. meter and progress).\\n }\\n }\\n\\n // Coerce `undefined` to `null`.\\n return input.value != null ? input.value : null;\\n};\\n\\n\\n/**\\n * Returns the value of the named form field. In the case of radio buttons,\\n * returns the value of the checked button with the given name.\\n *\\n * @param {HTMLFormElement} form The form element.\\n * @param {string} name Name of an input to the form.\\n *\\n * @return {Array<string>|string|null} The value of the form element, or\\n * null if the form element does not exist or has no value.\\n */\\ngoog.dom.forms.getValueByName = function(form, name) {\\n 'use strict';\\n var els = form.elements[name];\\n\\n if (!els) {\\n return null;\\n } else if (els.type) {\\n return goog.dom.forms.getValue(/** @type {!Element} */ (els));\\n } else {\\n for (var i = 0; i < els.length; i++) {\\n var val = goog.dom.forms.getValue(els[i]);\\n if (val) {\\n return val;\\n }\\n }\\n return null;\\n }\\n};\\n\\n\\n/**\\n * Gets the current value of a checkable input element.\\n * @param {Element} el The element.\\n * @return {?string} The value of the form element (or null).\\n * @private\\n */\\ngoog.dom.forms.getInputChecked_ = function(el) {\\n 'use strict';\\n return el.checked ? /** @type {?} */ (el).value : null;\\n};\\n\\n\\n/**\\n * Gets the current value of a select-one element.\\n * @param {Element} el The element.\\n * @return {?string} The value of the form element (or null).\\n * @private\\n */\\ngoog.dom.forms.getSelectSingle_ = function(el) {\\n 'use strict';\\n var selectedIndex = /** @type {!HTMLSelectElement} */ (el).selectedIndex;\\n return selectedIndex >= 0 ?\\n /** @type {!HTMLSelectElement} */ (el).options[selectedIndex].value :\\n null;\\n};\\n\\n\\n/**\\n * Gets the current value of a select-multiple element.\\n * @param {Element} el The element.\\n * @return {Array<string>?} The value of the form element (or null).\\n * @private\\n */\\ngoog.dom.forms.getSelectMultiple_ = function(el) {\\n 'use strict';\\n var values = [];\\n for (var option, i = 0;\\n option = /** @type {!HTMLSelectElement} */ (el).options[i]; i++) {\\n if (option.selected) {\\n values.push(option.value);\\n }\\n }\\n return values.length ? values : null;\\n};\\n\\n\\n/**\\n * Sets the current value of any element with a type.\\n * @param {Element} el The element.\\n * @param {*=} opt_value The value to give to the element, which will be coerced\\n * by the browser in the default case using toString. This value should be\\n * an array for setting the value of select multiple elements.\\n */\\ngoog.dom.forms.setValue = function(el, opt_value) {\\n 'use strict';\\n // Elements with a type may need more specialized logic.\\n var type = /** @type {!HTMLInputElement} */ (el).type;\\n switch (typeof type === 'string' && type.toLowerCase()) {\\n case goog.dom.InputType.CHECKBOX:\\n case goog.dom.InputType.RADIO:\\n goog.dom.forms.setInputChecked_(\\n el,\\n /** @type {string} */ (opt_value));\\n return;\\n case goog.dom.InputType.SELECT_ONE:\\n goog.dom.forms.setSelectSingle_(\\n el,\\n /** @type {string} */ (opt_value));\\n return;\\n case goog.dom.InputType.SELECT_MULTIPLE:\\n goog.dom.forms.setSelectMultiple_(\\n el,\\n /** @type {!Array<string>} */ (opt_value));\\n return;\\n default:\\n // Not every element with a value has a type (e.g. meter and progress).\\n el.value = opt_value != null ? opt_value : '';\\n }\\n};\\n\\n\\n/**\\n * Sets a checkable input element's checked property.\\n * #TODO(user): This seems potentially unintuitive since it doesn't set\\n * the value property but my hunch is that the primary use case is to check a\\n * checkbox, not to reset its value property.\\n * @param {Element} el The element.\\n * @param {string|boolean=} opt_value The value, sets the element checked if\\n * val is set.\\n * @private\\n */\\ngoog.dom.forms.setInputChecked_ = function(el, opt_value) {\\n 'use strict';\\n el.checked = opt_value;\\n};\\n\\n\\n/**\\n * Sets the value of a select-one element.\\n * @param {Element} el The element.\\n * @param {string=} opt_value The value of the selected option element.\\n * @private\\n */\\ngoog.dom.forms.setSelectSingle_ = function(el, opt_value) {\\n 'use strict';\\n // unset any prior selections\\n el.selectedIndex = -1;\\n if (typeof opt_value === 'string') {\\n for (var option, i = 0;\\n option = /** @type {!HTMLSelectElement} */ (el).options[i]; i++) {\\n if (option.value == opt_value) {\\n option.selected = true;\\n break;\\n }\\n }\\n }\\n};\\n\\n\\n/**\\n * Sets the value of a select-multiple element.\\n * @param {Element} el The element.\\n * @param {Array<string>|string=} opt_value The value of the selected option\\n * element(s).\\n * @private\\n */\\ngoog.dom.forms.setSelectMultiple_ = function(el, opt_value) {\\n 'use strict';\\n // reset string opt_values as an array\\n if (typeof opt_value === 'string') {\\n opt_value = [opt_value];\\n }\\n for (var option, i = 0;\\n option = /** @type {!HTMLSelectElement} */ (el).options[i]; i++) {\\n // we have to reset the other options to false for select-multiple\\n option.selected = false;\\n if (opt_value) {\\n for (var value, j = 0; value = opt_value[j]; j++) {\\n if (option.value == value) {\\n option.selected = true;\\n }\\n }\\n }\\n }\\n};\\n\"],\n\"names\":[\"goog\",\"provide\",\"require\",\"dom\",\"forms\",\"submitFormInNewWindow\",\"goog.dom.forms.submitFormInNewWindow\",\"form\",\"opt_submitElement\",\"formData\",\"getFormDataMap\",\"action\",\"method\",\"InputType\",\"SUBMIT\",\"type\",\"toLowerCase\",\"Error\",\"submitValue\",\"getValue\",\"addFormDataToMap_\",\"name\",\"getAttribute\",\"submitFormDataInNewWindow\",\"goog.dom.forms.submitFormDataInNewWindow\",\"actionUri\",\"newWin\",\"window\",\"openBlank\",\"noreferrer\",\"newDocument\",\"document\",\"newForm\",\"createElement\",\"safe\",\"setFormElementAction\",\"forEach\",\"fieldValues\",\"fieldName\",\"i\",\"length\",\"fieldValue\",\"newInput\",\"value\",\"HTMLFormElement\",\"prototype\",\"appendChild\",\"call\",\"submit\",\"goog.dom.forms.getFormDataMap\",\"map\",\"structs\",\"Map\",\"getFormDataHelper_\",\"getFormDataString\",\"goog.dom.forms.getFormDataString\",\"sb\",\"addFormDataToStringBuffer_\",\"join\",\"goog.dom.forms.getFormDataHelper_\",\"result\",\"fnAppend\",\"els\",\"elements\",\"el\",\"item\",\"disabled\",\"tagName\",\"TagName\",\"FIELDSET\",\"FILE\",\"RESET\",\"BUTTON\",\"SELECT_MULTIPLE\",\"values\",\"j\",\"inputs\",\"getElementsByTagName\",\"String\",\"INPUT\",\"input\",\"IMAGE\",\"goog.dom.forms.addFormDataToMap_\",\"array\",\"get\",\"set\",\"push\",\"goog.dom.forms.addFormDataToStringBuffer_\",\"encodeURIComponent\",\"hasFileInput\",\"goog.dom.forms.hasFileInput\",\"setDisabled\",\"goog.dom.forms.setDisabled\",\"FORM\",\"blur\",\"focusAndSelect\",\"goog.dom.forms.focusAndSelect\",\"focus\",\"select\",\"hasValue\",\"goog.dom.forms.hasValue\",\"hasValueByName\",\"goog.dom.forms.hasValueByName\",\"getValueByName\",\"goog.dom.forms.getValue\",\"CHECKBOX\",\"RADIO\",\"getInputChecked_\",\"SELECT_ONE\",\"getSelectSingle_\",\"getSelectMultiple_\",\"goog.dom.forms.getValueByName\",\"val\",\"goog.dom.forms.getInputChecked_\",\"checked\",\"goog.dom.forms.getSelectSingle_\",\"selectedIndex\",\"options\",\"goog.dom.forms.getSelectMultiple_\",\"option\",\"selected\",\"setValue\",\"goog.dom.forms.setValue\",\"opt_value\",\"setInputChecked_\",\"setSelectSingle_\",\"setSelectMultiple_\",\"goog.dom.forms.setInputChecked_\",\"goog.dom.forms.setSelectSingle_\",\"goog.dom.forms.setSelectMultiple_\"]\n}\n"]