From 7e18c6ad4b2b48b1cc3e58c7f872ff3d325b3739 Mon Sep 17 00:00:00 2001 From: ilestis Date: Fri, 12 Jul 2024 12:06:26 -0600 Subject: [PATCH 01/17] Fix reminder adding on single calendar --- public/build/assets/app-336e29d2.js | 10 ---------- public/build/assets/app-d7b814de.js | 10 ++++++++++ public/build/manifest.json | 2 +- resources/js/forms/calendar-date.js | 4 ++-- 4 files changed, 13 insertions(+), 13 deletions(-) delete mode 100644 public/build/assets/app-336e29d2.js create mode 100644 public/build/assets/app-d7b814de.js diff --git a/public/build/assets/app-336e29d2.js b/public/build/assets/app-336e29d2.js deleted file mode 100644 index 7c68e6340c..0000000000 --- a/public/build/assets/app-336e29d2.js +++ /dev/null @@ -1,10 +0,0 @@ -import{t as ne,C as ie}from"./tippy.esm-24ef6cb2.js";import{S as qe}from"./sortable.esm-0d19b1d3.js";import"./dialog-4600fe8d.js";import{d as ut,o as ft,c as f,a as l,t as m,b as u,n as z,w as ce,e as v,F as L,r as E,f as T,g as x,h as N,i as B,j as de,k as ht,v as mt,l as Z,m as Ce,p as gt}from"./vue.esm-bundler-2d0f0fff.js";import{m as pt}from"./mitt-f7ef348c.js";import{_ as F}from"./_plugin-vue_export-helper-c27b6911.js";import{v as Ae}from"./v-click-outside.umd-1708c20a.js";import"./_commonjsHelpers-725317a4.js";const Me="kanka.default";window.triggerEvent=function(n){n=n||Me;const e=new Event(n);document.dispatchEvent(e)};window.onEvent=function(n,e){e=e||Me,document.addEventListener(e,n)};window.onReady=function(n){document.readyState==="complete"||document.readyState==="interactive"?setTimeout(n,1):document.addEventListener("DOMContentLoaded",n)};window.initTags=function(){var n,e;(n=document.querySelectorAll(".form-tags"))==null||n.forEach(function(t){t.classList.contains("select2-hidden-accessible")||t.dataset.loaded!==1&&(t.dataset.loaded=1,$(t).select2({tags:t.dataset.allowNew,allowClear:t.dataset.allowClear,dropdownParent:t.dataset.dropdownParent||"",minimumInputLength:0,ajax:{quietMillis:500,delay:500,url:t.dataset.url,dataType:"json",data:function(i){var r;return{q:(r=i.term)==null?void 0:r.trim()}},processResults:function(i){return{results:i}},cache:!0},createTag:function(i){var o;const r=(o=i.term)==null?void 0:o.trim();return r===""?null:{id:r,text:r,newTag:!0}},templateResult:function(i){const r=document.createElement("span");return r.classList.add("block","grow","text-left"),r.innerHTML=i.text,i.colour&&(r.classList.add("flex","gap-2","items-center","text-left"),r.innerHTML=""+i.text+""),r},templateSelection:function(i,r){if(i.newTag){const a=document.createElement("span");a.classList.add("new-tag"),a.title=t.dataset.newTag,a.innerHTML=i.text+' '}let o=i.element,s=[];return i.colour?s=i.colour.trim().split(" "):o.dataset.colour&&(s=o.dataset.colour.trim().split(" ")),s.length>0&&s.forEach(a=>{a.trim().length!==0&&r[0].classList.add(a)}),r[0].classList.add("text-left"),i.text}}))}),(e=document.querySelectorAll(".position-dropdown"))==null||e.forEach(function(t){t.classList.contains("select2-hidden-accessible")||t.dataset.loaded!==1&&(t.dataset.loaded=1,$(t).select2({tags:!0,allowClear:!0,dropdownParent:t.dataset.dropdownParent||"",placeholder:t.dataset.placeholder,minimumInputLength:0,createTag:function(i){var o;const r=(o=i.term)==null?void 0:o.trim();return r===""?null:{id:r,text:r,newTag:!0}}}))})};window.initTags();/*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/de",[],function(){return{errorLoading:function(){return"Die Ergebnisse konnten nicht geladen werden."},inputTooLong:function(e){return"Bitte "+(e.input.length-e.maximum)+" Zeichen weniger eingeben"},inputTooShort:function(e){return"Bitte "+(e.minimum-e.input.length)+" Zeichen mehr eingeben"},loadingMore:function(){return"Lade mehr Ergebnisse…"},maximumSelected:function(e){var t="Sie können nur "+e.maximum+" Element";return e.maximum!=1&&(t+="e"),t+=" auswählen"},noResults:function(){return"Keine Übereinstimmungen gefunden"},searching:function(){return"Suche…"},removeAllItems:function(){return"Entferne alle Elemente"}}}),n.define,n.require})();/*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/en",[],function(){return{errorLoading:function(){return"The results could not be loaded."},inputTooLong:function(e){var t=e.input.length-e.maximum,i="Please delete "+t+" character";return t!=1&&(i+="s"),i},inputTooShort:function(e){return"Please enter "+(e.minimum-e.input.length)+" or more characters"},loadingMore:function(){return"Loading more results…"},maximumSelected:function(e){var t="You can only select "+e.maximum+" item";return e.maximum!=1&&(t+="s"),t},noResults:function(){return"No results found"},searching:function(){return"Searching…"},removeAllItems:function(){return"Remove all items"}}}),n.define,n.require})();/*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/es",[],function(){return{errorLoading:function(){return"No se pudieron cargar los resultados"},inputTooLong:function(e){var t=e.input.length-e.maximum,i="Por favor, elimine "+t+" car";return i+=t==1?"ácter":"acteres"},inputTooShort:function(e){var t=e.minimum-e.input.length,i="Por favor, introduzca "+t+" car";return i+=t==1?"ácter":"acteres"},loadingMore:function(){return"Cargando más resultados…"},maximumSelected:function(e){var t="Sólo puede seleccionar "+e.maximum+" elemento";return e.maximum!=1&&(t+="s"),t},noResults:function(){return"No se encontraron resultados"},searching:function(){return"Buscando…"},removeAllItems:function(){return"Eliminar todos los elementos"}}}),n.define,n.require})();/*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/fr",[],function(){return{errorLoading:function(){return"Les résultats ne peuvent pas être chargés."},inputTooLong:function(e){var t=e.input.length-e.maximum;return"Supprimez "+t+" caractère"+(t>1?"s":"")},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Saisissez au moins "+t+" caractère"+(t>1?"s":"")},loadingMore:function(){return"Chargement de résultats supplémentaires…"},maximumSelected:function(e){return"Vous pouvez seulement sélectionner "+e.maximum+" élément"+(e.maximum>1?"s":"")},noResults:function(){return"Aucun résultat trouvé"},searching:function(){return"Recherche en cours…"},removeAllItems:function(){return"Supprimer tous les éléments"}}}),n.define,n.require})();/*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/it",[],function(){return{errorLoading:function(){return"I risultati non possono essere caricati."},inputTooLong:function(e){var t=e.input.length-e.maximum,i="Per favore cancella "+t+" caratter";return i+=t!==1?"i":"e"},inputTooShort:function(e){return"Per favore inserisci "+(e.minimum-e.input.length)+" o più caratteri"},loadingMore:function(){return"Caricando più risultati…"},maximumSelected:function(e){var t="Puoi selezionare solo "+e.maximum+" element";return e.maximum!==1?t+="i":t+="o",t},noResults:function(){return"Nessun risultato trovato"},searching:function(){return"Sto cercando…"},removeAllItems:function(){return"Rimuovi tutti gli oggetti"}}}),n.define,n.require})();/*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/nl",[],function(){return{errorLoading:function(){return"De resultaten konden niet worden geladen."},inputTooLong:function(e){return"Gelieve "+(e.input.length-e.maximum)+" karakters te verwijderen"},inputTooShort:function(e){return"Gelieve "+(e.minimum-e.input.length)+" of meer karakters in te voeren"},loadingMore:function(){return"Meer resultaten laden…"},maximumSelected:function(e){var t=e.maximum==1?"kan":"kunnen",i="Er "+t+" maar "+e.maximum+" item";return e.maximum!=1&&(i+="s"),i+=" worden geselecteerd"},noResults:function(){return"Geen resultaten gevonden…"},searching:function(){return"Zoeken…"},removeAllItems:function(){return"Verwijder alle items"}}}),n.define,n.require})();/*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/pl",[],function(){var e=["znak","znaki","znaków"],t=["element","elementy","elementów"],i=function(r,o){return r===1?o[0]:r>1&&r<=4?o[1]:r>=5?o[2]:void 0};return{errorLoading:function(){return"Nie można załadować wyników."},inputTooLong:function(r){var o=r.input.length-r.maximum;return"Usuń "+o+" "+i(o,e)},inputTooShort:function(r){var o=r.minimum-r.input.length;return"Podaj przynajmniej "+o+" "+i(o,e)},loadingMore:function(){return"Trwa ładowanie…"},maximumSelected:function(r){return"Możesz zaznaczyć tylko "+r.maximum+" "+i(r.maximum,t)},noResults:function(){return"Brak wyników"},searching:function(){return"Trwa wyszukiwanie…"},removeAllItems:function(){return"Usuń wszystkie przedmioty"}}}),n.define,n.require})();/*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/pt-BR",[],function(){return{errorLoading:function(){return"Os resultados não puderam ser carregados."},inputTooLong:function(e){var t=e.input.length-e.maximum,i="Apague "+t+" caracter";return t!=1&&(i+="es"),i},inputTooShort:function(e){return"Digite "+(e.minimum-e.input.length)+" ou mais caracteres"},loadingMore:function(){return"Carregando mais resultados…"},maximumSelected:function(e){var t="Você só pode selecionar "+e.maximum+" ite";return e.maximum==1?t+="m":t+="ns",t},noResults:function(){return"Nenhum resultado encontrado"},searching:function(){return"Buscando…"},removeAllItems:function(){return"Remover todos os itens"}}}),n.define,n.require})();/*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/ru",[],function(){function e(t,i,r,o){return t%10<5&&t%10>0&&t%100<5||t%100>20?t%10>1?r:i:o}return{errorLoading:function(){return"Невозможно загрузить результаты"},inputTooLong:function(t){var i=t.input.length-t.maximum,r="Пожалуйста, введите на "+i+" символ";return r+=e(i,"","a","ов"),r+=" меньше"},inputTooShort:function(t){var i=t.minimum-t.input.length,r="Пожалуйста, введите ещё хотя бы "+i+" символ";return r+=e(i,"","a","ов")},loadingMore:function(){return"Загрузка данных…"},maximumSelected:function(t){var i="Вы можете выбрать не более "+t.maximum+" элемент";return i+=e(t.maximum,"","a","ов")},noResults:function(){return"Совпадений не найдено"},searching:function(){return"Поиск…"},removeAllItems:function(){return"Удалить все элементы"}}}),n.define,n.require})();/*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/sk",[],function(){var e={2:function(t){return t?"dva":"dve"},3:function(){return"tri"},4:function(){return"štyri"}};return{errorLoading:function(){return"Výsledky sa nepodarilo načítať."},inputTooLong:function(t){var i=t.input.length-t.maximum;return i==1?"Prosím, zadajte o jeden znak menej":i>=2&&i<=4?"Prosím, zadajte o "+e[i](!0)+" znaky menej":"Prosím, zadajte o "+i+" znakov menej"},inputTooShort:function(t){var i=t.minimum-t.input.length;return i==1?"Prosím, zadajte ešte jeden znak":i<=4?"Prosím, zadajte ešte ďalšie "+e[i](!0)+" znaky":"Prosím, zadajte ešte ďalších "+i+" znakov"},loadingMore:function(){return"Načítanie ďalších výsledkov…"},maximumSelected:function(t){return t.maximum==1?"Môžete zvoliť len jednu položku":t.maximum>=2&&t.maximum<=4?"Môžete zvoliť najviac "+e[t.maximum](!1)+" položky":"Môžete zvoliť najviac "+t.maximum+" položiek"},noResults:function(){return"Nenašli sa žiadne položky"},searching:function(){return"Vyhľadávanie…"},removeAllItems:function(){return"Odstráňte všetky položky"}}}),n.define,n.require})();window.initForeignSelect=function(){const n=document.querySelectorAll("select.select2");n.length!==0&&(n.forEach(e=>{if(e.classList.contains("select2-hidden-accessible"))return;if(e.classList.contains("campaign-genres")){$(e).select2({tags:!1,allowClear:!0,dropdownParent:"",width:"100%",maximumSelectionLength:3});return}const t=e.dataset.url,i=e.dataset.allowClear,r=e.dataset.dropdownParent||"",o=e.dataset.placeholder;if(!t){$(e).select2({tags:!1,placeholder:o,allowClear:i??!1,language:e.dataset.language,minimumInputLength:0,dropdownParent:r,width:"100%"});return}$(e).select2({tags:!1,placeholder:o,allowClear:i||!0,language:e.dataset.language,minimumInputLength:0,dropdownParent:r,width:"100%",ajax:{delay:500,quietMillis:500,url:t,dataType:"json",data:function(s){var a;return{q:(a=s.term)==null?void 0:a.trim()}},processResults:function(s){return{results:s}},error:function(s){return s.status===503&&window.showToast(s.responseJSON.message,"error"),{results:[]}},cache:!0},templateResult:vt,templateSelection:yt,createTag:function(s){return null}})}),bt(),wt())};const vt=n=>{const e=document.createElement("span");return n.image?(e.classList.add("flex","gap-2","items-center","text-left"),e.innerHTML=""+n.text+""):e.innerHTML=n.text,e},yt=n=>{if(!n.id)return n.text;const e=document.createElement("span");return e.innerHTML=n.text,e},bt=()=>{const n=document.querySelectorAll("select.select2-local");n.length!==0&&n.forEach(e=>{$(e).select2({placeholder:e.dataset.placeholder,language:e.dataset.language,allowClear:!0})})},wt=()=>{const n=document.querySelectorAll("select.select2-colour");n.length!==0&&n.forEach(e=>{$(e).select2({placeholder:e.dataset.placeholder,language:e.dataset.language,allowClear:!1,templateResult:Le,templateSelection:Le})})},Le=n=>{if(n.id==="none")return n.text;const e=document.createElement("span");return e.innerHTML='
'+n.text,e};Array.prototype.find||(Array.prototype.find=function(n){if(this===null)throw new TypeError("Array.prototype.find called on null or undefined");if(typeof n!="function")throw new TypeError("predicate must be a function");for(var e=Object(this),t=e.length>>>0,i=arguments[1],r,o=0;o{r.key===t.keyCode&&(e.commandEvent=!0,e.callbacks()[r.value.toLowerCase()](t,i))})}input(e,t){e.inputEvent=!0,e.keyup.call(this,e,t)}click(e,t){let i=e.tribute;if(i.menu&&i.menu.contains(t.target)){let r=t.target;for(t.preventDefault(),t.stopPropagation();r.nodeName.toLowerCase()!=="li";)if(r=r.parentNode,!r||r===i.menu)throw new Error("cannot find the
  • container for the click");i.selectItemAtIndex(r.getAttribute("data-index"),t),i.hideMenu()}else i.current.element&&!i.current.externalTrigger&&(i.current.externalTrigger=!1,setTimeout(()=>i.hideMenu()))}keyup(e,t){if(e.inputEvent&&(e.inputEvent=!1),e.updateSelection(this),t.keyCode!==27){if(!e.tribute.allowSpaces&&e.tribute.hasTrailingSpace){e.tribute.hasTrailingSpace=!1,e.commandEvent=!0,e.callbacks().space(t,this);return}if(!e.tribute.isActive)if(e.tribute.autocompleteMode)e.callbacks().triggerChar(t,this,"");else{let i=e.getKeyCode(e,this,t);if(isNaN(i)||!i)return;let r=e.tribute.triggers().find(o=>o.charCodeAt(0)===i);typeof r<"u"&&e.callbacks().triggerChar(t,this,r)}e.tribute.current.mentionText.length{e.keyCode===i.key&&(t=!0)}),!t}return!1}getKeyCode(e,t,i){let r=e.tribute,o=r.range.getTriggerInfo(!1,r.hasTrailingSpace,!0,r.allowSpaces,r.autocompleteMode);return o?o.mentionTriggerChar.charCodeAt(0):!1}updateSelection(e){this.tribute.current.element=e;let t=this.tribute.range.getTriggerInfo(!1,this.tribute.hasTrailingSpace,!0,this.tribute.allowSpaces,this.tribute.autocompleteMode);t&&(this.tribute.current.selectedPath=t.mentionSelectedPath,this.tribute.current.mentionText=t.mentionText,this.tribute.current.selectedOffset=t.mentionSelectedOffset)}callbacks(){return{triggerChar:(e,t,i)=>{let r=this.tribute;r.current.trigger=i;let o=r.collection.find(s=>s.trigger===i);r.current.collection=o,r.current.mentionText.length>=r.current.collection.menuShowMinLength&&r.inputEvent&&r.showMenuFor(t,!0)},enter:(e,t)=>{this.tribute.isActive&&this.tribute.current.filteredItems&&(e.preventDefault(),e.stopPropagation(),setTimeout(()=>{this.tribute.selectItemAtIndex(this.tribute.menuSelected,e),this.tribute.hideMenu()},0))},escape:(e,t)=>{this.tribute.isActive&&(e.preventDefault(),e.stopPropagation(),this.tribute.isActive=!1,this.tribute.hideMenu())},tab:(e,t)=>{this.callbacks().enter(e,t)},space:(e,t)=>{this.tribute.isActive&&(this.tribute.spaceSelectsMatch?this.callbacks().enter(e,t):this.tribute.allowSpaces||(e.stopPropagation(),setTimeout(()=>{this.tribute.hideMenu(),this.tribute.isActive=!1},0)))},up:(e,t)=>{if(this.tribute.isActive&&this.tribute.current.filteredItems){e.preventDefault(),e.stopPropagation();let i=this.tribute.current.filteredItems.length,r=this.tribute.menuSelected;i>r&&r>0?(this.tribute.menuSelected--,this.setActiveLi()):r===0&&(this.tribute.menuSelected=i-1,this.setActiveLi(),this.tribute.menu.scrollTop=this.tribute.menu.scrollHeight)}},down:(e,t)=>{if(this.tribute.isActive&&this.tribute.current.filteredItems){e.preventDefault(),e.stopPropagation();let i=this.tribute.current.filteredItems.length-1,r=this.tribute.menuSelected;i>r?(this.tribute.menuSelected++,this.setActiveLi()):i===r&&(this.tribute.menuSelected=0,this.setActiveLi(),this.tribute.menu.scrollTop=0)}},delete:(e,t)=>{this.tribute.isActive&&this.tribute.current.mentionText.length<1?this.tribute.hideMenu():this.tribute.isActive&&this.tribute.showMenuFor(t)}}}setActiveLi(e){let t=this.tribute.menu.querySelectorAll("li"),i=t.length>>>0;e&&(this.tribute.menuSelected=parseInt(e));for(let r=0;ra.bottom){let c=s.bottom-a.bottom;this.tribute.menu.scrollTop+=c}else if(s.top{this.tribute.isActive&&this.tribute.showMenuFor(this.tribute.current.element,!1)},300,!1),this.windowResizeEvent=this.debounce(()=>{this.tribute.isActive&&this.tribute.range.positionMenuAtCaret(!0)},300,!1),this.tribute.range.getDocument().addEventListener("MSPointerDown",this.menuClickEvent,!1),this.tribute.range.getDocument().addEventListener("mousedown",this.menuClickEvent,!1),window.addEventListener("resize",this.windowResizeEvent),this.menuContainer?this.menuContainer.addEventListener("scroll",this.menuContainerScrollEvent,!1):window.addEventListener("scroll",this.menuContainerScrollEvent)}unbind(e){this.tribute.range.getDocument().removeEventListener("mousedown",this.menuClickEvent,!1),this.tribute.range.getDocument().removeEventListener("MSPointerDown",this.menuClickEvent,!1),window.removeEventListener("resize",this.windowResizeEvent),this.menuContainer?this.menuContainer.removeEventListener("scroll",this.menuContainerScrollEvent,!1):window.removeEventListener("scroll",this.menuContainerScrollEvent)}debounce(e,t,i){var r;return()=>{var o=this,s=arguments,a=()=>{r=null,i||e.apply(o,s)},c=i&&!r;clearTimeout(r),r=setTimeout(a,t),c&&e.apply(o,s)}}}class xt{constructor(e){this.tribute=e,this.tribute.range=this}getDocument(){let e;return this.tribute.current.collection&&(e=this.tribute.current.collection.iframe),e?e.contentWindow.document:document}positionMenuAtCaret(e){let t=this.tribute.current,i,r=this.getTriggerInfo(!1,this.tribute.hasTrailingSpace,!0,this.tribute.allowSpaces,this.tribute.autocompleteMode);if(typeof r<"u"){if(!this.tribute.positionMenu){this.tribute.menu.style.cssText="display: block;";return}this.isContentEditable(t.element)?i=this.getContentEditableCaretPosition(r.mentionPosition):i=this.getTextAreaOrInputUnderlinePosition(this.tribute.current.element,r.mentionPosition),this.tribute.menu.style.cssText=`top: ${i.top}px; - left: ${i.left}px; - right: ${i.right}px; - bottom: ${i.bottom}px; - position: absolute; - display: block;`,i.left==="auto"&&(this.tribute.menu.style.left="auto"),i.top==="auto"&&(this.tribute.menu.style.top="auto"),e&&this.scrollIntoView(),window.setTimeout(()=>{let o={width:this.tribute.menu.offsetWidth,height:this.tribute.menu.offsetHeight},s=this.isMenuOffScreen(i,o),a=window.innerWidth>o.width&&(s.left||s.right),c=window.innerHeight>o.height&&(s.top||s.bottom);(a||c)&&(this.tribute.menu.style.cssText="display: none",this.positionMenuAtCaret(e))},0)}else this.tribute.menu.style.cssText="display: none"}get menuContainerIsBody(){return this.tribute.menuContainer===document.body||!this.tribute.menuContainer}selectElement(e,t,i){let r,o=e;if(t)for(var s=0;s=0&&(t=r.substring(0,o))}}else{let i=this.tribute.current.element;if(i){let r=i.selectionStart;i.value&&r>=0&&(t=i.value.substring(0,r))}}return t}getLastWordInText(e){e=e.replace(/\u00A0/g," ");let t=e.split(/\s+/),i=t.length-1;return t[i].trim()}getTriggerInfo(e,t,i,r,o){let s=this.tribute.current,a,c,d;if(!this.isContentEditable(s.element))a=this.tribute.current.element;else{let p=this.getContentEditableSelectedPath(s);p&&(a=p.selected,c=p.path,d=p.offset)}let h=this.getTextPrecedingCurrentSelection(),g=this.getLastWordInText(h);if(o)return{mentionPosition:h.length-g.length,mentionText:g,mentionSelectedElement:a,mentionSelectedPath:c,mentionSelectedOffset:d};if(h!=null){let p=-1,_;if(this.tribute.collection.forEach(y=>{let S=y.trigger,b=y.requireLeadingSpace?this.lastIndexWithLeadingSpace(h,S):h.lastIndexOf(S);b>p&&(p=b,_=S,i=y.requireLeadingSpace)}),p>=0&&(p===0||!i||/[\xA0\s]/g.test(h.substring(p-1,p)))){let y=h.substring(p+_.length,h.length);_=h.substring(p,p+_.length);let S=y.substring(0,1),b=y.length>0&&(S===" "||S===" ");t&&(y=y.trim());let C=r?/[^\S ]/g:/[\xA0\s]/g;if(this.tribute.hasTrailingSpace=C.test(y),!b&&(e||!C.test(y)))return{mentionPosition:p,mentionText:y,mentionSelectedElement:a,mentionSelectedPath:c,mentionSelectedOffset:d,mentionTriggerChar:_}}}}lastIndexWithLeadingSpace(e,t){let i=e.split("").reverse().join(""),r=-1;for(let o=0,s=e.length;o=0;h--)if(t[h]!==i[o-h]){d=!1;break}if(d&&(a||c)){r=e.length-1-o;break}}return r}isContentEditable(e){return e.nodeName!=="INPUT"&&e.nodeName!=="TEXTAREA"}isMenuOffScreen(e,t){let i=window.innerWidth,r=window.innerHeight,o=document.documentElement,s=(window.pageXOffset||o.scrollLeft)-(o.clientLeft||0),a=(window.pageYOffset||o.scrollTop)-(o.clientTop||0),c=typeof e.top=="number"?e.top:a+r-e.bottom-t.height,d=typeof e.right=="number"?e.right:e.left+t.width,h=typeof e.bottom=="number"?e.bottom:e.top+t.height,g=typeof e.left=="number"?e.left:s+i-e.right-t.width;return{top:cMath.ceil(s+i),bottom:h>Math.ceil(a+r),left:g{a[j]=c[j]}),o?(a.width=`${parseInt(c.width)-2}px`,e.scrollHeight>parseInt(c.height)&&(a.overflowY="scroll")):a.overflow="hidden",s.textContent=e.value.substring(0,t),e.nodeName==="INPUT"&&(s.textContent=s.textContent.replace(/\s/g," "));let d=this.getDocument().createElement("span");d.textContent=e.value.substring(t)||".",s.appendChild(d);let h=e.getBoundingClientRect(),g=document.documentElement,p=(window.pageXOffset||g.scrollLeft)-(g.clientLeft||0),_=(window.pageYOffset||g.scrollTop)-(g.clientTop||0),y=0,S=0;this.menuContainerIsBody&&(y=h.top,S=h.left);let b={top:y+_+d.offsetTop+parseInt(c.borderTopWidth)+parseInt(c.fontSize)-e.scrollTop,left:S+p+d.offsetLeft+parseInt(c.borderLeftWidth)},C=window.innerWidth,O=window.innerHeight,A=this.getMenuDimensions(),M=this.isMenuOffScreen(b,A);M.right&&(b.right=C-b.left,b.left="auto");let G=this.tribute.menuContainer?this.tribute.menuContainer.offsetHeight:this.getDocument().body.offsetHeight;if(M.bottom){let j=this.tribute.menuContainer?this.tribute.menuContainer.getBoundingClientRect():this.getDocument().body.getBoundingClientRect(),w=G-(O-j.top);b.bottom=w+(O-h.top-d.offsetTop),b.top="auto"}return M=this.isMenuOffScreen(b,A),M.left&&(b.left=C>A.width?p+C-A.width:p,delete b.right),M.top&&(b.top=O>A.height?_+O-A.height:_,delete b.bottom),this.getDocument().body.removeChild(s),b}getContentEditableCaretPosition(e){let t,i=this.getWindowSelection();t=this.getDocument().createRange(),t.setStart(i.anchorNode,e),t.setEnd(i.anchorNode,e),t.collapse(!1);let r=t.getBoundingClientRect(),o=document.documentElement,s=(window.pageXOffset||o.scrollLeft)-(o.clientLeft||0),a=(window.pageYOffset||o.scrollTop)-(o.clientTop||0),c=r.left,d=r.top,h={left:c+s,top:d+r.height+a},g=window.innerWidth,p=window.innerHeight,_=this.getMenuDimensions(),y=this.isMenuOffScreen(h,_);y.right&&(h.left="auto",h.right=g-r.left-s);let S=this.tribute.menuContainer?this.tribute.menuContainer.offsetHeight:this.getDocument().body.offsetHeight;if(y.bottom){let b=this.tribute.menuContainer?this.tribute.menuContainer.getBoundingClientRect():this.getDocument().body.getBoundingClientRect(),C=S-(p-b.top);h.top="auto",h.bottom=C+(p-r.top)}return y=this.isMenuOffScreen(h,_),y.left&&(h.left=g>_.width?s+g-_.width:s,delete h.right),y.top&&(h.top=p>_.height?a+p-_.height:a,delete h.bottom),this.menuContainerIsBody||(h.left=h.left?h.left-this.tribute.menuContainer.offsetLeft:h.left,h.top=h.top?h.top-this.tribute.menuContainer.offsetTop:h.top),h}scrollIntoView(e){let t=20,i,r=100,o=this.menu;if(typeof o>"u")return;for(;i===void 0||i.height===0;)if(i=o.getBoundingClientRect(),i.height===0&&(o=o.childNodes[0],o===void 0||!o.getBoundingClientRect))return;let s=i.top,a=s+i.height;if(s<0)window.scrollTo(0,window.pageYOffset+i.top-t);else if(a>window.innerHeight){let c=window.pageYOffset+i.top-t;c-window.pageYOffset>r&&(c=window.pageYOffset+r);let d=window.pageYOffset-(window.innerHeight-a);d>c&&(d=c),window.scrollTo(0,d)}}}class kt{constructor(e){this.tribute=e,this.tribute.search=this}simpleFilter(e,t){return t.filter(i=>this.test(e,i))}test(e,t){return this.match(e,t)!==null}match(e,t,i){i=i||{},t.length;let r=i.pre||"",o=i.post||"",s=i.caseSensitive&&t||t.toLowerCase();if(i.skip)return{rendered:t,score:0};e=i.caseSensitive&&e||e.toLowerCase();let a=this.traverse(s,e,0,0,[]);return a?{rendered:this.render(t,a.cache,r,o),score:a.score}:null}traverse(e,t,i,r,o){if(t.length===r)return{score:this.calculateScore(o),cache:o.slice()};if(e.length===i||t.length-r>e.length-i)return;let s=t[r],a=e.indexOf(s,i),c,d;for(;a>-1;){if(o.push(a),d=this.traverse(e,t,a+1,r+1,o),o.pop(),!d)return c;(!c||c.score{o>0&&(e[o-1]+1===r?i+=i+1:i=1),t+=i}),t}render(e,t,i,r){var o=e.substring(0,t[0]);return t.forEach((s,a)=>{o+=i+e[s]+r+e.substring(s+1,t[a+1]?t[a+1]:e.length)}),o}filter(e,t,i){return i=i||{},t.reduce((r,o,s,a)=>{let c=o;i.extract&&(c=i.extract(o),c||(c=""));let d=this.match(e,c,i);return d!=null&&(r[r.length]={string:d.rendered,score:d.score,index:s,original:o}),r},[]).sort((r,o)=>{let s=o.score-r.score;return s||r.index-o.index})}}class H{constructor({values:e=null,iframe:t=null,selectClass:i="highlight",containerClass:r="tribute-container",itemClass:o="",trigger:s="@",autocompleteMode:a=!1,selectTemplate:c=null,menuItemTemplate:d=null,lookup:h="key",fillAttr:g="value",collection:p=null,menuContainer:_=null,noMatchTemplate:y=null,requireLeadingSpace:S=!0,allowSpaces:b=!1,replaceTextSuffix:C=null,positionMenu:O=!0,spaceSelectsMatch:A=!1,searchOpts:M={},menuItemLimit:G=null,menuShowMinLength:j=0}){if(this.autocompleteMode=a,this.menuSelected=0,this.current={},this.inputEvent=!1,this.isActive=!1,this.menuContainer=_,this.allowSpaces=b,this.replaceTextSuffix=C,this.positionMenu=O,this.hasTrailingSpace=!1,this.spaceSelectsMatch=A,this.autocompleteMode&&(s="",b=!1),e)this.collection=[{trigger:s,iframe:t,selectClass:i,containerClass:r,itemClass:o,selectTemplate:(c||H.defaultSelectTemplate).bind(this),menuItemTemplate:(d||H.defaultMenuItemTemplate).bind(this),noMatchTemplate:(w=>typeof w=="string"?w.trim()===""?null:w:typeof w=="function"?w.bind(this):y||(function(){return"
  • No Match Found!
  • "}).bind(this))(y),lookup:h,fillAttr:g,values:e,requireLeadingSpace:S,searchOpts:M,menuItemLimit:G,menuShowMinLength:j}];else if(p)this.autocompleteMode&&console.warn("Tribute in autocomplete mode does not work for collections"),this.collection=p.map(w=>({trigger:w.trigger||s,iframe:w.iframe||t,selectClass:w.selectClass||i,containerClass:w.containerClass||r,itemClass:w.itemClass||o,selectTemplate:(w.selectTemplate||H.defaultSelectTemplate).bind(this),menuItemTemplate:(w.menuItemTemplate||H.defaultMenuItemTemplate).bind(this),noMatchTemplate:(K=>typeof K=="string"?K.trim()===""?null:K:typeof K=="function"?K.bind(this):y||(function(){return"
  • No Match Found!
  • "}).bind(this))(y),lookup:w.lookup||h,fillAttr:w.fillAttr||g,values:w.values,requireLeadingSpace:w.requireLeadingSpace,searchOpts:w.searchOpts||M,menuItemLimit:w.menuItemLimit||G,menuShowMinLength:w.menuShowMinLength||j}));else throw new Error("[Tribute] No collection specified.");new xt(this),new J(this),new _t(this),new kt(this)}get isActive(){return this._isActive}set isActive(e){if(this._isActive!=e&&(this._isActive=e,this.current.element)){let t=new CustomEvent(`tribute-active-${e}`);this.current.element.dispatchEvent(t)}}static defaultSelectTemplate(e){return typeof e>"u"?`${this.current.collection.trigger}${this.current.mentionText}`:this.range.isContentEditable(this.current.element)?''+(this.current.collection.trigger+e.original[this.current.collection.fillAttr])+"":this.current.collection.trigger+e.original[this.current.collection.fillAttr]}static defaultMenuItemTemplate(e){return e.string}static inputTypes(){return["TEXTAREA","INPUT"]}triggers(){return this.collection.map(e=>e.trigger)}attach(e){if(!e)throw new Error("[Tribute] Must pass in a DOM node or NodeList.");if(typeof jQuery<"u"&&e instanceof jQuery&&(e=e.get()),e.constructor===NodeList||e.constructor===HTMLCollection||e.constructor===Array){let i=e.length;for(var t=0;t{if(!this.isActive)return;let o=this.search.filter(this.current.mentionText,r,{pre:this.current.collection.searchOpts.pre||"",post:this.current.collection.searchOpts.post||"",skip:this.current.collection.searchOpts.skip,extract:c=>{if(typeof this.current.collection.lookup=="string")return c[this.current.collection.lookup];if(typeof this.current.collection.lookup=="function")return this.current.collection.lookup(c,this.current.mentionText);throw new Error("Invalid lookup attribute, lookup must be string or function.")}});this.current.collection.menuItemLimit&&(o=o.slice(0,this.current.collection.menuItemLimit)),this.current.filteredItems=o;let s=this.menu.querySelector("ul");if(this.range.positionMenuAtCaret(t),!o.length){let c=new CustomEvent("tribute-no-match",{detail:this.menu});this.current.element.dispatchEvent(c),typeof this.current.collection.noMatchTemplate=="function"&&!this.current.collection.noMatchTemplate()||!this.current.collection.noMatchTemplate?this.hideMenu():typeof this.current.collection.noMatchTemplate=="function"?s.innerHTML=this.current.collection.noMatchTemplate():s.innerHTML=this.current.collection.noMatchTemplate;return}s.innerHTML="";let a=this.range.getDocument().createDocumentFragment();o.forEach((c,d)=>{let h=this.range.getDocument().createElement("li");h.setAttribute("data-index",d),h.className=this.current.collection.itemClass,h.addEventListener("mousemove",g=>{let[p,_]=this._findLiTarget(g.target);g.movementY!==0&&this.events.setActiveLi(_)}),this.menuSelected===d&&h.classList.add(this.current.collection.selectClass),h.innerHTML=this.current.collection.menuItemTemplate(c),a.appendChild(h)}),s.appendChild(a)};typeof this.current.collection.values=="function"?this.current.collection.values(this.current.mentionText,i):i(this.current.collection.values)}_findLiTarget(e){if(!e)return[];const t=e.getAttribute("data-index");return t?[e,t]:this._findLiTarget(e.parentNode)}showMenuForCollection(e,t){e!==document.activeElement&&this.placeCaretAtEnd(e),this.current.collection=this.collection[t||0],this.current.externalTrigger=!0,this.current.element=e,e.isContentEditable?this.insertTextAtCursor(this.current.collection.trigger):this.insertAtCaret(e,this.current.collection.trigger),this.showMenuFor(e)}placeCaretAtEnd(e){if(e.focus(),typeof window.getSelection<"u"&&typeof document.createRange<"u"){var t=document.createRange();t.selectNodeContents(e),t.collapse(!1);var i=window.getSelection();i.removeAllRanges(),i.addRange(t)}else if(typeof document.body.createTextRange<"u"){var r=document.body.createTextRange();r.moveToElementText(e),r.collapse(!1),r.select()}}insertTextAtCursor(e){var t,i;t=window.getSelection(),i=t.getRangeAt(0),i.deleteContents();var r=document.createTextNode(e);i.insertNode(r),i.selectNodeContents(r),i.collapse(!1),t.removeAllRanges(),t.addRange(i)}insertAtCaret(e,t){var i=e.scrollTop,r=e.selectionStart,o=e.value.substring(0,r),s=e.value.substring(e.selectionEnd,e.value.length);e.value=o+t+s,r=r+t.length,e.selectionStart=r,e.selectionEnd=r,e.focus(),e.scrollTop=i}hideMenu(){this.menu&&(this.menu.style.cssText="display: none;",this.isActive=!1,this.menuSelected=0,this.current={})}selectItemAtIndex(e,t){if(e=parseInt(e),typeof e!="number"||isNaN(e))return;let i=this.current.filteredItems[e],r=this.current.collection.selectTemplate(i);r!==null&&this.replaceText(r,t,i)}replaceText(e,t,i){this.range.replaceTriggerText(e,!0,!0,t,i)}_append(e,t,i){if(typeof e.values=="function")throw new Error("Unable to append to values, as it is a function.");i?e.values=t:e.values=e.values.concat(t)}append(e,t,i){let r=parseInt(e);if(typeof r!="number")throw new Error("please provide an index for the collection to update.");let o=this.collection[r];this._append(o,t,i)}appendCurrent(e,t){if(this.isActive)this._append(this.current.collection,e,t);else throw new Error("No active state. Please use append instead and pass an index.")}detach(e){if(!e)throw new Error("[Tribute] Must pass in a DOM node or NodeList.");if(typeof jQuery<"u"&&e instanceof jQuery&&(e=e.get()),e.constructor===NodeList||e.constructor===HTMLCollection||e.constructor===Array){let i=e.length;for(var t=0;t{e.removeAttribute("data-tribute"),this.isActive=!1,e.tributeMenu&&e.tributeMenu.remove()})}}function Lt(){const n=".kanka-mentions",e=document.querySelector(n);if(!e)return;const t=e.dataset.remote,i=new H({values:function(s,a){o(s,c=>a(c))},lookup:"name",menuShowMinLength:3,selectTemplate:function(s){return"["+s.original.model_type+":"+s.original.id+"]"},noMatchTemplate:function(){return null}});document.querySelectorAll(n).forEach(s=>{s.dataset.mentions!=="1"&&(s.dataset.mentions=1,i.attach(s))});function o(s,a){let c=new XMLHttpRequest;c.onreadystatechange=function(){if(c.readyState===4)if(c.status===200){let h=JSON.parse(c.responseText);a(h)}else c.status===403&&a([])};let d=t+"?q="+s;c.open("GET",d,!0),c.send()}}const Ie=()=>{document.querySelectorAll("form[data-shortcut]").forEach(function(e){St(e)})},De=()=>{document.addEventListener("keydown",function(n){const e=n.target,t=document.getElementById("primary-dialog"),i=document.querySelector(".quick-creator-button");let r=document.querySelector('[data-keyboard="edit"]');if(n.key==="]"){if(X(e))return;n.preventDefault();const o=document.querySelector(".sidebar-toggle");o.click(),o.blur()}else if(n.key==="k"){if(X(e))return;n.preventDefault(),document.getElementById("entity-lookup").focus()}else if(n.key==="n"&&!(n.ctrlKey||n.metaKey)&&!n.altKey&&i){if(X(e)||t!=null&&t.open)return;i.click()}else if(n.key==="e"&&!(n.ctrlKey||n.metaKey)&&r){if(X(e)||t!=null&&t.open)return;r.click()}else n.key==="Escape"&&(t==null?void 0:t.classList.contains("qq-modal-selection").length)===1&&window.closeDialog(t)})},X=n=>!n||n.length===0?!1:["input","textarea","select"].includes(n.tagName.toLowerCase())||n.getAttribute("contentEditable")==="true"?!0:!!n.classList.contains("CodeMirror"),St=n=>{n.dataset.shortcutInit||(n.dataset.shortcutInit=1,document.addEventListener("keydown",function(e){if((e.ctrlKey||e.metaKey)&&e.key.toLowerCase()==="s")return e.preventDefault(),n.dataset.unload&&(window.entityFormHasUnsavedChanges=!1),e.shiftKey?re("submit-update"):e.altKey&&re("submit-new"),n.requestSubmit(),!1;if((e.ctrlKey||e.metaKey)&&e.altKey&&e.key==="c")return n.dataset.unload&&(window.entityFormHasUnsavedChanges=!1),re("submit-copy"),n.submit(),!1}))},re=n=>{const e=document.getElementById("form-submit-main");e&&(e.name=n,document.getElementById("submit-mode").name=n)},je=()=>{document.querySelectorAll('input[data-paste="fontawesome"]').forEach(function(e){e.addEventListener("paste",function(t){t.preventDefault();const i=(t.clipboardData||window.clipboardData).getData("text");if(i.startsWith('s.json()).then(s=>{o.innerHTML="",s.forEach(a=>{const c=document.createElement("a");c.href=a.url,c.text=a.name,o.appendChild(c)}),s.length>0&&i.classList.remove("hidden")})}))}const He=()=>{if(oe=document.querySelectorAll(".form-submit-actions"),oe.length===0)return;let n=document.getElementById("form-submit-main"),e=document.getElementById("submit-mode");if(e===void 0)throw new Error("No submit mode hidden input found");oe.forEach(t=>{t.addEventListener("click",function(i){return i.preventDefault(),e.name=t.dataset.action,n.click(),!1})})};function qt(){if(document.querySelectorAll('form[data-unload="1"]').length===0)return;const e=document.querySelector("#form-submit-main");document.querySelectorAll('form[data-unload="1"] input, form[data-unload="1"] select, form[data-unload="1"] textarea').forEach(i=>{i.dataset.skipUnsaved||i.classList.contains("form-control")||(i.addEventListener("change",function(){window.entityFormHasUnsavedChanges=!0}),i.classList.contains("select2")&&(i.onchange=()=>{window.entityFormHasUnsavedChanges=!0}))}),e&&window.addEventListener("beforeunload",function(i){window.entityFormHasUnsavedChanges&&(i.preventDefault(),i.returnValue="Unsaved data warning")})}const Ct=()=>{document.querySelectorAll(".dynamic-row-add").forEach(e=>{e.addEventListener("click",function(t){t.preventDefault();const i=e.dataset.target,r=e.dataset.template,o=document.createElement("div");return o.innerHTML=document.querySelector("#"+r).innerHTML,document.querySelector("."+i).append(o),Se(),window.triggerEvent(),!1})}),Se()},Se=()=>{document.querySelectorAll(".dynamic-row-delete").forEach(e=>{e.dataset.init!==1&&(e.dataset.init=1,e.addEventListener("click",function(t){t.preventDefault(),e.closest(".parent-delete-row").remove()}),e.addEventListener("keydown",function(t){t.key==="Enter"&&e.click()}))})};Ct();He();qt();Et();Tt();const Pe=()=>{const n=document.querySelector(".btn-post-collapse");n==null||n.addEventListener("click",function(t){t.preventDefault(),document.querySelectorAll(".element-toggle").forEach(r=>{r.classList.add("animate-collapsed"),document.querySelector(r.dataset.target).classList.add("hidden")})});const e=document.querySelector(".btn-post-expand");e==null||e.addEventListener("click",function(t){t.preventDefault(),document.querySelectorAll(".element-toggle").forEach(r=>{r.classList.remove("animate-collapsed"),document.querySelector(r.dataset.target).classList.remove("hidden")})})},Ne=()=>{const n=document.querySelector(".story-load-more");n==null||n.addEventListener("click",function(e){return e.preventDefault(),this.classList.add("loading"),axios.get(this.dataset.url).then(t=>{n.parentNode.remove(),console.log(t),document.querySelector(".entity-posts").insertAdjacentHTML("beforeend",t.data),Ne(),Pe(),window.triggerEvent()}).catch(()=>{n.classList.remove("loading")}),!1})},At=()=>{const n=document.querySelector(".domain-trust");n&&n.addEventListener("click",function(e){const t="kanka_trusted_domains";let i=document.cookie.match("(^|;) ?"+t+"=([^;]*)(;|$)");i=i?i[2]:"";const r=n.dataset.domain;i.includes(r)||(i&&(i+="|"),i+=r);let o=new Date;o.setTime(o.getTime()+30*24*60*60*1e3),document.cookie=t+"="+i+";path=/;expires="+o.toUTCString()+";sameSite=Strict"})};Pe();Ne();At();const Be=document.querySelectorAll(".post-perm-add"),Mt=()=>{window.onEvent(function(){Dt()}),Be.length!==0&&(It(),Re())},It=()=>{Be.forEach(n=>{n.addEventListener("click",function(e){e.preventDefault();let t=this.dataset.type,i=document.querySelector('select[name="'+t+'"]');if(!i||!i.value)return!1;let r=i.textContent;const s=document.getElementById("post-perm-"+t+"-template").cloneNode(!0);return s.classList.remove("hidden"),s.removeAttribute("id"),s.innerHTML=s.innerHTML.replace(/\$SELECTEDID\$/g,i.value).replace(/\$SELECTEDNAME\$/g,r),document.getElementById("post-perm-target").insertAdjacentElement("afterend",s),document.getElementById("post-new-"+t).close(),Re(),i.value="",i.dispatchEvent(new Event("change")),!1})})},Re=()=>{const n=document.querySelectorAll(".post-delete-perm");console.log(n),n.forEach(e=>{e.addEventListener("click",function(t){console.log("clicking"),e.closest(".perm-row").remove(),t.preventDefault(),e.removeEventListener("click",arguments.callee)})})},Dt=()=>{const n=document.querySelector("form.post-visibility");n&&(n.onsubmit=function(e){return e.preventDefault(),axios.post(this.getAttribute("action"),{visibility_id:this.querySelector('[name="visibility_id"]').value}).then(t=>{document.getElementById("primary-dialog").close(),document.getElementById("visibility-icon-"+t.data.post_id).innerHTML=t.data.icon,window.showToast(t.data.toast)}),!1})};Mt();const jt=()=>{let n=document.getElementById("post-layout-selector");if(!n)return;const e=document.querySelector(".field-entry"),t=document.querySelector(".field-location"),i=document.querySelector(".field-display"),r=document.querySelector("#post-layout-subform");n.addEventListener("change",function(o){o.preventDefault(),this.value===""?(e.style.removeProperty("display"),e.style.removeProperty("display"),i.style.removeProperty("display"),r.style.display="none"):(e.style.display="none",t.style.display="none",i.style.display="none",r.style.removeProperty("display"))})};jt();const Ht=()=>{if(!document.querySelector("#calendar-year-switcher"))return;document.querySelectorAll(".calendar-event-block").forEach(e=>{e.dataset.toggle!=="dialog"&&e.dataset.url&&e.addEventListener("click",function(){window.location=e.dataset.url})})},Fe=()=>{var o,s,a;const n=document.querySelector('select[name="recurring_periodicity"]');if(!n)return;n.onchange=function(){const c=document.querySelector(".field-recurring-until");n.value?c.classList.remove("hidden"):c.classList.add("hidden")};const e=document.querySelector("#calendar-event-first"),t=document.querySelector(".calendar-new-event-field"),i=document.querySelector(".calendar-existing-event-field"),r=document.querySelector("#calendar-event-subform");(o=document.querySelector("#calendar-action-existing"))==null||o.addEventListener("click",function(c){c.preventDefault(),e.classList.add("!hidden"),t.classList.add("hidden"),i.classList.remove("hidden"),r.classList.remove("hidden")}),(s=document.querySelector("#calendar-action-new"))==null||s.addEventListener("click",function(c){c.preventDefault(),e.classList.add("!hidden"),t.classList.remove("hidden"),i.classList.add("hidden"),r.classList.remove("hidden")}),(a=document.querySelector("#calendar-event-switch"))==null||a.addEventListener("click",function(c){c.preventDefault(),r.classList.add("hidden"),e.classList.remove("!hidden"),i.classList.remove("hidden"),t.classList.remove("hidden")})},Pt=()=>{document.querySelector('[data-shortcut="previous"]')&&document.addEventListener("keydown",function(n){if((n.ctrlKey||n.metaKey)&&n.which===37){const e=document.querySelector('[data-shortcut="previous"]');e.classList.add("loading"),e.click()}else if((n.ctrlKey||n.metaKey)&&n.which===39){const e=document.querySelector('[data-shortcut="next"]');e.classList.add("loading"),e.click()}})};Ht();Pt();document.querySelector('select[name="recurring_periodicity"]')&&Fe();window.onEvent(function(){Fe()});let P,ue,k,se,D,I,q,W,ee,R;window.onEvent(function(){Bt()});const Nt=()=>{P=document.querySelector("#entity-calendar-form-add"),k=document.querySelector('select[name="calendar_id"]'),se=document.querySelector('input[name="calendar_id"]'),document.querySelector(".entity-calendar-modal-form"),R=document.querySelector(".entity-calendar-subform"),W=document.querySelector("#entity-calendar-form-cancel"),ue=document.querySelector(".entity-calendar-form"),I=document.querySelector('input[name="calendar_year"]'),D=document.querySelector('[name="calendar_month"]'),q=document.querySelector("#reminder_day"),ee=document.querySelector(".entity-calendar-loading"),P&&(P.addEventListener("click",function(n){n.preventDefault(),P.classList.add("hidden"),ue.classList.remove("hidden");let e=P.dataset.defaultCalendar;return e&&(se.value=e,W.classList.remove("hidden"),R.classList.remove("hidden"),te(e)),!1}),W.addEventListener("click",function(n){n.preventDefault(),k.value=null,se.value=null,W.classList.add("hidden"),fe()})),k&&(k.onchange=n=>{if(R.classList.add("hidden"),!k.value)return fe(),!1;I=document.querySelector('input[name="calendar_year"]'),D=document.querySelector('[name="calendar_month"]'),q=document.querySelector("#reminder_day"),!I&&document.querySelector('input[name="year"]')&&(I=document.querySelector('input[name="year"]'),D=document.querySelector('select[name="month"]'),q=document.querySelector("#reminder_day")),te(k.value)}),Oe()},Bt=()=>{if(!document.getElementById("entity-calendar-modal-add"))return;P=document.querySelector("input[name=calendar-data-url]"),k=document.querySelector('select[name="calendar_id"]'),I=document.querySelector('input[name="year"]'),D=document.querySelector('select[name="month"]'),q=document.querySelector("#reminder_day"),ee=document.querySelector(".entity-calendar-loading"),R=document.querySelector(".entity-calendar-subform"),k&&(k.onchange=e=>{if(R.classList.add("hidden"),!k.value){fe();return}te(k.value)},k!=null&&k.value&&(W.classList.remove("hidden"),R.classList.remove("hidden"),te(k.value)));const n=document.querySelector('.entity-calendar-subform input[name="length"]');n&&n.addEventListener("focusout",function(){if(!this.value)return;const e=this.dataset.url.replace("/0/","/"+k.value+"/"),t={day:q.value,month:D.value,year:I.value,length:this.value};axios.get(e,{data:t}).then(i=>{const r=document.querySelector(".length-warning");i.data.overflow==!0?r.classList.remove("hidden"):r.classList.add("hidden")})}),Oe()},te=n=>{ee.classList.remove("hidden"),n=parseInt(n);const e=document.querySelector('input[name="calendar-data-url"]').dataset.url.replace("/0/","/"+n+"/");fetch(e).then(t=>t.json()).then(t=>{let i=q.value;I.innerHTML="",D.innerHTML="",q.innerHTML="";let r=1,o=1;i||(i=t.current.day);let s=parseInt(t.current.month);Object.entries(t.months).forEach((h,g)=>{const p=document.createElement("option");p.text=h[1].name,p.value=g+1,h[0]===s&&(p.selected=!0),p.dataset.length=h[1].length,D.appendChild(p),r===s&&(o=h[1].length),r++});for(let h=1;h0;)c.options.remove(0);Object.entries(t.recurring).forEach((h,g)=>{const p=document.createElement("option");p.value=h[0],p.text=h[1],c.appendChild(p)}),document.querySelector("#reminder_length").value=1,t.length===1&&(D.value=t[0].id)})},fe=()=>{ue.classList.add("hidden"),P.classList.remove("hidden"),document.querySelector('[name="calendar_day"]').value=null,document.querySelector('[name="calendar_month"]').value=null,document.querySelector('input[name="calendar_year"]').value=null,document.querySelector('select[name="calendar_id"]').value=null},Oe=()=>{const n=document.querySelector("#reminder_month");n&&n.addEventListener("change",function(e){const i=n.options[n.selectedIndex].dataset.length;Rt(i)})},Rt=n=>{let e=parseInt(q.value);n=parseInt(n),e>n&&(e=n),q.innerHTML="";for(let t=1;t<=n;t++){const i=document.createElement("option");i.text=t,i.value=t,t==e&&(i.selected=!0),q.appendChild(i)}};Nt();const Qe=document.querySelector("dialog#edit-warning"),he=300*1e3;let Ft=document.querySelector('input[name="edit-warning"]'),ze,me=!0;const Ot=()=>{Qe&&(window.openDialog("edit-warning",Ft.dataset.url),window.onEvent(function(){Qt()}),zt())};function Qt(){me=!1;const n=document.getElementById("entity-edit-warning-ignore");n.addEventListener("click",function(e){e.preventDefault(),me=!0,axios.post(n.dataset.url).then(()=>{Qe.close()})})}const zt=()=>{const n=document.getElementById("editing-keep-alive");n&&(ze=n.dataset.url,setTimeout(ge,he))},ge=()=>{if(!me){setTimeout(ge,he);return}axios.post(ze).then(()=>{setTimeout(ge,he)})};Ot();let U,Ke,Ue,V;const ye=()=>{Ke=document.querySelector("#qq-modal-loading"),Ue=document.querySelector("#qq-modal-selection"),V=document.querySelector("#qq-modal-form"),document.querySelectorAll('[data-toggle="entity-creator"]').forEach(n=>{n.addEventListener("click",Kt)})},Kt=n=>{var i;n.preventDefault();const e=n.currentTarget;return e.dataset.type==="inline"?(document.querySelector(".quick-creator-body").classList.add("hidden"),(i=document.querySelector(".quick-creator-footer"))==null||i.classList.add("hidden"),document.querySelector(".quick-creator-loading").classList.remove("!hidden")):Ut(),axios.get(e.dataset.url).then(r=>{Ke.classList.add("!hidden"),Ue.classList.add("!hidden"),V.innerHTML=r.data,V.classList.remove("!hidden"),be(),we(),window.triggerEvent()}),!1},We=()=>{const n=document.querySelector("#qq-name-field");!n||n.dataset.init==="1"||(n.dataset.init="1",n.addEventListener("focusout",function(){if(!this.value)return;const e=this.parentNode.querySelector(".duplicate-entity-warning");e.classList.add("hidden");const t=this.dataset.live+"?q="+this.value+"&type="+this.dataset.type;axios.get(t).then(i=>{if(i.data.length===0){e.classList.add("hidden");return}const r=Object.keys(i.data).map(function(o){return''+i.data[o].name+""}).join(", ");n.parentNode.querySelector(".duplicate-entities").innerHTML=r,e.classList.remove("hidden")})}))},Ut=()=>{document.querySelector("#qq-modal-form").classList.add("!hidden"),document.querySelector("#qq-modal-selection").classList.add("!hidden"),document.querySelector("#qq-modal-loading").classList.remove("!hidden")},be=()=>{U=document.querySelectorAll(".quick-creator-submit"),U.length!==0&&(We(),we(),U.forEach(n=>{n.addEventListener("click",function(e){let t=this.value;return t&&(document.querySelector('#entity-creator-form [name="action"]').value=t),!0})}),document.getElementById("entity-creator-form").onsubmit=function(n){const e=n.target;n.preventDefault(),U.forEach(r=>r.classList.add("btn-disabled","loading")),document.querySelectorAll("div.text-error").forEach(r=>r.remove());const i=new FormData(e);axios.post(e.getAttribute("action"),i).then(r=>{var s,a;if(typeof r.data=="object"){if(r.data.redirect){window.location.replace(r.data.redirect);return}let c=new Option(r.data._name,r.data._id),d=document.querySelector("#"+r.data._target);if(r.data._multi){let p=d.value;p.push(r.data._id),d.appendChild(c),d.value=p}else{for(;d.options.length>0;)d.options.remove(0);d.appendChild(c),d.value=r.data._id}d.dispatchEvent(new Event("change"));const h=document.querySelector("#qq-modal-form");h&&(h.innerHTML="",h.classList.remove("!hidden")),(s=document.querySelector("#qq-modal-loading"))==null||s.classList.add("!hidden"),(a=document.querySelector("#qq-modal-selection"))==null||a.classList.remove("!hidden"),document.getElementById("primary-dialog").close(),pe();return}let o=document.getElementById("qq-modal-form");o.innerHTML=r.data,window.triggerEvent(),ye(),pe()}).catch(r=>{r.response&&window.formErrorHandler(r.response,e),U.forEach(o=>o.classList.remove("btn-disabled","loading")),document.querySelector('#entity-creator-form [name="action"]').value=""})})},we=()=>{var n;document.querySelectorAll(".qq-mode-toggle").forEach(e=>{e.addEventListener("click",function(t){var i;t.preventDefault(),!this.classList.contains("active")&&(document.querySelector(".qq-mode-toggle").classList.remove("active"),this.classList.add("active"),document.querySelector(".quick-creator-body").classList.add("hidden"),(i=document.querySelector(".quick-creator-footer"))==null||i.classList.add("hidden"),document.querySelector(".quick-creator-loading").classList.remove("!hidden"),axios.get(this.dataset.url).then(r=>{V.innerHTML=r.data,V.classList.remove("!hidden"),pe(),window.triggerEvent()}))})}),(n=document.querySelector(".qq-action-more"))==null||n.addEventListener("click",function(e){e.preventDefault(),this.classList.add("hidden"),document.querySelector(".qq-more-fields").classList.remove("hidden")}),ye()},pe=()=>{we(),We(),be()},Wt=()=>{document.querySelectorAll(".quick-creator-subform").forEach(e=>{e.addEventListener("click",t=>{window.openDialog("primary-dialog",e.dataset.url)})})};window.onEvent(function(){ye(),be()});Wt();const Ve=()=>{const n=document.querySelectorAll("[data-bulk-action]");n==null||n.forEach(t=>{t.addEventListener("click",i=>{i.preventDefault(),Gt(t.dataset.bulkAction)})});const e=document.querySelectorAll(".bulk-print");e==null||e.forEach(t=>{t.addEventListener("click",i=>{i.preventDefault(),t.closest("form").requestSubmit()})})},Vt=()=>{Yt();const n=document.querySelectorAll("input[name='model[]']");n==null||n.forEach(e=>{e.addEventListener("change",t=>{t.preventDefault(),_e()})})},Yt=()=>{const n=document.querySelector("#datagrid-select-all");n&&n.dataset.loaded!=="1"&&(n.dataset.loaded="1",n.addEventListener("click",function(e){const t=document.querySelectorAll("input[name='model[]']");n.checked?t==null||t.forEach(i=>{i.checked=!0}):t==null||t.forEach(i=>{i.checked=!1}),_e()}))},Gt=n=>{let e=[];const t=document.querySelectorAll("input[name='model[]']");t==null||t.forEach(i=>{i.checked&&e.push(i.value)}),n==="ajax"?window.onEvent(function(){document.querySelector('#primary-dialog input[name="models"]').value=e.toString()}):document.querySelector("#datagrid-bulk-"+n+"-models").value=e.toString()},_e=()=>{let n=!0;const e=document.querySelectorAll("input[name='model[]']");e==null||e.forEach(i=>{i.checked&&(n=!1)});const t=document.querySelectorAll(".datagrid-bulk-actions .btn2");t==null||t.forEach(i=>{n?(i.disabled=!0,i.classList.add("btn-disabled")):(i.disabled=!1,i.classList.remove("btn-disabled","disabled"))})},Xt=()=>{const n=document.querySelector(".list-treeview");if(!n)return;let e=n.dataset.url;document.querySelectorAll(".table-nested > tbody > tr").forEach(function(i){let r=i.dataset.children;parseInt(r)>0&&(i.classList.add("tr-hover"),i.classList.add("cursor-pointer"),i.addEventListener("click",function(o){const s=o.target;o.target.type!=="checkbox"&&s.dataset.tree!=="escape"&&(window.location=e+"?parent_id="+i.dataset.id+"&m=table")}))})};Vt();Ve();_e();Xt();window.onEvent(function(){Ve()});let Q;const Zt=new IntersectionObserver(function(n){n.forEach(e=>{e.isIntersecting===!0&&xe(e.target)})},{threshold:[0]}),Ye=()=>{const n=document.querySelectorAll('table[data-render="datagrid2"]');n==null||n.forEach(e=>{xe(e)})},xe=n=>{n.dataset.initiated!=="1"&&(n.dataset.initiayed="1",Jt(n),en(n),n.dataset.url&&ve(n,n))},Jt=n=>{var e,t;(e=n.querySelectorAll("thead a"))==null||e.forEach(i=>{i.dataset.loaded!=="1"&&(i.dataset.loaded="1",i.addEventListener("click",function(r){r.preventDefault(),ve(i,n)}))}),(t=n.parentNode.querySelectorAll('nav[role="navigation"] a'))==null||t.forEach(i=>{i.dataset.loaded!=="1"&&(i.dataset.loaded="1",i.addEventListener("click",r=>{r.preventDefault(),ve(i,n)}))})},$t=()=>{const n=document.querySelectorAll('[data-render="datagrid2-onload"]');n.length!==0&&n.forEach(e=>{Zt.observe(e)})},ve=(n,e)=>{var i,r,o;(i=e.querySelector("thead"))==null||i.classList.add("hidden"),(r=e.querySelector("tbody"))==null||r.classList.add("hidden"),(o=e.querySelector("tfoot"))==null||o.classList.remove("hidden");let t=n.getAttribute("href");n.dataset.url&&(t=n.dataset.url),e.parentNode&&axios.get(t).then(s=>{const a=e.parentNode;s.data.html&&(a.innerHTML=s.data.html),s.data.deletes&&(document.querySelector("#datagrid-delete-forms").innerHTML=s.data.deletes),s.data.url&&window.history.pushState({},"",s.data.url);const c=a.querySelector('[data-render="datagrid2"]');xe(c),window.triggerEvent()}).catch(s=>{console.error("datagrid2 error",e,e.parentNode)})},en=n=>{var r;const e=n.parentNode,t=e.querySelectorAll(".datagrid-bulk");t==null||t.forEach(o=>{tn(n,o)});const i=e.querySelectorAll(".datagrid-submit");i==null||i.forEach(o=>{o.addEventListener("click",function(s){var c;s.preventDefault(),Q=o.closest("form");const a=Q.querySelector('input[name="action"]');if(a.value=o.dataset.action,o.dataset.action==="delete")return window.openDialog("datagrid-bulk-delete"),!1;(c=n.parentNode.querySelectorAll(".datagrid-bulk-actions .btn2"))==null||c.forEach(d=>d.classList.add("btn-disabled")),n.parentNode.querySelector(".datagrid-bulk-actions .btn2").classList.add("loading"),Q.submit()})}),(r=document.querySelector("#datagrid-action-confirm"))==null||r.addEventListener("click",function(){window.closeDialog("datagrid-bulk-delete"),Q.submit()})},tn=(n,e)=>{e.dataset.loaded!=="1"&&(e.dataset.loaded="1",e.addEventListener("click",function(t){t.preventDefault(),Q=n.closest("form"),axios.post(Q.getAttribute("action")+"?action=edit",{model:nn(n)}).done(i=>{const r=document.getElementById("primary-dialog");r.innerHTML=i.data,window.openDialog("primary-dialog"),window.triggerEvent()})}))},nn=n=>{let e=[];const t=n.querySelectorAll("input[name='model[]']");return t==null||t.forEach(i=>{i.checked&&e.push(i.value)}),e};$t();Ye();window.onEvent(function(){Ye()});const Ge=()=>{document.querySelectorAll('[data-animate="collapse"]').forEach(t=>{t.addEventListener("click",rn)}),document.querySelectorAll('[data-animate="reveal"]').forEach(t=>{t.addEventListener("change",on)})};function rn(n){let e=this.dataset.target;e||(e=this.hash),document.querySelectorAll(e).forEach(i=>{i.classList.toggle("hidden")}),this.classList.toggle("animate-collapsed")}function on(n){let e=document.querySelector(this.dataset.target);this.value?e.classList.remove("hidden"):e.classList.add("hidden")}window.onEvent(function(){Ge()});Ge();const sn=()=>{const n=document.getElementById("bookmark-selector");if(!n)return!1;n.addEventListener("change",function(e){e.preventDefault();let t=n.options[n.selectedIndex];document.querySelectorAll(".bookmark-subform").forEach(o=>{o.classList.add("hidden")});let r=document.querySelector(t.dataset.target);r&&r.classList.remove("hidden")})},ln=()=>{const n=document.getElementById("entity-selector");if(n)n.value!==""&&document.getElementById("filter-subform").style.removeProperty("display");else return!1;n.addEventListener("change",function(){n.value===""?document.getElementById("filter-subform").style.display="none":document.getElementById("filter-subform").style.removeProperty("display")})};sn();ln();const an=()=>{let n=document.getElementById("webhook-selector");if(!n)return!1;n.addEventListener("change",function(e){var i;e.preventDefault();let t=this.options[this.selectedIndex];document.querySelector(".webhook-subform").classList.add("hidden"),(i=document.querySelector(t.dataset.target))==null||i.classList.remove("hidden")})};an();window.onEvent(function(){Xe()});const Xe=()=>{document.querySelectorAll(".form-members").forEach(e=>{if(e.dataset.loaded===1)return;e.dataset.loaded=1;let t=e.dataset.allowClear;$(e).select2({tags:!0,allowClear:t||!0,minimumInputLength:2,ajax:{quietMillis:500,delay:500,url:e.dataset.url,dataType:"json",data:function(i){var r;return{q:(r=i.term)==null?void 0:r.trim()}},processResults:function(i){return{results:i}},cache:!0},createTag:function(){}})})};Xe();const cn=()=>{if(!document.getElementById("campaign-modules"))return;document.querySelectorAll('input[name="enabled"]').forEach(function(t){dn(t)})},dn=n=>{n.addEventListener("change",function(e){e.preventDefault(),n.closest(".toggle").classList.add("!hidden"),n.closest(".box-module").querySelector(".action-loading").classList.remove("hidden"),axios.post(n.dataset.url).then(t=>{n.closest(".toggle").classList.remove("!hidden"),n.closest(".box-module").querySelector(".action-loading").classList.add("hidden"),t.data.success&&(t.data.status?n.closest(".box-module").classList.add("module-enabled"):n.closest(".box-module").classList.remove("module-enabled"),window.showToast(t.data.toast))})})},un=()=>{document.querySelectorAll(".public-permission").forEach(e=>{e.addEventListener("click",fn)})},fn=n=>{n.preventDefault(),globalThis.querySelector(".module-icon").classList.add("hidden"),globalThis.querySelector(".loading-animation").classList.remove("hidden"),axios.post(globalThis.dataset.url).then(e=>{globalThis.querySelector(".module-icon").classList.remove("hidden"),globalThis.querySelector(".loading-animation").classList.add("hidden"),e.data.success&&(e.data.status?globalThis.classList.add("enabled"):globalThis.classList.remove("enabled"),window.showToast(e.data.toast))})},hn=()=>{document.querySelectorAll(".codemirror").forEach(function(e){CodeMirror.fromTextArea(document.getElementById(e.id),{extraKeys:{"Ctrl-Space":"autocomplete"},lineNumbers:!0,lineWrapping:!0,theme:"dracula"})})},mn=()=>{let n=[].slice.call(document.querySelectorAll(".nested-sortable"));for(let e=0;e{const n=document.querySelector("form#campaign-style");n&&n.addEventListener("submit",function(e){let t=document.querySelector(n.dataset.error);return document.querySelector('textarea[name="content"]').value.length{const n=document.querySelector('input[name="vanity"]');n&&n.addEventListener("focusout",function(e){let t=this.value,i=document.getElementById("vanity-error"),r=document.getElementById("vanity-success"),o=document.getElementById("vanity-loading");if(i.innerHTML="",i.classList.add("hidden"),r.classList.add("hidden"),!t)return;r.classList.remove("hidden");let s={};s.vanity=t,axios.post(this.dataset.url,s).then(a=>{n.value=a.data.vanity,r.querySelector("code").innerHTML=a.data.vanity,i.classList.add("hidden"),o.classList.add("hidden"),r.classList.remove("hidden")}).catch(a=>{let c="";a.response.data.errors.vanity.forEach(d=>c+=d+" "),i.innerHTML=c,i.classList.remove("hidden"),r.classList.add("hidden"),o.classList.add("hidden")})})},vn=()=>{document.querySelectorAll(".permission-toggle").forEach(e=>{e.addEventListener("change",function(t){let i=this.dataset.action;document.querySelectorAll('input[data-action="'+i+'"]').forEach(o=>{this.checked?o.checked=!0:o.checked=!1})})})};cn();hn();mn();un();gn();pn();vn();const Ze=()=>{document.querySelectorAll("[data-clipboard]").forEach(e=>{e.addEventListener("click",yn,!1)})};function yn(n){n.preventDefault(),bn(this.dataset.clipboard,this);let e=this.dataset.toast;return e&&window.showToast(e),!1}async function bn(n,e){if(navigator.clipboard&&window.isSecureContext)await navigator.clipboard.writeText(n);else{const t=document.createElement("textarea");t.value=n,t.style.position="absolute",t.style.left="-999999px",e.append(t),t.select();try{document.execCommand("copy")}catch(i){console.error(i)}finally{t.remove()}}}Ze();window.onEvent(function(){Ze()});const Je=()=>{document.querySelectorAll('.toast-container [data-toggle="dismiss"]').forEach(e=>{e.dataset.init!=="1"&&(e.dataset.init="1",e.addEventListener("click",function(t){t.preventDefault();let i=e.closest(".toast-message");i.classList.remove("opacity-100"),i.classList.add("opacity-0"),setTimeout(function(){i.remove()},150)}))})};window.showToast=function(n,e){e=e||"bg-success text-success-content",e==="error"&&(e="bg-error text-error-content");const t=document.createElement("div");t.classList.add("opacity-100","duration-150","transition-opacity","rounded"),e&&e.split(" ").forEach(r=>{t.classList.add(r)}),t.innerHTML='
    '+n+'
    ',document.querySelector(".toast-container").appendChild(t),setTimeout(function(){t.classList.remove("opacity-100"),t.classList.add("opacity-0"),setTimeout(function(){t.remove()},150)},3e3),Je()};Je();const wn=()=>{document.querySelectorAll(".banner-notification-dismiss").forEach(n=>{n.addEventListener("click",_n,!1)}),document.querySelectorAll('[data-dismiss="tutorial"]').forEach(n=>{n.addEventListener("click",xn,!1)})};function _n(n){n.preventDefault();let e=this.dataset.dismiss;axios.post(this.dataset.url).then(()=>{if(!e)return;let t=document.querySelector(e);t&&t.classList.add("hidden")})}function xn(n){n.preventDefault();let e=this.dataset.target;axios.post(this.dataset.url).then(()=>{if(!e)return;let t=document.querySelector(e);t&&t.classList.add("hidden")})}wn();let $e;const kn=()=>{const n=document.getElementById("element-era-id");n&&($e=n.value,n.addEventListener("change",function(){Ln(n.value)}))},Ln=n=>{n=parseInt(n);let e=document.querySelector('input[name="era-data-url"]').dataset.url.replace("/0/","/"+n+"/"),t=document.querySelector('input[name="oldPosition"]').dataset.url;axios.get(e).then(i=>{let r=document.querySelector('select[name="position"]');r.innerHTML="";let o=1;Object.entries(i.data.positions).forEach(function(a,c){const d=document.createElement("option");d.text=a[1],t&&!c&&$e==n&&(d.value=1,r.appendChild(d)),c&&(d.value=o,r.appendChild(d)),o++})})};kn();window.initSortable=function(){let n=document.querySelectorAll(".sortable-elements");n.length!==0&&n.forEach(e=>{let t={},i=e.dataset.handle;i&&(t.handle=i),qe.create(e,t)})};window.initSortable();window.formErrorHandler=function(n,e){document.querySelectorAll(".input-error").forEach(d=>{d.classList.remove("input-error")});const i=document.querySelector(".text-error");i&&i.remove();const r=e.querySelector(".btn-primary");if(r&&(r.disabled=!1,r.classList.remove("loading")),n.status===503){window.showToast(n.data.message,"error");return}if(n.status===403){document.querySelector("#entity-form-403-error").classList.remove("hidden");return}if(!n.data.errors){window.showToast("Backend error","error");return}const o=n.data.errors;let s=[];const a=Object.keys(o);let c=!0;if(a.forEach(function(d){let h=document.querySelector('[name="'+d+'"]');if(h){h.classList.add("input-error");const g=document.createElement("div");g.classList.add("text-error"),g.innerHTML=o[d][0],h.parentNode.append(g)}else c=!1,s.push(o[d][0]);window.showToast(o[d][0],"error")}),!c){const d=document.querySelector("#entity-form-generic-error .error-logs");d.innerHTML="",s.forEach(function(h){d.append(h)}),document.querySelector("#entity-form-generic-error").classList.remove("hidden")}Sn(e,o)};const Sn=(n,e)=>{const t=Object.keys(e)[0],i=n.querySelector('[name="'+t+'"]');if(!i)return;if(!n.querySelector(".tab-content")){Ee(i);return}document.querySelector(".tab-content .active").classList.remove("active"),document.querySelector(".nav-tabs li.active").classList.remove("active");const r=document.querySelector('[name="'+t+'"').closest(".tab-pane");r&&(r.classList.add("active"),document.querySelector('a[href="#'+r.id+'"]').closest("li").classList.add("active")),Ee(i)},Ee=n=>{n.focus(),n.scrollIntoView({behavior:"smooth"})};window.onEvent(function(){et()});const et=()=>{document.querySelectorAll('[data-toggle="private"]').forEach(e=>{En(e)})},En=n=>{n.dataset.togglerinit!=="1"&&(n.dataset.togglerinit="1",n.addEventListener("click",function(e){const t=n.previousElementSibling;n.classList.contains("fa-lock-keyhole")?(n.classList.remove("fa-lock-keyhole","fa-solid"),n.classList.add("fa-unlock-keyhole","fa-regular"),n.setAttribute("title",n.dataset.public),t.value=0):(n.classList.remove("fa-unlock-keyhole","fa-regular"),n.classList.add("fa-lock-keyhole","fa-solid"),n.setAttribute("title",n.dataset.private),t.value=1)}))},Tn=()=>{const n=document.querySelector('input[data-toggle="entity-privacy"]');n&&n.addEventListener("change",function(){let e=document.getElementById("entity-is-private");this.checked?e.classList.remove("hidden"):e.classList.add("hidden")})};et();Tn();const qn={class:"mx-5"},Cn=["data-title"],An=l("svg",{class:"h-6 w-6 transition-all duration-150 hover:rotate-45","data-sidebar":"collapse",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:"0 0 50 50"},[l("path",{d:"M 7.71875 6.28125 L 6.28125 7.71875 L 23.5625 25 L 6.28125 42.28125 L 7.71875 43.71875 L 25 26.4375 L 42.28125 43.71875 L 43.71875 42.28125 L 26.4375 25 L 43.71875 7.71875 L 42.28125 6.28125 L 25 23.5625 Z"})],-1),Mn=l("svg",{class:"h-6 w-6 transition-all duration-150 hover:rotate-90","data-sidebar":"expand",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:"0 0 50 50"},[l("path",{d:"M 0 9 L 0 11 L 50 11 L 50 9 Z M 0 24 L 0 26 L 50 26 L 50 24 Z M 0 39 L 0 41 L 50 41 L 50 39 Z"})],-1),In={class:"sr-only"},Dn=ut({__name:"NavToggler",props:{text:null,title:null},setup(n){const e=n,t=()=>{const o=document.querySelector("body");o.classList.contains("sidebar-collapse")?(o.classList.remove("sidebar-collapse"),i(!1)):(o.classList.add("sidebar-collapse"),i(!0))},i=o=>{let s=new Date;const a=90;s.setTime(s.getTime()+a*24*60*60*1e3);let c=" expires="+s.toGMTString(),d=location.protocol==="https:"?"secure; ":"";document.cookie="toggleState="+(o?"collapsed":"open")+"; path=/; "+d+"samesite=lax; "+c},r=()=>{let s=new RegExp("toggleState=([^;]+)").exec(document.cookie);(s!=null?decodeURI(s[1]):null)==="collapsed"&&document.querySelector("body").classList.add("sidebar-collapse")};return ft(()=>{r()}),(o,s)=>(u(),f("div",qn,[l("span",{role:"button",class:"sidebar-toggle text-center cursor-pointer fill-current hover:text-primary-focus","data-toggle":"tooltip","data-title":e.title,"data-placement":"right","data-html":"true",tabindex:"3",onClick:s[0]||(s[0]=a=>t())},[An,Mn,l("span",In,m(e.text),1)],8,Cn)]))}}),jn={props:["entity"],methods:{backgroundImage:function(n){return"url('"+n.image+"')"},preview:function(n){this.emitter.emit("preview",n)}}},Hn=["data-id"],Pn={class:"flex-none"},Nn=["href","title"],Bn={class:"flex-grow truncate pl-1"},Rn=["title","innerHTML"],Fn=["innerHTML"];function On(n,e,t,i,r,o){return u(),f("div",{class:"flex justify-center gap-1 cursor-pointer hover:bg-base-200 rounded w-full","data-id":t.entity.id,onClick:e[1]||(e[1]=s=>o.preview(t.entity))},[l("div",Pn,[l("a",{href:t.entity.link,style:z({backgroundImage:o.backgroundImage(t.entity)}),onClick:e[0]||(e[0]=ce(()=>{},["stop"])),title:t.entity.name,class:"rounded cover-background block h-16 w-16"},null,12,Nn)]),l("div",Bn,[l("div",{class:"font-extrabold entity-name truncate",title:t.entity.name,innerHTML:t.entity.name},null,8,Rn),l("div",{class:"entity-type text-xs",innerHTML:t.entity.type},null,8,Fn)])],8,Hn)}const tt=F(jn,[["render",On]]),Qn={props:["entity"],components:{LookupEntity:tt},data(){return{focus_profile:!0,focus_pins:!1,focus_access:!1}},methods:{hasTitle(){return this.entity.title},tagClass(n){let e="inline-block rounded-xl px-3 py-1 bg-base-100 text-base-content text-xs";return n.colour&&(e+=" bg-"+n.colour,n.colour==="black"&&(e+=" text-white")),e},backgroundImage:function(){return"url('"+this.entity.image+"')"},tabClass:function(n){let e="p-1 px-1 mx-1 pt-2 select-none text-center truncate border-b-2 border-solid border-r-0 border-t-0 border-l-0";return n==="profile"&&this.focus_profile||n==="links"&&this.focus_pins||n==="access"&&this.focus_access?e+=" font-black border-slate-600":e+=" cursor-pointer border-base-100",e},switchTab:function(n){this.focus_profile=!1,this.focus_pins=!1,this.focus_access=!1,n==="profile"?this.focus_profile=!0:n==="links"?this.focus_pins=!0:n==="access"&&(this.focus_access=!0)},profileClass:function(n){return"entity-profile-"+n.slug}}},zn={class:"entity-header p-3 bg-entity-focus"},Kn={class:"w-full flex items-center"},Un=["href","title","innerHTML"],Wn={key:0,class:"fa-solid fa-skull mx-2","aria-hidden":"true"},Vn=["href"],Yn=l("i",{class:"fa-solid fa-external-link","aria-hidden":"true","aria-label":"Open in a new window"},null,-1),Gn=[Yn],Xn=["innerHTML"],Zn={key:1,class:"my-1 w-full flex flex-wrap gap-1"},Jn=["href","data-tag-id","data-tag-slug","innerHTML"],$n=["href","data-tag"],ei=l("i",{class:"fa-duotone circle-location-arrow","aria-hidden":"true","aria-label":"Location"},null,-1),ti=["href","title"],ni={class:"entity-sections"},ii={class:"tabs flex my-2 justify-center items-center border-solid border-slate-600 border-b-2 border-r-0 border-t-0 border-l-0"},ri={key:0,class:"tab-profile p-5 flex flex-col gap-5"},oi={key:0,class:"entity-pinned-attributes flex flex-col gap-3"},si=["data-attribute","data-target"],li={class:"inline-block uppercase font-extrabold mr-1"},ai=["innerHTML"],ci={key:1},di={class:"flex flex-col gap-3"},ui={class:"uppercase font-extrabold truncate"},fi={key:1,class:"tab-links p-3"},hi={key:0,class:"text-center italic"};function mi(n,e,t,i,r,o){const s=B("LookupEntity");return u(),f(L,null,[l("div",zn,[l("div",Kn,[l("a",{class:"text-2xl font-extrabold entity-name",href:t.entity.link,title:t.entity.name,innerHTML:t.entity.name},null,8,Un),t.entity.is_dead?(u(),f("i",Wn)):v("",!0),l("a",{class:"ml-2 text-xs",target:"_blank",href:t.entity.link},Gn,8,Vn)]),o.hasTitle()?(u(),f("div",{key:0,class:"block w-full",innerHTML:t.entity.title},null,8,Xn)):v("",!0),t.entity.tags.length>0?(u(),f("div",Zn,[(u(!0),f(L,null,E(t.entity.tags,a=>(u(),f("a",{class:x(o.tagClass(a)),href:a.link,"data-tag-id":a.id,"data-tag-slug":a.slug,innerHTML:a.name},null,10,Jn))),256))])):v("",!0),t.entity.location?(u(),f("a",{key:2,class:"block w-full cursor-pointer my-2",href:t.entity.location.link,"data-tag":t.entity.id},[ei,T(" "+m(t.entity.location.name),1)],8,$n)):v("",!0),t.entity.image?(u(),f("a",{key:3,href:t.entity.link,style:z({backgroundImage:o.backgroundImage()}),title:t.entity.name,class:"rounded cover-background block w-full aspect-square"},null,12,ti)):v("",!0)]),l("div",ni,[l("div",ii,[l("div",{class:x(o.tabClass("profile")),onClick:e[0]||(e[0]=a=>o.switchTab("profile"))},m(t.entity.texts.profile),3),l("div",{class:x(o.tabClass("links")),onClick:e[1]||(e[1]=a=>o.switchTab("links"))},m(t.entity.texts.connections),3),l("div",{class:x(o.tabClass("access")),onClick:e[2]||(e[2]=a=>o.switchTab("access"))},null,2)]),r.focus_profile?(u(),f("div",ri,[t.entity.attributes.length>0?(u(),f("div",oi,[(u(!0),f(L,null,E(t.entity.attributes,a=>(u(),f("div",{class:"","data-attribute":a.name,"data-target":a.id},[l("span",li,m(a.name),1),l("span",{innerHTML:a.value},null,8,ai)],8,si))),256))])):v("",!0),t.entity.attributes.length>0?(u(),f("hr",ci)):v("",!0),l("div",di,[(u(!0),f(L,null,E(t.entity.profile,a=>(u(),f("div",{class:x(["",o.profileClass(a)])},[l("div",ui,m(a.field),1),l("div",null,m(a.value),1)],2))),256))])])):v("",!0),r.focus_pins?(u(),f("div",fi,[(u(!0),f(L,null,E(t.entity.connections,a=>(u(),N(s,{entity:a},null,8,["entity"]))),256)),t.entity.connections.length===0?(u(),f("p",hi,m(t.entity.texts["no-connections"]),1)):v("",!0)])):v("",!0)])],64)}const gi=F(Qn,[["render",mi]]),pi={directives:{clickOutside:Ae.directive},props:{api_lookup:String,api_recent:String,placeholder:String,keyboard_tooltip:String},components:{LookupEntity:tt,EntityPreview:gi},data(){return{has_drawer:!1,term:null,show_loading:!1,show_recent:!1,show_preview:!1,show_results:!1,show_bookmarks:!1,recent:[],bookmarks:[],indexes:[],results:[],cached:{},has_recent:!1,texts:{},timeout_id:null,preview_entity:null}},watch:{term(n,e){this.termChanged()}},methods:{termChanged(){this.term.trim().length<3||(this.timeout_id!==void 0&&clearTimeout(this.timeout_id),this.show_loading=!0,this.timeout_id=setTimeout(()=>this.lookup(),500))},lookup(){let n=this.term.trim(),e=n.toLowerCase().replace(/ /g,"-").replace(/ [^\w-]+/g,"");if(this.cached[e])return this.displayCached(e);fetch(this.api_lookup+"?"+new URLSearchParams({q:n,v2:!0})).then(t=>t.json()).then(t=>this.parseLookupResponse(t,e))},focus(){this.api_recent&&(this.show_preview=!1,this.has_drawer=!0,this.fetch())},escape(){this.timeout_id!==void 0&&clearTimeout(this.timeout_id),this.close()},fetch(){if(this.has_recent){this.show_recent=!0;return}this.show_loading=!0,fetch(this.api_recent).then(n=>n.json()).then(n=>{this.recent=n.recent,this.bookmarks=n.bookmarks,this.indexes=n.indexes,this.texts.recents=n.texts.recents,this.texts.results=n.texts.results,this.texts.hint=n.texts.hint,this.texts.bookmarks=n.texts.bookmarks,this.texts.index=n.texts.index,this.texts.keyboard=n.texts.keyboard,this.texts.empty_results=n.texts.empty_results,this.texts.fulltext=n.texts.fulltext,this.texts.fulltext_route=n.fulltext_route,this.show_loading=!1,this.show_recent=!0,this.has_recent=!0,this.bookmarks.length>0?this.show_bookmarks=!0:this.show_bookmarks=!1}).catch(n=>{this.show_loading=!1,this.show_recent=!0,this.has_recent=!1})},parseLookupResponse(n,e){this.results=n.entities,this.cached[e]=n.entities,this.showResults()},displayCached(n){this.results=this.cached[n],this.showResults()},showResults(){this.timeout_id=null,this.show_preview=!1,this.show_loading=!1,this.show_results=!0},loadPreview(n){this.show_loading=!0,fetch(n.preview).then(e=>e.json()).then(e=>this.parsePreviewResponse(e))},parsePreviewResponse(n){this.preview_entity=n,this.show_loading=!1,this.show_preview=!0,this.show_recent=!1},onClickOutside(n){this.close()},close(){this.show_recent=!1,this.show_loading=!1,this.show_preview=!1,this.$refs.searchField.blur()},showBookmarks(){this.show_bookmarks=!0},searchFullTextUrl(){return`${this.texts.fulltext_route}?term=${this.term}`},showIndexes(){this.show_bookmarks=!1},modeClass(n){return n&&this.show_bookmarks||!n&&!this.show_bookmarks?" underline":""}},mounted(){this.emitter.on("preview",n=>{this.loadPreview(n)})}},vi={class:"flex grow mr-2"},yi={class:"relative grow field flex items-center"},bi=["placeholder"],wi={class:"absolute right-1 hidden md:inline"},_i=["data-title"],xi={key:0,class:"search-drawer absolute top-0 left-0 mt-12 h-sidebar w-sidebar bg-navbar bg-base-100 shadow-r overflow-y-auto"},ki={key:0,class:"text-center"},Li=l("i",{class:"fa-solid fa-spinner fa-spin","aria-hidden":"true","aria-label":"Loading"},null,-1),Si=[Li],Ei={key:1,class:"search-recent bg-lookup p-2 min-h-full shadow-r flex flex-col items-stretch"},Ti={key:0,class:"flex-none"},qi={class:"italic text-xs text-center"},Ci={class:"grow flex flex-col gap-5 p-2"},Ai={key:0,class:"search-results flex flex-col gap-2"},Mi={class:"text-sm uppercase"},Ii={key:0,class:"text-neutral-content text-sm"},Di=["href"],ji={key:1,class:"recent-searches flex flex-col gap-2"},Hi={class:"text-sm uppercase"},Pi={key:2,class:"flex gap-5 justify-center"},Ni={key:3,class:"flex flex-col gap-4"},Bi=["href","title"],Ri=["innerHTML"],Fi={key:4,class:"flex flex-col gap-4"},Oi=["href","title"],Qi=["innerHTML"],zi={key:1,class:"flex-none text-xs text-center"},Ki=l("hr",null,null,-1),Ui=["innerHTML"],Wi={key:2,class:"search-preview bg-lookup min-h-full shadow-r"};function Vi(n,e,t,i,r,o){const s=B("LookupEntity"),a=B("EntityPreview"),c=Ce("click-outside");return de((u(),f("div",vi,[l("div",yi,[de(l("input",{type:"text",class:"leading-4 w-20 md:w-full",maxlength:"25",ref:"searchField",id:"entity-lookup","onUpdate:modelValue":e[0]||(e[0]=d=>r.term=d),onClick:e[1]||(e[1]=d=>o.focus()),onFocus:e[2]||(e[2]=d=>o.focus()),onKeydown:e[3]||(e[3]=ht(d=>o.escape(),["esc"])),placeholder:t.placeholder},null,40,bi),[[mt,r.term]]),l("span",wi,[l("span",{class:"flex-none keyboard-shortcut py-1",id:"lookup-kb-shortcut","data-toggle":"tooltip","data-title":t.keyboard_tooltip,"data-html":"true","data-placement":"bottom"}," K ",8,_i)])]),r.show_recent||r.show_loading||r.show_preview?(u(),f("aside",xi,[r.show_loading?(u(),f("div",ki,Si)):v("",!0),r.show_recent?(u(),f("div",Ei,[r.show_results?v("",!0):(u(),f("div",Ti,[l("p",qi,m(r.texts.hint),1)])),l("div",Ci,[r.show_results?(u(),f("div",Ai,[l("div",Mi,m(r.texts.results),1),r.results.length===0?(u(),f("div",Ii,m(r.texts.empty_results),1)):(u(!0),f(L,{key:1},E(r.results,d=>(u(),N(s,{entity:d},null,8,["entity"]))),256)),l("a",{class:"grow text-sm uppercase hover:underline",href:o.searchFullTextUrl()},m(r.texts.fulltext),9,Di)])):v("",!0),r.recent.length>0?(u(),f("div",ji,[l("div",Hi,m(r.texts.recents),1),(u(!0),f(L,null,E(r.recent,d=>(u(),N(s,{entity:d},null,8,["entity"]))),256))])):v("",!0),r.bookmarks.length>0?(u(),f("div",Pi,[r.bookmarks.length>0?(u(),f("button",{key:0,class:x(["grow text-sm uppercase hover:underline",this.modeClass(!0)]),onClick:e[4]||(e[4]=d=>o.showBookmarks())},m(r.texts.bookmarks),3)):v("",!0),l("button",{class:x(["grow text-sm uppercase hover:underline",this.modeClass(!1)]),onClick:e[5]||(e[5]=d=>o.showIndexes())},m(r.texts.index),3)])):v("",!0),r.show_bookmarks?(u(),f("div",Ni,[(u(!0),f(L,null,E(r.bookmarks,d=>(u(),f("a",{href:d.url,onClick:e[6]||(e[6]=ce(()=>{},["stop"])),title:d.text,class:"flex gap-2 items-center"},[l("i",{class:x(["w-4",d.icon]),"aria-hidden":"true"},null,2),l("span",{innerHTML:d.text},null,8,Ri)],8,Bi))),256))])):(u(),f("div",Fi,[(u(!0),f(L,null,E(r.indexes,d=>(u(),f("a",{href:d.url,onClick:e[7]||(e[7]=ce(()=>{},["stop"])),title:d.name,class:"flex gap-2 items-center"},[l("i",{class:x(["w-4 text-center",d.icon]),"aria-hidden":"true"},null,2),l("span",{innerHTML:d.name},null,8,Qi)],8,Oi))),256))]))]),r.show_loading?v("",!0):(u(),f("div",zi,[Ki,l("p",{class:"italic text-xs text-center",innerHTML:r.texts.keyboard},null,8,Ui)]))])):v("",!0),r.show_preview?(u(),f("div",Wi,[Z(a,{entity:r.preview_entity},null,8,["entity"])])):v("",!0)])):v("",!0)])),[[c,o.onClickOutside]])}const Yi=F(pi,[["render",Vi]]),Gi={props:["campaign"],methods:{backgroundImage:function(n){return n.image?"url("+n.image+")":""},campaignClass:function(n){return"campaign flex items-end border border-solid rounded-lg cover-background relative h-24 overflow-hidden text-break shadow-xs hover:shadow-md border-0"+(n.is_boosted?" boosted":"")}}},Xi=["href","title"],Zi=["innerHTML"];function Ji(n,e,t,i,r,o){return u(),f("a",{class:x(o.campaignClass(t.campaign)),href:t.campaign.url,style:z({backgroundImage:o.backgroundImage(t.campaign)}),title:t.campaign.name},[l("div",{class:"flex items-end justify-center name w-full text-xs p-2 pt-6 text-center",innerHTML:t.campaign.name},null,8,Zi)],14,Xi)}const $i=F(Gi,[["render",Ji]]),er={props:["notification"],data(){return{is_dismissed:!1,is_loading:!1}},methods:{backgroundClass:function(n){let e="notification bg-base-200 flex justify-center items-center p-2 rounded-md";return n.is_read?e:e+" unread"},iconClass:function(n){return"fa-solid fa-"+n.icon},dismiss:function(n){this.is_loading=!0,axios.post(n.dismiss).then(()=>{this.is_dismissed=!0,this.emitter.emit("read_notification",n)})}}},tr=["data-id"],nr={class:"flex-none p-2"},ir=["innerHTML","href"],rr=["title"],or=l("i",{class:"fa-solid fa-times","aria-hidden":"true"},null,-1),sr=[or],lr={key:1,class:"flex-none p-2"},ar=l("i",{class:"fa-solid fa-spinner fa-spin","aria-hidden":"true"},null,-1),cr=[ar],dr=["data-id"],ur={class:"flex-none p-2"},fr=["innerHTML"],hr=["title"],mr=l("i",{class:"fa-solid fa-times","aria-hidden":"true"},null,-1),gr=[mr],pr={key:1,class:"flex-none p-2"},vr=l("i",{class:"fa-solid fa-spinner fa-spin","aria-hidden":"true"},null,-1),yr=[vr];function br(n,e,t,i,r,o){return t.notification.url&&!r.is_dismissed?(u(),f("div",{key:0,class:x(o.backgroundClass(t.notification)),"data-id":t.notification.id},[l("div",nr,[l("i",{class:x(o.iconClass(t.notification)),"aria-hidden":"true"},null,2)]),l("a",{class:"flex-grow p-2 break-all",innerHTML:t.notification.text,href:t.notification.url},null,8,ir),this.is_loading?(u(),f("div",lr,cr)):(u(),f("div",{key:0,class:"flex-none p-2 cursor-pointer dismissable",onClick:e[0]||(e[0]=s=>o.dismiss(t.notification)),title:t.notification.dismiss_text},sr,8,rr))],10,tr)):r.is_dismissed?v("",!0):(u(),f("div",{key:1,class:x(o.backgroundClass(t.notification)),"data-id":t.notification.id},[l("div",ur,[l("i",{class:x(o.iconClass(t.notification)),"aria-hidden":"true"},null,2)]),l("div",{class:"flex-grow p-2",innerHTML:t.notification.text},null,8,fr),this.is_loading?(u(),f("div",pr,yr)):(u(),f("div",{key:0,class:"flex-none p-2 cursor-pointer dismissable",onClick:e[1]||(e[1]=s=>o.dismiss(t.notification)),title:t.notification.dismiss_text},gr,8,hr))],10,dr))}const wr=F(er,[["render",br]]),_r={props:["release"],data(){return{is_dismissed:!1,is_loading:!1}},methods:{backgroundClass:function(n){return"release bg-base-200 flex justify-center items-center p-2 rounded-md"},dismiss:function(n){this.is_loading=!0,axios.post(n.dismiss).then(()=>{this.is_dismissed=!0,this.emitter.emit("read_release",n)})}}},xr=["data-id"],kr={class:"flex-grow p-2"},Lr=["innerHTML","href"],Sr=["innerHTML"],Er=["title"],Tr=l("i",{class:"fa-solid fa-times","aria-hidden":"true"},null,-1),qr=[Tr],Cr={key:1,class:"flex-none p-2"},Ar=l("i",{class:"fa-solid fa-spinner fa-spin","aria-hidden":"true"},null,-1),Mr=[Ar];function Ir(n,e,t,i,r,o){return r.is_dismissed?v("",!0):(u(),f("div",{key:0,class:x(o.backgroundClass(t.release)),"data-id":t.release.id},[l("div",kr,[l("a",{innerHTML:t.release.title,class:"font-bold cursor-pointer block w-full",href:t.release.url,target:"_blank"},null,8,Lr),l("p",{innerHTML:t.release.text},null,8,Sr)]),this.is_loading?(u(),f("div",Cr,Mr)):(u(),f("div",{key:0,class:"flex-none p-2 cursor-pointer dismissable",onClick:e[0]||(e[0]=s=>o.dismiss(t.release)),title:t.release.dismiss_text},qr,8,Er))],10,xr))}const Dr=F(_r,[["render",Ir]]),jr=l("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},[l("g",{transform:"translate(-219.000000, -200.000000)",fill:"currentcolor"},[l("g",{id:"icons",transform:"translate(56.000000, 160.000000)"},[l("path",{d:"M181.9,54 L179.8,54 C178.63975,54 177.7,54.895 177.7,56 L177.7,58 C177.7,59.105 178.63975,60 179.8,60 L181.9,60 C183.06025,60 184,59.105 184,58 L184,56 C184,54.895 183.06025,54 181.9,54 M174.55,54 L172.45,54 C171.28975,54 170.35,54.895 170.35,56 L170.35,58 C170.35,59.105 171.28975,60 172.45,60 L174.55,60 C175.71025,60 176.65,59.105 176.65,58 L176.65,56 C176.65,54.895 175.71025,54 174.55,54 M167.2,54 L165.1,54 C163.93975,54 163,54.895 163,56 L163,58 C163,59.105 163.93975,60 165.1,60 L167.2,60 C168.36025,60 169.3,59.105 169.3,58 L169.3,56 C169.3,54.895 168.36025,54 167.2,54 M181.9,47 L179.8,47 C178.63975,47 177.7,47.895 177.7,49 L177.7,51 C177.7,52.105 178.63975,53 179.8,53 L181.9,53 C183.06025,53 184,52.105 184,51 L184,49 C184,47.895 183.06025,47 181.9,47 M174.55,47 L172.45,47 C171.28975,47 170.35,47.895 170.35,49 L170.35,51 C170.35,52.105 171.28975,53 172.45,53 L174.55,53 C175.71025,53 176.65,52.105 176.65,51 L176.65,49 C176.65,47.895 175.71025,47 174.55,47 M167.2,47 L165.1,47 C163.93975,47 163,47.895 163,49 L163,51 C163,52.105 163.93975,53 165.1,53 L167.2,53 C168.36025,53 169.3,52.105 169.3,51 L169.3,49 C169.3,47.895 168.36025,47 167.2,47 M181.9,40 L179.8,40 C178.63975,40 177.7,40.895 177.7,42 L177.7,44 C177.7,45.105 178.63975,46 179.8,46 L181.9,46 C183.06025,46 184,45.105 184,44 L184,42 C184,40.895 183.06025,40 181.9,40 M174.55,40 L172.45,40 C171.28975,40 170.35,40.895 170.35,42 L170.35,44 C170.35,45.105 171.28975,46 172.45,46 L174.55,46 C175.71025,46 176.65,45.105 176.65,44 L176.65,42 C176.65,40.895 175.71025,40 174.55,40 M169.3,42 L169.3,44 C169.3,45.105 168.36025,46 167.2,46 L165.1,46 C163.93975,46 163,45.105 163,44 L163,42 C163,40.895 163.93975,40 165.1,40 L167.2,40 C168.36025,40 169.3,40.895 169.3,42"})])])],-1),Hr=[jr],Pr={__name:"GridSvg",props:{size:Number},setup(n){const e=n;function t(){return"w-"+e.size+" h-"+e.size}return(i,r)=>(u(),f("svg",{class:x(t()),viewBox:"0 -0.5 21 21",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true"},Hr,2))}},Nr={directives:{clickOutside:Ae.directive},props:{user_id:{type:String},api:{type:String},fetch:{type:String},initials:{type:String},avatar:{type:String},campaign_id:void 0,has_alerts:{type:Boolean}},components:{GridSvg:Pr,Campaign:$i,Notification:wr,Release:Dr},data(){return{alert_delta:60*1e3,is_loading:!1,is_expanded:!1,has_data:!1,view_campaigns:!1,view_profile:!1,profile:{},campaigns:{},notifications:{},marketplace:{},releases:{},show_alerts:!1,is_loaded:!1}},methods:{openCampaigns:function(){this.view_campaigns=!0,this.view_profile=!1,this.loadData()},openProfile:function(){this.view_profile=!0,this.view_campaigns=!1,this.loadData()},loadData:function(){this.is_expanded=!0,!this.has_data&&(this.is_loading=!0,fetch(this.api).then(n=>n.json()).then(n=>{this.profile=n.profile,this.campaigns=n.campaigns,this.notifications=n.notifications,this.marketplace=n.marketplace,this.releases=n.releases,this.show_alerts=n.has_unread,this.has_data=!0,this.is_loading=!1,this.is_loaded=!0}))},blockClass:function(n){return n?"block p-4 flex-grow items-center focus:box-shadow":"block p-4 items-center bg-base-200 cursor-pointer flex-none focus:box-shadow"},logout:function(){document.getElementById("logout-form").submit()},onClickOutside(n){this.is_expanded=!1},readRelease:function(n){let e=this.releases.releases.findIndex(t=>t.id===n.id);this.releases.releases.slice(e,1),this.updateUnread()},readNotification:function(n){let e=this.notifications.messages.findIndex(t=>t.id==n.id);this.notifications.messages.slice(e,1),this.updateUnread()},updateUnread:function(){this.notifications.messages.length===0&&this.releases.releases.length===0&&(this.show_alerts=!1)},updateAlerts:function(){let n=localStorage.getItem("last_notification-"+this.user_id),t=new Date().getTime()-60*5e3;if(!n||ne.json()).then(e=>{localStorage.setItem("notification-has-alerts-"+this.user_id,e.has_alerts),this.updateAlerts()})},queueFetch:function(){let n=this;setTimeout((function(){n.updateAlerts()}).bind(this),this.alert_delta)},showInitials:function(){return this.avatar.startsWith("/images/")},profilePictureUrl:function(){return"url("+this.avatar+")"}},mounted(){this.emitter.on("read_release",n=>{this.readRelease(n)}),this.emitter.on("read_notification",n=>{this.readNotification(n)}),this.show_alerts=this.has_alerts,this.queueFetch()}},Br={class:"nav-switcher flex items-center justify-center h-12"},Rr=l("span",{class:"sr-only"},"Campaigns",-1),Fr={class:"indicator relative inline-flex w-max"},Or={key:0,class:"notification-badge left-auto top-auto w-fit inline-flex absolute content-center items-center z-10"},Qr={key:1,class:"profile-box rounded-lg p-2 text-center font-bold"},zr={key:0,class:"navigation-drawer bg-base-100 h-full overflow-y-auto fixed top-0 right-0 rounded-l-2xl shadow-lg"},Kr={key:0,class:"temporary p-8 text-center"},Ur=l("i",{class:"fa-solid fa-spinner fa-spin","aria-hidden":"true"},null,-1),Wr=[Ur],Vr={key:1,class:""},Yr={class:"header flex"},Gr={key:0,class:"full flex items-center gap-4"},Xr={class:"flex-none"},Zr={class:"flex-grow"},Jr={class:"font-bold"},$r=["title"],eo={key:0,class:"full flex items-center gap-4"},to={key:0,class:"flex-none profile-box rounded-lg p-2 text-center uppercase font-bold"},no={class:"flex-grow"},io={class:"font-bold"},ro=["title"],oo={key:0,class:"flex-none profile-box rounded-lg p-2 text-center uppercase font-bold"},so={key:0,class:"profile p-5 flex flex-col gap-5"},lo={key:0,class:"notifications"},ao={class:"flex w-full py-2"},co={class:"flex-grow uppercase font-bold"},uo={class:"flex-grow text-right"},fo=["href"],ho={class:"flex flex-col gap-2"},mo={key:0,class:"no-notifications help-block text-neutral-content italic"},go={key:1,class:"releases"},po={class:"flex w-full py-2"},vo={class:"flex-grow uppercase font-bold"},yo={class:"flex flex-col gap-2"},bo={key:2,class:"marketplace"},wo={class:"flex w-full py-2"},_o={class:"flex-grow uppercase font-bold"},xo={class:"flex-grow text-right"},ko=["href"],Lo={class:"grid grid-cols-3 gap-2"},So=["href"],Eo=l("div",{class:"icon bg-base-200 rounded-full w-14 h-14 text-3xl aspect-square flex justify-center items-center"},[l("i",{class:"fa-solid fa-palette","aria-hidden":"true"})],-1),To={class:"text-muted text-xs"},qo=["href"],Co=l("div",{class:"icon bg-base-200 rounded-full w-14 h-14 text-3xl aspect-square flex justify-center items-center"},[l("i",{class:"fa-solid fa-columns","aria-hidden":"true"})],-1),Ao={class:"text-muted text-xs"},Mo=["href"],Io=l("div",{class:"icon bg-base-200 rounded-full w-14 h-14 text-3xl aspect-square flex justify-center items-center"},[l("i",{class:"fa-solid fa-dice-d20","aria-hidden":"true"})],-1),Do={class:"text-muted text-xs"},jo={key:3,class:"subscription"},Ho={class:"uppercase font-bold py-2"},Po=["href"],No={class:"flex-none p-2"},Bo=["src","alt"],Ro={class:"flex-grow p-2"},Fo={class:"font-bold text-lg"},Oo={key:0,class:"more"},Qo=l("br",null,null,-1),zo={key:1,class:"more"},Ko={class:"link flex gap-1 items-center"},Uo=l("i",{class:"fa-duotone fa-credit-card","aria-hidden":"true"},null,-1),Wo=l("i",{class:"fa-brands fa-paypal","aria-hidden":"true"},null,-1),Vo={key:4,class:"m-0 p-0 list-none flex flex-col gap-2"},Yo=["href"],Go=l("i",{class:"fa-solid fa-cog mr-3","aria-hidden":"true"},null,-1),Xo=["href"],Zo=l("i",{class:"fa-solid fa-user mr-3","aria-hidden":"true"},null,-1),Jo=["href"],$o=l("i",{class:"fa-solid fa-question-circle mr-3","aria-hidden":"true"},null,-1),es=l("i",{class:"fa-solid fa-sign-out mr-3","aria-hidden":"true"},null,-1),ts={key:5,class:"m-0 p-0 list-none flex flex-col gap-2"},ns=["href"],is=l("i",{class:"fa-solid fa-sign-out-alt mr-3","aria-hidden":"true"},null,-1),rs={key:1,class:"campaigns p-5"},os={key:0,class:"campaigns flex flex-col gap-5"},ss={class:"flex flex-col gap-2"},ls={class:"flex w-full"},as={class:"flex-grow uppercase font-bold"},cs={key:0,class:"flex-grow text-right"},ds=["href"],us={class:"grid grid-cols-2 md:grid-cols-3 gap-5"},fs=["href"],hs={class:"text-xs text-break uppercase"},ms=l("i",{class:"fa-solid fa-plus","aria-hidden":"true",style:{display:"none"}},null,-1),gs={key:0},ps={class:"flex flex-col gap-2"},vs={key:0,class:"uppercase"},ys={key:1,class:"grid grid-cols-2 md:grid-cols-3 gap-5 following"},bs=["href"],ws={class:"text-xs uppercase text-break"};function _s(n,e,t,i,r,o){const s=B("GridSvg"),a=B("Notification"),c=B("Release"),d=B("Campaign"),h=Ce("click-outside");return u(),f(L,null,[l("div",Br,[l("div",{class:"campaigns inline cursor-pointer text-center px-3 text-2xl hover:text-primary-focus",onClick:e[0]||(e[0]=g=>o.openCampaigns()),"aria-label":"Switch campaigns",tabindex:"0",role:"button"},[Z(s,{size:7}),Rr]),l("div",{class:"profile inline cursor-pointer text-center uppercase pt-1",onClick:e[1]||(e[1]=g=>o.openProfile()),"aria-label":"Profile settings",tabindex:"0",role:"button"},[l("div",Fr,[r.show_alerts?(u(),f("span",Or)):v("",!0),o.showInitials()?(u(),f("div",Qr,m(t.initials),1)):(u(),f("div",{key:2,class:"w-9 h-9 rounded-lg cover-background",style:z({backgroundImage:o.profilePictureUrl()})},null,4))])])]),r.is_expanded?de((u(),f("div",zr,[r.is_loading?(u(),f("div",Kr,Wr)):(u(),f("div",Vr,[l("div",Yr,[l("div",{class:x(o.blockClass(r.view_campaigns)),onClick:e[2]||(e[2]=g=>o.openCampaigns()),tabindex:"0",role:"button","aria-label":"Campaign list"},[r.view_campaigns?(u(),f("div",Gr,[l("div",Xr,[Z(s,{size:6})]),l("div",Zr,[l("div",Jr,m(r.campaigns.texts.campaigns),1),l("div",null,m(r.campaigns.texts.count),1)])])):(u(),f("div",{key:1,class:"flex items-center justify-center h-full",title:r.campaigns.texts.campaigns},[Z(s,{size:6})],8,$r))],2),l("div",{class:x(o.blockClass(r.view_profile)),onClick:e[3]||(e[3]=g=>o.openProfile()),tabindex:"0",role:"button","aria-label":"Profile pane"},[r.view_profile?(u(),f("div",eo,[o.showInitials()?(u(),f("div",to,m(t.initials),1)):(u(),f("div",{key:1,class:"flex-none w-9 h-9 rounded-lg cover-background",style:z({backgroundImage:o.profilePictureUrl()})},null,4)),l("div",no,[l("div",io,m(r.profile.name),1),l("div",null,m(r.profile.created),1)])])):(u(),f("div",{key:1,class:"",title:r.profile.your_profile},[o.showInitials()?(u(),f("div",oo,m(t.initials),1)):(u(),f("div",{key:1,class:"flex-none w-9 h-9 rounded-lg cover-background",style:z({backgroundImage:o.profilePictureUrl()})},null,4))],8,ro))],2)]),r.view_profile?(u(),f("div",so,[r.notifications.title?(u(),f("div",lo,[l("div",ao,[l("div",co,m(r.notifications.title),1),l("div",uo,[l("a",{href:r.notifications.all.url},m(r.notifications.all.text),9,fo)])]),l("div",ho,[(u(!0),f(L,null,E(r.notifications.messages,g=>(u(),N(a,{notification:g},null,8,["notification"]))),256))]),r.notifications.messages.length===0?(u(),f("div",mo,m(r.notifications.none),1)):v("",!0)])):v("",!0),r.releases.title&&r.releases.releases.length>0?(u(),f("div",go,[l("div",po,[l("div",vo,m(r.releases.title),1)]),l("div",yo,[(u(!0),f(L,null,E(r.releases.releases,g=>(u(),N(c,{release:g},null,8,["release"]))),256))])])):v("",!0),!r.profile.is_impersonating&&r.marketplace.title?(u(),f("div",bo,[l("div",wo,[l("div",_o,m(r.marketplace.title),1),l("div",xo,[l("a",{href:r.marketplace.explore.url,target:"_blank"},m(r.marketplace.explore.text),9,ko)])]),l("div",Lo,[l("a",{href:r.marketplace.themes.url,class:"border py-2 items-center justify-center rounded-md hover:shadow-md flex flex-col gap-1",target:"_blank"},[Eo,l("div",null,m(r.marketplace.themes.title),1),l("div",To,m(r.marketplace.themes.number),1)],8,So),l("a",{href:r.marketplace.sheets.url,class:"border py-2 items-center justify-center rounded-md hover:shadow-md flex flex-col gap-1",target:"_blank"},[Co,l("div",null,m(r.marketplace.sheets.title),1),l("div",Ao,m(r.marketplace.sheets.number),1)],8,qo),l("a",{href:r.marketplace.content.url,class:"border py-2 items-center justify-center rounded-md hover:shadow-md flex flex-col gap-1",target:"_blank"},[Io,l("div",null,m(r.marketplace.content.title),1),l("div",Do,m(r.marketplace.content.number),1)],8,Mo)])])):v("",!0),!r.profile.is_impersonating&&r.profile.subscription?(u(),f("div",jo,[l("div",Ho,m(r.profile.subscription.title),1),l("a",{class:"border rounded-lg flex justify-center items-center hover:shadow-md",href:r.profile.urls.subscription},[l("div",No,[l("img",{class:"w-16 h-16",src:r.profile.subscription.image,alt:r.profile.subscription.tier},null,8,Bo)]),l("div",Ro,[l("div",Fo,m(r.profile.subscription.tier),1),r.profile.subscription.tier!=="Kobold"?(u(),f("div",Oo,[T(m(r.profile.subscription.created),1),Qo,T(" "+m(r.profile.subscription.boosters),1)])):(u(),f("div",zo,[T(m(r.profile.subscription.call_to_action)+" ",1),l("div",Ko,[T(m(r.profile.subscription.call_to_action_2)+" ",1),Uo,Wo])]))])],8,Po)])):v("",!0),r.profile.is_impersonating?(u(),f("ul",ts,[l("li",null,[l("a",{href:r.profile.return.url,class:""},[is,T(" "+m(r.profile.return.name),1)],8,ns)])])):(u(),f("ul",Vo,[l("li",null,[l("a",{href:r.profile.urls.settings.url,class:"p-2 block"},[Go,T(" "+m(r.profile.urls.settings.name),1)],8,Yo)]),l("li",null,[l("a",{href:r.profile.urls.profile.url,class:"p-2 block"},[Zo,T(" "+m(r.profile.urls.profile.name),1)],8,Xo)]),l("li",null,[l("a",{href:r.profile.urls.help.url,class:"p-2 block",target:"_blank"},[$o,T(" "+m(r.profile.urls.help.name),1)],8,Jo)]),l("li",null,[l("a",{href:"#",onClick:e[4]||(e[4]=g=>o.logout()),class:"p-2 block"},[es,T(" "+m(r.profile.urls.logout.name),1)])])]))])):(u(),f("div",rs,[r.profile.is_impersonating?v("",!0):(u(),f("div",os,[l("div",ss,[l("div",ls,[l("div",as,m(r.campaigns.texts.campaigns),1),r.campaigns.member.length>0?(u(),f("div",cs,[l("a",{href:r.campaigns.urls.reorder},m(r.campaigns.texts.reorder),9,ds)])):v("",!0)]),l("div",us,[(u(!0),f(L,null,E(r.campaigns.member,g=>(u(),N(d,{campaign:g},null,8,["campaign"]))),256)),l("a",{href:r.campaigns.urls.new,class:"new-campaign flex items-center text-center border-dashed border rounded-lg h-24 p-2 overflow-hidden"},[l("span",hs,[ms,T(" "+m(r.campaigns.texts.new),1)])],8,fs)])]),r.profile.is_impersonating?v("",!0):(u(),f("hr",gs)),l("div",ps,[r.profile.is_impersonating?v("",!0):(u(),f("p",vs,m(r.campaigns.texts.followed),1)),r.profile.is_impersonating?v("",!0):(u(),f("div",ys,[(u(!0),f(L,null,E(r.campaigns.following,g=>(u(),N(d,{campaign:g},null,8,["campaign"]))),256)),l("a",{href:r.campaigns.urls.follow,class:"new-campaign flex items-center text-center border-dashed border rounded-lg h-24 p-2 overflow-hidden"},[l("span",ws,m(r.campaigns.texts.follow),1)],8,bs)]))])]))]))]))])),[[h,o.onClickOutside]]):v("",!0)],64)}const xs=F(Nr,[["render",_s]]),ks=pt(),Y=gt({});Y.config.globalProperties.emitter=ks;Y.component("nav-toggler",Dn);Y.component("nav-search",Yi);Y.component("nav-switcher",xs);Y.mount("#header");const le=Array(),nt=()=>{document.querySelectorAll('[data-toggle="tooltip-ajax"]').forEach(e=>{e.dataset.loaded!=="1"&&(e.dataset.loaded="1",ne(e,{theme:"kanka",placement:e.dataset.direction??"bottom",allowHTML:!0,interactive:!0,delay:500,appendTo:e.dataset.append??document.body,content:'