wishthis/semantic/dist/components/modal.min.js
2022-08-05 11:25:53 +02:00

11 lines
No EOL
21 KiB
JavaScript

/*
* # Fomantic UI - 2.9.0-beta.301+42e68bc
* https://github.com/fomantic/Fomantic-UI
* http://fomantic-ui.com/
*
* Copyright 2022 Contributors
* Released under the MIT license
* http://opensource.org/licenses/MIT
*
*/
!function(R,P,K,W){"use strict";R.isFunction=R.isFunction||function(e){return"function"==typeof e&&"number"!=typeof e.nodeType},P=void 0!==P&&P.Math==Math?P:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")(),R.fn.modal=function(T){var D,e=R(this),H=R(P),O=R(K),E=R("body"),L=e.selector||"",I=(new Date).getTime(),N=[],z=T,j="string"==typeof z,q=[].slice.call(arguments,1),B=P.requestAnimationFrame||P.mozRequestAnimationFrame||P.webkitRequestAnimationFrame||P.msRequestAnimationFrame||function(e){setTimeout(e,0)};return e.each(function(){var t,o,s,e,i,n,a,c,r,l,d,u=R.isPlainObject(T)?R.extend(!0,{},R.fn.modal.settings,T):R.extend({},R.fn.modal.settings),f=u.selector,m=u.className,h=u.namespace,g=u.fields,p=u.error,v="."+h,b="module-"+h,y=R(this),x=[P,K].indexOf(u.context)<0?R(K).find(u.context):R(u.context),k=y.find(f.closeIcon),w=this,C=y.hasClass("modal")?y.data(b):W,S=!1,F="",M="",A={initialize:function(){var s;A.create.id(),y.hasClass("modal")||(A.create.modal(),R.isFunction(u.onHidden)||(u.onHidden=function(){A.destroy(),y.remove()})),y.addClass(u.class),""!==u.title&&y.find(f.title).html(A.helpers.escape(u.title,u.preserveHTML)).addClass(u.classTitle),""!==u.content&&y.find(f.content).html(A.helpers.escape(u.content,u.preserveHTML)).addClass(u.classContent),A.has.configActions()&&(0===(s=y.find(f.actions).addClass(u.classActions)).length?s=R("<div/>",{class:m.actions+" "+(u.classActions||"")}).appendTo(y):s.empty(),u.actions.forEach(function(e){var t=e[g.icon]?"<i "+(e[g.text]?'aria-hidden="true"':"")+' class="'+A.helpers.deQuote(e[g.icon])+' icon"></i>':"",n=A.helpers.escape(e[g.text]||"",u.preserveHTML),i=A.helpers.deQuote(e[g.class]||""),o=e[g.click]&&R.isFunction(e[g.click])?e[g.click]:function(){};s.append(R("<button/>",{html:t+n,"aria-label":(e[g.text]||e[g.icon]||"").replace(/<[^>]+(>|$)/g,""),class:m.button+" "+i,click:function(){var e=R(this);e.is(f.approve)||e.is(f.deny)||!1===o.call(w,y)||A.hide()}}))})),A.cache={},A.verbose("Initializing dimmer",x),A.create.dimmer(),u.allowMultiple&&A.create.innerDimmer(),u.centered||y.addClass("top aligned"),A.refreshModals(),A.refreshInputs(),A.bind.events(),A.observeChanges(),A.instantiate(),u.autoShow&&A.show()},instantiate:function(){A.verbose("Storing instance of modal"),C=A,y.data(b,C)},create:{modal:function(){var e;y=R("<div/>",{class:m.modal,role:"dialog","aria-modal":!0}),u.closeIcon&&(k=R("<i/>",{class:m.close,role:"button",tabindex:0,"aria-label":u.text.close}),y.append(k)),""!==u.title&&(e="_"+A.get.id()+"title",y.attr("aria-labelledby",e),R("<div/>",{class:m.title,id:e}).appendTo(y)),""!==u.content&&(e="_"+A.get.id()+"desc",y.attr("aria-describedby",e),R("<div/>",{class:m.content,id:e}).appendTo(y)),A.has.configActions()&&R("<div/>",{class:m.actions}).appendTo(y),x.append(y)},dimmer:function(){var e={debug:u.debug,dimmerName:"modals"},e=R.extend(!0,e,u.dimmerSettings);R.fn.dimmer===W?A.error(p.dimmer):(A.debug("Creating dimmer"),i=x.dimmer(e),u.detachable?(A.verbose("Modal is detachable, moving content into dimmer"),i.dimmer("add content",y)):A.set.undetached(),n=i.dimmer("get dimmer"))},id:function(){l=(Math.random().toString(16)+"000000000").slice(2,10),r="."+l,A.verbose("Creating unique id for element",l)},innerDimmer:function(){0===y.find(f.dimmer).length&&R("<div/>",{class:m.innerDimmer}).prependTo(y)}},destroy:function(){d&&d.disconnect(),A.verbose("Destroying previous modal"),y.removeData(b).off(v),H.off(r),n.off(r),k.off(r),t&&t.off(r),x.dimmer("destroy")},observeChanges:function(){"MutationObserver"in P&&((d=new MutationObserver(function(e){u.observeChanges&&(A.debug("DOM tree modified, refreshing"),A.refresh()),A.refreshInputs()})).observe(w,{childList:!0,subtree:!0}),A.debug("Setting up mutation observer",d))},refresh:function(){A.remove.scrolling(),A.cacheSizes(),A.can.useFlex()||A.set.modalOffset(),A.set.screenHeight(),A.set.type()},refreshModals:function(){s=y.siblings(f.modal),o=s.add(y)},refreshInputs:function(){t&&t.off("keydown"+r),(t=y.find("[tabindex], :input").filter(":visible").filter(function(){return 0===R(this).closest(".disabled").length})).first().on("keydown"+r,A.event.inputKeyDown.first),t.last().on("keydown"+r,A.event.inputKeyDown.last)},attachEvents:function(e,t){var n=R(e);t=R.isFunction(A[t])?A[t]:A.toggle,0<n.length?(A.debug("Attaching modal events to element",e,t),n.off(v).on("click"+v,t)):A.error(p.notFound,e)},bind:{events:function(){A.verbose("Attaching events"),y.on("click"+v,f.close,A.event.close).on("click"+v,f.approve,A.event.approve).on("click"+v,f.deny,A.event.deny),k.on("keyup"+r,A.event.closeKeyUp),H.on("resize"+r,A.event.resize)},scrollLock:function(){i.get(0).addEventListener("touchmove",A.event.preventScroll,{passive:!1})}},unbind:{scrollLock:function(){i.get(0).removeEventListener("touchmove",A.event.preventScroll,{passive:!1})}},get:{id:function(){return l},element:function(){return y},settings:function(){return u}},event:{approve:function(){S||!1===u.onApprove.call(w,R(this))?A.verbose("Approve callback returned false cancelling hide"):(S=!0,A.hide(function(){S=!1}))},preventScroll:function(e){-1!==e.target.className.indexOf("dimmer")&&e.preventDefault()},deny:function(){S||!1===u.onDeny.call(w,R(this))?A.verbose("Deny callback returned false cancelling hide"):(S=!0,A.hide(function(){S=!1}))},close:function(){A.hide()},closeKeyUp:function(e){e=e.which;e!==u.keys.enter&&e!==u.keys.space||!y.hasClass(m.front)||A.hide()},inputKeyDown:{first:function(e){e.which===u.keys.tab&&e.shiftKey&&(t.last().focus(),e.preventDefault())},last:function(e){e.which!==u.keys.tab||e.shiftKey||(t.first().focus(),e.preventDefault())}},mousedown:function(e){var t=R(e.target),n=A.is.rtl();(a=0<t.closest(f.modal).length)&&A.verbose("Mouse down event registered inside the modal"),(c=A.is.scrolling()&&(!n&&R(P).outerWidth()-u.scrollbarWidth<=e.clientX||n&&u.scrollbarWidth>=e.clientX))&&A.verbose("Mouse down event registered inside the scrollbar")},mouseup:function(e){if(u.closable)if(a)A.debug("Dimmer clicked but mouse down was initially registered inside the modal");else if(c)A.debug("Dimmer clicked but mouse down was initially registered inside the scrollbar");else{var t=0<R(e.target).closest(f.modal).length,e=R.contains(K.documentElement,e.target);if(!t&&e&&A.is.active()&&y.hasClass(m.front)){if(A.debug("Dimmer clicked, hiding all modals"),u.allowMultiple){if(!A.hideAll())return}else if(!A.hide())return;A.remove.clickaway()}}else A.verbose("Dimmer clicked but closable setting is disabled")},debounce:function(e,t){clearTimeout(A.timer),A.timer=setTimeout(e,t)},keyboard:function(e){e.which===u.keys.escape&&(u.closable?(A.debug("Escape key pressed hiding modal"),y.hasClass(m.front)&&A.hide()):A.debug("Escape key pressed, but closable is set to false"),e.preventDefault())},resize:function(){i.dimmer("is active")&&(A.is.animating()||A.is.active())&&B(A.refresh)}},toggle:function(){A.is.active()||A.is.animating()?A.hide():A.show()},show:function(e){e=R.isFunction(e)?e:function(){},A.refreshModals(),A.set.dimmerSettings(),A.set.dimmerStyles(),A.showModal(e)},hide:function(e){return e=R.isFunction(e)?e:function(){},A.refreshModals(),A.hideModal(e)},showModal:function(e){e=R.isFunction(e)?e:function(){},A.is.animating()||!A.is.active()?!1===u.onShow.call(w)?A.verbose("Show callback returned false cancelling show"):(A.showDimmer(),A.cacheSizes(),A.set.bodyMargin(),A.can.useFlex()?A.remove.legacy():(A.set.legacy(),A.set.modalOffset(),A.debug("Using non-flex legacy modal positioning.")),A.set.screenHeight(),A.set.type(),A.set.clickaway(),!u.allowMultiple&&A.others.active()?A.hideOthers(A.showModal):(S=!1,u.allowMultiple&&(A.others.active()&&s.filter("."+m.active).find(f.dimmer).addClass("active"),u.detachable&&y.detach().appendTo(n)),u.transition&&R.fn.transition!==W&&y.transition("is supported")?(A.debug("Showing modal with css animations"),y.transition({debug:u.debug,animation:(u.transition.showMethod||u.transition)+" in",queue:u.queue,duration:u.transition.showDuration||u.duration,useFailSafe:!0,onComplete:function(){u.onVisible.apply(w),u.keyboardShortcuts&&A.add.keyboardShortcuts(),A.save.focus(),A.set.active(),u.autofocus&&A.set.autofocus(),e()}})):A.error(p.noTransition))):A.debug("Modal is already visible")},hideModal:function(e,t,n){var i=s.filter("."+m.active).last();if(e=R.isFunction(e)?e:function(){},!1===u.onHide.call(w,R(this)))return A.verbose("Hide callback returned false cancelling hide"),S=!1;(A.is.animating()||A.is.active())&&(A.debug("Hiding modal"),u.transition&&R.fn.transition!==W&&y.transition("is supported")?(A.remove.active(),y.transition({debug:u.debug,animation:(u.transition.hideMethod||u.transition)+" out",queue:u.queue,duration:u.transition.hideDuration||u.duration,useFailSafe:!0,onStart:function(){A.others.active()||A.others.animating()||t||A.hideDimmer(),u.keyboardShortcuts&&!A.others.active()&&A.remove.keyboardShortcuts()},onComplete:function(){A.unbind.scrollLock(),u.allowMultiple&&(i.addClass(m.front),y.removeClass(m.front),(n?o:i).find(f.dimmer).removeClass("active")),R.isFunction(u.onHidden)&&u.onHidden.call(w),A.remove.dimmerStyles(),A.restore.focus(),e()}})):A.error(p.noTransition))},showDimmer:function(){i.dimmer("is animating")||!i.dimmer("is active")?(A.save.bodyMargin(),A.debug("Showing dimmer"),i.dimmer("show")):A.debug("Dimmer already visible")},hideDimmer:function(){i.dimmer("is animating")||i.dimmer("is active")?(A.unbind.scrollLock(),i.dimmer("hide",function(){A.restore.bodyMargin(),A.remove.clickaway(),A.remove.screenHeight()})):A.debug("Dimmer is not visible cannot hide")},hideAll:function(n){var i,e=o.filter("."+m.active+", ."+m.animating);if(n=R.isFunction(n)?n:function(){},0<e.length)return A.debug("Hiding all visible modals"),i=!0,R(e.get().reverse()).each(function(e,t){i=i&&R(t).modal("hide modal",n,!1,!0)}),i&&A.hideDimmer(),i},hideOthers:function(e){var t=s.filter("."+m.active+", ."+m.animating);e=R.isFunction(e)?e:function(){},0<t.length&&(A.debug("Hiding other modals",s),t.modal("hide modal",e,!0))},others:{active:function(){return 0<s.filter("."+m.active).length},animating:function(){return 0<s.filter("."+m.animating).length}},add:{keyboardShortcuts:function(){A.verbose("Adding keyboard shortcuts"),O.on("keyup"+v,A.event.keyboard)}},save:{focus:function(){0<R(K.activeElement).closest(y).length||(e=R(K.activeElement).blur())},bodyMargin:function(){F=E.css("margin-"+(A.can.leftBodyScrollbar()?"left":"right"));var e=parseInt(F.replace(/[^\d.]/g,"")),t=P.innerWidth-K.documentElement.clientWidth;M=e+t}},restore:{focus:function(){e&&0<e.length&&u.restoreFocus&&e.focus()},bodyMargin:function(){var n=A.can.leftBodyScrollbar()?"left":"right";E.css("margin-"+n,F),E.find(f.bodyFixed.replace("right",n)).each(function(){var e=R(this),t="fixed"===e.css("position")?"padding-"+n:n;e.css(t,"")})}},remove:{active:function(){y.removeClass(m.active)},legacy:function(){y.removeClass(m.legacy)},clickaway:function(){u.detachable||y.off("mousedown"+r),n.off("mousedown"+r),n.off("mouseup"+r)},dimmerStyles:function(){n.removeClass(m.inverted),i.removeClass(m.blurring)},bodyStyle:function(){""===E.attr("style")&&(A.verbose("Removing style attribute"),E.removeAttr("style"))},screenHeight:function(){A.debug("Removing page height"),E.css("height","")},keyboardShortcuts:function(){A.verbose("Removing keyboard shortcuts"),O.off("keyup"+v)},scrolling:function(){i.removeClass(m.scrolling),y.removeClass(m.scrolling)}},cacheSizes:function(){y.addClass(m.loading);var e=y.prop("scrollHeight"),t=y.outerWidth(),n=y.outerHeight();A.cache.pageHeight!==W&&0===n||(R.extend(A.cache,{pageHeight:R(K).outerHeight(),width:t,height:n+u.offset,scrollHeight:e+u.offset,contextHeight:("body"==u.context?R(P):i).height()}),A.cache.topOffset=-A.cache.height/2),y.removeClass(m.loading),A.debug("Caching modal and container sizes",A.cache)},helpers:{deQuote:function(e){return String(e).replace(/"/g,"")},escape:function(e,t){if(t)return e;var n={"<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"};return/[&<>"'`]/.test(e)?(e=e.replace(/&(?![a-z0-9#]{1,6};)/,"&amp;")).replace(/[<>"'`]/g,function(e){return n[e]}):e}},can:{leftBodyScrollbar:function(){return A.cache.leftBodyScrollbar===W&&(A.cache.leftBodyScrollbar=A.is.rtl()&&(A.is.iframe&&!A.is.firefox()||A.is.safari()||A.is.edge()||A.is.ie())),A.cache.leftBodyScrollbar},useFlex:function(){return"auto"===u.useFlex?u.detachable&&!A.is.ie():(u.useFlex&&A.is.ie()?A.debug("useFlex true is not supported in IE"):u.useFlex&&!u.detachable&&A.debug("useFlex true in combination with detachable false is not supported"),u.useFlex)},fit:function(){var e=A.cache.contextHeight,t=A.cache.contextHeight/2,n=A.cache.topOffset,i=A.cache.scrollHeight,o=A.cache.height,s=u.padding;return o<i?t+n+i+s<e:o+2*s<e}},has:{configActions:function(){return Array.isArray(u.actions)&&0<u.actions.length}},is:{active:function(){return y.hasClass(m.active)},ie:function(){var e,t;return A.cache.isIE===W&&(e=!P.ActiveXObject&&"ActiveXObject"in P,t="ActiveXObject"in P,A.cache.isIE=e||t),A.cache.isIE},animating:function(){return y.transition("is supported")?y.transition("is animating"):y.is(":visible")},scrolling:function(){return i.hasClass(m.scrolling)},modernBrowser:function(){return!(P.ActiveXObject||"ActiveXObject"in P)},rtl:function(){return A.cache.isRTL===W&&(A.cache.isRTL="rtl"===E.attr("dir")||"rtl"===E.css("direction")),A.cache.isRTL},safari:function(){return A.cache.isSafari===W&&(A.cache.isSafari=/constructor/i.test(P.HTMLElement)||!!P.ApplePaySession),A.cache.isSafari},edge:function(){return A.cache.isEdge===W&&(A.cache.isEdge=!!P.setImmediate&&!A.is.ie()),A.cache.isEdge},firefox:function(){return A.cache.isFirefox===W&&(A.cache.isFirefox=!!P.InstallTrigger),A.cache.isFirefox},iframe:function(){return!(self===top)}},set:{autofocus:function(){var e=t.filter("[autofocus]"),e=(0<e.length?e:1<t.length?t.filter(":not(i.close)"):t).first();0<e.length&&e.focus()},bodyMargin:function(){var n=A.can.leftBodyScrollbar()?"left":"right";(u.detachable||A.can.fit())&&E.css("margin-"+n,M+"px"),E.find(f.bodyFixed.replace("right",n)).each(function(){var e=R(this),t="fixed"===e.css("position")?"padding-"+n:n;e.css(t,"calc("+e.css(t)+" + "+M+"px)")})},clickaway:function(){u.detachable||y.on("mousedown"+r,A.event.mousedown),n.on("mousedown"+r,A.event.mousedown),n.on("mouseup"+r,A.event.mouseup)},dimmerSettings:function(){var e;R.fn.dimmer===W?A.error(p.dimmer):(e={debug:u.debug,dimmerName:"modals",closable:"auto",useFlex:A.can.useFlex(),duration:{show:u.transition.showDuration||u.duration,hide:u.transition.hideDuration||u.duration}},e=R.extend(!0,e,u.dimmerSettings),u.inverted&&(e.variation=e.variation!==W?e.variation+" inverted":"inverted"),x.dimmer("setting",e))},dimmerStyles:function(){u.inverted?n.addClass(m.inverted):n.removeClass(m.inverted),u.blurring?i.addClass(m.blurring):i.removeClass(m.blurring)},modalOffset:function(){var e;u.detachable?y.css({marginTop:!y.hasClass("aligned")&&A.can.fit()?-A.cache.height/2:u.padding/2,marginLeft:-A.cache.width/2}):(e=A.can.fit(),y.css({top:!y.hasClass("aligned")&&e?R(K).scrollTop()+(A.cache.contextHeight-A.cache.height)/2:!e||y.hasClass("top")?R(K).scrollTop()+u.padding:R(K).scrollTop()+(A.cache.contextHeight-A.cache.height-u.padding),marginLeft:-A.cache.width/2})),A.verbose("Setting modal offset for legacy mode")},screenHeight:function(){A.can.fit()?E.css("height",""):y.hasClass("bottom")||(A.debug("Modal is taller than page content, resizing page height"),E.css("height",A.cache.height+2*u.padding))},active:function(){y.addClass(m.active+" "+m.front),s.filter("."+m.active).removeClass(m.front)},scrolling:function(){i.addClass(m.scrolling),y.addClass(m.scrolling),A.unbind.scrollLock()},legacy:function(){y.addClass(m.legacy)},type:function(){A.can.fit()?(A.verbose("Modal fits on screen"),A.others.active()||A.others.animating()||(A.remove.scrolling(),A.bind.scrollLock())):y.hasClass("bottom")?A.verbose("Bottom aligned modal not fitting on screen is unsupported for scrolling"):(A.verbose("Modal cannot fit on screen setting to scrolling"),A.set.scrolling())},undetached:function(){i.addClass(m.undetached)}},setting:function(e,t){if(A.debug("Changing setting",e,t),R.isPlainObject(e))R.extend(!0,u,e);else{if(t===W)return u[e];R.isPlainObject(u[e])?R.extend(!0,u[e],t):u[e]=t}},internal:function(e,t){if(R.isPlainObject(e))R.extend(!0,A,e);else{if(t===W)return A[e];A[e]=t}},debug:function(){!u.silent&&u.debug&&(u.performance?A.performance.log(arguments):(A.debug=Function.prototype.bind.call(console.info,console,u.name+":"),A.debug.apply(console,arguments)))},verbose:function(){!u.silent&&u.verbose&&u.debug&&(u.performance?A.performance.log(arguments):(A.verbose=Function.prototype.bind.call(console.info,console,u.name+":"),A.verbose.apply(console,arguments)))},error:function(){u.silent||(A.error=Function.prototype.bind.call(console.error,console,u.name+":"),A.error.apply(console,arguments))},performance:{log:function(e){var t,n;u.performance&&(n=(t=(new Date).getTime())-(I||t),I=t,N.push({Name:e[0],Arguments:[].slice.call(e,1)||"",Element:w,"Execution Time":n})),clearTimeout(A.performance.timer),A.performance.timer=setTimeout(A.performance.display,500)},display:function(){var e=u.name+":",n=0;I=!1,clearTimeout(A.performance.timer),R.each(N,function(e,t){n+=t["Execution Time"]}),e+=" "+n+"ms",L&&(e+=" '"+L+"'"),(console.group!==W||console.table!==W)&&0<N.length&&(console.groupCollapsed(e),console.table?console.table(N):R.each(N,function(e,t){console.log(t.Name+": "+t["Execution Time"]+"ms")}),console.groupEnd()),N=[]}},invoke:function(i,e,t){var o,s,n,a=C;return e=e||q,t=w||t,"string"==typeof i&&a!==W&&(i=i.split(/[\. ]/),o=i.length-1,R.each(i,function(e,t){var n=e!=o?t+i[e+1].charAt(0).toUpperCase()+i[e+1].slice(1):i;if(R.isPlainObject(a[n])&&e!=o)a=a[n];else{if(a[n]!==W)return s=a[n],!1;{if(!R.isPlainObject(a[t])||e==o)return a[t]!==W&&(s=a[t]),!1;a=a[t]}}})),R.isFunction(s)?n=s.apply(t,e):s!==W&&(n=s),Array.isArray(D)?D.push(n):D!==W?D=[D,n]:n!==W&&(D=n),s}};j?(C===W&&(R.isFunction(u.templates[z])&&(u.autoShow=!0,u.className.modal=u.className.template,u=R.extend(!0,{},u,u.templates[z].apply(A,q)),m=u.className,u.namespace,g=u.fields,p=u.error),A.initialize()),R.isFunction(u.templates[z])||A.invoke(z)):(C!==W&&C.invoke("destroy"),A.initialize(),D=y)}),D!==W?D:this},R.fn.modal.settings={name:"Modal",namespace:"modal",useFlex:"auto",offset:0,silent:!1,debug:!1,verbose:!1,performance:!0,observeChanges:!1,allowMultiple:!1,detachable:!0,closable:!0,autofocus:!0,restoreFocus:!0,autoShow:!1,inverted:!1,blurring:!1,centered:!0,dimmerSettings:{closable:!1,useCSS:!0},keyboardShortcuts:!0,context:"body",queue:!1,duration:500,transition:"scale",padding:50,scrollbarWidth:10,title:"",content:"",class:"",classTitle:"",classContent:"",classActions:"",closeIcon:!1,actions:!1,preserveHTML:!0,fields:{class:"class",text:"text",icon:"icon",click:"click"},onShow:function(){},onVisible:function(){},onHide:function(){return!0},onHidden:!1,onApprove:function(){return!0},onDeny:function(){return!0},keys:{space:32,enter:13,escape:27,tab:9},selector:{title:"> .header",content:"> .content",actions:"> .actions",close:"> .close",closeIcon:"> .close",approve:".actions .positive, .actions .approve, .actions .ok",deny:".actions .negative, .actions .deny, .actions .cancel",modal:".ui.modal",dimmer:"> .ui.dimmer",bodyFixed:"> .ui.fixed.menu, > .ui.right.toast-container, > .ui.right.sidebar, > .ui.fixed.nag, > .ui.fixed.nag > .close",prompt:".ui.input > input"},error:{dimmer:"UI Dimmer, a required component is not included in this page",method:"The method you called is not defined.",notFound:"The element you specified could not be found"},className:{active:"active",animating:"animating",blurring:"blurring",inverted:"inverted",legacy:"legacy",loading:"loading",scrolling:"scrolling",undetached:"undetached",front:"front",close:"close icon",button:"ui button",modal:"ui modal",title:"header",content:"content",actions:"actions",template:"ui tiny modal",ok:"positive",cancel:"negative",prompt:"ui fluid input",innerDimmer:"ui inverted dimmer"},text:{ok:"Ok",cancel:"Cancel",close:"Close"}},R.fn.modal.settings.templates={getArguments:function(e){e=[].slice.call(e);return R.isPlainObject(e[0])?R.extend({handler:function(){},content:"",title:""},e[0]):(R.isFunction(e[e.length-1])||e.push(function(){}),{handler:e.pop(),content:e.pop()||"",title:e.pop()||""})},alert:function(){var e=this.get.settings(),t=e.templates.getArguments(arguments),n=t.handler;return{title:t.title,content:t.content,onApprove:n,actions:[{text:e.text.ok,class:e.className.ok,click:n}]}},confirm:function(){function e(){i.handler(!0)}function t(){i.handler(!1)}var n=this.get.settings(),i=n.templates.getArguments(arguments);return{title:i.title,content:i.content,onApprove:e,onDeny:t,actions:[{text:n.text.ok,class:n.className.ok,click:e},{text:n.text.cancel,class:n.className.cancel,click:t}]}},prompt:function(){function e(){var e=n.get.settings(),e=n.get.element().find(e.selector.prompt)[0];o.handler(R(e).val())}function t(){o.handler(null)}var n=this,i=this.get.settings(),o=i.templates.getArguments(arguments);return 0===R(R.parseHTML(o.content)).filter(".ui.input").length&&(o.content+='<p><div class="'+i.className.prompt+'"><input placeholder="'+this.helpers.deQuote(o.placeholder||"")+'" type="text" value="'+this.helpers.deQuote(o.defaultValue||"")+'"></div></p>'),{title:o.title,content:o.content,onApprove:e,onDeny:t,actions:[{text:i.text.ok,class:i.className.ok,click:e},{text:i.text.cancel,class:i.className.cancel,click:t}]}}}}(jQuery,window,document);