/* * # Fomantic UI - 2.9.2 * https://github.com/fomantic/Fomantic-UI * https://fomantic-ui.com/ * * Copyright 2023 Contributors * Released under the MIT license * https://opensource.org/licenses/MIT * */ !function(j,O,L){"use strict";function z(e){return"function"==typeof e&&"number"!=typeof e.nodeType}O=void 0!==O&&O.Math===Math?O:globalThis,j.fn.form=function(C){var w,V=j(this),A=V.selector||"",D=Date.now(),R=[],S=C,F="string"==typeof S,T=[].slice.call(arguments,1);return V.each(function(){var i,d,e,t,f,s,m,p,g,n,u,r,a,l,c,o=j(this),h=this,v=[],b=!1,y=!1,x=!1,k=["clean","clean"],E={initialize:function(){E.get.settings(),F?(void 0===c&&E.instantiate(),E.invoke(S)):(void 0!==c&&(c.invoke("destroy"),E.refresh()),E.verbose("Initializing form validation",o,f),E.bindEvents(),E.set.defaults(),f.autoCheckRequired&&E.set.autoCheck(),E.instantiate())},instantiate:function(){E.verbose("Storing instance of module",E),c=E,o.data(a,E)},destroy:function(){E.verbose("Destroying previous module",c),E.removeEvents(),o.removeData(a)},refresh:function(){E.verbose("Refreshing selector cache"),i=o.find(p.field),d=o.find(p.group),e=o.find(p.message),o.find(p.prompt),t=o.find(p.submit),o.find(p.clear),o.find(p.reset)},refreshEvents:function(){E.removeEvents(),E.bindEvents()},submit:function(){E.verbose("Submitting form",o),y=!0,o.trigger("submit")},attachEvents:function(e,t){t=t||"submit",j(e).on("click"+l,function(e){E[t](),e.preventDefault()})},bindEvents:function(){E.verbose("Attaching form events"),o.on("submit"+l,E.validate.form).on("blur"+l,p.field,E.event.field.blur).on("click"+l,p.submit,E.submit).on("click"+l,p.reset,E.reset).on("click"+l,p.clear,E.clear),f.keyboardShortcuts&&o.on("keydown"+l,p.field,E.event.field.keydown),i.each(function(e,t){var t=j(t),n=t.prop("type"),n=E.get.changeEvent(n,t);t.on(n+l,E.event.field.change)}),f.preventLeaving&&j(O).on("beforeunload"+l,E.event.beforeUnload),i.on("change click keyup keydown blur",function(e){E.determine.isDirty()}),o.on("dirty"+l,function(e){f.onDirty.call()}),o.on("clean"+l,function(e){f.onClean.call()})},clear:function(){i.each(function(e,t){var t=j(t),n=t.parent(),r=t.closest(d),i=r.find(p.prompt),a=t.closest(p.uiCalendar),o=t.data(m.defaultValue)||"",l=t.is(p.checkbox),s=n.is(p.uiDropdown)&&E.can.useElement("dropdown"),u=0"))},fields:function(e,n){var r=j();return j.each(e,function(e,t){r=r.add(E.get.field(t,n))}),r},fieldLabel:function(e,t){var n="string"==typeof e?E.get.field(e):e,r=n.closest(p.group).find("label").eq(0);return 1===r.length?r.text():n.prop("placeholder")||(t?e:f.text.unspecifiedField)},validation:function(r){var i,a;return s&&(j.each(s,function(e,n){a=n.identifier||e,j.each(E.get.field(a),function(e,t){if(t==r[0])return n.identifier=a,i=n,!1})}),i)||!1},value:function(e,t){var n=[];return n.push(e),e=E.get.values.call(h,n,t),0<(n=Object.keys(e)).length?e[n[0]]:void 0},values:function(e,t){var e=Array.isArray(e)&&0").addClass(g.label)).appendTo(r),i.html(f.templates.prompt(t)),a?E.verbose("Inline errors are disabled, no inline error added",e):f.transition&&E.can.useElement("transition")?(E.verbose("Displaying error with css transition",f.transition),i.transition(f.transition+" in",f.duration)):(E.verbose("Displaying error with fallback javascript animation"),i.fadeIn(f.duration)))},errors:function(t){var r,i;!1!==(t=E.checkErrors(t))&&(E.debug("Adding form error messages",t),E.set.error(),r=[],j.isPlainObject(t)?j.each(Object.keys(t),function(e,n){!1!==E.checkErrors(t[n],!0)&&(f.inline?E.add.prompt(n,t[n]):!1!==(i=E.checkErrors(t[n]))&&j.each(i,function(e,t){r.push(f.prompt.addErrors.replace(/{name}/g,E.get.fieldLabel(n)).replace(/{error}/g,t))}))}):r=t,0"}),n+=""},prompt:function(e){var n;return 1===e.length?e[0]:(n='
    ',j.each(e,function(e,t){n+="
  • "+t+"
  • "}),n+="
")}},formatter:{date:function(e){return Intl.DateTimeFormat("en-GB").format(e)},datetime:function(e){return Intl.DateTimeFormat("en-GB",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(e)},time:function(e){return Intl.DateTimeFormat("en-GB",{hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(e)},month:function(e){return Intl.DateTimeFormat("en-GB",{month:"2-digit",year:"numeric"}).format(e)},year:function(e){return Intl.DateTimeFormat("en-GB",{year:"numeric"}).format(e)}},rules:{empty:function(e){return!(void 0===e||""===e||Array.isArray(e)&&0===e.length)},checked:function(){return 0=t)},exactCount:function(e,t){return 0===(t=Number(t))?""===e:1===t?""!==e&&-1===e.search(","):e.split(",").length===t},maxCount:function(e,t){return 0!==(t=Number(t))&&(1===t?-1===e.search(","):e.split(",").length<=t)}}}}(jQuery,window,document);