Files
everything/EveryThing/wwwroot/vendor/libs/bootbox/bootbox.js
David Štaleker db0cc8d3de prvi
2025-07-18 05:33:16 +02:00

16 lines
15 KiB
JavaScript

!function(t,e){var o=function(t){var e={};function o(r){if(e[r])return e[r].exports;var n=e[r]={i:r,l:!1,exports:{}};return t[r].call(n.exports,n,n.exports,o),n.l=!0,n.exports}return o.m=t,o.c=e,o.d=function(t,e,r){o.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},o.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},o.t=function(t,e){if(1&e&&(t=o(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(o.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)o.d(r,n,function(e){return t[e]}.bind(null,n));return r},o.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return o.d(e,"a",e),e},o.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},o.p="",o(o.s=329)}({1:function(t,e){t.exports=window.jQuery},329:function(t,e,o){"use strict";o.r(e);var r=o(89);o.n(r),o.d(e,"bootbox",function(){return r})},89:function(t,e,o){var r,n,a;
/*! @preserve
* bootbox.js
* version: 5.0.1
* author: Nick Payne <nick@kurai.co.uk>
* license: MIT
* http://bootboxjs.com/
*/
/*! @preserve
* bootbox.js
* version: 5.0.1
* author: Nick Payne <nick@kurai.co.uk>
* license: MIT
* http://bootboxjs.com/
*/
!function(i,l){"use strict";n=[o(1)],void 0===(a="function"==typeof(r=function t(e,o){var r,n,a,i;Object.keys||(Object.keys=(r=Object.prototype.hasOwnProperty,n=!{toString:null}.propertyIsEnumerable("toString"),i=(a=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"]).length,function(t){if("function"!=typeof t&&("object"!=typeof t||null===t))throw new TypeError("Object.keys called on non-object");var e,o,l=[];for(e in t)r.call(t,e)&&l.push(e);if(n)for(o=0;o<i;o++)r.call(t,a[o])&&l.push(a[o]);return l}));var l={VERSION:"5.0.0"},s={},c={dialog:'<div class="bootbox modal" tabindex="-1" role="dialog" aria-hidden="true"><div class="modal-dialog"><div class="modal-content"><div class="modal-body"><div class="bootbox-body"></div></div></div></div></div>',header:'<div class="modal-header"><h5 class="modal-title"></h5></div>',footer:'<div class="modal-footer"></div>',closeButton:'<button type="button" class="bootbox-close-button close" aria-hidden="true">&times;</button>',form:'<form class="bootbox-form"></form>',button:'<button type="button" class="btn"></button>',option:"<option></option>",promptMessage:'<div class="bootbox-prompt-message"></div>',inputs:{text:'<input class="bootbox-input bootbox-input-text form-control" autocomplete="off" type="text" />',textarea:'<textarea class="bootbox-input bootbox-input-textarea form-control"></textarea>',email:'<input class="bootbox-input bootbox-input-email form-control" autocomplete="off" type="email" />',select:'<select class="bootbox-input bootbox-input-select form-control"></select>',checkbox:'<div class="form-check checkbox"><label class="form-check-label"><input class="form-check-input bootbox-input bootbox-input-checkbox" type="checkbox" /></label></div>',radio:'<div class="form-check radio"><label class="form-check-label"><input class="form-check-input bootbox-input bootbox-input-radio" type="radio" name="bootbox-radio" /></label></div>',date:'<input class="bootbox-input bootbox-input-date form-control" autocomplete="off" type="date" />',time:'<input class="bootbox-input bootbox-input-time form-control" autocomplete="off" type="time" />',number:'<input class="bootbox-input bootbox-input-number form-control" autocomplete="off" type="number" />',password:'<input class="bootbox-input bootbox-input-password form-control" autocomplete="off" type="password" />',range:'<input class="bootbox-input bootbox-input-range form-control-range" autocomplete="off" type="range" />'}},u={locale:"en",backdrop:"static",animate:!0,className:null,closeButton:!0,show:!0,container:"body",value:"",inputType:"text",swapButtonOrder:!1,centerVertical:!1,multiple:!1};function p(t,o,r){return e.extend(!0,{},t,function(t,e){var o=t.length,r={};if(o<1||o>2)throw new Error("Invalid argument length");return 2===o||"string"==typeof t[0]?(r[e[0]]=t[0],r[e[1]]=t[1]):r=t[0],r}(o,r))}function d(t,e,r,n){var a;if(n&&n[0]){a=n[0].locale||u.locale;var i=n[0].swapButtonOrder||u.swapButtonOrder;i&&(e=e.reverse())}var l,s,c,d={className:"bootbox-"+t,buttons:f(e,a)};return l=p(d,n,r),c={},h(s=e,function(t,e){c[e]=!0}),h(l.buttons,function(t){if(c[t]===o)throw new Error('button key "'+t+'" is not allowed (options are '+s.join(" ")+")")}),l}function f(t,e){for(var o={},r=0,n=t.length;r<n;r++){var a=t[r],i=a.toLowerCase(),l=a.toUpperCase();o[i]={label:b(l,e)}}return o}function b(t,e){var o=s[e];return o?o[t]:s.en[t]}function m(t){return Object.keys(t).length}function h(t,o){var r=0;e.each(t,function(t,e){o(t,e,r++)})}function v(t,o,r){t.stopPropagation(),t.preventDefault();var n=e.isFunction(r)&&!1===r.call(o,t);n||o.modal("hide")}function w(t){return/([01][0-9]|2[0-3]):[0-5][0-9]?:[0-5][0-9]/.test(t)}function y(t){return/(\d{4})-(\d{2})-(\d{2})/.test(t)}return l.locales=function(t){return t?s[t]:s},l.addLocale=function(t,o){return e.each(["OK","CANCEL","CONFIRM"],function(t,e){if(!o[e])throw new Error('Please supply a translation for "'+e+'"')}),s[t]={OK:o.OK,CANCEL:o.CANCEL,CONFIRM:o.CONFIRM},l},l.removeLocale=function(t){if("en"===t)throw new Error('"en" is used as the default and fallback locale and cannot be removed.');return delete s[t],l},l.setLocale=function(t){return l.setDefaults("locale",t)},l.setDefaults=function(){var t={};return 2===arguments.length?t[arguments[0]]=arguments[1]:t=arguments[0],e.extend(u,t),l},l.hideAll=function(){return e(".bootbox").modal("hide"),l},l.init=function(o){return t(o||e)},l.dialog=function(t){if(e.fn.modal===o)throw new Error('"$.fn.modal" is not defined; please double check you have included the Bootstrap JavaScript library. See http://getbootstrap.com/javascript/ for more details.');if(t=function(t){var o,r;if("object"!=typeof t)throw new Error("Please supply an object of options");if(!t.message)throw new Error('"message" option must not be null or an empty string.');return(t=e.extend({},u,t)).buttons||(t.buttons={}),o=t.buttons,r=m(o),h(o,function(n,a,i){if(e.isFunction(a)&&(a=o[n]={callback:a}),"object"!==e.type(a))throw new Error('button with key "'+n+'" must be an object');if(a.label||(a.label=n),!a.className){var l=!1;l=t.swapButtonOrder?0===i:i===r-1,a.className=r<=2&&l?"btn-primary":"btn-secondary btn-default"}}),t}(t),e.fn.modal.Constructor.VERSION){t.fullBootstrapVersion=e.fn.modal.Constructor.VERSION;var r=t.fullBootstrapVersion.indexOf(".");t.bootstrap=t.fullBootstrapVersion.substring(0,r)}else t.bootstrap="2",t.fullBootstrapVersion="2.3.2",console.warn("Bootbox will *mostly* work with Bootstrap 2, but we do not officially support it. Please upgrade, if possible.");var n=e(c.dialog),a=n.find(".modal-dialog"),i=n.find(".modal-body"),l=e(c.header),s=e(c.footer),p=t.buttons,d={onEscape:t.onEscape};if(i.find(".bootbox-body").html(t.message),m(t.buttons)>0&&(h(p,function(t,o){var r=e(c.button);switch(r.data("bb-handler",t),r.addClass(o.className),t){case"ok":case"confirm":r.addClass("bootbox-accept");break;case"cancel":r.addClass("bootbox-cancel")}r.html(o.label),s.append(r),d[t]=o.callback}),i.after(s)),!0===t.animate&&n.addClass("fade"),t.className&&n.addClass(t.className),t.size&&(t.fullBootstrapVersion.substring(0,3)<"3.1"&&console.warn('"size" requires Bootstrap 3.1.0 or higher. You appear to be using '+t.fullBootstrapVersion+". Please upgrade to use this option."),"large"===t.size?a.addClass("modal-lg"):"small"===t.size&&a.addClass("modal-sm")),t.title&&(i.before(l),n.find(".modal-title").html(t.title)),t.closeButton){var f=e(c.closeButton);t.title?t.bootstrap>3?n.find(".modal-header").append(f):n.find(".modal-header").prepend(f):f.prependTo(i)}return t.centerVertical&&(t.fullBootstrapVersion<"4.0.0"&&console.warn('"centerVertical" requires Bootstrap 4.0.0-beta.3 or higher. You appear to be using '+t.fullBootstrapVersion+". Please upgrade to use this option."),a.addClass("modal-dialog-centered")),n.one("hide.bs.modal",function(t){t.target===this&&(n.off("escape.close.bb"),n.off("click"))}),n.one("hidden.bs.modal",function(t){t.target===this&&n.remove()}),n.one("shown.bs.modal",function(){n.find(".bootbox-accept:first").trigger("focus")}),"static"!==t.backdrop&&n.on("click.dismiss.bs.modal",function(t){n.children(".modal-backdrop").length&&(t.currentTarget=n.children(".modal-backdrop").get(0)),t.target===t.currentTarget&&n.trigger("escape.close.bb")}),n.on("escape.close.bb",function(t){d.onEscape&&v(t,n,d.onEscape)}),n.on("click",".modal-footer button:not(.disabled)",function(t){var o=e(this).data("bb-handler");v(t,n,d[o])}),n.on("click",".bootbox-close-button",function(t){v(t,n,d.onEscape)}),n.on("keyup",function(t){27===t.which&&n.trigger("escape.close.bb")}),e(t.container).append(n),n.modal({backdrop:!!t.backdrop&&"static",keyboard:!1,show:!1}),t.show&&n.modal("show"),n},l.alert=function(){var t;if((t=d("alert",["ok"],["message","callback"],arguments)).callback&&!e.isFunction(t.callback))throw new Error('alert requires the "callback" property to be a function when provided');return t.buttons.ok.callback=t.onEscape=function(){return!e.isFunction(t.callback)||t.callback.call(this)},l.dialog(t)},l.confirm=function(){var t;if(t=d("confirm",["cancel","confirm"],["message","callback"],arguments),!e.isFunction(t.callback))throw new Error("confirm requires a callback");return t.buttons.cancel.callback=t.onEscape=function(){return t.callback.call(this,!1)},t.buttons.confirm.callback=function(){return t.callback.call(this,!0)},l.dialog(t)},l.prompt=function(){var t,r,n,a,i,s;if(n=e(c.form),(t=d("prompt",["cancel","confirm"],["title","callback"],arguments)).value||(t.value=u.value),t.inputType||(t.inputType=u.inputType),i=t.show===o?u.show:t.show,t.show=!1,t.buttons.cancel.callback=t.onEscape=function(){return t.callback.call(this,null)},t.buttons.confirm.callback=function(){var o;if("checkbox"===t.inputType)o=a.find("input:checked").map(function(){return e(this).val()}).get();else if("radio"===t.inputType)o=a.find("input:checked").val();else{if(a[0].checkValidity&&!a[0].checkValidity())return!1;o="select"===t.inputType&&!0===t.multiple?a.find("option:selected").map(function(){return e(this).val()}).get():a.val()}return t.callback.call(this,o)},!t.title)throw new Error("prompt requires a title");if(!e.isFunction(t.callback))throw new Error("prompt requires a callback");if(!c.inputs[t.inputType])throw new Error("Invalid prompt type");switch(a=e(c.inputs[t.inputType]),t.inputType){case"text":case"textarea":case"email":case"password":a.val(t.value),t.placeholder&&a.attr("placeholder",t.placeholder),t.pattern&&a.attr("pattern",t.pattern),t.maxlength&&a.attr("maxlength",t.maxlength),t.required&&a.prop({required:!0});break;case"date":case"time":case"number":case"range":if(a.val(t.value),t.placeholder&&a.attr("placeholder",t.placeholder),t.pattern&&a.attr("pattern",t.pattern),t.required&&a.prop({required:!0}),"date"!==t.inputType&&t.step){if(!("any"===t.step||!isNaN(t.step)&&parseInt(t.step)>0))throw new Error('"step" must be a valid positive number or the value "any". See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-step for more information.');a.attr("step",t.step)}(function(t,e,r){var n=!1,a=!0,i=!0;if("date"===t)e===o||(a=y(e))?r===o||(i=y(r))||console.warn('Browsers which natively support the "date" input type expect date values to be of the form "YYYY-MM-DD" (see ISO-8601 https://www.iso.org/iso-8601-date-and-time-format.html). Bootbox does not enforce this rule, but your max value may not be enforced by this browser.'):console.warn('Browsers which natively support the "date" input type expect date values to be of the form "YYYY-MM-DD" (see ISO-8601 https://www.iso.org/iso-8601-date-and-time-format.html). Bootbox does not enforce this rule, but your min value may not be enforced by this browser.');else if("time"===t){if(e!==o&&!(a=w(e)))throw new Error('"min" is not a valid time. See https://www.w3.org/TR/2012/WD-html-markup-20120315/datatypes.html#form.data.time for more information.');if(r!==o&&!(i=w(r)))throw new Error('"max" is not a valid time. See https://www.w3.org/TR/2012/WD-html-markup-20120315/datatypes.html#form.data.time for more information.')}else{if(e!==o&&isNaN(e))throw new Error('"min" must be a valid number. See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-min for more information.');if(r!==o&&isNaN(r))throw new Error('"max" must be a valid number. See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-max for more information.')}if(a&&i){if(r<=e)throw new Error('"max" must be greater than "min". See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-max for more information.');n=!0}return n})(t.inputType,t.min,t.max)&&(t.min!==o&&a.attr("min",t.min),t.max!==o&&a.attr("max",t.max));break;case"select":var p={};if(s=t.inputOptions||[],!e.isArray(s))throw new Error("Please pass an array of input options");if(!s.length)throw new Error('prompt with "inputType" set to "select" requires at least one option');t.placeholder&&a.attr("placeholder",t.placeholder),t.required&&a.prop({required:!0}),t.multiple&&a.prop({multiple:!0}),h(s,function(t,r){var n=a;if(r.value===o||r.text===o)throw new Error('each option needs a "value" property and a "text" property');r.group&&(p[r.group]||(p[r.group]=e("<optgroup />").attr("label",r.group)),n=p[r.group]);var i=e(c.option);i.attr("value",r.value).text(r.text),n.append(i)}),h(p,function(t,e){a.append(e)}),a.val(t.value);break;case"checkbox":var f=e.isArray(t.value)?t.value:[t.value];if(!(s=t.inputOptions||[]).length)throw new Error('prompt with "inputType" set to "checkbox" requires at least one option');a=e('<div class="bootbox-checkbox-list"></div>'),h(s,function(r,n){if(n.value===o||n.text===o)throw new Error('each option needs a "value" property and a "text" property');var i=e(c.inputs[t.inputType]);i.find("input").attr("value",n.value),i.find("label").append("\n"+n.text),h(f,function(t,e){e===n.value&&i.find("input").prop("checked",!0)}),a.append(i)});break;case"radio":if(t.value!==o&&e.isArray(t.value))throw new Error('prompt with "inputType" set to "radio" requires a single, non-array value for "value"');if(!(s=t.inputOptions||[]).length)throw new Error('prompt with "inputType" set to "radio" requires at least one option');a=e('<div class="bootbox-radiobutton-list"></div>');var b=!0;h(s,function(r,n){if(n.value===o||n.text===o)throw new Error('each option needs a "value" property and a "text" property');var i=e(c.inputs[t.inputType]);i.find("input").attr("value",n.value),i.find("label").append("\n"+n.text),t.value!==o&&n.value===t.value&&(i.find("input").prop("checked",!0),b=!1),a.append(i)}),b&&a.find('input[type="radio"]').first().prop("checked",!0)}if(n.append(a),n.on("submit",function(t){t.preventDefault(),t.stopPropagation(),r.find(".bootbox-accept").trigger("click")}),""!==e.trim(t.message)){var m=e(c.promptMessage).html(t.message);n.prepend(m),t.message=n}else t.message=n;return(r=l.dialog(t)).off("shown.bs.modal"),r.on("shown.bs.modal",function(){a.focus()}),!0===i&&r.modal("show"),r},l.addLocale("en",{OK:"OK",CANCEL:"Cancel",CONFIRM:"OK"}),l})?r.apply(e,n):r)||(t.exports=a)}()}});if("object"==typeof o){var r=["object"==typeof module&&"object"==typeof module.exports?module.exports:null,"undefined"!=typeof window?window:null,t&&t!==window?t:null];for(var n in o)r[0]&&(r[0][n]=o[n]),r[1]&&"__esModule"!==n&&(r[1][n]=o[n]),r[2]&&(r[2][n]=o[n])}}(this);