/* * # Fomantic UI - 2.9.0-beta.297+0ffef84 * https://github.com/fomantic/Fomantic-UI * http://fomantic-ui.com/ * * Copyright 2022 Contributors * Released under the MIT license * http://opensource.org/licenses/MIT * */ !function(w,C,A,P){"use strict";w.isFunction=w.isFunction||function(e){return"function"==typeof e&&"number"!=typeof e.nodeType},C=void 0!==C&&C.Math==Math?C:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")(),w.fn.state=function(v){var g,b=w(this),x=b.selector||"",p=(new Date).getTime(),h=[],m=v,T="string"==typeof m,y=[].slice.call(arguments,1);return b.each(function(){var i=w.isPlainObject(v)?w.extend(!0,{},w.fn.state.settings,v):w.extend({},w.fn.state.settings),c=i.error,n=i.metadata,t=i.className,e=i.namespace,a=i.states,o=i.text,s="."+e,r=e+"-module",l=w(this),u=this,d=l.data(r),f={initialize:function(){f.verbose("Initializing module"),i.automatic&&f.add.defaults(),i.context&&""!==x?([C,A].indexOf(i.context)<0?w(A).find(i.context):w(i.context)).on(x,"mouseenter"+s,f.change.text).on(x,"mouseleave"+s,f.reset.text).on(x,"click"+s,f.toggle.state):l.on("mouseenter"+s,f.change.text).on("mouseleave"+s,f.reset.text).on("click"+s,f.toggle.state),f.instantiate()},instantiate:function(){f.verbose("Storing instance of module",f),d=f,l.data(r,f)},destroy:function(){f.verbose("Destroying previous module",d),l.off(s).removeData(r)},refresh:function(){f.verbose("Refreshing selector cache"),l=w(u)},add:{defaults:function(){var n=v&&w.isPlainObject(v.states)?v.states:{};w.each(i.defaults,function(e,t){f.is[e]!==P&&f.is[e]()&&(f.verbose("Adding default states",e,u),w.extend(i.states,t,n))})}},is:{active:function(){return l.hasClass(t.active)},loading:function(){return l.hasClass(t.loading)},inactive:function(){return!l.hasClass(t.active)},state:function(e){return t[e]!==P&&l.hasClass(t[e])},enabled:function(){return!l.is(i.filter.active)},disabled:function(){return l.is(i.filter.active)},textEnabled:function(){return!l.is(i.filter.text)},button:function(){return l.is(".button:not(a, .submit)")},input:function(){return l.is("input")},progress:function(){return l.is(".ui.progress")}},allow:function(e){f.debug("Now allowing state",e),a[e]=!0},disallow:function(e){f.debug("No longer allowing",e),a[e]=!1},allows:function(e){return a[e]||!1},enable:function(){l.removeClass(t.disabled)},disable:function(){l.addClass(t.disabled)},setState:function(e){f.allows(e)&&l.addClass(t[e])},removeState:function(e){f.allows(e)&&l.removeClass(t[e])},toggle:{state:function(){var e;if(f.allows("active")&&f.is.enabled()){if(f.refresh(),w.fn.api!==P)if(e=l.api("get request"),l.api("was cancelled"))f.debug("API Request cancelled by beforesend"),i.activateTest=function(){return!1},i.deactivateTest=function(){return!1};else if(e)return void f.listenTo(e);f.change.state()}}},listenTo:function(e){f.debug("API request detected, waiting for state signal",e),e&&(o.loading&&f.update.text(o.loading),w.when(e).then(function(){"resolved"==e.state()?(f.debug("API request succeeded"),i.activateTest=function(){return!0},i.deactivateTest=function(){return!0}):(f.debug("API request failed"),i.activateTest=function(){return!1},i.deactivateTest=function(){return!1}),f.change.state()}))},change:{state:function(){f.debug("Determining state change direction"),f.is.inactive()?f.activate():f.deactivate(),i.sync&&f.sync(),i.onChange.call(u)},text:function(){f.is.textEnabled()&&(f.is.disabled()?(f.verbose("Changing text to disabled text",o.hover),f.update.text(o.disabled)):f.is.active()?o.hover?(f.verbose("Changing text to hover text",o.hover),f.update.text(o.hover)):o.deactivate&&(f.verbose("Changing text to deactivating text",o.deactivate),f.update.text(o.deactivate)):o.hover?(f.verbose("Changing text to hover text",o.hover),f.update.text(o.hover)):o.activate&&(f.verbose("Changing text to activating text",o.activate),f.update.text(o.activate)))}},activate:function(){i.activateTest.call(u)&&(f.debug("Setting state to active"),l.addClass(t.active),f.update.text(o.active),i.onActivate.call(u))},deactivate:function(){i.deactivateTest.call(u)&&(f.debug("Setting state to inactive"),l.removeClass(t.active),f.update.text(o.inactive),i.onDeactivate.call(u))},sync:function(){f.verbose("Syncing other buttons to current state"),f.is.active()?b.not(l).state("activate"):b.not(l).state("deactivate")},get:{text:function(){return i.selector.text?l.find(i.selector.text).text():l.html()},textFor:function(e){return o[e]||!1}},flash:{text:function(e,t,n){var a=f.get.text();f.debug("Flashing text message",e,t),e=e||i.text.flash,t=t||i.flashDuration,n=n||function(){},f.update.text(e),setTimeout(function(){f.update.text(a),n.call(u)},t)}},reset:{text:function(){var e=o.active||l.data(n.storedText),t=o.inactive||l.data(n.storedText);f.is.textEnabled()&&(f.is.active()&&e?(f.verbose("Resetting active text",e),f.update.text(e)):t&&(f.verbose("Resetting inactive text",e),f.update.text(t)))}},update:{text:function(e){var t=f.get.text();e&&e!==t?(f.debug("Updating text",e),i.selector.text?l.data(n.storedText,e).find(i.selector.text).text(e):l.data(n.storedText,e).html(e)):f.debug("Text is already set, ignoring update",e)}},setting:function(e,t){if(f.debug("Changing setting",e,t),w.isPlainObject(e))w.extend(!0,i,e);else{if(t===P)return i[e];w.isPlainObject(i[e])?w.extend(!0,i[e],t):i[e]=t}},internal:function(e,t){if(w.isPlainObject(e))w.extend(!0,f,e);else{if(t===P)return f[e];f[e]=t}},debug:function(){!i.silent&&i.debug&&(i.performance?f.performance.log(arguments):(f.debug=Function.prototype.bind.call(console.info,console,i.name+":"),f.debug.apply(console,arguments)))},verbose:function(){!i.silent&&i.verbose&&i.debug&&(i.performance?f.performance.log(arguments):(f.verbose=Function.prototype.bind.call(console.info,console,i.name+":"),f.verbose.apply(console,arguments)))},error:function(){i.silent||(f.error=Function.prototype.bind.call(console.error,console,i.name+":"),f.error.apply(console,arguments))},performance:{log:function(e){var t,n;i.performance&&(n=(t=(new Date).getTime())-(p||t),p=t,h.push({Name:e[0],Arguments:[].slice.call(e,1)||"",Element:u,"Execution Time":n})),clearTimeout(f.performance.timer),f.performance.timer=setTimeout(f.performance.display,500)},display:function(){var e=i.name+":",n=0;p=!1,clearTimeout(f.performance.timer),w.each(h,function(e,t){n+=t["Execution Time"]}),e+=" "+n+"ms",x&&(e+=" '"+x+"'"),(console.group!==P||console.table!==P)&&0