PageSourceSearch

https://shop.duden.de/theme/a9dd922003eb7771b776d292d2b01149/js/va…niserv.custom-form-handler-plugin.8020fd.js

js duden.de collected 2026-09-24 07:56:17 UTC 11,850 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[37592],{857:t=>{var e=function(t){var e;return!!t&&"object"==typeof t&&"[object RegExp]"!==(e=Object.prototype.toString.call(t))&&"[object Date]"!==e&&t.$$typeof!==i},i="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function r(t,e){return!1!==e.clone&&e.isMergeableObject(t)?a(Array.isArray(t)?[]:{},t,e):t}function n(t,e,i){return t.concat(e).map(function(t){return r(t,i)})}function o(t){return Object.keys(t).concat(Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(t).filter(function(e){return Object.propertyIsEnumerable.call(t,e)}):[])}function s(t,e){try{return e in t}catch(t){return!1}}function a(t,i,l){(l=l||{}).arrayMerge=l.arrayMerge||n,l.isMergeableObject=l.isMergeableObject||e,l.cloneUnlessOtherwiseSpecified=r;var c,d,u=Array.isArray(i);return u!==Array.isArray(t)?r(i,l):u?l.arrayMerge(t,i,l):(d={},(c=l).isMergeableObject(t)&&o(t).forEach(function(e){d[e]=r(t[e],c)}),o(i).forEach(function(e){(!s(t,e)||Object.hasOwnProperty.call(t,e)&&Object.propertyIsEnumerable.call(t,e))&&(s(t,e)&&c.isMergeableObject(i[e])?d[e]=(function(t,e){if(!e.customMerge)return a;var i=e.customMerge(t);return"function"==typeof i?i:a})(e,c)(t[e],i[e],c):d[e]=r(i[e],c))}),d)}a.all=function(t,e){if(!Array.isArray(t))throw Error("first argument should be an array");return t.reduce(function(t,i){return a(t,i,e)},{})},t.exports=a},592:(t,e,i)=>{i.r(e),i.d(e,{default:()=>u});var r=i(293);class n{static debounce(t,e){let i,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return function(){for(var n=arguments.length,o=Array(n),s=0;s<n;s++)o[s]=arguments[s];r&&!i&&setTimeout(t.bind(t,...o),0),clearTimeout(i),i=setTimeout(t.bind(t,...o),e)}}}var o=i(266);let s="loader",a={BEFORE:"before",INNER:"inner"};class l{create(){if(!this.exists()){if(this.position===a.INNER){this.parent.innerHTML=l.getTemplate();return}this.parent.insertAdjacentHTML(this._getPosition(),l.getTemplate())}}remove(){let t=this.parent.querySelectorAll(".".concat(s));o.Z.iterate(t,t=>t.remove())}exists(){return this.parent.querySelectorAll(".".concat(s)).length>0}_getPosition(){return this.position===a.BEFORE?"afterbegin":"beforeend"}static getTemplate(){return'<div class="'.concat(s,'" role="status">\n                    <span class="').concat("visually-hidden",'">Loading...</span>\n                </div>')}static SELECTOR_CLASS(){return s}constructor(t,e=a.BEFORE){this.parent=t instanceof Element?t:document.body.querySelector(t),this.position=e}}class c extends l{create(){super.create(),this._isButtonElement()?this.parent.disabled=!0:this._isAnchorElement()&&this.parent.classList.add("disabled")}remove(){super.remove(),this._isButtonElement()?this.parent.disabled=!1:this._isAnchorElement()&&this.parent.classList.remove("disabled")}_isButtonElement(){return"button"===this.parent.tagName.toLowerCase()}_isAnchorElement(){return"a"===this.parent.tagName.toLowerCase()}constructor(t,e="before"){if(super(t,e),!this._isButtonElement()&&!this._isAnchorElement())throw Error("Parent element is not of type <button> or <a>")}}class d extends r.Z{init(){if(!1===this._isFormElement(this.el)){console.error("[FormHandler]: Element is not of type <form>",this.el);return}this.form=this.el,this.submitButtons=this._getSubmitButtons(),this.submittButtonLoaders=[],!0===this.options.validation&&this._initFormValidation(),this._initFormEvents()}set formFields(t){this._formFields=t}get formFields(){return this.options.formFieldSelector?this.form.querySelectorAll(this.options.formFieldSelector):[...this.form.elements]}_initFormEvents(){this.form.addEventListener("submit",this._onFormSubmit.bind(this)),this.form.addEventListener("removeLoader",this.removeLoadingIndicator.bind(this))}_initFormValidation(){window.formValidation.setNoValidate(this.form),this.form.checkValidity=this._checkValidity.bind(this),this._initFieldValidationEvents()}_initFieldValidationEvents(){this.formFields.forEach(t=>{this._initFieldValidation(t)})}_initFieldValidation(t){let e=t.tagName.toLowerCase();t.addEventListener("select"===e?"change":"input",n.debounce(window.formValidation.validateField.bind(window.formValidation,t),this.options.debounceTime))}_onFormSubmit(t){if(this.$emitter.publish("beforeSubmit"),!0===this.options.validateOnSubmit){let e=window.formValidation.validateForm(this.form,this.formFields);if(e.length>0){t.preventDefault(),this.$emitter.publish("validationFailed",{invalidFields:e}),!0===this.options.focusInvalidField&&(e[0].scrollIntoView({behavior:"smooth",block:"center"}),e[0].focus());return}}this.$emitter.publish("validSubmit"),!0===this.options.loadingIndicator&&this.addLoadingIndicator()}addLoadingIndicator(){this.submitButtons.forEach(t=>{let e=new c(t,this.options.loadingIndicatorPosition);this.submittButtonLoaders.push(e),e.create()})}
1removeLoadingIndicator(){this.submittButtonLoaders.forEach(t=>t.remove())}_checkValidity(){return 0===window.formValidation.validateForm(this.form,this.formFields).length}_getSubmitButtons(){let t=Array.from(this.form.querySelectorAll("button[type=submit]")),e=this.form.id;if(e){let i=Array.from(document.querySelectorAll('button[type=submit][form="'.concat(e,'"]')));t.push(...i)}return t}_isFormElement(t){return"form"===t.tagName.toLowerCase()}}d.options={validation:!0,validateOnSubmit:!0,focusInvalidField:!0,debounceTime:"200",formFieldSelector:"input, textarea, select",loadingIndicator:!0,loadingIndicatorPosition:"before"};class u extends d{_initFieldValidation(t){super._initFieldValidation(t);let e=t.tagName.toLowerCase(),i=t.dataset.validationLinkedId;if(i){let r=document.querySelector("#".concat(i));r&&r instanceof HTMLElement&&t.addEventListener("select"===e?"change":"input",n.debounce(window.formValidation.validateField.bind(window.formValidation,r),this.options.debounceTime))}}}},49:(t,e,i)=>{i.d(e,{Z:()=>n});var r=i(140);class n{static isNode(t){return"object"==typeof t&&null!==t&&(t===document||t===window||t instanceof Node)}static hasAttribute(t,e){if(!n.isNode(t))throw Error("The element must be a valid HTML Node!");return"function"==typeof t.hasAttribute&&t.hasAttribute(e)}static getAttribute(t,e){let i=!(arguments.length>2)||void 0===arguments[2]||arguments[2];if(i&&!1===n.hasAttribute(t,e))throw Error('The required property "'.concat(e,'" does not exist!'));if("function"!=typeof t.getAttribute){if(i)throw Error("This node doesn't support the getAttribute function!");return}return t.getAttribute(e)}static getDataAttribute(t,e){let i=!(arguments.length>2)||void 0===arguments[2]||arguments[2],o=e.replace(/^data(|-)/,""),s=r.Z.toLowerCamelCase(o,"-");if(!n.isNode(t)){if(i)throw Error("The passed node is not a valid HTML Node!");return}if(void 0===t.dataset){if(i)throw Error("This node doesn't support the dataset attribute!");return}let a=t.dataset[s];if(void 0===a){if(i)throw Error('The required data attribute "'.concat(e,'" does not exist on ').concat(t,"!"));return a}return r.Z.parsePrimitive(a)}static querySelector(t,e){let i=!(arguments.length>2)||void 0===arguments[2]||arguments[2];if(i&&!n.isNode(t))throw Error("The parent node is not a valid HTML Node!");let r=t.querySelector(e)||!1;if(i&&!1===r)throw Error('The required element "'.concat(e,'" does not exist in parent node!'));return r}static querySelectorAll(t,e){let i=!(arguments.length>2)||void 0===arguments[2]||arguments[2];if(i&&!n.isNode(t))throw Error("The parent node is not a valid HTML Node!");let r=t.querySelectorAll(e);if(0===r.length&&(r=!1),i&&!1===r)throw Error('At least one item of "'.concat(e,'" must exist in parent node!'));return r}static getFocusableElements(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document.body;return t.querySelectorAll('\n            input:not([tabindex^="-"]):not([disabled]):not([type="hidden"]),\n            select:not([tabindex^="-"]):not([disabled]),\n            textarea:not([tabindex^="-"]):not([disabled]),\n            button:not([tabindex^="-"]):not([disabled]),\n            a[href]:not([tabindex^="-"]):not([disabled]),\n            [tabindex]:not([tabindex^="-"]):not([disabled])\n        ')}static getFirstFocusableElement(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document.body;return this.getFocusableElements(t)[0]}static getLastFocusableElement(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document,e=this.getFocusableElements(t);return e[e.length-1]}}},266:(t,e,i)=>{i.d(e,{Z:()=>r});class r{static iterate(t,e){if(t instanceof Map||Array.isArray(t))return t.forEach(e);if(t instanceof FormData){for(var i of t.entries())e(i[1],i[0]);return}if(t instanceof NodeList)return t.forEach(e);if(t instanceof HTMLCollection)return Array.from(t).forEach(e);if(t instanceof Object)return Object.keys(t).forEach(i=>{e(t[i],i)});throw Error("The element type ".concat(typeof t," is not iterable!"))}}},140:(t,e,i)=>{i.d(e,{Z:()=>r});class r{static ucFirst(t){return t.charAt(0).toUpperCase()+t.slice(1)}static lcFirst(t){return t.charAt(0).toLowerCase()+t.slice(1)}static toDashCase(t){return t.replace(/([A-Z])/g,"-$1").replace(/^-/,"").toLowerCase()}static toLowerCamelCase(t,e){let i=r.toUpperCamelCase(t,e);return r.lcFirst(i)}static toUpperCamelCase(t,e){return e?t.split(e).map(t=>
1r.ucFirst(t.toLowerCase())).join(""):r.ucFirst(t.toLowerCase())}static parsePrimitive(t){try{return/^\d+(.|,)\d+$/.test(t)&&(t=t.replace(",",".")),JSON.parse(t)}catch(e){return t.toString()}}}},293:(t,e,i)=>{i.d(e,{Z:()=>l});var r=i(857),n=i.n(r),o=i(49),s=i(140);class a{publish(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=new CustomEvent(t,{detail:e,cancelable:i});return this.el.dispatchEvent(r),r}subscribe(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=this,n=t.split("."),o=i.scope?e.bind(i.scope):e;if(i.once&&!0===i.once){let e=o;o=function(i){r.unsubscribe(t),e(i)}}return this.el.addEventListener(n[0],o),this.listeners.push({splitEventName:n,opts:i,cb:o}),!0}unsubscribe(t){let e=t.split(".");return this.listeners=this.listeners.reduce((t,i)=>([...i.splitEventName].sort().toString()===e.sort().toString()?this.el.removeEventListener(i.splitEventName[0],i.cb):t.push(i),t),[]),!0}reset(){return this.listeners.forEach(t=>{this.el.removeEventListener(t.splitEventName[0],t.cb)}),this.listeners=[],!0}get el(){return this._el}set el(t){this._el=t}get listeners(){return this._listeners}set listeners(t){this._listeners=t}constructor(t=document){this._el=t,t.$emitter=this,this._listeners=[]}}class l{init(){throw Error('The "init" method for the plugin "'.concat(this._pluginName,'" is not defined.'))}update(){}_init(){this._initialized||(this.init(),this._initialized=!0)}_update(){this._initialized&&this.update()}_mergeOptions(t){let e=s.Z.toDashCase(this._pluginName),i=o.Z.getDataAttribute(this.el,"data-".concat(e,"-config"),!1),r=o.Z.getAttribute(this.el,"data-".concat(e,"-options"),!1),a=[this.constructor.options,this.options,t];i&&a.push(window.PluginConfigManager.get(this._pluginName,i));try{r&&a.push(JSON.parse(r))}catch(t){throw console.error(this.el),Error('The data attribute "data-'.concat(e,'-options" could not be parsed to json: ').concat(t.message))}return n().all(a.filter(t=>t instanceof Object&&!(t instanceof Array)).map(t=>t||{}))}_registerInstance(){window.PluginManager.getPluginInstancesFromElement(this.el).set(this._pluginName,this),window.PluginManager.getPlugin(this._pluginName,!1).get("instances").push(this)}_getPluginName(t){return t||(t=this.constructor.name),t}constructor(t,e={},i=!1){if(!o.Z.isNode(t))throw Error("There is no valid element given.");this.el=t,this.$emitter=new a(this.el),this._pluginName=this._getPluginName(i),this.options=this._mergeOptions(e),this._initialized=!1,this._registerInstance(),this._init()}}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.