mirror of
https://github.com/flarum/framework.git
synced 2024-12-14 16:13:50 +08:00
721e2eae3d
Includes transpiled JS/TS, and Typescript declaration files (typings). [skip ci]
2 lines
46 KiB
JavaScript
Executable File
Generated
2 lines
46 KiB
JavaScript
Executable File
Generated
(()=>{var t={647:function(t){t.exports=function(){"use strict";var t,e,a=1e3,n=6e4,s=36e5,r=864e5,o=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,i=31536e6,l=2592e6,m=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/,u={years:i,months:l,days:r,hours:s,minutes:n,seconds:a,milliseconds:1,weeks:6048e5},c=function(t){return t instanceof b},d=function(t,e,a){return new b(t,a,e.$l)},g=function(t){return e.p(t)+"s"},p=function(t){return t<0},h=function(t){return p(t)?Math.ceil(t):Math.floor(t)},f=function(t){return Math.abs(t)},x=function(t,e){return t?p(t)?{negative:!0,format:""+f(t)+e}:{negative:!1,format:""+t+e}:{negative:!1,format:""}},b=function(){function p(t,e,a){var n=this;if(this.$d={},this.$l=a,void 0===t&&(this.$ms=0,this.parseFromMilliseconds()),e)return d(t*u[g(e)],this);if("number"==typeof t)return this.$ms=t,this.parseFromMilliseconds(),this;if("object"==typeof t)return Object.keys(t).forEach((function(e){n.$d[g(e)]=t[e]})),this.calMilliseconds(),this;if("string"==typeof t){var s=t.match(m);if(s){var r=s.slice(2).map((function(t){return null!=t?Number(t):0}));return this.$d.years=r[0],this.$d.months=r[1],this.$d.weeks=r[2],this.$d.days=r[3],this.$d.hours=r[4],this.$d.minutes=r[5],this.$d.seconds=r[6],this.calMilliseconds(),this}}return this}var f=p.prototype;return f.calMilliseconds=function(){var t=this;this.$ms=Object.keys(this.$d).reduce((function(e,a){return e+(t.$d[a]||0)*u[a]}),0)},f.parseFromMilliseconds=function(){var t=this.$ms;this.$d.years=h(t/i),t%=i,this.$d.months=h(t/l),t%=l,this.$d.days=h(t/r),t%=r,this.$d.hours=h(t/s),t%=s,this.$d.minutes=h(t/n),t%=n,this.$d.seconds=h(t/a),t%=a,this.$d.milliseconds=t},f.toISOString=function(){var t=x(this.$d.years,"Y"),e=x(this.$d.months,"M"),a=+this.$d.days||0;this.$d.weeks&&(a+=7*this.$d.weeks);var n=x(a,"D"),s=x(this.$d.hours,"H"),r=x(this.$d.minutes,"M"),o=this.$d.seconds||0;this.$d.milliseconds&&(o+=this.$d.milliseconds/1e3);var i=x(o,"S"),l=t.negative||e.negative||n.negative||s.negative||r.negative||i.negative,m=s.format||r.format||i.format?"T":"",u=(l?"-":"")+"P"+t.format+e.format+n.format+m+s.format+r.format+i.format;return"P"===u||"-P"===u?"P0D":u},f.toJSON=function(){return this.toISOString()},f.format=function(t){var a=t||"YYYY-MM-DDTHH:mm:ss",n={Y:this.$d.years,YY:e.s(this.$d.years,2,"0"),YYYY:e.s(this.$d.years,4,"0"),M:this.$d.months,MM:e.s(this.$d.months,2,"0"),D:this.$d.days,DD:e.s(this.$d.days,2,"0"),H:this.$d.hours,HH:e.s(this.$d.hours,2,"0"),m:this.$d.minutes,mm:e.s(this.$d.minutes,2,"0"),s:this.$d.seconds,ss:e.s(this.$d.seconds,2,"0"),SSS:e.s(this.$d.milliseconds,3,"0")};return a.replace(o,(function(t,e){return e||String(n[t])}))},f.as=function(t){return this.$ms/u[g(t)]},f.get=function(t){var e=this.$ms,a=g(t);return"milliseconds"===a?e%=1e3:e="weeks"===a?h(e/u[a]):this.$d[a],0===e?0:e},f.add=function(t,e,a){var n;return n=e?t*u[g(e)]:c(t)?t.$ms:d(t,this).$ms,d(this.$ms+n*(a?-1:1),this)},f.subtract=function(t,e){return this.add(t,e,!0)},f.locale=function(t){var e=this.clone();return e.$l=t,e},f.clone=function(){return d(this.$ms,this)},f.humanize=function(e){return t().add(this.$ms,"ms").locale(this.$l).fromNow(!e)},f.milliseconds=function(){return this.get("milliseconds")},f.asMilliseconds=function(){return this.as("milliseconds")},f.seconds=function(){return this.get("seconds")},f.asSeconds=function(){return this.as("seconds")},f.minutes=function(){return this.get("minutes")},f.asMinutes=function(){return this.as("minutes")},f.hours=function(){return this.get("hours")},f.asHours=function(){return this.as("hours")},f.days=function(){return this.get("days")},f.asDays=function(){return this.as("days")},f.weeks=function(){return this.get("weeks")},f.asWeeks=function(){return this.as("weeks")},f.months=function(){return this.get("months")},f.asMonths=function(){return this.as("months")},f.years=function(){return this.get("years")},f.asYears=function(){return this.as("years")},p}();return function(a,n,s){t=s,e=s().$utils(),s.duration=function(t,e){var a=s.locale();return d(t,{$l:a},e)},s.isDuration=c;var r=n.prototype.add,o=n.prototype.subtract;n.prototype.add=function(t,e){return c(t)&&(t=t.asMilliseconds()),r.bind(this)(t,e)},n.prototype.subtract=function(t,e){return c(t)&&(t=t.asMilliseconds()),o.bind(this)(t,e)}}}()}},e={};function a(n){var s=e[n];if(void 0!==s)return s.exports;var r=e[n]={exports:{}};return t[n].call(r.exports,r,r.exports,a),r.exports}a.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return a.d(e,{a:e}),e},a.d=(t,e)=>{for(var n in e)a.o(e,n)&&!a.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},a.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),a.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n={};(()=>{"use strict";a.r(n);const t=flarum.reg.get("core","common/extend"),e=flarum.reg.get("core","admin/app");var s=a.n(e);const r=flarum.reg.get("core","admin/components/ExtensionPage");var o=a.n(r);const i=flarum.reg.get("core","common/components/Button");var l=a.n(i);const u=flarum.reg.get("core","admin/components/LoadingModal");var c=a.n(u);const d=flarum.reg.get("core","admin/utils/isExtensionEnabled");var g=a.n(d);const p=flarum.reg.get("core","common/Component");var h=a.n(p);const f=flarum.reg.get("core","common/components/LoadingIndicator");var x=a.n(f);const b=flarum.reg.get("core","common/components/Tooltip");var y=a.n(b);const v=flarum.reg.get("core","common/components/Icon");var _=a.n(v);const k=flarum.reg.get("core","common/utils/ItemList");var N=a.n(k);const M=flarum.reg.get("core","common/utils/extractText");var w=a.n(M);const E=flarum.reg.get("core","common/components/Link");var S=a.n(E);const U=flarum.reg.get("core","common/utils/classList");var B=a.n(U);class q extends(h()){view(t){const{className:e,type:a,...n}=this.attrs;return m("span",Object.assign({className:B()(["Label","Label--".concat(this.attrs.type),e])},n),t.children)}}flarum.reg.add("flarum-extension-manager","admin/components/Label",q);const j=flarum.reg.get("core","common/components/Modal");var T=a.n(j);class $ extends(T()){className(){return"Modal--large QuickModal"}title(){return s().translator.trans("flarum-extension-manager.admin.sections.queue.operations.".concat(this.attrs.task.operation()))}content(){return m("div",{className:"Modal-body"},m("div",{className:"TaskOutputModal-data"},"failure"===this.attrs.task.status()&&m("div",{className:"Form-group"},m("label",null,s().translator.trans("flarum-extension-manager.admin.sections.queue.output_modal.guessed_cause")),m("div",{className:"FormControl TaskOutputModal-data-guessed-cause"},this.attrs.task.guessedCause()&&s().translator.trans("flarum-extension-manager.admin.exceptions.guessed_cause."+this.attrs.task.guessedCause())||s().translator.trans("flarum-extension-manager.admin.sections.queue.output_modal.cause_unknown"))),m("div",{className:"Form-group"},m("label",null,s().translator.trans("flarum-extension-manager.admin.sections.queue.output_modal.command")),m("div",{className:"FormControl TaskOutputModal-data-command"},m("code",null,"$ composer ",this.attrs.task.command()))),m("div",{className:"Form-group"},m("label",null,s().translator.trans("flarum-extension-manager.admin.sections.queue.output_modal.output")),m("div",{className:"FormControl TaskOutputModal-data-output"},m("code",null,m("pre",null,this.attrs.task.output()))))))}}flarum.reg.add("flarum-extension-manager","admin/components/TaskOutputModal",$);var C=a(647),P=a.n(C);function F(t,e){dayjs.extend(P());const a=dayjs(e).diff(t);return dayjs.duration(a).humanize()}flarum.reg.add("flarum-extension-manager","admin/utils/humanDuration",F);class L extends(h()){view(){return m("nav",{className:"Pagination UserListPage-gridPagination"},m(l(),{disabled:!this.attrs.list.hasPrev()||s().extensionManager.control.isLoading(),title:s().translator.trans("core.admin.users.pagination.back_button"),onclick:()=>this.attrs.list.prev(),icon:"fas fa-chevron-left",className:"Button Button--icon UserListPage-backBtn"}),m("span",{className:"UserListPage-pageNumber"},s().translator.trans("core.admin.users.pagination.page_counter",{current:this.attrs.list.pageNumber()+1,total:this.attrs.list.getTotalPages()})),m(l(),{disabled:!this.attrs.list.hasNext()||s().extensionManager.control.isLoading(),title:s().translator.trans("core.admin.users.pagination.next_button"),onclick:()=>this.attrs.list.next(),icon:"fas fa-chevron-right",className:"Button Button--icon UserListPage-nextBtn"}))}}flarum.reg.add("flarum-extension-manager","admin/components/Pagination",L);class O extends(h()){oninit(t){super.oninit(t),s().extensionManager.queue.load()}view(){return m("section",{id:"ExtensionManager-queueSection",className:"ExtensionPage-permissions ExtensionManager-queueSection"},m("div",{className:"ExtensionPage-permissions-header ExtensionManager-queueSection-header"},m("div",{className:"container"},m("h2",{className:"ExtensionTitle"},s().translator.trans("flarum-extension-manager.admin.sections.queue.title")),m(l(),{className:"Button Button--icon",icon:"fas fa-sync-alt",onclick:()=>s().extensionManager.queue.load(),"aria-label":s().translator.trans("flarum-extension-manager.admin.sections.queue.refresh"),disabled:s().extensionManager.control.isLoading()}))),m("div",{className:"container"},this.queueTable()))}columns(){const t=new(N());return t.add("operation",{label:w()(s().translator.trans("flarum-extension-manager.admin.sections.queue.columns.operation")),content:t=>m("div",{className:"ExtensionManager-queueTable-operation"},m("span",{className:"ExtensionManager-queueTable-operation-icon"},this.operationIcon(t.operation())),m("span",{className:"ExtensionManager-queueTable-operation-name"},s().translator.trans("flarum-extension-manager.admin.sections.queue.operations.".concat(t.operation()))))},80),t.add("package",{label:w()(s().translator.trans("flarum-extension-manager.admin.sections.queue.columns.package")),content:t=>{var e;const a=s().data.extensions[null==(e=t.package())?void 0:e.replace(/(\/flarum-|\/flarum-ext-|\/)/g,"-")];return a?m(S(),{className:"ExtensionManager-queueTable-package",href:s().route("extension",{id:a.id})},m("div",{className:"ExtensionManager-queueTable-package-icon ExtensionIcon",style:a.icon},!!a.icon&&m(_(),{name:a.icon.name})),m("div",{className:"ExtensionManager-queueTable-package-details"},m("span",{className:"ExtensionManager-queueTable-package-title"},a.extra["flarum-extension"].title),m("span",{className:"ExtensionManager-queueTable-package-name"},t.package()))):t.package()}},75),t.add("status",{label:w()(s().translator.trans("flarum-extension-manager.admin.sections.queue.columns.status")),content:t=>m("[",null,m(q,{className:"ExtensionManager-queueTable-status",type:{running:"neutral",failure:"error",pending:"warning",success:"success"}[t.status()]},s().translator.trans("flarum-extension-manager.admin.sections.queue.statuses.".concat(t.status()))),["pending","running"].includes(t.status())&&m(x(),{size:"small",display:"inline"}))},70),t.add("elapsedTime",{label:w()(s().translator.trans("flarum-extension-manager.admin.sections.queue.columns.elapsed_time")),content:t=>t.startedAt()&&t.finishedAt()?m(y(),{text:"".concat(dayjs(t.startedAt()).format("LL LTS")," ").concat(dayjs(t.finishedAt()).format("LL LTS"))},m("span",null,F(t.startedAt(),t.finishedAt()))):s().translator.trans("flarum-extension-manager.admin.sections.queue.task_just_started")},65),t.add("memoryUsed",{label:w()(s().translator.trans("flarum-extension-manager.admin.sections.queue.columns.peak_memory_used")),content:t=>m("span",null,t.peakMemoryUsed())},60),t.add("details",{label:w()(s().translator.trans("flarum-extension-manager.admin.sections.queue.columns.details")),content:t=>m(l(),{className:"Button Button--icon Table-controls-item",icon:"fas fa-file-alt","aria-label":s().translator.trans("flarum-extension-manager.admin.sections.queue.columns.details"),onclick:()=>s().modal.show($,{task:t}),disabled:["pending","running"].includes(t.status())}),className:"Table-controls"},55),t}queueTable(){const t=s().extensionManager.queue.getItems();if(!t)return m(x(),null);if(t&&!t.length)return m("h3",{className:"ExtensionPage-subHeader"},s().translator.trans("flarum-extension-manager.admin.sections.queue.none"));const e=this.columns();return m("[",null,m("table",{className:"Table ExtensionManager-queueTable"},m("thead",null,m("tr",null,e.toArray().map(((t,e)=>m("th",{key:e},t.label))))),m("tbody",null,t.map(((t,a)=>m("tr",{key:a},e.toArray().map(((e,a)=>{const{label:n,content:s,...r}=e;return m("td",Object.assign({key:a},r),s(t))}))))))),m(L,{list:s().extensionManager.queue}))}operationIcon(t){return m(_(),{name:{update_check:"fas fa-sync-alt",update_major:"fas fa-play",update_minor:"fas fa-play",update_global:"fas fa-play",extension_install:"fas fa-download",extension_remove:"fas fa-times",extension_update:"fas fa-arrow-alt-circle-up",why_not:"fas fa-exclamation-circle"}[t]})}}flarum.reg.add("flarum-extension-manager","admin/components/QueueSection",O);const A=flarum.reg.get("core","common/components/Alert");var D=a.n(A);function I(t){return I="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},I(t)}function Y(t,e,a){return(e=function(t){var e=function(t,e){if("object"!==I(t)||null===t)return t;var a=t[Symbol.toPrimitive];if(void 0!==a){var n=a.call(t,e);if("object"!==I(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t,"string");return"symbol"===I(e)?e:String(e)}(e))in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}const R=flarum.reg.get("core","common/utils/Stream");var G=a.n(R);class W extends(h()){constructor(){super(...arguments),Y(this,"packageName",void 0)}oninit(t){super.oninit(t),this.packageName=G()("")}view(){return m("div",{className:"Form-group ExtensionManager-installer"},m("label",{htmlFor:"install-extension"},s().translator.trans("flarum-extension-manager.admin.extensions.install")),m("div",{className:"helpText"},s().translator.trans("flarum-extension-manager.admin.extensions.install_help",{extiverse:m("a",{href:"https://extiverse.com"},"extiverse.com"),semantic_link:m("a",{href:"https://devhints.io/semver"}),code:m("code",null)})),m("div",{className:"FormControl-container"},m("input",{className:"FormControl",id:"install-extension",placeholder:"vendor/package-name",bidi:this.packageName}),m(l(),{className:"Button",icon:"fas fa-download",onclick:this.onsubmit.bind(this),loading:s().extensionManager.control.isLoading("extension-install"),disabled:s().extensionManager.control.hasOperationRunning()},s().translator.trans("flarum-extension-manager.admin.extensions.proceed"))))}data(){return{package:this.packageName()}}onsubmit(){s().extensionManager.control.requirePackage(this.data())}}flarum.reg.add("flarum-extension-manager","admin/components/Installer",W);const H=flarum.reg.get("core","common/helpers/humanTime");var Q=a.n(H);function J(t){s().extensionManager.control.setLoading(null);const e=t.response.errors[0];if(!["composer_command_failure","extension_already_installed","extension_not_installed"].includes(e.code))throw t;switch(s().alerts.clear(),e.code){case"composer_command_failure":e.guessed_cause?(s().alerts.show({type:"error"},s().translator.trans("flarum-extension-manager.admin.exceptions.guessed_cause.".concat(e.guessed_cause))),s().modal.close()):s().alerts.show({type:"error"},s().translator.trans("flarum-extension-manager.admin.exceptions.composer_command_failure"));break;case"extension_already_installed":s().alerts.show({type:"error"},s().translator.trans("flarum-extension-manager.admin.exceptions.extension_already_installed")),s().modal.close();break;case"extension_not_installed":s().alerts.show({type:"error"},s().translator.trans("flarum-extension-manager.admin.exceptions.extension_not_installed")),s().modal.close()}}class V extends(T()){constructor(){super(...arguments),Y(this,"loading",!0),Y(this,"whyNot",null)}className(){return"Modal--large WhyNotModal"}title(){return s().translator.trans("flarum-extension-manager.admin.why_not_modal.title")}oncreate(t){super.oncreate(t),this.requestWhyNot()}content(){return m("div",{className:"Modal-body"},this.loading?m(x(),null):m("pre",{className:"WhyNotModal-contents"},this.whyNot))}requestWhyNot(){s().request({method:"POST",url:"".concat(s().forum.attribute("apiUrl"),"/extension-manager/why-not"),body:{data:{package:this.attrs.package}}}).then((t=>{this.loading=!1,this.whyNot=t.data.reason,m.redraw()})).catch(J)}}flarum.reg.add("flarum-extension-manager","admin/components/WhyNotModal",V);const Z=flarum.reg.get("core","common/components/Dropdown");var z=a.n(Z);class K extends(h()){view(t){var e;const{extension:a,updates:n,onClickUpdate:r,whyNotWarning:o,isCore:i,isDanger:u}=this.attrs,c=null!=(e=n["latest-minor"])?e:n["latest-major"]&&!i?n["latest-major"]:null;return m("div",{className:B()({"ExtensionManager-extension":!0,"ExtensionManager-extension--core":i,"ExtensionManager-extension--danger":u})},m("div",{className:"ExtensionManager-extension-icon ExtensionIcon",style:a.icon},a.icon?m(_(),{name:a.icon.name}):""),m("div",{className:"ExtensionManager-extension-info"},m("div",{className:"ExtensionManager-extension-name"},a.extra["flarum-extension"].title),m("div",{className:"ExtensionManager-extension-version"},m("span",{className:"ExtensionManager-extension-version-current"},this.version(n.version)),c?m(q,{className:"ExtensionManager-extension-version-latest",type:n["latest-minor"]?"success":"warning"},this.version(c)):null)),m("div",{className:"ExtensionManager-extension-controls"},r&&"function"==typeof r?m(y(),{text:s().translator.trans("flarum-extension-manager.admin.extensions.update")},m(l(),{icon:"fas fa-arrow-alt-circle-up",className:"Button Button--icon Button--flat",onclick:r,"aria-label":s().translator.trans("flarum-extension-manager.admin.extensions.update")})):r?m(z(),{buttonClassName:"Button Button--icon Button--flat",icon:"fas fa-arrow-alt-circle-up",label:s().translator.trans("flarum-extension-manager.admin.extensions.update")},m(l(),{icon:"fas fa-arrow-alt-circle-up",className:"Button",onclick:r.soft},s().translator.trans("flarum-extension-manager.admin.extensions.update_soft_label")),m(l(),{icon:"fas fa-arrow-alt-circle-up",className:"Button",onclick:r.hard,disabled:!n["direct-dependency"]},s().translator.trans("flarum-extension-manager.admin.extensions.update_hard_label"))):null,o?m(y(),{text:s().translator.trans("flarum-extension-manager.admin.extensions.check_why_it_failed_updating")},m(l(),{icon:"fas fa-exclamation-circle",className:"Button Button--icon Button--flat Button--danger",onclick:()=>s().modal.show(V,{package:a.name}),"aria-label":s().translator.trans("flarum-extension-manager.admin.extensions.check_why_it_failed_updating")})):null))}version(t){return"v"===t.charAt(0)?t.substring(1):t}}flarum.reg.add("flarum-extension-manager","admin/components/ExtensionItem",K);class X extends(h()){constructor(){super(...arguments),Y(this,"updateState",void 0)}oninit(t){super.oninit(t),this.updateState=this.attrs.updateState}view(){return m("div",{className:B()("Form-group Form-group--danger ExtensionManager-majorUpdate",{"ExtensionManager-majorUpdate--failed":"failure"===this.updateState.status,"ExtensionManager-majorUpdate--incompatibleExtensions":this.updateState.incompatibleExtensions.length})},m("img",{alt:"flarum logo",src:s().forum.attribute("baseUrl")+"/assets/extensions/flarum-extension-manager/flarum.svg"}),m("label",null,s().translator.trans("flarum-extension-manager.admin.major_updater.title",{version:this.attrs.coreUpdate["latest-major"]})),m("p",{className:"helpText"},s().translator.trans("flarum-extension-manager.admin.major_updater.description")),m("div",{className:"ExtensionManager-updaterControls"},m(y(),{text:s().translator.trans("flarum-extension-manager.admin.major_updater.dry_run_help")},m(l(),{className:"Button",icon:"fas fa-vial",onclick:this.update.bind(this,!0),disabled:s().extensionManager.control.hasOperationRunning()},s().translator.trans("flarum-extension-manager.admin.major_updater.dry_run"))),m(l(),{className:"Button Button--danger",icon:"fas fa-play",onclick:this.update.bind(this,!1),disabled:s().extensionManager.control.hasOperationRunning()},s().translator.trans("flarum-extension-manager.admin.major_updater.update"))),this.updateState.incompatibleExtensions.length?m("div",{className:"ExtensionManager-majorUpdate-incompatibleExtensions ExtensionManager-extensions-grid"},this.updateState.incompatibleExtensions.map((t=>m(K,{extension:s().data.extensions[t.replace("flarum-","").replace("flarum-ext-","").replace("/","-")],updates:{},onClickUpdate:null,isDanger:!0})))):null,"failure"===this.updateState.status?m(D(),{type:"error",className:"ExtensionManager-majorUpdate-failure",dismissible:!1,controls:[m(l(),{className:"Button Button--text ExtensionManager-majorUpdate-failure-details",icon:"fas fa-question-circle",onclick:()=>s().modal.show(V,{package:"flarum/core"})},s().translator.trans("flarum-extension-manager.admin.major_updater.failure.why"))]},m("p",{className:"ExtensionManager-majorUpdate-failure-desc"},s().translator.trans("flarum-extension-manager.admin.major_updater.failure.desc"))):null)}update(t){s().extensionManager.control.majorUpdate({dryRun:t})}}flarum.reg.add("flarum-extension-manager","admin/components/MajorUpdater",X);class tt extends(h()){view(){const t=s().extensionManager.control.coreUpdate;return[m("div",{className:"Form-group"},m("label",null,s().translator.trans("flarum-extension-manager.admin.updater.updater_title")),m("div",{className:"helpText"},s().translator.trans("flarum-extension-manager.admin.updater.updater_help")),this.lastUpdateCheckView(),m("div",{className:"ExtensionManager-updaterControls"},this.controlItems().toArray()),this.availableUpdatesView()),t&&t.package["latest-major"]?m(X,{coreUpdate:t.package,updateState:s().extensionManager.control.lastUpdateRun.major}):null]}lastUpdateCheckView(){var t;return(null==(t=s().extensionManager.control.lastUpdateCheck)?void 0:t.checkedAt)&&m("p",{className:"ExtensionManager-lastUpdatedAt"},m("span",{className:"ExtensionManager-lastUpdatedAt-label"},s().translator.trans("flarum-extension-manager.admin.updater.last_update_checked_at")),m("span",{className:"ExtensionManager-lastUpdatedAt-value"},Q()(s().extensionManager.control.lastUpdateCheck.checkedAt)))||null}availableUpdatesView(){const t=s().extensionManager.control;if(s().extensionManager.control.isLoading("check")||s().extensionManager.control.isLoading("global-update"))return m("div",{className:"ExtensionManager-extensions"},m(x(),null));const e=t.coreUpdate&&t.coreUpdate.package["latest-minor"];return t.extensionUpdates.length||e?m("div",{className:"ExtensionManager-extensions"},m("div",{className:"ExtensionManager-extensions-grid"},e?m(K,{extension:t.coreUpdate.extension,updates:t.coreUpdate.package,isCore:!0,onClickUpdate:()=>t.updateCoreMinor(),whyNotWarning:t.lastUpdateRun.limitedPackages().includes("flarum/core")}):null,t.extensionUpdates.map((e=>m(K,{extension:e,updates:t.packageUpdates[e.id],onClickUpdate:{soft:()=>t.updateExtension(e,"soft"),hard:()=>t.updateExtension(e,"hard")},whyNotWarning:t.lastUpdateRun.limitedPackages().includes(e.name)}))))):m("div",{className:"ExtensionManager-extensions"},m("span",{className:"helpText"},s().translator.trans("flarum-extension-manager.admin.updater.up_to_date")))}controlItems(){const t=new(N());return t.add("updateCheck",m(l(),{className:"Button",icon:"fas fa-sync-alt",onclick:()=>s().extensionManager.control.checkForUpdates(),loading:s().extensionManager.control.isLoading("check"),disabled:s().extensionManager.control.hasOperationRunning()},s().translator.trans("flarum-extension-manager.admin.updater.check_for_updates")),100),t.add("globalUpdate",m(l(),{className:"Button",icon:"fas fa-play",onclick:()=>s().extensionManager.control.updateGlobally(),loading:s().extensionManager.control.isLoading("global-update"),disabled:s().extensionManager.control.hasOperationRunning()},s().translator.trans("flarum-extension-manager.admin.updater.run_global_update"))),t}}flarum.reg.add("flarum-extension-manager","admin/components/Updater",tt);const et=flarum.reg.get("core","common/components/Form");var at=a.n(et);class nt extends(h()){oninit(t){super.oninit(t)}view(){return m("div",{className:"ExtensionPage-permissions ExtensionManager-controlSection"},m("div",{className:"ExtensionPage-permissions-header"},m("div",{className:"container"},m("h2",{className:"ExtensionTitle"},s().translator.trans("flarum-extension-manager.admin.sections.control.title")))),m("div",{className:"container"},s().data["flarum-extension-manager.writable_dirs"]?m(at(),null,m(W,null),m(tt,null)):m("div",{className:"Form-group"},m(D(),{type:"warning",dismissible:!1},s().translator.trans("flarum-extension-manager.admin.file_permissions")))))}}flarum.reg.add("flarum-extension-manager","admin/components/ControlSection",nt);const st=flarum.reg.get("core","admin/components/AdminPage");var rt=a.n(st);class ot extends(h()){constructor(){super(...arguments),Y(this,"settings",{}),Y(this,"initialSettings",null),Y(this,"loading",!1),Y(this,"type",void 0)}oninit(t){super.oninit(t),this.submit(!0)}className(){return""}view(){return m("div",{className:B()("FormSection",this.className())},m("label",null,this.title()),this.content(),m("div",{className:"Form-group Form-controls"},this.submitButton()))}submitButton(){return[m(l(),{className:"Button Button--primary",loading:this.loading,onclick:()=>this.submit(!1),disabled:!this.isDirty()},s().translator.trans("core.admin.settings.submit_button"))]}customSettingComponents(){return rt().prototype.customSettingComponents()}setting(t){var e;return null!=(e=this.settings[t])?e:this.settings[t]=G()()}submit(t){this.loading=!0;const e={};Object.keys(this.settings).forEach((t=>{e[t]=this.settings[t]()})),s().request({method:"POST",url:s().forum.attribute("apiUrl")+"/extension-manager/composer",body:{type:this.type,data:t?null:e}}).then((t=>{let{data:e}=t;Object.keys(e).forEach((t=>{this.settings[t]=G()(e[t])})),this.initialSettings=Array.isArray(e)?{}:e})).finally((()=>{this.loading=!1,m.redraw()}))}isDirty(){return JSON.stringify(this.initialSettings)!==JSON.stringify(this.settings)}}flarum.reg.add("flarum-extension-manager","admin/components/ConfigureJson",ot);const it=flarum.reg.get("core","common/components/Select");var lt=a.n(it);class mt extends(T()){constructor(){super(...arguments),Y(this,"name",void 0),Y(this,"repository",void 0)}oninit(t){super.oninit(t),this.name=G()(this.attrs.name||""),this.repository=G()(this.attrs.repository||{type:"composer",url:""})}className(){return"RepositoryModal Modal--small"}title(){const t=this.attrs.repository?"edit":"add";return s().translator.trans("flarum-extension-manager.admin.composer.".concat(t,"_repository_label"))}content(){const t={composer:s().translator.trans("flarum-extension-manager.admin.composer.repositories.types.composer"),vcs:s().translator.trans("flarum-extension-manager.admin.composer.repositories.types.vcs"),path:s().translator.trans("flarum-extension-manager.admin.composer.repositories.types.path")};return m("div",{className:"Modal-body"},m("div",{className:"Form-group"},m("label",null,s().translator.trans("flarum-extension-manager.admin.composer.repositories.add_modal.name_label")),m("input",{className:"FormControl",bidi:this.name})),m("div",{className:"Form-group"},m("label",null,s().translator.trans("flarum-extension-manager.admin.composer.repositories.add_modal.type_label")),m(lt(),{options:t,value:this.repository().type,onchange:t=>this.repository({...this.repository(),type:t})})),m("div",{className:"Form-group"},m("label",null,s().translator.trans("flarum-extension-manager.admin.composer.repositories.add_modal.url")),m("input",{className:"FormControl",onchange:t=>this.repository({...this.repository(),url:t.target.value}),value:this.repository().url})),m("div",{className:"Form-group"},m(l(),{className:"Button Button--primary",onclick:this.submit.bind(this)},s().translator.trans("flarum-extension-manager.admin.composer.repositories.add_modal.submit_button"))))}submit(){this.attrs.onsubmit(this.repository(),this.name()),this.hide()}}flarum.reg.add("flarum-extension-manager","admin/components/RepositoryModal",mt);class ut extends ot{constructor(){super(...arguments),Y(this,"type","composer")}title(){return s().translator.trans("flarum-extension-manager.admin.composer.title")}className(){return"ConfigureComposer"}content(){return m("div",{className:"Form ExtensionManager-SettingsGroups-content"},this.attrs.buildSettingComponent.call(this,{setting:"minimum-stability",label:s().translator.trans("flarum-extension-manager.admin.composer.minimum_stability.label"),help:s().translator.trans("flarum-extension-manager.admin.composer.minimum_stability.help"),type:"select",options:{stable:s().translator.trans("flarum-extension-manager.admin.composer.minimum_stability.options.stable"),RC:s().translator.trans("flarum-extension-manager.admin.composer.minimum_stability.options.rc"),beta:s().translator.trans("flarum-extension-manager.admin.composer.minimum_stability.options.beta"),alpha:s().translator.trans("flarum-extension-manager.admin.composer.minimum_stability.options.alpha"),dev:s().translator.trans("flarum-extension-manager.admin.composer.minimum_stability.options.dev")}}),m("div",{className:"Form-group"},m("label",null,s().translator.trans("flarum-extension-manager.admin.composer.repositories.label")),m("div",{className:"helpText"},s().translator.trans("flarum-extension-manager.admin.composer.repositories.help")),m("div",{className:"ConfigureComposer-repositories"},Object.keys(this.setting("repositories")()||{}).map((t=>{const e=this.setting("repositories")()[t];return m("div",{className:"ButtonGroup ButtonGroup--full"},m(l(),{className:"Button",icon:{composer:"fas fa-cubes",vcs:"fas fa-code-branch",path:"fas fa-folder"}[e.type],onclick:()=>s().modal.show(mt,{name:t,repository:e,onsubmit:(e,a)=>{const n=this.setting("repositories")();delete n[t],this.setting("repositories")(n),this.onchange(e,a)}})},t," (",e.type,")"),m(l(),{className:"Button Button--icon",icon:"fas fa-trash","aria-label":s().translator.trans("flarum-extension-manager.admin.composer.delete_repository_label"),onclick:()=>{if(confirm(w()(s().translator.trans("flarum-extension-manager.admin.composer.delete_repository_confirmation")))){const e={...this.setting("repositories")()};delete e[t],this.setting("repositories")(e)}}}))})))))}submitButton(){const t=super.submitButton();return t.push(m(l(),{className:"Button",onclick:()=>s().modal.show(mt,{onsubmit:this.onchange.bind(this)})},s().translator.trans("flarum-extension-manager.admin.composer.add_repository_label"))),t}onchange(t,e){this.setting("repositories")({...this.setting("repositories")(),[e]:t})}}flarum.reg.add("flarum-extension-manager","admin/components/ConfigureComposer",ut);const ct=flarum.reg.get("core","common/helpers/listItems");var dt=a.n(ct);class gt extends(T()){constructor(){super(...arguments),Y(this,"type",void 0),Y(this,"host",void 0),Y(this,"token",void 0)}oninit(t){super.oninit(t),this.type=G()(this.attrs.type||"bearer"),this.host=G()(this.attrs.host||""),this.token=G()(this.attrs.token||"")}className(){return"AuthMethodModal Modal--small"}title(){const t=this.attrs.host?"edit":"add";return s().translator.trans("flarum-extension-manager.admin.auth_config.".concat(t,"_label"))}content(){const t={"github-oauth":s().translator.trans("flarum-extension-manager.admin.auth_config.types.github-oauth"),"gitlab-oauth":s().translator.trans("flarum-extension-manager.admin.auth_config.types.gitlab-oauth"),"gitlab-token":s().translator.trans("flarum-extension-manager.admin.auth_config.types.gitlab-token"),bearer:s().translator.trans("flarum-extension-manager.admin.auth_config.types.bearer")};return m("div",{className:"Modal-body"},m("div",{className:"Form-group"},m("label",null,s().translator.trans("flarum-extension-manager.admin.auth_config.add_modal.type_label")),m(lt(),{options:t,value:this.type(),onchange:this.type})),m("div",{className:"Form-group"},m("label",null,s().translator.trans("flarum-extension-manager.admin.auth_config.add_modal.host_label")),m("input",{className:"FormControl",bidi:this.host,placeholder:s().translator.trans("flarum-extension-manager.admin.auth_config.add_modal.host_placeholder")})),m("div",{className:"Form-group"},m("label",null,s().translator.trans("flarum-extension-manager.admin.auth_config.add_modal.token_label")),m("textarea",{className:"FormControl",oninput:t=>this.token(t.target.value),rows:"6",placeholder:this.token().startsWith("unchanged:")?w()(s().translator.trans("flarum-extension-manager.admin.auth_config.add_modal.unchanged_token_placeholder")):""},this.token().startsWith("unchanged:")?"":this.token())),m("div",{className:"Form-group"},m(l(),{className:"Button Button--primary",onclick:this.submit.bind(this)},s().translator.trans("flarum-extension-manager.admin.auth_config.add_modal.submit_button"))))}submit(){this.attrs.onsubmit(this.type(),this.host(),this.token()),this.hide()}}flarum.reg.add("flarum-extension-manager","admin/components/AuthMethodModal",gt);class pt extends ot{constructor(){super(...arguments),Y(this,"type","auth")}title(){return s().translator.trans("flarum-extension-manager.admin.auth_config.title")}className(){return"ConfigureAuth"}content(){const t=Object.keys(this.settings),e=t.length&&t.every((t=>{const e=this.settings[t]();return Array.isArray(e)?e.length:Object.keys(e).length}));return m("div",{className:"ExtensionManager-SettingsGroups-content"},e?t.map((t=>{const e=this.settings[t]();return m("div",{className:"Form-group"},m("label",null,s().translator.trans("flarum-extension-manager.admin.auth_config.types.".concat(t))),m("div",{className:"ConfigureAuth-hosts"},Object.keys(e).map((a=>{const n=e[a];return m("div",{className:"ButtonGroup ButtonGroup--full"},m(l(),{className:"Button",icon:"fas fa-key",onclick:()=>s().modal.show(gt,{type:t,host:a,token:n,onsubmit:this.onchange.bind(this,a)})},a),m(l(),{className:"Button Button--icon",icon:"fas fa-trash","aria-label":s().translator.trans("flarum-extension-manager.admin.auth_config.delete_label"),onclick:()=>{if(confirm(w()(s().translator.trans("flarum-extension-manager.admin.auth_config.delete_confirmation")))){const e={...this.setting(t)()};delete e[a],Object.keys(e).length?this.setting(t)(e):delete this.settings[t]}}}))}))))})):m("span",{className:"helpText"},s().translator.trans("flarum-extension-manager.admin.auth_config.no_auth_methods_configured")))}submitButton(){const t=super.submitButton();return t.push(m(l(),{className:"Button",loading:this.loading,onclick:()=>s().modal.show(gt,{onsubmit:this.onchange.bind(this,null)})},s().translator.trans("flarum-extension-manager.admin.auth_config.add_label"))),t}onchange(t,e,a,n){const s={...this.setting(e)()};t&&delete s[t],s[a]=n,this.setting(e)(s)}}flarum.reg.add("flarum-extension-manager","admin/components/ConfigureAuth",pt);class ht extends(o()){content(){const t=s().extensionData.getSettings(this.extension.id),e=[s().translator.trans("flarum-extension-manager.admin.settings.access_warning")];return s().data.debugEnabled&&e.push(s().translator.trans("flarum-extension-manager.admin.settings.debug_mode_warning")),m("div",{className:"ExtensionPage-settings"},m("div",{className:"container"},m("div",{className:"ExtensionManager-warnings Form-group"},m(D(),{className:"ExtensionManager-primaryWarning",type:"warning",dismissible:!1},m("ul",null,dt()(e)))),t?m("div",{className:"FormSectionGroup ExtensionManager-SettingsGroups"},m("div",{className:"FormSection"},m("label",null,s().translator.trans("flarum-extension-manager.admin.settings.title")),m("div",{className:"Form"},t.map(this.buildSettingComponent.bind(this))),m("div",{className:"Form-group Form--controls"},this.submitButton())),m(ut,{buildSettingComponent:this.buildSettingComponent}),m(pt,{buildSettingComponent:this.buildSettingComponent})):m("h3",{className:"ExtensionPage-subHeader"},s().translator.trans("core.admin.extension.no_settings"))))}sections(t){const e=super.sections(t);return e.setPriority("content",10),e.add("control",m(nt,null),8),"0"!==s().data.settings["flarum-extension-manager.queue_jobs"]&&s().data.settings["flarum-extension-manager.queue_jobs"]&&e.add("queue",m(O,null),5),e.remove("permissions"),e}onsaved(){super.onsaved(),m.redraw()}}flarum.reg.add("flarum-extension-manager","admin/components/SettingsPage",ht);const ft=flarum.reg.get("core","common/Model");var xt=a.n(ft);const bt=["B","kB","MB","GB","TB","PB","EB","ZB","YB"],yt=["B","kiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"],vt=["b","kbit","Mbit","Gbit","Tbit","Pbit","Ebit","Zbit","Ybit"],_t=["b","kibit","Mibit","Gibit","Tibit","Pibit","Eibit","Zibit","Yibit"],kt=(t,e,a)=>{let n=t;return"string"==typeof e||Array.isArray(e)?n=t.toLocaleString(e,a):!0!==e&&void 0===a||(n=t.toLocaleString(void 0,a)),n};class Nt extends(xt()){status(){return xt().attribute("status").call(this)}operation(){return xt().attribute("operation").call(this)}command(){return xt().attribute("command").call(this)}package(){return xt().attribute("package").call(this)}output(){return xt().attribute("output").call(this)}guessedCause(){return xt().attribute("guessedCause").call(this)}createdAt(){return xt().attribute("createdAt",xt().transformDate).call(this)}startedAt(){return xt().attribute("startedAt",xt().transformDate).call(this)}finishedAt(){return xt().attribute("finishedAt",xt().transformDate).call(this)}peakMemoryUsed(){return function(t,e){if(!Number.isFinite(t))throw new TypeError("Expected a finite number, got ".concat(typeof t,": ").concat(t));const a=(e={bits:!1,binary:!1,...e}).bits?e.binary?_t:vt:e.binary?yt:bt;if(e.signed&&0===t)return" 0 ".concat(a[0]);const n=t<0,s=n?"-":e.signed?"+":"";let r;if(n&&(t=-t),void 0!==e.minimumFractionDigits&&(r={minimumFractionDigits:e.minimumFractionDigits}),void 0!==e.maximumFractionDigits&&(r={maximumFractionDigits:e.maximumFractionDigits,...r}),t<1)return s+kt(t,e.locale,r)+" "+a[0];const o=Math.min(Math.floor(e.binary?Math.log(t)/Math.log(1024):Math.log10(t)/3),a.length-1);return t/=(e.binary?1024:1e3)**o,r||(t=t.toPrecision(3)),s+kt(Number(t),e.locale,r)+" "+a[o]}(1024*xt().attribute("peakMemoryUsed").call(this))}}function Mt(){s().modal.close(),m.route.set(s().route("extension",{id:"flarum-extension-manager"})),s().extensionManager.queue.load({},!0),setTimeout((()=>{var t;null==(t=document.getElementById("ExtensionManager-queueSection"))||t.scrollIntoView({block:"nearest"})}),200)}flarum.reg.add("flarum-extension-manager","admin/models/Task",Nt),window.jumpToQueue=Mt,flarum.reg.add("flarum-extension-manager","admin/utils/jumpToQueue",Mt);class wt{constructor(){Y(this,"polling",null),Y(this,"tasks",null),Y(this,"limit",20),Y(this,"offset",0),Y(this,"total",0)}load(t,e){var a;return void 0===e&&(e=!1),this.tasks=null,t={page:{limit:this.limit,offset:this.offset,...null==(a=t)?void 0:a.page},...t},s().store.find("extension-manager-tasks",t||{}).then((t=>{var a;return this.tasks=t,this.total=null==(a=t.payload.meta)?void 0:a.total,m.redraw(),(null==t?void 0:t.find((t=>"pending"===t.status()||"running"===t.status())))?this.pollQueue(e):e?(s().extensionManager.control.setLoading(null),window.location.reload()):s().extensionManager.control.isLoading()&&s().extensionManager.control.setLoading(null),t}))}getItems(){return this.tasks}getTotalPages(){return Math.ceil(this.total/this.limit)}pageNumber(){return Math.ceil(this.offset/this.limit)}hasPrev(){return 0!==this.pageNumber()}hasNext(){return this.offset+this.limit<this.total}prev(){this.hasPrev()&&(this.offset-=this.limit,this.load())}next(){this.hasNext()&&(this.offset+=this.limit,this.load())}pollQueue(t){void 0===t&&(t=!1),this.polling&&clearTimeout(this.polling),this.polling=setTimeout((()=>{this.load({},t)}),6e3)}hasPending(){var t;return!(null==(t=this.tasks)||!t.find((t=>"pending"===t.status()||"running"===t.status())))}}flarum.reg.add("flarum-extension-manager","admin/states/QueueState",wt);class Et{get lastUpdateRun(){const t=JSON.parse(s().data.settings["flarum-extension-manager.last_update_run"]);return t.limitedPackages=()=>[...t.major.limitedPackages,...t.minor.limitedPackages,...t.global.limitedPackages],t}constructor(){Y(this,"loading",null),Y(this,"packageUpdates",{}),Y(this,"lastUpdateCheck",void 0),Y(this,"extensionUpdates",void 0),Y(this,"coreUpdate",null),this.lastUpdateCheck=JSON.parse(s().data.settings["flarum-extension-manager.last_update_check"]),this.extensionUpdates=this.formatExtensionUpdates(this.lastUpdateCheck),this.coreUpdate=this.formatCoreUpdate(this.lastUpdateCheck)}isLoading(t){return void 0===t&&(t=null),t&&this.loading===t||!t&&null!==this.loading}hasOperationRunning(){return this.isLoading()||s().extensionManager.queue.hasPending()}setLoading(t){this.loading=t}requirePackage(t){s().extensionManager.control.setLoading("extension-install"),s().modal.show(c()),s().request({method:"POST",url:"".concat(s().forum.attribute("apiUrl"),"/extension-manager/extensions"),body:{data:t}}).then((t=>{if(t.processing)Mt();else{const e=t.id;s().alerts.show({type:"success"},s().translator.trans("flarum-extension-manager.admin.extensions.successful_install",{extension:e})),window.location.href="".concat(s().forum.attribute("adminUrl"),"#/extension/").concat(e),window.location.reload()}})).catch(J).finally((()=>{s().modal.close(),m.redraw()}))}checkForUpdates(){this.setLoading("check"),s().request({method:"POST",url:"".concat(s().forum.attribute("apiUrl"),"/extension-manager/check-for-updates")}).then((t=>{t.processing?Mt():(this.lastUpdateCheck=t,this.extensionUpdates=this.formatExtensionUpdates(t),this.coreUpdate=this.formatCoreUpdate(t),this.setLoading(null),m.redraw())})).catch(J).finally((()=>{m.redraw()}))}updateCoreMinor(){confirm(w()(s().translator.trans("flarum-extension-manager.admin.minor_update_confirmation.content")))&&(s().modal.show(c()),this.setLoading("minor-update"),s().request({method:"POST",url:"".concat(s().forum.attribute("apiUrl"),"/extension-manager/minor-update")}).then((t=>{null!=t&&t.processing?Mt():(s().alerts.show({type:"success"},s().translator.trans("flarum-extension-manager.admin.update_successful")),window.location.reload())})).catch(J).finally((()=>{s().modal.close(),m.redraw()})))}updateExtension(t,e){s().modal.show(c()),this.setLoading("extension-update"),s().request({method:"PATCH",url:"".concat(s().forum.attribute("apiUrl"),"/extension-manager/extensions/").concat(t.id),body:{data:{updateMode:e}}}).then((e=>{null!=e&&e.processing?Mt():(s().alerts.show({type:"success"},s().translator.trans("flarum-extension-manager.admin.extensions.successful_update",{extension:t.extra["flarum-extension"].title})),window.location.reload())})).catch(J).finally((()=>{s().modal.close(),m.redraw()}))}updateGlobally(){s().modal.show(c()),this.setLoading("global-update"),s().request({method:"POST",url:"".concat(s().forum.attribute("apiUrl"),"/extension-manager/global-update")}).then((t=>{null!=t&&t.processing?Mt():(s().alerts.show({type:"success"},s().translator.trans("flarum-extension-manager.admin.updater.global_update_successful")),window.location.reload())})).catch(J).finally((()=>{s().modal.close(),m.redraw()}))}formatExtensionUpdates(t){var e,a;return this.packageUpdates={},null==t||null==(e=t.updates)||null==(a=e.installed)||a.filter((t=>{const e=t.name.replace("/","-").replace(/(flarum-ext-)|(flarum-)/,""),a=s().data.extensions[e],n=["semver-safe-update","update-possible"].includes(t["latest-status"]);return a&&n&&(this.packageUpdates[a.id]=t),a&&n})),Object.values(s().data.extensions).filter((t=>this.packageUpdates[t.id]))}formatCoreUpdate(t){var e,a;const n=null==t||null==(e=t.updates)||null==(a=e.installed)?void 0:a.filter((t=>"flarum/core"===t.name)).pop();return n?{package:n,extension:{id:"flarum-core",name:"flarum/core",version:s().data.settings.version,icon:{backgroundImage:"url(".concat(s().data.resources[0].attributes.baseUrl,"/assets/extensions/flarum-extension-manager/flarum.svg")},extra:{"flarum-extension":{title:w()(s().translator.trans("flarum-extension-manager.admin.updater.flarum"))}}}}:null}majorUpdate(t){let{dryRun:e}=t;s().extensionManager.control.setLoading(e?"major-update-dry-run":"major-update"),s().modal.show(c());const a=this.lastUpdateRun.major;s().request({method:"POST",url:"".concat(s().forum.attribute("apiUrl"),"/extension-manager/major-update"),body:{data:{dryRun:e}}}).then((t=>{null!=t&&t.processing?Mt():(s().alerts.show({type:"success"},s().translator.trans("flarum-extension-manager.admin.update_successful")),window.location.reload())})).catch(J).catch((t=>{var e,n,r;s().modal.close(),a.status="failure",a.incompatibleExtensions=null==(e=t.response)||null==(n=e.errors)||null==(r=n.pop())?void 0:r.incompatible_extensions})).finally((()=>{m.redraw()}))}}flarum.reg.add("flarum-extension-manager","admin/states/ControlSectionState",Et);class St{constructor(){Y(this,"queue",new wt),Y(this,"control",new Et)}}flarum.reg.add("flarum-extension-manager","admin/states/ExtensionManagerState",St),s().initializers.add("flarum-extension-manager",(e=>{e.store.models["extension-manager-tasks"]=Nt,e.extensionManager=new St,e.data["flarum-extension-manager.using_sync_queue"]&&(e.data.settings["flarum-extension-manager.queue_jobs"]="0"),e.extensionData.for("flarum-extension-manager").registerSetting({setting:"flarum-extension-manager.queue_jobs",label:e.translator.trans("flarum-extension-manager.admin.settings.queue_jobs"),help:m.trust(w()(e.translator.trans("flarum-extension-manager.admin.settings.queue_jobs_help",{basic_impl_link:"https://discuss.flarum.org/d/28151-database-queue-the-simplest-queue-even-for-shared-hosting",adv_impl_link:"https://discuss.flarum.org/d/21873-redis-sessions-cache-queues",php_version:"<strong>".concat(e.data.phpVersion,"</strong>"),folder_perms_link:"https://docs.flarum.org/install#folder-ownership"}))),type:"boolean",disabled:e.data["flarum-extension-manager.using_sync_queue"]}).registerSetting({setting:"flarum-extension-manager.task_retention_days",label:e.translator.trans("flarum-extension-manager.admin.settings.task_retention_days"),help:e.translator.trans("flarum-extension-manager.admin.settings.task_retention_days_help"),type:"number"}).registerPage(ht),(0,t.extend)(o().prototype,"topItems",(function(t){"flarum-extension-manager"===this.extension.id||g()(this.extension.id)||t.add("remove",m(l(),{className:"Button Button--danger",icon:"fas fa-times",onclick:()=>{e.modal.show(c()),e.request({url:"".concat(e.forum.attribute("apiUrl"),"/extension-manager/extensions/").concat(this.extension.id),method:"DELETE"}).then((t=>{null!=t&&t.processing?Mt():(e.alerts.show({type:"success"},e.translator.trans("flarum-extension-manager.admin.extensions.successful_remove")),window.location=e.forum.attribute("adminUrl"))})).finally((()=>{e.modal.close()}))}},e.translator.trans("flarum-extension-manager.admin.extensions.remove")))}))}))})(),module.exports=n})();
|
|
//# sourceMappingURL=admin.js.map
|