From a3192d293429e407f0974aff32f3f340fd491dc7 Mon Sep 17 00:00:00 2001 From: flarum-bot Date: Sun, 29 Oct 2023 13:51:57 +0000 Subject: [PATCH] Bundled output for commit 96ba2f5f2d1d0e41557ecac576bc422986fff0a0 Includes transpiled JS/TS, and Typescript declaration files (typings). [skip ci] --- extensions/tags/js/dist/common/components/TagSelectionModal.js | 2 +- .../tags/js/dist/common/components/TagSelectionModal.js.map | 2 +- extensions/tags/js/dist/forum/components/TagDiscussionModal.js | 2 +- .../tags/js/dist/forum/components/TagDiscussionModal.js.map | 2 +- framework/core/js/dist/forum.js | 2 +- framework/core/js/dist/forum.js.map | 2 +- framework/core/js/dist/forum/components/Composer.js | 2 +- framework/core/js/dist/forum/components/Composer.js.map | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/extensions/tags/js/dist/common/components/TagSelectionModal.js b/extensions/tags/js/dist/common/components/TagSelectionModal.js index f95b19136..2856d5a89 100644 --- a/extensions/tags/js/dist/common/components/TagSelectionModal.js +++ b/extensions/tags/js/dist/common/components/TagSelectionModal.js @@ -1,2 +1,2 @@ -"use strict";(self.webpackChunkmodule_exports=self.webpackChunkmodule_exports||[]).push([[162],{610:(t,e,s)=>{s.r(e),s.d(e,{default:()=>S});var i=s(905),a=s(351),n=s.n(a),l=s(645),r=s.n(l),o=s(836),c=s.n(o),d=s(596),h=s.n(d),u=s(291),g=s.n(u),p=s(657),f=s.n(p),y=s(149),T=s.n(y),b=s(686),x=s.n(b),w=s(636),v=s.n(w),I=s(648),N=s(924),_=s(974),C=s(997);class S extends(x()){constructor(){super(...arguments),(0,i.Z)(this,"loading",!0),(0,i.Z)(this,"tags",void 0),(0,i.Z)(this,"selected",[]),(0,i.Z)(this,"bypassReqs",!1),(0,i.Z)(this,"filter",v()("")),(0,i.Z)(this,"focused",!1),(0,i.Z)(this,"navigator",new(f())),(0,i.Z)(this,"indexTag",void 0)}static initAttrs(t){var e,s,i,a,l,r,o,m,c,d,u,g,p,f,y,T,b,x;super.initAttrs(t),t.title||(t.title=h()(n().translator.trans("flarum-tags.lib.tag_selection_modal.title"))),t.canSelect||(t.canSelect=()=>!0),null!=t.allowResetting||(t.allowResetting=!0),t.limits={min:{total:null!=(e=null==(s=t.limits)||null==(i=s.min)?void 0:i.total)?e:-1/0,primary:null!=(a=null==(l=t.limits)||null==(r=l.min)?void 0:r.primary)?a:-1/0,secondary:null!=(o=null==(m=t.limits)||null==(c=m.min)?void 0:c.secondary)?o:-1/0},max:{total:null!=(d=null==(u=t.limits)||null==(g=u.max)?void 0:g.total)?d:1/0,primary:null!=(p=null==(f=t.limits)||null==(y=f.max)?void 0:y.primary)?p:1/0,secondary:null!=(T=null==(b=t.limits)||null==(x=b.max)?void 0:x.secondary)?T:1/0}},function(t){if(t.min.primary>t.max.primary)throw new Error("The minimum number of primary tags allowed cannot be more than the maximum number of primary tags allowed.");if(t.min.secondary>t.max.secondary)throw new Error("The minimum number of secondary tags allowed cannot be more than the maximum number of secondary tags allowed.");if(t.min.total>t.max.primary+t.max.secondary)throw new Error("The minimum number of tags allowed cannot be more than the maximum number of primary and secondary tags allowed together.");if(t.max.totalt.max.total)throw new Error("The minimum number of tags allowed cannot be more than the maximum number of tags allowed.")}(t.limits)}oninit(t){super.oninit(t),this.navigator.onUp((()=>this.setIndex(this.getCurrentNumericIndex()-1,!0))).onDown((()=>this.setIndex(this.getCurrentNumericIndex()+1,!0))).onSelect(this.select.bind(this)).onRemove((()=>this.selected.splice(this.selected.length-1,1))),n().tagList.load(["parent"]).then((t=>{this.loading=!1,this.attrs.selectableTags&&(t=this.attrs.selectableTags(t)),this.tags=(0,I.Z)(t),this.attrs.selectedTags&&this.attrs.selectedTags.map(this.addTag.bind(this)),this.indexTag=t[0],m.redraw()}))}className(){return c()("TagSelectionModal",this.attrs.className)}title(){return this.attrs.title}content(){if(this.loading||!this.tags)return m(T(),null);const t=this.filter().toLowerCase(),e=this.primaryCount(),s=this.secondaryCount(),i=this.getFilteredTags(),a=Math.max(h()(this.getInstruction(e,s)).length,this.filter().length);return[m("div",{className:"Modal-body"},m("div",{className:"TagSelectionModal-form"},m("div",{className:"TagSelectionModal-form-input"},m("div",{className:"TagsInput FormControl "+(this.focused?"focus":""),onclick:()=>this.$(".TagsInput input").focus()},m("span",{className:"TagsInput-selected"},this.selected.map((t=>m("span",{className:"TagsInput-tag",onclick:()=>{this.removeTag(t),this.onready()}},(0,N.Z)(t))))),m("input",{className:"FormControl",placeholder:h()(this.getInstruction(e,s)),bidi:this.filter,style:{width:a+"ch"},onkeydown:this.navigator.navigate.bind(this.navigator),onfocus:()=>this.focused=!0,onblur:()=>this.focused=!1}))),m("div",{className:"TagSelectionModal-form-submit App-primaryControl"},m(r(),{type:"submit",className:"Button Button--primary",disabled:!this.meetsRequirements(e,s),icon:"fas fa-check"},n().translator.trans("flarum-tags.lib.tag_selection_modal.submit_button"))))),m("div",{className:"Modal-footer"},m("ul",{className:"TagSelectionModal-list SelectTagList"},i.map((e=>m("li",{"data-index":e.id(),className:c()({pinned:null!==e.position(),child:!!e.parent(),colored:!!e.color(),selected:this.selected.includes(e),active:this.indexTag===e}),style:{color:e.color()},onmouseover:()=>this.indexTag=e,onclick:this.toggleTag.bind(this,e)},(0,_.Z)(e),m("span",{className:"SelectTagListItem-name"},g()(e.name(),t)),e.description()?m("span",{className:"SelectTagListItem-description"},e.description()):"")))),this.attrs.limits.allowBypassing&&m("div",{className:"TagSelectionModal-controls"},m(C.Z,{className:"Button",onclick:()=>this.bypassReqs=!this.bypassReqs,isToggled:this.bypassReqs},n().translator.trans("flarum-tags.lib.tag_selection_modal.bypass_requirements"))))]}getFilteredTags(){const t=this.filter().toLowerCase(),e=this.primaryCount(),s=this.secondaryCount();let i=this.tags;return this.attrs.requireParentTag&&(i=i.filter((t=>{const e=t.parent();return null!==e&&(!1===e||this.selected.includes(e))}))),this.bypassReqs||(this.selected.length>=this.attrs.limits.max.total?i=i.filter((t=>this.selected.includes(t))):(e>=this.attrs.limits.max.primary&&(i=i.filter((t=>!t.isPrimary()||this.selected.includes(t)))),s>=this.attrs.limits.max.secondary&&(i=i.filter((t=>t.isPrimary()||this.selected.includes(t)))))),t&&(i=i.filter((e=>e.name().toLowerCase().includes(t)))),this.indexTag&&i.includes(this.indexTag)||(this.indexTag=i[0]),i}primaryCount(){return this.selected.filter((t=>t.isPrimary())).length}secondaryCount(){return this.selected.filter((t=>!t.isPrimary())).length}meetsRequirements(t,e){return!!(this.bypassReqs||this.attrs.allowResetting&&0===this.selected.length)||!(this.selected.length=this.attrs.limits.min.primary&&e>=this.attrs.limits.min.secondary}addTag(t){if(t&&this.attrs.canSelect(t)){if(this.attrs.onSelect&&this.attrs.onSelect(t,this.selected),this.attrs.requireParentTag){const e=t.parent();e&&!this.selected.includes(e)&&this.selected.push(e)}this.selected.includes(t)||this.selected.push(t)}}removeTag(t){const e=this.selected.indexOf(t);-1!==e&&(this.selected.splice(e,1),this.attrs.requireParentTag&&this.selected.filter((e=>e.parent()===t)).forEach(this.removeTag.bind(this)),this.attrs.onDeselect&&this.attrs.onDeselect(t,this.selected))}toggleTag(t){this.tags&&(this.selected.includes(t)?this.removeTag(t):this.addTag(t),this.filter()&&(this.filter(""),this.indexTag=this.tags[0]),this.onready())}getInstruction(t,e){if(this.bypassReqs)return"";if(t li")}getCurrentNumericIndex(){return this.indexTag?this.selectableItems().index(this.getItem(this.indexTag)):-1}getItem(t){return this.selectableItems().filter('[data-index="'.concat(t.id(),'"]'))}setIndex(t,e){const s=this.selectableItems(),i=s.parent();t<0?t=s.length-1:t>=s.length&&(t=0);const a=s.eq(t);if(this.indexTag=n().store.getById("tags",a.attr("data-index")),m.redraw(),e&&this.indexTag){const t=i.scrollTop(),e=i.offset().top,s=e+i.outerHeight(),n=a.offset().top,l=n+a.outerHeight();let r;ns&&(r=t-s+l+parseInt(i.css("padding-bottom"),10)),void 0!==r&&i.stop(!0).animate({scrollTop:r},100)}}}flarum.reg.add("flarum-tags","common/components/TagSelectionModal",S)},997:(t,e,s)=>{s.d(e,{Z:()=>c});var i=s(433),a=s.n(i),n=s(645),l=s.n(n),r=s(836),o=s.n(r);class c extends(a()){view(t){const{className:e,isToggled:s,...i}=this.attrs,a=s?"far fa-check-circle":"far fa-circle";return m(l(),Object.assign({},i,{icon:a,className:o()([e,s&&"Button--toggled"])}),t.children)}}flarum.reg.add("flarum-tags","forum/components/ToggleButton",c)}}]); +"use strict";(self.webpackChunkmodule_exports=self.webpackChunkmodule_exports||[]).push([[162],{610:(t,e,s)=>{s.r(e),s.d(e,{default:()=>C});var i=s(905),a=s(351),n=s.n(a),l=s(645),r=s.n(l),o=s(836),c=s.n(o),d=s(596),h=s.n(d),u=s(291),g=s.n(u),p=s(657),f=s.n(p),y=s(149),T=s.n(y),b=s(686),x=s.n(b),w=s(636),v=s.n(w),I=s(648),N=s(924),_=s(974),S=s(997);class C extends(x()){constructor(){super(...arguments),(0,i.Z)(this,"loading",!0),(0,i.Z)(this,"tags",void 0),(0,i.Z)(this,"selected",[]),(0,i.Z)(this,"bypassReqs",!1),(0,i.Z)(this,"filter",v()("")),(0,i.Z)(this,"focused",!1),(0,i.Z)(this,"navigator",new(f())),(0,i.Z)(this,"indexTag",void 0)}static initAttrs(t){var e,s,i,a,l,r,o,m,c,d,u,g,p,f,y,T,b,x;super.initAttrs(t),t.title||(t.title=h()(n().translator.trans("flarum-tags.lib.tag_selection_modal.title"))),t.canSelect||(t.canSelect=()=>!0),null!=t.allowResetting||(t.allowResetting=!0),t.limits={min:{total:null!=(e=null==(s=t.limits)||null==(i=s.min)?void 0:i.total)?e:-1/0,primary:null!=(a=null==(l=t.limits)||null==(r=l.min)?void 0:r.primary)?a:-1/0,secondary:null!=(o=null==(m=t.limits)||null==(c=m.min)?void 0:c.secondary)?o:-1/0},max:{total:null!=(d=null==(u=t.limits)||null==(g=u.max)?void 0:g.total)?d:1/0,primary:null!=(p=null==(f=t.limits)||null==(y=f.max)?void 0:y.primary)?p:1/0,secondary:null!=(T=null==(b=t.limits)||null==(x=b.max)?void 0:x.secondary)?T:1/0}},function(t){if(t.min.primary>t.max.primary)throw new Error("The minimum number of primary tags allowed cannot be more than the maximum number of primary tags allowed.");if(t.min.secondary>t.max.secondary)throw new Error("The minimum number of secondary tags allowed cannot be more than the maximum number of secondary tags allowed.");if(t.min.total>t.max.primary+t.max.secondary)throw new Error("The minimum number of tags allowed cannot be more than the maximum number of primary and secondary tags allowed together.");if(t.max.totalt.max.total)throw new Error("The minimum number of tags allowed cannot be more than the maximum number of tags allowed.")}(t.limits)}oninit(t){super.oninit(t),this.navigator.onUp((()=>this.setIndex(this.getCurrentNumericIndex()-1,!0))).onDown((()=>this.setIndex(this.getCurrentNumericIndex()+1,!0))).onSelect(this.select.bind(this)).onRemove((()=>this.selected.splice(this.selected.length-1,1))),n().tagList.load(["parent"]).then((t=>{this.loading=!1,this.attrs.selectableTags&&(t=this.attrs.selectableTags(t)),this.tags=(0,I.Z)(t),this.attrs.selectedTags&&this.attrs.selectedTags.map(this.addTag.bind(this)),this.indexTag=t[0],m.redraw()}))}className(){return c()("TagSelectionModal",this.attrs.className)}title(){return this.attrs.title}content(){if(this.loading||!this.tags)return m(T(),null);const t=this.filter().toLowerCase(),e=this.primaryCount(),s=this.secondaryCount(),i=this.getFilteredTags(),a=Math.max(h()(this.getInstruction(e,s)).length,this.filter().length);return[m("div",{className:"Modal-body"},m("div",{className:"TagSelectionModal-form"},m("div",{className:"TagSelectionModal-form-input"},m("div",{className:"TagsInput FormControl "+(this.focused?"focus":""),onclick:()=>this.$(".TagsInput input").focus()},m("span",{className:"TagsInput-selected"},this.selected.map((t=>m("span",{className:"TagsInput-tag",onclick:()=>{this.removeTag(t),this.onready()}},(0,N.Z)(t))))),m("input",{className:"FormControl",placeholder:h()(this.getInstruction(e,s)),bidi:this.filter,style:{width:a+"ch"},onkeydown:this.navigator.navigate.bind(this.navigator),onfocus:()=>this.focused=!0,onblur:()=>this.focused=!1}))),m("div",{className:"TagSelectionModal-form-submit App-primaryControl"},m(r(),{type:"submit",className:"Button Button--primary",disabled:!this.meetsRequirements(e,s),icon:"fas fa-check"},n().translator.trans("flarum-tags.lib.tag_selection_modal.submit_button"))))),m("div",{className:"Modal-footer"},m("ul",{className:"TagSelectionModal-list SelectTagList"},i.map((e=>m("li",{"data-index":e.id(),className:c()("SelectTagListItem",{pinned:null!==e.position(),child:!!e.parent(),colored:!!e.color(),selected:this.selected.includes(e),active:this.indexTag===e}),style:{color:e.color()},onmouseover:()=>this.indexTag=e,onclick:this.toggleTag.bind(this,e)},m("i",{className:"SelectTagListItem-icon"},(0,_.Z)(e,{className:"SelectTagListItem-tagIcon"}),m("i",{className:"icon TagIcon fas fa-check SelectTagListItem-checkIcon"})),m("span",{className:"SelectTagListItem-name"},g()(e.name(),t)),e.description()?m("span",{className:"SelectTagListItem-description"},e.description()):"")))),this.attrs.limits.allowBypassing&&m("div",{className:"TagSelectionModal-controls"},m(S.Z,{className:"Button",onclick:()=>this.bypassReqs=!this.bypassReqs,isToggled:this.bypassReqs},n().translator.trans("flarum-tags.lib.tag_selection_modal.bypass_requirements"))))]}getFilteredTags(){const t=this.filter().toLowerCase(),e=this.primaryCount(),s=this.secondaryCount();let i=this.tags;return this.attrs.requireParentTag&&(i=i.filter((t=>{const e=t.parent();return null!==e&&(!1===e||this.selected.includes(e))}))),this.bypassReqs||(this.selected.length>=this.attrs.limits.max.total?i=i.filter((t=>this.selected.includes(t))):(e>=this.attrs.limits.max.primary&&(i=i.filter((t=>!t.isPrimary()||this.selected.includes(t)))),s>=this.attrs.limits.max.secondary&&(i=i.filter((t=>t.isPrimary()||this.selected.includes(t)))))),t&&(i=i.filter((e=>e.name().toLowerCase().includes(t)))),this.indexTag&&i.includes(this.indexTag)||(this.indexTag=i[0]),i}primaryCount(){return this.selected.filter((t=>t.isPrimary())).length}secondaryCount(){return this.selected.filter((t=>!t.isPrimary())).length}meetsRequirements(t,e){return!!(this.bypassReqs||this.attrs.allowResetting&&0===this.selected.length)||!(this.selected.length=this.attrs.limits.min.primary&&e>=this.attrs.limits.min.secondary}addTag(t){if(t&&this.attrs.canSelect(t)){if(this.attrs.onSelect&&this.attrs.onSelect(t,this.selected),this.attrs.requireParentTag){const e=t.parent();e&&!this.selected.includes(e)&&this.selected.push(e)}this.selected.includes(t)||this.selected.push(t)}}removeTag(t){const e=this.selected.indexOf(t);-1!==e&&(this.selected.splice(e,1),this.attrs.requireParentTag&&this.selected.filter((e=>e.parent()===t)).forEach(this.removeTag.bind(this)),this.attrs.onDeselect&&this.attrs.onDeselect(t,this.selected))}toggleTag(t){this.tags&&(this.selected.includes(t)?this.removeTag(t):this.addTag(t),this.filter()&&(this.filter(""),this.indexTag=this.tags[0]),this.onready())}getInstruction(t,e){if(this.bypassReqs)return"";if(t li")}getCurrentNumericIndex(){return this.indexTag?this.selectableItems().index(this.getItem(this.indexTag)):-1}getItem(t){return this.selectableItems().filter('[data-index="'.concat(t.id(),'"]'))}setIndex(t,e){const s=this.selectableItems(),i=s.parent();t<0?t=s.length-1:t>=s.length&&(t=0);const a=s.eq(t);if(this.indexTag=n().store.getById("tags",a.attr("data-index")),m.redraw(),e&&this.indexTag){const t=i.scrollTop(),e=i.offset().top,s=e+i.outerHeight(),n=a.offset().top,l=n+a.outerHeight();let r;ns&&(r=t-s+l+parseInt(i.css("padding-bottom"),10)),void 0!==r&&i.stop(!0).animate({scrollTop:r},100)}}}flarum.reg.add("flarum-tags","common/components/TagSelectionModal",C)},997:(t,e,s)=>{s.d(e,{Z:()=>c});var i=s(433),a=s.n(i),n=s(645),l=s.n(n),r=s(836),o=s.n(r);class c extends(a()){view(t){const{className:e,isToggled:s,...i}=this.attrs,a=s?"far fa-check-circle":"far fa-circle";return m(l(),Object.assign({},i,{icon:a,className:o()([e,s&&"Button--toggled"])}),t.children)}}flarum.reg.add("flarum-tags","forum/components/ToggleButton",c)}}]); //# sourceMappingURL=TagSelectionModal.js.map \ No newline at end of file diff --git a/extensions/tags/js/dist/common/components/TagSelectionModal.js.map b/extensions/tags/js/dist/common/components/TagSelectionModal.js.map index e23c381ea..c57f46b65 100644 --- a/extensions/tags/js/dist/common/components/TagSelectionModal.js.map +++ b/extensions/tags/js/dist/common/components/TagSelectionModal.js.map @@ -1 +1 @@ -{"version":3,"file":"common/components/TagSelectionModal.js","mappings":"+VAce,MAAMA,UAA0B,KAC7CC,cACEC,SAASC,YACT,OAAgBC,KAAM,WAAW,IACjC,OAAgBA,KAAM,YAAQ,IAC9B,OAAgBA,KAAM,WAAY,KAClC,OAAgBA,KAAM,cAAc,IACpC,OAAgBA,KAAM,SAAU,IAAO,MACvC,OAAgBA,KAAM,WAAW,IACjC,OAAgBA,KAAM,YAAa,IAAI,OACvC,OAAgBA,KAAM,gBAAY,EACpC,CACAC,iBAAiBC,GACf,IAA2BC,EAAuBC,EAAeC,EAAmBC,EAAuBC,EAAgBC,EAAoBC,EAAuBC,EAAgBC,EAAoBC,EAAuBC,EAAgBC,EAAoBC,EAAuBC,EAAgBC,EAAoBC,EAAuBC,EAAgBC,EACvWtB,MAAMuB,UAAUnB,GAGhBA,EAAMoB,QAAUpB,EAAMoB,MAAQ,IAAY,qBAAqB,+CAC/DpB,EAAMqB,YAAcrB,EAAMqB,UAAY,KAAM,GACM,MAAzBrB,EAAMsB,iBAAkDtB,EAAMsB,gBAAiB,GACxGtB,EAAMuB,OAAS,CACbC,IAAK,CACHC,MAAyK,OAAjKxB,EAA0D,OAAjCC,EAAgBF,EAAMuB,SAAsE,OAA1CpB,EAAoBD,EAAcsB,UAA5C,EAAoErB,EAAkBsB,OAAiBxB,GAAwB,IACxMyB,QAAiL,OAAvKtB,EAA2D,OAAlCC,EAAiBL,EAAMuB,SAAwE,OAA5CjB,EAAqBD,EAAemB,UAA9C,EAAsElB,EAAmBoB,SAAmBtB,GAAwB,IAChNuB,UAAqL,OAAzKpB,EAA2D,OAAlCC,EAAiBR,EAAMuB,SAAwE,OAA5Cd,EAAqBD,EAAegB,UAA9C,EAAsEf,EAAmBkB,WAAqBpB,GAAwB,KAEtNqB,IA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AAUc,IAAI,kBAAmB,UAE9E,IAAdT,GACTL,EAAUe,MAAK,GAAMC,QAAQ,CAC3BX,aACC,IAEP,CACF,EAuBFY,OAAOC,IAAIC,IAAI,cAAe,sCAAuCvJ,E,2FCnXtD,MAAMwJ,UAAqB,KACxCC,KAAKlH,GACH,MAAM,UACJuB,EAAS,UACT4C,KACGpG,GACDF,KAAKE,MACHoF,EAAOgB,EAAY,sBAAwB,gBACjD,OAAO9C,EAAE,IAAQ8F,OAAOC,OAAO,CAAC,EAAGrJ,EAAO,CACxCoF,KAAMA,EACN5B,UAAW,IAAU,CAACA,EAAW4C,GAAa,sBAC5CnE,EAAMqH,SACZ,EAEFP,OAAOC,IAAIC,IAAI,cAAe,gCAAiCC,E","sources":["webpack://@flarum/tags/./src/common/components/TagSelectionModal.tsx","webpack://@flarum/tags/./src/forum/components/ToggleButton.js"],"sourcesContent":["import _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport app from 'flarum/common/app';\nimport Button from 'flarum/common/components/Button';\nimport classList from 'flarum/common/utils/classList';\nimport extractText from 'flarum/common/utils/extractText';\nimport highlight from 'flarum/common/helpers/highlight';\nimport KeyboardNavigatable from 'flarum/common/utils/KeyboardNavigatable';\nimport LoadingIndicator from 'flarum/common/components/LoadingIndicator';\nimport Modal from 'flarum/common/components/Modal';\nimport Stream from 'flarum/common/utils/Stream';\nimport sortTags from '../utils/sortTags';\nimport tagLabel from '../helpers/tagLabel';\nimport tagIcon from '../helpers/tagIcon';\nimport ToggleButton from '../../forum/components/ToggleButton';\nexport default class TagSelectionModal extends Modal {\n constructor() {\n super(...arguments);\n _defineProperty(this, \"loading\", true);\n _defineProperty(this, \"tags\", void 0);\n _defineProperty(this, \"selected\", []);\n _defineProperty(this, \"bypassReqs\", false);\n _defineProperty(this, \"filter\", Stream(''));\n _defineProperty(this, \"focused\", false);\n _defineProperty(this, \"navigator\", new KeyboardNavigatable());\n _defineProperty(this, \"indexTag\", void 0);\n }\n static initAttrs(attrs) {\n var _attrs$allowResetting, _attrs$limits$min$tot, _attrs$limits, _attrs$limits$min, _attrs$limits$min$pri, _attrs$limits2, _attrs$limits2$min, _attrs$limits$min$sec, _attrs$limits3, _attrs$limits3$min, _attrs$limits$max$tot, _attrs$limits4, _attrs$limits4$max, _attrs$limits$max$pri, _attrs$limits5, _attrs$limits5$max, _attrs$limits$max$sec, _attrs$limits6, _attrs$limits6$max;\n super.initAttrs(attrs);\n\n // Default values for optional attributes.\n attrs.title || (attrs.title = extractText(app.translator.trans('flarum-tags.lib.tag_selection_modal.title')));\n attrs.canSelect || (attrs.canSelect = () => true);\n (_attrs$allowResetting = attrs.allowResetting) != null ? _attrs$allowResetting : attrs.allowResetting = true;\n attrs.limits = {\n min: {\n total: (_attrs$limits$min$tot = (_attrs$limits = attrs.limits) == null ? void 0 : (_attrs$limits$min = _attrs$limits.min) == null ? void 0 : _attrs$limits$min.total) != null ? _attrs$limits$min$tot : -Infinity,\n primary: (_attrs$limits$min$pri = (_attrs$limits2 = attrs.limits) == null ? void 0 : (_attrs$limits2$min = _attrs$limits2.min) == null ? void 0 : _attrs$limits2$min.primary) != null ? _attrs$limits$min$pri : -Infinity,\n secondary: (_attrs$limits$min$sec = (_attrs$limits3 = attrs.limits) == null ? void 0 : (_attrs$limits3$min = _attrs$limits3.min) == null ? void 0 : _attrs$limits3$min.secondary) != null ? _attrs$limits$min$sec : -Infinity\n },\n max: {\n total: (_attrs$limits$max$tot = (_attrs$limits4 = attrs.limits) == null ? void 0 : (_attrs$limits4$max = _attrs$limits4.max) == null ? void 0 : _attrs$limits4$max.total) != null ? _attrs$limits$max$tot : Infinity,\n primary: (_attrs$limits$max$pri = (_attrs$limits5 = attrs.limits) == null ? void 0 : (_attrs$limits5$max = _attrs$limits5.max) == null ? void 0 : _attrs$limits5$max.primary) != null ? _attrs$limits$max$pri : Infinity,\n secondary: (_attrs$limits$max$sec = (_attrs$limits6 = attrs.limits) == null ? void 0 : (_attrs$limits6$max = _attrs$limits6.max) == null ? void 0 : _attrs$limits6$max.secondary) != null ? _attrs$limits$max$sec : Infinity\n }\n };\n\n // Prevent illogical limits from being provided.\n catchInvalidLimits(attrs.limits);\n }\n oninit(vnode) {\n super.oninit(vnode);\n this.navigator.onUp(() => this.setIndex(this.getCurrentNumericIndex() - 1, true)).onDown(() => this.setIndex(this.getCurrentNumericIndex() + 1, true)).onSelect(this.select.bind(this)).onRemove(() => this.selected.splice(this.selected.length - 1, 1));\n app.tagList.load(['parent']).then(tags => {\n this.loading = false;\n if (this.attrs.selectableTags) {\n tags = this.attrs.selectableTags(tags);\n }\n this.tags = sortTags(tags);\n if (this.attrs.selectedTags) {\n this.attrs.selectedTags.map(this.addTag.bind(this));\n }\n this.indexTag = tags[0];\n m.redraw();\n });\n }\n className() {\n return classList('TagSelectionModal', this.attrs.className);\n }\n title() {\n return this.attrs.title;\n }\n content() {\n if (this.loading || !this.tags) {\n return m(LoadingIndicator, null);\n }\n const filter = this.filter().toLowerCase();\n const primaryCount = this.primaryCount();\n const secondaryCount = this.secondaryCount();\n const tags = this.getFilteredTags();\n const inputWidth = Math.max(extractText(this.getInstruction(primaryCount, secondaryCount)).length, this.filter().length);\n return [m(\"div\", {\n className: \"Modal-body\"\n }, m(\"div\", {\n className: \"TagSelectionModal-form\"\n }, m(\"div\", {\n className: \"TagSelectionModal-form-input\"\n }, m(\"div\", {\n className: 'TagsInput FormControl ' + (this.focused ? 'focus' : ''),\n onclick: () => this.$('.TagsInput input').focus()\n }, m(\"span\", {\n className: \"TagsInput-selected\"\n }, this.selected.map(tag => m(\"span\", {\n className: \"TagsInput-tag\",\n onclick: () => {\n this.removeTag(tag);\n this.onready();\n }\n }, tagLabel(tag)))), m(\"input\", {\n className: \"FormControl\",\n placeholder: extractText(this.getInstruction(primaryCount, secondaryCount)),\n bidi: this.filter,\n style: {\n width: inputWidth + 'ch'\n },\n onkeydown: this.navigator.navigate.bind(this.navigator),\n onfocus: () => this.focused = true,\n onblur: () => this.focused = false\n }))), m(\"div\", {\n className: \"TagSelectionModal-form-submit App-primaryControl\"\n }, m(Button, {\n type: \"submit\",\n className: \"Button Button--primary\",\n disabled: !this.meetsRequirements(primaryCount, secondaryCount),\n icon: \"fas fa-check\"\n }, app.translator.trans('flarum-tags.lib.tag_selection_modal.submit_button'))))), m(\"div\", {\n className: \"Modal-footer\"\n }, m(\"ul\", {\n className: \"TagSelectionModal-list SelectTagList\"\n }, tags.map(tag => m(\"li\", {\n \"data-index\": tag.id(),\n className: classList({\n pinned: tag.position() !== null,\n child: !!tag.parent(),\n colored: !!tag.color(),\n selected: this.selected.includes(tag),\n active: this.indexTag === tag\n }),\n style: {\n color: tag.color()\n },\n onmouseover: () => this.indexTag = tag,\n onclick: this.toggleTag.bind(this, tag)\n }, tagIcon(tag), m(\"span\", {\n className: \"SelectTagListItem-name\"\n }, highlight(tag.name(), filter)), tag.description() ? m(\"span\", {\n className: \"SelectTagListItem-description\"\n }, tag.description()) : ''))), this.attrs.limits.allowBypassing && m(\"div\", {\n className: \"TagSelectionModal-controls\"\n }, m(ToggleButton, {\n className: \"Button\",\n onclick: () => this.bypassReqs = !this.bypassReqs,\n isToggled: this.bypassReqs\n }, app.translator.trans('flarum-tags.lib.tag_selection_modal.bypass_requirements'))))];\n }\n\n /**\n * Filters the available tags on every state change.\n */\n getFilteredTags() {\n const filter = this.filter().toLowerCase();\n const primaryCount = this.primaryCount();\n const secondaryCount = this.secondaryCount();\n let tags = this.tags;\n if (this.attrs.requireParentTag) {\n // Filter out all child tags whose parents have not been selected. This\n // makes it impossible to select a child if its parent hasn't been selected.\n tags = tags.filter(tag => {\n const parent = tag.parent();\n return parent !== null && (parent === false || this.selected.includes(parent));\n });\n }\n if (!this.bypassReqs) {\n // If we reached the total maximum number of tags, we can't select anymore.\n if (this.selected.length >= this.attrs.limits.max.total) {\n tags = tags.filter(tag => this.selected.includes(tag));\n }\n // If the number of selected primary/secondary tags is at the maximum, then\n // we'll filter out all other tags of that type.\n else {\n if (primaryCount >= this.attrs.limits.max.primary) {\n tags = tags.filter(tag => !tag.isPrimary() || this.selected.includes(tag));\n }\n if (secondaryCount >= this.attrs.limits.max.secondary) {\n tags = tags.filter(tag => tag.isPrimary() || this.selected.includes(tag));\n }\n }\n }\n\n // If the user has entered text in the filter input, then filter by tags\n // whose name matches what they've entered.\n if (filter) {\n tags = tags.filter(tag => tag.name().toLowerCase().includes(filter));\n }\n if (!this.indexTag || !tags.includes(this.indexTag)) this.indexTag = tags[0];\n return tags;\n }\n\n /**\n * Counts the number of selected primary tags.\n */\n primaryCount() {\n return this.selected.filter(tag => tag.isPrimary()).length;\n }\n\n /**\n * Counts the number of selected secondary tags.\n */\n secondaryCount() {\n return this.selected.filter(tag => !tag.isPrimary()).length;\n }\n\n /**\n * Validates the number of selected primary/secondary tags against the set min max limits.\n */\n meetsRequirements(primaryCount, secondaryCount) {\n if (this.bypassReqs || this.attrs.allowResetting && this.selected.length === 0) {\n return true;\n }\n if (this.selected.length < this.attrs.limits.min.total) {\n return false;\n }\n return primaryCount >= this.attrs.limits.min.primary && secondaryCount >= this.attrs.limits.min.secondary;\n }\n\n /**\n * Add the given tag to the list of selected tags.\n */\n addTag(tag) {\n if (!tag || !this.attrs.canSelect(tag)) return;\n if (this.attrs.onSelect) {\n this.attrs.onSelect(tag, this.selected);\n }\n\n // If this tag has a parent, we'll also need to add the parent tag to the\n // selected list if it's not already in there.\n if (this.attrs.requireParentTag) {\n const parent = tag.parent();\n if (parent && !this.selected.includes(parent)) {\n this.selected.push(parent);\n }\n }\n if (!this.selected.includes(tag)) {\n this.selected.push(tag);\n }\n }\n\n /**\n * Remove the given tag from the list of selected tags.\n */\n removeTag(tag) {\n const index = this.selected.indexOf(tag);\n if (index !== -1) {\n this.selected.splice(index, 1);\n\n // Look through the list of selected tags for any tags which have the tag\n // we just removed as their parent. We'll need to remove them too.\n if (this.attrs.requireParentTag) {\n this.selected.filter(t => t.parent() === tag).forEach(this.removeTag.bind(this));\n }\n if (this.attrs.onDeselect) {\n this.attrs.onDeselect(tag, this.selected);\n }\n }\n }\n toggleTag(tag) {\n // Won't happen, needed for type safety.\n if (!this.tags) return;\n if (this.selected.includes(tag)) {\n this.removeTag(tag);\n } else {\n this.addTag(tag);\n }\n if (this.filter()) {\n this.filter('');\n this.indexTag = this.tags[0];\n }\n this.onready();\n }\n\n /**\n * Gives human text instructions based on the current number of selected tags and set limits.\n */\n getInstruction(primaryCount, secondaryCount) {\n if (this.bypassReqs) {\n return '';\n }\n if (primaryCount < this.attrs.limits.min.primary) {\n const remaining = this.attrs.limits.min.primary - primaryCount;\n return extractText(app.translator.trans('flarum-tags.lib.tag_selection_modal.choose_primary_placeholder', {\n count: remaining\n }));\n } else if (secondaryCount < this.attrs.limits.min.secondary) {\n const remaining = this.attrs.limits.min.secondary - secondaryCount;\n return extractText(app.translator.trans('flarum-tags.lib.tag_selection_modal.choose_secondary_placeholder', {\n count: remaining\n }));\n } else if (this.selected.length < this.attrs.limits.min.total) {\n const remaining = this.attrs.limits.min.total - this.selected.length;\n return extractText(app.translator.trans('flarum-tags.lib.tag_selection_modal.choose_tags_placeholder', {\n count: remaining\n }));\n }\n return '';\n }\n\n /**\n * Submit tag selection.\n */\n onsubmit(e) {\n e.preventDefault();\n if (this.attrs.onsubmit) this.attrs.onsubmit(this.selected);\n this.hide();\n }\n select(e) {\n // Ctrl + Enter submits the selection, just Enter completes the current entry\n if (e.metaKey || e.ctrlKey || this.indexTag && this.selected.includes(this.indexTag)) {\n if (this.selected.length) {\n // The DOM submit method doesn't emit a `submit event, so we\n // simulate a manual submission so our `onsubmit` logic is run.\n this.$('button[type=\"submit\"]').click();\n }\n } else if (this.indexTag) {\n this.getItem(this.indexTag)[0].dispatchEvent(new Event('click'));\n }\n }\n selectableItems() {\n return this.$('.TagSelectionModal-list > li');\n }\n getCurrentNumericIndex() {\n if (!this.indexTag) return -1;\n return this.selectableItems().index(this.getItem(this.indexTag));\n }\n getItem(selectedTag) {\n return this.selectableItems().filter(\"[data-index=\\\"\".concat(selectedTag.id(), \"\\\"]\"));\n }\n setIndex(index, scrollToItem) {\n const $items = this.selectableItems();\n const $dropdown = $items.parent();\n if (index < 0) {\n index = $items.length - 1;\n } else if (index >= $items.length) {\n index = 0;\n }\n const $item = $items.eq(index);\n this.indexTag = app.store.getById('tags', $item.attr('data-index'));\n m.redraw();\n if (scrollToItem && this.indexTag) {\n const dropdownScroll = $dropdown.scrollTop();\n const dropdownTop = $dropdown.offset().top;\n const dropdownBottom = dropdownTop + $dropdown.outerHeight();\n const itemTop = $item.offset().top;\n const itemBottom = itemTop + $item.outerHeight();\n let scrollTop;\n if (itemTop < dropdownTop) {\n scrollTop = dropdownScroll - dropdownTop + itemTop - parseInt($dropdown.css('padding-top'), 10);\n } else if (itemBottom > dropdownBottom) {\n scrollTop = dropdownScroll - dropdownBottom + itemBottom + parseInt($dropdown.css('padding-bottom'), 10);\n }\n if (typeof scrollTop !== 'undefined') {\n $dropdown.stop(true).animate({\n scrollTop\n }, 100);\n }\n }\n }\n}\n\n/**\n * Catch invalid limits provided to the tag selection modal.\n */\nfunction catchInvalidLimits(limits) {\n if (limits.min.primary > limits.max.primary) {\n throw new Error('The minimum number of primary tags allowed cannot be more than the maximum number of primary tags allowed.');\n }\n if (limits.min.secondary > limits.max.secondary) {\n throw new Error('The minimum number of secondary tags allowed cannot be more than the maximum number of secondary tags allowed.');\n }\n if (limits.min.total > limits.max.primary + limits.max.secondary) {\n throw new Error('The minimum number of tags allowed cannot be more than the maximum number of primary and secondary tags allowed together.');\n }\n if (limits.max.total < limits.min.primary + limits.min.secondary) {\n throw new Error('The maximum number of tags allowed cannot be less than the minimum number of primary and secondary tags allowed together.');\n }\n if (limits.min.total > limits.max.total) {\n throw new Error('The minimum number of tags allowed cannot be more than the maximum number of tags allowed.');\n }\n}\nflarum.reg.add('flarum-tags', 'common/components/TagSelectionModal', TagSelectionModal);","import Component from 'flarum/common/Component';\nimport Button from 'flarum/common/components/Button';\nimport classList from 'flarum/common/utils/classList';\n\n/**\n * @TODO move to core\n */\nexport default class ToggleButton extends Component {\n view(vnode) {\n const {\n className,\n isToggled,\n ...attrs\n } = this.attrs;\n const icon = isToggled ? 'far fa-check-circle' : 'far fa-circle';\n return m(Button, Object.assign({}, attrs, {\n icon: icon,\n className: classList([className, isToggled && 'Button--toggled'])\n }), vnode.children);\n }\n}\nflarum.reg.add('flarum-tags', 'forum/components/ToggleButton', ToggleButton);"],"names":["TagSelectionModal","constructor","super","arguments","this","static","attrs","_attrs$limits$min$tot","_attrs$limits","_attrs$limits$min","_attrs$limits$min$pri","_attrs$limits2","_attrs$limits2$min","_attrs$limits$min$sec","_attrs$limits3","_attrs$limits3$min","_attrs$limits$max$tot","_attrs$limits4","_attrs$limits4$max","_attrs$limits$max$pri","_attrs$limits5","_attrs$limits5$max","_attrs$limits$max$sec","_attrs$limits6","_attrs$limits6$max","initAttrs","title","canSelect","allowResetting","limits","min","total","primary","secondary","max","Infinity","Error","catchInvalidLimits","oninit","vnode","navigator","onUp","setIndex","getCurrentNumericIndex","onDown","onSelect","select","bind","onRemove","selected","splice","length","then","tags","loading","selectableTags","selectedTags","map","addTag","indexTag","m","redraw","className","content","filter","toLowerCase","primaryCount","secondaryCount","getFilteredTags","inputWidth","Math","getInstruction","focused","onclick","$","focus","tag","removeTag","onready","placeholder","bidi","style","width","onkeydown","navigate","onfocus","onblur","type","disabled","meetsRequirements","icon","id","pinned","position","child","parent","colored","color","includes","active","onmouseover","toggleTag","name","description","allowBypassing","bypassReqs","isToggled","requireParentTag","isPrimary","push","index","indexOf","t","forEach","onDeselect","remaining","count","onsubmit","e","preventDefault","hide","metaKey","ctrlKey","click","getItem","dispatchEvent","Event","selectableItems","selectedTag","concat","scrollToItem","$items","$dropdown","$item","eq","attr","dropdownScroll","scrollTop","dropdownTop","offset","top","dropdownBottom","outerHeight","itemTop","itemBottom","parseInt","css","stop","animate","flarum","reg","add","ToggleButton","view","Object","assign","children"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"common/components/TagSel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Q,CAC3BX,aACC,IAEP,CACF,EAuBFY,OAAOC,IAAIC,IAAI,cAAe,sCAAuCvJ,E,2FCzXtD,MAAMwJ,UAAqB,KACxCC,KAAKlH,GACH,MAAM,UACJuB,EAAS,UACT4C,KACGpG,GACDF,KAAKE,MACHoF,EAAOgB,EAAY,sBAAwB,gBACjD,OAAO9C,EAAE,IAAQ8F,OAAOC,OAAO,CAAC,EAAGrJ,EAAO,CACxCoF,KAAMA,EACN5B,UAAW,IAAU,CAACA,EAAW4C,GAAa,sBAC5CnE,EAAMqH,SACZ,EAEFP,OAAOC,IAAIC,IAAI,cAAe,gCAAiCC,E","sources":["webpack://@flarum/tags/./src/common/components/TagSelectionModal.tsx","webpack://@flarum/tags/./src/forum/components/ToggleButton.js"],"sourcesContent":["import _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport app from 'flarum/common/app';\nimport Button from 'flarum/common/components/Button';\nimport classList from 'flarum/common/utils/classList';\nimport extractText from 'flarum/common/utils/extractText';\nimport highlight from 'flarum/common/helpers/highlight';\nimport KeyboardNavigatable from 'flarum/common/utils/KeyboardNavigatable';\nimport LoadingIndicator from 'flarum/common/components/LoadingIndicator';\nimport Modal from 'flarum/common/components/Modal';\nimport Stream from 'flarum/common/utils/Stream';\nimport sortTags from '../utils/sortTags';\nimport tagLabel from '../helpers/tagLabel';\nimport tagIcon from '../helpers/tagIcon';\nimport ToggleButton from '../../forum/components/ToggleButton';\nexport default class TagSelectionModal extends Modal {\n constructor() {\n super(...arguments);\n _defineProperty(this, \"loading\", true);\n _defineProperty(this, \"tags\", void 0);\n _defineProperty(this, \"selected\", []);\n _defineProperty(this, \"bypassReqs\", false);\n _defineProperty(this, \"filter\", Stream(''));\n _defineProperty(this, \"focused\", false);\n _defineProperty(this, \"navigator\", new KeyboardNavigatable());\n _defineProperty(this, \"indexTag\", void 0);\n }\n static initAttrs(attrs) {\n var _attrs$allowResetting, _attrs$limits$min$tot, _attrs$limits, _attrs$limits$min, _attrs$limits$min$pri, _attrs$limits2, _attrs$limits2$min, _attrs$limits$min$sec, _attrs$limits3, _attrs$limits3$min, _attrs$limits$max$tot, _attrs$limits4, _attrs$limits4$max, _attrs$limits$max$pri, _attrs$limits5, _attrs$limits5$max, _attrs$limits$max$sec, _attrs$limits6, _attrs$limits6$max;\n super.initAttrs(attrs);\n\n // Default values for optional attributes.\n attrs.title || (attrs.title = extractText(app.translator.trans('flarum-tags.lib.tag_selection_modal.title')));\n attrs.canSelect || (attrs.canSelect = () => true);\n (_attrs$allowResetting = attrs.allowResetting) != null ? _attrs$allowResetting : attrs.allowResetting = true;\n attrs.limits = {\n min: {\n total: (_attrs$limits$min$tot = (_attrs$limits = attrs.limits) == null ? void 0 : (_attrs$limits$min = _attrs$limits.min) == null ? void 0 : _attrs$limits$min.total) != null ? _attrs$limits$min$tot : -Infinity,\n primary: (_attrs$limits$min$pri = (_attrs$limits2 = attrs.limits) == null ? void 0 : (_attrs$limits2$min = _attrs$limits2.min) == null ? void 0 : _attrs$limits2$min.primary) != null ? _attrs$limits$min$pri : -Infinity,\n secondary: (_attrs$limits$min$sec = (_attrs$limits3 = attrs.limits) == null ? void 0 : (_attrs$limits3$min = _attrs$limits3.min) == null ? void 0 : _attrs$limits3$min.secondary) != null ? _attrs$limits$min$sec : -Infinity\n },\n max: {\n total: (_attrs$limits$max$tot = (_attrs$limits4 = attrs.limits) == null ? void 0 : (_attrs$limits4$max = _attrs$limits4.max) == null ? void 0 : _attrs$limits4$max.total) != null ? _attrs$limits$max$tot : Infinity,\n primary: (_attrs$limits$max$pri = (_attrs$limits5 = attrs.limits) == null ? void 0 : (_attrs$limits5$max = _attrs$limits5.max) == null ? void 0 : _attrs$limits5$max.primary) != null ? _attrs$limits$max$pri : Infinity,\n secondary: (_attrs$limits$max$sec = (_attrs$limits6 = attrs.limits) == null ? void 0 : (_attrs$limits6$max = _attrs$limits6.max) == null ? void 0 : _attrs$limits6$max.secondary) != null ? _attrs$limits$max$sec : Infinity\n }\n };\n\n // Prevent illogical limits from being provided.\n catchInvalidLimits(attrs.limits);\n }\n oninit(vnode) {\n super.oninit(vnode);\n this.navigator.onUp(() => this.setIndex(this.getCurrentNumericIndex() - 1, true)).onDown(() => this.setIndex(this.getCurrentNumericIndex() + 1, true)).onSelect(this.select.bind(this)).onRemove(() => this.selected.splice(this.selected.length - 1, 1));\n app.tagList.load(['parent']).then(tags => {\n this.loading = false;\n if (this.attrs.selectableTags) {\n tags = this.attrs.selectableTags(tags);\n }\n this.tags = sortTags(tags);\n if (this.attrs.selectedTags) {\n this.attrs.selectedTags.map(this.addTag.bind(this));\n }\n this.indexTag = tags[0];\n m.redraw();\n });\n }\n className() {\n return classList('TagSelectionModal', this.attrs.className);\n }\n title() {\n return this.attrs.title;\n }\n content() {\n if (this.loading || !this.tags) {\n return m(LoadingIndicator, null);\n }\n const filter = this.filter().toLowerCase();\n const primaryCount = this.primaryCount();\n const secondaryCount = this.secondaryCount();\n const tags = this.getFilteredTags();\n const inputWidth = Math.max(extractText(this.getInstruction(primaryCount, secondaryCount)).length, this.filter().length);\n return [m(\"div\", {\n className: \"Modal-body\"\n }, m(\"div\", {\n className: \"TagSelectionModal-form\"\n }, m(\"div\", {\n className: \"TagSelectionModal-form-input\"\n }, m(\"div\", {\n className: 'TagsInput FormControl ' + (this.focused ? 'focus' : ''),\n onclick: () => this.$('.TagsInput input').focus()\n }, m(\"span\", {\n className: \"TagsInput-selected\"\n }, this.selected.map(tag => m(\"span\", {\n className: \"TagsInput-tag\",\n onclick: () => {\n this.removeTag(tag);\n this.onready();\n }\n }, tagLabel(tag)))), m(\"input\", {\n className: \"FormControl\",\n placeholder: extractText(this.getInstruction(primaryCount, secondaryCount)),\n bidi: this.filter,\n style: {\n width: inputWidth + 'ch'\n },\n onkeydown: this.navigator.navigate.bind(this.navigator),\n onfocus: () => this.focused = true,\n onblur: () => this.focused = false\n }))), m(\"div\", {\n className: \"TagSelectionModal-form-submit App-primaryControl\"\n }, m(Button, {\n type: \"submit\",\n className: \"Button Button--primary\",\n disabled: !this.meetsRequirements(primaryCount, secondaryCount),\n icon: \"fas fa-check\"\n }, app.translator.trans('flarum-tags.lib.tag_selection_modal.submit_button'))))), m(\"div\", {\n className: \"Modal-footer\"\n }, m(\"ul\", {\n className: \"TagSelectionModal-list SelectTagList\"\n }, tags.map(tag => m(\"li\", {\n \"data-index\": tag.id(),\n className: classList('SelectTagListItem', {\n pinned: tag.position() !== null,\n child: !!tag.parent(),\n colored: !!tag.color(),\n selected: this.selected.includes(tag),\n active: this.indexTag === tag\n }),\n style: {\n color: tag.color()\n },\n onmouseover: () => this.indexTag = tag,\n onclick: this.toggleTag.bind(this, tag)\n }, m(\"i\", {\n className: \"SelectTagListItem-icon\"\n }, tagIcon(tag, {\n className: 'SelectTagListItem-tagIcon'\n }), m(\"i\", {\n className: \"icon TagIcon fas fa-check SelectTagListItem-checkIcon\"\n })), m(\"span\", {\n className: \"SelectTagListItem-name\"\n }, highlight(tag.name(), filter)), tag.description() ? m(\"span\", {\n className: \"SelectTagListItem-description\"\n }, tag.description()) : ''))), this.attrs.limits.allowBypassing && m(\"div\", {\n className: \"TagSelectionModal-controls\"\n }, m(ToggleButton, {\n className: \"Button\",\n onclick: () => this.bypassReqs = !this.bypassReqs,\n isToggled: this.bypassReqs\n }, app.translator.trans('flarum-tags.lib.tag_selection_modal.bypass_requirements'))))];\n }\n\n /**\n * Filters the available tags on every state change.\n */\n getFilteredTags() {\n const filter = this.filter().toLowerCase();\n const primaryCount = this.primaryCount();\n const secondaryCount = this.secondaryCount();\n let tags = this.tags;\n if (this.attrs.requireParentTag) {\n // Filter out all child tags whose parents have not been selected. This\n // makes it impossible to select a child if its parent hasn't been selected.\n tags = tags.filter(tag => {\n const parent = tag.parent();\n return parent !== null && (parent === false || this.selected.includes(parent));\n });\n }\n if (!this.bypassReqs) {\n // If we reached the total maximum number of tags, we can't select anymore.\n if (this.selected.length >= this.attrs.limits.max.total) {\n tags = tags.filter(tag => this.selected.includes(tag));\n }\n // If the number of selected primary/secondary tags is at the maximum, then\n // we'll filter out all other tags of that type.\n else {\n if (primaryCount >= this.attrs.limits.max.primary) {\n tags = tags.filter(tag => !tag.isPrimary() || this.selected.includes(tag));\n }\n if (secondaryCount >= this.attrs.limits.max.secondary) {\n tags = tags.filter(tag => tag.isPrimary() || this.selected.includes(tag));\n }\n }\n }\n\n // If the user has entered text in the filter input, then filter by tags\n // whose name matches what they've entered.\n if (filter) {\n tags = tags.filter(tag => tag.name().toLowerCase().includes(filter));\n }\n if (!this.indexTag || !tags.includes(this.indexTag)) this.indexTag = tags[0];\n return tags;\n }\n\n /**\n * Counts the number of selected primary tags.\n */\n primaryCount() {\n return this.selected.filter(tag => tag.isPrimary()).length;\n }\n\n /**\n * Counts the number of selected secondary tags.\n */\n secondaryCount() {\n return this.selected.filter(tag => !tag.isPrimary()).length;\n }\n\n /**\n * Validates the number of selected primary/secondary tags against the set min max limits.\n */\n meetsRequirements(primaryCount, secondaryCount) {\n if (this.bypassReqs || this.attrs.allowResetting && this.selected.length === 0) {\n return true;\n }\n if (this.selected.length < this.attrs.limits.min.total) {\n return false;\n }\n return primaryCount >= this.attrs.limits.min.primary && secondaryCount >= this.attrs.limits.min.secondary;\n }\n\n /**\n * Add the given tag to the list of selected tags.\n */\n addTag(tag) {\n if (!tag || !this.attrs.canSelect(tag)) return;\n if (this.attrs.onSelect) {\n this.attrs.onSelect(tag, this.selected);\n }\n\n // If this tag has a parent, we'll also need to add the parent tag to the\n // selected list if it's not already in there.\n if (this.attrs.requireParentTag) {\n const parent = tag.parent();\n if (parent && !this.selected.includes(parent)) {\n this.selected.push(parent);\n }\n }\n if (!this.selected.includes(tag)) {\n this.selected.push(tag);\n }\n }\n\n /**\n * Remove the given tag from the list of selected tags.\n */\n removeTag(tag) {\n const index = this.selected.indexOf(tag);\n if (index !== -1) {\n this.selected.splice(index, 1);\n\n // Look through the list of selected tags for any tags which have the tag\n // we just removed as their parent. We'll need to remove them too.\n if (this.attrs.requireParentTag) {\n this.selected.filter(t => t.parent() === tag).forEach(this.removeTag.bind(this));\n }\n if (this.attrs.onDeselect) {\n this.attrs.onDeselect(tag, this.selected);\n }\n }\n }\n toggleTag(tag) {\n // Won't happen, needed for type safety.\n if (!this.tags) return;\n if (this.selected.includes(tag)) {\n this.removeTag(tag);\n } else {\n this.addTag(tag);\n }\n if (this.filter()) {\n this.filter('');\n this.indexTag = this.tags[0];\n }\n this.onready();\n }\n\n /**\n * Gives human text instructions based on the current number of selected tags and set limits.\n */\n getInstruction(primaryCount, secondaryCount) {\n if (this.bypassReqs) {\n return '';\n }\n if (primaryCount < this.attrs.limits.min.primary) {\n const remaining = this.attrs.limits.min.primary - primaryCount;\n return extractText(app.translator.trans('flarum-tags.lib.tag_selection_modal.choose_primary_placeholder', {\n count: remaining\n }));\n } else if (secondaryCount < this.attrs.limits.min.secondary) {\n const remaining = this.attrs.limits.min.secondary - secondaryCount;\n return extractText(app.translator.trans('flarum-tags.lib.tag_selection_modal.choose_secondary_placeholder', {\n count: remaining\n }));\n } else if (this.selected.length < this.attrs.limits.min.total) {\n const remaining = this.attrs.limits.min.total - this.selected.length;\n return extractText(app.translator.trans('flarum-tags.lib.tag_selection_modal.choose_tags_placeholder', {\n count: remaining\n }));\n }\n return '';\n }\n\n /**\n * Submit tag selection.\n */\n onsubmit(e) {\n e.preventDefault();\n if (this.attrs.onsubmit) this.attrs.onsubmit(this.selected);\n this.hide();\n }\n select(e) {\n // Ctrl + Enter submits the selection, just Enter completes the current entry\n if (e.metaKey || e.ctrlKey || this.indexTag && this.selected.includes(this.indexTag)) {\n if (this.selected.length) {\n // The DOM submit method doesn't emit a `submit event, so we\n // simulate a manual submission so our `onsubmit` logic is run.\n this.$('button[type=\"submit\"]').click();\n }\n } else if (this.indexTag) {\n this.getItem(this.indexTag)[0].dispatchEvent(new Event('click'));\n }\n }\n selectableItems() {\n return this.$('.TagSelectionModal-list > li');\n }\n getCurrentNumericIndex() {\n if (!this.indexTag) return -1;\n return this.selectableItems().index(this.getItem(this.indexTag));\n }\n getItem(selectedTag) {\n return this.selectableItems().filter(\"[data-index=\\\"\".concat(selectedTag.id(), \"\\\"]\"));\n }\n setIndex(index, scrollToItem) {\n const $items = this.selectableItems();\n const $dropdown = $items.parent();\n if (index < 0) {\n index = $items.length - 1;\n } else if (index >= $items.length) {\n index = 0;\n }\n const $item = $items.eq(index);\n this.indexTag = app.store.getById('tags', $item.attr('data-index'));\n m.redraw();\n if (scrollToItem && this.indexTag) {\n const dropdownScroll = $dropdown.scrollTop();\n const dropdownTop = $dropdown.offset().top;\n const dropdownBottom = dropdownTop + $dropdown.outerHeight();\n const itemTop = $item.offset().top;\n const itemBottom = itemTop + $item.outerHeight();\n let scrollTop;\n if (itemTop < dropdownTop) {\n scrollTop = dropdownScroll - dropdownTop + itemTop - parseInt($dropdown.css('padding-top'), 10);\n } else if (itemBottom > dropdownBottom) {\n scrollTop = dropdownScroll - dropdownBottom + itemBottom + parseInt($dropdown.css('padding-bottom'), 10);\n }\n if (typeof scrollTop !== 'undefined') {\n $dropdown.stop(true).animate({\n scrollTop\n }, 100);\n }\n }\n }\n}\n\n/**\n * Catch invalid limits provided to the tag selection modal.\n */\nfunction catchInvalidLimits(limits) {\n if (limits.min.primary > limits.max.primary) {\n throw new Error('The minimum number of primary tags allowed cannot be more than the maximum number of primary tags allowed.');\n }\n if (limits.min.secondary > limits.max.secondary) {\n throw new Error('The minimum number of secondary tags allowed cannot be more than the maximum number of secondary tags allowed.');\n }\n if (limits.min.total > limits.max.primary + limits.max.secondary) {\n throw new Error('The minimum number of tags allowed cannot be more than the maximum number of primary and secondary tags allowed together.');\n }\n if (limits.max.total < limits.min.primary + limits.min.secondary) {\n throw new Error('The maximum number of tags allowed cannot be less than the minimum number of primary and secondary tags allowed together.');\n }\n if (limits.min.total > limits.max.total) {\n throw new Error('The minimum number of tags allowed cannot be more than the maximum number of tags allowed.');\n }\n}\nflarum.reg.add('flarum-tags', 'common/components/TagSelectionModal', TagSelectionModal);","import Component from 'flarum/common/Component';\nimport Button from 'flarum/common/components/Button';\nimport classList from 'flarum/common/utils/classList';\n\n/**\n * @TODO move to core\n */\nexport default class ToggleButton extends Component {\n view(vnode) {\n const {\n className,\n isToggled,\n ...attrs\n } = this.attrs;\n const icon = isToggled ? 'far fa-check-circle' : 'far fa-circle';\n return m(Button, Object.assign({}, attrs, {\n icon: icon,\n className: classList([className, isToggled && 'Button--toggled'])\n }), vnode.children);\n }\n}\nflarum.reg.add('flarum-tags', 'forum/components/ToggleButton', ToggleButton);"],"names":["TagSelectionModal","constructor","super","arguments","this","static","attrs","_attrs$limits$min$tot","_attrs$limits","_attrs$limits$min","_attrs$limits$min$pri","_attrs$limits2","_attrs$limits2$min","_attrs$limits$min$sec","_attrs$limits3","_attrs$limits3$min","_attrs$limits$max$tot","_attrs$limits4","_attrs$limits4$max","_attrs$limits$max$pri","_attrs$limits5","_attrs$limits5$max","_attrs$limits$max$sec","_attrs$limits6","_attrs$limits6$max","initAttrs","title","canSelect","allowResetting","limits","min","total","primary","secondary","max","Infinity","Error","catchInvalidLimits","oninit","vnode","navigator","onUp","setIndex","getCurrentNumericIndex","onDown","onSelect","select","bind","onRemove","selected","splice","length","then","tags","loading","selectableTags","selectedTags","map","addTag","indexTag","m","redraw","className","content","filter","toLowerCase","primaryCount","secondaryCount","getFilteredTags","inputWidth","Math","getInstruction","focused","onclick","$","focus","tag","removeTag","onready","placeholder","bidi","style","width","onkeydown","navigate","onfocus","onblur","type","disabled","meetsRequirements","icon","id","pinned","position","child","parent","colored","color","includes","active","onmouseover","toggleTag","name","description","allowBypassing","bypassReqs","isToggled","requireParentTag","isPrimary","push","index","indexOf","t","forEach","onDeselect","remaining","count","onsubmit","e","preventDefault","hide","metaKey","ctrlKey","click","getItem","dispatchEvent","Event","selectableItems","selectedTag","concat","scrollToItem","$items","$dropdown","$item","eq","attr","dropdownScroll","scrollTop","dropdownTop","offset","top","dropdownBottom","outerHeight","itemTop","itemBottom","parseInt","css","stop","animate","flarum","reg","add","ToggleButton","view","Object","assign","children"],"sourceRoot":""} \ No newline at end of file diff --git a/extensions/tags/js/dist/forum/components/TagDiscussionModal.js b/extensions/tags/js/dist/forum/components/TagDiscussionModal.js index dca62dbd2..63e2eb3ec 100644 --- a/extensions/tags/js/dist/forum/components/TagDiscussionModal.js +++ b/extensions/tags/js/dist/forum/components/TagDiscussionModal.js @@ -1,2 +1,2 @@ -"use strict";(self.webpackChunkmodule_exports=self.webpackChunkmodule_exports||[]).push([[642],{884:(t,e,s)=>{s.r(e),s.d(e,{default:()=>E});var i=s(892),a=s.n(i),n=s(232),l=s.n(n),r=s(836),o=s.n(r),c=s(596),d=s.n(c),h=s(490),u=s(905),g=s(351),p=s.n(g),f=s(645),y=s.n(f),T=s(291),b=s.n(T),x=s(657),w=s.n(x),v=s(149),I=s.n(v),N=s(686),_=s.n(N),S=s(636),C=s.n(S),q=s(648),R=s(924),k=s(974),M=s(433),Z=s.n(M);class P extends(Z()){view(t){const{className:e,isToggled:s,...i}=this.attrs,a=s?"far fa-check-circle":"far fa-circle";return m(y(),Object.assign({},i,{icon:a,className:o()([e,s&&"Button--toggled"])}),t.children)}}flarum.reg.add("flarum-tags","forum/components/ToggleButton",P);class B extends(_()){constructor(){super(...arguments),(0,u.Z)(this,"loading",!0),(0,u.Z)(this,"tags",void 0),(0,u.Z)(this,"selected",[]),(0,u.Z)(this,"bypassReqs",!1),(0,u.Z)(this,"filter",C()("")),(0,u.Z)(this,"focused",!1),(0,u.Z)(this,"navigator",new(w())),(0,u.Z)(this,"indexTag",void 0)}static initAttrs(t){var e,s,i,a,n,l,r,o,m,c,h,u,g,f,y,T,b,x;super.initAttrs(t),t.title||(t.title=d()(p().translator.trans("flarum-tags.lib.tag_selection_modal.title"))),t.canSelect||(t.canSelect=()=>!0),null!=t.allowResetting||(t.allowResetting=!0),t.limits={min:{total:null!=(e=null==(s=t.limits)||null==(i=s.min)?void 0:i.total)?e:-1/0,primary:null!=(a=null==(n=t.limits)||null==(l=n.min)?void 0:l.primary)?a:-1/0,secondary:null!=(r=null==(o=t.limits)||null==(m=o.min)?void 0:m.secondary)?r:-1/0},max:{total:null!=(c=null==(h=t.limits)||null==(u=h.max)?void 0:u.total)?c:1/0,primary:null!=(g=null==(f=t.limits)||null==(y=f.max)?void 0:y.primary)?g:1/0,secondary:null!=(T=null==(b=t.limits)||null==(x=b.max)?void 0:x.secondary)?T:1/0}},function(t){if(t.min.primary>t.max.primary)throw new Error("The minimum number of primary tags allowed cannot be more than the maximum number of primary tags allowed.");if(t.min.secondary>t.max.secondary)throw new Error("The minimum number of secondary tags allowed cannot be more than the maximum number of secondary tags allowed.");if(t.min.total>t.max.primary+t.max.secondary)throw new Error("The minimum number of tags allowed cannot be more than the maximum number of primary and secondary tags allowed together.");if(t.max.totalt.max.total)throw new Error("The minimum number of tags allowed cannot be more than the maximum number of tags allowed.")}(t.limits)}oninit(t){super.oninit(t),this.navigator.onUp((()=>this.setIndex(this.getCurrentNumericIndex()-1,!0))).onDown((()=>this.setIndex(this.getCurrentNumericIndex()+1,!0))).onSelect(this.select.bind(this)).onRemove((()=>this.selected.splice(this.selected.length-1,1))),p().tagList.load(["parent"]).then((t=>{this.loading=!1,this.attrs.selectableTags&&(t=this.attrs.selectableTags(t)),this.tags=(0,q.Z)(t),this.attrs.selectedTags&&this.attrs.selectedTags.map(this.addTag.bind(this)),this.indexTag=t[0],m.redraw()}))}className(){return o()("TagSelectionModal",this.attrs.className)}title(){return this.attrs.title}content(){if(this.loading||!this.tags)return m(I(),null);const t=this.filter().toLowerCase(),e=this.primaryCount(),s=this.secondaryCount(),i=this.getFilteredTags(),a=Math.max(d()(this.getInstruction(e,s)).length,this.filter().length);return[m("div",{className:"Modal-body"},m("div",{className:"TagSelectionModal-form"},m("div",{className:"TagSelectionModal-form-input"},m("div",{className:"TagsInput FormControl "+(this.focused?"focus":""),onclick:()=>this.$(".TagsInput input").focus()},m("span",{className:"TagsInput-selected"},this.selected.map((t=>m("span",{className:"TagsInput-tag",onclick:()=>{this.removeTag(t),this.onready()}},(0,R.Z)(t))))),m("input",{className:"FormControl",placeholder:d()(this.getInstruction(e,s)),bidi:this.filter,style:{width:a+"ch"},onkeydown:this.navigator.navigate.bind(this.navigator),onfocus:()=>this.focused=!0,onblur:()=>this.focused=!1}))),m("div",{className:"TagSelectionModal-form-submit App-primaryControl"},m(y(),{type:"submit",className:"Button Button--primary",disabled:!this.meetsRequirements(e,s),icon:"fas fa-check"},p().translator.trans("flarum-tags.lib.tag_selection_modal.submit_button"))))),m("div",{className:"Modal-footer"},m("ul",{className:"TagSelectionModal-list SelectTagList"},i.map((e=>m("li",{"data-index":e.id(),className:o()({pinned:null!==e.position(),child:!!e.parent(),colored:!!e.color(),selected:this.selected.includes(e),active:this.indexTag===e}),style:{color:e.color()},onmouseover:()=>this.indexTag=e,onclick:this.toggleTag.bind(this,e)},(0,k.Z)(e),m("span",{className:"SelectTagListItem-name"},b()(e.name(),t)),e.description()?m("span",{className:"SelectTagListItem-description"},e.description()):"")))),this.attrs.limits.allowBypassing&&m("div",{className:"TagSelectionModal-controls"},m(P,{className:"Button",onclick:()=>this.bypassReqs=!this.bypassReqs,isToggled:this.bypassReqs},p().translator.trans("flarum-tags.lib.tag_selection_modal.bypass_requirements"))))]}getFilteredTags(){const t=this.filter().toLowerCase(),e=this.primaryCount(),s=this.secondaryCount();let i=this.tags;return this.attrs.requireParentTag&&(i=i.filter((t=>{const e=t.parent();return null!==e&&(!1===e||this.selected.includes(e))}))),this.bypassReqs||(this.selected.length>=this.attrs.limits.max.total?i=i.filter((t=>this.selected.includes(t))):(e>=this.attrs.limits.max.primary&&(i=i.filter((t=>!t.isPrimary()||this.selected.includes(t)))),s>=this.attrs.limits.max.secondary&&(i=i.filter((t=>t.isPrimary()||this.selected.includes(t)))))),t&&(i=i.filter((e=>e.name().toLowerCase().includes(t)))),this.indexTag&&i.includes(this.indexTag)||(this.indexTag=i[0]),i}primaryCount(){return this.selected.filter((t=>t.isPrimary())).length}secondaryCount(){return this.selected.filter((t=>!t.isPrimary())).length}meetsRequirements(t,e){return!!(this.bypassReqs||this.attrs.allowResetting&&0===this.selected.length)||!(this.selected.length=this.attrs.limits.min.primary&&e>=this.attrs.limits.min.secondary}addTag(t){if(t&&this.attrs.canSelect(t)){if(this.attrs.onSelect&&this.attrs.onSelect(t,this.selected),this.attrs.requireParentTag){const e=t.parent();e&&!this.selected.includes(e)&&this.selected.push(e)}this.selected.includes(t)||this.selected.push(t)}}removeTag(t){const e=this.selected.indexOf(t);-1!==e&&(this.selected.splice(e,1),this.attrs.requireParentTag&&this.selected.filter((e=>e.parent()===t)).forEach(this.removeTag.bind(this)),this.attrs.onDeselect&&this.attrs.onDeselect(t,this.selected))}toggleTag(t){this.tags&&(this.selected.includes(t)?this.removeTag(t):this.addTag(t),this.filter()&&(this.filter(""),this.indexTag=this.tags[0]),this.onready())}getInstruction(t,e){if(this.bypassReqs)return"";if(t li")}getCurrentNumericIndex(){return this.indexTag?this.selectableItems().index(this.getItem(this.indexTag)):-1}getItem(t){return this.selectableItems().filter('[data-index="'.concat(t.id(),'"]'))}setIndex(t,e){const s=this.selectableItems(),i=s.parent();t<0?t=s.length-1:t>=s.length&&(t=0);const a=s.eq(t);if(this.indexTag=p().store.getById("tags",a.attr("data-index")),m.redraw(),e&&this.indexTag){const t=i.scrollTop(),e=i.offset().top,s=e+i.outerHeight(),n=a.offset().top,l=n+a.outerHeight();let r;ns&&(r=t-s+l+parseInt(i.css("padding-bottom"),10)),void 0!==r&&i.stop(!0).animate({scrollTop:r},100)}}}flarum.reg.add("flarum-tags","common/components/TagSelectionModal",B);class E extends B{static initAttrs(t){var e;super.initAttrs(t);const s=t.discussion?a().translator.trans("flarum-tags.forum.choose_tags.edit_title",{title:m("em",null,t.discussion.title())}):a().translator.trans("flarum-tags.forum.choose_tags.title");t.className=o()(t.className,"TagDiscussionModal"),t.title=d()(s),t.allowResetting=!!a().forum.attribute("canBypassTagCounts"),t.limits={allowBypassing:t.allowResetting,max:{primary:a().forum.attribute("maxPrimaryTags"),secondary:a().forum.attribute("maxSecondaryTags")},min:{primary:a().forum.attribute("minPrimaryTags"),secondary:a().forum.attribute("minSecondaryTags")}},t.requireParentTag=!0,t.selectableTags=()=>(0,h.Z)(t.discussion),null!=t.selectedTags||(t.selectedTags=(null==(e=t.discussion)?void 0:e.tags())||[]),t.canSelect=t=>t.canStartDiscussion();const i=t.onsubmit||null;t.onsubmit=function(e){const s=t.discussion;s&&s.save({relationships:{tags:e}}).then((()=>{a().current.matches(l())&&a().current.get("stream").update(),m.redraw()})),i&&i(e)}}}flarum.reg.add("flarum-tags","forum/components/TagDiscussionModal",E)}}]); +"use strict";(self.webpackChunkmodule_exports=self.webpackChunkmodule_exports||[]).push([[642],{884:(t,e,s)=>{s.r(e),s.d(e,{default:()=>B});var i=s(892),a=s.n(i),n=s(232),l=s.n(n),r=s(836),o=s.n(r),c=s(596),d=s.n(c),h=s(490),u=s(905),g=s(351),p=s.n(g),f=s(645),y=s.n(f),T=s(291),b=s.n(T),x=s(657),w=s.n(x),v=s(149),I=s.n(v),N=s(686),S=s.n(N),_=s(636),C=s.n(_),k=s(648),q=s(924),R=s(974),M=s(433),Z=s.n(M);class L extends(Z()){view(t){const{className:e,isToggled:s,...i}=this.attrs,a=s?"far fa-check-circle":"far fa-circle";return m(y(),Object.assign({},i,{icon:a,className:o()([e,s&&"Button--toggled"])}),t.children)}}flarum.reg.add("flarum-tags","forum/components/ToggleButton",L);class P extends(S()){constructor(){super(...arguments),(0,u.Z)(this,"loading",!0),(0,u.Z)(this,"tags",void 0),(0,u.Z)(this,"selected",[]),(0,u.Z)(this,"bypassReqs",!1),(0,u.Z)(this,"filter",C()("")),(0,u.Z)(this,"focused",!1),(0,u.Z)(this,"navigator",new(w())),(0,u.Z)(this,"indexTag",void 0)}static initAttrs(t){var e,s,i,a,n,l,r,o,m,c,h,u,g,f,y,T,b,x;super.initAttrs(t),t.title||(t.title=d()(p().translator.trans("flarum-tags.lib.tag_selection_modal.title"))),t.canSelect||(t.canSelect=()=>!0),null!=t.allowResetting||(t.allowResetting=!0),t.limits={min:{total:null!=(e=null==(s=t.limits)||null==(i=s.min)?void 0:i.total)?e:-1/0,primary:null!=(a=null==(n=t.limits)||null==(l=n.min)?void 0:l.primary)?a:-1/0,secondary:null!=(r=null==(o=t.limits)||null==(m=o.min)?void 0:m.secondary)?r:-1/0},max:{total:null!=(c=null==(h=t.limits)||null==(u=h.max)?void 0:u.total)?c:1/0,primary:null!=(g=null==(f=t.limits)||null==(y=f.max)?void 0:y.primary)?g:1/0,secondary:null!=(T=null==(b=t.limits)||null==(x=b.max)?void 0:x.secondary)?T:1/0}},function(t){if(t.min.primary>t.max.primary)throw new Error("The minimum number of primary tags allowed cannot be more than the maximum number of primary tags allowed.");if(t.min.secondary>t.max.secondary)throw new Error("The minimum number of secondary tags allowed cannot be more than the maximum number of secondary tags allowed.");if(t.min.total>t.max.primary+t.max.secondary)throw new Error("The minimum number of tags allowed cannot be more than the maximum number of primary and secondary tags allowed together.");if(t.max.totalt.max.total)throw new Error("The minimum number of tags allowed cannot be more than the maximum number of tags allowed.")}(t.limits)}oninit(t){super.oninit(t),this.navigator.onUp((()=>this.setIndex(this.getCurrentNumericIndex()-1,!0))).onDown((()=>this.setIndex(this.getCurrentNumericIndex()+1,!0))).onSelect(this.select.bind(this)).onRemove((()=>this.selected.splice(this.selected.length-1,1))),p().tagList.load(["parent"]).then((t=>{this.loading=!1,this.attrs.selectableTags&&(t=this.attrs.selectableTags(t)),this.tags=(0,k.Z)(t),this.attrs.selectedTags&&this.attrs.selectedTags.map(this.addTag.bind(this)),this.indexTag=t[0],m.redraw()}))}className(){return o()("TagSelectionModal",this.attrs.className)}title(){return this.attrs.title}content(){if(this.loading||!this.tags)return m(I(),null);const t=this.filter().toLowerCase(),e=this.primaryCount(),s=this.secondaryCount(),i=this.getFilteredTags(),a=Math.max(d()(this.getInstruction(e,s)).length,this.filter().length);return[m("div",{className:"Modal-body"},m("div",{className:"TagSelectionModal-form"},m("div",{className:"TagSelectionModal-form-input"},m("div",{className:"TagsInput FormControl "+(this.focused?"focus":""),onclick:()=>this.$(".TagsInput input").focus()},m("span",{className:"TagsInput-selected"},this.selected.map((t=>m("span",{className:"TagsInput-tag",onclick:()=>{this.removeTag(t),this.onready()}},(0,q.Z)(t))))),m("input",{className:"FormControl",placeholder:d()(this.getInstruction(e,s)),bidi:this.filter,style:{width:a+"ch"},onkeydown:this.navigator.navigate.bind(this.navigator),onfocus:()=>this.focused=!0,onblur:()=>this.focused=!1}))),m("div",{className:"TagSelectionModal-form-submit App-primaryControl"},m(y(),{type:"submit",className:"Button Button--primary",disabled:!this.meetsRequirements(e,s),icon:"fas fa-check"},p().translator.trans("flarum-tags.lib.tag_selection_modal.submit_button"))))),m("div",{className:"Modal-footer"},m("ul",{className:"TagSelectionModal-list SelectTagList"},i.map((e=>m("li",{"data-index":e.id(),className:o()("SelectTagListItem",{pinned:null!==e.position(),child:!!e.parent(),colored:!!e.color(),selected:this.selected.includes(e),active:this.indexTag===e}),style:{color:e.color()},onmouseover:()=>this.indexTag=e,onclick:this.toggleTag.bind(this,e)},m("i",{className:"SelectTagListItem-icon"},(0,R.Z)(e,{className:"SelectTagListItem-tagIcon"}),m("i",{className:"icon TagIcon fas fa-check SelectTagListItem-checkIcon"})),m("span",{className:"SelectTagListItem-name"},b()(e.name(),t)),e.description()?m("span",{className:"SelectTagListItem-description"},e.description()):"")))),this.attrs.limits.allowBypassing&&m("div",{className:"TagSelectionModal-controls"},m(L,{className:"Button",onclick:()=>this.bypassReqs=!this.bypassReqs,isToggled:this.bypassReqs},p().translator.trans("flarum-tags.lib.tag_selection_modal.bypass_requirements"))))]}getFilteredTags(){const t=this.filter().toLowerCase(),e=this.primaryCount(),s=this.secondaryCount();let i=this.tags;return this.attrs.requireParentTag&&(i=i.filter((t=>{const e=t.parent();return null!==e&&(!1===e||this.selected.includes(e))}))),this.bypassReqs||(this.selected.length>=this.attrs.limits.max.total?i=i.filter((t=>this.selected.includes(t))):(e>=this.attrs.limits.max.primary&&(i=i.filter((t=>!t.isPrimary()||this.selected.includes(t)))),s>=this.attrs.limits.max.secondary&&(i=i.filter((t=>t.isPrimary()||this.selected.includes(t)))))),t&&(i=i.filter((e=>e.name().toLowerCase().includes(t)))),this.indexTag&&i.includes(this.indexTag)||(this.indexTag=i[0]),i}primaryCount(){return this.selected.filter((t=>t.isPrimary())).length}secondaryCount(){return this.selected.filter((t=>!t.isPrimary())).length}meetsRequirements(t,e){return!!(this.bypassReqs||this.attrs.allowResetting&&0===this.selected.length)||!(this.selected.length=this.attrs.limits.min.primary&&e>=this.attrs.limits.min.secondary}addTag(t){if(t&&this.attrs.canSelect(t)){if(this.attrs.onSelect&&this.attrs.onSelect(t,this.selected),this.attrs.requireParentTag){const e=t.parent();e&&!this.selected.includes(e)&&this.selected.push(e)}this.selected.includes(t)||this.selected.push(t)}}removeTag(t){const e=this.selected.indexOf(t);-1!==e&&(this.selected.splice(e,1),this.attrs.requireParentTag&&this.selected.filter((e=>e.parent()===t)).forEach(this.removeTag.bind(this)),this.attrs.onDeselect&&this.attrs.onDeselect(t,this.selected))}toggleTag(t){this.tags&&(this.selected.includes(t)?this.removeTag(t):this.addTag(t),this.filter()&&(this.filter(""),this.indexTag=this.tags[0]),this.onready())}getInstruction(t,e){if(this.bypassReqs)return"";if(t li")}getCurrentNumericIndex(){return this.indexTag?this.selectableItems().index(this.getItem(this.indexTag)):-1}getItem(t){return this.selectableItems().filter('[data-index="'.concat(t.id(),'"]'))}setIndex(t,e){const s=this.selectableItems(),i=s.parent();t<0?t=s.length-1:t>=s.length&&(t=0);const a=s.eq(t);if(this.indexTag=p().store.getById("tags",a.attr("data-index")),m.redraw(),e&&this.indexTag){const t=i.scrollTop(),e=i.offset().top,s=e+i.outerHeight(),n=a.offset().top,l=n+a.outerHeight();let r;ns&&(r=t-s+l+parseInt(i.css("padding-bottom"),10)),void 0!==r&&i.stop(!0).animate({scrollTop:r},100)}}}flarum.reg.add("flarum-tags","common/components/TagSelectionModal",P);class B extends P{static initAttrs(t){var e;super.initAttrs(t);const s=t.discussion?a().translator.trans("flarum-tags.forum.choose_tags.edit_title",{title:m("em",null,t.discussion.title())}):a().translator.trans("flarum-tags.forum.choose_tags.title");t.className=o()(t.className,"TagDiscussionModal"),t.title=d()(s),t.allowResetting=!!a().forum.attribute("canBypassTagCounts"),t.limits={allowBypassing:t.allowResetting,max:{primary:a().forum.attribute("maxPrimaryTags"),secondary:a().forum.attribute("maxSecondaryTags")},min:{primary:a().forum.attribute("minPrimaryTags"),secondary:a().forum.attribute("minSecondaryTags")}},t.requireParentTag=!0,t.selectableTags=()=>(0,h.Z)(t.discussion),null!=t.selectedTags||(t.selectedTags=(null==(e=t.discussion)?void 0:e.tags())||[]),t.canSelect=t=>t.canStartDiscussion();const i=t.onsubmit||null;t.onsubmit=function(e){const s=t.discussion;s&&s.save({relationships:{tags:e}}).then((()=>{a().current.matches(l())&&a().current.get("stream").update(),m.redraw()})),i&&i(e)}}}flarum.reg.add("flarum-tags","forum/components/TagDiscussionModal",B)}}]); //# sourceMappingURL=TagDiscussionModal.js.map \ No newline at end of file diff --git a/extensions/tags/js/dist/forum/components/TagDiscussionModal.js.map b/extensions/tags/js/dist/forum/components/TagDiscussionModal.js.map index f09940758..a358ceac7 100644 --- a/extensions/tags/js/dist/forum/components/TagDiscussionModal.js.map +++ b/extensions/tags/js/dist/forum/components/TagDiscussionModal.js.map @@ -1 +1 @@ -{"version":3,"file":"forum/components/TagDiscussionModal.js","mappings":"qZAOe,MAAMA,UAAqB,KACxCC,KAAKC,GACH,MAAM,UACJC,EAAS,UACTC,KACGC,GACDC,KAAKD,MACHE,EAAOH,EAAY,sBAAwB,gBACjD,OAAOI,EAAE,IAAQC,OAAOC,OAAO,CAAC,EAAGL,EAAO,CACxCE,KAAMA,EACNJ,UAAW,IAAU,CAACA,EAAWC,GAAa,sBAC5CF,EAAMS,SACZ,EAEFC,OAAOC,IAAIC,IAAI,cAAe,gCAA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C,IAAI,cAAe,sCAAuCC,GCpXtD,MAAMiJ,UAA2BjJ,EAC9CI,iBAAiBd,GACf,IAAyB4J,EACzBhJ,MAAMqB,UAAUjC,GAChB,MAAMkC,EAAQlC,EAAM6J,WAAa,qBAAqB,2CAA4C,CAChG3H,MAAO/B,EAAE,KAAM,KAAMH,EAAM6J,WAAW3H,WACnC,qBAAqB,uCAC1BlC,EAAMF,UAAY,IAAUE,EAAMF,UAAW,sBAC7CE,EAAMkC,MAAQ,IAAYA,GAC1BlC,EAAMoC,iBAAmB,oBAAoB,sBAC7CpC,EAAMqC,OAAS,CACb0E,eAAgB/G,EAAMoC,eACtBM,IAAK,CACHF,QAAS,oBAAoB,kBAC7BC,UAAW,oBAAoB,qBAEjCH,IAAK,CACHE,QAAS,oBAAoB,kBAC7BC,UAAW,oBAAoB,sBAGnCzC,EAAMiH,kBAAmB,EACzBjH,EAAM8D,eAAiB,KAAM,EAAAgG,EAAA,GAAkB9J,EAAM6J,YACP,MAAvB7J,EAAMgE,eAA8ChE,EAAMgE,cAA0D,OAAzC4F,EAAoB5J,EAAM6J,iBAAsB,EAASD,EAAkBhG,SAAW,IACxL5D,EAAMmC,UAAY+C,GAAOA,EAAI6E,qBAC7B,MAAMC,EAAmBhK,EAAM2H,UAAY,KAG3C3H,EAAM2H,SAAW,SAAU/D,GACzB,MAAMiG,EAAa7J,EAAM6J,WACrBA,GACFA,EAAWI,KAAK,CACdC,cAAe,CACbtG,UAEDD,MAAK,KACF,oBAAoB,MACtB,gBAAgB,UAAUwG,SAE5BhK,EAAEiE,QAAQ,IAGV4F,GAAkBA,EAAiBpG,EACzC,CACF,EAEFrD,OAAOC,IAAIC,IAAI,cAAe,sCAAuCkJ,E","sources":["webpack://@flarum/tags/./src/forum/components/ToggleButton.js","webpack://@flarum/tags/./src/common/components/TagSelectionModal.tsx","webpack://@flarum/tags/./src/forum/components/TagDiscussionModal.tsx"],"sourcesContent":["import Component from 'flarum/common/Component';\nimport Button from 'flarum/common/components/Button';\nimport classList from 'flarum/common/utils/classList';\n\n/**\n * @TODO move to core\n */\nexport default class ToggleButton extends Component {\n view(vnode) {\n const {\n className,\n isToggled,\n ...attrs\n } = this.attrs;\n const icon = isToggled ? 'far fa-check-circle' : 'far fa-circle';\n return m(Button, Object.assign({}, attrs, {\n icon: icon,\n className: classList([className, isToggled && 'Button--toggled'])\n }), vnode.children);\n }\n}\nflarum.reg.add('flarum-tags', 'forum/components/ToggleButton', ToggleButton);","import _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport app from 'flarum/common/app';\nimport Button from 'flarum/common/components/Button';\nimport classList from 'flarum/common/utils/classList';\nimport extractText from 'flarum/common/utils/extractText';\nimport highlight from 'flarum/common/helpers/highlight';\nimport KeyboardNavigatable from 'flarum/common/utils/KeyboardNavigatable';\nimport LoadingIndicator from 'flarum/common/components/LoadingIndicator';\nimport Modal from 'flarum/common/components/Modal';\nimport Stream from 'flarum/common/utils/Stream';\nimport sortTags from '../utils/sortTags';\nimport tagLabel from '../helpers/tagLabel';\nimport tagIcon from '../helpers/tagIcon';\nimport ToggleButton from '../../forum/components/ToggleButton';\nexport default class TagSelectionModal extends Modal {\n constructor() {\n super(...arguments);\n _defineProperty(this, \"loading\", true);\n _defineProperty(this, \"tags\", void 0);\n _defineProperty(this, \"selected\", []);\n _defineProperty(this, \"bypassReqs\", false);\n _defineProperty(this, \"filter\", Stream(''));\n _defineProperty(this, \"focused\", false);\n _defineProperty(this, \"navigator\", new KeyboardNavigatable());\n _defineProperty(this, \"indexTag\", void 0);\n }\n static initAttrs(attrs) {\n var _attrs$allowResetting, _attrs$limits$min$tot, _attrs$limits, _attrs$limits$min, _attrs$limits$min$pri, _attrs$limits2, _attrs$limits2$min, _attrs$limits$min$sec, _attrs$limits3, _attrs$limits3$min, _attrs$limits$max$tot, _attrs$limits4, _attrs$limits4$max, _attrs$limits$max$pri, _attrs$limits5, _attrs$limits5$max, _attrs$limits$max$sec, _attrs$limits6, _attrs$limits6$max;\n super.initAttrs(attrs);\n\n // Default values for optional attributes.\n attrs.title || (attrs.title = extractText(app.translator.trans('flarum-tags.lib.tag_selection_modal.title')));\n attrs.canSelect || (attrs.canSelect = () => true);\n (_attrs$allowResetting = attrs.allowResetting) != null ? _attrs$allowResetting : attrs.allowResetting = true;\n attrs.limits = {\n min: {\n total: (_attrs$limits$min$tot = (_attrs$limits = attrs.limits) == null ? void 0 : (_attrs$limits$min = _attrs$limits.min) == null ? void 0 : _attrs$limits$min.total) != null ? _attrs$limits$min$tot : -Infinity,\n primary: (_attrs$limits$min$pri = (_attrs$limits2 = attrs.limits) == null ? void 0 : (_attrs$limits2$min = _attrs$limits2.min) == null ? void 0 : _attrs$limits2$min.primary) != null ? _attrs$limits$min$pri : -Infinity,\n secondary: (_attrs$limits$min$sec = (_attrs$limits3 = attrs.limits) == null ? void 0 : (_attrs$limits3$min = _attrs$limits3.min) == null ? void 0 : _attrs$limits3$min.secondary) != null ? _attrs$limits$min$sec : -Infinity\n },\n max: {\n total: (_attrs$limits$max$tot = (_attrs$limits4 = attrs.limits) == null ? void 0 : (_attrs$limits4$max = _attrs$limits4.max) == null ? void 0 : _attrs$limits4$max.total) != null ? _attrs$limits$max$tot : Infinity,\n primary: (_attrs$limits$max$pri = (_attrs$limits5 = attrs.limits) == null ? void 0 : (_attrs$limits5$max = _attrs$limits5.max) == null ? void 0 : _attrs$limits5$max.primary) != null ? _attrs$limits$max$pri : Infinity,\n secondary: (_attrs$limits$max$sec = (_attrs$limits6 = attrs.limits) == null ? void 0 : (_attrs$limits6$max = _attrs$limits6.max) == null ? void 0 : _attrs$limits6$max.secondary) != null ? _attrs$limits$max$sec : Infinity\n }\n };\n\n // Prevent illogical limits from being provided.\n catchInvalidLimits(attrs.limits);\n }\n oninit(vnode) {\n super.oninit(vnode);\n this.navigator.onUp(() => this.setIndex(this.getCurrentNumericIndex() - 1, true)).onDown(() => this.setIndex(this.getCurrentNumericIndex() + 1, true)).onSelect(this.select.bind(this)).onRemove(() => this.selected.splice(this.selected.length - 1, 1));\n app.tagList.load(['parent']).then(tags => {\n this.loading = false;\n if (this.attrs.selectableTags) {\n tags = this.attrs.selectableTags(tags);\n }\n this.tags = sortTags(tags);\n if (this.attrs.selectedTags) {\n this.attrs.selectedTags.map(this.addTag.bind(this));\n }\n this.indexTag = tags[0];\n m.redraw();\n });\n }\n className() {\n return classList('TagSelectionModal', this.attrs.className);\n }\n title() {\n return this.attrs.title;\n }\n content() {\n if (this.loading || !this.tags) {\n return m(LoadingIndicator, null);\n }\n const filter = this.filter().toLowerCase();\n const primaryCount = this.primaryCount();\n const secondaryCount = this.secondaryCount();\n const tags = this.getFilteredTags();\n const inputWidth = Math.max(extractText(this.getInstruction(primaryCount, secondaryCount)).length, this.filter().length);\n return [m(\"div\", {\n className: \"Modal-body\"\n }, m(\"div\", {\n className: \"TagSelectionModal-form\"\n }, m(\"div\", {\n className: \"TagSelectionModal-form-input\"\n }, m(\"div\", {\n className: 'TagsInput FormControl ' + (this.focused ? 'focus' : ''),\n onclick: () => this.$('.TagsInput input').focus()\n }, m(\"span\", {\n className: \"TagsInput-selected\"\n }, this.selected.map(tag => m(\"span\", {\n className: \"TagsInput-tag\",\n onclick: () => {\n this.removeTag(tag);\n this.onready();\n }\n }, tagLabel(tag)))), m(\"input\", {\n className: \"FormControl\",\n placeholder: extractText(this.getInstruction(primaryCount, secondaryCount)),\n bidi: this.filter,\n style: {\n width: inputWidth + 'ch'\n },\n onkeydown: this.navigator.navigate.bind(this.navigator),\n onfocus: () => this.focused = true,\n onblur: () => this.focused = false\n }))), m(\"div\", {\n className: \"TagSelectionModal-form-submit App-primaryControl\"\n }, m(Button, {\n type: \"submit\",\n className: \"Button Button--primary\",\n disabled: !this.meetsRequirements(primaryCount, secondaryCount),\n icon: \"fas fa-check\"\n }, app.translator.trans('flarum-tags.lib.tag_selection_modal.submit_button'))))), m(\"div\", {\n className: \"Modal-footer\"\n }, m(\"ul\", {\n className: \"TagSelectionModal-list SelectTagList\"\n }, tags.map(tag => m(\"li\", {\n \"data-index\": tag.id(),\n className: classList({\n pinned: tag.position() !== null,\n child: !!tag.parent(),\n colored: !!tag.color(),\n selected: this.selected.includes(tag),\n active: this.indexTag === tag\n }),\n style: {\n color: tag.color()\n },\n onmouseover: () => this.indexTag = tag,\n onclick: this.toggleTag.bind(this, tag)\n }, tagIcon(tag), m(\"span\", {\n className: \"SelectTagListItem-name\"\n }, highlight(tag.name(), filter)), tag.description() ? m(\"span\", {\n className: \"SelectTagListItem-description\"\n }, tag.description()) : ''))), this.attrs.limits.allowBypassing && m(\"div\", {\n className: \"TagSelectionModal-controls\"\n }, m(ToggleButton, {\n className: \"Button\",\n onclick: () => this.bypassReqs = !this.bypassReqs,\n isToggled: this.bypassReqs\n }, app.translator.trans('flarum-tags.lib.tag_selection_modal.bypass_requirements'))))];\n }\n\n /**\n * Filters the available tags on every state change.\n */\n getFilteredTags() {\n const filter = this.filter().toLowerCase();\n const primaryCount = this.primaryCount();\n const secondaryCount = this.secondaryCount();\n let tags = this.tags;\n if (this.attrs.requireParentTag) {\n // Filter out all child tags whose parents have not been selected. This\n // makes it impossible to select a child if its parent hasn't been selected.\n tags = tags.filter(tag => {\n const parent = tag.parent();\n return parent !== null && (parent === false || this.selected.includes(parent));\n });\n }\n if (!this.bypassReqs) {\n // If we reached the total maximum number of tags, we can't select anymore.\n if (this.selected.length >= this.attrs.limits.max.total) {\n tags = tags.filter(tag => this.selected.includes(tag));\n }\n // If the number of selected primary/secondary tags is at the maximum, then\n // we'll filter out all other tags of that type.\n else {\n if (primaryCount >= this.attrs.limits.max.primary) {\n tags = tags.filter(tag => !tag.isPrimary() || this.selected.includes(tag));\n }\n if (secondaryCount >= this.attrs.limits.max.secondary) {\n tags = tags.filter(tag => tag.isPrimary() || this.selected.includes(tag));\n }\n }\n }\n\n // If the user has entered text in the filter input, then filter by tags\n // whose name matches what they've entered.\n if (filter) {\n tags = tags.filter(tag => tag.name().toLowerCase().includes(filter));\n }\n if (!this.indexTag || !tags.includes(this.indexTag)) this.indexTag = tags[0];\n return tags;\n }\n\n /**\n * Counts the number of selected primary tags.\n */\n primaryCount() {\n return this.selected.filter(tag => tag.isPrimary()).length;\n }\n\n /**\n * Counts the number of selected secondary tags.\n */\n secondaryCount() {\n return this.selected.filter(tag => !tag.isPrimary()).length;\n }\n\n /**\n * Validates the number of selected primary/secondary tags against the set min max limits.\n */\n meetsRequirements(primaryCount, secondaryCount) {\n if (this.bypassReqs || this.attrs.allowResetting && this.selected.length === 0) {\n return true;\n }\n if (this.selected.length < this.attrs.limits.min.total) {\n return false;\n }\n return primaryCount >= this.attrs.limits.min.primary && secondaryCount >= this.attrs.limits.min.secondary;\n }\n\n /**\n * Add the given tag to the list of selected tags.\n */\n addTag(tag) {\n if (!tag || !this.attrs.canSelect(tag)) return;\n if (this.attrs.onSelect) {\n this.attrs.onSelect(tag, this.selected);\n }\n\n // If this tag has a parent, we'll also need to add the parent tag to the\n // selected list if it's not already in there.\n if (this.attrs.requireParentTag) {\n const parent = tag.parent();\n if (parent && !this.selected.includes(parent)) {\n this.selected.push(parent);\n }\n }\n if (!this.selected.includes(tag)) {\n this.selected.push(tag);\n }\n }\n\n /**\n * Remove the given tag from the list of selected tags.\n */\n removeTag(tag) {\n const index = this.selected.indexOf(tag);\n if (index !== -1) {\n this.selected.splice(index, 1);\n\n // Look through the list of selected tags for any tags which have the tag\n // we just removed as their parent. We'll need to remove them too.\n if (this.attrs.requireParentTag) {\n this.selected.filter(t => t.parent() === tag).forEach(this.removeTag.bind(this));\n }\n if (this.attrs.onDeselect) {\n this.attrs.onDeselect(tag, this.selected);\n }\n }\n }\n toggleTag(tag) {\n // Won't happen, needed for type safety.\n if (!this.tags) return;\n if (this.selected.includes(tag)) {\n this.removeTag(tag);\n } else {\n this.addTag(tag);\n }\n if (this.filter()) {\n this.filter('');\n this.indexTag = this.tags[0];\n }\n this.onready();\n }\n\n /**\n * Gives human text instructions based on the current number of selected tags and set limits.\n */\n getInstruction(primaryCount, secondaryCount) {\n if (this.bypassReqs) {\n return '';\n }\n if (primaryCount < this.attrs.limits.min.primary) {\n const remaining = this.attrs.limits.min.primary - primaryCount;\n return extractText(app.translator.trans('flarum-tags.lib.tag_selection_modal.choose_primary_placeholder', {\n count: remaining\n }));\n } else if (secondaryCount < this.attrs.limits.min.secondary) {\n const remaining = this.attrs.limits.min.secondary - secondaryCount;\n return extractText(app.translator.trans('flarum-tags.lib.tag_selection_modal.choose_secondary_placeholder', {\n count: remaining\n }));\n } else if (this.selected.length < this.attrs.limits.min.total) {\n const remaining = this.attrs.limits.min.total - this.selected.length;\n return extractText(app.translator.trans('flarum-tags.lib.tag_selection_modal.choose_tags_placeholder', {\n count: remaining\n }));\n }\n return '';\n }\n\n /**\n * Submit tag selection.\n */\n onsubmit(e) {\n e.preventDefault();\n if (this.attrs.onsubmit) this.attrs.onsubmit(this.selected);\n this.hide();\n }\n select(e) {\n // Ctrl + Enter submits the selection, just Enter completes the current entry\n if (e.metaKey || e.ctrlKey || this.indexTag && this.selected.includes(this.indexTag)) {\n if (this.selected.length) {\n // The DOM submit method doesn't emit a `submit event, so we\n // simulate a manual submission so our `onsubmit` logic is run.\n this.$('button[type=\"submit\"]').click();\n }\n } else if (this.indexTag) {\n this.getItem(this.indexTag)[0].dispatchEvent(new Event('click'));\n }\n }\n selectableItems() {\n return this.$('.TagSelectionModal-list > li');\n }\n getCurrentNumericIndex() {\n if (!this.indexTag) return -1;\n return this.selectableItems().index(this.getItem(this.indexTag));\n }\n getItem(selectedTag) {\n return this.selectableItems().filter(\"[data-index=\\\"\".concat(selectedTag.id(), \"\\\"]\"));\n }\n setIndex(index, scrollToItem) {\n const $items = this.selectableItems();\n const $dropdown = $items.parent();\n if (index < 0) {\n index = $items.length - 1;\n } else if (index >= $items.length) {\n index = 0;\n }\n const $item = $items.eq(index);\n this.indexTag = app.store.getById('tags', $item.attr('data-index'));\n m.redraw();\n if (scrollToItem && this.indexTag) {\n const dropdownScroll = $dropdown.scrollTop();\n const dropdownTop = $dropdown.offset().top;\n const dropdownBottom = dropdownTop + $dropdown.outerHeight();\n const itemTop = $item.offset().top;\n const itemBottom = itemTop + $item.outerHeight();\n let scrollTop;\n if (itemTop < dropdownTop) {\n scrollTop = dropdownScroll - dropdownTop + itemTop - parseInt($dropdown.css('padding-top'), 10);\n } else if (itemBottom > dropdownBottom) {\n scrollTop = dropdownScroll - dropdownBottom + itemBottom + parseInt($dropdown.css('padding-bottom'), 10);\n }\n if (typeof scrollTop !== 'undefined') {\n $dropdown.stop(true).animate({\n scrollTop\n }, 100);\n }\n }\n }\n}\n\n/**\n * Catch invalid limits provided to the tag selection modal.\n */\nfunction catchInvalidLimits(limits) {\n if (limits.min.primary > limits.max.primary) {\n throw new Error('The minimum number of primary tags allowed cannot be more than the maximum number of primary tags allowed.');\n }\n if (limits.min.secondary > limits.max.secondary) {\n throw new Error('The minimum number of secondary tags allowed cannot be more than the maximum number of secondary tags allowed.');\n }\n if (limits.min.total > limits.max.primary + limits.max.secondary) {\n throw new Error('The minimum number of tags allowed cannot be more than the maximum number of primary and secondary tags allowed together.');\n }\n if (limits.max.total < limits.min.primary + limits.min.secondary) {\n throw new Error('The maximum number of tags allowed cannot be less than the minimum number of primary and secondary tags allowed together.');\n }\n if (limits.min.total > limits.max.total) {\n throw new Error('The minimum number of tags allowed cannot be more than the maximum number of tags allowed.');\n }\n}\nflarum.reg.add('flarum-tags', 'common/components/TagSelectionModal', TagSelectionModal);","import app from 'flarum/forum/app';\nimport DiscussionPage from 'flarum/forum/components/DiscussionPage';\nimport classList from 'flarum/common/utils/classList';\nimport extractText from 'flarum/common/utils/extractText';\nimport getSelectableTags from '../utils/getSelectableTags';\nimport TagSelectionModal from '../../common/components/TagSelectionModal';\nexport default class TagDiscussionModal extends TagSelectionModal {\n static initAttrs(attrs) {\n var _attrs$selectedTags, _attrs$discussion;\n super.initAttrs(attrs);\n const title = attrs.discussion ? app.translator.trans('flarum-tags.forum.choose_tags.edit_title', {\n title: m(\"em\", null, attrs.discussion.title())\n }) : app.translator.trans('flarum-tags.forum.choose_tags.title');\n attrs.className = classList(attrs.className, 'TagDiscussionModal');\n attrs.title = extractText(title);\n attrs.allowResetting = !!app.forum.attribute('canBypassTagCounts');\n attrs.limits = {\n allowBypassing: attrs.allowResetting,\n max: {\n primary: app.forum.attribute('maxPrimaryTags'),\n secondary: app.forum.attribute('maxSecondaryTags')\n },\n min: {\n primary: app.forum.attribute('minPrimaryTags'),\n secondary: app.forum.attribute('minSecondaryTags')\n }\n };\n attrs.requireParentTag = true;\n attrs.selectableTags = () => getSelectableTags(attrs.discussion);\n (_attrs$selectedTags = attrs.selectedTags) != null ? _attrs$selectedTags : attrs.selectedTags = ((_attrs$discussion = attrs.discussion) == null ? void 0 : _attrs$discussion.tags()) || [];\n attrs.canSelect = tag => tag.canStartDiscussion();\n const suppliedOnsubmit = attrs.onsubmit || null;\n\n // Save changes.\n attrs.onsubmit = function (tags) {\n const discussion = attrs.discussion;\n if (discussion) {\n discussion.save({\n relationships: {\n tags\n }\n }).then(() => {\n if (app.current.matches(DiscussionPage)) {\n app.current.get('stream').update();\n }\n m.redraw();\n });\n }\n if (suppliedOnsubmit) suppliedOnsubmit(tags);\n };\n }\n}\nflarum.reg.add('flarum-tags', 'forum/components/TagDiscussionModal', TagDiscussionModal);"],"names":["ToggleButton","view","vnode","className","isToggled","attrs","this","icon","m","Object","assign","children","flarum","reg","add","TagSelectionModal","constructor","super","arguments","static","_attrs$limits$min$tot","_attrs$limits","_attrs$limits$min","_attrs$limits$min$pri","_attrs$limits2","_attrs$limits2$min","_attrs$limits$min$sec","_attrs$limits3","_attrs$limits3$min","_attrs$limits$max$tot","_attrs$limits4","_attrs$limits4$max","_attrs$limits$max$pri","_attrs$limits5","_attrs$limits5$max","_attrs$limits$max$sec","_attrs$limits6","_attrs$limits6$max","initAttrs","title","canSelect","allowResetting","limits","min","total","primary","secondary","max","Infinity","Error","catchInvalidLimits","oninit","navigator","onUp","setIndex","getCurrentNumericIndex","onDown","onSelect","select","bind","onRemove","selected","splice","length","then","tags","loading","selectableTags","sortTags","selectedTags","map","addTag","indexTag","redraw","content","filter","toLowerCase","primaryCount","secondaryCount","getFilteredTags","inputWidth","Math","getInstruction","focused","onclick","$","focus","tag","removeTag","onready","tagLabel","placeholder","bidi","style","width","onkeydown","navigate","onfocus","onblur","type","disabled","meetsRequirements","id","pinned","position","child","parent","colored","color","includes","active","onmouseover","toggleTag","tagIcon","name","description","allowBypassing","bypassReqs","requireParentTag","isPrimary","push","index","indexOf","t","forEach","onDeselect","remaining","count","onsubmit","e","preventDefault","hide","metaKey","ctrlKey","click","getItem","dispatchEvent","Event","selectableItems","selectedTag","concat","scrollToItem","$items","$dropdown","$item","eq","attr","dropdownScroll","scrollTop","dropdownTop","offset","top","dropdownBottom","outerHeight","itemTop","itemBottom","parseInt","css","stop","animate","TagDiscussionModal","_attrs$discussion","discussion","getSelectableTags","canStartDiscussion","suppliedOnsubmit","save","relationships","update"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"forum/components/TagDiscussionModal.js","mappings":"qZAOe,MAAMA,UAAqB,KACxCC,KAAKC,GACH,MAAM,UACJC,EAAS,UACTC,KACGC,GACDC,KAAKD,MACHE,EAAOH,EAAY,sBAAwB,gBACjD,OAAOI,EAAE,IAAQC,OAAOC,OAAO,CAAC,EAAGL,EAAO,CACxCE,KAAMA,EACNJ,UAAW,IAAU,CAACA,EAAWC,GAAa,sBAC5CF,EAAMS,SACZ,EAEFC,OAAOC,IAAIC,IAAI,cAAe,gCAAiCd,GCPhD,MAAMe,UAA0B,KAC7CC,cACEC,SAASC,YACT,OAAgBZ,KAAM,WAAW,IACjC,OAAgBA,KAAM,YAAQ,IAC9B,OAAgBA,KAAM,WAAY,KAClC,OAAgBA,KAAM,cAAc,IACpC,OAAgBA,KAAM,SAAU,IAAO,MACvC,OAAgBA,KAAM,WAAW,IACjC,OAAgBA,KAAM,YAAa,IAAI,OACvC,OAAgBA,KAAM,gBAAY,EACpC,CACAa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AAMH,EAAM6J,WAAW3H,WACnC,qBAAqB,uCAC1BlC,EAAMF,UAAY,IAAUE,EAAMF,UAAW,sBAC7CE,EAAMkC,MAAQ,IAAYA,GAC1BlC,EAAMoC,iBAAmB,oBAAoB,sBAC7CpC,EAAMqC,OAAS,CACb0E,eAAgB/G,EAAMoC,eACtBM,IAAK,CACHF,QAAS,oBAAoB,kBAC7BC,UAAW,oBAAoB,qBAEjCH,IAAK,CACHE,QAAS,oBAAoB,kBAC7BC,UAAW,oBAAoB,sBAGnCzC,EAAMiH,kBAAmB,EACzBjH,EAAM8D,eAAiB,KAAM,EAAAgG,EAAA,GAAkB9J,EAAM6J,YACP,MAAvB7J,EAAMgE,eAA8ChE,EAAMgE,cAA0D,OAAzC4F,EAAoB5J,EAAM6J,iBAAsB,EAASD,EAAkBhG,SAAW,IACxL5D,EAAMmC,UAAY+C,GAAOA,EAAI6E,qBAC7B,MAAMC,EAAmBhK,EAAM2H,UAAY,KAG3C3H,EAAM2H,SAAW,SAAU/D,GACzB,MAAMiG,EAAa7J,EAAM6J,WACrBA,GACFA,EAAWI,KAAK,CACdC,cAAe,CACbtG,UAEDD,MAAK,KACF,oBAAoB,MACtB,gBAAgB,UAAUwG,SAE5BhK,EAAEiE,QAAQ,IAGV4F,GAAkBA,EAAiBpG,EACzC,CACF,EAEFrD,OAAOC,IAAIC,IAAI,cAAe,sCAAuCkJ,E","sources":["webpack://@flarum/tags/./src/forum/components/ToggleButton.js","webpack://@flarum/tags/./src/common/components/TagSelectionModal.tsx","webpack://@flarum/tags/./src/forum/components/TagDiscussionModal.tsx"],"sourcesContent":["import Component from 'flarum/common/Component';\nimport Button from 'flarum/common/components/Button';\nimport classList from 'flarum/common/utils/classList';\n\n/**\n * @TODO move to core\n */\nexport default class ToggleButton extends Component {\n view(vnode) {\n const {\n className,\n isToggled,\n ...attrs\n } = this.attrs;\n const icon = isToggled ? 'far fa-check-circle' : 'far fa-circle';\n return m(Button, Object.assign({}, attrs, {\n icon: icon,\n className: classList([className, isToggled && 'Button--toggled'])\n }), vnode.children);\n }\n}\nflarum.reg.add('flarum-tags', 'forum/components/ToggleButton', ToggleButton);","import _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport app from 'flarum/common/app';\nimport Button from 'flarum/common/components/Button';\nimport classList from 'flarum/common/utils/classList';\nimport extractText from 'flarum/common/utils/extractText';\nimport highlight from 'flarum/common/helpers/highlight';\nimport KeyboardNavigatable from 'flarum/common/utils/KeyboardNavigatable';\nimport LoadingIndicator from 'flarum/common/components/LoadingIndicator';\nimport Modal from 'flarum/common/components/Modal';\nimport Stream from 'flarum/common/utils/Stream';\nimport sortTags from '../utils/sortTags';\nimport tagLabel from '../helpers/tagLabel';\nimport tagIcon from '../helpers/tagIcon';\nimport ToggleButton from '../../forum/components/ToggleButton';\nexport default class TagSelectionModal extends Modal {\n constructor() {\n super(...arguments);\n _defineProperty(this, \"loading\", true);\n _defineProperty(this, \"tags\", void 0);\n _defineProperty(this, \"selected\", []);\n _defineProperty(this, \"bypassReqs\", false);\n _defineProperty(this, \"filter\", Stream(''));\n _defineProperty(this, \"focused\", false);\n _defineProperty(this, \"navigator\", new KeyboardNavigatable());\n _defineProperty(this, \"indexTag\", void 0);\n }\n static initAttrs(attrs) {\n var _attrs$allowResetting, _attrs$limits$min$tot, _attrs$limits, _attrs$limits$min, _attrs$limits$min$pri, _attrs$limits2, _attrs$limits2$min, _attrs$limits$min$sec, _attrs$limits3, _attrs$limits3$min, _attrs$limits$max$tot, _attrs$limits4, _attrs$limits4$max, _attrs$limits$max$pri, _attrs$limits5, _attrs$limits5$max, _attrs$limits$max$sec, _attrs$limits6, _attrs$limits6$max;\n super.initAttrs(attrs);\n\n // Default values for optional attributes.\n attrs.title || (attrs.title = extractText(app.translator.trans('flarum-tags.lib.tag_selection_modal.title')));\n attrs.canSelect || (attrs.canSelect = () => true);\n (_attrs$allowResetting = attrs.allowResetting) != null ? _attrs$allowResetting : attrs.allowResetting = true;\n attrs.limits = {\n min: {\n total: (_attrs$limits$min$tot = (_attrs$limits = attrs.limits) == null ? void 0 : (_attrs$limits$min = _attrs$limits.min) == null ? void 0 : _attrs$limits$min.total) != null ? _attrs$limits$min$tot : -Infinity,\n primary: (_attrs$limits$min$pri = (_attrs$limits2 = attrs.limits) == null ? void 0 : (_attrs$limits2$min = _attrs$limits2.min) == null ? void 0 : _attrs$limits2$min.primary) != null ? _attrs$limits$min$pri : -Infinity,\n secondary: (_attrs$limits$min$sec = (_attrs$limits3 = attrs.limits) == null ? void 0 : (_attrs$limits3$min = _attrs$limits3.min) == null ? void 0 : _attrs$limits3$min.secondary) != null ? _attrs$limits$min$sec : -Infinity\n },\n max: {\n total: (_attrs$limits$max$tot = (_attrs$limits4 = attrs.limits) == null ? void 0 : (_attrs$limits4$max = _attrs$limits4.max) == null ? void 0 : _attrs$limits4$max.total) != null ? _attrs$limits$max$tot : Infinity,\n primary: (_attrs$limits$max$pri = (_attrs$limits5 = attrs.limits) == null ? void 0 : (_attrs$limits5$max = _attrs$limits5.max) == null ? void 0 : _attrs$limits5$max.primary) != null ? _attrs$limits$max$pri : Infinity,\n secondary: (_attrs$limits$max$sec = (_attrs$limits6 = attrs.limits) == null ? void 0 : (_attrs$limits6$max = _attrs$limits6.max) == null ? void 0 : _attrs$limits6$max.secondary) != null ? _attrs$limits$max$sec : Infinity\n }\n };\n\n // Prevent illogical limits from being provided.\n catchInvalidLimits(attrs.limits);\n }\n oninit(vnode) {\n super.oninit(vnode);\n this.navigator.onUp(() => this.setIndex(this.getCurrentNumericIndex() - 1, true)).onDown(() => this.setIndex(this.getCurrentNumericIndex() + 1, true)).onSelect(this.select.bind(this)).onRemove(() => this.selected.splice(this.selected.length - 1, 1));\n app.tagList.load(['parent']).then(tags => {\n this.loading = false;\n if (this.attrs.selectableTags) {\n tags = this.attrs.selectableTags(tags);\n }\n this.tags = sortTags(tags);\n if (this.attrs.selectedTags) {\n this.attrs.selectedTags.map(this.addTag.bind(this));\n }\n this.indexTag = tags[0];\n m.redraw();\n });\n }\n className() {\n return classList('TagSelectionModal', this.attrs.className);\n }\n title() {\n return this.attrs.title;\n }\n content() {\n if (this.loading || !this.tags) {\n return m(LoadingIndicator, null);\n }\n const filter = this.filter().toLowerCase();\n const primaryCount = this.primaryCount();\n const secondaryCount = this.secondaryCount();\n const tags = this.getFilteredTags();\n const inputWidth = Math.max(extractText(this.getInstruction(primaryCount, secondaryCount)).length, this.filter().length);\n return [m(\"div\", {\n className: \"Modal-body\"\n }, m(\"div\", {\n className: \"TagSelectionModal-form\"\n }, m(\"div\", {\n className: \"TagSelectionModal-form-input\"\n }, m(\"div\", {\n className: 'TagsInput FormControl ' + (this.focused ? 'focus' : ''),\n onclick: () => this.$('.TagsInput input').focus()\n }, m(\"span\", {\n className: \"TagsInput-selected\"\n }, this.selected.map(tag => m(\"span\", {\n className: \"TagsInput-tag\",\n onclick: () => {\n this.removeTag(tag);\n this.onready();\n }\n }, tagLabel(tag)))), m(\"input\", {\n className: \"FormControl\",\n placeholder: extractText(this.getInstruction(primaryCount, secondaryCount)),\n bidi: this.filter,\n style: {\n width: inputWidth + 'ch'\n },\n onkeydown: this.navigator.navigate.bind(this.navigator),\n onfocus: () => this.focused = true,\n onblur: () => this.focused = false\n }))), m(\"div\", {\n className: \"TagSelectionModal-form-submit App-primaryControl\"\n }, m(Button, {\n type: \"submit\",\n className: \"Button Button--primary\",\n disabled: !this.meetsRequirements(primaryCount, secondaryCount),\n icon: \"fas fa-check\"\n }, app.translator.trans('flarum-tags.lib.tag_selection_modal.submit_button'))))), m(\"div\", {\n className: \"Modal-footer\"\n }, m(\"ul\", {\n className: \"TagSelectionModal-list SelectTagList\"\n }, tags.map(tag => m(\"li\", {\n \"data-index\": tag.id(),\n className: classList('SelectTagListItem', {\n pinned: tag.position() !== null,\n child: !!tag.parent(),\n colored: !!tag.color(),\n selected: this.selected.includes(tag),\n active: this.indexTag === tag\n }),\n style: {\n color: tag.color()\n },\n onmouseover: () => this.indexTag = tag,\n onclick: this.toggleTag.bind(this, tag)\n }, m(\"i\", {\n className: \"SelectTagListItem-icon\"\n }, tagIcon(tag, {\n className: 'SelectTagListItem-tagIcon'\n }), m(\"i\", {\n className: \"icon TagIcon fas fa-check SelectTagListItem-checkIcon\"\n })), m(\"span\", {\n className: \"SelectTagListItem-name\"\n }, highlight(tag.name(), filter)), tag.description() ? m(\"span\", {\n className: \"SelectTagListItem-description\"\n }, tag.description()) : ''))), this.attrs.limits.allowBypassing && m(\"div\", {\n className: \"TagSelectionModal-controls\"\n }, m(ToggleButton, {\n className: \"Button\",\n onclick: () => this.bypassReqs = !this.bypassReqs,\n isToggled: this.bypassReqs\n }, app.translator.trans('flarum-tags.lib.tag_selection_modal.bypass_requirements'))))];\n }\n\n /**\n * Filters the available tags on every state change.\n */\n getFilteredTags() {\n const filter = this.filter().toLowerCase();\n const primaryCount = this.primaryCount();\n const secondaryCount = this.secondaryCount();\n let tags = this.tags;\n if (this.attrs.requireParentTag) {\n // Filter out all child tags whose parents have not been selected. This\n // makes it impossible to select a child if its parent hasn't been selected.\n tags = tags.filter(tag => {\n const parent = tag.parent();\n return parent !== null && (parent === false || this.selected.includes(parent));\n });\n }\n if (!this.bypassReqs) {\n // If we reached the total maximum number of tags, we can't select anymore.\n if (this.selected.length >= this.attrs.limits.max.total) {\n tags = tags.filter(tag => this.selected.includes(tag));\n }\n // If the number of selected primary/secondary tags is at the maximum, then\n // we'll filter out all other tags of that type.\n else {\n if (primaryCount >= this.attrs.limits.max.primary) {\n tags = tags.filter(tag => !tag.isPrimary() || this.selected.includes(tag));\n }\n if (secondaryCount >= this.attrs.limits.max.secondary) {\n tags = tags.filter(tag => tag.isPrimary() || this.selected.includes(tag));\n }\n }\n }\n\n // If the user has entered text in the filter input, then filter by tags\n // whose name matches what they've entered.\n if (filter) {\n tags = tags.filter(tag => tag.name().toLowerCase().includes(filter));\n }\n if (!this.indexTag || !tags.includes(this.indexTag)) this.indexTag = tags[0];\n return tags;\n }\n\n /**\n * Counts the number of selected primary tags.\n */\n primaryCount() {\n return this.selected.filter(tag => tag.isPrimary()).length;\n }\n\n /**\n * Counts the number of selected secondary tags.\n */\n secondaryCount() {\n return this.selected.filter(tag => !tag.isPrimary()).length;\n }\n\n /**\n * Validates the number of selected primary/secondary tags against the set min max limits.\n */\n meetsRequirements(primaryCount, secondaryCount) {\n if (this.bypassReqs || this.attrs.allowResetting && this.selected.length === 0) {\n return true;\n }\n if (this.selected.length < this.attrs.limits.min.total) {\n return false;\n }\n return primaryCount >= this.attrs.limits.min.primary && secondaryCount >= this.attrs.limits.min.secondary;\n }\n\n /**\n * Add the given tag to the list of selected tags.\n */\n addTag(tag) {\n if (!tag || !this.attrs.canSelect(tag)) return;\n if (this.attrs.onSelect) {\n this.attrs.onSelect(tag, this.selected);\n }\n\n // If this tag has a parent, we'll also need to add the parent tag to the\n // selected list if it's not already in there.\n if (this.attrs.requireParentTag) {\n const parent = tag.parent();\n if (parent && !this.selected.includes(parent)) {\n this.selected.push(parent);\n }\n }\n if (!this.selected.includes(tag)) {\n this.selected.push(tag);\n }\n }\n\n /**\n * Remove the given tag from the list of selected tags.\n */\n removeTag(tag) {\n const index = this.selected.indexOf(tag);\n if (index !== -1) {\n this.selected.splice(index, 1);\n\n // Look through the list of selected tags for any tags which have the tag\n // we just removed as their parent. We'll need to remove them too.\n if (this.attrs.requireParentTag) {\n this.selected.filter(t => t.parent() === tag).forEach(this.removeTag.bind(this));\n }\n if (this.attrs.onDeselect) {\n this.attrs.onDeselect(tag, this.selected);\n }\n }\n }\n toggleTag(tag) {\n // Won't happen, needed for type safety.\n if (!this.tags) return;\n if (this.selected.includes(tag)) {\n this.removeTag(tag);\n } else {\n this.addTag(tag);\n }\n if (this.filter()) {\n this.filter('');\n this.indexTag = this.tags[0];\n }\n this.onready();\n }\n\n /**\n * Gives human text instructions based on the current number of selected tags and set limits.\n */\n getInstruction(primaryCount, secondaryCount) {\n if (this.bypassReqs) {\n return '';\n }\n if (primaryCount < this.attrs.limits.min.primary) {\n const remaining = this.attrs.limits.min.primary - primaryCount;\n return extractText(app.translator.trans('flarum-tags.lib.tag_selection_modal.choose_primary_placeholder', {\n count: remaining\n }));\n } else if (secondaryCount < this.attrs.limits.min.secondary) {\n const remaining = this.attrs.limits.min.secondary - secondaryCount;\n return extractText(app.translator.trans('flarum-tags.lib.tag_selection_modal.choose_secondary_placeholder', {\n count: remaining\n }));\n } else if (this.selected.length < this.attrs.limits.min.total) {\n const remaining = this.attrs.limits.min.total - this.selected.length;\n return extractText(app.translator.trans('flarum-tags.lib.tag_selection_modal.choose_tags_placeholder', {\n count: remaining\n }));\n }\n return '';\n }\n\n /**\n * Submit tag selection.\n */\n onsubmit(e) {\n e.preventDefault();\n if (this.attrs.onsubmit) this.attrs.onsubmit(this.selected);\n this.hide();\n }\n select(e) {\n // Ctrl + Enter submits the selection, just Enter completes the current entry\n if (e.metaKey || e.ctrlKey || this.indexTag && this.selected.includes(this.indexTag)) {\n if (this.selected.length) {\n // The DOM submit method doesn't emit a `submit event, so we\n // simulate a manual submission so our `onsubmit` logic is run.\n this.$('button[type=\"submit\"]').click();\n }\n } else if (this.indexTag) {\n this.getItem(this.indexTag)[0].dispatchEvent(new Event('click'));\n }\n }\n selectableItems() {\n return this.$('.TagSelectionModal-list > li');\n }\n getCurrentNumericIndex() {\n if (!this.indexTag) return -1;\n return this.selectableItems().index(this.getItem(this.indexTag));\n }\n getItem(selectedTag) {\n return this.selectableItems().filter(\"[data-index=\\\"\".concat(selectedTag.id(), \"\\\"]\"));\n }\n setIndex(index, scrollToItem) {\n const $items = this.selectableItems();\n const $dropdown = $items.parent();\n if (index < 0) {\n index = $items.length - 1;\n } else if (index >= $items.length) {\n index = 0;\n }\n const $item = $items.eq(index);\n this.indexTag = app.store.getById('tags', $item.attr('data-index'));\n m.redraw();\n if (scrollToItem && this.indexTag) {\n const dropdownScroll = $dropdown.scrollTop();\n const dropdownTop = $dropdown.offset().top;\n const dropdownBottom = dropdownTop + $dropdown.outerHeight();\n const itemTop = $item.offset().top;\n const itemBottom = itemTop + $item.outerHeight();\n let scrollTop;\n if (itemTop < dropdownTop) {\n scrollTop = dropdownScroll - dropdownTop + itemTop - parseInt($dropdown.css('padding-top'), 10);\n } else if (itemBottom > dropdownBottom) {\n scrollTop = dropdownScroll - dropdownBottom + itemBottom + parseInt($dropdown.css('padding-bottom'), 10);\n }\n if (typeof scrollTop !== 'undefined') {\n $dropdown.stop(true).animate({\n scrollTop\n }, 100);\n }\n }\n }\n}\n\n/**\n * Catch invalid limits provided to the tag selection modal.\n */\nfunction catchInvalidLimits(limits) {\n if (limits.min.primary > limits.max.primary) {\n throw new Error('The minimum number of primary tags allowed cannot be more than the maximum number of primary tags allowed.');\n }\n if (limits.min.secondary > limits.max.secondary) {\n throw new Error('The minimum number of secondary tags allowed cannot be more than the maximum number of secondary tags allowed.');\n }\n if (limits.min.total > limits.max.primary + limits.max.secondary) {\n throw new Error('The minimum number of tags allowed cannot be more than the maximum number of primary and secondary tags allowed together.');\n }\n if (limits.max.total < limits.min.primary + limits.min.secondary) {\n throw new Error('The maximum number of tags allowed cannot be less than the minimum number of primary and secondary tags allowed together.');\n }\n if (limits.min.total > limits.max.total) {\n throw new Error('The minimum number of tags allowed cannot be more than the maximum number of tags allowed.');\n }\n}\nflarum.reg.add('flarum-tags', 'common/components/TagSelectionModal', TagSelectionModal);","import app from 'flarum/forum/app';\nimport DiscussionPage from 'flarum/forum/components/DiscussionPage';\nimport classList from 'flarum/common/utils/classList';\nimport extractText from 'flarum/common/utils/extractText';\nimport getSelectableTags from '../utils/getSelectableTags';\nimport TagSelectionModal from '../../common/components/TagSelectionModal';\nexport default class TagDiscussionModal extends TagSelectionModal {\n static initAttrs(attrs) {\n var _attrs$selectedTags, _attrs$discussion;\n super.initAttrs(attrs);\n const title = attrs.discussion ? app.translator.trans('flarum-tags.forum.choose_tags.edit_title', {\n title: m(\"em\", null, attrs.discussion.title())\n }) : app.translator.trans('flarum-tags.forum.choose_tags.title');\n attrs.className = classList(attrs.className, 'TagDiscussionModal');\n attrs.title = extractText(title);\n attrs.allowResetting = !!app.forum.attribute('canBypassTagCounts');\n attrs.limits = {\n allowBypassing: attrs.allowResetting,\n max: {\n primary: app.forum.attribute('maxPrimaryTags'),\n secondary: app.forum.attribute('maxSecondaryTags')\n },\n min: {\n primary: app.forum.attribute('minPrimaryTags'),\n secondary: app.forum.attribute('minSecondaryTags')\n }\n };\n attrs.requireParentTag = true;\n attrs.selectableTags = () => getSelectableTags(attrs.discussion);\n (_attrs$selectedTags = attrs.selectedTags) != null ? _attrs$selectedTags : attrs.selectedTags = ((_attrs$discussion = attrs.discussion) == null ? void 0 : _attrs$discussion.tags()) || [];\n attrs.canSelect = tag => tag.canStartDiscussion();\n const suppliedOnsubmit = attrs.onsubmit || null;\n\n // Save changes.\n attrs.onsubmit = function (tags) {\n const discussion = attrs.discussion;\n if (discussion) {\n discussion.save({\n relationships: {\n tags\n }\n }).then(() => {\n if (app.current.matches(DiscussionPage)) {\n app.current.get('stream').update();\n }\n m.redraw();\n });\n }\n if (suppliedOnsubmit) suppliedOnsubmit(tags);\n };\n }\n}\nflarum.reg.add('flarum-tags', 'forum/components/TagDiscussionModal', TagDiscussionModal);"],"names":["ToggleButton","view","vnode","className","isToggled","attrs","this","icon","m","Object","assign","children","flarum","reg","add","TagSelectionModal","constructor","super","arguments","static","_attrs$limits$min$tot","_attrs$limits","_attrs$limits$min","_attrs$limits$min$pri","_attrs$limits2","_attrs$limits2$min","_attrs$limits$min$sec","_attrs$limits3","_attrs$limits3$min","_attrs$limits$max$tot","_attrs$limits4","_attrs$limits4$max","_attrs$limits$max$pri","_attrs$limits5","_attrs$limits5$max","_attrs$limits$max$sec","_attrs$limits6","_attrs$limits6$max","initAttrs","title","canSelect","allowResetting","limits","min","total","primary","secondary","max","Infinity","Error","catchInvalidLimits","oninit","navigator","onUp","setIndex","getCurrentNumericIndex","onDown","onSelect","select","bind","onRemove","selected","splice","length","then","tags","loading","selectableTags","sortTags","selectedTags","map","addTag","indexTag","redraw","content","filter","toLowerCase","primaryCount","secondaryCount","getFilteredTags","inputWidth","Math","getInstruction","focused","onclick","$","focus","tag","removeTag","onready","tagLabel","placeholder","bidi","style","width","onkeydown","navigate","onfocus","onblur","type","disabled","meetsRequirements","id","pinned","position","child","parent","colored","color","includes","active","onmouseover","toggleTag","tagIcon","name","description","allowBypassing","bypassReqs","requireParentTag","isPrimary","push","index","indexOf","t","forEach","onDeselect","remaining","count","onsubmit","e","preventDefault","hide","metaKey","ctrlKey","click","getItem","dispatchEvent","Event","selectableItems","selectedTag","concat","scrollToItem","$items","$dropdown","$item","eq","attr","dropdownScroll","scrollTop","dropdownTop","offset","top","dropdownBottom","outerHeight","itemTop","itemBottom","parseInt","css","stop","animate","TagDiscussionModal","_attrs$discussion","discussion","getSelectableTags","canStartDiscussion","suppliedOnsubmit","save","relationships","update"],"sourceRoot":""} \ No newline at end of file diff --git a/framework/core/js/dist/forum.js b/framework/core/js/dist/forum.js index b8d530c86..1cba994d2 100644 --- a/framework/core/js/dist/forum.js +++ b/framework/core/js/dist/forum.js @@ -1,3 +1,3 @@ /*! For license information please see forum.js.LICENSE.txt */ -(()=>{var t,e,n={2915:(t,e,n)=>{"use strict";n.d(e,{Z:()=>I});var r=n(7905),s=n(7465),o=n(4041),i=n(7202),a=n(2039),l=n(8588),c=n(406),u=n(627),d=n(6684),h=n(775),f=n(6786),p=n(1552),g=n(7569),v=n(4430),b=n(6386),y=n(4718),w=n(1378),Z=n(8134),x=n(3813),k=n(7498),N=n(6322),C=n(4125),S=n(7645),T=n(5788),E=n(5013),A=n(5123),P=n(5278),D=n(6778),_=n(7366);class I{constructor(){(0,r.Z)(this,"forum",void 0),(0,r.Z)(this,"routes",{}),(0,r.Z)(this,"initializers",new o.Z),(0,r.Z)(this,"session",void 0),(0,r.Z)(this,"translator",new u.Z),(0,r.Z)(this,"store",new d.Z({"access-tokens":_.Z,forums:x.Z,users:k.Z,discussions:N.Z,posts:C.Z,groups:S.Z,notifications:T.Z})),(0,r.Z)(this,"cache",{}),(0,r.Z)(this,"booted",!1),(0,r.Z)(this,"current",new E.Z(null)),(0,r.Z)(this,"previous",new E.Z(null)),(0,r.Z)(this,"modal",new A.Z),(0,r.Z)(this,"alerts",new P.Z),(0,r.Z)(this,"drawer",void 0),(0,r.Z)(this,"history",null),(0,r.Z)(this,"pane",null),(0,r.Z)(this,"data",void 0),(0,r.Z)(this,"_title",""),(0,r.Z)(this,"_titleCount",0),(0,r.Z)(this,"requestErrorAlert",null),(0,r.Z)(this,"initialRoute",void 0)}set title(t){this._title=t}get title(){return this._title}set titleCount(t){this._titleCount=t}get titleCount(){return this._titleCount}load(t){this.data=t,this.translator.setLocale(t.locale)}boot(){var t;const e=[];this.initializers.toArray().forEach((t=>{try{t(this)}catch(n){const r=t.itemName.includes("/")?t.itemName.replace(/(\/flarum-ext-)|(\/flarum-)/g,"-"):t.itemName;e.push((()=>(0,D.Z)((0,p.Z)(s.Z.translator.trans("core.lib.error.extension_initialiation_failed_message",{extension:r})),"".concat(r," failed to initialize"),n)))}})),this.store.pushPayload({data:this.data.resources}),this.forum=this.store.getById("forums","1"),this.session=new h.Z(null!=(t=this.store.getById("users",String(this.data.session.userId)))?t:null,this.data.session.csrfToken),this.mount(),this.initialRoute=window.location.href,e.forEach((t=>t()))}bootExtensions(t){Object.keys(t).forEach((e=>{const n=t[e];if(!n.extend)return;const r=n.extend.flat(1/0);for(const t of r)t.extend(this,{name:e,exports:n})}))}mount(t){void 0===t&&(t=""),m.mount(document.getElementById("modal"),{view:()=>m(a.Z,{state:this.modal})}),m.mount(document.getElementById("alerts"),{view:()=>m(l.Z,{state:this.alerts})}),this.drawer=new g.Z,m.route(document.getElementById("content"),t+"/",(0,v.Z)(this.routes,t));const e=document.getElementById("app"),n=document.querySelector(".App-header"),r=new y.Z((t=>{const r=e.getBoundingClientRect().top+document.body.scrollTop;e.classList.toggle("affix",t>=r),e.classList.toggle("scrolled",t>r),n.classList.toggle("navbar-fixed-top",t>=r)}));r.start(),r.update(),document.body.classList.add("ontouchstart"in window?"touch":"no-touch"),(0,w.Z)()}preloadedApiDocument(){if(this.data.apiDocument&&window.location.href===this.initialRoute){const t=((0,d.Y)(this.data.apiDocument),this.store.pushPayload(this.data.apiDocument));return this.data.apiDocument=null,t}return null}screen(){return getComputedStyle(document.documentElement).getPropertyValue("--flarum-screen")}setTitle(t){this.title=t,this.updateTitle()}setTitleCount(t){this.titleCount=t,this.updateTitle()}updateTitle(){const t=this.titleCount?"(".concat(this.titleCount,") "):"",e=m.route.get()===this.forum.attribute("basePath")+"/",n={pageTitle:this.title,forumName:this.forum.attribute("title"),pageNumber:1};let r=e||!this.title?(0,p.Z)(s.Z.translator.trans("core.lib.meta_titles.without_page_title",n)):(0,p.Z)(s.Z.translator.trans("core.lib.meta_titles.with_page_title",n));r=t+r;const o=new DOMParser;document.title=o.parseFromString(r,"text/html").body.innerText}transformRequestOptions(t){const{background:e,deserialize:n,extract:r,modifyText:o,...i}={...t},a=o||r,l={background:null==e||e,deserialize:null!=n?n:t=>t,...i};if((0,Z.l)(l,"config",((t,e)=>{e.setRequestHeader("X-CSRF-Token",this.session.csrfToken)})),l.method&&!["GET","POST"].includes(l.method)){const t=l.method;(0,Z.l)(l,"config",((e,n)=>{n.setRequestHeader("X-HTTP-Method-Override",t)})),l.method="POST"}return l.extract=t=>{let e;e=a?a(t.responseText):t.responseText;const n=t.status;if(n<200||n>299)throw new b.Z(n,"".concat(e),l,t);if(t.getResponseHeader){const e=t.getResponseHeader("X-CSRF-Token");e&&(s.Z.session.csrfToken=e)}try{return""===e?null:JSON.parse(e)}catch(n){throw new b.Z(500,"".concat(e),l,t)}},l}request(t){const e=this.transformRequestOptions(t);return this.requestErrorAlert&&this.alerts.dismiss(this.requestErrorAlert),m.request(e).catch((e=>this.requestErrorCatch(e,t.errorHandler)))}requestErrorCatch(t,e){var n,r,o;const a=null!=(n=null==(r=t.response)||null==(o=r.errors)?void 0:o.map((t=>{var e;return decodeURI(null!=(e=t.detail)?e:"")})))?n:[];let l;switch(t.status){case 422:l=a.map((t=>[t,m("br",null)])).flat().slice(0,-1);break;case 401:case 403:l=s.Z.translator.trans("core.lib.error.permission_denied_message");break;case 404:case 410:l=s.Z.translator.trans("core.lib.error.not_found_message");break;case 413:l=s.Z.translator.trans("core.lib.error.payload_too_large_message");break;case 429:l=s.Z.translator.trans("core.lib.error.rate_limit_exceeded_message");break;default:l=this.requestWasCrossOrigin(t)?s.Z.translator.trans("core.lib.error.generic_cross_origin_message"):s.Z.translator.trans("core.lib.error.generic_message")}const c=s.Z.forum.attribute("debug");return t.alert={type:"error",content:l,controls:c&&[m(i.Z,{className:"Button Button--link",onclick:this.showDebug.bind(this,t,a)},s.Z.translator.trans("core.lib.debug_button"))]},e?e(t):this.requestErrorDefaultHandler(t,c,a),Promise.reject(t)}requestWasCrossOrigin(t){return new URL(t.options.url,document.baseURI).origin!==window.location.origin}requestErrorDefaultHandler(t,e,n){if(!(t instanceof b.Z))throw t;if(e&&t.xhr){const{method:e,url:r}=t.options,{status:s=""}=t.xhr;console.group("".concat(e," ").concat(r," ").concat(s)),n.length?console.error(...n):console.error(t),console.groupEnd()}t.alert&&(this.requestErrorAlert=this.alerts.show(t.alert,t.alert.content))}showDebug(t,e){null!==this.requestErrorAlert&&this.alerts.dismiss(this.requestErrorAlert),this.modal.show(c.Z,{error:t,formattedError:e})}route(t,e){void 0===e&&(e={});const n=this.routes[t];if(!n)throw new Error("Route '".concat(t,"' does not exist"));const r=n.path.replace(/:([^\/]+)/g,((t,n)=>"".concat((0,f.Z)(e,n))));for(const t in e)e.hasOwnProperty(t)&&!e[t]&&delete e[t];const s=m.buildQueryString(e);return(""===m.route.prefix?this.forum.attribute("basePath"):"")+r+(s?"?"+s:"")}}flarum.reg.add("core","common/Application",I)},2190:(t,e,n)=>{"use strict";n.d(e,{Z:()=>s});var r=n(7905);class s{constructor(){(0,r.Z)(this,"element",void 0),(0,r.Z)(this,"attrs",void 0),(0,r.Z)(this,"state",void 0)}oninit(t){this.setAttrs(t.attrs)}oncreate(t){this.element=t.dom}onbeforeupdate(t){this.setAttrs(t.attrs)}onupdate(t){}onbeforeremove(t){}onremove(t){}$(t){const e=$(this.element);return t?e.find(t):e}static component(t,e){void 0===t&&(t={}),void 0===e&&(e=null);const n={...t};return m(this,n,e)}setAttrs(t){if(void 0===t&&(t={}),this.constructor.initAttrs(t),t){if("children"in t)throw new Error("[".concat(this.constructor.name,'] The "children" attribute of attrs should never be used. Either pass children in as the vnode children or rename the attribute'));if("tag"in t)throw new Error("[".concat(this.constructor.name,'] You cannot use the "tag" attribute name with Mithril 2.'))}this.attrs=t}static initAttrs(t){}}flarum.reg.add("core","common/Component",s)},9175:(t,e,n)=>{"use strict";n.d(e,{Z:()=>i});var r=n(7905),s=n(7465),o=n(4300);class i{constructor(t,e){void 0===t&&(t={}),void 0===e&&(e=s.Z.store),(0,r.Z)(this,"data",{}),(0,r.Z)(this,"freshness",new Date),(0,r.Z)(this,"exists",!1),(0,r.Z)(this,"store",void 0),this.data=t,this.store=e}id(){return"id"in this.data?this.data.id:void 0}attribute(t){var e,n;return null==(e=this.data)||null==(n=e.attributes)?void 0:n[t]}pushData(t){if("id"in t&&(this.data.id=t.id),"type"in t&&(this.data.type=t.type),"attributes"in t){var e;(e=this.data).attributes||(e.attributes={});for(const e in t.attributes){const n=t.attributes[e];n&&n instanceof i&&((0,o.w)("Providing models as attributes to `Model.pushData()` or `Model.pushAttributes()` is deprecated.","3249"),delete t.attributes[e],t.relationships||(t.relationships={}),t.relationships[e]={data:i.getIdentifier(n)})}Object.assign(this.data.attributes,t.attributes)}if("relationships"in t){var n;const e=null!=(n=this.data.relationships)?n:{};for(const n in t.relationships){const r=t.relationships[n];if(null===r){delete e[n],delete t.relationships[n];continue}let s;s=r instanceof i?{data:i.getIdentifier(r)}:r instanceof Array?{data:r.map(i.getIdentifier)}:r,t.relationships[n]=s,e[n]=s}this.data.relationships=e}return this.freshness=new Date,this}pushAttributes(t){this.pushData({attributes:t})}save(t,e){void 0===e&&(e={});const n={type:this.data.type,attributes:t};if("id"in this.data&&(n.id=this.data.id),t.relationships){n.relationships={};for(const e in t.relationships){const r=t.relationships[e];null!==r&&(n.relationships[e]={data:r instanceof Array?r.map(i.getIdentifier):i.getIdentifier(r)})}delete t.relationships}const r=this.copyData();this.pushData(n);const o={data:n,meta:e.meta||void 0};return s.Z.request({method:this.exists?"PATCH":"POST",url:s.Z.forum.attribute("apiUrl")+this.apiEndpoint(),body:o,...e}).then((t=>this.store.pushPayload(t)),(t=>{throw this.pushData(r),m.redraw(),t}))}delete(t,e){return void 0===t&&(t={}),void 0===e&&(e={}),this.exists?s.Z.request({method:"DELETE",url:s.Z.forum.attribute("apiUrl")+this.apiEndpoint(),body:t,...e}).then((()=>{this.exists=!1,this.store.remove(this)})):Promise.resolve()}apiEndpoint(){return"/"+this.data.type+("id"in this.data?"/"+this.data.id:"")}copyData(){return JSON.parse(JSON.stringify(this.data))}rawRelationship(t){var e,n;return null==(e=this.data.relationships)||null==(n=e[t])?void 0:n.data}static attribute(t,e){return function(){return e?e(this.attribute(t)):this.attribute(t)}}static hasOne(t){return function(){var e,n;const r=null==(e=this.data.relationships)||null==(n=e[t])?void 0:n.data;if(r&&r instanceof Array)throw new Error("Relationship ".concat(t," on model ").concat(this.data.type," is plural, so the hasOne method cannot be used to access it."));return!!r&&this.store.getById(r.type,r.id)}}static hasMany(t){return function(){var e,n;const r=null==(e=this.data.relationships)||null==(n=e[t])?void 0:n.data;if(r&&!(r instanceof Array))throw new Error("Relationship ".concat(t," on model ").concat(this.data.type," is singular, so the hasMany method cannot be used to access it."));return!!r&&r.map((t=>this.store.getById(t.type,t.id)))}}static transformDate(t){return null!=t?new Date(t):t}static getIdentifier(t){return t&&"id"in t.data?{type:t.data.type,id:t.data.id}:null}}flarum.reg.add("core","common/Model",i)},775:(t,e,n)=>{"use strict";n.d(e,{Z:()=>o});var r=n(7905),s=n(7465);class o{constructor(t,e){(0,r.Z)(this,"user",void 0),(0,r.Z)(this,"csrfToken",void 0),this.user=t,this.csrfToken=e}login(t,e){return void 0===e&&(e={}),s.Z.request({method:"POST",url:"".concat(s.Z.forum.attribute("baseUrl"),"/login"),body:t,...e})}logout(){window.location.href="".concat(s.Z.forum.attribute("baseUrl"),"/logout?token=").concat(this.csrfToken)}}flarum.reg.add("core","common/Session",o)},6684:(t,e,n)=>{"use strict";n.d(e,{Y:()=>i,Z:()=>a});var r=n(7905),s=n(7465),o=n(4300);function i(t){return Array.isArray(t.data)}class a{constructor(t){(0,r.Z)(this,"data",{}),(0,r.Z)(this,"models",void 0),this.models=t}pushPayload(t){t.included&&t.included.map(this.pushObject.bind(this));const e=t.data instanceof Array?t.data.map((t=>this.pushObject(t,!1))):this.pushObject(t.data,!1);return e.payload=t,e}pushObject(t,e){if(void 0===e&&(e=!0),!this.models[t.type])return e||setTimeout((()=>(0,o.w)("Pushing object of type `".concat(t.type,"` not allowed, as type not yet registered in the store."),"3206"))),null;const n=this.data[t.type]=this.data[t.type]||{},r=n[t.id],s=r?r.pushData(t):this.createRecord(t.type,t);return n[t.id]=s,s.exists=!0,s}async find(t,e,n,r){void 0===n&&(n={}),void 0===r&&(r={});let o=n,a=s.Z.forum.attribute("apiUrl")+"/"+t;return e instanceof Array?a+="?filter[id]="+e.join(","):"object"==typeof e?o=e:e&&(a+="/"+e),s.Z.request({method:"GET",url:a,params:o,...r}).then((t=>(i(t),this.pushPayload(t))))}getById(t,e){var n,r;return null==(n=this.data)||null==(r=n[t])?void 0:r[e]}getBy(t,e,n){return this.all(t).filter((t=>t[e]()===n))[0]}all(t){const e=this.data[t];return e?Object.values(e):[]}remove(t){delete this.data[t.data.type][t.id()]}createRecord(t,e){return void 0===e&&(e={}),e.type=e.type||t,new this.models[t](e,this)}}flarum.reg.add("core","common/Store",a)},627:(t,e,n)=>{"use strict";n.d(e,{Z:()=>l});var r=n(7905),s=n(7302),o=n(1700),i=n(5537),a=n(6786);class l{constructor(){(0,r.Z)(this,"translations",{}),(0,r.Z)(this,"formatter",new s.Zk(null,this.formatterTypeHandlers(),s.TJ))}setLocale(t){this.formatter.locale=t}getLocale(){return this.formatter.locale}addTranslations(t){Object.assign(this.translations,t)}formatterTypeHandlers(){return{plural:o.kU,select:o.kO}}preprocessParameters(t){if("user"in t){const e=(0,a.Z)(t,"user");t.username||(t.username=(0,i.Z)(e))}return t}trans(t,e){void 0===e&&(e={});const n=this.translations[t];return n?(e=this.preprocessParameters(e),this.formatter.rich(n,e)):t}}flarum.reg.add("core","common/Translator",l)},7465:(t,e,n)=>{"use strict";n.d(e,{Z:()=>o});const r=window,s=new Proxy({},{get:(t,e)=>Reflect.get(r.app,e,r.app),set:(t,e,n)=>Reflect.set(r.app,e,n,r.app)}),o=s;flarum.reg.add("core","common/app",s)},3817:(t,e,n)=>{"use strict";n.d(e,{Z:()=>u});var r=n(2190),s=n(7202),o=n(1268),i=n(6786),a=n(3344),l=n(7465),c=n(9133);class u extends r.Z{view(t){const e=Object.assign({},this.attrs),n=(0,i.Z)(e,"type");e.className=(0,a.Z)("Alert","Alert--".concat(n),e.className);const r=(0,i.Z)(e,"title"),u=(0,i.Z)(e,"icon"),d=(0,i.Z)(e,"content")||t.children,h=(0,i.Z)(e,"controls")||[],f=(0,i.Z)(e,"dismissible"),p=(0,i.Z)(e,"ondismiss"),g=[];return(f||void 0===f)&&g.push(m(s.Z,{"aria-label":l.Z.translator.trans("core.lib.alert.dismiss_a11y_label"),icon:"fas fa-times",className:"Button Button--link Button--icon Alert-dismiss",onclick:p})),m("div",e,m("div",{className:(0,a.Z)("Alert-container",e.containerClassName)},!!r&&m("div",{className:"Alert-title"},!!u&&m("span",{className:"Alert-title-icon"},m(c.Z,{name:u})),m("span",{className:"Alert-title-text"},r)),m("span",{className:"Alert-body"},d),m("ul",{className:"Alert-controls"},(0,o.Z)(h.concat(g)))))}}flarum.reg.add("core","common/components/Alert",u)},8588:(t,e,n)=>{"use strict";n.d(e,{Z:()=>s});var r=n(2190);class s extends r.Z{oninit(t){super.oninit(t),this.state=this.attrs.state}view(){const t=this.state.getActiveAlerts();return m("div",{className:"AlertManager"},Object.keys(t).map(Number).map((e=>{const n=t[e],r="error"===n.attrs.type;return m("div",{className:"AlertManager-alert",role:"alert","aria-live":r?"assertive":"polite"},m(n.componentClass,Object.assign({},n.attrs,{ondismiss:this.state.dismiss.bind(this.state,e)}),n.children))})))}}flarum.reg.add("core","common/components/AlertManager",s)},7323:(t,e,n)=>{"use strict";n.d(e,{Z:()=>o});var r=n(3344),s=n(2190);class o extends s.Z{view(t){const{user:e,...n}=t.attrs;n.className=(0,r.Z)("Avatar",n.className),null!=n.loading||(n.loading="lazy");let s="";const o="undefined"===n.title||n.title;if(o||delete n.title,e){const t=e.displayName()||"?",r=e.avatarUrl();if(o&&(n.title=n.title||t),r)return m("img",Object.assign({},n,{src:r,alt:""}));s=t.charAt(0).toUpperCase(),n.style={"--avatar-bg":e.color()}}return m("span",n,s)}}flarum.reg.add("core","common/components/Avatar",o)},3804:(t,e,n)=>{"use strict";n.d(e,{Z:()=>l});var r=n(6439),s=n(2190),o=n(3344),i=n(9215),a=n(9133);class l extends s.Z{view(){const{type:t,icon:e,label:n,color:s,style:l={},...c}=this.attrs,u=(0,o.Z)("Badge",[t&&"Badge--".concat(t)],c.className,(0,i.Z)(s)),d=e?m(a.Z,{name:e,className:"Badge-icon"}):m.trust(" "),h={...l,"--badge-bg":s},f={...c,className:u,style:h},p=m("div",f,d);return n?m(r.Z,{text:n},p):p}}flarum.reg.add("core","common/components/Badge",l)},7202:(t,e,n)=>{"use strict";n.d(e,{Z:()=>c});var r=n(2190),s=n(4300),o=n(3344),i=n(1552),a=n(5226),l=n(9133);class c extends r.Z{view(t){let{type:e,title:n,"aria-label":r,icon:s,disabled:a,loading:l,className:c,class:u,...d}=this.attrs;e||(e="button"),r||(r=n),"object"==typeof r&&(r=(0,i.Z)(r)),(a||l)&&delete d.onclick,c=(0,o.Z)(u,c,{hasIcon:s,disabled:a||l,loading:l});const h={disabled:a,className:c,type:e,"aria-label":r,...d};return m("button",h,this.getButtonContent(t.children))}oncreate(t){var e,n;super.oncreate(t);const{"aria-label":r}=this.attrs;this.view!==c.prototype.view||r||(0,i.Z)(t.children)||null!=(e=this.element)&&null!=(n=e.getAttribute)&&n.call(e,"aria-label")||(0,s.Z)('[Flarum Accessibility Warning] Button has no content and no accessible label. This means that screen-readers will not be able to interpret its meaning and just read "Button". Consider providing accessible text via the `aria-label` attribute. https://web.dev/button-name',this.element)}getButtonContent(t){const e=this.attrs.icon;return[e&&m(l.Z,{name:e,className:"Button-icon"}),t&&m("span",{className:"Button-label"},t),this.attrs.loading&&m(a.Z,{size:"small",display:"inline"})]}}flarum.reg.add("core","common/components/Button",c)},7298:(t,e,n)=>{"use strict";n.d(e,{Z:()=>l});var r=n(2190),s=n(5226),o=n(3344),i=n(7669),a=n(9133);class l extends r.Z{view(t){const e=(0,o.Z)(["Checkbox",this.attrs.state?"on":"off",this.attrs.className,this.attrs.loading&&"loading",this.attrs.disabled&&"disabled"]);return m("label",{className:e},m("input",{type:"checkbox",checked:this.attrs.state,disabled:this.attrs.disabled,onchange:(0,i.Z)("checked",this.onchange.bind(this))}),m("div",{className:"Checkbox-display","aria-hidden":"true"},this.getDisplay()),t.children)}getDisplay(){return this.attrs.loading?m(s.Z,{display:"unset",size:"small"}):m(a.Z,{name:this.attrs.state?"fas fa-check":"fas fa-times"})}onchange(t){this.attrs.onchange&&this.attrs.onchange(t,this)}}flarum.reg.add("core","common/components/Checkbox",l)},344:(t,e,n)=>{"use strict";n.d(e,{Z:()=>u});var r=n(7905),s=n(7465),o=n(2190),i=n(1268),a=n(1552),l=n(6439),c=n(9133);class u extends o.Z{constructor(){super(...arguments),(0,r.Z)(this,"showing",!1)}static initAttrs(t){t.className||(t.className=""),t.buttonClassName||(t.buttonClassName=""),t.menuClassName||(t.menuClassName=""),t.label||(t.label=""),null!=t.caretIcon||(t.caretIcon="fas fa-caret-down"),t.accessibleToggleLabel||(t.accessibleToggleLabel=(0,a.Z)(s.Z.translator.trans("core.lib.dropdown.toggle_dropdown_accessible_label")))}view(t){const e=t.children?(0,i.Z)(t.children):[],n=!this.attrs.lazyDraw||this.showing;return m("div",{className:"ButtonGroup Dropdown dropdown "+this.attrs.className+" itemCount"+e.length+(this.showing?" open":"")},this.getButton(t.children),n&&this.getMenu(e))}oncreate(t){super.oncreate(t),this.$().on("shown.bs.dropdown",(()=>{var t,e,n,r,s,o,i,a,l,c,u;const{lazyDraw:d,onshow:h}=this.attrs;this.showing=!0,d&&m.redraw.sync(),"function"==typeof h&&h(),d||m.redraw();const f=this.$(".Dropdown-menu"),p=f.hasClass("Dropdown-menu--right"),g=null!=(t=null==(e=f.offset())?void 0:e.top)?t:0,v=null!=(n=f.height())?n:0,b=null!=(r=$(window).scrollTop())?r:0,y=null!=(s=$(window).height())?s:0;f.removeClass("Dropdown-menu--top Dropdown-menu--right"),f.toggleClass("Dropdown-menu--top",g+v>b+y),((null==(o=f.offset())?void 0:o.top)||0)<0&&f.removeClass("Dropdown-menu--top");const w=null!=(i=null==(a=f.offset())?void 0:a.left)?i:0,Z=null!=(l=f.width())?l:0,x=null!=(c=$(window).scrollLeft())?c:0,k=null!=(u=$(window).width())?u:0;f.toggleClass("Dropdown-menu--right",p||w+Z>x+k)})),this.$().on("hidden.bs.dropdown",(()=>{this.showing=!1,this.attrs.onhide&&this.attrs.onhide(),m.redraw()}))}getButton(t){let e=m("button",{className:"Dropdown-toggle "+this.attrs.buttonClassName,"aria-haspopup":"menu","aria-label":this.attrs.accessibleToggleLabel,"data-toggle":"dropdown",onclick:this.attrs.onclick},this.getButtonContent(t));return this.attrs.tooltip&&(e=m(l.Z,{text:this.attrs.tooltip,position:"bottom"},e)),e}getButtonContent(t){return[this.attrs.icon?m(c.Z,{name:this.attrs.icon,className:"Button-icon"}):"",m("span",{className:"Button-label"},this.attrs.label),this.attrs.caretIcon?m(c.Z,{name:this.attrs.caretIcon,className:"Button-caret"}):""]}getMenu(t){return m("ul",{className:"Dropdown-menu dropdown-menu "+this.attrs.menuClassName},t)}}flarum.reg.add("core","common/components/Dropdown",u)},8034:(t,e,n)=>{"use strict";n.d(e,{Z:()=>o});var r=n(2190),s=n(3344);class o extends r.Z{view(t){return m("div",{className:(0,s.Z)("FieldSet",this.attrs.className),role:"group","aria-label":this.attrs.label,"aria-disabled":!1},m("label",{className:"FieldSet-label","aria-hidden":"true"},this.attrs.label),this.attrs.description?m("div",{className:"FieldSet-description helpText"},this.attrs.description):null,m("div",{className:"FieldSet-items"},t.children))}}flarum.reg.add("core","common/components/FieldSet",o)},6352:(t,e,n)=>{"use strict";n.d(e,{Z:()=>o});var r=n(2190),s=n(3344);class o extends r.Z{view(t){const{label:e,description:n,className:r,...o}=t.attrs;return m("div",Object.assign({className:(0,s.Z)("Form",r)},o),m("div",{className:"Form-header"},e&&m("label",null,e),n&&m("p",{className:"helpText"},n)),m("div",{className:"Form-body"},t.children))}}flarum.reg.add("core","common/components/Form",o)},6697:(t,e,n)=>{"use strict";n.d(e,{Z:()=>s});var r=n(3804);class s extends r.Z{static initAttrs(t){super.initAttrs(t),t.group&&(t.icon=t.group.icon()||"",t.color=t.group.color()||"",t.label=void 0===t.label?t.group.nameSingular():t.label,t.type="group--"+t.group.id(),delete t.group)}}flarum.reg.add("core","common/components/GroupBadge",s)},9133:(t,e,n)=>{"use strict";n.d(e,{Z:()=>o});var r=n(3344),s=n(2190);class o extends s.Z{view(t){const{name:e,...n}=t.attrs;return n.className=(0,r.Z)("icon",e,n.className),m("i",Object.assign({"aria-hidden":"true"},n))}}flarum.reg.add("core","common/components/Icon",o)},5226:(t,e,n)=>{"use strict";n.d(e,{Z:()=>i});var r=n(7465),s=n(2190),o=n(3344);class i extends s.Z{view(){const{display:t="block",size:e="medium",containerClassName:n,className:s,...i}=this.attrs,a=(0,o.Z)("LoadingIndicator",s),l=(0,o.Z)("LoadingIndicator-container","unset"!==t&&"LoadingIndicator-container--".concat(t),e&&"LoadingIndicator-container--".concat(e),n);return m("div",Object.assign({"aria-label":r.Z.translator.trans("core.lib.loading_indicator.accessible_label"),role:"status"},i.containerAttrs,{"data-size":e,className:l}),m("div",Object.assign({"aria-hidden":"true",className:a},i)))}}flarum.reg.add("core","common/components/LoadingIndicator",i)},7108:(t,e,n)=>{"use strict";n.d(e,{Z:()=>u});var r=n(7905),s=n(7465),o=n(2190),i=n(3817),a=n(7202),l=n(4300),c=n(3344);class u extends o.Z{constructor(){super(...arguments),(0,r.Z)(this,"loading",!1),(0,r.Z)(this,"alertAttrs",null)}static get dismissibleOptions(){return this.isDismissible?{isDismissible:!0,viaCloseButton:this.isDismissibleViaCloseButton,viaEscKey:this.isDismissibleViaEscKey,viaBackdropClick:this.isDismissibleViaBackdropClick}:{isDismissible:!1,viaCloseButton:!1,viaEscKey:!1,viaBackdropClick:!1}}oninit(t){super.oninit(t);const e=[];["className","title","content","onsubmit"].forEach((t=>{this[t]||(this[t]=function(){},e.push(t))})),e.length>0&&(0,l.Z)("Modal `".concat(this.constructor.name,"` does not implement all abstract methods of the Modal super class. Missing methods: ").concat(e.join(", "),"."))}oncreate(t){super.oncreate(t),this.attrs.animateShow((()=>this.onready()))}onbeforeremove(t){if(super.onbeforeremove(t),!this.attrs.state.modal)return new Promise((t=>setTimeout(t,300)))}view(){return this.alertAttrs&&(this.alertAttrs.dismissible=!1),m("div",{className:(0,c.Z)("Modal modal-dialog fade",this.className())},m("div",{className:"Modal-content"},this.dismissibleOptions.viaCloseButton&&m("div",{className:"Modal-close App-backControl"},m(a.Z,{icon:"fas fa-times",onclick:()=>this.hide(),className:"Button Button--icon Button--link","aria-label":s.Z.translator.trans("core.lib.modal.close")})),m("form",{onsubmit:this.onsubmit.bind(this)},m("div",{className:"Modal-header"},m("h3",{className:"App-titleControl App-titleControl--text"},this.title())),!!this.alertAttrs&&m("div",{className:"Modal-alert"},m(i.Z,this.alertAttrs)),this.content())))}onsubmit(t){}onready(){this.$().find("input, select, textarea").first().trigger("focus").trigger("select")}hide(){this.attrs.animateHide()}loaded(){this.loading=!1,m.redraw()}onerror(t){var e;this.alertAttrs=t.alert,m.redraw(),422===t.status&&null!=(e=t.response)&&e.errors?this.$("form [name="+t.response.errors[0].source.pointer.replace("/data/attributes/","")+"]").trigger("select"):this.onready()}get dismissibleOptions(){return this.constructor.dismissibleOptions}}(0,r.Z)(u,"isDismissible",!0),(0,r.Z)(u,"isDismissibleViaCloseButton",!0),(0,r.Z)(u,"isDismissibleViaEscKey",!0),(0,r.Z)(u,"isDismissibleViaBackdropClick",!0),flarum.reg.add("core","common/components/Modal",u)},2039:(t,e,n)=>{"use strict";n.d(e,{Z:()=>l});var r=n(7905),s=n(2190),o=n(2795),i=n(8378),a=n(5226);class l extends s.Z{constructor(){super(...arguments),(0,r.Z)(this,"focusTrap",void 0),(0,r.Z)(this,"lastSetFocusTrap",void 0),(0,r.Z)(this,"modalClosing",!1),(0,r.Z)(this,"keyUpListener",null)}view(t){return m("[",null,this.attrs.state.modalList.map(((t,e)=>{const n=null==t?void 0:t.componentClass;return m("div",{key:t.key,className:"ModalManager modal","data-modal-key":t.key,"data-modal-number":e,role:"dialog","aria-modal":"true",style:{"--modal-number":e},"aria-hidden":this.attrs.state.modal!==t&&"true"},!!n&&[m(n,Object.assign({key:t.key},t.attrs,{animateShow:this.animateShow.bind(this),animateHide:this.animateHide.bind(this),state:this.attrs.state})),m("div",{key:t.key,className:"ModalManager-invisibleBackdrop",onclick:this.handlePossibleBackdropClick.bind(this)})])})),(this.attrs.state.backdropShown||this.attrs.state.loadingModal)&&m("div",{className:"Modal-backdrop backdrop",ontransitionend:this.onBackdropTransitionEnd.bind(this),"data-showing":!!this.attrs.state.modalList.length||this.attrs.state.loadingModal,style:{"--modal-count":this.attrs.state.modalList.length+Number(this.attrs.state.loadingModal)}},this.attrs.state.loadingModal&&m(a.Z,null)))}oncreate(t){super.oncreate(t),this.keyUpListener=this.handleEscPress.bind(this),document.body.addEventListener("keyup",this.keyUpListener)}onbeforeremove(t){super.onbeforeremove(t),this.keyUpListener&&document.body.removeEventListener("keyup",this.keyUpListener),this.keyUpListener=null}onupdate(t){super.onupdate(t),requestAnimationFrame((()=>{try{var t,e,n,r;if(!this.attrs.state.isModalOpen())return null==(e=document.getElementById("app"))||e.setAttribute("aria-hidden","false"),null==(n=(r=this.focusTrap).deactivate)||n.call(r),void(0,i.tP)();null==(t=document.getElementById("app"))||t.setAttribute("aria-hidden","true");const u=this.attrs.state.modal.key;var s,a,l,c;this.focusTrap&&this.lastSetFocusTrap!==u&&(null==(s=(a=this.focusTrap).deactivate)||s.call(a),(0,i.tP)()),this.activeDialogElement&&this.lastSetFocusTrap!==u&&(this.focusTrap=(0,o.v)(this.activeDialogElement,{allowOutsideClick:!0}),null==(l=(c=this.focusTrap).activate)||l.call(c),(0,i.Qp)(this.activeDialogManagerElement,{reserveScrollBarGap:!0})),this.lastSetFocusTrap=u}catch{}}))}get activeDialogElement(){var t;return document.body.querySelector('.ModalManager[data-modal-key="'.concat(null==(t=this.attrs.state.modal)?void 0:t.key,'"] .Modal'))}get activeDialogManagerElement(){var t;return document.body.querySelector('.ModalManager[data-modal-key="'.concat(null==(t=this.attrs.state.modal)?void 0:t.key,'"]'))}animateShow(t){void 0===t&&(t=()=>{}),this.attrs.state.modal&&(this.activeDialogElement.addEventListener("transitionend",(()=>{t()}),{once:!0}),requestAnimationFrame((()=>{this.activeDialogElement.classList.add("in")})))}animateHide(t){void 0===t&&(t=()=>{}),this.modalClosing||(this.modalClosing=!0,this.activeDialogElement.addEventListener("transitionend",(()=>{this.modalClosing=!1,this.attrs.state.close(),t()}),{once:!0}),this.activeDialogElement.classList.remove("in"),this.activeDialogElement.classList.add("out"))}handleEscPress(t){if(!this.attrs.state.modal)return;const e=this.attrs.state.modal.componentClass.dismissibleOptions;"Escape"===t.key&&e.viaEscKey&&(t.preventDefault(),this.animateHide())}handlePossibleBackdropClick(t){this.attrs.state.modal&&this.attrs.state.modal.componentClass.dismissibleOptions.viaBackdropClick&&this.animateHide()}onBackdropTransitionEnd(t){"opacity"===t.propertyName&&null===t.currentTarget.getAttribute("data-showing")&&(this.attrs.state.backdropShown=!1,m.redraw())}}flarum.reg.add("core","common/components/ModalManager",l)},5386:(t,e,n)=>{"use strict";n.d(e,{Z:()=>l});var r=n(7465),s=n(2190),o=n(7202),i=n(2360),a=n(3344);class l extends s.Z{view(){const{history:t,pane:e}=r.Z;return m("div",{className:(0,a.Z)("Navigation ButtonGroup",this.attrs.className),onmouseenter:e&&e.show.bind(e),onmouseleave:e&&e.onmouseleave.bind(e)},null!=t&&t.canGoBack()?[this.getBackButton(),this.getPaneButton()]:this.getDrawerButton())}getBackButton(){const{history:t}=r.Z,e=null==t?void 0:t.getPrevious();return m(i.Z,{className:"Button Navigation-back Button--icon",href:null==t?void 0:t.backUrl(),icon:"fas fa-chevron-left","aria-label":null==e?void 0:e.title,onclick:e=>{e.shiftKey||e.ctrlKey||e.metaKey||2===e.which||(e.preventDefault(),null==t||t.back())}})}getPaneButton(){const{pane:t}=r.Z;return t&&t.active?m(o.Z,{className:(0,a.Z)("Button Button--icon Navigation-pin",{active:t.pinned}),onclick:t.togglePinned.bind(t),icon:"fas fa-thumbtack"}):null}getDrawerButton(){if(!this.attrs.drawer)return null;const{drawer:t}=r.Z,e=r.Z.session.user;return m(o.Z,{className:(0,a.Z)("Button Button--icon Navigation-drawer",{new:null==e?void 0:e.newNotificationCount()}),onclick:e=>{e.stopPropagation(),t.show()},icon:"fas fa-bars","aria-label":r.Z.translator.trans("core.lib.nav.drawer_button")})}}flarum.reg.add("core","common/components/Navigation",l)},4661:(t,e,n)=>{"use strict";n.d(e,{Z:()=>a});var r=n(7905),s=n(7465),o=n(2190),i=n(5013);class a extends o.Z{constructor(){super(...arguments),(0,r.Z)(this,"bodyClass",""),(0,r.Z)(this,"scrollTopOnCreate",!0),(0,r.Z)(this,"useBrowserScrollRestoration",!0)}oninit(t){super.oninit(t),s.Z.previous=s.Z.current,s.Z.current=new i.Z(this.constructor,{routeName:this.attrs.routeName}),s.Z.drawer.hide(),s.Z.modal.close()}oncreate(t){super.oncreate(t),this.bodyClass&&$("#app").addClass(this.bodyClass),this.scrollTopOnCreate&&$(window).scrollTop(0),"scrollRestoration"in history&&(history.scrollRestoration=this.useBrowserScrollRestoration?"auto":"manual")}onremove(t){super.onremove(t),this.bodyClass&&$("#app").removeClass(this.bodyClass)}}flarum.reg.add("core","common/components/Page",a)},406:(t,e,n)=>{"use strict";n.d(e,{Z:()=>s});var r=n(7108);class s extends r.Z{className(){return"RequestErrorModal Modal--large"}title(){return!!this.attrs.error.xhr&&"".concat(this.attrs.error.xhr.status," ").concat(this.attrs.error.xhr.statusText)}content(){const{error:t,formattedError:e}=this.attrs;let n;return n=e.length?e.join("\n\n"):t.response?JSON.stringify(t.response,null,2):t.responseText,m("div",{className:"Modal-body"},m("pre",null,this.attrs.error.options.method," ",this.attrs.error.options.url,m("br",null),m("br",null),n))}}flarum.reg.add("core","common/components/RequestErrorModal",s)},2812:(t,e,n)=>{"use strict";n.d(e,{Z:()=>a});var r=n(344),s=n(3344),o=n(9133);function i(t){if(!t||"object"!=typeof t||t instanceof Array)return!1;const e=t.tag;return("string"!=typeof e||"a"===e||"button"===e)&&("object"!=typeof e&&"function"!=typeof e||!("initAttrs"in e)||e.initAttrs(t.attrs),"object"!=typeof e&&"function"!=typeof e||!("isActive"in e)?t.attrs.active:e.isActive(t.attrs))}class a extends r.Z{static initAttrs(t){null!=t.caretIcon||(t.caretIcon="fas fa-sort"),super.initAttrs(t),t.className=(0,s.Z)(t.className,"Dropdown--select")}getButtonContent(t){const e=t.find(i);let n=e&&"object"==typeof e&&"children"in e&&e.children||this.attrs.defaultLabel;return[m("span",{className:"Button-label"},n),this.attrs.caretIcon?m(o.Z,{name:this.attrs.caretIcon,className:"Button-caret"}):null]}}flarum.reg.add("core","common/components/SelectDropdown",a)},4197:(t,e,n)=>{"use strict";n.d(e,{Z:()=>l});var r=n(344),s=n(7202),o=n(3344),i=n(6439),a=n(9133);class l extends r.Z{static initAttrs(t){super.initAttrs(t),t.className=(0,o.Z)(t.className,"Dropdown--split",{"Dropdown--withMainAction":t.mainAction}),t.menuClassName=(0,o.Z)(t.menuClassName,"Dropdown-menu--right")}getButton(t){const e=this.attrs.mainAction||this.getFirstChild(t),n=Object.assign({},null==e?void 0:e.attrs);n.className=(0,o.Z)(n.className,"SplitDropdown-button Button",this.attrs.buttonClassName);let r=m(s.Z,n,e.children);return this.attrs.tooltip&&(r=m(i.Z,{text:this.attrs.tooltip,position:"bottom"},r)),m("[",null,r,m("button",{className:"Dropdown-toggle Button Button--icon "+this.attrs.buttonClassName,"aria-haspopup":"menu","aria-label":this.attrs.accessibleToggleLabel,"data-toggle":"dropdown"},this.attrs.icon?m(a.Z,{name:this.attrs.icon,className:"Button-icon"}):null,m(a.Z,{name:"fas fa-caret-down",className:"Button-caret"})))}getFirstChild(t){let e=t;for(;e instanceof Array;)e=e[0];return e}}flarum.reg.add("core","common/components/SplitDropdown",l)},9797:(t,e,n)=>{"use strict";n.d(e,{Z:()=>o});var r=n(3344),s=n(7298);class o extends s.Z{static initAttrs(t){super.initAttrs(t),t.className=(0,r.Z)(t.className,"Checkbox--switch")}getDisplay(){return!!this.attrs.loading&&super.getDisplay()}}flarum.reg.add("core","common/components/Switch",o)},6439:(t,e,n)=>{"use strict";n.d(e,{Z:()=>a});var r=n(7905),s=n(2190),o=n(3344),i=n(1552);class a extends s.Z{constructor(){super(...arguments),(0,r.Z)(this,"firstChild",null),(0,r.Z)(this,"childDomNode",null),(0,r.Z)(this,"oldText",""),(0,r.Z)(this,"oldVisibility",void 0),(0,r.Z)(this,"shouldRecreateTooltip",!1),(0,r.Z)(this,"shouldChangeTooltipVisibility",!1)}view(t){const e=t.children,{text:n,tooltipVisible:r,showOnFocus:s=!0,position:o="top",ignoreTitleWarning:i=!1,html:a=!1,delay:l=0,...c}=this.attrs;this.attrs.title&&!i&&console.warn("`title` attribute was passed to Tooltip component. Was this intentional? Tooltip content should be passed to the `text` attr instead.");const u=this.getRealText();if(u!==this.oldText&&(this.oldText=u,this.shouldRecreateTooltip=!0),r!==this.oldVisibility&&(this.oldVisibility=this.attrs.tooltipVisible,this.shouldChangeTooltipVisibility=!0),void 0===e)throw new Error("Tooltip component was provided with no direct child DOM element. Tooltips must contain a single direct DOM node to attach to.");if(1!==e.length)throw new Error("Tooltip component was either passed more than one or no child node.\n\nPlease wrap multiple children in another element, such as a
or .");const d=e[0];if("object"!=typeof d||Array.isArray(d)||null===d)throw new Error("Tooltip component was provided with no direct child DOM element. Tooltips must contain a single direct DOM node to attach to.");if("string"==typeof d.tag&&["#","[","<"].includes(d.tag))throw new Error('Tooltip component with provided with a vnode with tag "'.concat(d.tag,'". This is not a DOM element, so is not a valid child element. Please wrap this vnode in another element, such as a
or .'));return this.firstChild=d,e}oncreate(t){super.oncreate(t),this.checkDomNodeChanged(),this.recreateTooltip()}onupdate(t){super.onupdate(t),this.checkDomNodeChanged(),this.recreateTooltip()}recreateTooltip(){this.shouldRecreateTooltip&&null!==this.childDomNode&&($(this.childDomNode).tooltip("destroy","DANGEROUS_tooltip_jquery_fn_deprecation_exempt"),this.createTooltip(),this.shouldRecreateTooltip=!1),this.shouldChangeTooltipVisibility&&(this.shouldChangeTooltipVisibility=!1,this.updateVisibility())}updateVisibility(){null!==this.childDomNode&&(!0===this.attrs.tooltipVisible?$(this.childDomNode).tooltip("show","DANGEROUS_tooltip_jquery_fn_deprecation_exempt"):!1===this.attrs.tooltipVisible&&$(this.childDomNode).tooltip("hide","DANGEROUS_tooltip_jquery_fn_deprecation_exempt"))}createTooltip(){if(null===this.childDomNode)return;const{showOnFocus:t=!0,position:e="top",delay:n,html:r=!1,tooltipVisible:s,text:i}=this.attrs,a="boolean"==typeof s?"manual":(0,o.Z)("hover",[t&&"focus"]),l=this.getRealText();this.childDomNode.setAttribute("title",l),this.childDomNode.setAttribute("aria-label",l),$(this.childDomNode).tooltip({html:r,delay:n,placement:e,trigger:a},"DANGEROUS_tooltip_jquery_fn_deprecation_exempt")}getRealText(){const{text:t}=this.attrs;return Array.isArray(t)?(0,i.Z)(t):t}checkDomNodeChanged(){const t=this.firstChild.dom;t&&!t.isSameNode(this.childDomNode)&&(this.childDomNode=t,this.shouldRecreateTooltip=!0)}}flarum.reg.add("core","common/components/Tooltip",a)},8134:(t,e,n)=>{"use strict";function r(t,e,n){if("string"==typeof t){let[s,o]=flarum.reg.namespaceAndIdFromPath(t);return flarum.reg.onLoad(s,o,(t=>{r(t.prototype,e,n)}))}(Array.isArray(e)?e:[e]).forEach((e=>{const r=t[e];t[e]=function(){for(var t=arguments.length,e=new Array(t),s=0;sr}),flarum.reg.add("core","common/extend",{extend:r,override:function t(e,n,r){if("string"==typeof e){let[s,o]=flarum.reg.namespaceAndIdFromPath(e);return flarum.reg.onLoad(s,o,(e=>{t(e.prototype,n,r)}))}(Array.isArray(n)?n:[n]).forEach((t=>{const n=e[t];e[t]=function(){for(var t=arguments.length,e=new Array(t),s=0;s{"use strict";n.d(e,{Z:()=>s});var r=n(7465);function s(t,e,n){var s,o;console.group("%c".concat(e),"background-color: #d83e3e; color: #ffffff; font-weight: bold;"),console.error(n),console.groupEnd(),null!=(s=r.Z.session)&&null!=(o=s.user)&&o.isAdmin()&&r.Z.alerts.show({type:"error"},"".concat(t))}flarum.reg.add("core","common/helpers/fireApplicationError",s)},4300:(t,e,n)=>{"use strict";n.d(e,{Z:()=>s,w:()=>o});var r=n(7465);function s(){r.Z.forum.attribute("debug")&&console.warn(...arguments)}function o(t,e,n,r){void 0===n&&(n="2.0"),void 0===r&&(r="flarum/core"),s("[Flarum ".concat(n," Deprecation] ").concat(t,"\n\nSee: https://github.com/").concat(r,"/pull/").concat(e))}flarum.reg.add("core","common/helpers/fireDebugWarning",s)},3726:(t,e,n)=>{"use strict";n.d(e,{Z:()=>o});var r=n(3860),s=n.n(r);function o(t){const e=s()(t),n=e.format(),r=e.format("LLLL");return m("time",{pubdate:!0,datetime:n},r)}flarum.reg.add("core","common/helpers/fullTime",o)},156:(t,e,n)=>{"use strict";n.d(e,{Z:()=>s});var r=n(1061);function s(t,e,n){if(!e&&!n)return t;const s=e instanceof RegExp?e:new RegExp(null!=e?e:"","gi");let o=t,i=0;return n&&(e&&(i=Math.max(0,t.search(s)-n/2)),o=(0,r.$G)(o,n,i)),o=$("
").text(o).html(),e&&(o=o.replace(s,"$&")),m.trust(o)}flarum.reg.add("core","common/helpers/highlight",s)},9841:(t,e,n)=>{"use strict";n.d(e,{Z:()=>i});var r=n(3860),s=n.n(r),o=n(9423);function i(t){const e=s()(t),n=e.format(),r=e.format("LLLL"),i=(0,o.Z)(t);return m("time",{pubdate:!0,datetime:n,title:r,"data-humantime":!0},i)}flarum.reg.add("core","common/helpers/humanTime",i)},1268:(t,e,n)=>{"use strict";n.d(e,{Z:()=>a});var r=n(2903),s=n(3344);function o(t){return"object"==typeof t&&null!==t&&"tag"in t}function i(t){return o(t)&&t.tag===r.Z}function a(t,e,n){void 0===e&&(e="li"),void 0===n&&(n={});const r=e;return function(t){const e=[];let n;return t.filter(Boolean).forEach(((r,s)=>{(!i(r)||n&&!i(n)&&s!==t.length-1)&&(n=r,e.push(r))})),e}(t instanceof Array?t:[t]).map((t=>{var e;const i=[t.itemName&&"item-".concat(t.itemName)];if(o(t)&&t.tag.isListItem)return t.attrs=t.attrs||{},t.attrs.key=t.attrs.key||t.itemName,t.key=t.attrs.key,t;var a,l,c;o(t)&&(i.push((null==(a=t.attrs)?void 0:a.itemClassName)||t.itemClassName),null!=(l=(c=t.tag).isActive)&&l.call(c,t.attrs)&&i.push("active"));const u=o(t)&&(null==t||null==(e=t.attrs)?void 0:e.key)||t.itemName;return m(r,Object.assign({className:(0,s.Z)(i),key:u},n),t)}))}flarum.reg.add("core","common/helpers/listItems",a)},9215:(t,e,n)=>{"use strict";n.d(e,{Z:()=>s});var r=n(6476);function s(t){return t?(0,r.Z)(t)?"text-contrast--light":"text-contrast--dark":"text-contrast--unchanged"}flarum.reg.add("core","common/helpers/textContrastClass",s)},236:(t,e,n)=>{"use strict";n.d(e,{Z:()=>s});var r=n(9133);function s(t){return t.lastSeenAt()&&t.isOnline()?m("span",{className:"UserOnline"},m(r.Z,{name:"fas fa-circle"})):null}flarum.reg.add("core","common/helpers/userOnline",s)},5537:(t,e,n)=>{"use strict";n.d(e,{Z:()=>o});var r=n(7465),s=n(1552);function o(t,e){const n=t&&t.displayName()||(0,s.Z)(r.Z.translator.trans("core.lib.username.deleted_text")),o=e?e(n):n;return m("span",{className:"username"},o)}flarum.reg.add("core","common/helpers/username",o)},7366:(t,e,n)=>{"use strict";n.d(e,{Z:()=>s});var r=n(9175);class s extends r.Z{token(){return r.Z.attribute("token").call(this)}userId(){return r.Z.attribute("userId").call(this)}title(){return r.Z.attribute("title").call(this)}type(){return r.Z.attribute("type").call(this)}createdAt(){return r.Z.attribute("createdAt",r.Z.transformDate).call(this)}lastActivityAt(){return r.Z.attribute("lastActivityAt",r.Z.transformDate).call(this)}lastIpAddress(){return r.Z.attribute("lastIpAddress").call(this)}device(){return r.Z.attribute("device").call(this)}isCurrent(){return r.Z.attribute("isCurrent").call(this)}isSessionToken(){return r.Z.attribute("isSessionToken").call(this)}}flarum.reg.add("core","common/models/AccessToken",s)},6322:(t,e,n)=>{"use strict";n.d(e,{Z:()=>l});var r=n(7465),s=n(9175),o=n(1356),i=n(4041),a=n(3804);class l extends s.Z{title(){return s.Z.attribute("title").call(this)}slug(){return s.Z.attribute("slug").call(this)}createdAt(){return s.Z.attribute("createdAt",s.Z.transformDate).call(this)}user(){return s.Z.hasOne("user").call(this)}firstPost(){return s.Z.hasOne("firstPost").call(this)}lastPostedAt(){return s.Z.attribute("lastPostedAt",s.Z.transformDate).call(this)}lastPostedUser(){return s.Z.hasOne("lastPostedUser").call(this)}lastPost(){return s.Z.hasOne("lastPost").call(this)}lastPostNumber(){return s.Z.attribute("lastPostNumber").call(this)}commentCount(){return s.Z.attribute("commentCount").call(this)}replyCount(){return(0,o.Z)("commentCount",(t=>{var e;return Math.max(0,(null!=(e=t)?e:0)-1)})).call(this)}posts(){return s.Z.hasMany("posts").call(this)}mostRelevantPost(){return s.Z.hasOne("mostRelevantPost").call(this)}lastReadAt(){return s.Z.attribute("lastReadAt",s.Z.transformDate).call(this)}lastReadPostNumber(){return s.Z.attribute("lastReadPostNumber").call(this)}isUnread(){return(0,o.Z)("unreadCount",(t=>!!t)).call(this)}isRead(){return(0,o.Z)("unreadCount",(t=>!(!r.Z.session.user||t))).call(this)}hiddenAt(){return s.Z.attribute("hiddenAt",s.Z.transformDate).call(this)}hiddenUser(){return s.Z.hasOne("hiddenUser").call(this)}isHidden(){return(0,o.Z)("hiddenAt",(t=>!!t)).call(this)}canReply(){return s.Z.attribute("canReply").call(this)}canRename(){return s.Z.attribute("canRename").call(this)}canHide(){return s.Z.attribute("canHide").call(this)}canDelete(){return s.Z.attribute("canDelete").call(this)}removePost(t){const e=this.rawRelationship("posts");e&&e.some(((n,r)=>t===n.id&&(e.splice(r,1),!0)))}unreadCount(){var t,e,n;const s=r.Z.session.user;if(s&&(null!=(t=null==(e=s.markedAllAsReadAt())?void 0:e.getTime())?t:0)<(null==(n=this.lastPostedAt())?void 0:n.getTime())){var o,i;const t=Math.max(0,(null!=(o=this.lastPostNumber())?o:0)-(this.lastReadPostNumber()||0));return Math.min(t,null!=(i=this.commentCount())?i:0)}return 0}badges(){const t=new i.Z;return this.isHidden()&&t.add("hidden",m(a.Z,{type:"hidden",icon:"fas fa-trash",label:r.Z.translator.trans("core.lib.badge.hidden_tooltip")})),t}postIds(){var t,e;return null!=(t=null==(e=this.rawRelationship("posts"))?void 0:e.map((t=>t.id)))?t:[]}}flarum.reg.add("core","common/models/Discussion",l)},3813:(t,e,n)=>{"use strict";n.d(e,{Z:()=>s});var r=n(9175);class s extends r.Z{apiEndpoint(){return"/"}}flarum.reg.add("core","common/models/Forum",s)},7645:(t,e,n)=>{"use strict";n.d(e,{Z:()=>o});var r=n(7905),s=n(9175);class o extends s.Z{nameSingular(){return s.Z.attribute("nameSingular").call(this)}namePlural(){return s.Z.attribute("namePlural").call(this)}color(){return s.Z.attribute("color").call(this)}icon(){return s.Z.attribute("icon").call(this)}isHidden(){return s.Z.attribute("isHidden").call(this)}}(0,r.Z)(o,"ADMINISTRATOR_ID","1"),(0,r.Z)(o,"GUEST_ID","2"),(0,r.Z)(o,"MEMBER_ID","3"),flarum.reg.add("core","common/models/Group",o)},5788:(t,e,n)=>{"use strict";n.d(e,{Z:()=>s});var r=n(9175);class s extends r.Z{contentType(){return r.Z.attribute("contentType").call(this)}content(){return r.Z.attribute("content").call(this)}createdAt(){return r.Z.attribute("createdAt",r.Z.transformDate).call(this)}isRead(){return r.Z.attribute("isRead").call(this)}user(){return r.Z.hasOne("user").call(this)}fromUser(){return r.Z.hasOne("fromUser").call(this)}subject(){return r.Z.hasOne("subject").call(this)}}flarum.reg.add("core","common/models/Notification",s)},4125:(t,e,n)=>{"use strict";n.d(e,{Z:()=>i});var r=n(9175),s=n(1356),o=n(1061);class i extends r.Z{number(){return r.Z.attribute("number").call(this)}discussion(){return r.Z.hasOne("discussion").call(this)}createdAt(){return r.Z.attribute("createdAt",r.Z.transformDate).call(this)}user(){return r.Z.hasOne("user").call(this)}contentType(){return r.Z.attribute("contentType").call(this)}content(){return r.Z.attribute("content").call(this)}contentHtml(){return r.Z.attribute("contentHtml").call(this)}renderFailed(){return r.Z.attribute("renderFailed").call(this)}contentPlain(){return(0,s.Z)("contentHtml",(t=>"string"==typeof t?(0,o.AH)(t):t)).call(this)}editedAt(){return r.Z.attribute("editedAt",r.Z.transformDate).call(this)}editedUser(){return r.Z.hasOne("editedUser").call(this)}isEdited(){return(0,s.Z)("editedAt",(t=>!!t)).call(this)}hiddenAt(){return r.Z.attribute("hiddenAt",r.Z.transformDate).call(this)}hiddenUser(){return r.Z.hasOne("hiddenUser").call(this)}isHidden(){return(0,s.Z)("hiddenAt",(t=>!!t)).call(this)}canEdit(){return r.Z.attribute("canEdit").call(this)}canHide(){return r.Z.attribute("canHide").call(this)}canDelete(){return r.Z.attribute("canDelete").call(this)}}flarum.reg.add("core","common/models/Post",i)},7498:(t,e,n)=>{"use strict";n.d(e,{Z:()=>d});var r=n(7905),s=n(613),o=n.n(s),i=n(9175),a=n(2688),l=n(4041),c=n(1356),u=n(6697);class d extends i.Z{constructor(){super(...arguments),(0,r.Z)(this,"avatarColor",null)}username(){return i.Z.attribute("username").call(this)}slug(){return i.Z.attribute("slug").call(this)}displayName(){return i.Z.attribute("displayName").call(this)}email(){return i.Z.attribute("email").call(this)}isEmailConfirmed(){return i.Z.attribute("isEmailConfirmed").call(this)}password(){return i.Z.attribute("password").call(this)}avatarUrl(){return i.Z.attribute("avatarUrl").call(this)}preferences(){return i.Z.attribute("preferences").call(this)}groups(){return i.Z.hasMany("groups").call(this)}isAdmin(){return i.Z.attribute("isAdmin").call(this)}joinTime(){return i.Z.attribute("joinTime",i.Z.transformDate).call(this)}lastSeenAt(){return i.Z.attribute("lastSeenAt",i.Z.transformDate).call(this)}markedAllAsReadAt(){return i.Z.attribute("markedAllAsReadAt",i.Z.transformDate).call(this)}unreadNotificationCount(){return i.Z.attribute("unreadNotificationCount").call(this)}newNotificationCount(){return i.Z.attribute("newNotificationCount").call(this)}discussionCount(){return i.Z.attribute("discussionCount").call(this)}commentCount(){return i.Z.attribute("commentCount").call(this)}canEdit(){return i.Z.attribute("canEdit").call(this)}canEditCredentials(){return i.Z.attribute("canEditCredentials").call(this)}canEditGroups(){return i.Z.attribute("canEditGroups").call(this)}canDelete(){return i.Z.attribute("canDelete").call(this)}color(){return(0,c.Z)("displayName","avatarUrl","avatarColor",((t,e,n)=>n?"rgb(".concat(n.join(", "),")"):e?(this.calculateAvatarColor(),""):"#"+(0,a.Z)(t))).call(this)}isOnline(){return dayjs().subtract(5,"minutes").isBefore(this.lastSeenAt())}badges(){const t=new l.Z,e=this.groups();return e&&e.forEach((e=>{t.add("group".concat(null==e?void 0:e.id()),m(u.Z,{group:e}))})),t}calculateAvatarColor(){var t;const e=new Image,n=this;e.addEventListener("load",(function(){try{const t=new(o());n.avatarColor=t.getColor(this)}catch(t){if(!(t instanceof TypeError))throw t;n.avatarColor=[255,255,255]}n.freshness=new Date,m.redraw()})),e.crossOrigin="anonymous",e.src=null!=(t=this.avatarUrl())?t:""}savePreferences(t){const e=this.preferences();return Object.assign(null!=e?e:{},t),this.save({preferences:e})}}flarum.reg.add("core","common/models/User",d)},2408:(t,e,n)=>{"use strict";n.d(e,{Z:()=>o});var r=n(7905),s=n(2190);class o{constructor(t,e){(0,r.Z)(this,"component",void 0),(0,r.Z)(this,"routeName",void 0),this.component=t,this.routeName=e}makeKey(){return this.routeName+JSON.stringify(m.route.param())}makeAttrs(t){return{...t.attrs,routeName:this.routeName}}async onmatch(t,e,n){return this.component.prototype instanceof s.Z?this.component:(await this.component()).default}render(t){return[{...t,attrs:this.makeAttrs(t),key:this.makeKey()}]}}flarum.reg.add("core","common/resolvers/DefaultResolver",o)},5278:(t,e,n)=>{"use strict";n.d(e,{Z:()=>i});var r=n(7905),s=n(3817),o=n(7465);class i{constructor(){(0,r.Z)(this,"activeAlerts",{}),(0,r.Z)(this,"alertId",0),(0,r.Z)(this,"loadingPool",0)}getActiveAlerts(){return this.activeAlerts}show(t,e,n){let r,o=s.Z,i={};return 1==arguments.length?r=t:2==arguments.length?(i=t,r=e):3==arguments.length&&(o=t,i=e,r=n),this.activeAlerts[++this.alertId]={children:r,attrs:i,componentClass:o},m.redraw(),this.alertId}dismiss(t){t&&t in this.activeAlerts&&(delete this.activeAlerts[t],m.redraw())}clear(){this.activeAlerts={},m.redraw()}showLoading(){return this.loadingPool++,this.loadingPool>1?null:this.show({type:"warning",dismissible:!1},o.Z.translator.trans("core.lib.loading_indicator.accessible_label"))}clearLoading(){this.loadingPool--,0===this.loadingPool&&this.clear()}}flarum.reg.add("core","common/states/AlertManagerState",i)},5123:(t,e,n)=>{"use strict";n.d(e,{Z:()=>o});var r=n(7905),s=n(7108);class o{constructor(){(0,r.Z)(this,"modal",null),(0,r.Z)(this,"modalList",[]),(0,r.Z)(this,"backdropShown",!1),(0,r.Z)(this,"loadingModal",!1),(0,r.Z)(this,"key",0)}async show(t,e,n){if(void 0===e&&(e={}),void 0===n&&(n=!1),!(t.prototype instanceof s.Z)&&"function"!=typeof t){const t="The ModalManager can only show Modals.";throw console.error(t),new Error(t)}t.prototype instanceof s.Z||(this.loadingModal=!0,m.redraw.sync(),t=(await t()).default,this.loadingModal=!1),this.backdropShown=!0,m.redraw.sync(),requestAnimationFrame((()=>{this.modal={componentClass:t,attrs:e,key:this.key++},n?this.modalList.push(this.modal):this.modalList=[this.modal],m.redraw()}))}close(){this.modal&&(this.modalList.length>1?(this.modalList.pop(),this.modal=this.modalList[this.modalList.length-1]):(this.modal=null,this.modalList=[]),m.redraw())}isModalOpen(){return!!this.modal}}flarum.reg.add("core","common/states/ModalManagerState",o)},2437:(t,e,n)=>{"use strict";n.d(e,{Z:()=>o});var r=n(7905),s=n(7465);class o{constructor(t,e,n){void 0===t&&(t={}),void 0===e&&(e=1),void 0===n&&(n=20),(0,r.Z)(this,"location",void 0),(0,r.Z)(this,"pageSize",void 0),(0,r.Z)(this,"pages",[]),(0,r.Z)(this,"params",{}),(0,r.Z)(this,"initialLoading",!1),(0,r.Z)(this,"loadingPrev",!1),(0,r.Z)(this,"loadingNext",!1),this.params=t,this.location={page:e},this.pageSize=n}clear(){this.pages=[],m.redraw()}loadPrev(){if(this.loadingPrev||1===this.getLocation().page)return Promise.resolve();this.loadingPrev=!0;const t=this.getPrevPageNumber();return this.loadPage(t).then(this.parseResults.bind(this,t)).finally((()=>this.loadingPrev=!1))}loadNext(){if(this.loadingNext)return Promise.resolve();this.loadingNext=!0;const t=this.getNextPageNumber();return this.loadPage(t).then(this.parseResults.bind(this,t)).finally((()=>this.loadingNext=!1))}parseResults(t,e){var n;const r=Number(t),s=null==(n=e.payload)?void 0:n.links,o={number:r,items:e,hasNext:!(null==s||!s.next),hasPrev:!(null==s||!s.prev)};this.isEmpty()||r>this.getNextPageNumber()-1?this.pages.push(o):this.pages.unshift(o),this.location={page:r},m.redraw()}loadPage(t){void 0===t&&(t=1);const e=this.requestParams(),n=Array.isArray(e.include)?e.include.join(","):e.include,r={...e,page:{...e.page,offset:this.pageSize*(t-1)},include:n};return s.Z.store.find(this.type,r)}requestParams(){return this.params}refreshParams(t,e){return this.isEmpty()||this.paramsChanged(t)?(this.params=t,this.refresh(e)):Promise.resolve()}refresh(t){return void 0===t&&(t=1),this.initialLoading=!0,this.loadingPrev=!1,this.loadingNext=!1,this.clear(),this.location={page:t},this.loadPage().then((t=>{this.pages=[],this.parseResults(this.location.page,t)})).finally((()=>this.initialLoading=!1))}getPages(){return this.pages}getLocation(){return this.location}isLoading(){return this.initialLoading||this.loadingNext||this.loadingPrev}isInitialLoading(){return this.initialLoading}isLoadingPrev(){return this.loadingPrev}isLoadingNext(){return this.loadingNext}hasItems(){return!!this.getAllItems().length}isEmpty(){return!this.isInitialLoading()&&!this.hasItems()}hasPrev(){var t;return!(null==(t=this.pages[0])||!t.hasPrev)}hasNext(){var t;return!(null==(t=this.pages[this.pages.length-1])||!t.hasNext)}getParams(){return this.params}getNextPageNumber(){var t;const e=null==(t=this.pages[this.pages.length-1])?void 0:t.number;return e&&!isNaN(e)?e+1:this.location.page}getPrevPageNumber(){var t;const e=null==(t=this.pages[0])?void 0:t.number;return e&&!isNaN(e)?Math.max(e-1,1):this.location.page}paramsChanged(t){return Object.keys(t).some((e=>this.getParams()[e]!==t[e]))}getAllItems(){return this.getPages().map((t=>t.items)).flat()}}flarum.reg.add("core","common/states/PaginatedListState",o)},4219:(t,e,n)=>{"use strict";n.d(e,{Z:()=>l});var r=n(7905),s=n(2474),o=n.n(s),i=n(4085),a=n(4041);class l{constructor(t,e){(0,r.Z)(this,"el",void 0),this.el=document.createElement("textarea"),this.build(t,e)}build(t,e){this.el.className=e.classNames.join(" "),this.el.disabled=e.disabled,this.el.placeholder=e.placeholder,this.el.value=e.value;const n=t=>{e.inputListeners.forEach((t=>{t()})),t.redraw=!1};this.el.oninput=t=>{e.oninput(this.el.value),n(t)},this.el.onclick=n,this.el.onkeyup=n,this.el.addEventListener("keydown",(t=>{this.keyHandlers(e).toArray().forEach((e=>e(t)))})),t.append(this.el)}keyHandlers(t){const e=new a.Z;return e.add("submit",(function(e){(e.metaKey||e.ctrlKey)&&"Enter"===e.key&&t.onsubmit()})),e}moveCursorTo(t){this.setSelectionRange(t,t)}getSelectionRange(){return[this.el.selectionStart,this.el.selectionEnd]}getLastNChars(t){return this.el.value.slice(Math.max(0,this.el.selectionStart-t),this.el.selectionStart)}insertAtCursor(t){this.insertAt(this.el.selectionStart,t)}insertAt(t,e){this.insertBetween(t,t,e)}insertBetween(t,e,n){this.setSelectionRange(t,e);const r=t+n.length;(0,i.Z)(this.el,{text:n,selectionStart:r,selectionEnd:r})}replaceBeforeCursor(t,e){this.insertBetween(t,this.el.selectionStart,e)}setSelectionRange(t,e){this.el.setSelectionRange(t,e),this.focus()}getCaretCoordinates(t){const e=o()(this.el,t);return{top:e.top-this.el.scrollTop,left:e.left}}disabled(t){this.el.disabled=t}focus(){this.el.focus()}destroy(){this.el.remove()}}flarum.reg.add("core","common/utils/BasicEditorDriver",l)},4041:(t,e,n)=>{"use strict";n.d(e,{Z:()=>i});var r=n(7905),s=n(7531);class o{constructor(t,e){(0,r.Z)(this,"content",void 0),(0,r.Z)(this,"priority",void 0),this.content=t,this.priority=e}}class i{constructor(){(0,r.Z)(this,"_items",{})}get items(){return new Proxy(this._items,{set:()=>(console.warn("Modifying `ItemList.items` is not allowed."),!1)})}isEmpty(){return 0===Object.keys(this._items).length}has(t){return Object.keys(this._items).includes(t)}get(t){return this._items[t].content}getPriority(t){return this._items[t].priority}add(t,e,n){return void 0===n&&(n=0),this._items[t]=new o(e,n),this}replace(t,e,n){return void 0===e&&(e=null),void 0===n&&(n=null),this.has(t)?(null!==e&&(this._items[t].content=e),null!==n&&(this._items[t].priority=n),this):this}setContent(t,e){if(!this.has(t))throw new Error("[ItemList] Cannot set content of Item. Key `".concat(t,"` is not present."));return this.replace(t,e)}setPriority(t,e){if(!this.has(t))throw new Error("[ItemList] Cannot set priority of Item. Key `".concat(t,"` is not present."));return this._items[t].priority=e,this}remove(t){return delete this._items[t],this}merge(t){return Object.keys(t._items).forEach((e=>{const n=t._items[e];n instanceof o&&(this._items[e]=n)})),this}toArray(t){return void 0===t&&(t=!1),Object.keys(this._items).map(((e,n)=>{const r=this._items[e];return!t||(0,s.Z)(r.content)?{...r,content:this.createItemContentProxy((0,s.Z)(r.content)?r.content:Object(r.content),e)}:{...r}})).sort(((t,e)=>e.priority-t.priority)).map((t=>t.content))}toObject(){return Object.keys(this._items).reduce(((t,e)=>{const n={content:this.get(e),itemName:e,priority:this.getPriority(e)};return t[e]=n,t}),{})}createItemContentProxy(t,e){return new Proxy(t,{get:(t,n,r)=>"itemName"===n?e:Reflect.get(t,n,r),set(t,n,r,s){if(null!==e&&"itemName"===n)throw new Error("`itemName` property is read-only");return Reflect.set(t,n,r,s)}})}}flarum.reg.add("core","common/utils/ItemList",i)},8046:(t,e,n)=>{"use strict";n.d(e,{Z:()=>o});var r=n(7905),s=function(t){return t[t.Enter=13]="Enter",t[t.Escape=27]="Escape",t[t.Space=32]="Space",t[t.ArrowUp=38]="ArrowUp",t[t.ArrowDown=40]="ArrowDown",t[t.ArrowLeft=37]="ArrowLeft",t[t.ArrowRight=39]="ArrowRight",t[t.Tab=9]="Tab",t[t.Backspace=8]="Backspace",t}(s||{});class o{constructor(){(0,r.Z)(this,"callbacks",new Map),(0,r.Z)(this,"whenCallback",(t=>!0))}onUp(t){return this.callbacks.set(s.ArrowUp,(e=>{e.preventDefault(),t(e)})),this}onDown(t){return this.callbacks.set(s.ArrowDown,(e=>{e.preventDefault(),t(e)})),this}onSelect(t,e){void 0===e&&(e=!1);const n=e=>{e.preventDefault(),t(e)};return e||this.callbacks.set(s.Tab,n),this.callbacks.set(s.Enter,n),this}onTab(t){return this.callbacks.set(9,(e=>{e.preventDefault(),t(e)})),this}onCancel(t){return this.callbacks.set(s.Escape,(e=>{e.stopPropagation(),e.preventDefault(),t(e)})),this}onRemove(t){return this.callbacks.set(s.Backspace,(e=>{e instanceof KeyboardEvent&&e.target instanceof HTMLInputElement&&0===e.target.selectionStart&&0===e.target.selectionEnd&&(t(e),e.preventDefault())})),this}when(t){return this.whenCallback=t,this}bindTo(t){t[0].addEventListener("keydown",this.navigate.bind(this))}navigate(t){if(!this.whenCallback(t))return;const e=this.callbacks.get(t.which);e&&e(t)}}flarum.reg.add("core","common/utils/KeyboardNavigatable",o)},6386:(t,e,n)=>{"use strict";n.d(e,{Z:()=>s});var r=n(7905);class s{constructor(t,e,n,s){(0,r.Z)(this,"status",void 0),(0,r.Z)(this,"options",void 0),(0,r.Z)(this,"xhr",void 0),(0,r.Z)(this,"responseText",void 0),(0,r.Z)(this,"response",void 0),(0,r.Z)(this,"alert",void 0),this.status=t,this.responseText=e,this.options=n,this.xhr=s;try{this.response=JSON.parse(null!=e?e:"null")}catch(t){this.response=null}this.alert=null}}flarum.reg.add("core","common/utils/RequestError",s)},6458:(t,e,n)=>{"use strict";n.d(e,{Z:()=>o});var r=n(562),s=n.n(r);const o=s();flarum.reg.add("core","common/utils/Stream",s())},4794:(t,e,n)=>{"use strict";n.d(e,{Z:()=>s});var r=n(7905);class s{constructor(){(0,r.Z)(this,"callbacks",void 0),(0,r.Z)(this,"data",void 0);for(var t=arguments.length,e=new Array(t),n=0;n{const r=e();r!==this.data[n]&&(this.data[n]=r,t=!0)})),t}check(){for(var t=arguments.length,e=new Array(t),n=0;n{"use strict";n.d(e,{Z:()=>o});var r=n(7465),s=n(1552);function o(t){return t>=1e6?Math.floor(t/1e6)+(0,s.Z)(r.Z.translator.trans("core.lib.number_suffix.mega_text")):t>=1e3?(t/1e3).toFixed(1)+(0,s.Z)(r.Z.translator.trans("core.lib.number_suffix.kilo_text")):t.toString()}flarum.reg.add("core","common/utils/abbreviateNumber",o)},117:()=>{Array.prototype.flat||(Array.prototype.flat=function t(e){return(null!=e?e:1)>0?Array.prototype.reduce.call(this,((n,r)=>n.concat(Array.isArray(r)?t.call(r,e-1):r)),[]):[...this]})},3344:(t,e,n)=>{"use strict";function r(t){var e,n,s="";if("string"==typeof t||"number"==typeof t)s+=t;else if("object"==typeof t)if(Array.isArray(t))for(e=0;eo});const s=function(){for(var t,e,n=0,s="";n{"use strict";function r(){for(var t=arguments.length,e=new Array(t),n=0;n{const n=this[e],r="function"==typeof n?n.call(this):n;o[e]!==r&&(t=!0,o[e]=r)})),t&&(i=s.apply(this,r.map((t=>o[t])))),i}}n.d(e,{Z:()=>r}),flarum.reg.add("core","common/utils/computed",r)},9158:(t,e,n)=>{"use strict";n.d(e,{Z:()=>s});const r=/[.*+?^${}()|[\]\\]/g;function s(t){return t.replace(r,"\\$&")}flarum.reg.add("core","common/utils/escapeRegExp",s)},6786:(t,e,n)=>{"use strict";function r(t,e){const n=t[e];return delete t[e],n}n.d(e,{Z:()=>r}),flarum.reg.add("core","common/utils/extract",r)},1552:(t,e,n)=>{"use strict";function r(t){return t instanceof Array?t.map((t=>r(t))).join(""):"object"==typeof t&&null!==t?r(t.children):String(t)}n.d(e,{Z:()=>r}),flarum.reg.add("core","common/utils/extractText",r)},2795:(t,e,n)=>{"use strict";n.d(e,{v:()=>s});var r=n(9685);function s(){for(var t=arguments.length,e=new Array(t),n=0;n{"use strict";n.d(e,{Z:()=>s});var r=n(7465);function s(t,e){return void 0===e&&(e=r.Z.data.locale),new Intl.NumberFormat(e).format(t)}flarum.reg.add("core","common/utils/formatNumber",s)},9423:(t,e,n)=>{"use strict";n.d(e,{Z:()=>o});var r=n(3860),s=n.n(r);function o(t){let e=s()(t);const n=s()();let r;return e.isAfter(n)&&(e=n),r=e.diff(s()())<-2592e6?e.year()===s()().year()?e.format("D MMM"):e.format("ll"):e.fromNow(),r}flarum.reg.add("core","common/utils/humanTime",o)},4085:(t,e,n)=>{"use strict";n.d(e,{Z:()=>s});let r=null;function s(t,e){let{text:n,selectionStart:s,selectionEnd:o}=e;const i=t.selectionStart,a=t.value.slice(0,i),l=t.value.slice(t.selectionEnd);if(null===r||!0===r){t.contentEditable="true";try{r=document.execCommand("insertText",!1,n)}catch(t){r=!1}t.contentEditable="false"}r&&!t.value.slice(0,t.selectionStart).endsWith(n)&&(r=!1),r||(t.value=a+n+l,t.dispatchEvent(new CustomEvent("input",{bubbles:!0,cancelable:!0}))),null!=s&&null!=o?t.setSelectionRange(s,o):t.setSelectionRange(i,t.selectionEnd)}flarum.reg.add("core","common/utils/insertText",s)},6476:(t,e,n)=>{"use strict";function r(t){if(!t||t.length<4)return!1;let e=t.replace("#","");return 3===e.length&&(e+=e),(299*parseInt(e.slice(0,2),16)+587*parseInt(e.slice(2,4),16)+114*parseInt(e.slice(4,6),16))/1e3<(parseInt(getComputedStyle(document.body).getPropertyValue("--yiq-threshold").trim())||128)}n.d(e,{Z:()=>r}),flarum.reg.add("core","common/utils/isDark",r)},7531:(t,e,n)=>{"use strict";function r(t){const e=typeof t;return"function"===e||"object"===e&&!!t}n.d(e,{Z:()=>r}),flarum.reg.add("core","common/utils/isObject",r)},1378:(t,e,n)=>{"use strict";n.d(e,{Z:()=>o});var r=n(9423);function s(){$("[data-humantime]").each((function(){const t=$(this),e=(0,r.Z)(t.attr("datetime"));t.html(e)}))}function o(){setInterval(s,1e4)}flarum.reg.add("core","common/utils/liveHumanTimes",o)},4430:(t,e,n)=>{"use strict";n.d(e,{Z:()=>s});var r=n(2408);function s(t,e){void 0===e&&(e="");const n={};for(const s in t){const o=t[s];if("resolver"in o)n[e+o.path]=o.resolver;else{if(!("component"in o))throw new Error("Either a resolver or a component must be provided for the route [".concat(s,"]"));{const t="resolverClass"in o?o.resolverClass:r.Z;n[e+o.path]=new t(o.component,s)}}}return n}flarum.reg.add("core","common/utils/mapRoutes",s)},6083:(t,e,n)=>{"use strict";function r(t,e,n){void 0===e&&(e=null),void 0===n&&(n={});const r={...n};r.state=r.state||{},r.state.key=Date.now(),m.route.set(t,e,r)}n.d(e,{Z:()=>r}),flarum.reg.add("core","common/utils/setRouteWithForcedRefresh",r)},1061:(t,e,n)=>{"use strict";function r(t,e,n){return void 0===n&&(n=0),(n>0?"...":"")+t.substring(n,n+e)+(t.length>n+e?"...":"")}n.d(e,{$G:()=>r,AH:()=>o,Ps:()=>i});var s=function(t){return t.ALPHANUMERIC="alphanum",t.UTF8="utf8",t}(s||{});function o(t){const e=t.replace(/(<\/p>|
)/g,"$1  ").replace(/]*>/gi," "),n=(new DOMParser).parseFromString(e,"text/html").documentElement;return o.removeSelectors.forEach((t=>{n.querySelectorAll(t).forEach((t=>{t.remove()}))})),n.innerText.replace(/\s+/g," ").trim()}function i(t){return t.substr(0,1).toUpperCase()+t.substr(1)}o.removeSelectors=["blockquote","script"],flarum.reg.add("core","common/utils/string",{truncate:r,slug:function(t,e){switch(void 0===e&&(e=s.ALPHANUMERIC),e){case s.UTF8:return t.toLowerCase().replace(/[^\p{L}\p{N}\p{M}]/giu,"-").replace(/-+/g,"-").replace(/-$|^-/g,"");case s.ALPHANUMERIC:default:return t.toLowerCase().replace(/[^a-z0-9]/gi,"-").replace(/-+/g,"-").replace(/-$|^-/g,"")}},getPlainContent:o,ucfirst:i,camelCaseToSnakeCase:function(t){return t.replace(/[A-Z]/g,(t=>"_".concat(t.toLowerCase())))},generateRandomString:function(t){if(t<0)throw new Error("Cannot generate a random string with length less than 0.");if(0===t)return"";const e=new Uint8Array(t/2);return window.crypto.getRandomValues(e),Array.from(e,(t=>t.toString(16).padStart(2,"0"))).join("")}})},2688:(t,e,n)=>{"use strict";function r(t){let e=0;for(let n=0;nr}),flarum.reg.add("core","common/utils/stringToColor",r)},7669:(t,e,n)=>{"use strict";function r(t,e){return function(){e(this.getAttribute(t)||this[t])}}n.d(e,{Z:()=>r}),flarum.reg.add("core","common/utils/withAttr",r)},681:(t,e,n)=>{"use strict";n.d(e,{Z:()=>P});var r=n(7905),s=n(6789),o=n(8010),i=n(6247),a=n(1786),l=n(4876),c=n(8222),u=n(2237),d=n(7352),h=n(2364),f=n(4723),p=n(2915),g=n(5386),v=n(177),b=n(4564),y=n(1654),w=n(2401);function Z(){return"ontouchstart"in window&&null!=navigator.vendor&&navigator.vendor.includes("Apple")&&null!=navigator.userAgent&&!navigator.userAgent.includes("CriOS")&&!navigator.userAgent.includes("FxiOS")}flarum.reg.add("core","forum/utils/isSafariMobile",Z);var x=n(1552),k=n(2190),N=n(4041),C=n(3817),S=n(7202),T=n(9133);class E extends k.Z{constructor(){super(...arguments),(0,r.Z)(this,"loading",!1),(0,r.Z)(this,"sent",!1)}view(){return m("div",{className:"App-notices"},this.items().toArray())}items(){const t=new N.Z,e=s.Z.session.user;return e&&!e.isEmailConfirmed()&&t.add("emailConfirmation",m(C.Z,{dismissible:!1,controls:[m(S.Z,{className:"Button Button--link",onclick:this.onclickEmailConfirmation.bind(this),loading:this.loading,disabled:this.sent},this.sent?[m(T.Z,{name:"fas fa-check"})," ",s.Z.translator.trans("core.forum.user_email_confirmation.sent_message")]:s.Z.translator.trans("core.forum.user_email_confirmation.resend_button"))],className:"Alert--emailConfirmation",containerClassName:"container"},s.Z.translator.trans("core.forum.user_email_confirmation.alert_message",{email:m("strong",null,e.email())})),100),t}onclickEmailConfirmation(){const t=s.Z.session.user;this.loading=!0,m.redraw(),s.Z.request({method:"POST",url:s.Z.forum.attribute("apiUrl")+"/users/"+t.id()+"/send-confirmation"}).then((()=>{this.loading=!1,this.sent=!0,m.redraw()})).catch((()=>{this.loading=!1,m.redraw()}))}}flarum.reg.add("core","forum/components/Notices",E);class A extends k.Z{view(){return null}}flarum.reg.add("core","forum/components/Footer",A);class P extends p.Z{constructor(){super(),(0,r.Z)(this,"notificationComponents",{discussionRenamed:u.Z}),(0,r.Z)(this,"postComponents",{comment:d.Z,discussionRenamed:h.Z}),(0,r.Z)(this,"pane",null),(0,r.Z)(this,"history",new o.Z),(0,r.Z)(this,"notifications",new v.Z),(0,r.Z)(this,"search",new b.Z),(0,r.Z)(this,"composer",new w.Z),(0,r.Z)(this,"discussions",new y.Z({})),(0,r.Z)(this,"route",void 0),(0,r.Z)(this,"data",void 0),(0,f.Z)(this),this.route=Object.assign(Object.getPrototypeOf(Object.getPrototypeOf(this)).route.bind(this),(0,f.K)(this))}mount(){const t=this.forum.attribute("defaultRoute");let e="index";for(const n in this.routes)this.routes[n].path===t&&(e=n);this.routes[e].path="/",this.history.push(e,(0,x.Z)(this.translator.trans("core.forum.header.back_to_index_tooltip")),"/"),this.pane=new i.Z(document.getElementById("app")),m.route.prefix="",super.mount(this.forum.attribute("basePath")),m.mount(document.getElementById("app-navigation"),{view:()=>m(g.Z,{className:"App-backControl",drawer:!0})}),m.mount(document.getElementById("header-navigation"),g.Z),m.mount(document.getElementById("header-primary"),l.Z),m.mount(document.getElementById("header-secondary"),c.Z),m.mount(document.getElementById("notices"),E),m.mount(document.getElementById("footer"),A),document.getElementById("home-link").addEventListener("click",(t=>{var e;if(t.ctrlKey||t.metaKey||1===t.button)return;t.preventDefault(),s.Z.history.home();const n=null==(e=s.Z.session.user)?void 0:e.id();n&&(s.Z.store.find("users",n),m.redraw())})),Z()&&$((()=>{$(".App").addClass("mobile-safari")}))}viewingDiscussion(t){return this.current.matches(a.Z,{discussion:t})}authenticationComplete(t){t.loggedIn?window.location.reload():this.modal.show((()=>n.e(395).then(n.bind(n,8686))),t)}}},6789:(t,e,n)=>{"use strict";n.d(e,{Z:()=>s});const r=new(n(681).Z);window.app=r;const s=r;flarum.reg.add("core","forum/app",r)},1223:(t,e,n)=>{"use strict";n.d(e,{Z:()=>N});var r=n(7905),s=n(6789),o=n(2190),i=n(6597),a=n(1268),l=n(156),c=n(9423),u=n(4041),d=n(3934),h=n(344),f=n(6577),p=n(4794),g=n(3666),v=n(4681),b=n(3344),y=n(1786),w=n(9158),Z=n(6439),x=n(9133),k=n(7323);class N extends o.Z{constructor(){super(...arguments),(0,r.Z)(this,"subtree",void 0),(0,r.Z)(this,"highlightRegExp",void 0)}oninit(t){super.oninit(t),this.subtree=new p.Z((()=>this.attrs.discussion.freshness),(()=>{const t=s.Z.session.user&&s.Z.session.user.markedAllAsReadAt();return t&&t.getTime()}),(()=>this.active()))}elementAttrs(){return{className:(0,b.Z)("DiscussionListItem",{active:this.active(),"DiscussionListItem--hidden":this.attrs.discussion.isHidden(),Slidable:"ontouchstart"in window})}}view(){const t=this.elementAttrs();return m("div",t,this.viewItems().toArray())}viewItems(){const t=new u.Z,e=g.Z.controls(this.attrs.discussion,this).toArray();return e.length&&t.add("controls",this.controlsView(e),100),t.add("slidableUnderneath",this.slidableUnderneathView(),90),t.add("content",this.contentView(),80),t}controlsView(t){return m(h.Z,{icon:"fas fa-ellipsis-v",className:"DiscussionListItem-controls",buttonClassName:"Button Button--icon Button--flat Slidable-underneath Slidable-underneath--right",accessibleToggleLabel:s.Z.translator.trans("core.forum.discussion_controls.toggle_dropdown_accessible_label")},t)}slidableUnderneathView(){const t=this.attrs.discussion.isUnread();return m("span",{className:(0,b.Z)("Slidable-underneath Slidable-underneath--left Slidable-underneath--elastic",{disabled:!t}),onclick:this.markAsRead.bind(this)},m(x.Z,{name:"fas fa-check"}))}contentView(){const t=this.attrs.discussion,e=t.isUnread(),n=t.isRead();return m("div",{className:(0,b.Z)("DiscussionListItem-content","Slidable-content",{unread:e,read:n})},this.contentItems().toArray())}contentItems(){const t=new u.Z;return t.add("author",this.authorView(),100),t.add("main",this.mainView(),80),t.add("stats",this.statsView(),70),t}authorView(){return m("div",{className:"DiscussionListItem-author"},this.authorItems().toArray())}authorItems(){const t=new u.Z,e=this.attrs.discussion,n=e.user();return t.add("avatar",m(Z.Z,{text:s.Z.translator.trans("core.forum.discussion_list.started_text",{user:n,ago:(0,c.Z)(e.createdAt())}),position:"right"},m(i.Z,{className:"DiscussionListItem-author-avatar",href:n?s.Z.route.user(n):"#"},m(k.Z,{user:n||null,title:""}))),100),t.add("badges",this.badgesView(),90),t}badgesView(){const t=this.attrs.discussion;return m("ul",{className:"DiscussionListItem-badges badges"},(0,a.Z)(t.badges().toArray()))}mainView(){const t=this.attrs.discussion,e=this.getJumpTo();return m(i.Z,{href:s.Z.route.discussion(t,e),className:"DiscussionListItem-main"},m("h2",{className:"DiscussionListItem-title"},(0,l.Z)(t.title(),this.highlightRegExp)),m("ul",{className:"DiscussionListItem-info"},(0,a.Z)(this.infoItems().toArray())))}getJumpTo(){const t=this.attrs.discussion;let e=0;if(this.attrs.params.q){const n=t.mostRelevantPost();n&&(e=n.number());const r=(0,w.Z)(this.attrs.params.q);this.highlightRegExp=new RegExp(r+"|"+r.trim().replace(/\s+/g,"|"),"gi")}else{var n;e=Math.min(null!=(n=t.lastPostNumber())?n:0,(t.lastReadPostNumber()||0)+1)}return e}oncreate(t){if(super.oncreate(t),"ontouchstart"in window){const t=(0,v.Z)(this.element);this.$(".DiscussionListItem-controls").on("hidden.bs.dropdown",(()=>t.reset()))}}onbeforeupdate(t){return super.onbeforeupdate(t),this.subtree.needsRebuild()}active(){return s.Z.current.matches(y.Z,{discussion:this.attrs.discussion})}showFirstPost(){var t;return["newest","oldest"].includes(null!=(t=this.attrs.params.sort)?t:"")}showRepliesCount(){return"replies"===this.attrs.params.sort}markAsRead(){const t=this.attrs.discussion;t.isUnread()&&(t.save({lastReadPostNumber:t.lastPostNumber()}),m.redraw())}infoItems(){const t=new u.Z;if(this.attrs.params.q){const n=this.attrs.discussion.mostRelevantPost()||this.attrs.discussion.firstPost();if(n&&"comment"===n.contentType()){var e;const r=(0,l.Z)(null!=(e=n.contentPlain())?e:"",this.highlightRegExp,175);t.add("excerpt",r,-100)}}else t.add("terminalPost",m(f.Z,{discussion:this.attrs.discussion,lastPost:!this.showFirstPost()}));return t}statsView(){return m("div",{className:"DiscussionListItem-stats"},this.statsItems().toArray())}statsItems(){const t=new u.Z;return t.add("replyCount",this.replyCountItem(),70),t}replyCountItem(){const t=this.attrs.discussion,e=!this.showRepliesCount()&&t.isUnread(),n=e?"core.forum.discussion_list.unread_replies_a11y_label":"core.forum.discussion_list.total_replies_a11y_label";return m(C,{className:"DiscussionListItem-count",icon:e?[m(x.Z,{name:"fas fa-check _checkmark"}),m(x.Z,{name:"fas fa-comment _comment"})]:m(x.Z,{name:"far fa-comment"}),label:e?(0,d.Z)(t.unreadCount()):(0,d.Z)(t.replyCount()),a11yLabel:s.Z.translator.trans(n,{count:t.replyCount()}),onclick:e?this.markAsRead.bind(this):void 0})}}class C extends o.Z{view(t){const{icon:e,label:n,a11yLabel:r,className:s,...o}=t.attrs,i=o.onclick?"button":"span";return m(i,Object.assign({className:(0,b.Z)("DiscussionListItem-stats-item",s,{"Button--ua-reset":"button"===i})},o),m("span",{className:"DiscussionListItem-stats-item-icon"},e),m("span",{className:"DiscussionListItem-stats-item-label"},m("span",{"aria-hidden":"true"},n),m("span",{className:"visually-hidden"},null!=r?r:n)))}}flarum.reg.add("core","forum/components/DiscussionListItem",N)},1786:(t,e,n)=>{"use strict";n.d(e,{Z:()=>p});var r=n(7905),s=n(6789),o=n(4661),i=n(4041),a=n(5724),l=n(9873),c=n(4197),u=n(1268),d=n(3666),h=n(5003),f=n(836);class p extends o.Z{constructor(){super(...arguments),(0,r.Z)(this,"loading",!0),(0,r.Z)(this,"PostStream",null),(0,r.Z)(this,"PostStreamScrubber",null),(0,r.Z)(this,"discussion",null),(0,r.Z)(this,"stream",null),(0,r.Z)(this,"near",0),(0,r.Z)(this,"useBrowserScrollRestoration",!0)}oninit(t){var e,n;super.oninit(t),this.load(),(s.Z.discussions.hasItems()||s.Z.discussions.isLoading())&&(null==(e=s.Z.pane)||e.enable(),null==(n=s.Z.pane)||n.hide()),this.bodyClass="App--discussion"}onremove(t){var e,n,r;super.onremove(t),null==(e=s.Z.pane)||e.disable(),!this.discussion||!s.Z.composer.composingReplyTo(this.discussion)||null!=(n=s.Z.composer)&&null!=(r=n.fields)&&r.content()?s.Z.composer.minimize():s.Z.composer.hide()}view(){return m(f.Z,{className:"DiscussionPage",loading:this.loading,hero:this.hero.bind(this),sidebar:this.sidebar.bind(this),pane:()=>m(l.Z,{state:s.Z.discussions})},this.loading||m("div",{className:"DiscussionPage-stream"},m(this.PostStream,{discussion:this.discussion,stream:this.stream,onPositionChange:this.positionChanged.bind(this)})))}sidebar(){return m("nav",{className:"DiscussionPage-nav"},m("ul",null,(0,u.Z)(this.sidebarItems().toArray())))}hero(){return m(a.Z,{discussion:this.discussion})}load(){Promise.all([n.e(563).then(n.bind(n,7764)),n.e(808).then(n.bind(n,9816))]).then((t=>{let[e,n]=t;this.PostStream=e.default,this.PostStreamScrubber=n.default;const r=s.Z.preloadedApiDocument();if(r)setTimeout(this.show.bind(this,r),0);else{const t=this.requestParams();s.Z.store.find("discussions",m.route.param("id"),t).then(this.show.bind(this))}})),m.redraw()}requestParams(){return{bySlug:!0,page:{near:this.near}}}show(t){var e,n;this.loading=!1,s.Z.history.push("discussion",t.title()),s.Z.setTitle(t.title()),s.Z.setTitleCount(0);let r=[];if(t.payload&&t.payload.included){const e=t.id();r=t.payload.included.filter((t=>"posts"===t.type&&t.relationships&&t.relationships.discussion&&!Array.isArray(t.relationships.discussion.data)&&t.relationships.discussion.data.id===e)).map((t=>s.Z.store.getById("posts",t.id))).sort(((t,e)=>t.number()-e.number())).slice(0,20)}this.stream=new h.Z(t,r);const o=m.route.param("near"),i="reply"===o?"reply":parseInt(o);this.stream.goToNumber(i||(null!=(e=null==(n=r[0])?void 0:n.number())?e:0),!0).then((()=>{this.discussion=t,s.Z.current.set("discussion",t),s.Z.current.set("stream",this.stream)}))}sidebarItems(){const t=new i.Z;return this.discussion&&t.add("controls",m(c.Z,{icon:"fas fa-ellipsis-v",className:"App-primaryControl",buttonClassName:"Button--primary",accessibleToggleLabel:s.Z.translator.trans("core.forum.discussion_controls.toggle_dropdown_accessible_label")},d.Z.controls(this.discussion,this).toArray()),100),t.add("scrubber",m(this.PostStreamScrubber,{stream:this.stream,className:"App-titleControl"}),-100),t}positionChanged(t,e){const n=this.discussion;if(!n)return;const r=s.Z.route.discussion(n,this.near=t);window.history.replaceState(null,document.title,r),s.Z.history.push("discussion",n.title()),s.Z.session.user&&e>(n.lastReadPostNumber()||0)&&(n.save({lastReadPostNumber:e}),m.redraw())}}flarum.reg.add("core","forum/components/DiscussionPage",p),flarum.reg.addChunkModule("563","7764","core","forum/components/PostStream"),flarum.reg.addChunkModule("563","7764","core","/home/runner/work/framework/framework/framework/core/js/src/forum/components/PostStream.js"),flarum.reg.addChunkModule("563","7764","core","/home/runner/work/framework/framework/framework/core/js/src/forum/components/LoadingPost.js"),flarum.reg.addChunkModule("563","7764","core","/home/runner/work/framework/framework/framework/core/js/src/forum/components/ReplyPlaceholder.js"),flarum.reg.addChunkModule("808","9816","core","forum/components/PostStreamScrubber")},2237:(t,e,n)=>{"use strict";n.d(e,{Z:()=>o});var r=n(6789),s=n(8162);class o extends s.Z{icon(){return"fas fa-pencil-alt"}href(){const t=this.attrs.notification,e=t.subject();return e?r.Z.route.discussion(e,t.content().postNumber):"#"}content(){return r.Z.translator.trans("core.forum.notifications.discussion_renamed_text",{user:this.attrs.notification.fromUser()})}excerpt(){return null}}flarum.reg.add("core","forum/components/DiscussionRenamedNotification",o)},4581:(t,e,n)=>{"use strict";n.d(e,{Z:()=>l});var r=n(7905),s=n(6789),o=n(156),i=n(2360),a=n(6597);class l{constructor(){(0,r.Z)(this,"results",new Map)}async search(t){t=t.toLowerCase(),this.results.set(t,[]);const e={filter:{q:t},page:{limit:3},include:"mostRelevantPost"};return s.Z.store.find("discussions",e).then((e=>{this.results.set(t,e),m.redraw()}))}view(t){t=t.toLowerCase();const e=(this.results.get(t)||[]).map((e=>{var n;const r=e.mostRelevantPost();return m("li",{className:"DiscussionSearchResult","data-index":"discussions"+e.id()},m(a.Z,{href:s.Z.route.discussion(e,r&&r.number()||0)},m("div",{className:"DiscussionSearchResult-title"},(0,o.Z)(e.title(),t)),!!r&&m("div",{className:"DiscussionSearchResult-excerpt"},(0,o.Z)(null!=(n=r.contentPlain())?n:"",t,100))))}));return[m("li",{className:"Dropdown-header"},s.Z.translator.trans("core.forum.search.discussions_heading")),m("li",null,m(i.Z,{icon:"fas fa-search",href:s.Z.route("index",{q:t})},s.Z.translator.trans("core.forum.search.all_discussions_button",{query:t}))),...e]}}flarum.reg.add("core","forum/components/DiscussionsSearchSource",l)},2488:(t,e,n)=>{"use strict";n.d(e,{Z:()=>w});var r=n(7905),s=n(6789),o=n(4661),i=n(4041),a=n(1268),l=n(8421),c=n(9517),u=n(1786),d=n(344),h=n(7202),f=n(1552),p=n(836),g=n(2190),v=n(2812),b=n(2360);class y extends g.Z{view(t){return m("nav",{className:"IndexPage-nav sideNav"},m("ul",null,(0,a.Z)(this.items().toArray())))}items(){const t=new i.Z,e=s.Z.forum.attribute("canStartDiscussion")||!s.Z.session.user;return t.add("newDiscussion",m(h.Z,{icon:"fas fa-edit",className:"Button Button--primary IndexPage-newDiscussion",itemClassName:"App-primaryControl",onclick:()=>this.newDiscussionAction().catch((()=>{})),disabled:!e},s.Z.translator.trans("core.forum.index.".concat(e?"start_discussion_button":"cannot_start_discussion_button")))),t.add("nav",m(v.Z,{buttonClassName:"Button",className:"App-titleControl",accessibleToggleLabel:s.Z.translator.trans("core.forum.index.toggle_sidenav_dropdown_accessible_label")},this.navItems().toArray())),t}navItems(){const t=new i.Z,e=s.Z.search.stickyParams();return t.add("allDiscussions",m(b.Z,{href:s.Z.route("index",e),icon:"far fa-comments"},s.Z.translator.trans("core.forum.index.all_discussions_link")),100),t}newDiscussionAction(){return new Promise(((t,e)=>s.Z.session.user?(s.Z.composer.load((()=>n.e(437).then(n.bind(n,3829))),{user:s.Z.session.user}).then((()=>s.Z.composer.show())),t(s.Z.composer)):(s.Z.modal.show((()=>n.e(460).then(n.bind(n,5049)))),e())))}}flarum.reg.add("core","forum/components/IndexSidebar",y),flarum.reg.addChunkModule("437","2140","core","forum/components/DiscussionComposer");class w extends o.Z{constructor(){super(...arguments),(0,r.Z)(this,"lastDiscussion",void 0)}oninit(t){super.oninit(t),s.Z.previous.matches(u.Z)&&(this.lastDiscussion=s.Z.previous.get("discussion")),s.Z.previous.matches(w)&&s.Z.discussions.clear(),s.Z.discussions.refreshParams(s.Z.search.params(),m.route.param("page")&&Number(m.route.param("page"))||1),s.Z.history.push("index",(0,f.Z)(s.Z.translator.trans("core.forum.header.back_to_index_tooltip"))),this.bodyClass="App--index",this.scrollTopOnCreate=!1}view(){return m(p.Z,{className:"IndexPage",hero:this.hero.bind(this),sidebar:this.sidebar.bind(this)},m("div",{className:"IndexPage-toolbar"},m("ul",{className:"IndexPage-toolbar-view"},(0,a.Z)(this.viewItems().toArray())),m("ul",{className:"IndexPage-toolbar-action"},(0,a.Z)(this.actionItems().toArray()))),m(l.Z,{state:s.Z.discussions}))}setTitle(){s.Z.setTitle((0,f.Z)(s.Z.translator.trans("core.forum.index.meta_title_text"))),s.Z.setTitleCount(0)}oncreate(t){super.oncreate(t),this.setTitle();const e=s.Z.cache.heroHeight,n=s.Z.cache.heroHeight=this.$(".Hero").outerHeight()||0,r=s.Z.cache.scrollTop;if($("#app").css("min-height",($(window).height()||0)+n),null!=s.Z.previous.type&&(this.lastDiscussion?$(window).scrollTop(r-e+n):$(window).scrollTop(0),this.lastDiscussion)){const t=this.$('li[data-id="'.concat(this.lastDiscussion.id(),'"] .DiscussionListItem'));if(t.length){const e=$("#header").outerHeight()||0,n=$(window).height()||0,s=t.offset(),o=s&&s.top||0,i=o+(t.outerHeight()||0);(or+n)&&$(window).scrollTop(o-e)}}}onbeforeremove(t){super.onbeforeremove(t),s.Z.cache.scrollTop=$(window).scrollTop()}onremove(t){super.onremove(t),$("#app").css("min-height","")}hero(){return m(c.Z,null)}sidebar(){return m(y,null)}viewItems(){const t=new i.Z,e=s.Z.discussions.sortMap(),n=Object.keys(e).reduce(((t,e)=>(t[e]=s.Z.translator.trans("core.forum.index_sort.".concat(e,"_button")),t)),{});return t.add("sort",m(d.Z,{buttonClassName:"Button",label:n[s.Z.search.params().sort]||Object.keys(e).map((t=>n[t]))[0],accessibleToggleLabel:s.Z.translator.trans("core.forum.index_sort.toggle_dropdown_accessible_label")},Object.keys(n).map((t=>{const r=n[t],o=(s.Z.search.params().sort||Object.keys(e)[0])===t;return m(h.Z,{icon:!o||"fas fa-check",onclick:s.Z.search.changeSort.bind(s.Z.search,t),active:o},r)})))),t}actionItems(){const t=new i.Z;return t.add("refresh",m(h.Z,{title:s.Z.translator.trans("core.forum.index.refresh_tooltip"),icon:"fas fa-sync",className:"Button Button--icon",onclick:()=>{s.Z.discussions.refresh(),s.Z.session.user&&(s.Z.store.find("users",s.Z.session.user.id()),m.redraw())}})),s.Z.session.user&&t.add("markAllAsRead",m(h.Z,{title:s.Z.translator.trans("core.forum.index.mark_all_as_read_tooltip"),icon:"fas fa-check",className:"Button Button--icon",onclick:this.markAllAsRead.bind(this)})),t}markAllAsRead(){var t;confirm((0,f.Z)(s.Z.translator.trans("core.forum.index.mark_all_as_read_confirmation")))&&(null==(t=s.Z.session.user)||t.save({markedAllAsReadAt:new Date}))}}(0,r.Z)(w,"providesInitialSearch",!0),flarum.reg.add("core","forum/components/IndexPage",w)},8162:(t,e,n)=>{"use strict";n.d(e,{Z:()=>f});var r=n(6789),s=n(2190),o=n(7202),i=n(3344),a=n(6597),l=n(9841),c=n(9133);class u extends s.Z{view(t){const{avatar:e,icon:n,content:r,excerpt:s,datetime:o,href:u,className:d,onclick:h,actions:f,...p}=t.attrs;return m(a.Z,{className:(0,i.Z)("HeaderListItem",d),href:u,external:u.includes("://"),onclick:h},e,m(c.Z,{name:n,className:"HeaderListItem-icon"}),m("span",{className:"HeaderListItem-title"},m("span",{className:"HeaderListItem-content"},r),m("span",{className:"HeaderListItem-title-spring"}),m("span",{className:"HeaderListItem-time"},o&&(0,l.Z)(o))),m("div",{className:"HeaderListItem-actions"},f),m("div",{className:"HeaderListItem-excerpt"},s))}}flarum.reg.add("core","forum/components/HeaderListItem",u);var d=n(4041),h=n(7323);class f extends s.Z{view(t){var e;const n=this.attrs.notification,r=null!=(e=this.href())?e:"",s=n.fromUser();return m(u,{className:(0,i.Z)("Notification","Notification--".concat(n.contentType()),[!n.isRead()&&"unread"]),avatar:m(h.Z,{user:s||null}),icon:this.icon(),content:this.content(),excerpt:this.excerpt(),datetime:n.createdAt(),href:r,onclick:this.markAsRead.bind(this),actions:this.actionItems().toArray()})}actionItems(){const t=new d.Z;return this.attrs.notification.isRead()||t.add("markAsRead",m(o.Z,{className:"Notification-action Button Button--link",icon:"fas fa-check","aria-label":r.Z.translator.trans("core.forum.notifications.mark_as_read_tooltip"),onclick:t=>{t.preventDefault(),t.stopPropagation(),this.markAsRead()}}),100),t}markAsRead(){var t,e;this.attrs.notification.isRead()||(null==(t=r.Z.session.user)||t.pushAttributes({unreadNotificationCount:(null!=(e=r.Z.session.user.unreadNotificationCount())?e:1)-1}),this.attrs.notification.save({isRead:!0}))}}flarum.reg.add("core","forum/components/Notification",f)},85:(t,e,n)=>{"use strict";n.d(e,{Z:()=>u});var r=n(6789),s=n(7297),o=n(1552),i=n(344),a=n(3344),l=n(9133);class c extends i.Z{static initAttrs(t){t.className=(0,a.Z)("HeaderDropdown",t.className),t.buttonClassName||(t.buttonClassName="Button Button--flat"),t.menuClassName||(t.menuClassName="Dropdown-menu--right"),t.label||(t.label=(0,o.Z)(r.Z.translator.trans("core.forum.notifications.tooltip"))),super.initAttrs(t)}getButton(t){const e=this.getNewCount(),n=super.getButton(t);return n.attrs.title=this.attrs.label,n.attrs.className=(0,a.Z)(n.attrs.className,[e&&"new"]),n.attrs.onclick=this.onclick.bind(this),n}getButtonContent(){const t=this.getUnreadCount();return[this.attrs.icon?m(l.Z,{name:this.attrs.icon,className:"Button-icon"}):null,0!==t&&m("span",{className:"HeaderDropdown-unread"},t),m("span",{className:"Button-label"},this.attrs.label)]}getMenu(){return m("div",{className:(0,a.Z)("Dropdown-menu",this.attrs.menuClassName),onclick:this.menuClick.bind(this)},this.showing&&this.getContent())}menuClick(t){(t.shiftKey||t.metaKey||t.ctrlKey||1===t.button)&&t.stopPropagation()}onclick(){var t;r.Z.drawer.isOpen()?this.goToRoute():null==(t=this.attrs.state)||t.load()}}flarum.reg.add("core","forum/components/HeaderDropdown",c);class u extends c{static initAttrs(t){t.className=(0,a.Z)("NotificationsDropdown",t.className),t.icon||(t.icon="fas fa-bell"),t.accessibleToggleLabel||(t.accessibleToggleLabel=(0,o.Z)(r.Z.translator.trans("core.forum.notifications.toggle_dropdown_accessible_label"))),super.initAttrs(t)}getContent(){return m(s.Z,{state:this.attrs.state})}goToRoute(){m.route.set(r.Z.route("notifications"))}getUnreadCount(){return r.Z.session.user.unreadNotificationCount()}getNewCount(){return r.Z.session.user.newNotificationCount()}}flarum.reg.add("core","forum/components/NotificationsDropdown",u)},836:(t,e,n)=>{"use strict";n.d(e,{Z:()=>l});var r=n(7905),s=n(2190),o=n(3344),i=n(4041),a=n(5226);class l extends s.Z{constructor(){super(...arguments),(0,r.Z)(this,"content",void 0)}view(t){const{className:e}=t.attrs;return this.content=t.children,m("div",{className:(0,o.Z)("Page",e)},this.rootItems().toArray())}rootItems(){const t=new i.Z;return t.add("pane",this.providedPane(),100),t.add("main",this.main(),10),t}mainItems(){const t=new i.Z;return t.add("hero",this.providedHero(),100),t.add("container",this.container(),10),t}loadingItems(){const t=new i.Z;return t.add("spinner",m(a.Z,{display:"block"}),100),t}main(){return m("div",{className:"Page-main"},this.attrs.loading?this.loadingItems().toArray():this.mainItems().toArray())}containerItems(){const t=new i.Z;return t.add("sidebar",this.sidebar(),100),t.add("content",this.providedContent(),10),t}container(){return m("div",{className:"Page-container container"},this.containerItems().toArray())}sidebarItems(){const t=new i.Z;return t.add("sidebar",this.attrs.sidebar&&this.attrs.sidebar()||null,100),t}sidebar(){return m("div",{className:"Page-sidebar"},this.sidebarItems().toArray())}providedPane(){return m("div",{className:"Page-pane"},this.attrs.pane&&this.attrs.pane()||null)}providedHero(){return m("div",{className:"Page-hero"},this.attrs.hero&&this.attrs.hero()||null)}providedContent(){return m("div",{className:"Page-content"},this.content)}}flarum.reg.add("core","forum/components/PageStructure",l)},6098:(t,e,n)=>{"use strict";n.d(e,{Z:()=>h});var r=n(7905),s=n(6789),o=n(2190),i=n(4794),a=n(344),l=n(4478),c=n(1268),u=n(4041),d=n(5226);class h extends o.Z{constructor(){super(...arguments),(0,r.Z)(this,"loading",!1),(0,r.Z)(this,"subtree",void 0)}oninit(t){super.oninit(t),this.loading=!1,this.subtree=new i.Z((()=>this.loading),(()=>this.attrs.post.freshness),(()=>{const t=this.attrs.post.user();return t&&t.freshness}))}view(t){const e=this.elementAttrs();e.className=this.classes(e.className).join(" ");const n=l.Z.controls(this.attrs.post,this).toArray(),r=this.footerItems().toArray();return m("article",e,this.header(),m("div",{className:"Post-container"},m("div",{className:"Post-side"},this.sideItems().toArray()),m("div",{className:"Post-main"},this.loading?m(d.Z,null):this.content(),m("aside",{className:"Post-actions"},m("ul",null,(0,c.Z)(this.actionItems().toArray()),!!n.length&&m("li",null,m(a.Z,{className:"Post-controls",buttonClassName:"Button Button--icon Button--flat",menuClassName:"Dropdown-menu--right",icon:"fas fa-ellipsis-h",onshow:()=>this.$(".Post-controls").addClass("open"),onhide:()=>this.$(".Post-controls").removeClass("open"),accessibleToggleLabel:s.Z.translator.trans("core.forum.post_controls.toggle_dropdown_accessible_label")},n)))),m("footer",{className:"Post-footer"},r.length?m("ul",null,(0,c.Z)(r)):null))))}onbeforeupdate(t){return super.onbeforeupdate(t),this.subtree.needsRebuild()}onupdate(t){super.onupdate(t);const e=this.$(".Post-actions"),n=this.$(".Post-controls");e.toggleClass("openWithin",n.hasClass("open"))}elementAttrs(){return{}}header(){return null}content(){return[]}classes(t){let e=(t||"").split(" ").concat(["Post"]);const n=this.attrs.post.user(),r=this.attrs.post.discussion();return this.loading&&e.push("Post--loading"),n&&n===s.Z.session.user&&e.push("Post--by-actor"),n&&n===r.user()&&e.push("Post--by-start-user"),e}actionItems(){return new u.Z}footerItems(){return new u.Z}sideItems(){const t=new u.Z;return t.add("avatar",this.avatar(),100),t}avatar(){return null}}flarum.reg.add("core","forum/components/Post",h)},890:(t,e,n)=>{"use strict";n.d(e,{Z:()=>d});var r=n(7905),s=n(6789),o=n(3390),i=n(5226),a=n(7202),l=n(6597),c=n(4675),u=n(7352);class d extends o.Z{constructor(){super(...arguments),(0,r.Z)(this,"loading",!0),(0,r.Z)(this,"moreResults",!1),(0,r.Z)(this,"posts",[]),(0,r.Z)(this,"loadLimit",20)}oninit(t){super.oninit(t),this.loadUser(m.route.param("username"))}content(){if(0===this.posts.length&&!this.loading)return m("div",{className:"PostsUserPage"},m(c.Z,{text:s.Z.translator.trans("core.forum.user.posts_empty_text")}));let t;return this.loading?t=m(i.Z,null):this.moreResults&&(t=m("div",{className:"PostsUserPage-loadMore"},m(a.Z,{className:"Button",onclick:this.loadMore.bind(this)},s.Z.translator.trans("core.forum.user.posts_load_more_button")))),m("div",{className:"PostsUserPage"},m("ul",{className:"PostsUserPage-list"},this.posts.map((t=>m("li",null,m("div",{className:"PostsUserPage-discussion"},s.Z.translator.trans("core.forum.user.in_discussion_text",{discussion:m(l.Z,{href:s.Z.route.post(t)},t.discussion().title())})),m(u.Z,{post:t}))))),m("div",{className:"PostsUserPage-loadMore"},t))}show(t){super.show(t),this.refresh()}refresh(){this.loading=!0,this.posts=[],m.redraw(),this.loadResults().then(this.parseResults.bind(this))}loadResults(t){return void 0===t&&(t=0),s.Z.store.find("posts",{filter:{author:this.user.username(),type:"comment"},page:{offset:t,limit:this.loadLimit},sort:"-createdAt"})}loadMore(){this.loading=!0,this.loadResults(this.posts.length).then(this.parseResults.bind(this))}parseResults(t){return this.loading=!1,this.posts.push(...t),this.moreResults=t.length>=this.loadLimit,m.redraw(),t}}flarum.reg.add("core","forum/components/PostsUserPage",d)},9067:(t,e,n)=>{"use strict";n.d(e,{Z:()=>c});var r=n(7905),s=n(6789),o=n(7108),i=n(7202),a=n(6458),l=n(6352);class c extends o.Z{constructor(){super(...arguments),(0,r.Z)(this,"discussion",void 0),(0,r.Z)(this,"currentTitle",void 0),(0,r.Z)(this,"newTitle",void 0)}oninit(t){super.oninit(t),this.discussion=this.attrs.discussion,this.currentTitle=this.attrs.currentTitle,this.newTitle=(0,a.Z)(this.currentTitle)}className(){return"RenameDiscussionModal Modal--small"}title(){return s.Z.translator.trans("core.forum.rename_discussion.title")}content(){return m("div",{className:"Modal-body"},m(l.Z,{className:"Form--centered"},m("div",{className:"Form-group"},m("input",{className:"FormControl",bidi:this.newTitle,type:"text"})),m("div",{className:"Form-group Form-controls"},m(i.Z,{className:"Button Button--primary Button--block",type:"submit",loading:this.loading},s.Z.translator.trans("core.forum.rename_discussion.submit_button")))))}onsubmit(t){t.preventDefault(),this.loading=!0;const e=this.newTitle(),n=this.currentTitle;if(e&&e!==n)return this.discussion.save({title:e}).then((()=>{s.Z.viewingDiscussion(this.discussion)&&s.Z.current.get("stream").update(),m.redraw(),this.hide()})).catch((()=>{this.loading=!1,m.redraw()}));this.hide()}}flarum.reg.add("core","forum/components/RenameDiscussionModal",c)},4501:(t,e,n)=>{"use strict";n.d(e,{Z:()=>g});var r=n(7905),s=n(6789),o=n(2190),i=n(5226),a=n(4041),l=n(3344),c=n(1552),u=n(8046),d=n(4581),h=n(9607),f=n(4300),p=n(9133);class g extends o.Z{constructor(){super(...arguments),(0,r.Z)(this,"searchState",void 0),(0,r.Z)(this,"hasFocus",!1),(0,r.Z)(this,"sources",void 0),(0,r.Z)(this,"loadingSources",0),(0,r.Z)(this,"index",0),(0,r.Z)(this,"navigator",void 0),(0,r.Z)(this,"searchTimeout",void 0),(0,r.Z)(this,"updateMaxHeightHandler",void 0)}get state(){return(0,f.w)("`state` property of the Search component is deprecated","3212"),this.searchState}set state(t){void 0!==t&&(0,f.w)("`state` property of the Search component is deprecated","3212"),this.searchState=t}oninit(t){super.oninit(t),this.searchState=this.attrs.state}view(){const t=this.searchState.getInitialSearch();if(this.sources||(this.sources=this.sourceItems().toArray()),!this.sources.length)return m("div",null);const e=(0,c.Z)(s.Z.translator.trans("core.forum.header.search_placeholder")),n=!!t,r=!(!this.searchState.getValue()||!this.hasFocus),o=!(this.loadingSources||!this.searchState.getValue());return m("div",{role:"search","aria-label":s.Z.translator.trans("core.forum.header.search_role_label"),className:(0,l.Z)("Search",{open:this.searchState.getValue()&&this.hasFocus,focused:this.hasFocus,active:n,loading:!!this.loadingSources})},m("div",{className:"Search-input"},m("input",{"aria-label":e,className:"FormControl",type:"search",placeholder:e,value:this.searchState.getValue(),oninput:t=>{var e;return this.searchState.setValue(null==t||null==(e=t.target)?void 0:e.value)},onfocus:()=>this.hasFocus=!0,onblur:()=>this.hasFocus=!1}),!!this.loadingSources&&m(i.Z,{size:"small",display:"inline",containerClassName:"Button Button--icon Button--link"}),o&&m("button",{className:"Search-clear Button Button--icon Button--link",onclick:this.clear.bind(this),"aria-label":s.Z.translator.trans("core.forum.header.search_clear_button_accessible_label"),type:"button"},m(p.Z,{name:"fas fa-times-circle"}))),m("ul",{className:"Dropdown-menu Search-results","aria-hidden":!r||void 0,"aria-live":r?"polite":void 0},r&&this.sources.map((t=>t.view(this.searchState.getValue())))))}updateMaxHeight(){var t,e;const n=window.innerHeight-this.element.querySelector(".Search-input>.FormControl").getBoundingClientRect().bottom-14;null==(t=this.element.querySelector(".Search-results"))||null==(e=t.style)||e.setProperty("max-height","".concat(n,"px"))}onupdate(t){var e;super.onupdate(t),this.setIndex(this.getCurrentNumericIndex()),null!=(e=this.sources)&&e.length&&this.updateMaxHeight()}oncreate(t){var e;if(super.oncreate(t),null==(e=this.sources)||!e.length)return;const n=this,r=this.searchState;this.setIndex(this.getCurrentNumericIndex()),this.$(".Search-results").on("mousedown",(t=>t.preventDefault())).on("click",(()=>this.$("input").trigger("blur"))).on("mouseenter","> li:not(.Dropdown-header)",(function(){n.setIndex(n.selectableItems().index(this))}));const s=this.$("input");this.navigator=new u.Z,this.navigator.onUp((()=>this.setIndex(this.getCurrentNumericIndex()-1,!0))).onDown((()=>this.setIndex(this.getCurrentNumericIndex()+1,!0))).onSelect(this.selectResult.bind(this),!0).onCancel(this.clear.bind(this)).bindTo(s),s.on("input focus",(function(){const t=this.value.toLowerCase();t&&(n.searchTimeout&&clearTimeout(n.searchTimeout),n.searchTimeout=window.setTimeout((()=>{var e;r.isCached(t)||(t.length>=n.constructor.MIN_SEARCH_LEN&&(null==(e=n.sources)||e.map((e=>{e.search&&(n.loadingSources++,e.search(t).then((()=>{n.loadingSources=Math.max(0,n.loadingSources-1),m.redraw()})))}))),r.cache(t),m.redraw())}),250))})).on("focus",(function(){$(this).one("mouseup",(t=>t.preventDefault())).trigger("select")})),this.updateMaxHeightHandler=this.updateMaxHeight.bind(this),window.addEventListener("resize",this.updateMaxHeightHandler)}onremove(t){super.onremove(t),this.updateMaxHeightHandler&&window.removeEventListener("resize",this.updateMaxHeightHandler)}selectResult(){this.searchTimeout&&clearTimeout(this.searchTimeout),this.loadingSources=0;const t=this.getItem(this.index).find("a").attr("href");this.searchState.getValue()&&t?m.route.set(t):this.clear(),this.$("input").blur()}clear(){this.searchState.clear()}sourceItems(){const t=new a.Z;return s.Z.forum.attribute("canViewForum")&&t.add("discussions",new d.Z),s.Z.forum.attribute("canSearchUsers")&&t.add("users",new h.Z),t}selectableItems(){return this.$(".Search-results > li:not(.Dropdown-header)")}getCurrentNumericIndex(){return Math.max(0,this.selectableItems().index(this.getItem(this.index)))}getItem(t){const e=this.selectableItems();let n=e.filter('[data-index="'.concat(t,'"]'));return n.length||(n=e.eq(t)),n}setIndex(t,e){void 0===e&&(e=!1);const n=this.selectableItems(),r=n.parent();let s=t;t<0?s=n.length-1:t>=n.length&&(s=0);const o=n.removeClass("active").eq(s).addClass("active");if(this.index=parseInt(o.attr("data-index"))||s,e){const t=r.scrollTop(),e=r.offset().top,n=e+r.outerHeight(),s=o.offset().top,i=s+o.outerHeight();let a;sn&&(a=t-n+i+parseInt(r.css("padding-bottom"),10)),void 0!==a&&r.stop(!0).animate({scrollTop:a},100)}}}(0,r.Z)(g,"MIN_SEARCH_LEN",3),flarum.reg.add("core","forum/components/Search",g)},7911:(t,e,n)=>{"use strict";n.d(e,{Z:()=>h});var r=n(6789),s=n(5537),o=n(344),i=n(2360),a=n(7202),l=n(4041),c=n(2903),u=n(1552),d=n(7323);class h extends o.Z{static initAttrs(t){super.initAttrs(t),t.className="SessionDropdown",t.buttonClassName="Button Button--user Button--flat",t.menuClassName="Dropdown-menu--right",t.accessibleToggleLabel=(0,u.Z)(r.Z.translator.trans("core.forum.header.session_dropdown_accessible_label"))}view(t){return super.view({...t,children:this.items().toArray()})}getButtonContent(){const t=r.Z.session.user;return[m(d.Z,{user:t})," ",m("span",{className:"Button-label"},(0,s.Z)(t))]}items(){const t=new l.Z,e=r.Z.session.user;return t.add("profile",m(i.Z,{icon:"fas fa-user",href:r.Z.route.user(e)},r.Z.translator.trans("core.forum.header.profile_button")),100),t.add("settings",m(i.Z,{icon:"fas fa-cog",href:r.Z.route("settings")},r.Z.translator.trans("core.forum.header.settings_button")),50),r.Z.forum.attribute("adminUrl")&&t.add("administration",m(i.Z,{icon:"fas fa-wrench",href:r.Z.forum.attribute("adminUrl"),target:"_blank"},r.Z.translator.trans("core.forum.header.admin_button")),0),t.add("separator",m(c.Z,null),-90),t.add("logOut",m(a.Z,{icon:"fas fa-sign-out-alt",onclick:r.Z.session.logout.bind(r.Z.session)},r.Z.translator.trans("core.forum.header.log_out_button")),-100),t}}flarum.reg.add("core","forum/components/SessionDropdown",h)},3390:(t,e,n)=>{"use strict";n.d(e,{Z:()=>p});var r=n(7905),s=n(6789),o=n(4661),i=n(4041),a=n(4741),l=n(2812),c=n(2360),u=n(2903),d=n(1268),h=n(3477),f=n(836);class p extends o.Z{constructor(){super(...arguments),(0,r.Z)(this,"user",null)}oninit(t){super.oninit(t),this.bodyClass="App--user"}view(){return m(f.Z,{className:"UserPage",hero:this.hero.bind(this),sidebar:this.sidebar.bind(this),loading:!this.user},this.user&&this.content())}hero(){return m(a.Z,{user:this.user,className:"Hero UserHero",editable:this.user.canEdit()||this.user===s.Z.session.user,controlsButtonClassName:"Button"})}sidebar(){return m(h.Z,null,m("nav",{className:"sideNav UserPage-nav"},m("ul",null,(0,d.Z)(this.sidebarItems().toArray()))))}content(){}show(t){this.user=t,s.Z.current.set("user",t),s.Z.setTitle(t.displayName()),m.redraw()}loadUser(t){const e=t.toLowerCase();s.Z.preloadedApiDocument(),s.Z.store.all("users").some((n=>!(n.username().toLowerCase()!==e&&n.id()!==t||!n.joinTime()||(this.show(n),0)))),this.user||s.Z.store.find("users",t,{bySlug:!0}).then(this.show.bind(this))}sidebarItems(){const t=new i.Z;return t.add("nav",m(l.Z,{className:"App-titleControl",buttonClassName:"Button"},this.navItems().toArray())),t}navItems(){const t=new i.Z,e=this.user,n=s.Z.session.user===e;return t.add("posts",m(c.Z,{href:s.Z.route("user.posts",{username:e.slug()}),icon:"far fa-comment"},s.Z.translator.trans("core.forum.user.posts_link")," ",m("span",{className:"Button-badge"},e.commentCount())),100),t.add("discussions",m(c.Z,{href:s.Z.route("user.discussions",{username:e.slug()}),icon:"fas fa-bars"},s.Z.translator.trans("core.forum.user.discussions_link")," ",m("span",{className:"Button-badge"},e.discussionCount())),90),n&&(t.add("separator",m(u.Z,null),-90),t.add("settings",m(c.Z,{href:s.Z.route("settings"),icon:"fas fa-cog"},s.Z.translator.trans("core.forum.user.settings_link")),-100)),(n||s.Z.forum.attribute("canModerateAccessTokens"))&&(n||t.add("security-separator",m(u.Z,null),-90),t.add("security",m(c.Z,{href:s.Z.route("user.security",{username:e.slug()}),icon:"fas fa-shield-alt"},s.Z.translator.trans("core.forum.user.security_link")),-100)),t}}flarum.reg.add("core","forum/components/UserPage",p)},9607:(t,e,n)=>{"use strict";n.d(e,{Z:()=>c});var r=n(7905),s=n(6789),o=n(156),i=n(5537),a=n(6597),l=n(7323);class c{constructor(){(0,r.Z)(this,"results",new Map)}async search(t){return s.Z.store.find("users",{filter:{q:t},page:{limit:5}}).then((e=>{this.results.set(t,e),m.redraw()}))}view(t){t=t.toLowerCase();const e=(this.results.get(t)||[]).concat(s.Z.store.all("users").filter((e=>[e.username(),e.displayName()].some((e=>e.toLowerCase().substr(0,t.length)===t))))).filter(((t,e,n)=>n.lastIndexOf(t)===e)).sort(((t,e)=>t.displayName().localeCompare(e.displayName())));return e.length?[m("li",{className:"Dropdown-header"},s.Z.translator.trans("core.forum.search.users_heading")),...e.map((e=>{const n=(0,i.Z)(e,(e=>(0,o.Z)(e,t)));return m("li",{className:"UserSearchResult","data-index":"users"+e.id()},m(a.Z,{href:s.Z.route.user(e)},m(l.Z,{user:e}),n))}))]:[]}}flarum.reg.add("core","forum/components/UsersSearchSource",c)},9517:(t,e,n)=>{"use strict";n.d(e,{Z:()=>c});var r=n(7905),s=n(6789),o=n(2190),i=n(7202),a=n(4041);const l="welcomeHidden";class c extends o.Z{constructor(){super(...arguments),(0,r.Z)(this,"hidden",!1)}oninit(t){super.oninit(t)}view(t){return this.isHidden()?null:m("header",{className:"Hero WelcomeHero"},m("div",{className:"container"},m(i.Z,{icon:"fas fa-times",onclick:()=>{this.$().slideUp(this.hide.bind(this))},className:"Hero-close Button Button--icon Button--link","aria-label":s.Z.translator.trans("core.forum.welcome_hero.hide")}),m("div",{className:"containerNarrow"},this.welcomeItems().toArray())))}hide(){localStorage.setItem(l,"true")}isHidden(){var t;return null==(t=s.Z.forum.attribute("welcomeTitle"))||!t.trim()||!!localStorage.getItem(l)||!!this.hidden}welcomeItems(){const t=new a.Z;return t.add("hero-title",m("h1",{className:"Hero-title"},s.Z.forum.attribute("welcomeTitle")),20),t.add("hero-subtitle",m("div",{className:"Hero-subtitle"},m.trust(s.Z.forum.attribute("welcomeMessage"))),10),t}}flarum.reg.add("core","forum/components/WelcomeHero",c)},8689:(t,e,n)=>{"use strict";n.d(e,{Z:()=>a});var r=n(7905),s=n(6789),o=n(2408),i=n(1786);class a extends o.Z{canonicalizeDiscussionSlug(t){if(t)return t.split("-")[0]}makeKey(){const t={...m.route.param()};return"near"in t&&delete t.near,t.id=this.canonicalizeDiscussionSlug(t.id),this.routeName.replace(".near","")+JSON.stringify(t)}onmatch(t,e,n){return s.Z.current.matches(i.Z)&&this.canonicalizeDiscussionSlug(t.id)===this.canonicalizeDiscussionSlug(m.route.param("id"))&&(a.scrollToPostNumber=t.near||1),super.onmatch(t,e,n)}render(t){if(null!==a.scrollToPostNumber){const t=a.scrollToPostNumber;setTimeout((()=>s.Z.current.get("stream").goToNumber(t))),a.scrollToPostNumber=null}return super.render(t)}}(0,r.Z)(a,"scrollToPostNumber",null),flarum.reg.add("core","forum/resolvers/DiscussionPageResolver",a)},4723:(t,e,n)=>{"use strict";n.d(e,{K:()=>l,Z:()=>a});var r=n(2488),s=n(1786),o=n(890),i=n(8689);function a(t){t.routes={index:{path:"/all",component:r.Z},discussion:{path:"/d/:id",component:s.Z,resolverClass:i.Z},"discussion.near":{path:"/d/:id/:near",component:s.Z,resolverClass:i.Z},user:{path:"/u/:username",component:o.Z},"user.posts":{path:"/u/:username",component:o.Z},"user.discussions":{path:"/u/:username/discussions",component:()=>n.e(799).then(n.bind(n,6466))},settings:{path:"/settings",component:()=>n.e(826).then(n.bind(n,9989))},"user.security":{path:"/u/:username/security",component:()=>n.e(505).then(n.bind(n,2828))},notifications:{path:"/notifications",component:()=>n.e(744).then(n.bind(n,8246))}}}function l(t){return{discussion:(e,n)=>t.route(n&&1!==n?"discussion.near":"discussion",{id:e.slug(),near:n&&1!==n?n:void 0}),post:e=>t.route.discussion(e.discussion(),e.number()),user:e=>t.route("user",{username:e.slug()})}}flarum.reg.addChunkModule("799","6466","core","forum/components/DiscussionsUserPage"),flarum.reg.addChunkModule("826","9989","core","forum/components/SettingsPage"),flarum.reg.addChunkModule("826","9989","core","/home/runner/work/framework/framework/framework/core/js/src/forum/components/SettingsPage.tsx"),flarum.reg.addChunkModule("826","9989","core","/home/runner/work/framework/framework/framework/core/js/src/forum/components/NotificationGrid.js"),flarum.reg.addChunkModule("826","9989","core","/home/runner/work/framework/framework/framework/core/js/src/forum/components/ChangePasswordModal.tsx"),flarum.reg.addChunkModule("826","9989","core","/home/runner/work/framework/framework/framework/core/js/src/forum/components/ChangeEmailModal.tsx"),flarum.reg.addChunkModule("505","2828","core","forum/components/UserSecurityPage"),flarum.reg.addChunkModule("505","2828","core","/home/runner/work/framework/framework/framework/core/js/src/forum/components/UserSecurityPage.tsx"),flarum.reg.addChunkModule("505","2828","core","/home/runner/work/framework/framework/framework/core/js/src/forum/components/AccessTokensList.tsx"),flarum.reg.addChunkModule("505","2828","core","/home/runner/work/framework/framework/framework/core/js/src/forum/components/NewAccessTokenModal.tsx"),flarum.reg.addChunkModule("505","2828","core","/home/runner/work/framework/framework/framework/core/js/src/forum/states/UserSecurityPageState.ts"),flarum.reg.addChunkModule("505","2828","core","/home/runner/work/framework/framework/framework/core/js/src/common/components/LabelValue.tsx"),flarum.reg.addChunkModule("744","8246","core","forum/components/NotificationsPage")},1654:(t,e,n)=>{"use strict";n.d(e,{Z:()=>l});var r=n(7905),s=n(6789),o=n(2437);class i{constructor(){(0,r.Z)(this,"events",{}),this.events={}}on(t,e){return this.events[t]||(this.events[t]=[]),this.events[t].push(e),this}emit(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;rt(...n)))}}flarum.reg.add("core","common/utils/EventEmitter",i);const a=new i;class l extends o.Z{constructor(t,e){void 0===e&&(e=1),super(t,e,20),(0,r.Z)(this,"extraDiscussions",[]),(0,r.Z)(this,"eventEmitter",void 0),this.eventEmitter=a.on("discussion.deleted",this.deleteDiscussion.bind(this))}get type(){return"discussions"}requestParams(){var t;const e={include:["user","lastPostedUser"],filter:this.params.filter||{},sort:this.sortMap()[null!=(t=this.params.sort)?t:""]};return this.params.q&&(e.filter.q=this.params.q,e.include.push("mostRelevantPost","mostRelevantPost.user")),e}loadPage(t){void 0===t&&(t=1);const e=s.Z.preloadedApiDocument();return e?(this.initialLoading=!1,Promise.resolve(e)):super.loadPage(t)}clear(){super.clear(),this.extraDiscussions=[]}sortMap(){const t={};return this.params.q&&(t.relevance=""),t.latest="-lastPostedAt",t.top="-commentCount",t.newest="-createdAt",t.oldest="createdAt",t}isSearchResults(){return!!this.params.q}removeDiscussion(t){this.eventEmitter.emit("discussion.deleted",t)}deleteDiscussion(t){for(const e of this.pages){const n=e.items.indexOf(t);if(-1!==n){e.items.splice(n,1);break}}const e=this.extraDiscussions.indexOf(t);-1!==e&&this.extraDiscussions.splice(e),m.redraw()}addDiscussion(t){this.removeDiscussion(t),this.extraDiscussions.unshift(t),m.redraw()}getAllItems(){return this.extraDiscussions.concat(super.getAllItems())}getPages(){const t=super.getPages();return this.extraDiscussions.length?[{number:-1,items:this.extraDiscussions},...t]:t}}flarum.reg.add("core","forum/states/DiscussionListState",l)},4564:(t,e,n)=>{"use strict";n.d(e,{Z:()=>a});var r=n(7905),s=n(6789),o=n(6083),i=n(5749);class a extends i.Z{constructor(t){void 0===t&&(t=[]),super(t),(0,r.Z)(this,"initialValueSet",!1)}getValue(){return!this.initialValueSet&&this.currPageProvidesSearch()&&this.intializeValue(),super.getValue()}intializeValue(){this.setValue(this.getInitialSearch()),this.initialValueSet=!0}currPageProvidesSearch(){return s.Z.current.type&&s.Z.current.type.providesInitialSearch}getInitialSearch(){return this.currPageProvidesSearch()?this.params().q:""}clear(){super.clear(),this.getInitialSearch()?this.clearInitialSearch():m.redraw()}clearInitialSearch(){const{q:t,...e}=this.params();(0,o.Z)(s.Z.route(s.Z.current.get("routeName"),e))}stickyParams(){return{sort:m.route.param("sort"),q:m.route.param("q")}}params(){const t=this.stickyParams();return t.filter=m.route.param("filter"),t}changeSort(t){const e=this.params();t===Object.keys(s.Z.discussions.sortMap())[0]?delete e.sort:e.sort=t,(0,o.Z)(s.Z.route(s.Z.current.get("routeName"),e))}}flarum.reg.add("core","forum/states/GlobalSearchState",a)},177:(t,e,n)=>{"use strict";n.d(e,{Z:()=>o});var r=n(6789),s=n(2437);class o extends s.Z{constructor(){super({},1,20)}get type(){return"notifications"}load(){var t,e;return null!=(t=r.Z.session.user)&&t.newNotificationCount()&&(this.pages=[],this.location={page:1}),this.pages.length>0?Promise.resolve():(null==(e=r.Z.session.user)||e.pushAttributes({newNotificationCount:0}),super.loadNext())}markAllAsRead(){var t;if(0!==this.pages.length)return null==(t=r.Z.session.user)||t.pushAttributes({unreadNotificationCount:0}),this.pages.forEach((t=>{t.items.forEach((t=>t.pushAttributes({isRead:!0})))})),r.Z.request({url:r.Z.forum.attribute("apiUrl")+"/notifications/read",method:"POST"})}deleteAll(){var t;if(0!==this.pages.length)return null==(t=r.Z.session.user)||t.pushAttributes({unreadNotificationCount:0}),this.pages=[],r.Z.request({url:r.Z.forum.attribute("apiUrl")+"/notifications",method:"DELETE"})}}flarum.reg.add("core","forum/states/NotificationListState",o)},5003:(t,e,n)=>{"use strict";n.d(e,{Z:()=>a});var r=n(7905),s=n(6789),o=n(8324),i=n(2199);class a{constructor(t,e){void 0===e&&(e=[]),(0,r.Z)(this,"discussion",void 0),(0,r.Z)(this,"paused",!1),(0,r.Z)(this,"loadPageTimeouts",{}),(0,r.Z)(this,"pagesLoading",0),(0,r.Z)(this,"index",0),(0,r.Z)(this,"number",1),(0,r.Z)(this,"visible",1),(0,r.Z)(this,"visibleStart",0),(0,r.Z)(this,"visibleEnd",0),(0,r.Z)(this,"animateScroll",!1),(0,r.Z)(this,"needsScroll",!1),(0,r.Z)(this,"targetPost",null),(0,r.Z)(this,"description",""),(0,r.Z)(this,"forceUpdateScrubber",!1),(0,r.Z)(this,"loadPromise",null),(0,r.Z)(this,"loadNext",void 0),(0,r.Z)(this,"loadPrevious",void 0),this.discussion=t,this.loadNext=(0,o.P)(300,this._loadNext),this.loadPrevious=(0,o.P)(300,this._loadPrevious),this.show(e)}update(){return this.viewingEnd()?(this.visibleEnd=this.count(),this.loadRange(this.visibleStart,this.visibleEnd)):Promise.resolve()}goToFirst(){return this.goToIndex(0)}goToLast(){return this.goToIndex(this.count()-1,!0)}goToNumber(t,e){if(void 0===e&&(e=!1),"reply"===t){const t=this.goToLast();return this.targetPost={...this.targetPost,reply:!0},t}return this.paused=!0,this.loadPromise=this.loadNearNumber(t),this.needsScroll=!0,this.targetPost={number:t},this.animateScroll=!e,this.number=t,this.loadPromise.then((()=>m.redraw()))}goToIndex(t,e){return void 0===e&&(e=!1),this.paused=!0,this.loadPromise=this.loadNearIndex(t),this.needsScroll=!0,this.targetPost={index:t},this.animateScroll=!e,this.index=t,m.redraw(),this.loadPromise}loadNearNumber(t){return this.posts().some((e=>e&&Number(e.number())===Number(t)))?Promise.resolve():(this.reset(),s.Z.store.find("posts",{filter:{discussion:this.discussion.id()},page:{near:t}}).then(this.show.bind(this)))}loadNearIndex(t){if(t>=this.visibleStart&&tthis.visibleStart&&n>=0&&(this.visibleStart=n+a.loadCount+1,this.loadPageTimeouts[n]&&(clearTimeout(this.loadPageTimeouts[n]),delete this.loadPageTimeouts[n],this.pagesLoading--)),this.loadPage(t,e)}_loadPrevious(){const t=this.visibleStart,e=this.visibleStart=this.sanitizeIndex(this.visibleStart-a.loadCount),n=e+2*a.loadCount;n{if(tthis.visibleEnd)return;const r=n?this.visibleEnd-1:this.visibleStart;(0,i.Z)('.PostStream-item[data-index="'.concat(r,'"]'),m.redraw.sync)};r(),this.loadPageTimeouts[t]=setTimeout((()=>{this.loadRange(t,e).then((()=>{r(),this.pagesLoading--})),delete this.loadPageTimeouts[t]}),this.pagesLoading-1?1e3:0)}loadRange(t,e){const n=[],r=[];return this.discussion.postIds().slice(t,e).forEach((t=>{const e=s.Z.store.getById("posts",t);e&&e.discussion()&&void 0!==e.canEdit()?r.push(e):n.push(t)})),n.length?s.Z.store.find("posts",n).then((t=>r.concat(t).sort(((t,e)=>t.number()-e.number())))):Promise.resolve(r)}show(t){var e;this.visibleStart=t.length?this.discussion.postIds().indexOf(null!=(e=t[0].id())?e:"0"):0,this.visibleEnd=this.sanitizeIndex(this.visibleStart+t.length)}reset(t,e){this.visibleStart=t||0,this.visibleEnd=this.sanitizeIndex(e||a.loadCount)}posts(){return this.discussion.postIds().slice(this.visibleStart,this.visibleEnd).map((t=>{const e=s.Z.store.getById("posts",t);return e&&e.discussion()&&void 0!==e.canEdit()?e:null}))}count(){return this.discussion.postIds().length}disabled(){return this.visible>=this.count()}viewingEnd(){return Math.abs(this.count()-this.visibleEnd)<=1}sanitizeIndex(t){return Math.max(0,Math.min(this.count(),Math.floor(t)))}}(0,r.Z)(a,"loadCount",20),flarum.reg.add("core","forum/states/PostStreamState",a)},5749:(t,e,n)=>{"use strict";n.d(e,{Z:()=>s});var r=n(7905);class s{constructor(t){void 0===t&&(t=[]),(0,r.Z)(this,"cachedSearches",void 0),(0,r.Z)(this,"value",""),this.cachedSearches=new Set(t)}getInitialSearch(){return""}getValue(){return this.value}setValue(t){this.value=t}clear(){this.setValue("")}cache(t){this.cachedSearches.add(t)}isCached(t){return this.cachedSearches.has(t)}}flarum.reg.add("core","forum/states/SearchState",s)},8010:(t,e,n)=>{"use strict";n.d(e,{Z:()=>o});var r=n(7905),s=n(6083);class o{constructor(){(0,r.Z)(this,"stack",[])}getCurrent(){return this.stack[this.stack.length-1]}getPrevious(){return this.stack[this.stack.length-2]}push(t,e,n){void 0===n&&(n=m.route.get());const r=this.stack[this.stack.length-2];r&&r.name===t&&this.stack.pop();const s=this.getCurrent();s&&s.name===t?Object.assign(s,{url:n,title:e}):this.stack.push({name:t,url:n,title:e})}canGoBack(){return this.stack.length>1}back(){if(!this.canGoBack())return this.home();this.stack.pop(),m.route.set(this.getCurrent().url)}backUrl(){return this.stack[this.stack.length-2].url}home(){this.stack.splice(0),(0,s.Z)("/")}}flarum.reg.add("core","forum/utils/History",o)},7302:(t,e,n)=>{"use strict";n.d(e,{TJ:()=>P,Zk:()=>T});var r=n(6880),s=n.n(r),o=n(6353),i=n.n(o),a=n(2512),l=n.n(a),c=n(8328),u=n.n(c),d=n(9939),h=n.n(d),f=n(1627),p=n.n(f),g=n(1700),v=n(1008),b=n(871),y=n.n(b);function w(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],s=[],o=function(r,o,i,a,l,c){if(o)return{break:!0};var u=Z(t,i,a,l);if(!u)return s;var d=u.segmentIndex===a,h=t[u.segmentIndex],f=[];if(d)f.push(r.slice(l+1,u.segmentStart));else{f.push(r.slice(l+1));for(var p=a+1;p"===a[h]){var f=a.slice(c+1+l,h),p=s(a,l,f,i,h,c);if(p.exit)return;if(p.newSegmentIndex&&(i=p.newSegmentIndex),p.processedSegment&&(d=!0),p.break)break;l=!1,c=null,u=!1}else u&&(o=a[h],!/[a-zA-Z-_]/.test(o))&&(l=!1,c=null,u=!1);else c=h,u=!0,"/"===a[h+1]&&(l=!0,h++);d||r.push(a)}else r.push(a)}}function k(t){return Object.keys(t).reduce((function(e,n){return e[n]=C(t[n]),e}),{})}function N(t){return"string"!=typeof t?t:t.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/&/g,"&")}function C(t){return"string"==typeof t||t instanceof String?t.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'"):Array.isArray(t)?t.map(C):t}function S(t,e,n){return"<".concat(t,">").concat(N(n),"")}var T=function(t){u()(o,t);var e,n,r=(e=o,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,r=p()(e);if(n){var s=p()(this).constructor;t=Reflect.construct(r,arguments,s)}else t=r.apply(this,arguments);return h()(this,t)});function o(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return i()(this,o),(e=r.call(this,t,n)).richHandler=s||S,e}return l()(o,[{key:"rich",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=k(e),r=(0,v.xH)(this.process(t,n)),o=Math.random().toString(36)+Math.random().toString(36)+Math.random().toString(36),i=Object.fromEntries(Object.entries(e).map((function(t){var e=s()(t,2),n=e[0];return e[1],[n,o]}))),a=(0,v.xH)(this.process(t,i)),l=w(a,i,(function(){return o})),c=l.map((function(t,e){return t===o?null:e})).filter((function(t){return null!==t}));return w(r,n,this.richHandler,c)}}]),o}(g.vl);function E(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function A(t){for(var e=1;e{"use strict";function r(t){return t.reduce((function(t,e){return t.concat(Array.isArray(e)?r(e):e)}),[])}n.d(e,{xH:()=>r})},8693:(t,e,n)=>{"use strict";function r(t){var e={};return function(){for(var n=arguments.length,r=new Array(n),s=0;sr})},1700:(t,e,n)=>{"use strict";n.d(e,{kO:()=>S,kU:()=>N,vl:()=>b});var r=n(6880),s=n.n(r),o=n(6353),i=n.n(o),a=n(2512),l=n.n(a),c=n(871),u=n.n(c),d=n(1008),h=n(8693);function f(t){for(var e=function(t){return/\s/.test(t)},n=[],r={},s=0,o=null,i=!1,a=0;a3&&void 0!==arguments[3]?arguments[3]:[];if(!t)return r;if(1===n)return r.push(t),r;var s=t.indexOf(e);if(-1===s)return r.push(t),r;var o=t.substring(0,s).trim(),i=t.substring(s+e.length+1).trim();return r.push(o),g(i,e,n-1,r)}var v,b=function(){function t(e){var n=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};i()(this,t),u()(this,"format",(0,h.H)((function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(0,d.xH)(n.process(t,e)).join("")}))),this.locale=e,this.typeHandlers=r}return l()(t,[{key:"process",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!t)return[];var n=t.indexOf("{");if(-1!==n){var r=p(t,n);if(-1===r)throw new Error('Unbalanced curly braces in string: "'.concat(t,'"'));var o=t.substring(n,r+1);if(o){var i=[],a=t.substring(0,n);a&&i.push(a);var l=m(o),c=s()(l,3),u=c[0],d=c[1],h=c[2],f=e[u];null==f&&(f="");var g=d&&this.typeHandlers[d];i.push(g?g(f,h,this.locale,e,this.process.bind(this)):f);var v=t.substring(r+1);return v&&i.push(this.process(v,e)),i}}return[t]}}]),t}();function y(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function w(t){for(var e=1;e1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0,s=arguments.length>4?arguments[4]:void 0,o=f(e),i=o.args,a=o.cases,l=parseInt(t);i.forEach((function(t){t.startsWith("offset:")&&(l-=parseInt(t.slice("offset:".length)))}));var c=[];if("PluralRules"in Intl){void 0!==v&&v.resolvedOptions().locale===n||(v=new Intl.PluralRules(n));var u=v.select(l);u!==x&&c.push(u)}1===l&&c.push("one"),c.push("=".concat(l),x);for(var d=0;d1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>3?arguments[3]:void 0,r=arguments.length>4?arguments[4]:void 0,s=f(e),o=s.cases;return t in o?r(o[t],n):C in o?r(o.other,n):t}},8378:(t,e,n)=>{"use strict";n.d(e,{Qp:()=>p,tP:()=>m});var r=!1;if("undefined"!=typeof window){var s={get passive(){r=!0}};window.addEventListener("testPassive",null,s),window.removeEventListener("testPassive",null,s)}var o="undefined"!=typeof window&&window.navigator&&window.navigator.platform&&(/iP(ad|hone|od)/.test(window.navigator.platform)||"MacIntel"===window.navigator.platform&&window.navigator.maxTouchPoints>1),i=[],a=!1,l=-1,c=void 0,u=void 0,d=void 0,h=function(t){return i.some((function(e){return!(!e.options.allowTouchMove||!e.options.allowTouchMove(t))}))},f=function(t){var e=t||window.event;return!!h(e.target)||e.touches.length>1||(e.preventDefault&&e.preventDefault(),!1)},p=function(t,e){if(t){if(!i.some((function(e){return e.targetElement===t}))){var n={targetElement:t,options:e||{}};i=[].concat(function(t){if(Array.isArray(t)){for(var e=0,n=Array(t.length);e=r&&(document.body.style.top=-(e+t))}))}),300)}})):function(t){if(void 0===d){var e=!!t&&!0===t.reserveScrollBarGap,n=window.innerWidth-document.documentElement.clientWidth;if(e&&n>0){var r=parseInt(window.getComputedStyle(document.body).getPropertyValue("padding-right"),10);d=document.body.style.paddingRight,document.body.style.paddingRight=r+n+"px"}}void 0===c&&(c=document.body.style.overflow,document.body.style.overflow="hidden")}(e),o&&(t.ontouchstart=function(t){1===t.targetTouches.length&&(l=t.targetTouches[0].clientY)},t.ontouchmove=function(e){1===e.targetTouches.length&&function(t,e){var n=t.targetTouches[0].clientY-l;!h(t.target)&&(e&&0===e.scrollTop&&n>0||function(t){return!!t&&t.scrollHeight-t.scrollTop<=t.clientHeight}(e)&&n<0?f(t):t.stopPropagation())}(e,t)},a||(document.addEventListener("touchmove",f,r?{passive:!1}:void 0),a=!0))}}else console.error("disableBodyScroll unsuccessful - targetElement must be provided when calling disableBodyScroll on IOS devices.")},m=function(){o&&(i.forEach((function(t){t.targetElement.ontouchstart=null,t.targetElement.ontouchmove=null})),a&&(document.removeEventListener("touchmove",f,r?{passive:!1}:void 0),a=!1),l=-1),o?function(){if(void 0!==u){var t=-parseInt(document.body.style.top,10),e=-parseInt(document.body.style.left,10);document.body.style.position=u.position,document.body.style.top=u.top,document.body.style.left=u.left,window.scrollTo(e,t),u=void 0}}():(void 0!==d&&(document.body.style.paddingRight=d,d=void 0),void 0!==c&&(document.body.style.overflow=c,c=void 0)),i=[]}},9361:()=>{!function(t){"use strict";var e=function(n,r){this.options=t.extend({},e.DEFAULTS,r);var s=this.options.target===e.DEFAULTS.target?t(this.options.target):t(document).find(this.options.target);this.$target=s.on("scroll.bs.affix.data-api",t.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",t.proxy(this.checkPositionWithEventLoop,this)),this.$element=t(n),this.affixed=null,this.unpin=null,this.pinnedOffset=null,this.checkPosition()};function n(n){return this.each((function(){var r=t(this),s=r.data("bs.affix"),o="object"==typeof n&&n;s||r.data("bs.affix",s=new e(this,o)),"string"==typeof n&&s[n]()}))}e.VERSION="3.4.1",e.RESET="affix affix-top affix-bottom",e.DEFAULTS={offset:0,target:window},e.prototype.getState=function(t,e,n,r){var s=this.$target.scrollTop(),o=this.$element.offset(),i=this.$target.height();if(null!=n&&"top"==this.affixed)return s=t-r&&"bottom"},e.prototype.getPinnedOffset=function(){if(this.pinnedOffset)return this.pinnedOffset;this.$element.removeClass(e.RESET).addClass("affix");var t=this.$target.scrollTop(),n=this.$element.offset();return this.pinnedOffset=n.top-t},e.prototype.checkPositionWithEventLoop=function(){setTimeout(t.proxy(this.checkPosition,this),1)},e.prototype.checkPosition=function(){if(this.$element.is(":visible")){var n=this.$element.height(),r=this.options.offset,s=r.top,o=r.bottom,i=Math.max(t(document).height(),t(document.body).height());"object"!=typeof r&&(o=s=r),"function"==typeof s&&(s=r.top(this.$element)),"function"==typeof o&&(o=r.bottom(this.$element));var a=this.getState(i,n,s,o);if(this.affixed!=a){null!=this.unpin&&this.$element.css("top","");var l="affix"+(a?"-"+a:""),c=t.Event(l+".bs.affix");if(this.$element.trigger(c),c.isDefaultPrevented())return;this.affixed=a,this.unpin="bottom"==a?this.getPinnedOffset():null,this.$element.removeClass(e.RESET).addClass(l).trigger(l.replace("affix","affixed")+".bs.affix")}"bottom"==a&&this.$element.offset({top:i-n-o})}};var r=t.fn.affix;t.fn.affix=n,t.fn.affix.Constructor=e,t.fn.affix.noConflict=function(){return t.fn.affix=r,this},t(window).on("load",(function(){t('[data-spy="affix"]').each((function(){var e=t(this),r=e.data();r.offset=r.offset||{},null!=r.offsetBottom&&(r.offset.bottom=r.offsetBottom),null!=r.offsetTop&&(r.offset.top=r.offsetTop),n.call(e,r)}))}))}(jQuery)},6013:()=>{!function(t){"use strict";var e='[data-toggle="dropdown"]',n=function(e){t(e).on("click.bs.dropdown",this.toggle)};function r(e){var n=e.attr("data-target");n||(n=(n=e.attr("href"))&&/#[A-Za-z]/.test(n)&&n.replace(/.*(?=#[^\s]*$)/,""));var r="#"!==n?t(document).find(n):null;return r&&r.length?r:e.parent()}function s(n){n&&3===n.which||(t(".dropdown-backdrop").remove(),t(e).each((function(){var e=t(this),s=r(e),o={relatedTarget:this};s.hasClass("open")&&(n&&"click"==n.type&&/input|textarea/i.test(n.target.tagName)&&t.contains(s[0],n.target)||(s.trigger(n=t.Event("hide.bs.dropdown",o)),n.isDefaultPrevented()||(e.attr("aria-expanded","false"),s.removeClass("open").trigger(t.Event("hidden.bs.dropdown",o)))))})))}n.VERSION="3.4.1",n.prototype.toggle=function(e){var n=t(this);if(!n.is(".disabled, :disabled")){var o=r(n),i=o.hasClass("open");if(s(),!i){"ontouchstart"in document.documentElement&&!o.closest(".navbar-nav").length&&t(document.createElement("div")).addClass("dropdown-backdrop").insertAfter(t(this)).on("click",s);var a={relatedTarget:this};if(o.trigger(e=t.Event("show.bs.dropdown",a)),e.isDefaultPrevented())return;n.trigger("focus").attr("aria-expanded","true"),o.toggleClass("open").trigger(t.Event("shown.bs.dropdown",a))}return!1}},n.prototype.keydown=function(n){if(/(38|40|27|32)/.test(n.which)&&!/input|textarea/i.test(n.target.tagName)){var s=t(this);if(n.preventDefault(),n.stopPropagation(),!s.is(".disabled, :disabled")){var o=r(s),i=o.hasClass("open");if(!i&&27!=n.which||i&&27==n.which)return 27==n.which&&o.find(e).trigger("focus"),s.trigger("click");var a=o.find(".dropdown-menu li:not(.disabled):visible a");if(a.length){var l=a.index(n.target);38==n.which&&l>0&&l--,40==n.which&&l{!function(t){"use strict";var e=["sanitize","whiteList","sanitizeFn"],n=["background","cite","href","itemtype","longdesc","poster","src","xlink:href"],r=/^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi,s=/^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z0-9+/]+=*$/i;function o(e,o){var i=e.nodeName.toLowerCase();if(-1!==t.inArray(i,o))return-1===t.inArray(i,n)||Boolean(e.nodeValue.match(r)||e.nodeValue.match(s));for(var a=t(o).filter((function(t,e){return e instanceof RegExp})),l=0,c=a.length;l
',trigger:"hover focus",title:"",delay:0,html:!1,container:!1,viewport:{selector:"body",padding:0},sanitize:!0,sanitizeFn:null,whiteList:{"*":["class","dir","id","lang","role",/^aria-[\w-]*$/i],a:["target","href","title","rel"],area:[],b:[],br:[],col:[],code:[],div:[],em:[],hr:[],h1:[],h2:[],h3:[],h4:[],h5:[],h6:[],i:[],img:["src","alt","title","width","height"],li:[],ol:[],p:[],pre:[],s:[],small:[],span:[],sub:[],sup:[],strong:[],u:[],ul:[]}},a.prototype.init=function(e,n,r){if(this.enabled=!0,this.type=e,this.$element=t(n),this.options=this.getOptions(r),this.$viewport=this.options.viewport&&t(document).find(t.isFunction(this.options.viewport)?this.options.viewport.call(this,this.$element):this.options.viewport.selector||this.options.viewport),this.inState={click:!1,hover:!1,focus:!1},this.$element[0]instanceof document.constructor&&!this.options.selector)throw new Error("`selector` option must be specified when initializing "+this.type+" on the window.document object!");for(var s=this.options.trigger.split(" "),o=s.length;o--;){var i=s[o];if("click"==i)this.$element.on("click."+this.type,this.options.selector,t.proxy(this.toggle,this));else if("manual"!=i){var a="hover"==i?"mouseenter":"focusin",l="hover"==i?"mouseleave":"focusout";this.$element.on(a+"."+this.type,this.options.selector,t.proxy(this.enter,this)),this.$element.on(l+"."+this.type,this.options.selector,t.proxy(this.leave,this))}}this.options.selector?this._options=t.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},a.prototype.getDefaults=function(){return a.DEFAULTS},a.prototype.getOptions=function(n){var r=this.$element.data();for(var s in r)r.hasOwnProperty(s)&&-1!==t.inArray(s,e)&&delete r[s];return(n=t.extend({},this.getDefaults(),r,n)).delay&&"number"==typeof n.delay&&(n.delay={show:n.delay,hide:n.delay}),n.sanitize&&(n.template=i(n.template,n.whiteList,n.sanitizeFn)),n},a.prototype.getDelegateOptions=function(){var e={},n=this.getDefaults();return this._options&&t.each(this._options,(function(t,r){n[t]!=r&&(e[t]=r)})),e},a.prototype.enter=function(e){var n=e instanceof this.constructor?e:t(e.currentTarget).data("bs."+this.type);if(n||(n=new this.constructor(e.currentTarget,this.getDelegateOptions()),t(e.currentTarget).data("bs."+this.type,n)),e instanceof t.Event&&(n.inState["focusin"==e.type?"focus":"hover"]=!0),n.tip().hasClass("in")||"in"==n.hoverState)n.hoverState="in";else{if(clearTimeout(n.timeout),n.hoverState="in",!n.options.delay||!n.options.delay.show)return n.show();n.timeout=setTimeout((function(){"in"==n.hoverState&&n.show()}),n.options.delay.show)}},a.prototype.isInStateTrue=function(){for(var t in this.inState)if(this.inState[t])return!0;return!1},a.prototype.leave=function(e){var n=e instanceof this.constructor?e:t(e.currentTarget).data("bs."+this.type);if(n||(n=new this.constructor(e.currentTarget,this.getDelegateOptions()),t(e.currentTarget).data("bs."+this.type,n)),e instanceof t.Event&&(n.inState["focusout"==e.type?"focus":"hover"]=!1),!n.isInStateTrue()){if(clearTimeout(n.timeout),n.hoverState="out",!n.options.delay||!n.options.delay.hide)return n.hide();n.timeout=setTimeout((function(){"out"==n.hoverState&&n.hide()}),n.options.delay.hide)}},a.prototype.show=function(){var e=t.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){this.$element.trigger(e);var n=t.contains(this.$element[0].ownerDocument.documentElement,this.$element[0]);if(e.isDefaultPrevented()||!n)return;var r=this,s=this.tip(),o=this.getUID(this.type);this.setContent(),s.attr("id",o),this.$element.attr("aria-describedby",o),this.options.animation&&s.addClass("fade");var i="function"==typeof this.options.placement?this.options.placement.call(this,s[0],this.$element[0]):this.options.placement,l=/\s?auto?\s?/i,c=l.test(i);c&&(i=i.replace(l,"")||"top"),s.detach().css({top:0,left:0,display:"block"}).addClass(i).data("bs."+this.type,this),this.options.container?s.appendTo(t(document).find(this.options.container)):s.insertAfter(this.$element),this.$element.trigger("inserted.bs."+this.type);var u=this.getPosition(),d=s[0].offsetWidth,h=s[0].offsetHeight;if(c){var f=i,p=this.getPosition(this.$viewport);i="bottom"==i&&u.bottom+h>p.bottom?"top":"top"==i&&u.top-hp.width?"left":"left"==i&&u.left-di.top+i.height&&(s.top=i.top+i.height-l)}else{var c=e.left-o,u=e.left+o+n;ci.right&&(s.left=i.left+i.width-u)}return s},a.prototype.getTitle=function(){var t=this.$element,e=this.options;return t.attr("data-original-title")||("function"==typeof e.title?e.title.call(t[0]):e.title)},a.prototype.getUID=function(t){do{t+=~~(1e6*Math.random())}while(document.getElementById(t));return t},a.prototype.tip=function(){if(!this.$tip&&(this.$tip=t(this.options.template),1!=this.$tip.length))throw new Error(this.type+" `template` option must consist of exactly 1 top-level element!");return this.$tip},a.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},a.prototype.enable=function(){this.enabled=!0},a.prototype.disable=function(){this.enabled=!1},a.prototype.toggleEnabled=function(){this.enabled=!this.enabled},a.prototype.toggle=function(e){var n=this;e&&((n=t(e.currentTarget).data("bs."+this.type))||(n=new this.constructor(e.currentTarget,this.getDelegateOptions()),t(e.currentTarget).data("bs."+this.type,n))),e?(n.inState.click=!n.inState.click,n.isInStateTrue()?n.enter(n):n.leave(n)):n.tip().hasClass("in")?n.leave(n):n.enter(n)},a.prototype.destroy=function(){var t=this;clearTimeout(this.timeout),this.hide((function(){t.$element.off("."+t.type).removeData("bs."+t.type),t.$tip&&t.$tip.detach(),t.$tip=null,t.$arrow=null,t.$viewport=null,t.$element=null}))},a.prototype.sanitizeHtml=function(t){return i(t,this.options.whiteList,this.options.sanitizeFn)};var l=t.fn.tooltip;t.fn.tooltip=function(e){return this.each((function(){var n=t(this),r=n.data("bs.tooltip"),s="object"==typeof e&&e;!r&&/destroy|hide/.test(e)||(r||n.data("bs.tooltip",r=new a(this,s)),"string"==typeof e&&r[e]())}))},t.fn.tooltip.Constructor=a,t.fn.tooltip.noConflict=function(){return t.fn.tooltip=l,this}}(jQuery)},3929:()=>{!function(t){"use strict";t.fn.emulateTransitionEnd=function(e){var n=!1,r=this;return t(this).one("bsTransitionEnd",(function(){n=!0})),setTimeout((function(){n||t(r).trigger(t.support.transition.end)}),e),this},t((function(){t.support.transition=function(){var t=document.createElement("bootstrap"),e={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var n in e)if(void 0!==t.style[n])return{end:e[n]};return!1}(),t.support.transition&&(t.event.special.bsTransitionEnd={bindType:t.support.transition.end,delegateType:t.support.transition.end,handle:function(e){if(t(e.target).is(this))return e.handleObj.handler.apply(this,arguments)}})}))}(jQuery)},613:t=>{var e=function(t){this.canvas=document.createElement("canvas"),this.context=this.canvas.getContext("2d"),document.body.appendChild(this.canvas),this.width=this.canvas.width=t.width,this.height=this.canvas.height=t.height,this.context.drawImage(t,0,0,this.width,this.height)};e.prototype.clear=function(){this.context.clearRect(0,0,this.width,this.height)},e.prototype.update=function(t){this.context.putImageData(t,0,0)},e.prototype.getPixelCount=function(){return this.width*this.height},e.prototype.getImageData=function(){return this.context.getImageData(0,0,this.width,this.height)},e.prototype.removeCanvas=function(){this.canvas.parentNode.removeChild(this.canvas)};var n=function(){};if(n.prototype.getColor=function(t,e){return this.getPalette(t,5,e)[0]},n.prototype.getPalette=function(t,n,r){void 0===n&&(n=10),(void 0===r||1>r)&&(r=10);for(var o,i,a,l,c=new e(t),u=c.getImageData().data,d=c.getPixelCount(),h=[],f=0;d>f;f+=r)i=u[0+(o=4*f)],a=u[o+1],l=u[o+2],u[o+3]>=125&&(i>250&&a>250&&l>250||h.push([i,a,l]));var p=s.quantize(h,n),m=p?p.palette():null;return c.removeCanvas(),m},!r)var r={map:function(t,e){var n={};return e?t.map((function(t,r){return n.index=r,e.call(n,t)})):t.slice()},naturalOrder:function(t,e){return e>t?-1:t>e?1:0},sum:function(t,e){var n={};return t.reduce(e?function(t,r,s){return n.index=s,t+e.call(n,r)}:function(t,e){return t+e},0)},max:function(t,e){return Math.max.apply(null,e?r.map(t,e):t)}};var s=function(){function t(t,e,n){return(t<<2*l)+(e<>c,s=e[1]>>c,o=e[2]>>c,n=t(r,s,o),i[n]=(i[n]||0)+1})),i}function i(t,e){var r,s,o,i=1e6,a=0,l=1e6,u=0,d=1e6,h=0;return t.forEach((function(t){r=t[0]>>c,s=t[1]>>c,o=t[2]>>c,i>r?i=r:r>a&&(a=r),l>s?l=s:s>u&&(u=s),d>o?d=o:o>h&&(h=o)})),new n(i,a,l,u,d,h,e)}function a(e,n){if(n.count()){var s=n.r2-n.r1+1,o=n.g2-n.g1+1,i=n.b2-n.b1+1,a=r.max([s,o,i]);if(1==n.count())return[n.copy()];var l,c,u,d,h=0,f=[],p=[];if(a==s)for(l=n.r1;l<=n.r2;l++){for(d=0,c=n.g1;c<=n.g2;c++)for(u=n.b1;u<=n.b2;u++)d+=e[t(l,c,u)]||0;h+=d,f[l]=h}else if(a==o)for(l=n.g1;l<=n.g2;l++){for(d=0,c=n.r1;c<=n.r2;c++)for(u=n.b1;u<=n.b2;u++)d+=e[t(c,l,u)]||0;h+=d,f[l]=h}else for(l=n.b1;l<=n.b2;l++){for(d=0,c=n.r1;c<=n.r2;c++)for(u=n.g1;u<=n.g2;u++)d+=e[t(c,u,l)]||0;h+=d,f[l]=h}return f.forEach((function(t,e){p[e]=h-t})),function(t){var e,r,s,o,i,a=t+"1",c=t+"2",u=0;for(l=n[a];l<=n[c];l++)if(f[l]>h/2){for(s=n.copy(),o=n.copy(),e=l-n[a],i=(r=n[c]-l)>=e?Math.min(n[c]-1,~~(l+r/2)):Math.max(n[a],~~(l-1-e/2));!f[i];)i++;for(u=p[i];!u&&f[i-1];)u=p[--i];return s[c]=i,o[a]=s[c]+1,[s,o]}}(a==s?"r":a==o?"g":"b")}}var l=5,c=8-l;return n.prototype={volume:function(t){var e=this;return(!e._volume||t)&&(e._volume=(e.r2-e.r1+1)*(e.g2-e.g1+1)*(e.b2-e.b1+1)),e._volume},count:function(e){var n=this,r=n.histo;if(!n._count_set||e){var s,o,i,a=0;for(s=n.r1;s<=n.r2;s++)for(o=n.g1;o<=n.g2;o++)for(i=n.b1;i<=n.b2;i++)index=t(s,o,i),a+=r[index]||0;n._count=a,n._count_set=!0}return n._count},copy:function(){var t=this;return new n(t.r1,t.r2,t.g1,t.g2,t.b1,t.b2,t.histo)},avg:function(e){var n=this,r=n.histo;if(!n._avg||e){var s,o,i,a,c=0,u=1<<8-l,d=0,h=0,f=0;for(o=n.r1;o<=n.r2;o++)for(i=n.g1;i<=n.g2;i++)for(a=n.b1;a<=n.b2;a++)c+=s=r[t(o,i,a)]||0,d+=s*(o+.5)*u,h+=s*(i+.5)*u,f+=s*(a+.5)*u;n._avg=c?[~~(d/c),~~(h/c),~~(f/c)]:[~~(u*(n.r1+n.r2+1)/2),~~(u*(n.g1+n.g2+1)/2),~~(u*(n.b1+n.b2+1)/2)]}return n._avg},contains:function(t){var e=this,n=t[0]>>c;return gval=t[1]>>c,bval=t[2]>>c,n>=e.r1&&n<=e.r2&&gval>=e.g1&&gval<=e.g2&&bval>=e.b1&&bval<=e.b2}},s.prototype={push:function(t){this.vboxes.push({vbox:t,color:t.avg()})},palette:function(){return this.vboxes.map((function(t){return t.color}))},size:function(){return this.vboxes.size()},map:function(t){for(var e=this.vboxes,n=0;n(n=Math.sqrt(Math.pow(t[0]-s.peek(o).color[0],2)+Math.pow(t[1]-s.peek(o).color[1],2)+Math.pow(t[2]-s.peek(o).color[2],2)))||void 0===e)&&(e=n,r=s.peek(o).color);return r},forcebw:function(){var t=this.vboxes;t.sort((function(t,e){return r.naturalOrder(r.sum(t.color),r.sum(e.color))}));var e=t[0].color;e[0]<5&&e[1]<5&&e[2]<5&&(t[0].color=[0,0,0]);var n=t.length-1,s=t[n].color;s[0]>251&&s[1]>251&&s[2]>251&&(t[n].color=[255,255,255])}},{quantize:function(t,n){function l(t,e){for(var n,r=1,s=0;1e3>s;)if((n=t.pop()).count()){var o=a(c,n),i=o[0],l=o[1];if(!i)return;if(t.push(i),l&&(t.push(l),r++),r>=e)return;if(s++>1e3)return}else t.push(n),s++}if(!t.length||2>n||n>256)return!1;var c=o(t);c.forEach((function(){}));var u=i(t,c),d=new e((function(t,e){return r.naturalOrder(t.count(),e.count())}));d.push(u),l(d,.75*n);for(var h=new e((function(t,e){return r.naturalOrder(t.count()*t.volume(),e.count()*e.volume())}));d.size();)h.push(d.pop());l(h,n-h.size());for(var f=new s;h.size();)f.push(h.pop());return f}}}();t.exports=n},3860:function(t){t.exports=function(){"use strict";var t=6e4,e=36e5,n="millisecond",r="second",s="minute",o="hour",i="day",a="week",l="month",c="quarter",u="year",d="date",h="Invalid Date",f=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,p=/\[([^\]]+)]|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,m={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(t){var e=["th","st","nd","rd"],n=t%100;return"["+t+(e[(n-20)%10]||e[n]||e[0])+"]"}},g=function(t,e,n){var r=String(t);return!r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},v={s:g,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),s=n%60;return(e<=0?"+":"-")+g(r,2,"0")+":"+g(s,2,"0")},m:function t(e,n){if(e.date()1)return t(i[0])}else{var a=e.name;y[a]=e,s=a}return!r&&s&&(b=s),s||!r&&b},x=function(t,e){if(w(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new N(n)},k=v;k.l=Z,k.i=w,k.w=function(t,e){return x(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var N=function(){function m(t){this.$L=Z(t.locale,null,!0),this.parse(t)}var g=m.prototype;return g.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(k.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match(f);if(r){var s=r[2]-1||0,o=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],s,r[3]||1,r[4]||0,r[5]||0,r[6]||0,o)):new Date(r[1],s,r[3]||1,r[4]||0,r[5]||0,r[6]||0,o)}}return new Date(e)}(t),this.$x=t.x||{},this.init()},g.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds()},g.$utils=function(){return k},g.isValid=function(){return!(this.$d.toString()===h)},g.isSame=function(t,e){var n=x(t);return this.startOf(e)<=n&&n<=this.endOf(e)},g.isAfter=function(t,e){return x(t)0,g<=m.r||!m.r){g<=1&&p>0&&(m=h[p-1]);var v=d[m.l];a&&(g=a(""+g)),c="string"==typeof v?v.replace("%d",g):v(g,r,m.l,u);break}}if(r)return c;var b=u?d.future:d.past;return"function"==typeof b?b(c):b.replace("%s",c)},r.to=function(t,e){return o(t,e,this,!0)},r.from=function(t,e){return o(t,e,this)};var i=function(t){return t.$u?n.utc():n()};r.toNow=function(t){return this.to(i(this),t)},r.fromNow=function(t){return this.from(i(this),t)}}}()},7749:(t,e,n)=>{"use strict";t.exports=function(){if("object"==typeof globalThis)return globalThis;var t;try{t=this||new Function("return this")()}catch(t){if("object"==typeof window)return window;if("object"==typeof self)return self;if(void 0!==n.g)return n.g}return t}()},9685:(t,e,n)=>{"use strict";n.d(e,{v:()=>f});var r=n(1710);function s(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function o(t){for(var e=1;e0){var e=a[a.length-1];e!==t&&e.pause()}var n=a.indexOf(t);-1===n||a.splice(n,1),a.push(t)},deactivateTrap:function(t){var e=a.indexOf(t);-1!==e&&a.splice(e,1),a.length>0&&a[a.length-1].unpause()}}),c=function(t){return setTimeout(t,0)},u=function(t,e){var n=-1;return t.every((function(t,r){return!e(t)||(n=r,!1)})),n},d=function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r1?n-1:0),o=1;o=0)t=s.activeElement;else{var e=a.tabbableGroups[0];t=e&&e.firstTabbableNode||m("fallbackFocus")}if(!t)throw new Error("Your focus-trap needs to have at least one focusable element");return t},v=function(){if(a.containerGroups=a.containers.map((function(t){var e=(0,r.ht)(t,i.tabbableOptions),n=(0,r.KW)(t,i.tabbableOptions);return{container:t,tabbableNodes:e,focusableNodes:n,firstTabbableNode:e.length>0?e[0]:null,lastTabbableNode:e.length>0?e[e.length-1]:null,nextTabbableNode:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],s=n.findIndex((function(e){return e===t}));if(!(s<0))return e?n.slice(s+1).find((function(t){return(0,r.Wq)(t,i.tabbableOptions)})):n.slice(0,s).reverse().find((function(t){return(0,r.Wq)(t,i.tabbableOptions)}))}}})),a.tabbableGroups=a.containerGroups.filter((function(t){return t.tabbableNodes.length>0})),a.tabbableGroups.length<=0&&!m("fallbackFocus"))throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times")},b=function t(e){!1!==e&&e!==s.activeElement&&(e&&e.focus?(e.focus({preventScroll:!!i.preventScroll}),a.mostRecentlyFocusedNode=e,function(t){return t.tagName&&"input"===t.tagName.toLowerCase()&&"function"==typeof t.select}(e)&&e.select()):t(g()))},y=function(t){var e=m("setReturnFocus",t);return e||!1!==e&&t},w=function(t){var e=h(t);p(e)>=0||(d(i.clickOutsideDeactivates,t)?n.deactivate({returnFocus:i.returnFocusOnDeactivate&&!(0,r.EB)(e,i.tabbableOptions)}):d(i.allowOutsideClick,t)||t.preventDefault())},Z=function(t){var e=h(t),n=p(e)>=0;n||e instanceof Document?n&&(a.mostRecentlyFocusedNode=e):(t.stopImmediatePropagation(),b(a.mostRecentlyFocusedNode||g()))},x=function(t){if(function(t){return"Escape"===t.key||"Esc"===t.key||27===t.keyCode}(t)&&!1!==d(i.escapeDeactivates,t))return t.preventDefault(),void n.deactivate();(function(t){return"Tab"===t.key||9===t.keyCode})(t)&&function(t){var e=h(t);v();var n=null;if(a.tabbableGroups.length>0){var s=p(e),o=s>=0?a.containerGroups[s]:void 0;if(s<0)n=t.shiftKey?a.tabbableGroups[a.tabbableGroups.length-1].lastTabbableNode:a.tabbableGroups[0].firstTabbableNode;else if(t.shiftKey){var l=u(a.tabbableGroups,(function(t){var n=t.firstTabbableNode;return e===n}));if(l<0&&(o.container===e||(0,r.EB)(e,i.tabbableOptions)&&!(0,r.Wq)(e,i.tabbableOptions)&&!o.nextTabbableNode(e,!1))&&(l=s),l>=0){var c=0===l?a.tabbableGroups.length-1:l-1;n=a.tabbableGroups[c].lastTabbableNode}}else{var d=u(a.tabbableGroups,(function(t){var n=t.lastTabbableNode;return e===n}));if(d<0&&(o.container===e||(0,r.EB)(e,i.tabbableOptions)&&!(0,r.Wq)(e,i.tabbableOptions)&&!o.nextTabbableNode(e))&&(d=s),d>=0){var f=d===a.tabbableGroups.length-1?0:d+1;n=a.tabbableGroups[f].firstTabbableNode}}}else n=m("fallbackFocus");n&&(t.preventDefault(),b(n))}(t)},k=function(t){var e=h(t);p(e)>=0||d(i.clickOutsideDeactivates,t)||d(i.allowOutsideClick,t)||(t.preventDefault(),t.stopImmediatePropagation())},N=function(){if(a.active)return l.activateTrap(n),a.delayInitialFocusTimer=i.delayInitialFocus?c((function(){b(g())})):b(g()),s.addEventListener("focusin",Z,!0),s.addEventListener("mousedown",w,{capture:!0,passive:!1}),s.addEventListener("touchstart",w,{capture:!0,passive:!1}),s.addEventListener("click",k,{capture:!0,passive:!1}),s.addEventListener("keydown",x,{capture:!0,passive:!1}),n},C=function(){if(a.active)return s.removeEventListener("focusin",Z,!0),s.removeEventListener("mousedown",w,!0),s.removeEventListener("touchstart",w,!0),s.removeEventListener("click",k,!0),s.removeEventListener("keydown",x,!0),n};return(n={get active(){return a.active},get paused(){return a.paused},activate:function(t){if(a.active)return this;var e=f(t,"onActivate"),n=f(t,"onPostActivate"),r=f(t,"checkCanFocusTrap");r||v(),a.active=!0,a.paused=!1,a.nodeFocusedBeforeActivation=s.activeElement,e&&e();var o=function(){r&&v(),N(),n&&n()};return r?(r(a.containers.concat()).then(o,o),this):(o(),this)},deactivate:function(t){if(!a.active)return this;var e=o({onDeactivate:i.onDeactivate,onPostDeactivate:i.onPostDeactivate,checkCanReturnFocus:i.checkCanReturnFocus},t);clearTimeout(a.delayInitialFocusTimer),a.delayInitialFocusTimer=void 0,C(),a.active=!1,a.paused=!1,l.deactivateTrap(n);var r=f(e,"onDeactivate"),s=f(e,"onPostDeactivate"),u=f(e,"checkCanReturnFocus"),d=f(e,"returnFocus","returnFocusOnDeactivate");r&&r();var h=function(){c((function(){d&&b(y(a.nodeFocusedBeforeActivation)),s&&s()}))};return d&&u?(u(y(a.nodeFocusedBeforeActivation)).then(h,h),this):(h(),this)},pause:function(){return a.paused||!a.active||(a.paused=!0,C()),this},unpause:function(){return a.paused&&a.active?(a.paused=!1,v(),N(),this):this},updateContainerElements:function(t){var e=[].concat(t).filter(Boolean);return a.containers=e.map((function(t){return"string"==typeof t?s.querySelector(t):t})),a.active&&v(),this}}).updateContainerElements(t),n}},2045:function(){!function(t){function e(e){if("string"==typeof e.data&&(e.data={keys:e.data}),e.data&&e.data.keys&&"string"==typeof e.data.keys){var n=e.handler,r=e.data.keys.toLowerCase().split(" ");e.handler=function(e){if(this===e.target||!(t.hotkeys.options.filterInputAcceptingElements&&t.hotkeys.textInputTypes.test(e.target.nodeName)||t.hotkeys.options.filterContentEditable&&t(e.target).attr("contenteditable")||t.hotkeys.options.filterTextInputs&&t.inArray(e.target.type,t.hotkeys.textAcceptingInputTypes)>-1)){var s="keypress"!==e.type&&t.hotkeys.specialKeys[e.which],o=String.fromCharCode(e.which).toLowerCase(),i="",a={};t.each(["alt","ctrl","shift"],(function(t,n){e[n+"Key"]&&s!==n&&(i+=n+"+")})),e.metaKey&&!e.ctrlKey&&"meta"!==s&&(i+="meta+"),e.metaKey&&"meta"!==s&&i.indexOf("alt+ctrl+shift+")>-1&&(i=i.replace("alt+ctrl+shift+","hyper+")),s?a[i+s]=!0:(a[i+o]=!0,a[i+t.hotkeys.shiftNums[o]]=!0,"shift+"===i&&(a[t.hotkeys.shiftNums[o]]=!0));for(var l=0,c=r.length;l","/":"?","\\":"|"},textAcceptingInputTypes:["text","password","number","email","url","range","date","month","week","time","datetime","datetime-local","search","color","tel"],textInputTypes:/textarea|input|select/i,options:{filterInputAcceptingElements:!0,filterTextInputs:!0,filterContentEditable:!0}},t.each(["keydown","keyup","keypress"],(function(){t.event.special[this]={add:e}}))}(jQuery||this.jQuery||window.jQuery)},2890:function(t,e){var n;!function(e,n){"use strict";"object"==typeof t.exports?t.exports=e.document?n(e,!0):function(t){if(!t.document)throw new Error("jQuery requires a window with a document");return n(t)}:n(e)}("undefined"!=typeof window?window:this,(function(r,s){"use strict";var o=[],i=Object.getPrototypeOf,a=o.slice,l=o.flat?function(t){return o.flat.call(t)}:function(t){return o.concat.apply([],t)},c=o.push,u=o.indexOf,d={},h=d.toString,f=d.hasOwnProperty,p=f.toString,m=p.call(Object),g={},v=function(t){return"function"==typeof t&&"number"!=typeof t.nodeType&&"function"!=typeof t.item},b=function(t){return null!=t&&t===t.window},y=r.document,w={type:!0,src:!0,nonce:!0,noModule:!0};function Z(t,e,n){var r,s,o=(n=n||y).createElement("script");if(o.text=t,e)for(r in w)(s=e[r]||e.getAttribute&&e.getAttribute(r))&&o.setAttribute(r,s);n.head.appendChild(o).parentNode.removeChild(o)}function x(t){return null==t?t+"":"object"==typeof t||"function"==typeof t?d[h.call(t)]||"object":typeof t}var k="3.6.1",N=function(t,e){return new N.fn.init(t,e)};function C(t){var e=!!t&&"length"in t&&t.length,n=x(t);return!v(t)&&!b(t)&&("array"===n||0===e||"number"==typeof e&&e>0&&e-1 in t)}N.fn=N.prototype={jquery:k,constructor:N,length:0,toArray:function(){return a.call(this)},get:function(t){return null==t?a.call(this):t<0?this[t+this.length]:this[t]},pushStack:function(t){var e=N.merge(this.constructor(),t);return e.prevObject=this,e},each:function(t){return N.each(this,t)},map:function(t){return this.pushStack(N.map(this,(function(e,n){return t.call(e,n,e)})))},slice:function(){return this.pushStack(a.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},even:function(){return this.pushStack(N.grep(this,(function(t,e){return(e+1)%2})))},odd:function(){return this.pushStack(N.grep(this,(function(t,e){return e%2})))},eq:function(t){var e=this.length,n=+t+(t<0?e:0);return this.pushStack(n>=0&&n+~]|[\\x20\\t\\r\\n\\f])[\\x20\\t\\r\\n\\f]*"),z=new RegExp(j+"|>"),W=new RegExp(H),V=new RegExp("^"+R+"$"),G={ID:new RegExp("^#("+R+")"),CLASS:new RegExp("^\\.("+R+")"),TAG:new RegExp("^("+R+"|[*])"),ATTR:new RegExp("^"+$),PSEUDO:new RegExp("^"+H),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\([\\x20\\t\\r\\n\\f]*(even|odd|(([+-]|)(\\d*)n|)[\\x20\\t\\r\\n\\f]*(?:([+-]|)[\\x20\\t\\r\\n\\f]*(\\d+)|))[\\x20\\t\\r\\n\\f]*\\)|)","i"),bool:new RegExp("^(?:"+M+")$","i"),needsContext:new RegExp("^[\\x20\\t\\r\\n\\f]*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\([\\x20\\t\\r\\n\\f]*((?:-\\d)?\\d*)[\\x20\\t\\r\\n\\f]*\\)|)(?=[^-]|$)","i")},Y=/HTML$/i,K=/^(?:input|select|textarea|button)$/i,X=/^h\d$/i,J=/^[^{]+\{\s*\[native \w/,Q=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,tt=/[+~]/,et=new RegExp("\\\\[\\da-fA-F]{1,6}[\\x20\\t\\r\\n\\f]?|\\\\([^\\r\\n\\f])","g"),nt=function(t,e){var n="0x"+t.slice(1)-65536;return e||(n<0?String.fromCharCode(n+65536):String.fromCharCode(n>>10|55296,1023&n|56320))},rt=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,st=function(t,e){return e?"\0"===t?"�":t.slice(0,-1)+"\\"+t.charCodeAt(t.length-1).toString(16)+" ":"\\"+t},ot=function(){h()},it=wt((function(t){return!0===t.disabled&&"fieldset"===t.nodeName.toLowerCase()}),{dir:"parentNode",next:"legend"});try{I.apply(P=O.call(Z.childNodes),Z.childNodes),P[Z.childNodes.length].nodeType}catch(t){I={apply:P.length?function(t,e){_.apply(t,O.call(e))}:function(t,e){for(var n=t.length,r=0;t[n++]=e[r++];);t.length=n-1}}}function at(t,e,r,s){var o,a,c,u,d,p,v,b=e&&e.ownerDocument,Z=e?e.nodeType:9;if(r=r||[],"string"!=typeof t||!t||1!==Z&&9!==Z&&11!==Z)return r;if(!s&&(h(e),e=e||f,m)){if(11!==Z&&(d=Q.exec(t)))if(o=d[1]){if(9===Z){if(!(c=e.getElementById(o)))return r;if(c.id===o)return r.push(c),r}else if(b&&(c=b.getElementById(o))&&y(e,c)&&c.id===o)return r.push(c),r}else{if(d[2])return I.apply(r,e.getElementsByTagName(t)),r;if((o=d[3])&&n.getElementsByClassName&&e.getElementsByClassName)return I.apply(r,e.getElementsByClassName(o)),r}if(n.qsa&&!T[t+" "]&&(!g||!g.test(t))&&(1!==Z||"object"!==e.nodeName.toLowerCase())){if(v=t,b=e,1===Z&&(z.test(t)||F.test(t))){for((b=tt.test(t)&&vt(e.parentNode)||e)===e&&n.scope||((u=e.getAttribute("id"))?u=u.replace(rt,st):e.setAttribute("id",u=w)),a=(p=i(t)).length;a--;)p[a]=(u?"#"+u:":scope")+" "+yt(p[a]);v=p.join(",")}try{return I.apply(r,b.querySelectorAll(v)),r}catch(e){T(t,!0)}finally{u===w&&e.removeAttribute("id")}}}return l(t.replace(q,"$1"),e,r,s)}function lt(){var t=[];return function e(n,s){return t.push(n+" ")>r.cacheLength&&delete e[t.shift()],e[n+" "]=s}}function ct(t){return t[w]=!0,t}function ut(t){var e=f.createElement("fieldset");try{return!!t(e)}catch(t){return!1}finally{e.parentNode&&e.parentNode.removeChild(e),e=null}}function dt(t,e){for(var n=t.split("|"),s=n.length;s--;)r.attrHandle[n[s]]=e}function ht(t,e){var n=e&&t,r=n&&1===t.nodeType&&1===e.nodeType&&t.sourceIndex-e.sourceIndex;if(r)return r;if(n)for(;n=n.nextSibling;)if(n===e)return-1;return t?1:-1}function ft(t){return function(e){return"input"===e.nodeName.toLowerCase()&&e.type===t}}function pt(t){return function(e){var n=e.nodeName.toLowerCase();return("input"===n||"button"===n)&&e.type===t}}function mt(t){return function(e){return"form"in e?e.parentNode&&!1===e.disabled?"label"in e?"label"in e.parentNode?e.parentNode.disabled===t:e.disabled===t:e.isDisabled===t||e.isDisabled!==!t&&it(e)===t:e.disabled===t:"label"in e&&e.disabled===t}}function gt(t){return ct((function(e){return e=+e,ct((function(n,r){for(var s,o=t([],n.length,e),i=o.length;i--;)n[s=o[i]]&&(n[s]=!(r[s]=n[s]))}))}))}function vt(t){return t&&void 0!==t.getElementsByTagName&&t}for(e in n=at.support={},o=at.isXML=function(t){var e=t&&t.namespaceURI,n=t&&(t.ownerDocument||t).documentElement;return!Y.test(e||n&&n.nodeName||"HTML")},h=at.setDocument=function(t){var e,s,i=t?t.ownerDocument||t:Z;return i!=f&&9===i.nodeType&&i.documentElement?(p=(f=i).documentElement,m=!o(f),Z!=f&&(s=f.defaultView)&&s.top!==s&&(s.addEventListener?s.addEventListener("unload",ot,!1):s.attachEvent&&s.attachEvent("onunload",ot)),n.scope=ut((function(t){return p.appendChild(t).appendChild(f.createElement("div")),void 0!==t.querySelectorAll&&!t.querySelectorAll(":scope fieldset div").length})),n.attributes=ut((function(t){return t.className="i",!t.getAttribute("className")})),n.getElementsByTagName=ut((function(t){return t.appendChild(f.createComment("")),!t.getElementsByTagName("*").length})),n.getElementsByClassName=J.test(f.getElementsByClassName),n.getById=ut((function(t){return p.appendChild(t).id=w,!f.getElementsByName||!f.getElementsByName(w).length})),n.getById?(r.filter.ID=function(t){var e=t.replace(et,nt);return function(t){return t.getAttribute("id")===e}},r.find.ID=function(t,e){if(void 0!==e.getElementById&&m){var n=e.getElementById(t);return n?[n]:[]}}):(r.filter.ID=function(t){var e=t.replace(et,nt);return function(t){var n=void 0!==t.getAttributeNode&&t.getAttributeNode("id");return n&&n.value===e}},r.find.ID=function(t,e){if(void 0!==e.getElementById&&m){var n,r,s,o=e.getElementById(t);if(o){if((n=o.getAttributeNode("id"))&&n.value===t)return[o];for(s=e.getElementsByName(t),r=0;o=s[r++];)if((n=o.getAttributeNode("id"))&&n.value===t)return[o]}return[]}}),r.find.TAG=n.getElementsByTagName?function(t,e){return void 0!==e.getElementsByTagName?e.getElementsByTagName(t):n.qsa?e.querySelectorAll(t):void 0}:function(t,e){var n,r=[],s=0,o=e.getElementsByTagName(t);if("*"===t){for(;n=o[s++];)1===n.nodeType&&r.push(n);return r}return o},r.find.CLASS=n.getElementsByClassName&&function(t,e){if(void 0!==e.getElementsByClassName&&m)return e.getElementsByClassName(t)},v=[],g=[],(n.qsa=J.test(f.querySelectorAll))&&(ut((function(t){var e;p.appendChild(t).innerHTML="",t.querySelectorAll("[msallowcapture^='']").length&&g.push("[*^$]=[\\x20\\t\\r\\n\\f]*(?:''|\"\")"),t.querySelectorAll("[selected]").length||g.push("\\[[\\x20\\t\\r\\n\\f]*(?:value|"+M+")"),t.querySelectorAll("[id~="+w+"-]").length||g.push("~="),(e=f.createElement("input")).setAttribute("name",""),t.appendChild(e),t.querySelectorAll("[name='']").length||g.push("\\[[\\x20\\t\\r\\n\\f]*name[\\x20\\t\\r\\n\\f]*=[\\x20\\t\\r\\n\\f]*(?:''|\"\")"),t.querySelectorAll(":checked").length||g.push(":checked"),t.querySelectorAll("a#"+w+"+*").length||g.push(".#.+[+~]"),t.querySelectorAll("\\\f"),g.push("[\\r\\n\\f]")})),ut((function(t){t.innerHTML="";var e=f.createElement("input");e.setAttribute("type","hidden"),t.appendChild(e).setAttribute("name","D"),t.querySelectorAll("[name=d]").length&&g.push("name[\\x20\\t\\r\\n\\f]*[*^$|!~]?="),2!==t.querySelectorAll(":enabled").length&&g.push(":enabled",":disabled"),p.appendChild(t).disabled=!0,2!==t.querySelectorAll(":disabled").length&&g.push(":enabled",":disabled"),t.querySelectorAll("*,:x"),g.push(",.*:")}))),(n.matchesSelector=J.test(b=p.matches||p.webkitMatchesSelector||p.mozMatchesSelector||p.oMatchesSelector||p.msMatchesSelector))&&ut((function(t){n.disconnectedMatch=b.call(t,"*"),b.call(t,"[s!='']:x"),v.push("!=",H)})),g=g.length&&new RegExp(g.join("|")),v=v.length&&new RegExp(v.join("|")),e=J.test(p.compareDocumentPosition),y=e||J.test(p.contains)?function(t,e){var n=9===t.nodeType?t.documentElement:t,r=e&&e.parentNode;return t===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):t.compareDocumentPosition&&16&t.compareDocumentPosition(r)))}:function(t,e){if(e)for(;e=e.parentNode;)if(e===t)return!0;return!1},E=e?function(t,e){if(t===e)return d=!0,0;var r=!t.compareDocumentPosition-!e.compareDocumentPosition;return r||(1&(r=(t.ownerDocument||t)==(e.ownerDocument||e)?t.compareDocumentPosition(e):1)||!n.sortDetached&&e.compareDocumentPosition(t)===r?t==f||t.ownerDocument==Z&&y(Z,t)?-1:e==f||e.ownerDocument==Z&&y(Z,e)?1:u?L(u,t)-L(u,e):0:4&r?-1:1)}:function(t,e){if(t===e)return d=!0,0;var n,r=0,s=t.parentNode,o=e.parentNode,i=[t],a=[e];if(!s||!o)return t==f?-1:e==f?1:s?-1:o?1:u?L(u,t)-L(u,e):0;if(s===o)return ht(t,e);for(n=t;n=n.parentNode;)i.unshift(n);for(n=e;n=n.parentNode;)a.unshift(n);for(;i[r]===a[r];)r++;return r?ht(i[r],a[r]):i[r]==Z?-1:a[r]==Z?1:0},f):f},at.matches=function(t,e){return at(t,null,null,e)},at.matchesSelector=function(t,e){if(h(t),n.matchesSelector&&m&&!T[e+" "]&&(!v||!v.test(e))&&(!g||!g.test(e)))try{var r=b.call(t,e);if(r||n.disconnectedMatch||t.document&&11!==t.document.nodeType)return r}catch(t){T(e,!0)}return at(e,f,null,[t]).length>0},at.contains=function(t,e){return(t.ownerDocument||t)!=f&&h(t),y(t,e)},at.attr=function(t,e){(t.ownerDocument||t)!=f&&h(t);var s=r.attrHandle[e.toLowerCase()],o=s&&A.call(r.attrHandle,e.toLowerCase())?s(t,e,!m):void 0;return void 0!==o?o:n.attributes||!m?t.getAttribute(e):(o=t.getAttributeNode(e))&&o.specified?o.value:null},at.escape=function(t){return(t+"").replace(rt,st)},at.error=function(t){throw new Error("Syntax error, unrecognized expression: "+t)},at.uniqueSort=function(t){var e,r=[],s=0,o=0;if(d=!n.detectDuplicates,u=!n.sortStable&&t.slice(0),t.sort(E),d){for(;e=t[o++];)e===t[o]&&(s=r.push(o));for(;s--;)t.splice(r[s],1)}return u=null,t},s=at.getText=function(t){var e,n="",r=0,o=t.nodeType;if(o){if(1===o||9===o||11===o){if("string"==typeof t.textContent)return t.textContent;for(t=t.firstChild;t;t=t.nextSibling)n+=s(t)}else if(3===o||4===o)return t.nodeValue}else for(;e=t[r++];)n+=s(e);return n},r=at.selectors={cacheLength:50,createPseudo:ct,match:G,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(t){return t[1]=t[1].replace(et,nt),t[3]=(t[3]||t[4]||t[5]||"").replace(et,nt),"~="===t[2]&&(t[3]=" "+t[3]+" "),t.slice(0,4)},CHILD:function(t){return t[1]=t[1].toLowerCase(),"nth"===t[1].slice(0,3)?(t[3]||at.error(t[0]),t[4]=+(t[4]?t[5]+(t[6]||1):2*("even"===t[3]||"odd"===t[3])),t[5]=+(t[7]+t[8]||"odd"===t[3])):t[3]&&at.error(t[0]),t},PSEUDO:function(t){var e,n=!t[6]&&t[2];return G.CHILD.test(t[0])?null:(t[3]?t[2]=t[4]||t[5]||"":n&&W.test(n)&&(e=i(n,!0))&&(e=n.indexOf(")",n.length-e)-n.length)&&(t[0]=t[0].slice(0,e),t[2]=n.slice(0,e)),t.slice(0,3))}},filter:{TAG:function(t){var e=t.replace(et,nt).toLowerCase();return"*"===t?function(){return!0}:function(t){return t.nodeName&&t.nodeName.toLowerCase()===e}},CLASS:function(t){var e=N[t+" "];return e||(e=new RegExp("(^|[\\x20\\t\\r\\n\\f])"+t+"("+j+"|$)"))&&N(t,(function(t){return e.test("string"==typeof t.className&&t.className||void 0!==t.getAttribute&&t.getAttribute("class")||"")}))},ATTR:function(t,e,n){return function(r){var s=at.attr(r,t);return null==s?"!="===e:!e||(s+="","="===e?s===n:"!="===e?s!==n:"^="===e?n&&0===s.indexOf(n):"*="===e?n&&s.indexOf(n)>-1:"$="===e?n&&s.slice(-n.length)===n:"~="===e?(" "+s.replace(B," ")+" ").indexOf(n)>-1:"|="===e&&(s===n||s.slice(0,n.length+1)===n+"-"))}},CHILD:function(t,e,n,r,s){var o="nth"!==t.slice(0,3),i="last"!==t.slice(-4),a="of-type"===e;return 1===r&&0===s?function(t){return!!t.parentNode}:function(e,n,l){var c,u,d,h,f,p,m=o!==i?"nextSibling":"previousSibling",g=e.parentNode,v=a&&e.nodeName.toLowerCase(),b=!l&&!a,y=!1;if(g){if(o){for(;m;){for(h=e;h=h[m];)if(a?h.nodeName.toLowerCase()===v:1===h.nodeType)return!1;p=m="only"===t&&!p&&"nextSibling"}return!0}if(p=[i?g.firstChild:g.lastChild],i&&b){for(y=(f=(c=(u=(d=(h=g)[w]||(h[w]={}))[h.uniqueID]||(d[h.uniqueID]={}))[t]||[])[0]===x&&c[1])&&c[2],h=f&&g.childNodes[f];h=++f&&h&&h[m]||(y=f=0)||p.pop();)if(1===h.nodeType&&++y&&h===e){u[t]=[x,f,y];break}}else if(b&&(y=f=(c=(u=(d=(h=e)[w]||(h[w]={}))[h.uniqueID]||(d[h.uniqueID]={}))[t]||[])[0]===x&&c[1]),!1===y)for(;(h=++f&&h&&h[m]||(y=f=0)||p.pop())&&((a?h.nodeName.toLowerCase()!==v:1!==h.nodeType)||!++y||(b&&((u=(d=h[w]||(h[w]={}))[h.uniqueID]||(d[h.uniqueID]={}))[t]=[x,y]),h!==e)););return(y-=s)===r||y%r==0&&y/r>=0}}},PSEUDO:function(t,e){var n,s=r.pseudos[t]||r.setFilters[t.toLowerCase()]||at.error("unsupported pseudo: "+t);return s[w]?s(e):s.length>1?(n=[t,t,"",e],r.setFilters.hasOwnProperty(t.toLowerCase())?ct((function(t,n){for(var r,o=s(t,e),i=o.length;i--;)t[r=L(t,o[i])]=!(n[r]=o[i])})):function(t){return s(t,0,n)}):s}},pseudos:{not:ct((function(t){var e=[],n=[],r=a(t.replace(q,"$1"));return r[w]?ct((function(t,e,n,s){for(var o,i=r(t,null,s,[]),a=t.length;a--;)(o=i[a])&&(t[a]=!(e[a]=o))})):function(t,s,o){return e[0]=t,r(e,null,o,n),e[0]=null,!n.pop()}})),has:ct((function(t){return function(e){return at(t,e).length>0}})),contains:ct((function(t){return t=t.replace(et,nt),function(e){return(e.textContent||s(e)).indexOf(t)>-1}})),lang:ct((function(t){return V.test(t||"")||at.error("unsupported lang: "+t),t=t.replace(et,nt).toLowerCase(),function(e){var n;do{if(n=m?e.lang:e.getAttribute("xml:lang")||e.getAttribute("lang"))return(n=n.toLowerCase())===t||0===n.indexOf(t+"-")}while((e=e.parentNode)&&1===e.nodeType);return!1}})),target:function(e){var n=t.location&&t.location.hash;return n&&n.slice(1)===e.id},root:function(t){return t===p},focus:function(t){return t===f.activeElement&&(!f.hasFocus||f.hasFocus())&&!!(t.type||t.href||~t.tabIndex)},enabled:mt(!1),disabled:mt(!0),checked:function(t){var e=t.nodeName.toLowerCase();return"input"===e&&!!t.checked||"option"===e&&!!t.selected},selected:function(t){return t.parentNode&&t.parentNode.selectedIndex,!0===t.selected},empty:function(t){for(t=t.firstChild;t;t=t.nextSibling)if(t.nodeType<6)return!1;return!0},parent:function(t){return!r.pseudos.empty(t)},header:function(t){return X.test(t.nodeName)},input:function(t){return K.test(t.nodeName)},button:function(t){var e=t.nodeName.toLowerCase();return"input"===e&&"button"===t.type||"button"===e},text:function(t){var e;return"input"===t.nodeName.toLowerCase()&&"text"===t.type&&(null==(e=t.getAttribute("type"))||"text"===e.toLowerCase())},first:gt((function(){return[0]})),last:gt((function(t,e){return[e-1]})),eq:gt((function(t,e,n){return[n<0?n+e:n]})),even:gt((function(t,e){for(var n=0;ne?e:n;--r>=0;)t.push(r);return t})),gt:gt((function(t,e,n){for(var r=n<0?n+e:n;++r1?function(e,n,r){for(var s=t.length;s--;)if(!t[s](e,n,r))return!1;return!0}:t[0]}function xt(t,e,n,r,s){for(var o,i=[],a=0,l=t.length,c=null!=e;a-1&&(o[c]=!(i[c]=d))}}else v=xt(v===i?v.splice(p,v.length):v),s?s(null,i,v,l):I.apply(i,v)}))}function Nt(t){for(var e,n,s,o=t.length,i=r.relative[t[0].type],a=i||r.relative[" "],l=i?1:0,u=wt((function(t){return t===e}),a,!0),d=wt((function(t){return L(e,t)>-1}),a,!0),h=[function(t,n,r){var s=!i&&(r||n!==c)||((e=n).nodeType?u(t,n,r):d(t,n,r));return e=null,s}];l1&&Zt(h),l>1&&yt(t.slice(0,l-1).concat({value:" "===t[l-2].type?"*":""})).replace(q,"$1"),n,l0,s=t.length>0,o=function(o,i,a,l,u){var d,p,g,v=0,b="0",y=o&&[],w=[],Z=c,k=o||s&&r.find.TAG("*",u),N=x+=null==Z?1:Math.random()||.1,C=k.length;for(u&&(c=i==f||i||u);b!==C&&null!=(d=k[b]);b++){if(s&&d){for(p=0,i||d.ownerDocument==f||(h(d),a=!m);g=t[p++];)if(g(d,i||f,a)){l.push(d);break}u&&(x=N)}n&&((d=!g&&d)&&v--,o&&y.push(d))}if(v+=b,n&&b!==v){for(p=0;g=e[p++];)g(y,w,i,a);if(o){if(v>0)for(;b--;)y[b]||w[b]||(w[b]=D.call(l));w=xt(w)}I.apply(l,w),u&&!o&&w.length>0&&v+e.length>1&&at.uniqueSort(l)}return u&&(x=N,c=Z),y};return n?ct(o):o}(o,s)),a.selector=t}return a},l=at.select=function(t,e,n,s){var o,l,c,u,d,h="function"==typeof t&&t,f=!s&&i(t=h.selector||t);if(n=n||[],1===f.length){if((l=f[0]=f[0].slice(0)).length>2&&"ID"===(c=l[0]).type&&9===e.nodeType&&m&&r.relative[l[1].type]){if(!(e=(r.find.ID(c.matches[0].replace(et,nt),e)||[])[0]))return n;h&&(e=e.parentNode),t=t.slice(l.shift().value.length)}for(o=G.needsContext.test(t)?0:l.length;o--&&(c=l[o],!r.relative[u=c.type]);)if((d=r.find[u])&&(s=d(c.matches[0].replace(et,nt),tt.test(l[0].type)&&vt(e.parentNode)||e))){if(l.splice(o,1),!(t=s.length&&yt(l)))return I.apply(n,s),n;break}}return(h||a(t,f))(s,e,!m,n,!e||tt.test(t)&&vt(e.parentNode)||e),n},n.sortStable=w.split("").sort(E).join("")===w,n.detectDuplicates=!!d,h(),n.sortDetached=ut((function(t){return 1&t.compareDocumentPosition(f.createElement("fieldset"))})),ut((function(t){return t.innerHTML="","#"===t.firstChild.getAttribute("href")}))||dt("type|href|height|width",(function(t,e,n){if(!n)return t.getAttribute(e,"type"===e.toLowerCase()?1:2)})),n.attributes&&ut((function(t){return t.innerHTML="",t.firstChild.setAttribute("value",""),""===t.firstChild.getAttribute("value")}))||dt("value",(function(t,e,n){if(!n&&"input"===t.nodeName.toLowerCase())return t.defaultValue})),ut((function(t){return null==t.getAttribute("disabled")}))||dt(M,(function(t,e,n){var r;if(!n)return!0===t[e]?e.toLowerCase():(r=t.getAttributeNode(e))&&r.specified?r.value:null})),at}(r);N.find=S,N.expr=S.selectors,N.expr[":"]=N.expr.pseudos,N.uniqueSort=N.unique=S.uniqueSort,N.text=S.getText,N.isXMLDoc=S.isXML,N.contains=S.contains,N.escapeSelector=S.escape;var T=function(t,e,n){for(var r=[],s=void 0!==n;(t=t[e])&&9!==t.nodeType;)if(1===t.nodeType){if(s&&N(t).is(n))break;r.push(t)}return r},E=function(t,e){for(var n=[];t;t=t.nextSibling)1===t.nodeType&&t!==e&&n.push(t);return n},A=N.expr.match.needsContext;function P(t,e){return t.nodeName&&t.nodeName.toLowerCase()===e.toLowerCase()}var D=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function _(t,e,n){return v(e)?N.grep(t,(function(t,r){return!!e.call(t,r,t)!==n})):e.nodeType?N.grep(t,(function(t){return t===e!==n})):"string"!=typeof e?N.grep(t,(function(t){return u.call(e,t)>-1!==n})):N.filter(e,t,n)}N.filter=function(t,e,n){var r=e[0];return n&&(t=":not("+t+")"),1===e.length&&1===r.nodeType?N.find.matchesSelector(r,t)?[r]:[]:N.find.matches(t,N.grep(e,(function(t){return 1===t.nodeType})))},N.fn.extend({find:function(t){var e,n,r=this.length,s=this;if("string"!=typeof t)return this.pushStack(N(t).filter((function(){for(e=0;e1?N.uniqueSort(n):n},filter:function(t){return this.pushStack(_(this,t||[],!1))},not:function(t){return this.pushStack(_(this,t||[],!0))},is:function(t){return!!_(this,"string"==typeof t&&A.test(t)?N(t):t||[],!1).length}});var I,O=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/;(N.fn.init=function(t,e,n){var r,s;if(!t)return this;if(n=n||I,"string"==typeof t){if(!(r="<"===t[0]&&">"===t[t.length-1]&&t.length>=3?[null,t,null]:O.exec(t))||!r[1]&&e)return!e||e.jquery?(e||n).find(t):this.constructor(e).find(t);if(r[1]){if(e=e instanceof N?e[0]:e,N.merge(this,N.parseHTML(r[1],e&&e.nodeType?e.ownerDocument||e:y,!0)),D.test(r[1])&&N.isPlainObject(e))for(r in e)v(this[r])?this[r](e[r]):this.attr(r,e[r]);return this}return(s=y.getElementById(r[2]))&&(this[0]=s,this.length=1),this}return t.nodeType?(this[0]=t,this.length=1,this):v(t)?void 0!==n.ready?n.ready(t):t(N):N.makeArray(t,this)}).prototype=N.fn,I=N(y);var L=/^(?:parents|prev(?:Until|All))/,M={children:!0,contents:!0,next:!0,prev:!0};function j(t,e){for(;(t=t[e])&&1!==t.nodeType;);return t}N.fn.extend({has:function(t){var e=N(t,this),n=e.length;return this.filter((function(){for(var t=0;t-1:1===n.nodeType&&N.find.matchesSelector(n,t))){o.push(n);break}return this.pushStack(o.length>1?N.uniqueSort(o):o)},index:function(t){return t?"string"==typeof t?u.call(N(t),this[0]):u.call(this,t.jquery?t[0]:t):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(t,e){return this.pushStack(N.uniqueSort(N.merge(this.get(),N(t,e))))},addBack:function(t){return this.add(null==t?this.prevObject:this.prevObject.filter(t))}}),N.each({parent:function(t){var e=t.parentNode;return e&&11!==e.nodeType?e:null},parents:function(t){return T(t,"parentNode")},parentsUntil:function(t,e,n){return T(t,"parentNode",n)},next:function(t){return j(t,"nextSibling")},prev:function(t){return j(t,"previousSibling")},nextAll:function(t){return T(t,"nextSibling")},prevAll:function(t){return T(t,"previousSibling")},nextUntil:function(t,e,n){return T(t,"nextSibling",n)},prevUntil:function(t,e,n){return T(t,"previousSibling",n)},siblings:function(t){return E((t.parentNode||{}).firstChild,t)},children:function(t){return E(t.firstChild)},contents:function(t){return null!=t.contentDocument&&i(t.contentDocument)?t.contentDocument:(P(t,"template")&&(t=t.content||t),N.merge([],t.childNodes))}},(function(t,e){N.fn[t]=function(n,r){var s=N.map(this,e,n);return"Until"!==t.slice(-5)&&(r=n),r&&"string"==typeof r&&(s=N.filter(r,s)),this.length>1&&(M[t]||N.uniqueSort(s),L.test(t)&&s.reverse()),this.pushStack(s)}}));var R=/[^\x20\t\r\n\f]+/g;function $(t){return t}function H(t){throw t}function B(t,e,n,r){var s;try{t&&v(s=t.promise)?s.call(t).done(e).fail(n):t&&v(s=t.then)?s.call(t,e,n):e.apply(void 0,[t].slice(r))}catch(t){n.apply(void 0,[t])}}N.Callbacks=function(t){t="string"==typeof t?function(t){var e={};return N.each(t.match(R)||[],(function(t,n){e[n]=!0})),e}(t):N.extend({},t);var e,n,r,s,o=[],i=[],a=-1,l=function(){for(s=s||t.once,r=e=!0;i.length;a=-1)for(n=i.shift();++a-1;)o.splice(n,1),n<=a&&a--})),this},has:function(t){return t?N.inArray(t,o)>-1:o.length>0},empty:function(){return o&&(o=[]),this},disable:function(){return s=i=[],o=n="",this},disabled:function(){return!o},lock:function(){return s=i=[],n||e||(o=n=""),this},locked:function(){return!!s},fireWith:function(t,n){return s||(n=[t,(n=n||[]).slice?n.slice():n],i.push(n),e||l()),this},fire:function(){return c.fireWith(this,arguments),this},fired:function(){return!!r}};return c},N.extend({Deferred:function(t){var e=[["notify","progress",N.Callbacks("memory"),N.Callbacks("memory"),2],["resolve","done",N.Callbacks("once memory"),N.Callbacks("once memory"),0,"resolved"],["reject","fail",N.Callbacks("once memory"),N.Callbacks("once memory"),1,"rejected"]],n="pending",s={state:function(){return n},always:function(){return o.done(arguments).fail(arguments),this},catch:function(t){return s.then(null,t)},pipe:function(){var t=arguments;return N.Deferred((function(n){N.each(e,(function(e,r){var s=v(t[r[4]])&&t[r[4]];o[r[1]]((function(){var t=s&&s.apply(this,arguments);t&&v(t.promise)?t.promise().progress(n.notify).done(n.resolve).fail(n.reject):n[r[0]+"With"](this,s?[t]:arguments)}))})),t=null})).promise()},then:function(t,n,s){var o=0;function i(t,e,n,s){return function(){var a=this,l=arguments,c=function(){var r,c;if(!(t=o&&(n!==H&&(a=void 0,l=[r]),e.rejectWith(a,l))}};t?u():(N.Deferred.getStackHook&&(u.stackTrace=N.Deferred.getStackHook()),r.setTimeout(u))}}return N.Deferred((function(r){e[0][3].add(i(0,r,v(s)?s:$,r.notifyWith)),e[1][3].add(i(0,r,v(t)?t:$)),e[2][3].add(i(0,r,v(n)?n:H))})).promise()},promise:function(t){return null!=t?N.extend(t,s):s}},o={};return N.each(e,(function(t,r){var i=r[2],a=r[5];s[r[1]]=i.add,a&&i.add((function(){n=a}),e[3-t][2].disable,e[3-t][3].disable,e[0][2].lock,e[0][3].lock),i.add(r[3].fire),o[r[0]]=function(){return o[r[0]+"With"](this===o?void 0:this,arguments),this},o[r[0]+"With"]=i.fireWith})),s.promise(o),t&&t.call(o,o),o},when:function(t){var e=arguments.length,n=e,r=Array(n),s=a.call(arguments),o=N.Deferred(),i=function(t){return function(n){r[t]=this,s[t]=arguments.length>1?a.call(arguments):n,--e||o.resolveWith(r,s)}};if(e<=1&&(B(t,o.done(i(n)).resolve,o.reject,!e),"pending"===o.state()||v(s[n]&&s[n].then)))return o.then();for(;n--;)B(s[n],i(n),o.reject);return o.promise()}});var q=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;N.Deferred.exceptionHook=function(t,e){r.console&&r.console.warn&&t&&q.test(t.name)&&r.console.warn("jQuery.Deferred exception: "+t.message,t.stack,e)},N.readyException=function(t){r.setTimeout((function(){throw t}))};var U=N.Deferred();function F(){y.removeEventListener("DOMContentLoaded",F),r.removeEventListener("load",F),N.ready()}N.fn.ready=function(t){return U.then(t).catch((function(t){N.readyException(t)})),this},N.extend({isReady:!1,readyWait:1,ready:function(t){(!0===t?--N.readyWait:N.isReady)||(N.isReady=!0,!0!==t&&--N.readyWait>0||U.resolveWith(y,[N]))}}),N.ready.then=U.then,"complete"===y.readyState||"loading"!==y.readyState&&!y.documentElement.doScroll?r.setTimeout(N.ready):(y.addEventListener("DOMContentLoaded",F),r.addEventListener("load",F));var z=function(t,e,n,r,s,o,i){var a=0,l=t.length,c=null==n;if("object"===x(n))for(a in s=!0,n)z(t,e,a,n[a],!0,o,i);else if(void 0!==r&&(s=!0,v(r)||(i=!0),c&&(i?(e.call(t,r),e=null):(c=e,e=function(t,e,n){return c.call(N(t),n)})),e))for(;a1,null,!0)},removeData:function(t){return this.each((function(){Q.remove(this,t)}))}}),N.extend({queue:function(t,e,n){var r;if(t)return e=(e||"fx")+"queue",r=J.get(t,e),n&&(!r||Array.isArray(n)?r=J.access(t,e,N.makeArray(n)):r.push(n)),r||[]},dequeue:function(t,e){e=e||"fx";var n=N.queue(t,e),r=n.length,s=n.shift(),o=N._queueHooks(t,e);"inprogress"===s&&(s=n.shift(),r--),s&&("fx"===e&&n.unshift("inprogress"),delete o.stop,s.call(t,(function(){N.dequeue(t,e)}),o)),!r&&o&&o.empty.fire()},_queueHooks:function(t,e){var n=e+"queueHooks";return J.get(t,n)||J.access(t,n,{empty:N.Callbacks("once memory").add((function(){J.remove(t,[e+"queue",n])}))})}}),N.fn.extend({queue:function(t,e){var n=2;return"string"!=typeof t&&(e=t,t="fx",n--),arguments.length\x20\t\r\n\f]*)/i,bt=/^$|^module$|\/(?:java|ecma)script/i;pt=y.createDocumentFragment().appendChild(y.createElement("div")),(mt=y.createElement("input")).setAttribute("type","radio"),mt.setAttribute("checked","checked"),mt.setAttribute("name","t"),pt.appendChild(mt),g.checkClone=pt.cloneNode(!0).cloneNode(!0).lastChild.checked,pt.innerHTML="",g.noCloneChecked=!!pt.cloneNode(!0).lastChild.defaultValue,pt.innerHTML="",g.option=!!pt.lastChild;var yt={thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};function wt(t,e){var n;return n=void 0!==t.getElementsByTagName?t.getElementsByTagName(e||"*"):void 0!==t.querySelectorAll?t.querySelectorAll(e||"*"):[],void 0===e||e&&P(t,e)?N.merge([t],n):n}function Zt(t,e){for(var n=0,r=t.length;n",""]);var xt=/<|&#?\w+;/;function kt(t,e,n,r,s){for(var o,i,a,l,c,u,d=e.createDocumentFragment(),h=[],f=0,p=t.length;f-1)s&&s.push(o);else if(c=at(o),i=wt(d.appendChild(o),"script"),c&&Zt(i),n)for(u=0;o=i[u++];)bt.test(o.type||"")&&n.push(o);return d}var Nt=/^([^.]*)(?:\.(.+)|)/;function Ct(){return!0}function St(){return!1}function Tt(t,e){return t===function(){try{return y.activeElement}catch(t){}}()==("focus"===e)}function Et(t,e,n,r,s,o){var i,a;if("object"==typeof e){for(a in"string"!=typeof n&&(r=r||n,n=void 0),e)Et(t,a,n,r,e[a],o);return t}if(null==r&&null==s?(s=n,r=n=void 0):null==s&&("string"==typeof n?(s=r,r=void 0):(s=r,r=n,n=void 0)),!1===s)s=St;else if(!s)return t;return 1===o&&(i=s,s=function(t){return N().off(t),i.apply(this,arguments)},s.guid=i.guid||(i.guid=N.guid++)),t.each((function(){N.event.add(this,e,s,r,n)}))}function At(t,e,n){n?(J.set(t,e,!1),N.event.add(t,e,{namespace:!1,handler:function(t){var r,s,o=J.get(this,e);if(1&t.isTrigger&&this[e]){if(o.length)(N.event.special[e]||{}).delegateType&&t.stopPropagation();else if(o=a.call(arguments),J.set(this,e,o),r=n(this,e),this[e](),o!==(s=J.get(this,e))||r?J.set(this,e,!1):s={},o!==s)return t.stopImmediatePropagation(),t.preventDefault(),s&&s.value}else o.length&&(J.set(this,e,{value:N.event.trigger(N.extend(o[0],N.Event.prototype),o.slice(1),this)}),t.stopImmediatePropagation())}})):void 0===J.get(t,e)&&N.event.add(t,e,Ct)}N.event={global:{},add:function(t,e,n,r,s){var o,i,a,l,c,u,d,h,f,p,m,g=J.get(t);if(K(t))for(n.handler&&(n=(o=n).handler,s=o.selector),s&&N.find.matchesSelector(it,s),n.guid||(n.guid=N.guid++),(l=g.events)||(l=g.events=Object.create(null)),(i=g.handle)||(i=g.handle=function(e){return void 0!==N&&N.event.triggered!==e.type?N.event.dispatch.apply(t,arguments):void 0}),c=(e=(e||"").match(R)||[""]).length;c--;)f=m=(a=Nt.exec(e[c])||[])[1],p=(a[2]||"").split(".").sort(),f&&(d=N.event.special[f]||{},f=(s?d.delegateType:d.bindType)||f,d=N.event.special[f]||{},u=N.extend({type:f,origType:m,data:r,handler:n,guid:n.guid,selector:s,needsContext:s&&N.expr.match.needsContext.test(s),namespace:p.join(".")},o),(h=l[f])||((h=l[f]=[]).delegateCount=0,d.setup&&!1!==d.setup.call(t,r,p,i)||t.addEventListener&&t.addEventListener(f,i)),d.add&&(d.add.call(t,u),u.handler.guid||(u.handler.guid=n.guid)),s?h.splice(h.delegateCount++,0,u):h.push(u),N.event.global[f]=!0)},remove:function(t,e,n,r,s){var o,i,a,l,c,u,d,h,f,p,m,g=J.hasData(t)&&J.get(t);if(g&&(l=g.events)){for(c=(e=(e||"").match(R)||[""]).length;c--;)if(f=m=(a=Nt.exec(e[c])||[])[1],p=(a[2]||"").split(".").sort(),f){for(d=N.event.special[f]||{},h=l[f=(r?d.delegateType:d.bindType)||f]||[],a=a[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),i=o=h.length;o--;)u=h[o],!s&&m!==u.origType||n&&n.guid!==u.guid||a&&!a.test(u.namespace)||r&&r!==u.selector&&("**"!==r||!u.selector)||(h.splice(o,1),u.selector&&h.delegateCount--,d.remove&&d.remove.call(t,u));i&&!h.length&&(d.teardown&&!1!==d.teardown.call(t,p,g.handle)||N.removeEvent(t,f,g.handle),delete l[f])}else for(f in l)N.event.remove(t,f+e[c],n,r,!0);N.isEmptyObject(l)&&J.remove(t,"handle events")}},dispatch:function(t){var e,n,r,s,o,i,a=new Array(arguments.length),l=N.event.fix(t),c=(J.get(this,"events")||Object.create(null))[l.type]||[],u=N.event.special[l.type]||{};for(a[0]=l,e=1;e=1))for(;c!==this;c=c.parentNode||this)if(1===c.nodeType&&("click"!==t.type||!0!==c.disabled)){for(o=[],i={},n=0;n-1:N.find(s,this,null,[c]).length),i[s]&&o.push(r);o.length&&a.push({elem:c,handlers:o})}return c=this,l\s*$/g;function It(t,e){return P(t,"table")&&P(11!==e.nodeType?e:e.firstChild,"tr")&&N(t).children("tbody")[0]||t}function Ot(t){return t.type=(null!==t.getAttribute("type"))+"/"+t.type,t}function Lt(t){return"true/"===(t.type||"").slice(0,5)?t.type=t.type.slice(5):t.removeAttribute("type"),t}function Mt(t,e){var n,r,s,o,i,a;if(1===e.nodeType){if(J.hasData(t)&&(a=J.get(t).events))for(s in J.remove(e,"handle events"),a)for(n=0,r=a[s].length;n1&&"string"==typeof p&&!g.checkClone&&Dt.test(p))return t.each((function(s){var o=t.eq(s);m&&(e[0]=p.call(this,s,o.html())),Rt(o,e,n,r)}));if(h&&(o=(s=kt(e,t[0].ownerDocument,!1,t,r)).firstChild,1===s.childNodes.length&&(s=o),o||r)){for(a=(i=N.map(wt(s,"script"),Ot)).length;d0&&Zt(i,!l&&wt(t,"script")),a},cleanData:function(t){for(var e,n,r,s=N.event.special,o=0;void 0!==(n=t[o]);o++)if(K(n)){if(e=n[J.expando]){if(e.events)for(r in e.events)s[r]?N.event.remove(n,r):N.removeEvent(n,r,e.handle);n[J.expando]=void 0}n[Q.expando]&&(n[Q.expando]=void 0)}}}),N.fn.extend({detach:function(t){return $t(this,t,!0)},remove:function(t){return $t(this,t)},text:function(t){return z(this,(function(t){return void 0===t?N.text(this):this.empty().each((function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=t)}))}),null,t,arguments.length)},append:function(){return Rt(this,arguments,(function(t){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||It(this,t).appendChild(t)}))},prepend:function(){return Rt(this,arguments,(function(t){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var e=It(this,t);e.insertBefore(t,e.firstChild)}}))},before:function(){return Rt(this,arguments,(function(t){this.parentNode&&this.parentNode.insertBefore(t,this)}))},after:function(){return Rt(this,arguments,(function(t){this.parentNode&&this.parentNode.insertBefore(t,this.nextSibling)}))},empty:function(){for(var t,e=0;null!=(t=this[e]);e++)1===t.nodeType&&(N.cleanData(wt(t,!1)),t.textContent="");return this},clone:function(t,e){return t=null!=t&&t,e=null==e?t:e,this.map((function(){return N.clone(this,t,e)}))},html:function(t){return z(this,(function(t){var e=this[0]||{},n=0,r=this.length;if(void 0===t&&1===e.nodeType)return e.innerHTML;if("string"==typeof t&&!Pt.test(t)&&!yt[(vt.exec(t)||["",""])[1].toLowerCase()]){t=N.htmlPrefilter(t);try{for(;n=0&&(l+=Math.max(0,Math.ceil(t["offset"+e[0].toUpperCase()+e.slice(1)]-o-l-a-.5))||0),l}function re(t,e,n){var r=qt(t),s=(!g.boxSizingReliable()||n)&&"border-box"===N.css(t,"boxSizing",!1,r),o=s,i=Wt(t,e,r),a="offset"+e[0].toUpperCase()+e.slice(1);if(Ht.test(i)){if(!n)return i;i="auto"}return(!g.boxSizingReliable()&&s||!g.reliableTrDimensions()&&P(t,"tr")||"auto"===i||!parseFloat(i)&&"inline"===N.css(t,"display",!1,r))&&t.getClientRects().length&&(s="border-box"===N.css(t,"boxSizing",!1,r),(o=a in t)&&(i=t[a])),(i=parseFloat(i)||0)+ne(t,e,n||(s?"border":"content"),o,r,i)+"px"}function se(t,e,n,r,s){return new se.prototype.init(t,e,n,r,s)}N.extend({cssHooks:{opacity:{get:function(t,e){if(e){var n=Wt(t,"opacity");return""===n?"1":n}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,gridArea:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnStart:!0,gridRow:!0,gridRowEnd:!0,gridRowStart:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{},style:function(t,e,n,r){if(t&&3!==t.nodeType&&8!==t.nodeType&&t.style){var s,o,i,a=Y(e),l=Bt.test(e),c=t.style;if(l||(e=Xt(a)),i=N.cssHooks[e]||N.cssHooks[a],void 0===n)return i&&"get"in i&&void 0!==(s=i.get(t,!1,r))?s:c[e];"string"==(o=typeof n)&&(s=st.exec(n))&&s[1]&&(n=ut(t,e,s),o="number"),null!=n&&n==n&&("number"!==o||l||(n+=s&&s[3]||(N.cssNumber[a]?"":"px")),g.clearCloneStyle||""!==n||0!==e.indexOf("background")||(c[e]="inherit"),i&&"set"in i&&void 0===(n=i.set(t,n,r))||(l?c.setProperty(e,n):c[e]=n))}},css:function(t,e,n,r){var s,o,i,a=Y(e);return Bt.test(e)||(e=Xt(a)),(i=N.cssHooks[e]||N.cssHooks[a])&&"get"in i&&(s=i.get(t,!0,n)),void 0===s&&(s=Wt(t,e,r)),"normal"===s&&e in te&&(s=te[e]),""===n||n?(o=parseFloat(s),!0===n||isFinite(o)?o||0:s):s}}),N.each(["height","width"],(function(t,e){N.cssHooks[e]={get:function(t,n,r){if(n)return!Jt.test(N.css(t,"display"))||t.getClientRects().length&&t.getBoundingClientRect().width?re(t,e,r):Ut(t,Qt,(function(){return re(t,e,r)}))},set:function(t,n,r){var s,o=qt(t),i=!g.scrollboxSize()&&"absolute"===o.position,a=(i||r)&&"border-box"===N.css(t,"boxSizing",!1,o),l=r?ne(t,e,r,a,o):0;return a&&i&&(l-=Math.ceil(t["offset"+e[0].toUpperCase()+e.slice(1)]-parseFloat(o[e])-ne(t,e,"border",!1,o)-.5)),l&&(s=st.exec(n))&&"px"!==(s[3]||"px")&&(t.style[e]=n,n=N.css(t,e)),ee(0,n,l)}}})),N.cssHooks.marginLeft=Vt(g.reliableMarginLeft,(function(t,e){if(e)return(parseFloat(Wt(t,"marginLeft"))||t.getBoundingClientRect().left-Ut(t,{marginLeft:0},(function(){return t.getBoundingClientRect().left})))+"px"})),N.each({margin:"",padding:"",border:"Width"},(function(t,e){N.cssHooks[t+e]={expand:function(n){for(var r=0,s={},o="string"==typeof n?n.split(" "):[n];r<4;r++)s[t+ot[r]+e]=o[r]||o[r-2]||o[0];return s}},"margin"!==t&&(N.cssHooks[t+e].set=ee)})),N.fn.extend({css:function(t,e){return z(this,(function(t,e,n){var r,s,o={},i=0;if(Array.isArray(e)){for(r=qt(t),s=e.length;i1)}}),N.Tween=se,se.prototype={constructor:se,init:function(t,e,n,r,s,o){this.elem=t,this.prop=n,this.easing=s||N.easing._default,this.options=e,this.start=this.now=this.cur(),this.end=r,this.unit=o||(N.cssNumber[n]?"":"px")},cur:function(){var t=se.propHooks[this.prop];return t&&t.get?t.get(this):se.propHooks._default.get(this)},run:function(t){var e,n=se.propHooks[this.prop];return this.options.duration?this.pos=e=N.easing[this.easing](t,this.options.duration*t,0,1,this.options.duration):this.pos=e=t,this.now=(this.end-this.start)*e+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):se.propHooks._default.set(this),this}},se.prototype.init.prototype=se.prototype,se.propHooks={_default:{get:function(t){var e;return 1!==t.elem.nodeType||null!=t.elem[t.prop]&&null==t.elem.style[t.prop]?t.elem[t.prop]:(e=N.css(t.elem,t.prop,""))&&"auto"!==e?e:0},set:function(t){N.fx.step[t.prop]?N.fx.step[t.prop](t):1!==t.elem.nodeType||!N.cssHooks[t.prop]&&null==t.elem.style[Xt(t.prop)]?t.elem[t.prop]=t.now:N.style(t.elem,t.prop,t.now+t.unit)}}},se.propHooks.scrollTop=se.propHooks.scrollLeft={set:function(t){t.elem.nodeType&&t.elem.parentNode&&(t.elem[t.prop]=t.now)}},N.easing={linear:function(t){return t},swing:function(t){return.5-Math.cos(t*Math.PI)/2},_default:"swing"},N.fx=se.prototype.init,N.fx.step={};var oe,ie,ae=/^(?:toggle|show|hide)$/,le=/queueHooks$/;function ce(){ie&&(!1===y.hidden&&r.requestAnimationFrame?r.requestAnimationFrame(ce):r.setTimeout(ce,N.fx.interval),N.fx.tick())}function ue(){return r.setTimeout((function(){oe=void 0})),oe=Date.now()}function de(t,e){var n,r=0,s={height:t};for(e=e?1:0;r<4;r+=2-e)s["margin"+(n=ot[r])]=s["padding"+n]=t;return e&&(s.opacity=s.width=t),s}function he(t,e,n){for(var r,s=(fe.tweeners[e]||[]).concat(fe.tweeners["*"]),o=0,i=s.length;o1)},removeAttr:function(t){return this.each((function(){N.removeAttr(this,t)}))}}),N.extend({attr:function(t,e,n){var r,s,o=t.nodeType;if(3!==o&&8!==o&&2!==o)return void 0===t.getAttribute?N.prop(t,e,n):(1===o&&N.isXMLDoc(t)||(s=N.attrHooks[e.toLowerCase()]||(N.expr.match.bool.test(e)?pe:void 0)),void 0!==n?null===n?void N.removeAttr(t,e):s&&"set"in s&&void 0!==(r=s.set(t,n,e))?r:(t.setAttribute(e,n+""),n):s&&"get"in s&&null!==(r=s.get(t,e))?r:null==(r=N.find.attr(t,e))?void 0:r)},attrHooks:{type:{set:function(t,e){if(!g.radioValue&&"radio"===e&&P(t,"input")){var n=t.value;return t.setAttribute("type",e),n&&(t.value=n),e}}}},removeAttr:function(t,e){var n,r=0,s=e&&e.match(R);if(s&&1===t.nodeType)for(;n=s[r++];)t.removeAttribute(n)}}),pe={set:function(t,e,n){return!1===e?N.removeAttr(t,n):t.setAttribute(n,n),n}},N.each(N.expr.match.bool.source.match(/\w+/g),(function(t,e){var n=me[e]||N.find.attr;me[e]=function(t,e,r){var s,o,i=e.toLowerCase();return r||(o=me[i],me[i]=s,s=null!=n(t,e,r)?i:null,me[i]=o),s}}));var ge=/^(?:input|select|textarea|button)$/i,ve=/^(?:a|area)$/i;function be(t){return(t.match(R)||[]).join(" ")}function ye(t){return t.getAttribute&&t.getAttribute("class")||""}function we(t){return Array.isArray(t)?t:"string"==typeof t&&t.match(R)||[]}N.fn.extend({prop:function(t,e){return z(this,N.prop,t,e,arguments.length>1)},removeProp:function(t){return this.each((function(){delete this[N.propFix[t]||t]}))}}),N.extend({prop:function(t,e,n){var r,s,o=t.nodeType;if(3!==o&&8!==o&&2!==o)return 1===o&&N.isXMLDoc(t)||(e=N.propFix[e]||e,s=N.propHooks[e]),void 0!==n?s&&"set"in s&&void 0!==(r=s.set(t,n,e))?r:t[e]=n:s&&"get"in s&&null!==(r=s.get(t,e))?r:t[e]},propHooks:{tabIndex:{get:function(t){var e=N.find.attr(t,"tabindex");return e?parseInt(e,10):ge.test(t.nodeName)||ve.test(t.nodeName)&&t.href?0:-1}}},propFix:{for:"htmlFor",class:"className"}}),g.optSelected||(N.propHooks.selected={get:function(t){var e=t.parentNode;return e&&e.parentNode&&e.parentNode.selectedIndex,null},set:function(t){var e=t.parentNode;e&&(e.selectedIndex,e.parentNode&&e.parentNode.selectedIndex)}}),N.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],(function(){N.propFix[this.toLowerCase()]=this})),N.fn.extend({addClass:function(t){var e,n,r,s,o,i;return v(t)?this.each((function(e){N(this).addClass(t.call(this,e,ye(this)))})):(e=we(t)).length?this.each((function(){if(r=ye(this),n=1===this.nodeType&&" "+be(r)+" "){for(o=0;o-1;)n=n.replace(" "+s+" "," ");i=be(n),r!==i&&this.setAttribute("class",i)}})):this:this.attr("class","")},toggleClass:function(t,e){var n,r,s,o,i=typeof t,a="string"===i||Array.isArray(t);return v(t)?this.each((function(n){N(this).toggleClass(t.call(this,n,ye(this),e),e)})):"boolean"==typeof e&&a?e?this.addClass(t):this.removeClass(t):(n=we(t),this.each((function(){if(a)for(o=N(this),s=0;s-1)return!0;return!1}});var Ze=/\r/g;N.fn.extend({val:function(t){var e,n,r,s=this[0];return arguments.length?(r=v(t),this.each((function(n){var s;1===this.nodeType&&(null==(s=r?t.call(this,n,N(this).val()):t)?s="":"number"==typeof s?s+="":Array.isArray(s)&&(s=N.map(s,(function(t){return null==t?"":t+""}))),(e=N.valHooks[this.type]||N.valHooks[this.nodeName.toLowerCase()])&&"set"in e&&void 0!==e.set(this,s,"value")||(this.value=s))}))):s?(e=N.valHooks[s.type]||N.valHooks[s.nodeName.toLowerCase()])&&"get"in e&&void 0!==(n=e.get(s,"value"))?n:"string"==typeof(n=s.value)?n.replace(Ze,""):null==n?"":n:void 0}}),N.extend({valHooks:{option:{get:function(t){var e=N.find.attr(t,"value");return null!=e?e:be(N.text(t))}},select:{get:function(t){var e,n,r,s=t.options,o=t.selectedIndex,i="select-one"===t.type,a=i?null:[],l=i?o+1:s.length;for(r=o<0?l:i?o:0;r-1)&&(n=!0);return n||(t.selectedIndex=-1),o}}}}),N.each(["radio","checkbox"],(function(){N.valHooks[this]={set:function(t,e){if(Array.isArray(e))return t.checked=N.inArray(N(t).val(),e)>-1}},g.checkOn||(N.valHooks[this].get=function(t){return null===t.getAttribute("value")?"on":t.value})})),g.focusin="onfocusin"in r;var xe=/^(?:focusinfocus|focusoutblur)$/,ke=function(t){t.stopPropagation()};N.extend(N.event,{trigger:function(t,e,n,s){var o,i,a,l,c,u,d,h,p=[n||y],m=f.call(t,"type")?t.type:t,g=f.call(t,"namespace")?t.namespace.split("."):[];if(i=h=a=n=n||y,3!==n.nodeType&&8!==n.nodeType&&!xe.test(m+N.event.triggered)&&(m.indexOf(".")>-1&&(g=m.split("."),m=g.shift(),g.sort()),c=m.indexOf(":")<0&&"on"+m,(t=t[N.expando]?t:new N.Event(m,"object"==typeof t&&t)).isTrigger=s?2:3,t.namespace=g.join("."),t.rnamespace=t.namespace?new RegExp("(^|\\.)"+g.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,t.result=void 0,t.target||(t.target=n),e=null==e?[t]:N.makeArray(e,[t]),d=N.event.special[m]||{},s||!d.trigger||!1!==d.trigger.apply(n,e))){if(!s&&!d.noBubble&&!b(n)){for(l=d.delegateType||m,xe.test(l+m)||(i=i.parentNode);i;i=i.parentNode)p.push(i),a=i;a===(n.ownerDocument||y)&&p.push(a.defaultView||a.parentWindow||r)}for(o=0;(i=p[o++])&&!t.isPropagationStopped();)h=i,t.type=o>1?l:d.bindType||m,(u=(J.get(i,"events")||Object.create(null))[t.type]&&J.get(i,"handle"))&&u.apply(i,e),(u=c&&i[c])&&u.apply&&K(i)&&(t.result=u.apply(i,e),!1===t.result&&t.preventDefault());return t.type=m,s||t.isDefaultPrevented()||d._default&&!1!==d._default.apply(p.pop(),e)||!K(n)||c&&v(n[m])&&!b(n)&&((a=n[c])&&(n[c]=null),N.event.triggered=m,t.isPropagationStopped()&&h.addEventListener(m,ke),n[m](),t.isPropagationStopped()&&h.removeEventListener(m,ke),N.event.triggered=void 0,a&&(n[c]=a)),t.result}},simulate:function(t,e,n){var r=N.extend(new N.Event,n,{type:t,isSimulated:!0});N.event.trigger(r,null,e)}}),N.fn.extend({trigger:function(t,e){return this.each((function(){N.event.trigger(t,e,this)}))},triggerHandler:function(t,e){var n=this[0];if(n)return N.event.trigger(t,e,n,!0)}}),g.focusin||N.each({focus:"focusin",blur:"focusout"},(function(t,e){var n=function(t){N.event.simulate(e,t.target,N.event.fix(t))};N.event.special[e]={setup:function(){var r=this.ownerDocument||this.document||this,s=J.access(r,e);s||r.addEventListener(t,n,!0),J.access(r,e,(s||0)+1)},teardown:function(){var r=this.ownerDocument||this.document||this,s=J.access(r,e)-1;s?J.access(r,e,s):(r.removeEventListener(t,n,!0),J.remove(r,e))}}}));var Ne=r.location,Ce={guid:Date.now()},Se=/\?/;N.parseXML=function(t){var e,n;if(!t||"string"!=typeof t)return null;try{e=(new r.DOMParser).parseFromString(t,"text/xml")}catch(t){}return n=e&&e.getElementsByTagName("parsererror")[0],e&&!n||N.error("Invalid XML: "+(n?N.map(n.childNodes,(function(t){return t.textContent})).join("\n"):t)),e};var Te=/\[\]$/,Ee=/\r?\n/g,Ae=/^(?:submit|button|image|reset|file)$/i,Pe=/^(?:input|select|textarea|keygen)/i;function De(t,e,n,r){var s;if(Array.isArray(e))N.each(e,(function(e,s){n||Te.test(t)?r(t,s):De(t+"["+("object"==typeof s&&null!=s?e:"")+"]",s,n,r)}));else if(n||"object"!==x(e))r(t,e);else for(s in e)De(t+"["+s+"]",e[s],n,r)}N.param=function(t,e){var n,r=[],s=function(t,e){var n=v(e)?e():e;r[r.length]=encodeURIComponent(t)+"="+encodeURIComponent(null==n?"":n)};if(null==t)return"";if(Array.isArray(t)||t.jquery&&!N.isPlainObject(t))N.each(t,(function(){s(this.name,this.value)}));else for(n in t)De(n,t[n],e,s);return r.join("&")},N.fn.extend({serialize:function(){return N.param(this.serializeArray())},serializeArray:function(){return this.map((function(){var t=N.prop(this,"elements");return t?N.makeArray(t):this})).filter((function(){var t=this.type;return this.name&&!N(this).is(":disabled")&&Pe.test(this.nodeName)&&!Ae.test(t)&&(this.checked||!gt.test(t))})).map((function(t,e){var n=N(this).val();return null==n?null:Array.isArray(n)?N.map(n,(function(t){return{name:e.name,value:t.replace(Ee,"\r\n")}})):{name:e.name,value:n.replace(Ee,"\r\n")}})).get()}});var _e=/%20/g,Ie=/#.*$/,Oe=/([?&])_=[^&]*/,Le=/^(.*?):[ \t]*([^\r\n]*)$/gm,Me=/^(?:GET|HEAD)$/,je=/^\/\//,Re={},$e={},He="*/".concat("*"),Be=y.createElement("a");function qe(t){return function(e,n){"string"!=typeof e&&(n=e,e="*");var r,s=0,o=e.toLowerCase().match(R)||[];if(v(n))for(;r=o[s++];)"+"===r[0]?(r=r.slice(1)||"*",(t[r]=t[r]||[]).unshift(n)):(t[r]=t[r]||[]).push(n)}}function Ue(t,e,n,r){var s={},o=t===$e;function i(a){var l;return s[a]=!0,N.each(t[a]||[],(function(t,a){var c=a(e,n,r);return"string"!=typeof c||o||s[c]?o?!(l=c):void 0:(e.dataTypes.unshift(c),i(c),!1)})),l}return i(e.dataTypes[0])||!s["*"]&&i("*")}function Fe(t,e){var n,r,s=N.ajaxSettings.flatOptions||{};for(n in e)void 0!==e[n]&&((s[n]?t:r||(r={}))[n]=e[n]);return r&&N.extend(!0,t,r),t}Be.href=Ne.href,N.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Ne.href,type:"GET",isLocal:/^(?:about|app|app-storage|.+-extension|file|res|widget):$/.test(Ne.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":He,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":N.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(t,e){return e?Fe(Fe(t,N.ajaxSettings),e):Fe(N.ajaxSettings,t)},ajaxPrefilter:qe(Re),ajaxTransport:qe($e),ajax:function(t,e){"object"==typeof t&&(e=t,t=void 0),e=e||{};var n,s,o,i,a,l,c,u,d,h,f=N.ajaxSetup({},e),p=f.context||f,m=f.context&&(p.nodeType||p.jquery)?N(p):N.event,g=N.Deferred(),v=N.Callbacks("once memory"),b=f.statusCode||{},w={},Z={},x="canceled",k={readyState:0,getResponseHeader:function(t){var e;if(c){if(!i)for(i={};e=Le.exec(o);)i[e[1].toLowerCase()+" "]=(i[e[1].toLowerCase()+" "]||[]).concat(e[2]);e=i[t.toLowerCase()+" "]}return null==e?null:e.join(", ")},getAllResponseHeaders:function(){return c?o:null},setRequestHeader:function(t,e){return null==c&&(t=Z[t.toLowerCase()]=Z[t.toLowerCase()]||t,w[t]=e),this},overrideMimeType:function(t){return null==c&&(f.mimeType=t),this},statusCode:function(t){var e;if(t)if(c)k.always(t[k.status]);else for(e in t)b[e]=[b[e],t[e]];return this},abort:function(t){var e=t||x;return n&&n.abort(e),C(0,e),this}};if(g.promise(k),f.url=((t||f.url||Ne.href)+"").replace(je,Ne.protocol+"//"),f.type=e.method||e.type||f.method||f.type,f.dataTypes=(f.dataType||"*").toLowerCase().match(R)||[""],null==f.crossDomain){l=y.createElement("a");try{l.href=f.url,l.href=l.href,f.crossDomain=Be.protocol+"//"+Be.host!=l.protocol+"//"+l.host}catch(t){f.crossDomain=!0}}if(f.data&&f.processData&&"string"!=typeof f.data&&(f.data=N.param(f.data,f.traditional)),Ue(Re,f,e,k),c)return k;for(d in(u=N.event&&f.global)&&0==N.active++&&N.event.trigger("ajaxStart"),f.type=f.type.toUpperCase(),f.hasContent=!Me.test(f.type),s=f.url.replace(Ie,""),f.hasContent?f.data&&f.processData&&0===(f.contentType||"").indexOf("application/x-www-form-urlencoded")&&(f.data=f.data.replace(_e,"+")):(h=f.url.slice(s.length),f.data&&(f.processData||"string"==typeof f.data)&&(s+=(Se.test(s)?"&":"?")+f.data,delete f.data),!1===f.cache&&(s=s.replace(Oe,"$1"),h=(Se.test(s)?"&":"?")+"_="+Ce.guid+++h),f.url=s+h),f.ifModified&&(N.lastModified[s]&&k.setRequestHeader("If-Modified-Since",N.lastModified[s]),N.etag[s]&&k.setRequestHeader("If-None-Match",N.etag[s])),(f.data&&f.hasContent&&!1!==f.contentType||e.contentType)&&k.setRequestHeader("Content-Type",f.contentType),k.setRequestHeader("Accept",f.dataTypes[0]&&f.accepts[f.dataTypes[0]]?f.accepts[f.dataTypes[0]]+("*"!==f.dataTypes[0]?", "+He+"; q=0.01":""):f.accepts["*"]),f.headers)k.setRequestHeader(d,f.headers[d]);if(f.beforeSend&&(!1===f.beforeSend.call(p,k,f)||c))return k.abort();if(x="abort",v.add(f.complete),k.done(f.success),k.fail(f.error),n=Ue($e,f,e,k)){if(k.readyState=1,u&&m.trigger("ajaxSend",[k,f]),c)return k;f.async&&f.timeout>0&&(a=r.setTimeout((function(){k.abort("timeout")}),f.timeout));try{c=!1,n.send(w,C)}catch(t){if(c)throw t;C(-1,t)}}else C(-1,"No Transport");function C(t,e,i,l){var d,h,y,w,Z,x=e;c||(c=!0,a&&r.clearTimeout(a),n=void 0,o=l||"",k.readyState=t>0?4:0,d=t>=200&&t<300||304===t,i&&(w=function(t,e,n){for(var r,s,o,i,a=t.contents,l=t.dataTypes;"*"===l[0];)l.shift(),void 0===r&&(r=t.mimeType||e.getResponseHeader("Content-Type"));if(r)for(s in a)if(a[s]&&a[s].test(r)){l.unshift(s);break}if(l[0]in n)o=l[0];else{for(s in n){if(!l[0]||t.converters[s+" "+l[0]]){o=s;break}i||(i=s)}o=o||i}if(o)return o!==l[0]&&l.unshift(o),n[o]}(f,k,i)),!d&&N.inArray("script",f.dataTypes)>-1&&N.inArray("json",f.dataTypes)<0&&(f.converters["text script"]=function(){}),w=function(t,e,n,r){var s,o,i,a,l,c={},u=t.dataTypes.slice();if(u[1])for(i in t.converters)c[i.toLowerCase()]=t.converters[i];for(o=u.shift();o;)if(t.responseFields[o]&&(n[t.responseFields[o]]=e),!l&&r&&t.dataFilter&&(e=t.dataFilter(e,t.dataType)),l=o,o=u.shift())if("*"===o)o=l;else if("*"!==l&&l!==o){if(!(i=c[l+" "+o]||c["* "+o]))for(s in c)if((a=s.split(" "))[1]===o&&(i=c[l+" "+a[0]]||c["* "+a[0]])){!0===i?i=c[s]:!0!==c[s]&&(o=a[0],u.unshift(a[1]));break}if(!0!==i)if(i&&t.throws)e=i(e);else try{e=i(e)}catch(t){return{state:"parsererror",error:i?t:"No conversion from "+l+" to "+o}}}return{state:"success",data:e}}(f,w,k,d),d?(f.ifModified&&((Z=k.getResponseHeader("Last-Modified"))&&(N.lastModified[s]=Z),(Z=k.getResponseHeader("etag"))&&(N.etag[s]=Z)),204===t||"HEAD"===f.type?x="nocontent":304===t?x="notmodified":(x=w.state,h=w.data,d=!(y=w.error))):(y=x,!t&&x||(x="error",t<0&&(t=0))),k.status=t,k.statusText=(e||x)+"",d?g.resolveWith(p,[h,x,k]):g.rejectWith(p,[k,x,y]),k.statusCode(b),b=void 0,u&&m.trigger(d?"ajaxSuccess":"ajaxError",[k,f,d?h:y]),v.fireWith(p,[k,x]),u&&(m.trigger("ajaxComplete",[k,f]),--N.active||N.event.trigger("ajaxStop")))}return k},getJSON:function(t,e,n){return N.get(t,e,n,"json")},getScript:function(t,e){return N.get(t,void 0,e,"script")}}),N.each(["get","post"],(function(t,e){N[e]=function(t,n,r,s){return v(n)&&(s=s||r,r=n,n=void 0),N.ajax(N.extend({url:t,type:e,dataType:s,data:n,success:r},N.isPlainObject(t)&&t))}})),N.ajaxPrefilter((function(t){var e;for(e in t.headers)"content-type"===e.toLowerCase()&&(t.contentType=t.headers[e]||"")})),N._evalUrl=function(t,e,n){return N.ajax({url:t,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,converters:{"text script":function(){}},dataFilter:function(t){N.globalEval(t,e,n)}})},N.fn.extend({wrapAll:function(t){var e;return this[0]&&(v(t)&&(t=t.call(this[0])),e=N(t,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&e.insertBefore(this[0]),e.map((function(){for(var t=this;t.firstElementChild;)t=t.firstElementChild;return t})).append(this)),this},wrapInner:function(t){return v(t)?this.each((function(e){N(this).wrapInner(t.call(this,e))})):this.each((function(){var e=N(this),n=e.contents();n.length?n.wrapAll(t):e.append(t)}))},wrap:function(t){var e=v(t);return this.each((function(n){N(this).wrapAll(e?t.call(this,n):t)}))},unwrap:function(t){return this.parent(t).not("body").each((function(){N(this).replaceWith(this.childNodes)})),this}}),N.expr.pseudos.hidden=function(t){return!N.expr.pseudos.visible(t)},N.expr.pseudos.visible=function(t){return!!(t.offsetWidth||t.offsetHeight||t.getClientRects().length)},N.ajaxSettings.xhr=function(){try{return new r.XMLHttpRequest}catch(t){}};var ze={0:200,1223:204},We=N.ajaxSettings.xhr();g.cors=!!We&&"withCredentials"in We,g.ajax=We=!!We,N.ajaxTransport((function(t){var e,n;if(g.cors||We&&!t.crossDomain)return{send:function(s,o){var i,a=t.xhr();if(a.open(t.type,t.url,t.async,t.username,t.password),t.xhrFields)for(i in t.xhrFields)a[i]=t.xhrFields[i];for(i in t.mimeType&&a.overrideMimeType&&a.overrideMimeType(t.mimeType),t.crossDomain||s["X-Requested-With"]||(s["X-Requested-With"]="XMLHttpRequest"),s)a.setRequestHeader(i,s[i]);e=function(t){return function(){e&&(e=n=a.onload=a.onerror=a.onabort=a.ontimeout=a.onreadystatechange=null,"abort"===t?a.abort():"error"===t?"number"!=typeof a.status?o(0,"error"):o(a.status,a.statusText):o(ze[a.status]||a.status,a.statusText,"text"!==(a.responseType||"text")||"string"!=typeof a.responseText?{binary:a.response}:{text:a.responseText},a.getAllResponseHeaders()))}},a.onload=e(),n=a.onerror=a.ontimeout=e("error"),void 0!==a.onabort?a.onabort=n:a.onreadystatechange=function(){4===a.readyState&&r.setTimeout((function(){e&&n()}))},e=e("abort");try{a.send(t.hasContent&&t.data||null)}catch(t){if(e)throw t}},abort:function(){e&&e()}}})),N.ajaxPrefilter((function(t){t.crossDomain&&(t.contents.script=!1)})),N.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(t){return N.globalEval(t),t}}}),N.ajaxPrefilter("script",(function(t){void 0===t.cache&&(t.cache=!1),t.crossDomain&&(t.type="GET")})),N.ajaxTransport("script",(function(t){var e,n;if(t.crossDomain||t.scriptAttrs)return{send:function(r,s){e=N("