/* * # Fomantic UI - 2.9.0-beta.315+0963809 * https://github.com/fomantic/Fomantic-UI * http://fomantic-ui.com/ * * Copyright 2022 Contributors * Released under the MIT license * http://opensource.org/licenses/MIT * */ !function(O,$,I,L){"use strict";O.isFunction=O.isFunction||function(e){return"function"==typeof e&&"number"!=typeof e.nodeType},$=void 0!==$&&$.Math==Math?$:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")(),O.fn.form=function(C){var w,V=O(this),A=V.selector||"",D=(new Date).getTime(),F=[],R=C,S=arguments[1],T="string"==typeof R,j=[].slice.call(arguments,1);return V.each(function(){var n,d,t,e,f,s,m,p,g,r,u,i,a,l,c,h=O(this),v=this,b=[],y=!1,o=!1,x=!1,k=["clean","clean"],E={initialize:function(){E.get.settings(),T?(c===L&&E.instantiate(),E.invoke(R)):(c!==L&&(c.invoke("destroy"),E.refresh()),E.verbose("Initializing form validation",h,f),E.bindEvents(),E.set.defaults(),f.autoCheckRequired&&E.set.autoCheck(),E.instantiate())},instantiate:function(){E.verbose("Storing instance of module",E),c=E,h.data(a,E)},destroy:function(){E.verbose("Destroying previous module",c),E.removeEvents(),h.removeData(a)},refresh:function(){E.verbose("Refreshing selector cache"),n=h.find(p.field),d=h.find(p.group),t=h.find(p.message),h.find(p.prompt),e=h.find(p.submit),h.find(p.clear),h.find(p.reset)},refreshEvents:function(){E.removeEvents(),E.bindEvents()},submit:function(){E.verbose("Submitting form",h),o=!0,h.submit()},attachEvents:function(e,t){t=t||"submit",O(e).on("click"+l,function(e){E[t](),e.preventDefault()})},bindEvents:function(){E.verbose("Attaching form events"),h.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&&h.on("keydown"+l,p.field,E.event.field.keydown),n.each(function(e,t){var t=O(t),n=t.prop("type"),n=E.get.changeEvent(n,t);t.on(n+l,E.event.field.change)}),f.preventLeaving&&O($).on("beforeunload"+l,E.event.beforeUnload),n.on("change click keyup keydown blur",function(e){E.determine.isDirty()}),h.on("dirty"+l,function(e){f.onDirty.call()}),h.on("clean"+l,function(e){f.onClean.call()})},clear:function(){n.each(function(e,t){var t=O(t),n=t.parent(),r=t.closest(d),i=r.find(p.prompt),a=t.closest(p.uiCalendar),o=t.data(m.defaultValue)||"",l=n.is(p.uiCheckbox),s=n.is(p.uiDropdown)&&E.can.useElement("dropdown"),u=0")},fields:function(e){var n=O();return O.each(e,function(e,t){n=n.add(E.get.field(t))}),n},validation:function(r){var i,a;return s&&(O.each(s,function(e,n){a=n.identifier||e,O.each(E.get.field(a),function(e,t){if(t==r[0])return n.identifier=a,i=n,!1})}),i)||!1},value:function(e){var t=[];return t.push(e),E.get.values.call(v,t)[e]},values:function(e){var e=Array.isArray(e)?E.get.fields(e):n,d={};return e.each(function(e,t){var t=O(t),n=t.closest(p.uiCalendar),r=t.prop("name"),i=t.val(),a=t.is(p.checkbox),o=t.is(p.radio),l=-1!==r.indexOf("[]"),s=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")&&h.transition("is supported")?(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(e){E.debug("Adding form error messages",e),E.set.error(),t.html(f.templates.error(e))}},remove:{errors:function(){E.debug("Removing form error messages"),t.empty()},states:function(){h.removeClass(g.error).removeClass(g.success),f.inline||E.remove.errors(),E.determine.isDirty()},rule:function(n,e){var r=Array.isArray(e)?e:[e];s[n]!==L&&Array.isArray(s[n].rules)&&(e===L?(E.debug("Removed all rules"),s[n].rules=[]):O.each(s[n].rules,function(e,t){t&&-1!==r.indexOf(t.type)&&(E.debug("Removed rule",t.type),s[n].rules.splice(e,1))}))},field:function(e){e=Array.isArray(e)?e:[e];O.each(e,function(e,t){E.remove.rule(t)}),E.refreshEvents()},rules:function(e,n){Array.isArray(e)?O.each(e,function(e,t){E.remove.rule(t,n)}):E.remove.rule(e,n)},fields:function(e){E.remove.field(e)},prompt:function(e){var t=E.get.field(e).closest(d),n=t.children(p.prompt);t.removeClass(g.error),f.inline&&n.is(":visible")&&(E.verbose("Removing prompt for field",e),f.transition&&E.can.useElement("transition")&&h.transition("is supported")?n.transition(f.transition+" out",f.duration,function(){n.remove()}):n.fadeOut(f.duration,function(){n.remove()}))}},set:{success:function(){h.removeClass(g.error).addClass(g.success)},defaults:function(){n.each(function(e,t){var t=O(t),n=t.parent(),r=0"}),n+=""},prompt:function(e){var n;return 1===e.length?e[0]:(n='
    ',O.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!(e===L||""===e||Array.isArray(e)&&0===e.length)},checked:function(){return 0=t},exactLength:function(e,t){return e!==L&&e.length==t},maxLength:function(e,t){return e!==L&&e.length<=t},match:function(e,t,n){var r,i;return 0<(i=n.find('[data-validate="'+t+'"]')).length||0<(i=n.find("#"+t)).length||0<(i=n.find('[name="'+t+'"]')).length?r=i.val():0<(i=n.find('[name="'+t+'[]"]')).length&&(r=i),r!==L&&e.toString()==r.toString()},different:function(e,t,n){var r,i;return 0<(i=n.find('[data-validate="'+t+'"]')).length||0<(i=n.find("#"+t)).length||0<(i=n.find('[name="'+t+'"]')).length?r=i.val():0<(i=n.find('[name="'+t+'[]"]')).length&&(r=i),r!==L&&e.toString()!==r.toString()},creditCard:function(n,e){var r,i={visa:{pattern:/^4/,length:[16]},amex:{pattern:/^3[47]/,length:[15]},mastercard:{pattern:/^5[1-5]/,length:[16]},discover:{pattern:/^(6011|622(12[6-9]|1[3-9][0-9]|[2-8][0-9]{2}|9[0-1][0-9]|92[0-5]|64[4-9])|65)/,length:[16]},unionPay:{pattern:/^(62|88)/,length:[16,17,18,19]},jcb:{pattern:/^35(2[89]|[3-8][0-9])/,length:[16]},maestro:{pattern:/^(5018|5020|5038|6304|6759|676[1-3])/,length:[12,13,14,15,16,17,18,19]},dinersClub:{pattern:/^(30[0-5]|^36)/,length:[14]},laser:{pattern:/^(6304|670[69]|6771)/,length:[16,17,18,19]},visaElectron:{pattern:/^(4026|417500|4508|4844|491(3|7))/,length:[16]}},a=!1,e="string"==typeof e&&e.split(",");if("string"==typeof n&&0!==n.length){if(n=n.replace(/[\s\-]/g,""),e&&(O.each(e,function(e,t){(r=i[t])&&(r={length:-1!==O.inArray(n.length,r.length),pattern:-1!==n.search(r.pattern)}).length&&r.pattern&&(a=!0)}),!a))return!1;if((e={number:-1!==O.inArray(n.length,i.unionPay.length),pattern:-1!==n.search(i.unionPay.pattern)}).number&&e.pattern)return!0;for(var t=n.length,o=0,l=[[0,1,2,3,4,5,6,7,8,9],[0,2,4,6,8,1,3,5,7,9]],s=0;t--;)s+=l[o][parseInt(n.charAt(t),10)],o^=1;return s%10==0&&0=t)},exactCount:function(e,t){return 0==t?""===e:1==t?""!==e&&-1===e.search(","):e.split(",").length==t},maxCount:function(e,t){return 0!=t&&(1==t?-1===e.search(","):e.split(",").length<=t)}}}}(jQuery,window,document);