core-install.mjs 12 KB

12
  1. /*! third party licenses: dist/vendor.LICENSE.txt */
  2. import{$ as t}from"./chunks/jquery-BdeSydBb.mjs";import{bS as m}from"./core-common.mjs";import{g as w}from"./chunks/requesttoken-a6i8BQgd.mjs";function v(s){return decodeURIComponent((new RegExp("[?|&]"+s+"=([^&;]+?)(&|#|;|$)").exec(location.search)||[,""])[1].replace(/\+/g,"%20"))||""}t.fn.extend({showPassword(s){const i={fn:null,args:{}};i.fn=s;const e=function(r){const a=t(r),n=t("<input />");return n.attr({type:"text",class:a.attr("class"),style:a.attr("style"),size:a.attr("size"),name:a.attr("name")+"-clone",tabindex:a.attr("tabindex"),autocomplete:"off"}),a.attr("placeholder")!==void 0&&n.attr("placeholder",a.attr("placeholder")),n},o=function(r,a){a.val(r.val())},l=function(r,a,n){r.is(":checked")?(o(a,n),n.show(),a.hide()):(o(n,a),n.hide(),a.show())};return this.each(function(){const r=t(this),a=t(r.data("typetoggle")),n=e(r);n.insertAfter(r),i.fn&&(i.args.input=r,i.args.checkbox=a,i.args.clone=n),a.bind("click",function(){l(a,r,n)}),r.bind("keyup",function(){o(r,n)}),n.bind("keyup",function(){o(n,r),r.trigger("keyup")}),n.bind("blur",function(){r.trigger("focusout")}),l(a,r,n),n.closest("form").submit(function(d){n.prop("type","password")}),i.fn&&i.fn(i.args)})}});(function(s){typeof define=="function"&&define.amd?define(["jquery","./controlgroup","./checkboxradio","../keycode","../widget"],s):s(jQuery)})(function(s){return s.widget("ui.button",{version:"1.13.2",defaultElement:"<button>",options:{classes:{"ui-button":"ui-corner-all"},disabled:null,icon:null,iconPosition:"beginning",label:null,showLabel:!0},_getCreateOptions:function(){var i,e=this._super()||{};return this.isInput=this.element.is("input"),i=this.element[0].disabled,i!=null&&(e.disabled=i),this.originalLabel=this.isInput?this.element.val():this.element.html(),this.originalLabel&&(e.label=this.originalLabel),e},_create:function(){!this.option.showLabel&!this.options.icon&&(this.options.showLabel=!0),this.options.disabled==null&&(this.options.disabled=this.element[0].disabled||!1),this.hasTitle=!!this.element.attr("title"),this.options.label&&this.options.label!==this.originalLabel&&(this.isInput?this.element.val(this.options.label):this.element.html(this.options.label)),this._addClass("ui-button","ui-widget"),this._setOption("disabled",this.options.disabled),this._enhance(),this.element.is("a")&&this._on({keyup:function(i){i.keyCode===s.ui.keyCode.SPACE&&(i.preventDefault(),this.element[0].click?this.element[0].click():this.element.trigger("click"))}})},_enhance:function(){this.element.is("button")||this.element.attr("role","button"),this.options.icon&&(this._updateIcon("icon",this.options.icon),this._updateTooltip())},_updateTooltip:function(){this.title=this.element.attr("title"),!this.options.showLabel&&!this.title&&this.element.attr("title",this.options.label)},_updateIcon:function(i,e){var o=i!=="iconPosition",l=o?this.options.iconPosition:e,r=l==="top"||l==="bottom";this.icon?o&&this._removeClass(this.icon,null,this.options.icon):(this.icon=s("<span>"),this._addClass(this.icon,"ui-button-icon","ui-icon"),this.options.showLabel||this._addClass("ui-button-icon-only")),o&&this._addClass(this.icon,null,e),this._attachIcon(l),r?(this._addClass(this.icon,null,"ui-widget-icon-block"),this.iconSpace&&this.iconSpace.remove()):(this.iconSpace||(this.iconSpace=s("<span> </span>"),this._addClass(this.iconSpace,"ui-button-icon-space")),this._removeClass(this.icon,null,"ui-wiget-icon-block"),this._attachIconSpace(l))},_destroy:function(){this.element.removeAttr("role"),this.icon&&this.icon.remove(),this.iconSpace&&this.iconSpace.remove(),this.hasTitle||this.element.removeAttr("title")},_attachIconSpace:function(i){this.icon[/^(?:end|bottom)/.test(i)?"before":"after"](this.iconSpace)},_attachIcon:function(i){this.element[/^(?:end|bottom)/.test(i)?"append":"prepend"](this.icon)},_setOptions:function(i){var e=i.showLabel===void 0?this.options.showLabel:i.showLabel,o=i.icon===void 0?this.options.icon:i.icon;!e&&!o&&(i.showLabel=!0),this._super(i)},_setOption:function(i,e){i==="icon"&&(e?this._updateIcon(i,e):this.icon&&(this.icon.remove(),this.iconSpace&&this.iconSpace.remove())),i==="iconPosition"&&this._updateIcon(i,e),i==="showLabel"&&(this._toggleClass("ui-button-icon-only",null,!e),this._updateTooltip()),i==="label"&&(this.isInput?this.element.val(e):(this.element.html(e),this.icon&&(this._attachIcon(this.options.iconPosition),this._attachIconSpace(this.options.iconPosition)))),this._super(i,e),i==="disabled"&&(this._toggleClass(null,"ui-state-disabled",e),this.element[0].disabled=e,e&&this.element.trigger("blur"))},refresh:function(){var i=this.element.is("input, button")?this.element[0].disabled:this.element.hasClass("ui-button-disabled");i!==this.options.disabled&&this._setOptions({disabled:i}),this._updateTooltip()}}),s.uiBackCompat!==!1&&(s.widget("ui.button",s.ui.button,{options:{text:!0,icons:{primary:null,secondary:null}},_create:function(){this.options.showLabel&&!this.options.text&&(this.options.showLabel=this.options.text),!this.options.showLabel&&this.options.text&&(this.options.text=this.options.showLabel),!this.options.icon&&(this.options.icons.primary||this.options.icons.secondary)?this.options.icons.primary?this.options.icon=this.options.icons.primary:(this.options.icon=this.options.icons.secondary,this.options.iconPosition="end"):this.options.icon&&(this.options.icons.primary=this.options.icon),this._super()},_setOption:function(i,e){if(i==="text"){this._super("showLabel",e);return}i==="showLabel"&&(this.options.text=e),i==="icon"&&(this.options.icons.primary=e),i==="icons"&&(e.primary?(this._super("icon",e.primary),this._super("iconPosition","beginning")):e.secondary&&(this._super("icon",e.secondary),this._super("iconPosition","end"))),this._superApply(arguments)}}),s.fn.button=function(i){return function(e){var o=typeof e=="string",l=Array.prototype.slice.call(arguments,1),r=this;return o?!this.length&&e==="instance"?r=void 0:this.each(function(){var a,n=s(this).attr("type"),d=n!=="checkbox"&&n!=="radio"?"button":"checkboxradio",h=s.data(this,"ui-"+d);if(e==="instance")return r=h,!1;if(!h)return s.error("cannot call methods on button prior to initialization; attempted to call method '"+e+"'");if(typeof h[e]!="function"||e.charAt(0)==="_")return s.error("no such method '"+e+"' for button widget instance");if(a=h[e].apply(h,l),a!==h&&a!==void 0)return r=a&&a.jquery?r.pushStack(a.get()):a,!1}):(l.length&&(e=s.widget.extend.apply(null,[e].concat(l))),this.each(function(){var a=s(this).attr("type"),n=a!=="checkbox"&&a!=="radio"?"button":"checkboxradio",d=s.data(this,"ui-"+n);if(d)d.option(e||{}),d._init&&d._init();else{if(n==="button"){i.call(s(this),e);return}s(this).checkboxradio(s.extend({icon:!1},e))}})),r}}(s.fn.button),s.fn.buttonset=function(){return s.ui.controlgroup||s.error("Controlgroup widget missing"),arguments[0]==="option"&&arguments[1]==="items"&&arguments[2]?this.controlgroup.apply(this,[arguments[0],"items.button",arguments[2]]):arguments[0]==="option"&&arguments[1]==="items"?this.controlgroup.apply(this,[arguments[0],"items.button"]):(typeof arguments[0]=="object"&&arguments[0].items&&(arguments[0].items={button:arguments[0].items}),this.controlgroup.apply(this,arguments))}),s.ui.button}),function(s){s.fn.strengthify=function(i){var e={zxcvbn:"zxcvbn/zxcvbn.js",userInputs:[],titles:["Weakest","Weak","So-so","Good","Perfect"],tilesOptions:{tooltip:!0,element:!1},drawTitles:!1,drawMessage:!1,drawBars:!0,$addAfter:null,nonce:null};return this.each(function(){var o=s.extend(e,i);!o.drawTitles&&!o.drawMessage&&!o.drawBars&&console.warn("expect at least one of 'drawTitles', 'drawMessage', or 'drawBars' to be true");function l(n){return s('div[data-strengthifyFor="'+n+'"]')}function r(){var n=s(this).val().substring(0,100),d=s(this).attr("id"),h=n===""?0:1,c=zxcvbn(n,o.userInputs),p="",f="",u="",b=l(d),y=b.find(".strengthify-container"),g=b.find("[data-strengthifyMessage]");switch(b.children().css("opacity",h).css("-ms-filter",'"progid:DXImageTransform.Microsoft.Alpha(Opacity='+h*100+')"'),o.onResult&&o.onResult(c),c.score){case 0:case 1:p="password-bad",f="danger",u=c.feedback?c.feedback.suggestions.join("<br/>"):"";break;case 2:f="warning",u=c.feedback?c.feedback.suggestions.join("<br/>"):"",p="password-medium";break;case 3:p="password-good",f="info",u="Getting better.";break;case 4:p="password-good",f="success",u="Looks good.";break}g&&(g.removeAttr("class"),g.addClass("bg-"+f),n===""&&(u=""),g.html(u)),y&&(y.attr("class",p+" strengthify-container").css("width",(c.score===0?1:c.score)*25+"%"),n===""&&y.css("width",0)),o.drawTitles&&(o.tilesOptions.tooltip&&(b.attr("title",o.titles[c.score]).tooltip({placement:"bottom",trigger:"manual"}).tooltip("fixTitle").tooltip("show"),h===0&&b.tooltip("hide")),o.tilesOptions.element&&b.find(".strengthify-tiles").text(o.titles[c.score]))}function a(){var n=s(this),d=n.attr("id"),h=r.bind(this),c=o.$addAfter;c||(c=n),c.after('<div class="strengthify-wrapper" data-strengthifyFor="'+n.attr("id")+'"></div>'),o.drawBars&&l(d).append('<div class="strengthify-bg" />').append('<div class="strengthify-container" />').append('<div class="strengthify-separator" style="left: 25%" />').append('<div class="strengthify-separator" style="left: 50%" />').append('<div class="strengthify-separator" style="left: 75%" />'),o.drawMessage&&l(d).append("<div data-strengthifyMessage></div>"),o.drawTitles&&o.tilesOptions&&l(d).append('<div class="strengthify-tiles"></div>');var p=document.createElement("script");p.src=o.zxcvbn,o.nonce!==null&&p.setAttribute("nonce",o.nonce),p.onload=function(){n.parent().on("scroll",h),n.bind("keyup input change",h)},document.head.appendChild(p)}a.call(this)})}}(jQuery),window.addEventListener("DOMContentLoaded",function(){const s={sqlite:!!t("#hasSQLite").val(),mysql:!!t("#hasMySQL").val(),postgresql:!!t("#hasPostgreSQL").val(),oracle:!!t("#hasOracle").val()};t("#selectDbType").buttonset(),t("#selectDbType p.info a").button("destroy"),t("#hasSQLite").val()?(t("#use_other_db").hide(),t("#use_oracle_db").hide()):t("#sqliteInformation").hide(),t("#adminlogin").change(function(){t("#adminlogin").val(t.trim(t("#adminlogin").val()))}),t("#sqlite").click(function(){t("#use_other_db").slideUp(250),t("#use_oracle_db").slideUp(250),t("#sqliteInformation").show(),t("#dbname").attr("pattern","[0-9a-zA-Z$_-]+")}),t("#mysql,#pgsql").click(function(){t("#use_other_db").slideDown(250),t("#use_oracle_db").slideUp(250),t("#sqliteInformation").hide(),t("#dbname").attr("pattern","[0-9a-zA-Z$_-]+")}),t("#oci").click(function(){t("#use_other_db").slideDown(250),t("#use_oracle_db").show(250),t("#sqliteInformation").hide(),t("#dbname").attr("pattern","[0-9a-zA-Z$_-.]+")}),t("#showAdvanced").click(function(e){e.preventDefault(),t("#datadirContent").slideToggle(250),t("#databaseBackend").slideToggle(250),t("#databaseField").slideToggle(250)}),t("form").submit(function(){const e=t(this).serializeArray();t(".float-spinner").show(250),t('input[type="submit"]').attr("disabled","disabled").val(t('input[type="submit"]').data("finishing")),t("input",this).addClass("ui-state-disabled").attr("disabled","disabled"),t("#selectDbType").find(".ui-button").length>0&&t("#selectDbType").buttonset("disable"),t(".strengthify-wrapper, .tipsy").css("filter","alpha(opacity=30)").css("opacity",.3);const o=t("<form>");o.attr("action",t(this).attr("action")),o.attr("method","POST");for(let r=0;r<e.length;r++){const a=t('<input type="hidden">');a.attr(e[r]),o.append(a)}const l=v("redirect_url");if(l){const r=t('<input type="hidden">');r.attr({name:"redirect_url",value:l}),o.append(r)}return o.appendTo(document.body),o.submit(),!1});const i=t('input[type="radio"]:checked').val();i===void 0&&t('input[type="radio"]').first().click(),(i==="sqlite"||s.sqlite&&i===void 0)&&(t("#datadirContent").hide(250),t("#databaseBackend").hide(250),t("#databaseField").hide(250),t(".float-spinner").hide(250)),t("#adminpass").strengthify({zxcvbn:OC.linkTo("core","vendor/zxcvbn/dist/zxcvbn.js"),titles:[m("core","Very weak password"),m("core","Weak password"),m("core","So-so password"),m("core","Good password"),m("core","Strong password")],drawTitles:!0,nonce:btoa(w())}),t("#dbpass").showPassword().keyup(),t(".toggle-password").click(function(e){e.preventDefault(),t(this).parent().children("input").attr("type")==="password"?t(this).parent().children("input").attr("type","text"):t(this).parent().children("input").attr("type","password")})});