inlaycms 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/admin/admin.js +1 -1
- package/dist/adapters/admin/screens/media.d.ts +4 -1
- package/dist/adapters/admin/screens/media.js +22 -2
- package/dist/adapters/admin/screens/redirects.js +3 -1
- package/dist/adapters/cli/main.js +9 -1
- package/dist/adapters/mcp/tools/read.d.ts +1 -1
- package/dist/adapters/mcp/tools/read.js +44 -1
- package/dist/adapters/mcp/tools/write.js +76 -5
- package/dist/adapters/site/plugin.d.ts +2 -0
- package/dist/adapters/site/plugin.js +10 -1
- package/dist/adapters/site/public.d.ts +9 -1
- package/dist/adapters/site/public.js +48 -30
- package/dist/core/content/find-text.d.ts +31 -0
- package/dist/core/content/find-text.js +124 -0
- package/dist/core/content/search.js +1 -14
- package/dist/core/content/text-match.d.ts +14 -0
- package/dist/core/content/text-match.js +99 -0
- package/dist/core/content/text-replace.d.ts +14 -0
- package/dist/core/content/text-replace.js +100 -0
- package/dist/core/core.d.ts +7 -0
- package/dist/core/core.js +2 -0
- package/dist/core/messages/en.d.ts +33 -2
- package/dist/core/messages/en.js +33 -2
- package/dist/core/release/pack.js +4 -0
- package/dist/core/release/public-files.d.ts +14 -0
- package/dist/core/release/public-files.js +43 -0
- package/dist/core/release/window.d.ts +2 -0
- package/dist/core/release/window.js +6 -0
- package/dist/core/report.d.ts +1 -1
- package/dist/core/richtext/runs.d.ts +12 -0
- package/dist/core/richtext/runs.js +31 -0
- package/dist/core/version.d.ts +2 -0
- package/dist/core/version.js +2 -0
- package/dist/host/app.d.ts +6 -0
- package/dist/host/app.js +3 -0
- package/package.json +1 -1
package/assets/admin/admin.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var We=Object.defineProperty;var _e=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(r){throw n=[r],r}};var je=(e,t)=>{for(var n in t)We(e,n,{get:t[n],enumerable:!0})};var ge={};je(ge,{default:()=>Z});var Xe,Z,_=_e(()=>{Xe=(function(){"use strict";let htmx={onLoad:null,process:null,on:null,off:null,trigger:null,ajax:null,find:null,findAll:null,closest:null,values:function(e,t){return getInputValues(e,t||"post").values},remove:null,addClass:null,removeClass:null,toggleClass:null,takeClass:null,swap:null,defineExtension:null,removeExtension:null,logAll:null,logNone:null,logger:null,config:{historyEnabled:!0,historyCacheSize:10,refreshOnHistoryMiss:!1,defaultSwapStyle:"innerHTML",defaultSwapDelay:0,defaultSettleDelay:20,includeIndicatorStyles:!0,indicatorClass:"htmx-indicator",requestClass:"htmx-request",addedClass:"htmx-added",settlingClass:"htmx-settling",swappingClass:"htmx-swapping",allowEval:!0,allowScriptTags:!0,inlineScriptNonce:"",inlineStyleNonce:"",attributesToSettle:["class","style","width","height"],withCredentials:!1,timeout:0,wsReconnectDelay:"full-jitter",wsBinaryType:"blob",disableSelector:"[hx-disable], [data-hx-disable]",scrollBehavior:"instant",defaultFocusScroll:!1,getCacheBusterParam:!1,globalViewTransitions:!1,methodsThatUseUrlParams:["get","delete"],selfRequestsOnly:!0,ignoreTitle:!1,scrollIntoViewOnBoost:!0,triggerSpecsCache:null,disableInheritance:!1,responseHandling:[{code:"204",swap:!1},{code:"[23]..",swap:!0},{code:"[45]..",swap:!1,error:!0}],allowNestedOobSwaps:!0,historyRestoreAsHxRequest:!0,reportValidityOfForms:!1},parseInterval:null,location,_:null,version:"2.0.11"};htmx.onLoad=onLoadHelper,htmx.process=processNode,htmx.on=addEventListenerImpl,htmx.off=removeEventListenerImpl,htmx.trigger=triggerEvent,htmx.ajax=ajaxHelper,htmx.find=find,htmx.findAll=findAll,htmx.closest=closest,htmx.remove=removeElement,htmx.addClass=addClassToElement,htmx.removeClass=removeClassFromElement,htmx.toggleClass=toggleClassOnElement,htmx.takeClass=takeClassForElement,htmx.swap=swap,htmx.defineExtension=defineExtension,htmx.removeExtension=removeExtension,htmx.logAll=logAll,htmx.logNone=logNone,htmx.parseInterval=parseInterval,htmx._=internalEval;let internalAPI={addTriggerHandler,bodyContains,canAccessLocalStorage,findThisElement,filterValues,swap,hasAttribute,getAttributeValue,getClosestAttributeValue,getClosestMatch,getExpressionVars,getHeaders,getInputValues,getInternalData,getSwapSpecification,getTriggerSpecs,getTarget,makeFragment,mergeObjects,makeSettleInfo,oobSwap,querySelectorExt,settleImmediately,shouldCancel,triggerEvent,triggerErrorEvent,withExtensions},VERBS=["get","post","put","delete","patch"],VERB_SELECTOR=VERBS.map(function(e){return"[hx-"+e+"], [data-hx-"+e+"]"}).join(", ");function parseInterval(e){if(e==null)return;let t=NaN;return e.slice(-2)=="ms"?t=parseFloat(e.slice(0,-2)):e.slice(-1)=="s"?t=parseFloat(e.slice(0,-1))*1e3:e.slice(-1)=="m"?t=parseFloat(e.slice(0,-1))*1e3*60:t=parseFloat(e),isNaN(t)?void 0:t}function getRawAttribute(e,t){return e instanceof Element&&e.getAttribute(t)}function hasAttribute(e,t){return!!e.hasAttribute&&(e.hasAttribute(t)||e.hasAttribute("data-"+t))}function getAttributeValue(e,t){return getRawAttribute(e,t)||getRawAttribute(e,"data-"+t)}function parentElt(e){let t=e.parentElement;return!t&&e.parentNode instanceof ShadowRoot?e.parentNode:t}function getDocument(){return document}function getRootNode(e,t){return e.getRootNode?e.getRootNode({composed:t}):getDocument()}function getClosestMatch(e,t){for(;e&&!t(e);)e=parentElt(e);return e||null}function getAttributeValueWithDisinheritance(e,t,n){let r=getAttributeValue(t,n),o=getAttributeValue(t,"hx-disinherit");var i=getAttributeValue(t,"hx-inherit");if(e!==t){if(htmx.config.disableInheritance)return i&&(i==="*"||i.split(" ").indexOf(n)>=0)?r:null;if(o&&(o==="*"||o.split(" ").indexOf(n)>=0))return"unset"}return r}function getClosestAttributeValue(e,t){let n=null;if(getClosestMatch(e,function(r){return!!(n=getAttributeValueWithDisinheritance(e,asElement(r),t))}),n!=="unset")return n}function matches(e,t){return e instanceof Element&&e.matches(t)}function getStartTag(e){let n=/<([a-z][^\/\0>\x20\t\r\n\f]*)/i.exec(e);return n?n[1].toLowerCase():""}function parseHTML(e){return"parseHTMLUnsafe"in Document?Document.parseHTMLUnsafe(e):new DOMParser().parseFromString(e,"text/html")}function takeChildrenFor(e,t){for(;t.childNodes.length>0;)e.append(t.childNodes[0])}function duplicateScript(e){let t=getDocument().createElement("script");return forEach(e.attributes,function(n){t.setAttribute(n.name,n.value)}),t.textContent=e.textContent,t.async=!1,htmx.config.inlineScriptNonce&&(t.nonce=htmx.config.inlineScriptNonce),t}function isJavaScriptScriptNode(e){return e.matches("script")&&(e.type==="text/javascript"||e.type==="module"||e.type==="")}function normalizeScriptTags(e){if(!htmx.config.allowScriptTags){e.querySelectorAll("script").forEach(t=>t.remove());return}Array.from(e.querySelectorAll("script")).forEach(t=>{if(isJavaScriptScriptNode(t)){let n=duplicateScript(t),r=t.parentNode;try{r.insertBefore(n,t)}catch(o){logError(o)}finally{t.remove()}}})}function makeFragment(e){e=e.replace(/<hx-([a-z]+)((?:\s[^>]*)?)>/gi,'<template hx type="$1"$2>').replace(/<\/hx-[a-z]+>/gi,"</template>");let t=e.replace(/<head(\s[^>]*)?>[\s\S]*?<\/head>/i,""),n=getStartTag(t),r;if(n==="html"){r=new DocumentFragment;let i=parseHTML(e);takeChildrenFor(r,i.body),r.title=i.title}else if(n==="body"){r=new DocumentFragment;let i=parseHTML(t);takeChildrenFor(r,i.body),r.title=i.title}else{let i=parseHTML('<body><template class="internal-htmx-wrapper">'+t+"</template></body>");r=i.querySelector("template").content,r.title=i.title;var o=r.querySelector("title");o&&o.parentNode===r&&(o.remove(),r.title=o.innerText)}return r&&normalizeScriptTags(r),r}function maybeCall(e){e&&e()}function isType(e,t){return Object.prototype.toString.call(e)==="[object "+t+"]"}function isFunction(e){return typeof e=="function"}function isRawObject(e){return isType(e,"Object")}function getInternalData(e){let t="htmx-internal-data",n=e[t];return n||(n=e[t]={}),n}function toArray(e){let t=[];if(e)for(let n=0;n<e.length;n++)t.push(e[n]);return t}function forEach(e,t){if(e)for(let n=0;n<e.length;n++)t(e[n])}function isScrolledIntoView(e){let t=e.getBoundingClientRect(),n=t.top,r=t.bottom;return n<window.innerHeight&&r>=0}function bodyContains(e){return e.getRootNode({composed:!0})===document}function splitOnWhitespace(e){return e.trim().split(/\s+/)}function mergeObjects(e,t){return Object.assign({},e,t)}function parseJSON(e){try{return JSON.parse(e)}catch(t){return logError(t),null}}function canAccessLocalStorage(){let e="htmx:sessionStorageTest";try{return sessionStorage.setItem(e,e),sessionStorage.removeItem(e),!0}catch{return!1}}function normalizePath(e){try{let t=new URL(e,window.location.href);e=t.pathname+t.search}catch{}return e!="/"&&(e=e.replace(/\/+$/,"")),e}function internalEval(str){return maybeEval(getDocument().body,function(){return eval(str)})}function onLoadHelper(e){return htmx.on("htmx:load",function(n){e(n.detail.elt)})}function logAll(){htmx.logger=function(e,t,n){console&&console.log(t,e,n)}}function logNone(){htmx.logger=null}function find(e,t){return typeof e!="string"?e.querySelector(t):find(getDocument(),e)}function findAll(e,t){return typeof e!="string"?e.querySelectorAll(t):findAll(getDocument(),e)}function getWindow(){return window}function removeElement(e,t){e=resolveTarget(e),t?getWindow().setTimeout(function(){removeElement(e),e=null},t):parentElt(e).removeChild(e)}function asElement(e){return e instanceof Element?e:null}function asHtmlElement(e){return e instanceof HTMLElement?e:null}function asString(e){return typeof e=="string"?e:null}function asParentNode(e){return e instanceof Element||e instanceof Document||e instanceof DocumentFragment?e:null}function addClassToElement(e,t,n){e=asElement(resolveTarget(e)),e&&(n?getWindow().setTimeout(function(){addClassToElement(e,t),e=null},n):e.classList&&e.classList.add(t))}function removeClassFromElement(e,t,n){let r=asElement(resolveTarget(e));r&&(n?getWindow().setTimeout(function(){removeClassFromElement(r,t),r=null},n):r.classList&&(r.classList.remove(t),r.classList.length===0&&r.removeAttribute("class")))}function toggleClassOnElement(e,t){e=resolveTarget(e),e.classList.toggle(t)}function takeClassForElement(e,t){e=resolveTarget(e),forEach(e.parentElement.children,function(n){removeClassFromElement(n,t)}),addClassToElement(asElement(e),t)}function closest(e,t){return e=asElement(resolveTarget(e)),e?e.closest(t):null}function startsWith(e,t){return e.substring(0,t.length)===t}function endsWith(e,t){return e.substring(e.length-t.length)===t}function normalizeSelector(e){let t=e.trim();return startsWith(t,"<")&&endsWith(t,"/>")?t.substring(1,t.length-2):t}function querySelectorAllExt(e,t,n){if(t.indexOf("global ")===0)return querySelectorAllExt(e,t.slice(7),!0);e=resolveTarget(e);let r=[];{let s=0,a=0;for(let l=0;l<t.length;l++){let u=t[l];if(u===","&&s===0){r.push(t.substring(a,l)),a=l+1;continue}u==="<"?s++:u==="/"&&l<t.length-1&&t[l+1]===">"&&s--}a<t.length&&r.push(t.substring(a))}let o=[],i=[];for(;r.length>0;){let s=normalizeSelector(r.shift()),a;s.indexOf("closest ")===0?a=closest(asElement(e),normalizeSelector(s.slice(8))):s.indexOf("find ")===0?a=find(asParentNode(e),normalizeSelector(s.slice(5))):s==="next"||s==="nextElementSibling"?a=asElement(e).nextElementSibling:s.indexOf("next ")===0?a=scanForwardQuery(e,normalizeSelector(s.slice(5)),!!n):s==="previous"||s==="previousElementSibling"?a=asElement(e).previousElementSibling:s.indexOf("previous ")===0?a=scanBackwardsQuery(e,normalizeSelector(s.slice(9)),!!n):s==="document"?a=document:s==="window"?a=window:s==="body"?a=document.body:s==="root"?a=getRootNode(e,!!n):s==="host"?a=e.getRootNode().host:i.push(s),a&&o.push(a)}if(i.length>0){let s=i.join(","),a=asParentNode(getRootNode(e,!!n));o.push(...toArray(a.querySelectorAll(s)))}return o}var scanForwardQuery=function(e,t,n){let r=asParentNode(getRootNode(e,n)).querySelectorAll(t);for(let o=0;o<r.length;o++){let i=r[o];if(i.compareDocumentPosition(e)===Node.DOCUMENT_POSITION_PRECEDING)return i}},scanBackwardsQuery=function(e,t,n){let r=asParentNode(getRootNode(e,n)).querySelectorAll(t);for(let o=r.length-1;o>=0;o--){let i=r[o];if(i.compareDocumentPosition(e)===Node.DOCUMENT_POSITION_FOLLOWING)return i}};function querySelectorExt(e,t){return typeof e!="string"?querySelectorAllExt(e,t)[0]:querySelectorAllExt(getDocument().body,e)[0]}function resolveTarget(e,t){return typeof e=="string"?find(asParentNode(t)||document,e):e}function processEventArgs(e,t,n,r){return isFunction(t)?{target:getDocument().body,event:asString(e),listener:t,options:n}:{target:resolveTarget(e),event:asString(t),listener:n,options:r}}function addEventListenerImpl(e,t,n,r){return ready(function(){let i=processEventArgs(e,t,n,r);i.target.addEventListener(i.event,i.listener,i.options)}),isFunction(t)?t:n}function removeEventListenerImpl(e,t,n){return ready(function(){let r=processEventArgs(e,t,n);r.target.removeEventListener(r.event,r.listener)}),isFunction(t)?t:n}let DUMMY_ELT=getDocument().createElement("output");function findAttributeTargets(e,t){let n=getClosestAttributeValue(e,t);if(n){if(n==="this")return[findThisElement(e,t)];{let r=querySelectorAllExt(e,n);if(/(^|,)(\s*)inherit(\s*)($|,)/.test(n)){let i=asElement(getClosestMatch(e,function(s){return s!==e&&hasAttribute(asElement(s),t)}));i&&r.push(...findAttributeTargets(i,t))}return r.length===0?(logError('The selector "'+n+'" on '+t+" returned no matches!"),[DUMMY_ELT]):r}}}function findThisElement(e,t){return asElement(getClosestMatch(e,function(n){return getAttributeValue(asElement(n),t)!=null}))}function getTarget(e){let t=getClosestAttributeValue(e,"hx-target");return t?t==="this"?findThisElement(e,"hx-target"):querySelectorExt(e,t):getInternalData(e).boosted?getDocument().body:e}function shouldSettleAttribute(e){return htmx.config.attributesToSettle.includes(e)}function cloneAttributes(e,t){forEach(Array.from(e.attributes),function(n){!t.hasAttribute(n.name)&&shouldSettleAttribute(n.name)&&e.removeAttribute(n.name)}),forEach(t.attributes,function(n){shouldSettleAttribute(n.name)&&e.setAttribute(n.name,n.value)})}function isInlineSwap(e,t){let n=getExtensions(t);for(let r=0;r<n.length;r++){let o=n[r];try{if(o.isInlineSwap(e))return!0}catch(i){logError(i)}}return e==="outerHTML"}function oobSwap(e,t,n,r){r=r||getDocument();let o="#"+CSS.escape(getRawAttribute(t,"id")),i="outerHTML";e==="true"||(e.indexOf(":")>0?(i=e.substring(0,e.indexOf(":")),o=e.substring(e.indexOf(":")+1)):i=e),t.removeAttribute("hx-swap-oob"),t.removeAttribute("data-hx-swap-oob");let s=querySelectorAllExt(r,o,!1);return s.length?(forEach(s,function(a){let l,u=t.cloneNode(!0);l=getDocument().createDocumentFragment(),l.appendChild(u),isInlineSwap(i,a)||(l=asParentNode(u));let f={shouldSwap:!0,target:a,fragment:l};triggerEvent(a,"htmx:oobBeforeSwap",f)&&(a=f.target,f.shouldSwap&&(handlePreservedElements(l),swapWithStyle(i,a,a,l,n),restorePreservedElements()),forEach(n.elts,function(c){triggerEvent(c,"htmx:oobAfterSwap",f)}))}),t.parentNode.removeChild(t)):(t.parentNode.removeChild(t),triggerErrorEvent(getDocument().body,"htmx:oobErrorNoTarget",{content:t,target:o})),e}function restorePreservedElements(){let e=find("#--htmx-preserve-pantry--");if(e){for(let t of[...e.children]){let n=find("#"+t.id);n.parentNode.moveBefore(t,n),n.remove()}e.remove()}}function handlePreservedElements(e){forEach(findAll(e,"[hx-preserve], [data-hx-preserve]"),function(t){let n=getAttributeValue(t,"id"),r=getDocument().getElementById(n);if(r!=null)if(t.moveBefore){let o=find("#--htmx-preserve-pantry--");o==null&&(getDocument().body.insertAdjacentHTML("afterend","<div id='--htmx-preserve-pantry--'></div>"),o=find("#--htmx-preserve-pantry--")),o.moveBefore(r,null)}else t.parentNode.replaceChild(r,t)})}function handleAttributes(e,t,n){forEach(t.querySelectorAll("[id]"),function(r){let o=getRawAttribute(r,"id");if(o&&o.length>0){let i=asParentNode(e),s=i&&i.querySelector(CSS.escape(r.tagName)+"#"+CSS.escape(o));if(s&&s!==i){let a=r.cloneNode();cloneAttributes(r,s),n.tasks.push(function(){cloneAttributes(r,a)})}}})}function makeAjaxLoadTask(e){return function(){removeClassFromElement(e,htmx.config.addedClass),processNode(asElement(e)),processFocus(asParentNode(e)),triggerEvent(e,"htmx:load")}}function processFocus(e){let t="[autofocus]",n=asHtmlElement(matches(e,t)?e:e.querySelector(t));n?.focus()}function insertNodesBefore(e,t,n,r){for(handleAttributes(e,n,r);n.childNodes.length>0;){let o=n.firstChild;addClassToElement(asElement(o),htmx.config.addedClass),e.insertBefore(o,t),o.nodeType!==Node.TEXT_NODE&&o.nodeType!==Node.COMMENT_NODE&&r.tasks.push(makeAjaxLoadTask(o))}}function stringHash(e,t){let n=0;for(;n<e.length;)t=(t<<5)-t+e.charCodeAt(n++)|0;return t}function attributeHash(e){let t=0;for(let n=0;n<e.attributes.length;n++){let r=e.attributes[n];r.value&&(t=stringHash(r.name,t),t=stringHash(r.value,t))}return t}function deInitOnHandlers(e){let t=getInternalData(e);if(t.onHandlers){for(let n=0;n<t.onHandlers.length;n++){let r=t.onHandlers[n];removeEventListenerImpl(e,r.event,r.listener)}delete t.onHandlers}}function deInitNode(e){let t=getInternalData(e);t.timeout&&clearTimeout(t.timeout),t.listenerInfos&&forEach(t.listenerInfos,function(n){n.on&&removeEventListenerImpl(n.on,n.trigger,n.listener)}),deInitOnHandlers(e),forEach(Object.keys(t),function(n){n!=="firstInitCompleted"&&delete t[n]})}function cleanUpElement(e){triggerEvent(e,"htmx:beforeCleanupElement"),deInitNode(e),forEach(e.children,function(t){cleanUpElement(t)})}function swapOuterHTML(e,t,n){if(e.tagName==="BODY")return swapInnerHTML(e,t,n);let r,o=e.previousSibling,i=parentElt(e);if(i){for(insertNodesBefore(i,e,t,n),o==null?r=i.firstChild:r=o.nextSibling,n.elts=n.elts.filter(function(s){return s!==e});r&&r!==e;)r instanceof Element&&n.elts.push(r),r=r.nextSibling;cleanUpElement(e),e.remove()}}function swapAfterBegin(e,t,n){return insertNodesBefore(e,e.firstChild,t,n)}function swapBeforeBegin(e,t,n){return insertNodesBefore(parentElt(e),e,t,n)}function swapBeforeEnd(e,t,n){return insertNodesBefore(e,null,t,n)}function swapAfterEnd(e,t,n){return insertNodesBefore(parentElt(e),e.nextSibling,t,n)}function swapDelete(e){cleanUpElement(e);let t=parentElt(e);if(t)return t.removeChild(e)}function swapInnerHTML(e,t,n){let r=e.firstChild;if(insertNodesBefore(e,r,t,n),r){for(;r.nextSibling;)cleanUpElement(r.nextSibling),e.removeChild(r.nextSibling);cleanUpElement(r),e.removeChild(r)}}function swapWithStyle(e,t,n,r,o){switch(e){case"none":return;case"outerHTML":swapOuterHTML(n,r,o);return;case"afterbegin":swapAfterBegin(n,r,o);return;case"beforebegin":swapBeforeBegin(n,r,o);return;case"beforeend":swapBeforeEnd(n,r,o);return;case"afterend":swapAfterEnd(n,r,o);return;case"delete":swapDelete(n);return;default:var i=getExtensions(t);for(let s=0;s<i.length;s++){let a=i[s];try{let l=a.handleSwap(e,n,r,o);if(l){if(Array.isArray(l))for(let u=0;u<l.length;u++){let f=l[u];f.nodeType!==Node.TEXT_NODE&&f.nodeType!==Node.COMMENT_NODE&&o.tasks.push(makeAjaxLoadTask(f))}return}}catch(l){logError(l)}}e==="innerHTML"?swapInnerHTML(n,r,o):swapWithStyle(htmx.config.defaultSwapStyle,t,n,r,o)}}function findAndSwapPartials(e,t,n){var r=findAll(e,"template[hx]");return forEach(r,function(o){var i=getRawAttribute(o,"type");if(i==="partial"){var s=getAttributeValue(o,"hx-target")||(o.id?"#"+CSS.escape(o.id):null);if(s){var a=getAttributeValue(o,"hx-swap"),l=getSwapSpecification(o,a),u=querySelectorAllExt(n||getDocument().body,s,!1);u.length===0&&triggerErrorEvent(getDocument().body,"htmx:partialErrorNoTarget",{template:o,targetSelector:s,sourceElement:n}),forEach(u,function(f){if(f=asElement(f),f){var c=o.content.cloneNode(!0);normalizeScriptTags(c);var m={shouldSwap:!0,target:f,fragment:c};if(!triggerEvent(f,"htmx:partialBeforeSwap",m))return;f=m.target,m.shouldSwap&&swap(f,m.fragment,l,{contextElement:f,afterSwapCallback:function(){forEach(t.elts,function(E){triggerEvent(E,"htmx:partialAfterSwap",m)})}})}})}}else triggerEvent(getDocument().body,"htmx:processTemplate",{type:i,template:o,settleInfo:t,sourceElement:n});o.parentNode.removeChild(o)}),r.length>0}function findAndSwapOobElements(e,t,n){var r=findAll(e,"[hx-swap-oob], [data-hx-swap-oob]");return forEach(r,function(o){if(htmx.config.allowNestedOobSwaps||o.parentElement===null){let i=getAttributeValue(o,"hx-swap-oob");i!=null&&oobSwap(i,o,t,n)}else o.removeAttribute("hx-swap-oob"),o.removeAttribute("data-hx-swap-oob")}),r.length>0}function swap(e,t,n,r){r||(r={});let o=null,i=null,s=function(){maybeCall(r.beforeSwapCallback),e=resolveTarget(e);let u=r.contextElement&&r.contextElement.isConnected?getRootNode(r.contextElement,!1):getDocument(),f=document.activeElement,c={};c={elt:f,start:f?f.selectionStart:null,end:f?f.selectionEnd:null};let m=makeSettleInfo(e);if(n.swapStyle==="textContent")e.textContent=t;else{let h=typeof t=="string"?makeFragment(t):t;if(m.title=r.title||h.title,r.historyRequest&&(h=h.querySelector("[hx-history-elt],[data-hx-history-elt]")||h),r.selectOOB){let p=r.selectOOB.split(",");for(let v=0;v<p.length;v++){let H=p[v].split(":",2),b=H[0].trim();b.indexOf("#")===0&&(b=b.substring(1));let d=H[1]||"true",g=h.querySelector("#"+b);g&&oobSwap(d,g,m,u)}}findAndSwapOobElements(h,m,u),forEach(findAll(h,"template"),function(p){p.content&&findAndSwapOobElements(p.content,m,u)&&p.remove()});var E=findAndSwapPartials(h,m,r.contextElement||asElement(e));if(r.select){let p=getDocument().createDocumentFragment();forEach(h.querySelectorAll(r.select),function(v){p.appendChild(v)}),h=p}handlePreservedElements(h),E&&!h.childElementCount&&!h.textContent.trim()?m.elts=[asElement(e)]:swapWithStyle(n.swapStyle,r.contextElement,e,h,m),restorePreservedElements()}if(c.elt&&!bodyContains(c.elt)&&getRawAttribute(c.elt,"id")){let h=document.getElementById(getRawAttribute(c.elt,"id")),p={preventScroll:n.focusScroll!==void 0?!n.focusScroll:!htmx.config.defaultFocusScroll};if(h){if(c.start&&h.setSelectionRange)try{h.setSelectionRange(c.start,c.end)}catch{}h.focus(p)}}removeClassFromElement(e,htmx.config.swappingClass),forEach(m.elts,function(h){h.classList&&addClassToElement(h,htmx.config.settlingClass),triggerEvent(h,"htmx:afterSwap",r.eventInfo)}),maybeCall(r.afterSwapCallback),n.ignoreTitle||handleTitle(m.title);let T=function(){if(forEach(m.tasks,function(h){h.call()}),forEach(m.elts,function(h){h.classList&&removeClassFromElement(h,htmx.config.settlingClass),triggerEvent(h,"htmx:afterSettle",r.eventInfo)}),r.anchor){let h=asElement(resolveTarget("#"+r.anchor));h&&h.scrollIntoView({block:"start",behavior:"auto"})}updateScrollState(m.elts,n),maybeCall(r.afterSettleCallback),maybeCall(o)};n.settleDelay>0?getWindow().setTimeout(T,n.settleDelay):T()},a=htmx.config.globalViewTransitions;n.hasOwnProperty("transition")&&(a=n.transition);let l=r.contextElement||getDocument();if(a&&triggerEvent(l,"htmx:beforeTransition",r.eventInfo)&&typeof Promise<"u"&&document.startViewTransition){let u=new Promise(function(c,m){o=c,i=m}),f=s;s=function(){document.startViewTransition(function(){return f(),u})}}try{n?.swapDelay&&n.swapDelay>0?getWindow().setTimeout(s,n.swapDelay):s()}catch(u){throw triggerErrorEvent(l,"htmx:swapError",r.eventInfo),maybeCall(i),u}}function handleTriggerHeader(e,t,n){let r=e.getResponseHeader(t);if(r.indexOf("{")===0){let o=parseJSON(r)||{};for(let i of Object.keys(o)){let s=o[i];isRawObject(s)?n=s.target!==void 0?s.target:n:s={value:s},triggerEvent(n,i,s)}}else{let o=r.split(",");for(let i=0;i<o.length;i++)triggerEvent(n,o[i].trim(),[])}}let WHITESPACE=/\s/,WHITESPACE_OR_COMMA=/[\s,]/,SYMBOL_START=/[_$a-zA-Z]/,SYMBOL_CONT=/[_$a-zA-Z0-9]/,STRINGISH_START=['"',"'","/"],NOT_WHITESPACE=/[^\s]/,COMBINED_SELECTOR_START=/[{(]/,COMBINED_SELECTOR_END=/[})]/;function tokenizeString(e){let t=[],n=0;for(;n<e.length;){if(SYMBOL_START.exec(e.charAt(n))){for(var r=n;SYMBOL_CONT.exec(e.charAt(n+1));)n++;t.push(e.substring(r,n+1))}else if(STRINGISH_START.indexOf(e.charAt(n))!==-1){let o=e.charAt(n);var r=n;for(n++;n<e.length&&e.charAt(n)!==o;)e.charAt(n)==="\\"&&n++,n++;t.push(e.substring(r,n+1))}else{let o=e.charAt(n);t.push(o)}n++}return t}function isPossibleRelativeReference(e,t,n){return SYMBOL_START.exec(e.charAt(0))&&e!=="true"&&e!=="false"&&e!=="this"&&e!==n&&t!=="."}function maybeGenerateConditional(e,t,n){if(t[0]==="["){t.shift();let r=1,o=" return (function("+n+"){ return (",i=null;for(;t.length>0;){let s=t[0];if(s==="]"){if(r--,r===0){i===null&&(o=o+"true"),t.shift(),o+=")})";try{let a=maybeEval(e,function(){return Function(o)()},function(){return!0});return a.source=o,a}catch(a){return triggerErrorEvent(getDocument().body,"htmx:syntax:error",{error:a,source:o}),null}}}else s==="["&&r++;isPossibleRelativeReference(s,i,n)?o+="(("+n+"."+s+") ? ("+n+"."+s+") : (window."+s+"))":o=o+s,i=t.shift()}}}function consumeUntil(e,t){let n="";for(;e.length>0&&!t.test(e[0]);)n+=e.shift();return n}function consumeCSSSelector(e){let t;return e.length>0&&COMBINED_SELECTOR_START.test(e[0])?(e.shift(),t=consumeUntil(e,COMBINED_SELECTOR_END).trim(),e.shift()):t=consumeUntil(e,WHITESPACE_OR_COMMA),t}let INPUT_SELECTOR="input, textarea, select";function parseAndCacheTrigger(e,t,n){let r=[],o=tokenizeString(t);do{consumeUntil(o,NOT_WHITESPACE);let a=o.length,l=consumeUntil(o,/[,\[\s]/);if(l!=="")if(l==="every"){let u={trigger:"every"};consumeUntil(o,NOT_WHITESPACE),u.pollInterval=parseInterval(consumeUntil(o,/[,\[\s]/)),consumeUntil(o,NOT_WHITESPACE);var i=maybeGenerateConditional(e,o,"event");i&&(u.eventFilter=i),r.push(u)}else{let u={trigger:l};var i=maybeGenerateConditional(e,o,"event");for(i&&(u.eventFilter=i),consumeUntil(o,NOT_WHITESPACE);o.length>0&&o[0]!==",";){let c=o.shift();if(c==="changed")u.changed=!0;else if(c==="once")u.once=!0;else if(c==="consume")u.consume=!0;else if(c==="delay"&&o[0]===":")o.shift(),u.delay=parseInterval(consumeUntil(o,WHITESPACE_OR_COMMA));else if(c==="from"&&o[0]===":"){if(o.shift(),COMBINED_SELECTOR_START.test(o[0]))var s=consumeCSSSelector(o);else{var s=consumeUntil(o,WHITESPACE_OR_COMMA);if(s==="closest"||s==="find"||s==="next"||s==="previous"){o.shift();let E=consumeCSSSelector(o);E.length>0&&(s+=" "+E)}}u.from=s}else c==="target"&&o[0]===":"?(o.shift(),u.target=consumeCSSSelector(o)):c==="throttle"&&o[0]===":"?(o.shift(),u.throttle=parseInterval(consumeUntil(o,WHITESPACE_OR_COMMA))):c==="queue"&&o[0]===":"?(o.shift(),u.queue=consumeUntil(o,WHITESPACE_OR_COMMA)):c==="root"&&o[0]===":"?(o.shift(),u[c]=consumeCSSSelector(o)):c==="threshold"&&o[0]===":"?(o.shift(),u[c]=consumeUntil(o,WHITESPACE_OR_COMMA)):triggerErrorEvent(e,"htmx:syntax:error",{token:o.shift()});consumeUntil(o,NOT_WHITESPACE)}r.push(u)}o.length===a&&triggerErrorEvent(e,"htmx:syntax:error",{token:o.shift()}),consumeUntil(o,NOT_WHITESPACE)}while(o[0]===","&&o.shift());return n&&(n[t]=r),r}function getTriggerSpecs(e){let t=getAttributeValue(e,"hx-trigger"),n=[];if(t){let r=htmx.config.triggerSpecsCache;n=r&&r[t]||parseAndCacheTrigger(e,t,r)}return n.length>0?n:matches(e,"form")?[{trigger:"submit"}]:matches(e,'input[type="button"], input[type="submit"]')?[{trigger:"click"}]:matches(e,INPUT_SELECTOR)?[{trigger:"change"}]:[{trigger:"click"}]}function cancelPolling(e){getInternalData(e).cancelled=!0}function processPolling(e,t,n){let r=getInternalData(e);r.timeout=getWindow().setTimeout(function(){bodyContains(e)&&r.cancelled!==!0&&(maybeFilterEvent(n,e,makeEvent("hx:poll:trigger",{triggerSpec:n,target:e}))||t(e),processPolling(e,t,n))},n.pollInterval)}function isLocalLink(e){return location.hostname===e.hostname&&getRawAttribute(e,"href")&&getRawAttribute(e,"href").indexOf("#")!==0}function eltIsDisabled(e){return closest(e,htmx.config.disableSelector)}function boostElement(e,t,n){if(e instanceof HTMLAnchorElement&&isLocalLink(e)&&(e.target===""||e.target==="_self")||e.tagName==="FORM"&&String(getRawAttribute(e,"method")).toLowerCase()!=="dialog"){t.boosted=!0;let r,o;if(e.tagName==="A")r="get",o=getRawAttribute(e,"href");else{let i=getRawAttribute(e,"method");r=i?i.toLowerCase():"get",o=getRawAttribute(e,"action"),(o==null||o==="")&&(o=location.href),r==="get"&&o.includes("?")&&(o=o.replace(/\?[^#]+/,""))}n.forEach(function(i){addEventListener(e,function(s,a){let l=asElement(s);if(eltIsDisabled(l)){cleanUpElement(l);return}issueAjaxRequest(r,o,l,a)},t,i,!0)})}}function shouldCancel(e,t){if(e.type==="submit"&&t.tagName==="FORM")return!0;if(e.type==="click"){let n=t.closest('input[type="submit"], button');if(n&&n.form&&n.type==="submit")return!0;let r=t.closest("a"),o=/^#.+/;if(r&&r.href&&!o.test(r.getAttribute("href")))return!0}return!1}function ignoreBoostedAnchorCtrlClick(e,t){return getInternalData(e).boosted&&e instanceof HTMLAnchorElement&&t.type==="click"&&(t.ctrlKey||t.metaKey)}function maybeFilterEvent(e,t,n){let r=e.eventFilter;if(r)try{return r.call(t,n)!==!0}catch(o){let i=r.source;return triggerErrorEvent(getDocument().body,"htmx:eventFilter:error",{error:o,source:i}),!0}return!1}function addEventListener(e,t,n,r,o){let i=getInternalData(e),s;r.from?s=querySelectorAllExt(e,r.from):s=[e],r.changed&&("lastValue"in i||(i.lastValue=new WeakMap),s.forEach(function(a){i.lastValue.has(r)||i.lastValue.set(r,new WeakMap),i.lastValue.get(r).set(a,a.value)})),forEach(s,function(a){let l=function(u){if(!bodyContains(e)){a.removeEventListener(r.trigger,l);return}if(ignoreBoostedAnchorCtrlClick(e,u)||((o||shouldCancel(u,a))&&u.preventDefault(),maybeFilterEvent(r,e,u)))return;let f=getInternalData(u);if(f.triggerSpec=r,f.handledFor==null&&(f.handledFor=[]),f.handledFor.indexOf(e)<0){if(f.handledFor.push(e),r.consume&&u.stopPropagation(),r.target&&u.target&&!matches(asElement(u.target),r.target))return;if(r.once){if(i.triggeredOnce)return;i.triggeredOnce=!0}if(r.changed){let c=u.target,m=c.value,E=i.lastValue.get(r);if(E.has(c)&&E.get(c)===m)return;E.set(c,m)}if(i.delayed&&clearTimeout(i.delayed),i.throttle)return;r.throttle>0?i.throttle||(triggerEvent(e,"htmx:trigger"),t(e,u),i.throttle=getWindow().setTimeout(function(){i.throttle=null},r.throttle)):r.delay>0?i.delayed=getWindow().setTimeout(function(){triggerEvent(e,"htmx:trigger"),t(e,u)},r.delay):(triggerEvent(e,"htmx:trigger"),t(e,u))}};n.listenerInfos==null&&(n.listenerInfos=[]),n.listenerInfos.push({trigger:r.trigger,listener:l,on:a}),a.addEventListener(r.trigger,l)})}let windowIsScrolling=!1,scrollHandler=null;function initScrollHandler(){scrollHandler||(scrollHandler=function(){windowIsScrolling=!0},window.addEventListener("scroll",scrollHandler),window.addEventListener("resize",scrollHandler),setInterval(function(){windowIsScrolling&&(windowIsScrolling=!1,forEach(getDocument().querySelectorAll("[hx-trigger*='revealed'],[data-hx-trigger*='revealed']"),function(e){maybeReveal(e)}))},200))}function maybeReveal(e){!hasAttribute(e,"data-hx-revealed")&&isScrolledIntoView(e)&&(e.setAttribute("data-hx-revealed","true"),getInternalData(e).initHash?triggerEvent(e,"revealed"):e.addEventListener("htmx:afterProcessNode",function(){triggerEvent(e,"revealed")},{once:!0}))}function loadImmediately(e,t,n,r){let o=function(){n.loaded||(n.loaded=!0,triggerEvent(e,"htmx:trigger"),t(e))};r>0?getWindow().setTimeout(o,r):o()}function processVerbs(e,t,n){let r=!1;return forEach(VERBS,function(o){if(hasAttribute(e,"hx-"+o)){let i=getAttributeValue(e,"hx-"+o);r=!0,t.path=i,t.verb=o,n.forEach(function(s){addTriggerHandler(e,s,t,function(a,l){let u=asElement(a);if(eltIsDisabled(u)){cleanUpElement(u);return}issueAjaxRequest(o,i,u,l)})})}}),r}function addTriggerHandler(e,t,n,r){if(t.trigger==="revealed")initScrollHandler(),addEventListener(e,r,n,t),maybeReveal(asElement(e));else if(t.trigger==="intersect"){let o={};t.root&&(o.root=querySelectorExt(e,t.root)),t.threshold&&(o.threshold=parseFloat(t.threshold)),new IntersectionObserver(function(s){for(let a=0;a<s.length;a++)if(s[a].isIntersecting){triggerEvent(e,"intersect");break}},o).observe(asElement(e)),addEventListener(asElement(e),r,n,t)}else!n.firstInitCompleted&&t.trigger==="load"?maybeFilterEvent(t,e,makeEvent("load",{elt:e}))||loadImmediately(asElement(e),r,n,t.delay):t.pollInterval>0?(n.polling=!0,processPolling(asElement(e),r,t)):addEventListener(e,r,n,t)}function shouldProcessHxOn(e){let t=asElement(e);if(!t)return!1;let n=t.attributes;for(let r=0;r<n.length;r++){let o=n[r].name;if(startsWith(o,"hx-on:")||startsWith(o,"data-hx-on:")||startsWith(o,"hx-on-")||startsWith(o,"data-hx-on-"))return!0}return!1}let HX_ON_QUERY=new XPathEvaluator().createExpression('.//*[@*[ starts-with(name(), "hx-on:") or starts-with(name(), "data-hx-on:") or starts-with(name(), "hx-on-") or starts-with(name(), "data-hx-on-") ]]');function processHXOnRoot(e,t){shouldProcessHxOn(e)&&t.push(asElement(e));let n=HX_ON_QUERY.evaluate(e),r=null;for(;r=n.iterateNext();)t.push(asElement(r))}function findHxOnWildcardElements(e){let t=[];if(e instanceof DocumentFragment)for(let n of e.childNodes)processHXOnRoot(n,t);else processHXOnRoot(e,t);return t}function findElementsToProcess(e){if(e.querySelectorAll){let n=", [hx-boost] a, [data-hx-boost] a, a[hx-boost], a[data-hx-boost]",r=[];for(let i of Object.keys(extensions)){let s=extensions[i];if(s.getSelectors){var t=s.getSelectors();t&&r.push(t)}}return e.querySelectorAll(VERB_SELECTOR+n+", form, [type='submit'], [hx-ext], [data-hx-ext], [hx-trigger], [data-hx-trigger]"+r.flat().map(i=>", "+i).join(""))}else return[]}function maybeSetLastButtonClicked(e){let t=getTargetButton(e.target),n=getRelatedFormData(e);n&&(n.lastButtonClicked=t)}function maybeUnsetLastButtonClicked(e){let t=getRelatedFormData(e);t&&(t.lastButtonClicked=null)}function getTargetButton(e){return closest(asElement(e),"button, input[type='submit']")}function getRelatedForm(e){return e.form||closest(e,"form")}function getRelatedFormData(e){let t=getTargetButton(e.target);if(!t)return;let n=getRelatedForm(t);if(n)return getInternalData(n)}function initButtonTracking(e){e.addEventListener("click",maybeSetLastButtonClicked),e.addEventListener("focusin",maybeSetLastButtonClicked),e.addEventListener("focusout",maybeUnsetLastButtonClicked)}function addHxOnEventHandler(e,t,n){let r=getInternalData(e);Array.isArray(r.onHandlers)||(r.onHandlers=[]);let o,i=function(s){maybeEval(e,function(){eltIsDisabled(e)||(o||(o=new Function("event",n)),o.call(e,s))})};e.addEventListener(t,i),r.onHandlers.push({event:t,listener:i})}function processHxOnWildcard(e){deInitOnHandlers(e);for(let t=0;t<e.attributes.length;t++){let n=e.attributes[t].name,r=e.attributes[t].value;if(startsWith(n,"hx-on")||startsWith(n,"data-hx-on")){let o=n.indexOf("-on")+3,i=n.slice(o,o+1);if(i==="-"||i===":"){let s=n.slice(o+1);startsWith(s,":")?s="htmx"+s:startsWith(s,"-")?s="htmx:"+s.slice(1):startsWith(s,"htmx-")&&(s="htmx:"+s.slice(5)),addHxOnEventHandler(e,s,r)}}}}function initNode(e){triggerEvent(e,"htmx:beforeProcessNode");let t=getInternalData(e),n=getTriggerSpecs(e);processVerbs(e,t,n)||(getClosestAttributeValue(e,"hx-boost")==="true"?boostElement(e,t,n):hasAttribute(e,"hx-trigger")&&n.forEach(function(o){addTriggerHandler(e,o,t,function(){})})),(e.tagName==="FORM"||getRawAttribute(e,"type")==="submit"&&hasAttribute(e,"form"))&&initButtonTracking(e),t.firstInitCompleted=!0,triggerEvent(e,"htmx:afterProcessNode")}function maybeDeInitAndHash(e){if(!(e instanceof Element))return!1;let t=getInternalData(e),n=attributeHash(e);return t.initHash!==n?(deInitNode(e),t.initHash=n,!0):!1}function processNode(e){if(e=resolveTarget(e),eltIsDisabled(e)){cleanUpElement(e);return}let t=[];maybeDeInitAndHash(e)&&t.push(e),forEach(findElementsToProcess(e),function(n){if(eltIsDisabled(n)){cleanUpElement(n);return}maybeDeInitAndHash(n)&&t.push(n)}),forEach(findHxOnWildcardElements(e),processHxOnWildcard),forEach(t,initNode)}function kebabEventName(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function makeEvent(e,t){return new CustomEvent(e,{bubbles:!0,cancelable:!0,composed:!0,detail:t})}function triggerErrorEvent(e,t,n){triggerEvent(e,t,mergeObjects({error:t},n))}function ignoreEventForLogging(e){return e==="htmx:afterProcessNode"}function withExtensions(e,t,n){forEach(getExtensions(e,[],n),function(r){try{t(r)}catch(o){logError(o)}})}function logError(e){console.error(e)}function triggerEvent(e,t,n){e=resolveTarget(e),n==null&&(n={}),n.elt=e;let r=makeEvent(t,n);htmx.logger&&!ignoreEventForLogging(t)&&htmx.logger(e,t,n),n.error&&(logError(n.error+(n.target?", "+n.target:"")),triggerEvent(e,"htmx:error",{errorInfo:n}));let o=e.dispatchEvent(r),i=kebabEventName(t);if(o&&i!==t){let s=makeEvent(i,r.detail);o=o&&e.dispatchEvent(s)}return withExtensions(asElement(e),function(s){o=o&&s.onEvent(t,r)!==!1&&!r.defaultPrevented}),o}let currentPathForHistory;function setCurrentPathForHistory(e){currentPathForHistory=e,canAccessLocalStorage()&&sessionStorage.setItem("htmx-current-path-for-history",e)}setCurrentPathForHistory(location.pathname+location.search);function getHistoryElement(){return getDocument().querySelector("[hx-history-elt],[data-hx-history-elt]")||getDocument().body}function saveToHistoryCache(e,t){if(!canAccessLocalStorage())return;let n=cleanInnerHtmlForHistory(t),r=getDocument().title,o=window.scrollY;if(htmx.config.historyCacheSize<=0){sessionStorage.removeItem("htmx-history-cache");return}e=normalizePath(e);let i=parseJSON(sessionStorage.getItem("htmx-history-cache"))||[];for(let a=0;a<i.length;a++)if(i[a].url===e){i.splice(a,1);break}let s={url:e,content:n,title:r,scroll:o};for(triggerEvent(getDocument().body,"htmx:historyItemCreated",{item:s,cache:i}),i.push(s);i.length>htmx.config.historyCacheSize;)i.shift();for(;i.length>0;)try{sessionStorage.setItem("htmx-history-cache",JSON.stringify(i));break}catch(a){triggerErrorEvent(getDocument().body,"htmx:historyCacheError",{cause:a,cache:i}),i.shift()}}function getCachedHistory(e){if(!canAccessLocalStorage())return null;e=normalizePath(e);let t=parseJSON(sessionStorage.getItem("htmx-history-cache"))||[];for(let n=0;n<t.length;n++)if(t[n].url===e)return t[n];return null}function cleanInnerHtmlForHistory(e){let t=htmx.config.requestClass,n=e.cloneNode(!0);return forEach(findAll(n,"."+t),function(r){removeClassFromElement(r,t)}),forEach(findAll(n,"[data-disabled-by-htmx]"),function(r){r.removeAttribute("disabled")}),n.innerHTML}function saveCurrentPageToHistory(){let e=getHistoryElement(),t=currentPathForHistory;canAccessLocalStorage()&&(t=sessionStorage.getItem("htmx-current-path-for-history")),t=t||location.pathname+location.search,getDocument().querySelector('[hx-history="false" i],[data-hx-history="false" i]')||(triggerEvent(getDocument().body,"htmx:beforeHistorySave",{path:t,historyElt:e}),saveToHistoryCache(t,e)),htmx.config.historyEnabled&&history.replaceState({htmx:!0},getDocument().title,location.href)}function pushUrlIntoHistory(e){htmx.config.getCacheBusterParam&&(e=e.replace(/org\.htmx\.cache-buster=[^&]*&?/,""),(endsWith(e,"&")||endsWith(e,"?"))&&(e=e.slice(0,-1))),htmx.config.historyEnabled&&history.pushState({htmx:!0},"",e),setCurrentPathForHistory(e)}function replaceUrlInHistory(e){htmx.config.historyEnabled&&history.replaceState({htmx:!0},"",e),setCurrentPathForHistory(e)}function settleImmediately(e){forEach(e,function(t){t.call(void 0)})}function loadHistoryFromServer(e){let t=new XMLHttpRequest,n={swapStyle:"innerHTML",swapDelay:0,settleDelay:0},r={path:e,xhr:t,historyElt:getHistoryElement(),swapSpec:n};t.open("GET",e,!0),htmx.config.historyRestoreAsHxRequest&&t.setRequestHeader("HX-Request","true"),t.setRequestHeader("HX-History-Restore-Request","true"),t.setRequestHeader("HX-Current-URL",location.href),t.onload=function(){this.status>=200&&this.status<400?(r.response=this.response,triggerEvent(getDocument().body,"htmx:historyCacheMissLoad",r),swap(r.historyElt,r.response,n,{contextElement:r.historyElt,historyRequest:!0}),setCurrentPathForHistory(r.path),triggerEvent(getDocument().body,"htmx:historyRestore",{path:e,cacheMiss:!0,serverResponse:r.response})):triggerErrorEvent(getDocument().body,"htmx:historyCacheMissLoadError",r)},triggerEvent(getDocument().body,"htmx:historyCacheMiss",r)&&t.send()}function restoreHistory(e){saveCurrentPageToHistory(),e=e||location.pathname+location.search;let t=getCachedHistory(e);if(t){let n={swapStyle:"innerHTML",swapDelay:0,settleDelay:0,scroll:t.scroll},r={path:e,item:t,historyElt:getHistoryElement(),swapSpec:n};triggerEvent(getDocument().body,"htmx:historyCacheHit",r)&&(swap(r.historyElt,t.content,n,{contextElement:r.historyElt,title:t.title}),setCurrentPathForHistory(r.path),triggerEvent(getDocument().body,"htmx:historyRestore",r))}else htmx.config.refreshOnHistoryMiss?htmx.location.reload(!0):loadHistoryFromServer(e)}function addRequestIndicatorClasses(e){let t=findAttributeTargets(e,"hx-indicator");return t==null&&(t=[e]),forEach(t,function(n){let r=getInternalData(n);r.requestCount=(r.requestCount||0)+1,addClassToElement(n,htmx.config.requestClass)}),t}function disableElements(e){let t=findAttributeTargets(e,"hx-disabled-elt");return t==null&&(t=[]),forEach(t,function(n){let r=getInternalData(n);r.requestCount=(r.requestCount||0)+1,n.hasAttribute("disabled")||(n.setAttribute("disabled",""),n.setAttribute("data-disabled-by-htmx",""))}),t}function removeRequestIndicators(e,t){forEach(e.concat(t),function(n){let r=getInternalData(n);r.requestCount=(r.requestCount||1)-1}),forEach(e,function(n){getInternalData(n).requestCount===0&&removeClassFromElement(n,htmx.config.requestClass)}),forEach(t,function(n){getInternalData(n).requestCount===0&&n.hasAttribute("data-disabled-by-htmx")&&(n.removeAttribute("disabled"),n.removeAttribute("data-disabled-by-htmx"))})}function haveSeenNode(e,t){for(let n=0;n<e.length;n++)if(e[n].isSameNode(t))return!0;return!1}function shouldInclude(e){let t=e;return t.name===""||t.name==null||t.disabled||closest(t,"fieldset[disabled]")||t.type==="button"||t.type==="submit"||t.tagName==="image"||t.tagName==="reset"||t.tagName==="file"?!1:t.type==="checkbox"||t.type==="radio"?t.checked:!0}function addValueToFormData(e,t,n){e!=null&&t!=null&&(Array.isArray(t)?t.forEach(function(r){n.append(e,r)}):n.append(e,t))}function removeValueFromFormData(e,t,n){if(e!=null&&t!=null){let r=n.getAll(e);Array.isArray(t)?r=r.filter(o=>t.indexOf(o)<0):r=r.filter(o=>o!==t),n.delete(e),forEach(r,o=>n.append(e,o))}}function getValueFromInput(e){return e instanceof HTMLSelectElement&&e.multiple?toArray(e.querySelectorAll("option:checked")).map(function(t){return t.value}):e instanceof HTMLInputElement&&e.files?toArray(e.files):e.value}function processInputValue(e,t,n,r,o){if(!(r==null||haveSeenNode(e,r))){if(e.push(r),shouldInclude(r)){let i=getRawAttribute(r,"name");addValueToFormData(i,getValueFromInput(r),t),o&&validateElement(r,n)}r instanceof HTMLFormElement&&(forEach(r.elements,function(i){e.indexOf(i)>=0?removeValueFromFormData(i.name,getValueFromInput(i),t):e.push(i),o&&validateElement(i,n)}),new FormData(r).forEach(function(i,s){i instanceof File&&i.name===""||addValueToFormData(s,i,t)}))}}function validateElement(e,t){let n=e;n.willValidate&&(triggerEvent(n,"htmx:validation:validate"),n.checkValidity()||(triggerEvent(n,"htmx:validation:failed",{message:n.validationMessage,validity:n.validity})&&!t.length&&htmx.config.reportValidityOfForms&&n.reportValidity(),t.push({elt:n,message:n.validationMessage,validity:n.validity})))}function overrideFormData(e,t){for(let n of t.keys())e.delete(n);return t.forEach(function(n,r){e.append(r,n)}),e}function getInputValues(e,t){let n=[],r=new FormData,o=new FormData,i=[],s=getInternalData(e);s.lastButtonClicked&&!bodyContains(s.lastButtonClicked)&&(s.lastButtonClicked=null);let a=e instanceof HTMLFormElement&&e.noValidate!==!0||getAttributeValue(e,"hx-validate")==="true";if(s.lastButtonClicked&&(a=a&&s.lastButtonClicked.formNoValidate!==!0),t!=="get"&&processInputValue(n,o,i,getRelatedForm(e),a),processInputValue(n,r,i,e,a),s.lastButtonClicked||e.tagName==="BUTTON"||e.tagName==="INPUT"&&getRawAttribute(e,"type")==="submit"){let u=s.lastButtonClicked||e,f=getRawAttribute(u,"name");addValueToFormData(f,u.value,o)}let l=findAttributeTargets(e,"hx-include");return forEach(l,function(u){processInputValue(n,r,i,asElement(u),a),matches(u,"form")||forEach(asParentNode(u).querySelectorAll(INPUT_SELECTOR),function(f){processInputValue(n,r,i,f,a)})}),overrideFormData(r,o),{errors:i,formData:r,values:formDataProxy(r)}}function appendParam(e,t,n){e!==""&&(e+="&"),String(n)==="[object Object]"&&(n=JSON.stringify(n));let r=encodeURIComponent(n);return e+=encodeURIComponent(t)+"="+r,e}function urlEncode(e){e=formDataFromObject(e);let t="";return e.forEach(function(n,r){t=appendParam(t,r,n)}),t}function getHeaders(e,t,n){let r={"HX-Request":"true","HX-Trigger":getRawAttribute(e,"id"),"HX-Trigger-Name":getRawAttribute(e,"name"),"HX-Target":getAttributeValue(t,"id"),"HX-Current-URL":location.href};return getValuesForElement(e,"hx-headers",!1,r),n!==void 0&&(r["HX-Prompt"]=n),getInternalData(e).boosted&&(r["HX-Boosted"]="true"),r}function filterValues(e,t){let n=getClosestAttributeValue(t,"hx-params");if(n){if(n==="none")return new FormData;if(n==="*")return e;if(n.indexOf("not ")===0)return forEach(n.slice(4).split(","),function(r){r=r.trim(),e.delete(r)}),e;{let r=new FormData;return forEach(n.split(","),function(o){o=o.trim(),e.has(o)&&e.getAll(o).forEach(function(i){r.append(o,i)})}),r}}else return e}function isAnchorLink(e){return!!getRawAttribute(e,"href")&&getRawAttribute(e,"href").indexOf("#")>=0}function getSwapSpecification(e,t){let n=t||getClosestAttributeValue(e,"hx-swap"),r={swapStyle:getInternalData(e).boosted?"innerHTML":htmx.config.defaultSwapStyle,swapDelay:htmx.config.defaultSwapDelay,settleDelay:htmx.config.defaultSettleDelay};if(htmx.config.scrollIntoViewOnBoost&&getInternalData(e).boosted&&!isAnchorLink(e)&&(r.show="top"),n){let s=splitOnWhitespace(n);if(s.length>0)for(let a=0;a<s.length;a++){let l=s[a];if(l.indexOf("swap:")===0)r.swapDelay=parseInterval(l.slice(5));else if(l.indexOf("settle:")===0)r.settleDelay=parseInterval(l.slice(7));else if(l.indexOf("transition:")===0)r.transition=l.slice(11)==="true";else if(l.indexOf("ignoreTitle:")===0)r.ignoreTitle=l.slice(12)==="true";else if(l.indexOf("scroll:")===0){var o=l.slice(7).split(":");let f=o.pop();var i=o.length>0?o.join(":"):null;r.scroll=f,r.scrollTarget=i}else if(l.indexOf("show:")===0){var o=l.slice(5).split(":");let c=o.pop();var i=o.length>0?o.join(":"):null;r.show=c,r.showTarget=i}else if(l.indexOf("focus-scroll:")===0){let u=l.slice(13);r.focusScroll=u=="true"}else a==0?r.swapStyle=l:logError("Unknown modifier in hx-swap: "+l)}}return r}function usesFormData(e){return getClosestAttributeValue(e,"hx-encoding")==="multipart/form-data"||matches(e,"form")&&getRawAttribute(e,"enctype")==="multipart/form-data"}function encodeParamsForBody(e,t,n){let r=null;return withExtensions(t,function(o){r==null&&(r=o.encodeParameters(e,n,t))}),r??(usesFormData(t)?overrideFormData(new FormData,formDataFromObject(n)):urlEncode(n))}function makeSettleInfo(e){return{tasks:[],elts:[e]}}function updateScrollState(e,t){let n=e[0],r=e[e.length-1];if(t.scroll){var o=null;t.scrollTarget&&(o=asElement(querySelectorExt(n,t.scrollTarget))),t.scroll==="top"&&(n||o)&&(o=o||n,o.scrollTop=0),t.scroll==="bottom"&&(r||o)&&(o=o||r,o.scrollTop=o.scrollHeight),typeof t.scroll=="number"&&getWindow().setTimeout(function(){window.scrollTo(0,t.scroll)},0)}if(t.show){var o=null;if(t.showTarget){let s=t.showTarget;t.showTarget==="window"&&(s="body"),o=asElement(querySelectorExt(n,s))}t.show==="top"&&(n||o)&&(o=o||n,o.scrollIntoView({block:"start",behavior:htmx.config.scrollBehavior})),t.show==="bottom"&&(r||o)&&(o=o||r,o.scrollIntoView({block:"end",behavior:htmx.config.scrollBehavior}))}}function getValuesForElement(e,t,n,r,o){if(r==null&&(r={}),e==null)return r;let i=getAttributeValue(e,t);if(i){let s=i.trim(),a=n;if(s==="unset")return null;s.indexOf("javascript:")===0?(s=s.slice(11),a=!0):s.indexOf("js:")===0&&(s=s.slice(3),a=!0),s.indexOf("{")!==0&&(s="{"+s+"}");let l;a?l=maybeEval(e,function(){return o?Function("event","return ("+s+")").call(e,o):Function("return ("+s+")").call(e)},{}):l=parseJSON(s);for(let u of Object.keys(l))r[u]==null&&(r[u]=l[u])}return getValuesForElement(asElement(parentElt(e)),t,n,r,o)}function maybeEval(e,t,n){return htmx.config.allowEval?t():(triggerErrorEvent(e,"htmx:evalDisallowedError"),n)}function getHXVarsForElement(e,t,n){return getValuesForElement(e,"hx-vars",!0,n,t)}function getHXValsForElement(e,t,n){return getValuesForElement(e,"hx-vals",!1,n,t)}function getExpressionVars(e,t){return mergeObjects(getHXVarsForElement(e,t),getHXValsForElement(e,t))}function safelySetHeaderValue(e,t,n){if(n!==null)try{e.setRequestHeader(t,n)}catch{e.setRequestHeader(t,encodeURIComponent(n)),e.setRequestHeader(t+"-URI-AutoEncoded","true")}}function getPathFromResponse(e){if(e.responseURL)try{let t=new URL(e.responseURL);return t.pathname+t.search}catch{triggerErrorEvent(getDocument().body,"htmx:badResponseUrl",{url:e.responseURL})}}function hasHeader(e,t){return e.getResponseHeader(t)!==null}function ajaxHelper(e,t,n){if(e=e.toLowerCase(),n){if(n instanceof Element||typeof n=="string")return issueAjaxRequest(e,t,null,null,{targetOverride:resolveTarget(n)||DUMMY_ELT,returnPromise:!0});{let r=resolveTarget(n.target);return(n.target&&!r||n.source&&!r&&!resolveTarget(n.source))&&(r=DUMMY_ELT),issueAjaxRequest(e,t,resolveTarget(n.source),n.event,{handler:n.handler,headers:n.headers,values:n.values,targetOverride:r,swapOverride:n.swap,select:n.select,returnPromise:!0,push:n.push,replace:n.replace,selectOOB:n.selectOOB})}}else return issueAjaxRequest(e,t,null,null,{returnPromise:!0})}function hierarchyForElt(e){let t=[];for(;e;)t.push(e),e=e.parentElement;return t}function verifyPath(e,t,n){let r=new URL(t,location.protocol!=="about:"?location.href:window.origin),i=(location.protocol!=="about:"?location.origin:window.origin)===r.origin;return htmx.config.selfRequestsOnly&&!i?!1:triggerEvent(e,"htmx:validateUrl",mergeObjects({url:r,sameHost:i},n))}function formDataFromObject(e){if(e instanceof FormData)return e;let t=new FormData;for(let n of Object.keys(e))e[n]&&typeof e[n].forEach=="function"?e[n].forEach(function(r){t.append(n,r)}):typeof e[n]=="object"&&!(e[n]instanceof Blob)?t.append(n,JSON.stringify(e[n])):t.append(n,e[n]);return t}function formDataArrayProxy(e,t,n){return new Proxy(n,{get:function(r,o){return typeof o=="number"?r[o]:o==="length"?r.length:o==="push"?function(i){r.push(i),e.append(t,i)}:typeof r[o]=="function"?function(){r[o].apply(r,arguments),e.delete(t),r.forEach(function(i){e.append(t,i)})}:r[o]&&r[o].length===1?r[o][0]:r[o]},set:function(r,o,i){return r[o]=i,e.delete(t),r.forEach(function(s){e.append(t,s)}),!0}})}function formDataProxy(e){return new Proxy(e,{get:function(t,n){if(typeof n=="symbol"){let o=Reflect.get(t,n);return typeof o=="function"?function(){return o.apply(e,arguments)}:o}if(n==="toJSON")return()=>Object.fromEntries(e);if(n in t&&typeof t[n]=="function")return function(){return e[n].apply(e,arguments)};let r=e.getAll(n);if(r.length!==0)return r.length===1?r[0]:formDataArrayProxy(t,n,r)},set:function(t,n,r){return typeof n!="string"?!1:(t.delete(n),r&&typeof r.forEach=="function"?r.forEach(function(o){t.append(n,o)}):typeof r=="object"&&!(r instanceof Blob)?t.append(n,JSON.stringify(r)):t.append(n,r),!0)},deleteProperty:function(t,n){return typeof n=="string"&&t.delete(n),!0},ownKeys:function(t){return Reflect.ownKeys(Object.fromEntries(t))},getOwnPropertyDescriptor:function(t,n){return Reflect.getOwnPropertyDescriptor(Object.fromEntries(t),n)}})}function issueAjaxRequest(e,t,n,r,o,i){let s=null,a=null;if(o=o??{},o.returnPromise&&typeof Promise<"u")var l=new Promise(function(y,A){s=y,a=A});n==null&&(n=getDocument().body);let u=o.handler||handleAjaxResponse,f=o.select||null;if(!bodyContains(n))return maybeCall(s),l;let c=o.targetOverride||asElement(getTarget(n));if(c==null||c==DUMMY_ELT)return triggerErrorEvent(n,"htmx:targetError",{target:getClosestAttributeValue(n,"hx-target")}),maybeCall(a),l;let m=getInternalData(n),E=m.lastButtonClicked;if(E){let y=getRawAttribute(E,"formaction");y!=null&&(t=y);let A=getRawAttribute(E,"formmethod");if(A!=null)if(VERBS.includes(A.toLowerCase()))e=A;else return maybeCall(s),l}let T=getClosestAttributeValue(n,"hx-confirm");if(i===void 0&&triggerEvent(n,"htmx:confirm",{target:c,elt:n,path:t,verb:e,triggeringEvent:r,etc:o,issueRequest:function(M){return issueAjaxRequest(e,t,n,r,o,!!M)},question:T})===!1)return maybeCall(s),l;let h=n,p=getClosestAttributeValue(n,"hx-sync"),v=null,H=!1;if(p){let y=p.split(":"),A=y[0].trim();if(A==="this"?h=findThisElement(n,"hx-sync"):h=asElement(querySelectorExt(n,A)),p=(y[1]||"drop").trim(),m=getInternalData(h),p==="drop"&&m.xhr&&m.abortable!==!0)return maybeCall(s),l;if(p==="abort"){if(m.xhr)return maybeCall(s),l;H=!0}else p==="replace"?triggerEvent(h,"htmx:abort"):p.indexOf("queue")===0&&(v=(p.split(" ")[1]||"last").trim())}if(m.xhr)if(m.abortable)triggerEvent(h,"htmx:abort");else{if(v==null){if(r){let y=getInternalData(r);y&&y.triggerSpec&&y.triggerSpec.queue&&(v=y.triggerSpec.queue)}v==null&&(v="last")}return m.queuedRequests==null&&(m.queuedRequests=[]),v==="first"&&m.queuedRequests.length===0?m.queuedRequests.push(function(){issueAjaxRequest(e,t,n,r,o)}):v==="all"?m.queuedRequests.push(function(){issueAjaxRequest(e,t,n,r,o)}):v==="last"&&(m.queuedRequests=[],m.queuedRequests.push(function(){issueAjaxRequest(e,t,n,r,o)})),maybeCall(s),l}let b=new XMLHttpRequest;m.xhr=b,m.abortable=H;let d=function(){m.xhr=null,m.abortable=!1,m.queuedRequests!=null&&m.queuedRequests.length>0&&m.queuedRequests.shift()()},g=getClosestAttributeValue(n,"hx-prompt");if(g){var x=prompt(g);if(x===null||!triggerEvent(n,"htmx:prompt",{prompt:x,target:c}))return maybeCall(s),d(),l}if(T&&!i&&!confirm(T))return maybeCall(s),d(),l;let S=getHeaders(n,c,x);e!=="get"&&!usesFormData(n)&&(S["Content-Type"]="application/x-www-form-urlencoded"),o.headers&&(S=mergeObjects(S,o.headers));let D=getInputValues(n,e),w=D.errors,k=D.formData;o.values&&overrideFormData(k,formDataFromObject(o.values));let B=formDataFromObject(getExpressionVars(n,r)),O=overrideFormData(k,B),I=filterValues(O,n);htmx.config.getCacheBusterParam&&e==="get"&&I.set("org.htmx.cache-buster",getRawAttribute(c,"id")||"true"),(t==null||t==="")&&(t=location.href);let K=getValuesForElement(n,"hx-request"),me=getInternalData(n).boosted,V=htmx.config.methodsThatUseUrlParams.indexOf(e)>=0,L={boosted:me,useUrlParams:V,formData:I,parameters:formDataProxy(I),unfilteredFormData:O,unfilteredParameters:formDataProxy(O),headers:S,elt:n,target:c,verb:e,errors:w,withCredentials:o.credentials||K.credentials||htmx.config.withCredentials,timeout:o.timeout||K.timeout||htmx.config.timeout,path:t,triggeringEvent:r};if(!triggerEvent(n,"htmx:configRequest",L))return maybeCall(s),d(),l;if(t=L.path,e=L.verb,S=L.headers,I=formDataFromObject(L.parameters),w=L.errors,V=L.useUrlParams,w&&w.length>0)return triggerEvent(n,"htmx:validation:halted",L),maybeCall(s),d(),l;let he=t.split("#"),Ve=he[0],Q=he[1],R=t;if(V&&(R=Ve,!I.keys().next().done&&(R.indexOf("?")<0?R+="?":R+="&",R+=urlEncode(I),Q&&(R+="#"+Q))),!verifyPath(n,R,L))return triggerErrorEvent(n,"htmx:invalidPath",L),maybeCall(a),d(),l;if(b.open(e.toUpperCase(),R,!0),b.overrideMimeType("text/html"),b.withCredentials=L.withCredentials,b.timeout=L.timeout,!K.noHeaders)for(let y of Object.keys(S))safelySetHeaderValue(b,y,S[y]);let C={xhr:b,target:c,requestConfig:L,etc:o,boosted:me,select:f,pathInfo:{requestPath:t,finalRequestPath:R,responsePath:null,anchor:Q}};if(b.onload=function(){try{let y=hierarchyForElt(n);if(C.pathInfo.responsePath=getPathFromResponse(b),u(n,C),C.keepIndicators!==!0&&removeRequestIndicators(U,W),triggerEvent(n,"htmx:afterRequest",C),triggerEvent(n,"htmx:afterOnLoad",C),!bodyContains(n)){let A=null;for(;y.length>0&&A==null;){let M=y.shift();bodyContains(M)&&(A=M)}A&&(triggerEvent(A,"htmx:afterRequest",C),triggerEvent(A,"htmx:afterOnLoad",C))}maybeCall(s)}catch(y){throw triggerErrorEvent(n,"htmx:onLoadError",mergeObjects({error:y},C)),y}finally{d()}},b.onerror=function(){removeRequestIndicators(U,W),triggerErrorEvent(n,"htmx:afterRequest",C),triggerErrorEvent(n,"htmx:sendError",C),maybeCall(a),d()},b.onabort=function(){removeRequestIndicators(U,W),triggerErrorEvent(n,"htmx:afterRequest",C),triggerErrorEvent(n,"htmx:sendAbort",C),maybeCall(a),d()},b.ontimeout=function(){removeRequestIndicators(U,W),triggerErrorEvent(n,"htmx:afterRequest",C),triggerErrorEvent(n,"htmx:timeout",C),maybeCall(a),d()},!triggerEvent(n,"htmx:beforeRequest",C))return maybeCall(s),d(),l;var U=addRequestIndicatorClasses(n),W=disableElements(n);forEach(["loadstart","loadend","progress","abort"],function(y){forEach([b,b.upload],function(A){A.addEventListener(y,function(M){triggerEvent(n,"htmx:xhr:"+y,{lengthComputable:M.lengthComputable,loaded:M.loaded,total:M.total})})})}),triggerEvent(n,"htmx:beforeSend",C);let Ue=V?null:encodeParamsForBody(b,n,I);return b.send(Ue),l}function determineHistoryUpdates(e,t){let n=t.xhr,r=null,o=null;if(hasHeader(n,"HX-Push")?(r=n.getResponseHeader("HX-Push"),o="push"):hasHeader(n,"HX-Push-Url")?(r=n.getResponseHeader("HX-Push-Url"),o="push"):hasHeader(n,"HX-Replace-Url")&&(r=n.getResponseHeader("HX-Replace-Url"),o="replace"),r)return r==="false"?{}:{type:o,path:r};let i=t.pathInfo.finalRequestPath,s=t.pathInfo.responsePath,a=t.etc.push||getClosestAttributeValue(e,"hx-push-url"),l=t.etc.replace||getClosestAttributeValue(e,"hx-replace-url");l==="false"&&(l=null);let u=getInternalData(e).boosted,f=null,c=null;return a?(f="push",c=a):l?(f="replace",c=l):u&&(f="push",c=s||i),c?c==="false"?{}:(c==="true"&&(c=s||i),t.pathInfo.anchor&&c.indexOf("#")===-1&&(c=c+"#"+t.pathInfo.anchor),{type:f,path:c}):{}}function codeMatches(e,t){var n=new RegExp(e.code);return n.test(t.toString(10))}function resolveResponseHandling(e){for(var t=0;t<htmx.config.responseHandling.length;t++){var n=htmx.config.responseHandling[t];if(codeMatches(n,e.status))return n}return{swap:!1}}function handleTitle(e){if(e){let t=find("title");t?t.textContent=e:window.document.title=e}}function resolveRetarget(e,t){if(t==="this")return e;let n=asElement(querySelectorExt(e,t));if(n==null)throw triggerErrorEvent(e,"htmx:targetError",{target:t}),new Error(`Invalid re-target ${t}`);return n}function handleAjaxResponse(e,t){let n=t.xhr,r=t.target,o=t.etc,i=t.select;if(!triggerEvent(e,"htmx:beforeOnLoad",t))return;if(hasHeader(n,"HX-Trigger")&&handleTriggerHeader(n,"HX-Trigger",e),hasHeader(n,"HX-Location")){let H=n.getResponseHeader("HX-Location");var s={};H.indexOf("{")===0&&(s=parseJSON(H),H=s.path,delete s.path),s.push=s.push??"true",ajaxHelper("get",H,s);return}let a=hasHeader(n,"HX-Refresh")&&n.getResponseHeader("HX-Refresh")==="true";if(hasHeader(n,"HX-Redirect")){t.keepIndicators=!0,htmx.location.href=n.getResponseHeader("HX-Redirect"),a&&htmx.location.reload();return}if(a){t.keepIndicators=!0,htmx.location.reload();return}let l=determineHistoryUpdates(e,t),u=resolveResponseHandling(n),f=u.swap,c=!!u.error,m=htmx.config.ignoreTitle||u.ignoreTitle,E=u.select;u.target&&(t.target=resolveRetarget(e,u.target));var T=o.swapOverride;T==null&&u.swapOverride&&(T=u.swapOverride),hasHeader(n,"HX-Retarget")&&(t.target=resolveRetarget(e,n.getResponseHeader("HX-Retarget"))),hasHeader(n,"HX-Reswap")&&(T=n.getResponseHeader("HX-Reswap"));var h=n.response,p=mergeObjects({shouldSwap:f,serverResponse:h,isError:c,ignoreTitle:m,selectOverride:E,swapOverride:T},t);if(!(u.event&&!triggerEvent(r,u.event,p))&&triggerEvent(r,"htmx:beforeSwap",p)){if(r=p.target,h=p.serverResponse,c=p.isError,m=p.ignoreTitle,E=p.selectOverride,T=p.swapOverride,t.target=r,t.failed=c,t.successful=!c,p.shouldSwap){n.status===286&&cancelPolling(e),withExtensions(e,function(d){h=d.transformResponse(h,n,e)}),l.type&&saveCurrentPageToHistory();var v=getSwapSpecification(e,T);v.hasOwnProperty("ignoreTitle")||(v.ignoreTitle=m),addClassToElement(r,htmx.config.swappingClass),i&&(E=i),hasHeader(n,"HX-Reselect")&&(E=n.getResponseHeader("HX-Reselect"));let H=o.selectOOB||getClosestAttributeValue(e,"hx-select-oob"),b=getClosestAttributeValue(e,"hx-select");swap(r,h,v,{select:E==="unset"?null:E||b,selectOOB:H,eventInfo:t,anchor:t.pathInfo.anchor,contextElement:e,afterSwapCallback:function(){if(hasHeader(n,"HX-Trigger-After-Swap")){let d=e;bodyContains(e)||(d=getDocument().body),handleTriggerHeader(n,"HX-Trigger-After-Swap",d)}},afterSettleCallback:function(){if(hasHeader(n,"HX-Trigger-After-Settle")){let d=e;bodyContains(e)||(d=getDocument().body),handleTriggerHeader(n,"HX-Trigger-After-Settle",d)}},beforeSwapCallback:function(){l.type&&(triggerEvent(getDocument().body,"htmx:beforeHistoryUpdate",mergeObjects({history:l},t)),l.type==="push"?(pushUrlIntoHistory(l.path),triggerEvent(getDocument().body,"htmx:pushedIntoHistory",{path:l.path})):(replaceUrlInHistory(l.path),triggerEvent(getDocument().body,"htmx:replacedInHistory",{path:l.path})))}})}c&&triggerErrorEvent(e,"htmx:responseError",mergeObjects({error:"Response Status Error Code "+n.status+" from "+t.pathInfo.requestPath},t))}}let extensions={};function extensionBase(){return{init:function(e){return null},getSelectors:function(){return null},onEvent:function(e,t){return!0},transformResponse:function(e,t,n){return e},isInlineSwap:function(e){return!1},handleSwap:function(e,t,n,r){return!1},encodeParameters:function(e,t,n){return null}}}function defineExtension(e,t){t.init&&t.init(internalAPI),extensions[e]=mergeObjects(extensionBase(),t)}function removeExtension(e){delete extensions[e]}function getExtensions(e,t,n){if(t==null&&(t=[]),e==null)return t;n==null&&(n=[]);let r=getAttributeValue(e,"hx-ext");return r&&forEach(r.split(","),function(o){if(o=o.replace(/ /g,""),o.slice(0,7)=="ignore:"){n.push(o.slice(7));return}if(n.indexOf(o)<0){let i=extensions[o];i&&t.indexOf(i)<0&&t.push(i)}}),getExtensions(asElement(parentElt(e)),t,n)}var isReady=!1;getDocument().addEventListener("DOMContentLoaded",function(){isReady=!0});function ready(e){isReady||getDocument().readyState==="complete"?e():getDocument().addEventListener("DOMContentLoaded",e)}function insertIndicatorStyles(){if(htmx.config.includeIndicatorStyles!==!1){let e=htmx.config.inlineStyleNonce?` nonce="${htmx.config.inlineStyleNonce}"`:"",t=htmx.config.indicatorClass,n=htmx.config.requestClass;getDocument().head.insertAdjacentHTML("beforeend",`<style${e}>.${t}{opacity:0;visibility: hidden} .${n} .${t}, .${n}.${t}{opacity:1;visibility: visible;transition: opacity 200ms ease-in}</style>`)}}function getMetaConfig(){let e=getDocument().querySelector('meta[name="htmx-config"]');return e?parseJSON(e.content):null}function mergeMetaConfig(){let e=getMetaConfig();e&&(htmx.config=mergeObjects(htmx.config,e))}return ready(function(){mergeMetaConfig(),insertIndicatorStyles();let e=getDocument().body;processNode(e);let t=getDocument().querySelectorAll("[hx-trigger='restored'],[data-hx-trigger='restored']");e.addEventListener("htmx:abort",function(r){let o=r.detail.elt||r.target,i=getInternalData(o);i&&i.xhr&&i.xhr.abort()});let n=window.onpopstate?window.onpopstate.bind(window):null;window.onpopstate=function(r){r.state&&r.state.htmx?(restoreHistory(),forEach(t,function(o){triggerEvent(o,"htmx:restored",{document:getDocument(),triggerEvent})})):n&&n(r)},getWindow().setTimeout(function(){triggerEvent(e,"htmx:load",{}),e=null},0)}),htmx})(),Z=Xe});_();_();var $e=Z,P="inlay-picker",j=null,X=null,F=e=>{e.dispatchEvent(new Event("change",{bubbles:!0}))},pe=()=>{let e=document.getElementById(P);return e instanceof HTMLDialogElement?e:null};function Ye(e){if(e===null)return null;let t;try{t=JSON.parse(e)}catch{return null}if(typeof t!="object"||t===null)return null;let{value:n,label:r,thumb:o}=t;return typeof n!="string"||typeof r!="string"?null:typeof o=="string"&&o.startsWith("/media/")?{value:n,label:r,thumb:o}:{value:n,label:r}}function Ee(e,t){let n=pe();n&&(j=document.activeElement instanceof HTMLElement?document.activeElement:null,X=t,n.querySelector("#inlay-picker-body")?.replaceChildren(),$e.ajax("get",e,{target:"#inlay-picker-body",swap:"innerHTML"}),n.open||n.showModal())}function ye(e,t,n){let r=e.querySelector("[data-picker-label]");r&&(r.textContent=t??r.dataset.empty??"",r.classList.remove("rounded-box","bg-warning","px-2","text-warning-content"),r.classList.toggle("text-base-content/70",t===null));let o=e.querySelector("img[data-picker-thumb]");o&&(n===void 0?o.removeAttribute("src"):o.src=n,o.hidden=n===void 0)}function ze(e,t){if(e.hasAttribute("data-many")){let o=e.querySelector("[data-picker-list]"),i=e.querySelector("template[data-picker-chip]");if(!o||!(i instanceof HTMLTemplateElement)||[...o.querySelectorAll('input[type="hidden"]')].some(m=>m.value===t.value))return;let a=i.content.firstElementChild?.cloneNode(!0);if(!(a instanceof HTMLElement))return;let l=a.querySelector('input[type="hidden"]');l&&(l.value=t.value);let u=a.querySelector("[data-chip-label]");u&&(u.textContent=t.label);let f=a.querySelector("[data-picker-remove]"),c=i.dataset.removeLabel;f&&c!==void 0&&f.setAttribute("aria-label",c.replace("{item}",t.label)),o.append(a),l&&F(l);return}let n=e.querySelector("input[data-picker-value]");n&&(n.value=t.value),ye(e,t.label,t.thumb);let r=e.closest("[data-link]")?.querySelector('input[data-link-mode="document"]');r&&(r.checked=!0),n&&F(n)}function Je(e){if(e.hasAttribute("data-many")){let n=e.querySelector("[data-picker-list]");for(let r of n?.querySelectorAll('input[type="hidden"]')??[])F(r);n?.replaceChildren();return}let t=e.querySelector("input[data-picker-value]");t&&(t.value=""),ye(e,null,void 0),t&&F(t)}function Ge(e){let t=e.closest("[data-picker]"),n=e.closest("li");for(let r of n?.querySelectorAll('input[type="hidden"]')??[])F(r);n?.remove(),t?.querySelector("[data-picker-open]")?.focus()}function be(e){let t=X;t&&(X=null,pe()?.close(),t(e))}function Ke(e){if(/[\u0000-\u001f\u007f]/.test(e))return!1;if(e.startsWith("/"))return!e.startsWith("//")&&!e.startsWith("/\\");try{return["http:","https:","mailto:","tel:"].includes(new URL(e).protocol)}catch{return!1}}function ve(e){let t=e.querySelector("input");if(!t)return;let n=t.value.trim();if(Ke(n)){be({value:`url:${n}`,label:n});return}let r=e.querySelector("[data-pick-web-problem]");if(r){r.hidden=!1;let o=(t.getAttribute("aria-describedby")??"").split(" ").filter(i=>i!=="");r.id!==""&&!o.includes(r.id)&&t.setAttribute("aria-describedby",[...o,r.id].join(" "))}t.setAttribute("aria-invalid","true"),t.focus()}function Qe(e){let t=e.target instanceof Element?e.target:null;if(!t)return;let n=t.closest(`#${P} [data-pick]`);if(n){let a=Ye(n.getAttribute("data-pick"));a&&be(a);return}let r=t.closest(`#${P} [data-pick-web-use]`)?.closest("[data-pick-web]");if(r){ve(r);return}let o=t.closest("[data-picker-open]"),i=t.closest("[data-picker]");if(o&&i){let a=i.dataset.picker;a!==void 0&&Ee(a,l=>ze(i,l));return}if(t.closest("[data-picker-clear]")&&i){Je(i);return}let s=t.closest("[data-picker-remove]");s&&Ge(s)}function Ze(e){let t=e.target;if(!(t instanceof HTMLInputElement)||!t.hasAttribute("data-link-url"))return;let n=t.closest("[data-link]")?.querySelector('input[data-link-mode="url"]');n&&t.value!==""&&(n.checked=!0)}function et(e){if(e.key!=="Enter"||!(e.target instanceof HTMLInputElement))return;let t=e.target.closest(`#${P} [data-pick-web]`);t&&(e.preventDefault(),ve(t))}function tt(e){!(e.target instanceof HTMLDialogElement)||e.target.id!==P||(X=null,j?.isConnected&&j.focus(),j=null)}function nt(e){let t=e.target;!(t instanceof Element)||t.id!=="inlay-picker-body"||t.querySelector('input[type="search"]')?.focus()}document.addEventListener("click",Qe);document.addEventListener("input",Ze);document.addEventListener("keydown",et);document.addEventListener("close",tt,!0);document.addEventListener("htmx:afterSwap",nt);window.InlayAdmin={openPicker:Ee};async function rt(e){await(await Promise.resolve().then(()=>(_(),ge))).default.ajax("get",e,{target:"#bulk-delete-body",select:"#bulk-delete-confirm"})}var $=new WeakSet;function ot(e){$.has(e)||($.add(e),e.addEventListener("click",t=>{!(t.target instanceof Element)||t.target.closest("[data-dialog-cancel]")===null||(t.preventDefault(),e.close())}))}function it(e,t){let n=e.ownerDocument,r=n.getElementById("bulk-delete-body");r?.replaceChildren(),ot(e),e.open||e.showModal();let o=()=>{e.close(),n.defaultView?.location.assign(t)};rt(t).then(()=>{let i=r?.querySelector("#bulk-delete-confirm");if(i==null)return o();i.querySelector('form button[type="submit"]')?.focus()},o)}function xe(e){if($.has(e))return;$.add(e);let t=e.querySelector("form");if(t===null||t.id==="")return;let n=e.ownerDocument,r=u=>[...n.querySelectorAll(u)].filter(f=>f.getAttribute("form")===t.id),o=()=>r('input[type="checkbox"][name="ids"]'),i=()=>r('input[type="checkbox"][data-select-all]'),s=e.querySelector("[data-selected-count]"),a=e.dataset.selectedTemplate??"{count}",l=()=>{let u=o(),f=u.filter(c=>c.checked).length;e.hidden=f===0,s!==null&&(s.textContent=f===0?"":a.replace("{count}",String(f)));for(let c of i())c.checked=f>0&&f===u.length,c.indeterminate=f>0&&f<u.length};for(let u of o())u.addEventListener("change",l);for(let u of i())u.addEventListener("change",()=>{for(let f of o())f.checked=u.checked;l()});for(let u of e.querySelectorAll("button[data-bulk-delete]"))u.addEventListener("click",f=>{let c=n.getElementById("bulk-delete-dialog"),m=u.getAttribute("formaction");if(!(c instanceof HTMLDialogElement)||m===null)return;f.preventDefault();let E=new URLSearchParams;for(let h of o())h.checked&&E.append("ids",h.value);let T=r('input[name="back"]')[0];T!==void 0&&E.set("back",T.value),it(c,`${m}?${E.toString()}`)});e.querySelector("[data-clear-selection]")?.addEventListener("click",()=>{for(let u of o())u.checked=!1;l(),i()[0]?.focus()}),l()}function ee(e){e instanceof HTMLElement&&e.matches("[data-bulk-bar]")&&xe(e);for(let t of e.querySelectorAll("[data-bulk-bar]"))xe(t)}var Se=new WeakSet;function Te(e){if(Se.has(e))return;Se.add(e);let t=()=>[...e.querySelectorAll("details.dropdown[open]")];e.addEventListener("keydown",n=>{if(n.key!=="Escape"||!(n.target instanceof Element))return;let r=n.target.closest("details.dropdown[open]");r!==null&&(n.preventDefault(),r.open=!1,r.querySelector(":scope > summary")?.focus())}),e.addEventListener("click",n=>{let r=n.target instanceof Node?n.target:null;for(let o of t())(r===null||!o.contains(r))&&(o.open=!1)})}var we=new WeakSet;function te(e){for(let t of e.querySelectorAll("[data-length-for]")){if(we.has(t))continue;let n=t.ownerDocument.getElementById(t.getAttribute("data-length-for")??""),r=Number(t.getAttribute("data-suggested-length")),o=t.getAttribute("data-label"),i=t.querySelector("[data-length-count]"),s=t.querySelector("[data-length-hint]");if(!(n instanceof HTMLInputElement||n instanceof HTMLTextAreaElement)||o===null||i===null||!Number.isFinite(r))continue;we.add(t);let a=()=>{let l=n.value.length;i.textContent=o.replace("{count}",()=>String(l)),s?.toggleAttribute("hidden",l<=r)};n.addEventListener("input",a)}}var st="publish-panel",at="publish-dialog-body",Ae=new WeakSet;function He(e,t){for(let n of e.querySelectorAll("[data-refresh][id]")){let r=t.getElementById(n.id);r!==null&&n.replaceWith(e.importNode(r,!0))}}function Ce(e){if(e.querySelector('input[name="_dialog"]')!==null)return;let t=e.ownerDocument.createElement("input");t.type="hidden",t.name="_dialog",t.value="1",e.append(t)}function ne(e,t){let n=new URLSearchParams;for(let[r,o]of new FormData(e))typeof o=="string"&&n.append(r,o);return t instanceof HTMLButtonElement&&t.name!==""&&n.append(t.name,t.value),n}function Le(e,t={}){let n=e.getElementById("publish-dialog");if(!(n instanceof HTMLDialogElement)||Ae.has(n))return;Ae.add(n);let r=n,o=e.defaultView,i=e.getElementById(at),s=e.getElementById("publish-dialog-title"),a=r.querySelector("[data-publish-loading]"),l=t.reload??(()=>o?.location.reload()),u=!1,f=!1,c=0,m=d=>{r.dataset.state=d;for(let g of r.querySelectorAll("[data-state-icon]"))g.hidden=g.dataset.stateIcon!==d},E=d=>{let g=new DOMParser().parseFromString(d,"text/html").getElementById(st);if(g===null||i===null)return!1;let x=g.dataset.state??"";s!==null&&(s.textContent=g.dataset.title??"");for(let D of g.querySelectorAll("[data-dialog-label]"))D.textContent=D.dataset.dialogLabel??"";return i.replaceChildren(e.importNode(g,!0)),a!==null&&(a.hidden=!0),m(x),x==="done"&&(u=!0),(i.querySelector('form button[type="submit"]')??i.querySelector("a, button"))?.focus(),!0},T=()=>{if(e.getElementById("editor-form")===null||o===null)return l();fetch(o.location.href,{headers:{accept:"text/html"}}).then(d=>d.text()).then(d=>He(e,new DOMParser().parseFromString(d,"text/html")),l)},h=(d,g)=>{let x=ne(d,g);x.set("_dialog","1"),g.disabled=!0;let S=()=>{g.disabled=!1,Ce(d),d.requestSubmit(g)};fetch(d.action,{method:"POST",body:x,headers:{accept:"text/html"}}).then(D=>D.text()).then(D=>{let w=new DOMParser().parseFromString(D,"text/html"),k=w.querySelector("[data-publish-open]")?.dataset.publishOpen,B=w.querySelector('#editor-form input[name="base"]')?.value,O=d.querySelector('input[name="base"]');if(k===void 0||B===void 0||O===null)return S();O.value=B;let I=w.getElementById("save-state");I!==null&&e.getElementById("save-state")?.replaceWith(e.importNode(I,!0)),He(e,w),d.dispatchEvent(new CustomEvent("inlay:saved",{bubbles:!0})),g.disabled=!1,p(k)},S)},p=d=>{let g=++c;i?.replaceChildren(),a!==null&&(a.hidden=!1),m(""),r.open||(u=!1,r.showModal());let x=()=>{g===c&&(r.close(),o?.location.assign(d))};fetch(d,{headers:{accept:"text/html"}}).then(S=>S.text()).then(S=>{g===c&&!E(S)&&x()},x)},v=d=>{let g=++c;f=!0;let x=ne(d);x.set("_dialog","1");for(let w of d.querySelectorAll("button, a"))w instanceof HTMLButtonElement?w.disabled=!0:w.setAttribute("aria-disabled","true");let S=d.querySelector('button[type="submit"]');S!==null&&d.dataset.busyLabel!==void 0&&(S.textContent=d.dataset.busyLabel);let D=()=>{g===c&&d.submit()};fetch(d.action,{method:"POST",body:x,headers:{accept:"text/html"}}).finally(()=>{f=!1}).then(w=>w.text()).then(w=>{g===c&&!E(w)&&D()},D)};e.addEventListener("click",d=>{if(!(d.target instanceof Element)||!r.isConnected)return;let g=d.target.closest("[data-publish-dialog]");if(g===null||r.contains(g))return;if(g instanceof HTMLAnchorElement){d.preventDefault(),g.closest("details.dropdown")?.removeAttribute("open"),p(g.href);return}if(!(g instanceof HTMLButtonElement)||g.form===null)return;let x=g.form;if(g.name==="_action"){if(x.hasAttribute("data-save-errors"))return Ce(x);d.preventDefault(),h(x,g);return}d.preventDefault();let S=new URL(g.getAttribute("formaction")??x.getAttribute("action")??"",e.baseURI);S.search=ne(x).toString(),p(S.href)}),i?.addEventListener("click",d=>{if(!(d.target instanceof Element))return;let g=d.target.closest("a, button");if(g!==null){if(g.getAttribute("aria-disabled")==="true"){d.preventDefault();return}if(g.hasAttribute("data-dialog-cancel")){d.preventDefault(),r.close();return}g instanceof HTMLAnchorElement&&new URL(g.href).pathname==="/admin/publish"&&(d.preventDefault(),p(g.href))}}),i?.addEventListener("submit",d=>{let g=d.target;!(g instanceof HTMLFormElement)||g.method!=="post"||(d.preventDefault(),v(g))}),r.addEventListener("close",()=>{c++,(u||f)&&T()});let H=e.querySelector("[data-publish-open]"),b=H?.dataset.publishOpen;if(!(H==null||b===void 0)){if(H.remove(),o!==null){let d=new URL(o.location.href);d.searchParams.delete("review"),o.history.replaceState(o.history.state,"",d.href)}p(b)}}var lt='input:not([type="hidden"]):not([type="radio"]), select, textarea',Y=new WeakSet,De=new WeakSet,Ie=new WeakSet,re=e=>!e.closest("[hidden]"),ut=e=>[...e.querySelectorAll('[role="alert"], [aria-invalid="true"]')].some(re);function Re(e){e.open||e.showModal();let t=o=>[...e.querySelectorAll(o)].find(re),n=t('[role="alert"]');if(n){n.hasAttribute("tabindex")||n.setAttribute("tabindex","-1"),n.focus();return}let r=t('[aria-invalid="true"]');if(r){let o=[...e.querySelectorAll('input[type="password"]')].find(s=>re(s)&&s.value==="");(o&&o.compareDocumentPosition(r)&Node.DOCUMENT_POSITION_FOLLOWING?o:r).focus();return}(t("[autofocus]")??t(lt))?.focus()}function Me(e){for(let t of e.querySelectorAll("dialog.sheet"))for(let n of t.querySelectorAll("[data-shown-when]")){let[r="",o=""]=(n.dataset.shownWhen??"").split("="),i=[...t.querySelectorAll("input")].find(s=>s.name===r&&s.checked);n.hidden=i?.value!==o}}function ct(){let e=new URL(location.href);e.searchParams.has("sheet")&&(e.searchParams.delete("sheet"),history.replaceState(history.state,"",`${e.pathname}${e.search}${e.hash}`))}function ft(e){if(Ie.has(e))return;Ie.add(e);let t=()=>Y.add(e);e.addEventListener("input",t),e.addEventListener("change",t),e.addEventListener("close",()=>{Y.delete(e),ct()})}function Oe(e){let t=e.querySelectorAll("dialog.sheet");for(let n of t)ft(n);De.has(e)||(De.add(e),e.addEventListener("click",n=>{let r=n.target;if(!(r instanceof Element))return;let o=r.closest("[data-sheet-open]");if(o){let s=e.getElementById(o.dataset.sheetOpen??"");s instanceof HTMLDialogElement&&Re(s);return}let i=r.closest("[data-sheet-close]");if(i){i.closest("dialog")?.close();return}r instanceof HTMLDialogElement&&r.classList.contains("sheet")&&!Y.has(r)&&r.close()}),e.addEventListener("change",n=>{let r=n.target instanceof Element?n.target.closest("dialog.sheet"):null;r&&Me(r.parentNode??e)})),Me(e);for(let n of e.querySelectorAll("dialog.sheet[data-sheet-autoopen]"))ut(n)&&Y.add(n),Re(n)}var dt="global-search",mt="global-search-results",ht='input, textarea, select, [contenteditable]:not([contenteditable="false"])',qe=new WeakSet,oe=new WeakMap,q=e=>e.getElementById(dt),N=e=>e.getElementById(mt),se=e=>[...N(e)?.querySelectorAll('[role="option"]')??[]];function ke(e){let t=N(e);return t!==null&&!t.hidden&&t.childElementCount>0}function z(e){return ke(e)&&N(e)?.querySelector('[role="listbox"]')!=null}function J(e,t){let n=q(e);for(let r of se(e))r.setAttribute("aria-selected",String(r===t)),r.querySelector("a")?.classList.toggle("menu-active",r===t);n!==null&&(t===null?n.removeAttribute("aria-activedescendant"):n.setAttribute("aria-activedescendant",t.id))}function ae(e){let t=q(e)?.getAttribute("aria-activedescendant");return t==null?null:se(e).find(n=>n.id===t&&n.getAttribute("aria-selected")==="true")??null}function ie(e){let t=q(e);if(t===null)return;let n=N(e);oe.has(e)&&oe.get(e)!==n&&J(e,null),oe.set(e,n);let r=String(z(e));t.getAttribute("aria-expanded")!==r&&t.setAttribute("aria-expanded",r),t.hasAttribute("aria-activedescendant")&&ae(e)===null&&t.removeAttribute("aria-activedescendant")}function Pe(e){let t=N(e);t!==null&&(t.hidden=!0),J(e,null),ie(e)}function gt(e,t){let n=se(e);if(n.length===0||!z(e))return;let r=n.indexOf(ae(e)??(t===1?n[n.length-1]:n[0])),o=n[(r+t+n.length)%n.length]??null;J(e,o),o?.scrollIntoView?.({block:"nearest"})}function pt(e,t,n){switch(n.key){case"ArrowDown":case"ArrowUp":if(!z(e))return;n.preventDefault(),gt(e,n.key==="ArrowDown"?1:-1);return;case"Enter":{let r=ae(e)?.querySelector("a");if(!r||!z(e))return;n.preventDefault(),r.click();return}case"Escape":n.preventDefault(),t.value="",Pe(e);return}}function Fe(e){if(ie(e),qe.has(e))return;qe.add(e),e.addEventListener("keydown",n=>{let r=q(e);if(r===null)return;if(n.target===r){pt(e,r,n);return}if(n.key!=="/"||n.ctrlKey||n.metaKey||n.altKey)return;let o=e.activeElement;o instanceof Element&&o.closest(ht)!==null||(n.preventDefault(),r.focus())}),e.addEventListener("input",n=>{n.target===q(e)&&J(e,null)}),e.addEventListener("click",n=>{let r=q(e);if(r===null||!ke(e))return;let o=r.form??r.parentElement;n.target instanceof Node&&o?.contains(n.target)||Pe(e)});let t=e.body??e.documentElement;new MutationObserver(()=>ie(e)).observe(t,{childList:!0,subtree:!0})}var le="inlay:place",G=e=>[...document.querySelectorAll(e)];function Et(e){let t=e.target;if(e.defaultPrevented||!(t instanceof HTMLFormElement)||t.method!=="post")return;let n={};for(let o of document.querySelectorAll("[data-keep-scroll]"))o.id!==""&&(n[o.id]=o.scrollTop);let r={path:location.pathname,y:window.scrollY,panes:n,open:G("details[data-item]").filter(o=>o.open).map(o=>o.dataset.item??""),closed:G("details[data-card]").filter(o=>!o.open).map(o=>o.dataset.card??"")};try{sessionStorage.setItem(le,JSON.stringify(r))}catch{}}function yt(){try{let e=sessionStorage.getItem(le);return sessionStorage.removeItem(le),e===null?null:JSON.parse(e)}catch{return null}}function bt(e){let t=new Set(e.open),n=new Set(e.closed);for(let r of G("details[data-item]"))t.has(r.dataset.item??"")&&(r.open=!0);for(let r of G("details[data-card]"))n.has(r.dataset.card??"")&&(r.open=!1);requestAnimationFrame(()=>{for(let[r,o]of Object.entries(e.panes)){let i=document.getElementById(r);i?.hasAttribute("data-keep-scroll")&&(i.scrollTop=o)}window.scrollTo(0,e.y)})}function vt(e){let t=()=>{e.classList.add("opacity-0"),setTimeout(()=>e.remove(),300)},n=Math.max(6e3,(e.textContent??"").length*80),r=setTimeout(t,n);e.addEventListener("pointerenter",()=>clearTimeout(r)),e.addEventListener("pointerleave",()=>{r=setTimeout(t,3e3)}),e.querySelector("[data-notice-dismiss]")?.addEventListener("click",()=>e.remove())}function xt(e){let t=new URL(location.href);for(let n of(e.dataset.noticeQuery??"").split(" "))t.searchParams.delete(n);t.href!==location.href&&history.replaceState(history.state,"",t)}function Ne(){let e=yt(),t=document.getElementById("admin-notice");t&&(vt(t),xt(t),e&&e.path===location.pathname&&bt(e))}document.addEventListener("submit",Et);var St=new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}),Tt=new Intl.DateTimeFormat(void 0,{dateStyle:"medium"}),ue=new Intl.RelativeTimeFormat(void 0,{numeric:"auto"}),Be=6e4,fe=60*Be,ce=24*fe;function wt(e,t){let n=e.getTime()-t.getTime(),r=Math.abs(n);return r>=7*ce?Tt.format(e):r<fe?ue.format(Math.round(n/Be),"minute"):r<ce?ue.format(Math.round(n/fe),"hour"):ue.format(Math.round(n/ce),"day")}function de(e,t=new Date){for(let n of e.querySelectorAll("time[data-local]")){let r=new Date(n.dateTime);if(Number.isNaN(r.getTime()))continue;let o=St.format(r);n.hasAttribute("data-relative")?(n.textContent=wt(r,t),n.title=o):n.textContent=o}}document.addEventListener("DOMContentLoaded",()=>{de(document),ee(document),te(document),Te(document),Fe(document),Le(document),Oe(document),Ne()});document.addEventListener("htmx:afterSwap",e=>{let t=e.target;de(t instanceof Element?t:document),ee(t instanceof Element?t:document),te(t instanceof Element?t:document)});
|
|
1
|
+
var _e=Object.defineProperty;var je=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(r){throw n=[r],r}};var Xe=(e,t)=>{for(var n in t)_e(e,n,{get:t[n],enumerable:!0})};var ge={};Xe(ge,{default:()=>Z});var $e,Z,_=je(()=>{$e=(function(){"use strict";let htmx={onLoad:null,process:null,on:null,off:null,trigger:null,ajax:null,find:null,findAll:null,closest:null,values:function(e,t){return getInputValues(e,t||"post").values},remove:null,addClass:null,removeClass:null,toggleClass:null,takeClass:null,swap:null,defineExtension:null,removeExtension:null,logAll:null,logNone:null,logger:null,config:{historyEnabled:!0,historyCacheSize:10,refreshOnHistoryMiss:!1,defaultSwapStyle:"innerHTML",defaultSwapDelay:0,defaultSettleDelay:20,includeIndicatorStyles:!0,indicatorClass:"htmx-indicator",requestClass:"htmx-request",addedClass:"htmx-added",settlingClass:"htmx-settling",swappingClass:"htmx-swapping",allowEval:!0,allowScriptTags:!0,inlineScriptNonce:"",inlineStyleNonce:"",attributesToSettle:["class","style","width","height"],withCredentials:!1,timeout:0,wsReconnectDelay:"full-jitter",wsBinaryType:"blob",disableSelector:"[hx-disable], [data-hx-disable]",scrollBehavior:"instant",defaultFocusScroll:!1,getCacheBusterParam:!1,globalViewTransitions:!1,methodsThatUseUrlParams:["get","delete"],selfRequestsOnly:!0,ignoreTitle:!1,scrollIntoViewOnBoost:!0,triggerSpecsCache:null,disableInheritance:!1,responseHandling:[{code:"204",swap:!1},{code:"[23]..",swap:!0},{code:"[45]..",swap:!1,error:!0}],allowNestedOobSwaps:!0,historyRestoreAsHxRequest:!0,reportValidityOfForms:!1},parseInterval:null,location,_:null,version:"2.0.11"};htmx.onLoad=onLoadHelper,htmx.process=processNode,htmx.on=addEventListenerImpl,htmx.off=removeEventListenerImpl,htmx.trigger=triggerEvent,htmx.ajax=ajaxHelper,htmx.find=find,htmx.findAll=findAll,htmx.closest=closest,htmx.remove=removeElement,htmx.addClass=addClassToElement,htmx.removeClass=removeClassFromElement,htmx.toggleClass=toggleClassOnElement,htmx.takeClass=takeClassForElement,htmx.swap=swap,htmx.defineExtension=defineExtension,htmx.removeExtension=removeExtension,htmx.logAll=logAll,htmx.logNone=logNone,htmx.parseInterval=parseInterval,htmx._=internalEval;let internalAPI={addTriggerHandler,bodyContains,canAccessLocalStorage,findThisElement,filterValues,swap,hasAttribute,getAttributeValue,getClosestAttributeValue,getClosestMatch,getExpressionVars,getHeaders,getInputValues,getInternalData,getSwapSpecification,getTriggerSpecs,getTarget,makeFragment,mergeObjects,makeSettleInfo,oobSwap,querySelectorExt,settleImmediately,shouldCancel,triggerEvent,triggerErrorEvent,withExtensions},VERBS=["get","post","put","delete","patch"],VERB_SELECTOR=VERBS.map(function(e){return"[hx-"+e+"], [data-hx-"+e+"]"}).join(", ");function parseInterval(e){if(e==null)return;let t=NaN;return e.slice(-2)=="ms"?t=parseFloat(e.slice(0,-2)):e.slice(-1)=="s"?t=parseFloat(e.slice(0,-1))*1e3:e.slice(-1)=="m"?t=parseFloat(e.slice(0,-1))*1e3*60:t=parseFloat(e),isNaN(t)?void 0:t}function getRawAttribute(e,t){return e instanceof Element&&e.getAttribute(t)}function hasAttribute(e,t){return!!e.hasAttribute&&(e.hasAttribute(t)||e.hasAttribute("data-"+t))}function getAttributeValue(e,t){return getRawAttribute(e,t)||getRawAttribute(e,"data-"+t)}function parentElt(e){let t=e.parentElement;return!t&&e.parentNode instanceof ShadowRoot?e.parentNode:t}function getDocument(){return document}function getRootNode(e,t){return e.getRootNode?e.getRootNode({composed:t}):getDocument()}function getClosestMatch(e,t){for(;e&&!t(e);)e=parentElt(e);return e||null}function getAttributeValueWithDisinheritance(e,t,n){let r=getAttributeValue(t,n),o=getAttributeValue(t,"hx-disinherit");var i=getAttributeValue(t,"hx-inherit");if(e!==t){if(htmx.config.disableInheritance)return i&&(i==="*"||i.split(" ").indexOf(n)>=0)?r:null;if(o&&(o==="*"||o.split(" ").indexOf(n)>=0))return"unset"}return r}function getClosestAttributeValue(e,t){let n=null;if(getClosestMatch(e,function(r){return!!(n=getAttributeValueWithDisinheritance(e,asElement(r),t))}),n!=="unset")return n}function matches(e,t){return e instanceof Element&&e.matches(t)}function getStartTag(e){let n=/<([a-z][^\/\0>\x20\t\r\n\f]*)/i.exec(e);return n?n[1].toLowerCase():""}function parseHTML(e){return"parseHTMLUnsafe"in Document?Document.parseHTMLUnsafe(e):new DOMParser().parseFromString(e,"text/html")}function takeChildrenFor(e,t){for(;t.childNodes.length>0;)e.append(t.childNodes[0])}function duplicateScript(e){let t=getDocument().createElement("script");return forEach(e.attributes,function(n){t.setAttribute(n.name,n.value)}),t.textContent=e.textContent,t.async=!1,htmx.config.inlineScriptNonce&&(t.nonce=htmx.config.inlineScriptNonce),t}function isJavaScriptScriptNode(e){return e.matches("script")&&(e.type==="text/javascript"||e.type==="module"||e.type==="")}function normalizeScriptTags(e){if(!htmx.config.allowScriptTags){e.querySelectorAll("script").forEach(t=>t.remove());return}Array.from(e.querySelectorAll("script")).forEach(t=>{if(isJavaScriptScriptNode(t)){let n=duplicateScript(t),r=t.parentNode;try{r.insertBefore(n,t)}catch(o){logError(o)}finally{t.remove()}}})}function makeFragment(e){e=e.replace(/<hx-([a-z]+)((?:\s[^>]*)?)>/gi,'<template hx type="$1"$2>').replace(/<\/hx-[a-z]+>/gi,"</template>");let t=e.replace(/<head(\s[^>]*)?>[\s\S]*?<\/head>/i,""),n=getStartTag(t),r;if(n==="html"){r=new DocumentFragment;let i=parseHTML(e);takeChildrenFor(r,i.body),r.title=i.title}else if(n==="body"){r=new DocumentFragment;let i=parseHTML(t);takeChildrenFor(r,i.body),r.title=i.title}else{let i=parseHTML('<body><template class="internal-htmx-wrapper">'+t+"</template></body>");r=i.querySelector("template").content,r.title=i.title;var o=r.querySelector("title");o&&o.parentNode===r&&(o.remove(),r.title=o.innerText)}return r&&normalizeScriptTags(r),r}function maybeCall(e){e&&e()}function isType(e,t){return Object.prototype.toString.call(e)==="[object "+t+"]"}function isFunction(e){return typeof e=="function"}function isRawObject(e){return isType(e,"Object")}function getInternalData(e){let t="htmx-internal-data",n=e[t];return n||(n=e[t]={}),n}function toArray(e){let t=[];if(e)for(let n=0;n<e.length;n++)t.push(e[n]);return t}function forEach(e,t){if(e)for(let n=0;n<e.length;n++)t(e[n])}function isScrolledIntoView(e){let t=e.getBoundingClientRect(),n=t.top,r=t.bottom;return n<window.innerHeight&&r>=0}function bodyContains(e){return e.getRootNode({composed:!0})===document}function splitOnWhitespace(e){return e.trim().split(/\s+/)}function mergeObjects(e,t){return Object.assign({},e,t)}function parseJSON(e){try{return JSON.parse(e)}catch(t){return logError(t),null}}function canAccessLocalStorage(){let e="htmx:sessionStorageTest";try{return sessionStorage.setItem(e,e),sessionStorage.removeItem(e),!0}catch{return!1}}function normalizePath(e){try{let t=new URL(e,window.location.href);e=t.pathname+t.search}catch{}return e!="/"&&(e=e.replace(/\/+$/,"")),e}function internalEval(str){return maybeEval(getDocument().body,function(){return eval(str)})}function onLoadHelper(e){return htmx.on("htmx:load",function(n){e(n.detail.elt)})}function logAll(){htmx.logger=function(e,t,n){console&&console.log(t,e,n)}}function logNone(){htmx.logger=null}function find(e,t){return typeof e!="string"?e.querySelector(t):find(getDocument(),e)}function findAll(e,t){return typeof e!="string"?e.querySelectorAll(t):findAll(getDocument(),e)}function getWindow(){return window}function removeElement(e,t){e=resolveTarget(e),t?getWindow().setTimeout(function(){removeElement(e),e=null},t):parentElt(e).removeChild(e)}function asElement(e){return e instanceof Element?e:null}function asHtmlElement(e){return e instanceof HTMLElement?e:null}function asString(e){return typeof e=="string"?e:null}function asParentNode(e){return e instanceof Element||e instanceof Document||e instanceof DocumentFragment?e:null}function addClassToElement(e,t,n){e=asElement(resolveTarget(e)),e&&(n?getWindow().setTimeout(function(){addClassToElement(e,t),e=null},n):e.classList&&e.classList.add(t))}function removeClassFromElement(e,t,n){let r=asElement(resolveTarget(e));r&&(n?getWindow().setTimeout(function(){removeClassFromElement(r,t),r=null},n):r.classList&&(r.classList.remove(t),r.classList.length===0&&r.removeAttribute("class")))}function toggleClassOnElement(e,t){e=resolveTarget(e),e.classList.toggle(t)}function takeClassForElement(e,t){e=resolveTarget(e),forEach(e.parentElement.children,function(n){removeClassFromElement(n,t)}),addClassToElement(asElement(e),t)}function closest(e,t){return e=asElement(resolveTarget(e)),e?e.closest(t):null}function startsWith(e,t){return e.substring(0,t.length)===t}function endsWith(e,t){return e.substring(e.length-t.length)===t}function normalizeSelector(e){let t=e.trim();return startsWith(t,"<")&&endsWith(t,"/>")?t.substring(1,t.length-2):t}function querySelectorAllExt(e,t,n){if(t.indexOf("global ")===0)return querySelectorAllExt(e,t.slice(7),!0);e=resolveTarget(e);let r=[];{let s=0,a=0;for(let l=0;l<t.length;l++){let c=t[l];if(c===","&&s===0){r.push(t.substring(a,l)),a=l+1;continue}c==="<"?s++:c==="/"&&l<t.length-1&&t[l+1]===">"&&s--}a<t.length&&r.push(t.substring(a))}let o=[],i=[];for(;r.length>0;){let s=normalizeSelector(r.shift()),a;s.indexOf("closest ")===0?a=closest(asElement(e),normalizeSelector(s.slice(8))):s.indexOf("find ")===0?a=find(asParentNode(e),normalizeSelector(s.slice(5))):s==="next"||s==="nextElementSibling"?a=asElement(e).nextElementSibling:s.indexOf("next ")===0?a=scanForwardQuery(e,normalizeSelector(s.slice(5)),!!n):s==="previous"||s==="previousElementSibling"?a=asElement(e).previousElementSibling:s.indexOf("previous ")===0?a=scanBackwardsQuery(e,normalizeSelector(s.slice(9)),!!n):s==="document"?a=document:s==="window"?a=window:s==="body"?a=document.body:s==="root"?a=getRootNode(e,!!n):s==="host"?a=e.getRootNode().host:i.push(s),a&&o.push(a)}if(i.length>0){let s=i.join(","),a=asParentNode(getRootNode(e,!!n));o.push(...toArray(a.querySelectorAll(s)))}return o}var scanForwardQuery=function(e,t,n){let r=asParentNode(getRootNode(e,n)).querySelectorAll(t);for(let o=0;o<r.length;o++){let i=r[o];if(i.compareDocumentPosition(e)===Node.DOCUMENT_POSITION_PRECEDING)return i}},scanBackwardsQuery=function(e,t,n){let r=asParentNode(getRootNode(e,n)).querySelectorAll(t);for(let o=r.length-1;o>=0;o--){let i=r[o];if(i.compareDocumentPosition(e)===Node.DOCUMENT_POSITION_FOLLOWING)return i}};function querySelectorExt(e,t){return typeof e!="string"?querySelectorAllExt(e,t)[0]:querySelectorAllExt(getDocument().body,e)[0]}function resolveTarget(e,t){return typeof e=="string"?find(asParentNode(t)||document,e):e}function processEventArgs(e,t,n,r){return isFunction(t)?{target:getDocument().body,event:asString(e),listener:t,options:n}:{target:resolveTarget(e),event:asString(t),listener:n,options:r}}function addEventListenerImpl(e,t,n,r){return ready(function(){let i=processEventArgs(e,t,n,r);i.target.addEventListener(i.event,i.listener,i.options)}),isFunction(t)?t:n}function removeEventListenerImpl(e,t,n){return ready(function(){let r=processEventArgs(e,t,n);r.target.removeEventListener(r.event,r.listener)}),isFunction(t)?t:n}let DUMMY_ELT=getDocument().createElement("output");function findAttributeTargets(e,t){let n=getClosestAttributeValue(e,t);if(n){if(n==="this")return[findThisElement(e,t)];{let r=querySelectorAllExt(e,n);if(/(^|,)(\s*)inherit(\s*)($|,)/.test(n)){let i=asElement(getClosestMatch(e,function(s){return s!==e&&hasAttribute(asElement(s),t)}));i&&r.push(...findAttributeTargets(i,t))}return r.length===0?(logError('The selector "'+n+'" on '+t+" returned no matches!"),[DUMMY_ELT]):r}}}function findThisElement(e,t){return asElement(getClosestMatch(e,function(n){return getAttributeValue(asElement(n),t)!=null}))}function getTarget(e){let t=getClosestAttributeValue(e,"hx-target");return t?t==="this"?findThisElement(e,"hx-target"):querySelectorExt(e,t):getInternalData(e).boosted?getDocument().body:e}function shouldSettleAttribute(e){return htmx.config.attributesToSettle.includes(e)}function cloneAttributes(e,t){forEach(Array.from(e.attributes),function(n){!t.hasAttribute(n.name)&&shouldSettleAttribute(n.name)&&e.removeAttribute(n.name)}),forEach(t.attributes,function(n){shouldSettleAttribute(n.name)&&e.setAttribute(n.name,n.value)})}function isInlineSwap(e,t){let n=getExtensions(t);for(let r=0;r<n.length;r++){let o=n[r];try{if(o.isInlineSwap(e))return!0}catch(i){logError(i)}}return e==="outerHTML"}function oobSwap(e,t,n,r){r=r||getDocument();let o="#"+CSS.escape(getRawAttribute(t,"id")),i="outerHTML";e==="true"||(e.indexOf(":")>0?(i=e.substring(0,e.indexOf(":")),o=e.substring(e.indexOf(":")+1)):i=e),t.removeAttribute("hx-swap-oob"),t.removeAttribute("data-hx-swap-oob");let s=querySelectorAllExt(r,o,!1);return s.length?(forEach(s,function(a){let l,c=t.cloneNode(!0);l=getDocument().createDocumentFragment(),l.appendChild(c),isInlineSwap(i,a)||(l=asParentNode(c));let f={shouldSwap:!0,target:a,fragment:l};triggerEvent(a,"htmx:oobBeforeSwap",f)&&(a=f.target,f.shouldSwap&&(handlePreservedElements(l),swapWithStyle(i,a,a,l,n),restorePreservedElements()),forEach(n.elts,function(u){triggerEvent(u,"htmx:oobAfterSwap",f)}))}),t.parentNode.removeChild(t)):(t.parentNode.removeChild(t),triggerErrorEvent(getDocument().body,"htmx:oobErrorNoTarget",{content:t,target:o})),e}function restorePreservedElements(){let e=find("#--htmx-preserve-pantry--");if(e){for(let t of[...e.children]){let n=find("#"+t.id);n.parentNode.moveBefore(t,n),n.remove()}e.remove()}}function handlePreservedElements(e){forEach(findAll(e,"[hx-preserve], [data-hx-preserve]"),function(t){let n=getAttributeValue(t,"id"),r=getDocument().getElementById(n);if(r!=null)if(t.moveBefore){let o=find("#--htmx-preserve-pantry--");o==null&&(getDocument().body.insertAdjacentHTML("afterend","<div id='--htmx-preserve-pantry--'></div>"),o=find("#--htmx-preserve-pantry--")),o.moveBefore(r,null)}else t.parentNode.replaceChild(r,t)})}function handleAttributes(e,t,n){forEach(t.querySelectorAll("[id]"),function(r){let o=getRawAttribute(r,"id");if(o&&o.length>0){let i=asParentNode(e),s=i&&i.querySelector(CSS.escape(r.tagName)+"#"+CSS.escape(o));if(s&&s!==i){let a=r.cloneNode();cloneAttributes(r,s),n.tasks.push(function(){cloneAttributes(r,a)})}}})}function makeAjaxLoadTask(e){return function(){removeClassFromElement(e,htmx.config.addedClass),processNode(asElement(e)),processFocus(asParentNode(e)),triggerEvent(e,"htmx:load")}}function processFocus(e){let t="[autofocus]",n=asHtmlElement(matches(e,t)?e:e.querySelector(t));n?.focus()}function insertNodesBefore(e,t,n,r){for(handleAttributes(e,n,r);n.childNodes.length>0;){let o=n.firstChild;addClassToElement(asElement(o),htmx.config.addedClass),e.insertBefore(o,t),o.nodeType!==Node.TEXT_NODE&&o.nodeType!==Node.COMMENT_NODE&&r.tasks.push(makeAjaxLoadTask(o))}}function stringHash(e,t){let n=0;for(;n<e.length;)t=(t<<5)-t+e.charCodeAt(n++)|0;return t}function attributeHash(e){let t=0;for(let n=0;n<e.attributes.length;n++){let r=e.attributes[n];r.value&&(t=stringHash(r.name,t),t=stringHash(r.value,t))}return t}function deInitOnHandlers(e){let t=getInternalData(e);if(t.onHandlers){for(let n=0;n<t.onHandlers.length;n++){let r=t.onHandlers[n];removeEventListenerImpl(e,r.event,r.listener)}delete t.onHandlers}}function deInitNode(e){let t=getInternalData(e);t.timeout&&clearTimeout(t.timeout),t.listenerInfos&&forEach(t.listenerInfos,function(n){n.on&&removeEventListenerImpl(n.on,n.trigger,n.listener)}),deInitOnHandlers(e),forEach(Object.keys(t),function(n){n!=="firstInitCompleted"&&delete t[n]})}function cleanUpElement(e){triggerEvent(e,"htmx:beforeCleanupElement"),deInitNode(e),forEach(e.children,function(t){cleanUpElement(t)})}function swapOuterHTML(e,t,n){if(e.tagName==="BODY")return swapInnerHTML(e,t,n);let r,o=e.previousSibling,i=parentElt(e);if(i){for(insertNodesBefore(i,e,t,n),o==null?r=i.firstChild:r=o.nextSibling,n.elts=n.elts.filter(function(s){return s!==e});r&&r!==e;)r instanceof Element&&n.elts.push(r),r=r.nextSibling;cleanUpElement(e),e.remove()}}function swapAfterBegin(e,t,n){return insertNodesBefore(e,e.firstChild,t,n)}function swapBeforeBegin(e,t,n){return insertNodesBefore(parentElt(e),e,t,n)}function swapBeforeEnd(e,t,n){return insertNodesBefore(e,null,t,n)}function swapAfterEnd(e,t,n){return insertNodesBefore(parentElt(e),e.nextSibling,t,n)}function swapDelete(e){cleanUpElement(e);let t=parentElt(e);if(t)return t.removeChild(e)}function swapInnerHTML(e,t,n){let r=e.firstChild;if(insertNodesBefore(e,r,t,n),r){for(;r.nextSibling;)cleanUpElement(r.nextSibling),e.removeChild(r.nextSibling);cleanUpElement(r),e.removeChild(r)}}function swapWithStyle(e,t,n,r,o){switch(e){case"none":return;case"outerHTML":swapOuterHTML(n,r,o);return;case"afterbegin":swapAfterBegin(n,r,o);return;case"beforebegin":swapBeforeBegin(n,r,o);return;case"beforeend":swapBeforeEnd(n,r,o);return;case"afterend":swapAfterEnd(n,r,o);return;case"delete":swapDelete(n);return;default:var i=getExtensions(t);for(let s=0;s<i.length;s++){let a=i[s];try{let l=a.handleSwap(e,n,r,o);if(l){if(Array.isArray(l))for(let c=0;c<l.length;c++){let f=l[c];f.nodeType!==Node.TEXT_NODE&&f.nodeType!==Node.COMMENT_NODE&&o.tasks.push(makeAjaxLoadTask(f))}return}}catch(l){logError(l)}}e==="innerHTML"?swapInnerHTML(n,r,o):swapWithStyle(htmx.config.defaultSwapStyle,t,n,r,o)}}function findAndSwapPartials(e,t,n){var r=findAll(e,"template[hx]");return forEach(r,function(o){var i=getRawAttribute(o,"type");if(i==="partial"){var s=getAttributeValue(o,"hx-target")||(o.id?"#"+CSS.escape(o.id):null);if(s){var a=getAttributeValue(o,"hx-swap"),l=getSwapSpecification(o,a),c=querySelectorAllExt(n||getDocument().body,s,!1);c.length===0&&triggerErrorEvent(getDocument().body,"htmx:partialErrorNoTarget",{template:o,targetSelector:s,sourceElement:n}),forEach(c,function(f){if(f=asElement(f),f){var u=o.content.cloneNode(!0);normalizeScriptTags(u);var m={shouldSwap:!0,target:f,fragment:u};if(!triggerEvent(f,"htmx:partialBeforeSwap",m))return;f=m.target,m.shouldSwap&&swap(f,m.fragment,l,{contextElement:f,afterSwapCallback:function(){forEach(t.elts,function(E){triggerEvent(E,"htmx:partialAfterSwap",m)})}})}})}}else triggerEvent(getDocument().body,"htmx:processTemplate",{type:i,template:o,settleInfo:t,sourceElement:n});o.parentNode.removeChild(o)}),r.length>0}function findAndSwapOobElements(e,t,n){var r=findAll(e,"[hx-swap-oob], [data-hx-swap-oob]");return forEach(r,function(o){if(htmx.config.allowNestedOobSwaps||o.parentElement===null){let i=getAttributeValue(o,"hx-swap-oob");i!=null&&oobSwap(i,o,t,n)}else o.removeAttribute("hx-swap-oob"),o.removeAttribute("data-hx-swap-oob")}),r.length>0}function swap(e,t,n,r){r||(r={});let o=null,i=null,s=function(){maybeCall(r.beforeSwapCallback),e=resolveTarget(e);let c=r.contextElement&&r.contextElement.isConnected?getRootNode(r.contextElement,!1):getDocument(),f=document.activeElement,u={};u={elt:f,start:f?f.selectionStart:null,end:f?f.selectionEnd:null};let m=makeSettleInfo(e);if(n.swapStyle==="textContent")e.textContent=t;else{let h=typeof t=="string"?makeFragment(t):t;if(m.title=r.title||h.title,r.historyRequest&&(h=h.querySelector("[hx-history-elt],[data-hx-history-elt]")||h),r.selectOOB){let p=r.selectOOB.split(",");for(let v=0;v<p.length;v++){let H=p[v].split(":",2),b=H[0].trim();b.indexOf("#")===0&&(b=b.substring(1));let d=H[1]||"true",g=h.querySelector("#"+b);g&&oobSwap(d,g,m,c)}}findAndSwapOobElements(h,m,c),forEach(findAll(h,"template"),function(p){p.content&&findAndSwapOobElements(p.content,m,c)&&p.remove()});var E=findAndSwapPartials(h,m,r.contextElement||asElement(e));if(r.select){let p=getDocument().createDocumentFragment();forEach(h.querySelectorAll(r.select),function(v){p.appendChild(v)}),h=p}handlePreservedElements(h),E&&!h.childElementCount&&!h.textContent.trim()?m.elts=[asElement(e)]:swapWithStyle(n.swapStyle,r.contextElement,e,h,m),restorePreservedElements()}if(u.elt&&!bodyContains(u.elt)&&getRawAttribute(u.elt,"id")){let h=document.getElementById(getRawAttribute(u.elt,"id")),p={preventScroll:n.focusScroll!==void 0?!n.focusScroll:!htmx.config.defaultFocusScroll};if(h){if(u.start&&h.setSelectionRange)try{h.setSelectionRange(u.start,u.end)}catch{}h.focus(p)}}removeClassFromElement(e,htmx.config.swappingClass),forEach(m.elts,function(h){h.classList&&addClassToElement(h,htmx.config.settlingClass),triggerEvent(h,"htmx:afterSwap",r.eventInfo)}),maybeCall(r.afterSwapCallback),n.ignoreTitle||handleTitle(m.title);let T=function(){if(forEach(m.tasks,function(h){h.call()}),forEach(m.elts,function(h){h.classList&&removeClassFromElement(h,htmx.config.settlingClass),triggerEvent(h,"htmx:afterSettle",r.eventInfo)}),r.anchor){let h=asElement(resolveTarget("#"+r.anchor));h&&h.scrollIntoView({block:"start",behavior:"auto"})}updateScrollState(m.elts,n),maybeCall(r.afterSettleCallback),maybeCall(o)};n.settleDelay>0?getWindow().setTimeout(T,n.settleDelay):T()},a=htmx.config.globalViewTransitions;n.hasOwnProperty("transition")&&(a=n.transition);let l=r.contextElement||getDocument();if(a&&triggerEvent(l,"htmx:beforeTransition",r.eventInfo)&&typeof Promise<"u"&&document.startViewTransition){let c=new Promise(function(u,m){o=u,i=m}),f=s;s=function(){document.startViewTransition(function(){return f(),c})}}try{n?.swapDelay&&n.swapDelay>0?getWindow().setTimeout(s,n.swapDelay):s()}catch(c){throw triggerErrorEvent(l,"htmx:swapError",r.eventInfo),maybeCall(i),c}}function handleTriggerHeader(e,t,n){let r=e.getResponseHeader(t);if(r.indexOf("{")===0){let o=parseJSON(r)||{};for(let i of Object.keys(o)){let s=o[i];isRawObject(s)?n=s.target!==void 0?s.target:n:s={value:s},triggerEvent(n,i,s)}}else{let o=r.split(",");for(let i=0;i<o.length;i++)triggerEvent(n,o[i].trim(),[])}}let WHITESPACE=/\s/,WHITESPACE_OR_COMMA=/[\s,]/,SYMBOL_START=/[_$a-zA-Z]/,SYMBOL_CONT=/[_$a-zA-Z0-9]/,STRINGISH_START=['"',"'","/"],NOT_WHITESPACE=/[^\s]/,COMBINED_SELECTOR_START=/[{(]/,COMBINED_SELECTOR_END=/[})]/;function tokenizeString(e){let t=[],n=0;for(;n<e.length;){if(SYMBOL_START.exec(e.charAt(n))){for(var r=n;SYMBOL_CONT.exec(e.charAt(n+1));)n++;t.push(e.substring(r,n+1))}else if(STRINGISH_START.indexOf(e.charAt(n))!==-1){let o=e.charAt(n);var r=n;for(n++;n<e.length&&e.charAt(n)!==o;)e.charAt(n)==="\\"&&n++,n++;t.push(e.substring(r,n+1))}else{let o=e.charAt(n);t.push(o)}n++}return t}function isPossibleRelativeReference(e,t,n){return SYMBOL_START.exec(e.charAt(0))&&e!=="true"&&e!=="false"&&e!=="this"&&e!==n&&t!=="."}function maybeGenerateConditional(e,t,n){if(t[0]==="["){t.shift();let r=1,o=" return (function("+n+"){ return (",i=null;for(;t.length>0;){let s=t[0];if(s==="]"){if(r--,r===0){i===null&&(o=o+"true"),t.shift(),o+=")})";try{let a=maybeEval(e,function(){return Function(o)()},function(){return!0});return a.source=o,a}catch(a){return triggerErrorEvent(getDocument().body,"htmx:syntax:error",{error:a,source:o}),null}}}else s==="["&&r++;isPossibleRelativeReference(s,i,n)?o+="(("+n+"."+s+") ? ("+n+"."+s+") : (window."+s+"))":o=o+s,i=t.shift()}}}function consumeUntil(e,t){let n="";for(;e.length>0&&!t.test(e[0]);)n+=e.shift();return n}function consumeCSSSelector(e){let t;return e.length>0&&COMBINED_SELECTOR_START.test(e[0])?(e.shift(),t=consumeUntil(e,COMBINED_SELECTOR_END).trim(),e.shift()):t=consumeUntil(e,WHITESPACE_OR_COMMA),t}let INPUT_SELECTOR="input, textarea, select";function parseAndCacheTrigger(e,t,n){let r=[],o=tokenizeString(t);do{consumeUntil(o,NOT_WHITESPACE);let a=o.length,l=consumeUntil(o,/[,\[\s]/);if(l!=="")if(l==="every"){let c={trigger:"every"};consumeUntil(o,NOT_WHITESPACE),c.pollInterval=parseInterval(consumeUntil(o,/[,\[\s]/)),consumeUntil(o,NOT_WHITESPACE);var i=maybeGenerateConditional(e,o,"event");i&&(c.eventFilter=i),r.push(c)}else{let c={trigger:l};var i=maybeGenerateConditional(e,o,"event");for(i&&(c.eventFilter=i),consumeUntil(o,NOT_WHITESPACE);o.length>0&&o[0]!==",";){let u=o.shift();if(u==="changed")c.changed=!0;else if(u==="once")c.once=!0;else if(u==="consume")c.consume=!0;else if(u==="delay"&&o[0]===":")o.shift(),c.delay=parseInterval(consumeUntil(o,WHITESPACE_OR_COMMA));else if(u==="from"&&o[0]===":"){if(o.shift(),COMBINED_SELECTOR_START.test(o[0]))var s=consumeCSSSelector(o);else{var s=consumeUntil(o,WHITESPACE_OR_COMMA);if(s==="closest"||s==="find"||s==="next"||s==="previous"){o.shift();let E=consumeCSSSelector(o);E.length>0&&(s+=" "+E)}}c.from=s}else u==="target"&&o[0]===":"?(o.shift(),c.target=consumeCSSSelector(o)):u==="throttle"&&o[0]===":"?(o.shift(),c.throttle=parseInterval(consumeUntil(o,WHITESPACE_OR_COMMA))):u==="queue"&&o[0]===":"?(o.shift(),c.queue=consumeUntil(o,WHITESPACE_OR_COMMA)):u==="root"&&o[0]===":"?(o.shift(),c[u]=consumeCSSSelector(o)):u==="threshold"&&o[0]===":"?(o.shift(),c[u]=consumeUntil(o,WHITESPACE_OR_COMMA)):triggerErrorEvent(e,"htmx:syntax:error",{token:o.shift()});consumeUntil(o,NOT_WHITESPACE)}r.push(c)}o.length===a&&triggerErrorEvent(e,"htmx:syntax:error",{token:o.shift()}),consumeUntil(o,NOT_WHITESPACE)}while(o[0]===","&&o.shift());return n&&(n[t]=r),r}function getTriggerSpecs(e){let t=getAttributeValue(e,"hx-trigger"),n=[];if(t){let r=htmx.config.triggerSpecsCache;n=r&&r[t]||parseAndCacheTrigger(e,t,r)}return n.length>0?n:matches(e,"form")?[{trigger:"submit"}]:matches(e,'input[type="button"], input[type="submit"]')?[{trigger:"click"}]:matches(e,INPUT_SELECTOR)?[{trigger:"change"}]:[{trigger:"click"}]}function cancelPolling(e){getInternalData(e).cancelled=!0}function processPolling(e,t,n){let r=getInternalData(e);r.timeout=getWindow().setTimeout(function(){bodyContains(e)&&r.cancelled!==!0&&(maybeFilterEvent(n,e,makeEvent("hx:poll:trigger",{triggerSpec:n,target:e}))||t(e),processPolling(e,t,n))},n.pollInterval)}function isLocalLink(e){return location.hostname===e.hostname&&getRawAttribute(e,"href")&&getRawAttribute(e,"href").indexOf("#")!==0}function eltIsDisabled(e){return closest(e,htmx.config.disableSelector)}function boostElement(e,t,n){if(e instanceof HTMLAnchorElement&&isLocalLink(e)&&(e.target===""||e.target==="_self")||e.tagName==="FORM"&&String(getRawAttribute(e,"method")).toLowerCase()!=="dialog"){t.boosted=!0;let r,o;if(e.tagName==="A")r="get",o=getRawAttribute(e,"href");else{let i=getRawAttribute(e,"method");r=i?i.toLowerCase():"get",o=getRawAttribute(e,"action"),(o==null||o==="")&&(o=location.href),r==="get"&&o.includes("?")&&(o=o.replace(/\?[^#]+/,""))}n.forEach(function(i){addEventListener(e,function(s,a){let l=asElement(s);if(eltIsDisabled(l)){cleanUpElement(l);return}issueAjaxRequest(r,o,l,a)},t,i,!0)})}}function shouldCancel(e,t){if(e.type==="submit"&&t.tagName==="FORM")return!0;if(e.type==="click"){let n=t.closest('input[type="submit"], button');if(n&&n.form&&n.type==="submit")return!0;let r=t.closest("a"),o=/^#.+/;if(r&&r.href&&!o.test(r.getAttribute("href")))return!0}return!1}function ignoreBoostedAnchorCtrlClick(e,t){return getInternalData(e).boosted&&e instanceof HTMLAnchorElement&&t.type==="click"&&(t.ctrlKey||t.metaKey)}function maybeFilterEvent(e,t,n){let r=e.eventFilter;if(r)try{return r.call(t,n)!==!0}catch(o){let i=r.source;return triggerErrorEvent(getDocument().body,"htmx:eventFilter:error",{error:o,source:i}),!0}return!1}function addEventListener(e,t,n,r,o){let i=getInternalData(e),s;r.from?s=querySelectorAllExt(e,r.from):s=[e],r.changed&&("lastValue"in i||(i.lastValue=new WeakMap),s.forEach(function(a){i.lastValue.has(r)||i.lastValue.set(r,new WeakMap),i.lastValue.get(r).set(a,a.value)})),forEach(s,function(a){let l=function(c){if(!bodyContains(e)){a.removeEventListener(r.trigger,l);return}if(ignoreBoostedAnchorCtrlClick(e,c)||((o||shouldCancel(c,a))&&c.preventDefault(),maybeFilterEvent(r,e,c)))return;let f=getInternalData(c);if(f.triggerSpec=r,f.handledFor==null&&(f.handledFor=[]),f.handledFor.indexOf(e)<0){if(f.handledFor.push(e),r.consume&&c.stopPropagation(),r.target&&c.target&&!matches(asElement(c.target),r.target))return;if(r.once){if(i.triggeredOnce)return;i.triggeredOnce=!0}if(r.changed){let u=c.target,m=u.value,E=i.lastValue.get(r);if(E.has(u)&&E.get(u)===m)return;E.set(u,m)}if(i.delayed&&clearTimeout(i.delayed),i.throttle)return;r.throttle>0?i.throttle||(triggerEvent(e,"htmx:trigger"),t(e,c),i.throttle=getWindow().setTimeout(function(){i.throttle=null},r.throttle)):r.delay>0?i.delayed=getWindow().setTimeout(function(){triggerEvent(e,"htmx:trigger"),t(e,c)},r.delay):(triggerEvent(e,"htmx:trigger"),t(e,c))}};n.listenerInfos==null&&(n.listenerInfos=[]),n.listenerInfos.push({trigger:r.trigger,listener:l,on:a}),a.addEventListener(r.trigger,l)})}let windowIsScrolling=!1,scrollHandler=null;function initScrollHandler(){scrollHandler||(scrollHandler=function(){windowIsScrolling=!0},window.addEventListener("scroll",scrollHandler),window.addEventListener("resize",scrollHandler),setInterval(function(){windowIsScrolling&&(windowIsScrolling=!1,forEach(getDocument().querySelectorAll("[hx-trigger*='revealed'],[data-hx-trigger*='revealed']"),function(e){maybeReveal(e)}))},200))}function maybeReveal(e){!hasAttribute(e,"data-hx-revealed")&&isScrolledIntoView(e)&&(e.setAttribute("data-hx-revealed","true"),getInternalData(e).initHash?triggerEvent(e,"revealed"):e.addEventListener("htmx:afterProcessNode",function(){triggerEvent(e,"revealed")},{once:!0}))}function loadImmediately(e,t,n,r){let o=function(){n.loaded||(n.loaded=!0,triggerEvent(e,"htmx:trigger"),t(e))};r>0?getWindow().setTimeout(o,r):o()}function processVerbs(e,t,n){let r=!1;return forEach(VERBS,function(o){if(hasAttribute(e,"hx-"+o)){let i=getAttributeValue(e,"hx-"+o);r=!0,t.path=i,t.verb=o,n.forEach(function(s){addTriggerHandler(e,s,t,function(a,l){let c=asElement(a);if(eltIsDisabled(c)){cleanUpElement(c);return}issueAjaxRequest(o,i,c,l)})})}}),r}function addTriggerHandler(e,t,n,r){if(t.trigger==="revealed")initScrollHandler(),addEventListener(e,r,n,t),maybeReveal(asElement(e));else if(t.trigger==="intersect"){let o={};t.root&&(o.root=querySelectorExt(e,t.root)),t.threshold&&(o.threshold=parseFloat(t.threshold)),new IntersectionObserver(function(s){for(let a=0;a<s.length;a++)if(s[a].isIntersecting){triggerEvent(e,"intersect");break}},o).observe(asElement(e)),addEventListener(asElement(e),r,n,t)}else!n.firstInitCompleted&&t.trigger==="load"?maybeFilterEvent(t,e,makeEvent("load",{elt:e}))||loadImmediately(asElement(e),r,n,t.delay):t.pollInterval>0?(n.polling=!0,processPolling(asElement(e),r,t)):addEventListener(e,r,n,t)}function shouldProcessHxOn(e){let t=asElement(e);if(!t)return!1;let n=t.attributes;for(let r=0;r<n.length;r++){let o=n[r].name;if(startsWith(o,"hx-on:")||startsWith(o,"data-hx-on:")||startsWith(o,"hx-on-")||startsWith(o,"data-hx-on-"))return!0}return!1}let HX_ON_QUERY=new XPathEvaluator().createExpression('.//*[@*[ starts-with(name(), "hx-on:") or starts-with(name(), "data-hx-on:") or starts-with(name(), "hx-on-") or starts-with(name(), "data-hx-on-") ]]');function processHXOnRoot(e,t){shouldProcessHxOn(e)&&t.push(asElement(e));let n=HX_ON_QUERY.evaluate(e),r=null;for(;r=n.iterateNext();)t.push(asElement(r))}function findHxOnWildcardElements(e){let t=[];if(e instanceof DocumentFragment)for(let n of e.childNodes)processHXOnRoot(n,t);else processHXOnRoot(e,t);return t}function findElementsToProcess(e){if(e.querySelectorAll){let n=", [hx-boost] a, [data-hx-boost] a, a[hx-boost], a[data-hx-boost]",r=[];for(let i of Object.keys(extensions)){let s=extensions[i];if(s.getSelectors){var t=s.getSelectors();t&&r.push(t)}}return e.querySelectorAll(VERB_SELECTOR+n+", form, [type='submit'], [hx-ext], [data-hx-ext], [hx-trigger], [data-hx-trigger]"+r.flat().map(i=>", "+i).join(""))}else return[]}function maybeSetLastButtonClicked(e){let t=getTargetButton(e.target),n=getRelatedFormData(e);n&&(n.lastButtonClicked=t)}function maybeUnsetLastButtonClicked(e){let t=getRelatedFormData(e);t&&(t.lastButtonClicked=null)}function getTargetButton(e){return closest(asElement(e),"button, input[type='submit']")}function getRelatedForm(e){return e.form||closest(e,"form")}function getRelatedFormData(e){let t=getTargetButton(e.target);if(!t)return;let n=getRelatedForm(t);if(n)return getInternalData(n)}function initButtonTracking(e){e.addEventListener("click",maybeSetLastButtonClicked),e.addEventListener("focusin",maybeSetLastButtonClicked),e.addEventListener("focusout",maybeUnsetLastButtonClicked)}function addHxOnEventHandler(e,t,n){let r=getInternalData(e);Array.isArray(r.onHandlers)||(r.onHandlers=[]);let o,i=function(s){maybeEval(e,function(){eltIsDisabled(e)||(o||(o=new Function("event",n)),o.call(e,s))})};e.addEventListener(t,i),r.onHandlers.push({event:t,listener:i})}function processHxOnWildcard(e){deInitOnHandlers(e);for(let t=0;t<e.attributes.length;t++){let n=e.attributes[t].name,r=e.attributes[t].value;if(startsWith(n,"hx-on")||startsWith(n,"data-hx-on")){let o=n.indexOf("-on")+3,i=n.slice(o,o+1);if(i==="-"||i===":"){let s=n.slice(o+1);startsWith(s,":")?s="htmx"+s:startsWith(s,"-")?s="htmx:"+s.slice(1):startsWith(s,"htmx-")&&(s="htmx:"+s.slice(5)),addHxOnEventHandler(e,s,r)}}}}function initNode(e){triggerEvent(e,"htmx:beforeProcessNode");let t=getInternalData(e),n=getTriggerSpecs(e);processVerbs(e,t,n)||(getClosestAttributeValue(e,"hx-boost")==="true"?boostElement(e,t,n):hasAttribute(e,"hx-trigger")&&n.forEach(function(o){addTriggerHandler(e,o,t,function(){})})),(e.tagName==="FORM"||getRawAttribute(e,"type")==="submit"&&hasAttribute(e,"form"))&&initButtonTracking(e),t.firstInitCompleted=!0,triggerEvent(e,"htmx:afterProcessNode")}function maybeDeInitAndHash(e){if(!(e instanceof Element))return!1;let t=getInternalData(e),n=attributeHash(e);return t.initHash!==n?(deInitNode(e),t.initHash=n,!0):!1}function processNode(e){if(e=resolveTarget(e),eltIsDisabled(e)){cleanUpElement(e);return}let t=[];maybeDeInitAndHash(e)&&t.push(e),forEach(findElementsToProcess(e),function(n){if(eltIsDisabled(n)){cleanUpElement(n);return}maybeDeInitAndHash(n)&&t.push(n)}),forEach(findHxOnWildcardElements(e),processHxOnWildcard),forEach(t,initNode)}function kebabEventName(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function makeEvent(e,t){return new CustomEvent(e,{bubbles:!0,cancelable:!0,composed:!0,detail:t})}function triggerErrorEvent(e,t,n){triggerEvent(e,t,mergeObjects({error:t},n))}function ignoreEventForLogging(e){return e==="htmx:afterProcessNode"}function withExtensions(e,t,n){forEach(getExtensions(e,[],n),function(r){try{t(r)}catch(o){logError(o)}})}function logError(e){console.error(e)}function triggerEvent(e,t,n){e=resolveTarget(e),n==null&&(n={}),n.elt=e;let r=makeEvent(t,n);htmx.logger&&!ignoreEventForLogging(t)&&htmx.logger(e,t,n),n.error&&(logError(n.error+(n.target?", "+n.target:"")),triggerEvent(e,"htmx:error",{errorInfo:n}));let o=e.dispatchEvent(r),i=kebabEventName(t);if(o&&i!==t){let s=makeEvent(i,r.detail);o=o&&e.dispatchEvent(s)}return withExtensions(asElement(e),function(s){o=o&&s.onEvent(t,r)!==!1&&!r.defaultPrevented}),o}let currentPathForHistory;function setCurrentPathForHistory(e){currentPathForHistory=e,canAccessLocalStorage()&&sessionStorage.setItem("htmx-current-path-for-history",e)}setCurrentPathForHistory(location.pathname+location.search);function getHistoryElement(){return getDocument().querySelector("[hx-history-elt],[data-hx-history-elt]")||getDocument().body}function saveToHistoryCache(e,t){if(!canAccessLocalStorage())return;let n=cleanInnerHtmlForHistory(t),r=getDocument().title,o=window.scrollY;if(htmx.config.historyCacheSize<=0){sessionStorage.removeItem("htmx-history-cache");return}e=normalizePath(e);let i=parseJSON(sessionStorage.getItem("htmx-history-cache"))||[];for(let a=0;a<i.length;a++)if(i[a].url===e){i.splice(a,1);break}let s={url:e,content:n,title:r,scroll:o};for(triggerEvent(getDocument().body,"htmx:historyItemCreated",{item:s,cache:i}),i.push(s);i.length>htmx.config.historyCacheSize;)i.shift();for(;i.length>0;)try{sessionStorage.setItem("htmx-history-cache",JSON.stringify(i));break}catch(a){triggerErrorEvent(getDocument().body,"htmx:historyCacheError",{cause:a,cache:i}),i.shift()}}function getCachedHistory(e){if(!canAccessLocalStorage())return null;e=normalizePath(e);let t=parseJSON(sessionStorage.getItem("htmx-history-cache"))||[];for(let n=0;n<t.length;n++)if(t[n].url===e)return t[n];return null}function cleanInnerHtmlForHistory(e){let t=htmx.config.requestClass,n=e.cloneNode(!0);return forEach(findAll(n,"."+t),function(r){removeClassFromElement(r,t)}),forEach(findAll(n,"[data-disabled-by-htmx]"),function(r){r.removeAttribute("disabled")}),n.innerHTML}function saveCurrentPageToHistory(){let e=getHistoryElement(),t=currentPathForHistory;canAccessLocalStorage()&&(t=sessionStorage.getItem("htmx-current-path-for-history")),t=t||location.pathname+location.search,getDocument().querySelector('[hx-history="false" i],[data-hx-history="false" i]')||(triggerEvent(getDocument().body,"htmx:beforeHistorySave",{path:t,historyElt:e}),saveToHistoryCache(t,e)),htmx.config.historyEnabled&&history.replaceState({htmx:!0},getDocument().title,location.href)}function pushUrlIntoHistory(e){htmx.config.getCacheBusterParam&&(e=e.replace(/org\.htmx\.cache-buster=[^&]*&?/,""),(endsWith(e,"&")||endsWith(e,"?"))&&(e=e.slice(0,-1))),htmx.config.historyEnabled&&history.pushState({htmx:!0},"",e),setCurrentPathForHistory(e)}function replaceUrlInHistory(e){htmx.config.historyEnabled&&history.replaceState({htmx:!0},"",e),setCurrentPathForHistory(e)}function settleImmediately(e){forEach(e,function(t){t.call(void 0)})}function loadHistoryFromServer(e){let t=new XMLHttpRequest,n={swapStyle:"innerHTML",swapDelay:0,settleDelay:0},r={path:e,xhr:t,historyElt:getHistoryElement(),swapSpec:n};t.open("GET",e,!0),htmx.config.historyRestoreAsHxRequest&&t.setRequestHeader("HX-Request","true"),t.setRequestHeader("HX-History-Restore-Request","true"),t.setRequestHeader("HX-Current-URL",location.href),t.onload=function(){this.status>=200&&this.status<400?(r.response=this.response,triggerEvent(getDocument().body,"htmx:historyCacheMissLoad",r),swap(r.historyElt,r.response,n,{contextElement:r.historyElt,historyRequest:!0}),setCurrentPathForHistory(r.path),triggerEvent(getDocument().body,"htmx:historyRestore",{path:e,cacheMiss:!0,serverResponse:r.response})):triggerErrorEvent(getDocument().body,"htmx:historyCacheMissLoadError",r)},triggerEvent(getDocument().body,"htmx:historyCacheMiss",r)&&t.send()}function restoreHistory(e){saveCurrentPageToHistory(),e=e||location.pathname+location.search;let t=getCachedHistory(e);if(t){let n={swapStyle:"innerHTML",swapDelay:0,settleDelay:0,scroll:t.scroll},r={path:e,item:t,historyElt:getHistoryElement(),swapSpec:n};triggerEvent(getDocument().body,"htmx:historyCacheHit",r)&&(swap(r.historyElt,t.content,n,{contextElement:r.historyElt,title:t.title}),setCurrentPathForHistory(r.path),triggerEvent(getDocument().body,"htmx:historyRestore",r))}else htmx.config.refreshOnHistoryMiss?htmx.location.reload(!0):loadHistoryFromServer(e)}function addRequestIndicatorClasses(e){let t=findAttributeTargets(e,"hx-indicator");return t==null&&(t=[e]),forEach(t,function(n){let r=getInternalData(n);r.requestCount=(r.requestCount||0)+1,addClassToElement(n,htmx.config.requestClass)}),t}function disableElements(e){let t=findAttributeTargets(e,"hx-disabled-elt");return t==null&&(t=[]),forEach(t,function(n){let r=getInternalData(n);r.requestCount=(r.requestCount||0)+1,n.hasAttribute("disabled")||(n.setAttribute("disabled",""),n.setAttribute("data-disabled-by-htmx",""))}),t}function removeRequestIndicators(e,t){forEach(e.concat(t),function(n){let r=getInternalData(n);r.requestCount=(r.requestCount||1)-1}),forEach(e,function(n){getInternalData(n).requestCount===0&&removeClassFromElement(n,htmx.config.requestClass)}),forEach(t,function(n){getInternalData(n).requestCount===0&&n.hasAttribute("data-disabled-by-htmx")&&(n.removeAttribute("disabled"),n.removeAttribute("data-disabled-by-htmx"))})}function haveSeenNode(e,t){for(let n=0;n<e.length;n++)if(e[n].isSameNode(t))return!0;return!1}function shouldInclude(e){let t=e;return t.name===""||t.name==null||t.disabled||closest(t,"fieldset[disabled]")||t.type==="button"||t.type==="submit"||t.tagName==="image"||t.tagName==="reset"||t.tagName==="file"?!1:t.type==="checkbox"||t.type==="radio"?t.checked:!0}function addValueToFormData(e,t,n){e!=null&&t!=null&&(Array.isArray(t)?t.forEach(function(r){n.append(e,r)}):n.append(e,t))}function removeValueFromFormData(e,t,n){if(e!=null&&t!=null){let r=n.getAll(e);Array.isArray(t)?r=r.filter(o=>t.indexOf(o)<0):r=r.filter(o=>o!==t),n.delete(e),forEach(r,o=>n.append(e,o))}}function getValueFromInput(e){return e instanceof HTMLSelectElement&&e.multiple?toArray(e.querySelectorAll("option:checked")).map(function(t){return t.value}):e instanceof HTMLInputElement&&e.files?toArray(e.files):e.value}function processInputValue(e,t,n,r,o){if(!(r==null||haveSeenNode(e,r))){if(e.push(r),shouldInclude(r)){let i=getRawAttribute(r,"name");addValueToFormData(i,getValueFromInput(r),t),o&&validateElement(r,n)}r instanceof HTMLFormElement&&(forEach(r.elements,function(i){e.indexOf(i)>=0?removeValueFromFormData(i.name,getValueFromInput(i),t):e.push(i),o&&validateElement(i,n)}),new FormData(r).forEach(function(i,s){i instanceof File&&i.name===""||addValueToFormData(s,i,t)}))}}function validateElement(e,t){let n=e;n.willValidate&&(triggerEvent(n,"htmx:validation:validate"),n.checkValidity()||(triggerEvent(n,"htmx:validation:failed",{message:n.validationMessage,validity:n.validity})&&!t.length&&htmx.config.reportValidityOfForms&&n.reportValidity(),t.push({elt:n,message:n.validationMessage,validity:n.validity})))}function overrideFormData(e,t){for(let n of t.keys())e.delete(n);return t.forEach(function(n,r){e.append(r,n)}),e}function getInputValues(e,t){let n=[],r=new FormData,o=new FormData,i=[],s=getInternalData(e);s.lastButtonClicked&&!bodyContains(s.lastButtonClicked)&&(s.lastButtonClicked=null);let a=e instanceof HTMLFormElement&&e.noValidate!==!0||getAttributeValue(e,"hx-validate")==="true";if(s.lastButtonClicked&&(a=a&&s.lastButtonClicked.formNoValidate!==!0),t!=="get"&&processInputValue(n,o,i,getRelatedForm(e),a),processInputValue(n,r,i,e,a),s.lastButtonClicked||e.tagName==="BUTTON"||e.tagName==="INPUT"&&getRawAttribute(e,"type")==="submit"){let c=s.lastButtonClicked||e,f=getRawAttribute(c,"name");addValueToFormData(f,c.value,o)}let l=findAttributeTargets(e,"hx-include");return forEach(l,function(c){processInputValue(n,r,i,asElement(c),a),matches(c,"form")||forEach(asParentNode(c).querySelectorAll(INPUT_SELECTOR),function(f){processInputValue(n,r,i,f,a)})}),overrideFormData(r,o),{errors:i,formData:r,values:formDataProxy(r)}}function appendParam(e,t,n){e!==""&&(e+="&"),String(n)==="[object Object]"&&(n=JSON.stringify(n));let r=encodeURIComponent(n);return e+=encodeURIComponent(t)+"="+r,e}function urlEncode(e){e=formDataFromObject(e);let t="";return e.forEach(function(n,r){t=appendParam(t,r,n)}),t}function getHeaders(e,t,n){let r={"HX-Request":"true","HX-Trigger":getRawAttribute(e,"id"),"HX-Trigger-Name":getRawAttribute(e,"name"),"HX-Target":getAttributeValue(t,"id"),"HX-Current-URL":location.href};return getValuesForElement(e,"hx-headers",!1,r),n!==void 0&&(r["HX-Prompt"]=n),getInternalData(e).boosted&&(r["HX-Boosted"]="true"),r}function filterValues(e,t){let n=getClosestAttributeValue(t,"hx-params");if(n){if(n==="none")return new FormData;if(n==="*")return e;if(n.indexOf("not ")===0)return forEach(n.slice(4).split(","),function(r){r=r.trim(),e.delete(r)}),e;{let r=new FormData;return forEach(n.split(","),function(o){o=o.trim(),e.has(o)&&e.getAll(o).forEach(function(i){r.append(o,i)})}),r}}else return e}function isAnchorLink(e){return!!getRawAttribute(e,"href")&&getRawAttribute(e,"href").indexOf("#")>=0}function getSwapSpecification(e,t){let n=t||getClosestAttributeValue(e,"hx-swap"),r={swapStyle:getInternalData(e).boosted?"innerHTML":htmx.config.defaultSwapStyle,swapDelay:htmx.config.defaultSwapDelay,settleDelay:htmx.config.defaultSettleDelay};if(htmx.config.scrollIntoViewOnBoost&&getInternalData(e).boosted&&!isAnchorLink(e)&&(r.show="top"),n){let s=splitOnWhitespace(n);if(s.length>0)for(let a=0;a<s.length;a++){let l=s[a];if(l.indexOf("swap:")===0)r.swapDelay=parseInterval(l.slice(5));else if(l.indexOf("settle:")===0)r.settleDelay=parseInterval(l.slice(7));else if(l.indexOf("transition:")===0)r.transition=l.slice(11)==="true";else if(l.indexOf("ignoreTitle:")===0)r.ignoreTitle=l.slice(12)==="true";else if(l.indexOf("scroll:")===0){var o=l.slice(7).split(":");let f=o.pop();var i=o.length>0?o.join(":"):null;r.scroll=f,r.scrollTarget=i}else if(l.indexOf("show:")===0){var o=l.slice(5).split(":");let u=o.pop();var i=o.length>0?o.join(":"):null;r.show=u,r.showTarget=i}else if(l.indexOf("focus-scroll:")===0){let c=l.slice(13);r.focusScroll=c=="true"}else a==0?r.swapStyle=l:logError("Unknown modifier in hx-swap: "+l)}}return r}function usesFormData(e){return getClosestAttributeValue(e,"hx-encoding")==="multipart/form-data"||matches(e,"form")&&getRawAttribute(e,"enctype")==="multipart/form-data"}function encodeParamsForBody(e,t,n){let r=null;return withExtensions(t,function(o){r==null&&(r=o.encodeParameters(e,n,t))}),r??(usesFormData(t)?overrideFormData(new FormData,formDataFromObject(n)):urlEncode(n))}function makeSettleInfo(e){return{tasks:[],elts:[e]}}function updateScrollState(e,t){let n=e[0],r=e[e.length-1];if(t.scroll){var o=null;t.scrollTarget&&(o=asElement(querySelectorExt(n,t.scrollTarget))),t.scroll==="top"&&(n||o)&&(o=o||n,o.scrollTop=0),t.scroll==="bottom"&&(r||o)&&(o=o||r,o.scrollTop=o.scrollHeight),typeof t.scroll=="number"&&getWindow().setTimeout(function(){window.scrollTo(0,t.scroll)},0)}if(t.show){var o=null;if(t.showTarget){let s=t.showTarget;t.showTarget==="window"&&(s="body"),o=asElement(querySelectorExt(n,s))}t.show==="top"&&(n||o)&&(o=o||n,o.scrollIntoView({block:"start",behavior:htmx.config.scrollBehavior})),t.show==="bottom"&&(r||o)&&(o=o||r,o.scrollIntoView({block:"end",behavior:htmx.config.scrollBehavior}))}}function getValuesForElement(e,t,n,r,o){if(r==null&&(r={}),e==null)return r;let i=getAttributeValue(e,t);if(i){let s=i.trim(),a=n;if(s==="unset")return null;s.indexOf("javascript:")===0?(s=s.slice(11),a=!0):s.indexOf("js:")===0&&(s=s.slice(3),a=!0),s.indexOf("{")!==0&&(s="{"+s+"}");let l;a?l=maybeEval(e,function(){return o?Function("event","return ("+s+")").call(e,o):Function("return ("+s+")").call(e)},{}):l=parseJSON(s);for(let c of Object.keys(l))r[c]==null&&(r[c]=l[c])}return getValuesForElement(asElement(parentElt(e)),t,n,r,o)}function maybeEval(e,t,n){return htmx.config.allowEval?t():(triggerErrorEvent(e,"htmx:evalDisallowedError"),n)}function getHXVarsForElement(e,t,n){return getValuesForElement(e,"hx-vars",!0,n,t)}function getHXValsForElement(e,t,n){return getValuesForElement(e,"hx-vals",!1,n,t)}function getExpressionVars(e,t){return mergeObjects(getHXVarsForElement(e,t),getHXValsForElement(e,t))}function safelySetHeaderValue(e,t,n){if(n!==null)try{e.setRequestHeader(t,n)}catch{e.setRequestHeader(t,encodeURIComponent(n)),e.setRequestHeader(t+"-URI-AutoEncoded","true")}}function getPathFromResponse(e){if(e.responseURL)try{let t=new URL(e.responseURL);return t.pathname+t.search}catch{triggerErrorEvent(getDocument().body,"htmx:badResponseUrl",{url:e.responseURL})}}function hasHeader(e,t){return e.getResponseHeader(t)!==null}function ajaxHelper(e,t,n){if(e=e.toLowerCase(),n){if(n instanceof Element||typeof n=="string")return issueAjaxRequest(e,t,null,null,{targetOverride:resolveTarget(n)||DUMMY_ELT,returnPromise:!0});{let r=resolveTarget(n.target);return(n.target&&!r||n.source&&!r&&!resolveTarget(n.source))&&(r=DUMMY_ELT),issueAjaxRequest(e,t,resolveTarget(n.source),n.event,{handler:n.handler,headers:n.headers,values:n.values,targetOverride:r,swapOverride:n.swap,select:n.select,returnPromise:!0,push:n.push,replace:n.replace,selectOOB:n.selectOOB})}}else return issueAjaxRequest(e,t,null,null,{returnPromise:!0})}function hierarchyForElt(e){let t=[];for(;e;)t.push(e),e=e.parentElement;return t}function verifyPath(e,t,n){let r=new URL(t,location.protocol!=="about:"?location.href:window.origin),i=(location.protocol!=="about:"?location.origin:window.origin)===r.origin;return htmx.config.selfRequestsOnly&&!i?!1:triggerEvent(e,"htmx:validateUrl",mergeObjects({url:r,sameHost:i},n))}function formDataFromObject(e){if(e instanceof FormData)return e;let t=new FormData;for(let n of Object.keys(e))e[n]&&typeof e[n].forEach=="function"?e[n].forEach(function(r){t.append(n,r)}):typeof e[n]=="object"&&!(e[n]instanceof Blob)?t.append(n,JSON.stringify(e[n])):t.append(n,e[n]);return t}function formDataArrayProxy(e,t,n){return new Proxy(n,{get:function(r,o){return typeof o=="number"?r[o]:o==="length"?r.length:o==="push"?function(i){r.push(i),e.append(t,i)}:typeof r[o]=="function"?function(){r[o].apply(r,arguments),e.delete(t),r.forEach(function(i){e.append(t,i)})}:r[o]&&r[o].length===1?r[o][0]:r[o]},set:function(r,o,i){return r[o]=i,e.delete(t),r.forEach(function(s){e.append(t,s)}),!0}})}function formDataProxy(e){return new Proxy(e,{get:function(t,n){if(typeof n=="symbol"){let o=Reflect.get(t,n);return typeof o=="function"?function(){return o.apply(e,arguments)}:o}if(n==="toJSON")return()=>Object.fromEntries(e);if(n in t&&typeof t[n]=="function")return function(){return e[n].apply(e,arguments)};let r=e.getAll(n);if(r.length!==0)return r.length===1?r[0]:formDataArrayProxy(t,n,r)},set:function(t,n,r){return typeof n!="string"?!1:(t.delete(n),r&&typeof r.forEach=="function"?r.forEach(function(o){t.append(n,o)}):typeof r=="object"&&!(r instanceof Blob)?t.append(n,JSON.stringify(r)):t.append(n,r),!0)},deleteProperty:function(t,n){return typeof n=="string"&&t.delete(n),!0},ownKeys:function(t){return Reflect.ownKeys(Object.fromEntries(t))},getOwnPropertyDescriptor:function(t,n){return Reflect.getOwnPropertyDescriptor(Object.fromEntries(t),n)}})}function issueAjaxRequest(e,t,n,r,o,i){let s=null,a=null;if(o=o??{},o.returnPromise&&typeof Promise<"u")var l=new Promise(function(y,A){s=y,a=A});n==null&&(n=getDocument().body);let c=o.handler||handleAjaxResponse,f=o.select||null;if(!bodyContains(n))return maybeCall(s),l;let u=o.targetOverride||asElement(getTarget(n));if(u==null||u==DUMMY_ELT)return triggerErrorEvent(n,"htmx:targetError",{target:getClosestAttributeValue(n,"hx-target")}),maybeCall(a),l;let m=getInternalData(n),E=m.lastButtonClicked;if(E){let y=getRawAttribute(E,"formaction");y!=null&&(t=y);let A=getRawAttribute(E,"formmethod");if(A!=null)if(VERBS.includes(A.toLowerCase()))e=A;else return maybeCall(s),l}let T=getClosestAttributeValue(n,"hx-confirm");if(i===void 0&&triggerEvent(n,"htmx:confirm",{target:u,elt:n,path:t,verb:e,triggeringEvent:r,etc:o,issueRequest:function(M){return issueAjaxRequest(e,t,n,r,o,!!M)},question:T})===!1)return maybeCall(s),l;let h=n,p=getClosestAttributeValue(n,"hx-sync"),v=null,H=!1;if(p){let y=p.split(":"),A=y[0].trim();if(A==="this"?h=findThisElement(n,"hx-sync"):h=asElement(querySelectorExt(n,A)),p=(y[1]||"drop").trim(),m=getInternalData(h),p==="drop"&&m.xhr&&m.abortable!==!0)return maybeCall(s),l;if(p==="abort"){if(m.xhr)return maybeCall(s),l;H=!0}else p==="replace"?triggerEvent(h,"htmx:abort"):p.indexOf("queue")===0&&(v=(p.split(" ")[1]||"last").trim())}if(m.xhr)if(m.abortable)triggerEvent(h,"htmx:abort");else{if(v==null){if(r){let y=getInternalData(r);y&&y.triggerSpec&&y.triggerSpec.queue&&(v=y.triggerSpec.queue)}v==null&&(v="last")}return m.queuedRequests==null&&(m.queuedRequests=[]),v==="first"&&m.queuedRequests.length===0?m.queuedRequests.push(function(){issueAjaxRequest(e,t,n,r,o)}):v==="all"?m.queuedRequests.push(function(){issueAjaxRequest(e,t,n,r,o)}):v==="last"&&(m.queuedRequests=[],m.queuedRequests.push(function(){issueAjaxRequest(e,t,n,r,o)})),maybeCall(s),l}let b=new XMLHttpRequest;m.xhr=b,m.abortable=H;let d=function(){m.xhr=null,m.abortable=!1,m.queuedRequests!=null&&m.queuedRequests.length>0&&m.queuedRequests.shift()()},g=getClosestAttributeValue(n,"hx-prompt");if(g){var x=prompt(g);if(x===null||!triggerEvent(n,"htmx:prompt",{prompt:x,target:u}))return maybeCall(s),d(),l}if(T&&!i&&!confirm(T))return maybeCall(s),d(),l;let S=getHeaders(n,u,x);e!=="get"&&!usesFormData(n)&&(S["Content-Type"]="application/x-www-form-urlencoded"),o.headers&&(S=mergeObjects(S,o.headers));let D=getInputValues(n,e),w=D.errors,k=D.formData;o.values&&overrideFormData(k,formDataFromObject(o.values));let B=formDataFromObject(getExpressionVars(n,r)),O=overrideFormData(k,B),I=filterValues(O,n);htmx.config.getCacheBusterParam&&e==="get"&&I.set("org.htmx.cache-buster",getRawAttribute(u,"id")||"true"),(t==null||t==="")&&(t=location.href);let K=getValuesForElement(n,"hx-request"),me=getInternalData(n).boosted,V=htmx.config.methodsThatUseUrlParams.indexOf(e)>=0,L={boosted:me,useUrlParams:V,formData:I,parameters:formDataProxy(I),unfilteredFormData:O,unfilteredParameters:formDataProxy(O),headers:S,elt:n,target:u,verb:e,errors:w,withCredentials:o.credentials||K.credentials||htmx.config.withCredentials,timeout:o.timeout||K.timeout||htmx.config.timeout,path:t,triggeringEvent:r};if(!triggerEvent(n,"htmx:configRequest",L))return maybeCall(s),d(),l;if(t=L.path,e=L.verb,S=L.headers,I=formDataFromObject(L.parameters),w=L.errors,V=L.useUrlParams,w&&w.length>0)return triggerEvent(n,"htmx:validation:halted",L),maybeCall(s),d(),l;let he=t.split("#"),Ue=he[0],Q=he[1],R=t;if(V&&(R=Ue,!I.keys().next().done&&(R.indexOf("?")<0?R+="?":R+="&",R+=urlEncode(I),Q&&(R+="#"+Q))),!verifyPath(n,R,L))return triggerErrorEvent(n,"htmx:invalidPath",L),maybeCall(a),d(),l;if(b.open(e.toUpperCase(),R,!0),b.overrideMimeType("text/html"),b.withCredentials=L.withCredentials,b.timeout=L.timeout,!K.noHeaders)for(let y of Object.keys(S))safelySetHeaderValue(b,y,S[y]);let C={xhr:b,target:u,requestConfig:L,etc:o,boosted:me,select:f,pathInfo:{requestPath:t,finalRequestPath:R,responsePath:null,anchor:Q}};if(b.onload=function(){try{let y=hierarchyForElt(n);if(C.pathInfo.responsePath=getPathFromResponse(b),c(n,C),C.keepIndicators!==!0&&removeRequestIndicators(U,W),triggerEvent(n,"htmx:afterRequest",C),triggerEvent(n,"htmx:afterOnLoad",C),!bodyContains(n)){let A=null;for(;y.length>0&&A==null;){let M=y.shift();bodyContains(M)&&(A=M)}A&&(triggerEvent(A,"htmx:afterRequest",C),triggerEvent(A,"htmx:afterOnLoad",C))}maybeCall(s)}catch(y){throw triggerErrorEvent(n,"htmx:onLoadError",mergeObjects({error:y},C)),y}finally{d()}},b.onerror=function(){removeRequestIndicators(U,W),triggerErrorEvent(n,"htmx:afterRequest",C),triggerErrorEvent(n,"htmx:sendError",C),maybeCall(a),d()},b.onabort=function(){removeRequestIndicators(U,W),triggerErrorEvent(n,"htmx:afterRequest",C),triggerErrorEvent(n,"htmx:sendAbort",C),maybeCall(a),d()},b.ontimeout=function(){removeRequestIndicators(U,W),triggerErrorEvent(n,"htmx:afterRequest",C),triggerErrorEvent(n,"htmx:timeout",C),maybeCall(a),d()},!triggerEvent(n,"htmx:beforeRequest",C))return maybeCall(s),d(),l;var U=addRequestIndicatorClasses(n),W=disableElements(n);forEach(["loadstart","loadend","progress","abort"],function(y){forEach([b,b.upload],function(A){A.addEventListener(y,function(M){triggerEvent(n,"htmx:xhr:"+y,{lengthComputable:M.lengthComputable,loaded:M.loaded,total:M.total})})})}),triggerEvent(n,"htmx:beforeSend",C);let We=V?null:encodeParamsForBody(b,n,I);return b.send(We),l}function determineHistoryUpdates(e,t){let n=t.xhr,r=null,o=null;if(hasHeader(n,"HX-Push")?(r=n.getResponseHeader("HX-Push"),o="push"):hasHeader(n,"HX-Push-Url")?(r=n.getResponseHeader("HX-Push-Url"),o="push"):hasHeader(n,"HX-Replace-Url")&&(r=n.getResponseHeader("HX-Replace-Url"),o="replace"),r)return r==="false"?{}:{type:o,path:r};let i=t.pathInfo.finalRequestPath,s=t.pathInfo.responsePath,a=t.etc.push||getClosestAttributeValue(e,"hx-push-url"),l=t.etc.replace||getClosestAttributeValue(e,"hx-replace-url");l==="false"&&(l=null);let c=getInternalData(e).boosted,f=null,u=null;return a?(f="push",u=a):l?(f="replace",u=l):c&&(f="push",u=s||i),u?u==="false"?{}:(u==="true"&&(u=s||i),t.pathInfo.anchor&&u.indexOf("#")===-1&&(u=u+"#"+t.pathInfo.anchor),{type:f,path:u}):{}}function codeMatches(e,t){var n=new RegExp(e.code);return n.test(t.toString(10))}function resolveResponseHandling(e){for(var t=0;t<htmx.config.responseHandling.length;t++){var n=htmx.config.responseHandling[t];if(codeMatches(n,e.status))return n}return{swap:!1}}function handleTitle(e){if(e){let t=find("title");t?t.textContent=e:window.document.title=e}}function resolveRetarget(e,t){if(t==="this")return e;let n=asElement(querySelectorExt(e,t));if(n==null)throw triggerErrorEvent(e,"htmx:targetError",{target:t}),new Error(`Invalid re-target ${t}`);return n}function handleAjaxResponse(e,t){let n=t.xhr,r=t.target,o=t.etc,i=t.select;if(!triggerEvent(e,"htmx:beforeOnLoad",t))return;if(hasHeader(n,"HX-Trigger")&&handleTriggerHeader(n,"HX-Trigger",e),hasHeader(n,"HX-Location")){let H=n.getResponseHeader("HX-Location");var s={};H.indexOf("{")===0&&(s=parseJSON(H),H=s.path,delete s.path),s.push=s.push??"true",ajaxHelper("get",H,s);return}let a=hasHeader(n,"HX-Refresh")&&n.getResponseHeader("HX-Refresh")==="true";if(hasHeader(n,"HX-Redirect")){t.keepIndicators=!0,htmx.location.href=n.getResponseHeader("HX-Redirect"),a&&htmx.location.reload();return}if(a){t.keepIndicators=!0,htmx.location.reload();return}let l=determineHistoryUpdates(e,t),c=resolveResponseHandling(n),f=c.swap,u=!!c.error,m=htmx.config.ignoreTitle||c.ignoreTitle,E=c.select;c.target&&(t.target=resolveRetarget(e,c.target));var T=o.swapOverride;T==null&&c.swapOverride&&(T=c.swapOverride),hasHeader(n,"HX-Retarget")&&(t.target=resolveRetarget(e,n.getResponseHeader("HX-Retarget"))),hasHeader(n,"HX-Reswap")&&(T=n.getResponseHeader("HX-Reswap"));var h=n.response,p=mergeObjects({shouldSwap:f,serverResponse:h,isError:u,ignoreTitle:m,selectOverride:E,swapOverride:T},t);if(!(c.event&&!triggerEvent(r,c.event,p))&&triggerEvent(r,"htmx:beforeSwap",p)){if(r=p.target,h=p.serverResponse,u=p.isError,m=p.ignoreTitle,E=p.selectOverride,T=p.swapOverride,t.target=r,t.failed=u,t.successful=!u,p.shouldSwap){n.status===286&&cancelPolling(e),withExtensions(e,function(d){h=d.transformResponse(h,n,e)}),l.type&&saveCurrentPageToHistory();var v=getSwapSpecification(e,T);v.hasOwnProperty("ignoreTitle")||(v.ignoreTitle=m),addClassToElement(r,htmx.config.swappingClass),i&&(E=i),hasHeader(n,"HX-Reselect")&&(E=n.getResponseHeader("HX-Reselect"));let H=o.selectOOB||getClosestAttributeValue(e,"hx-select-oob"),b=getClosestAttributeValue(e,"hx-select");swap(r,h,v,{select:E==="unset"?null:E||b,selectOOB:H,eventInfo:t,anchor:t.pathInfo.anchor,contextElement:e,afterSwapCallback:function(){if(hasHeader(n,"HX-Trigger-After-Swap")){let d=e;bodyContains(e)||(d=getDocument().body),handleTriggerHeader(n,"HX-Trigger-After-Swap",d)}},afterSettleCallback:function(){if(hasHeader(n,"HX-Trigger-After-Settle")){let d=e;bodyContains(e)||(d=getDocument().body),handleTriggerHeader(n,"HX-Trigger-After-Settle",d)}},beforeSwapCallback:function(){l.type&&(triggerEvent(getDocument().body,"htmx:beforeHistoryUpdate",mergeObjects({history:l},t)),l.type==="push"?(pushUrlIntoHistory(l.path),triggerEvent(getDocument().body,"htmx:pushedIntoHistory",{path:l.path})):(replaceUrlInHistory(l.path),triggerEvent(getDocument().body,"htmx:replacedInHistory",{path:l.path})))}})}u&&triggerErrorEvent(e,"htmx:responseError",mergeObjects({error:"Response Status Error Code "+n.status+" from "+t.pathInfo.requestPath},t))}}let extensions={};function extensionBase(){return{init:function(e){return null},getSelectors:function(){return null},onEvent:function(e,t){return!0},transformResponse:function(e,t,n){return e},isInlineSwap:function(e){return!1},handleSwap:function(e,t,n,r){return!1},encodeParameters:function(e,t,n){return null}}}function defineExtension(e,t){t.init&&t.init(internalAPI),extensions[e]=mergeObjects(extensionBase(),t)}function removeExtension(e){delete extensions[e]}function getExtensions(e,t,n){if(t==null&&(t=[]),e==null)return t;n==null&&(n=[]);let r=getAttributeValue(e,"hx-ext");return r&&forEach(r.split(","),function(o){if(o=o.replace(/ /g,""),o.slice(0,7)=="ignore:"){n.push(o.slice(7));return}if(n.indexOf(o)<0){let i=extensions[o];i&&t.indexOf(i)<0&&t.push(i)}}),getExtensions(asElement(parentElt(e)),t,n)}var isReady=!1;getDocument().addEventListener("DOMContentLoaded",function(){isReady=!0});function ready(e){isReady||getDocument().readyState==="complete"?e():getDocument().addEventListener("DOMContentLoaded",e)}function insertIndicatorStyles(){if(htmx.config.includeIndicatorStyles!==!1){let e=htmx.config.inlineStyleNonce?` nonce="${htmx.config.inlineStyleNonce}"`:"",t=htmx.config.indicatorClass,n=htmx.config.requestClass;getDocument().head.insertAdjacentHTML("beforeend",`<style${e}>.${t}{opacity:0;visibility: hidden} .${n} .${t}, .${n}.${t}{opacity:1;visibility: visible;transition: opacity 200ms ease-in}</style>`)}}function getMetaConfig(){let e=getDocument().querySelector('meta[name="htmx-config"]');return e?parseJSON(e.content):null}function mergeMetaConfig(){let e=getMetaConfig();e&&(htmx.config=mergeObjects(htmx.config,e))}return ready(function(){mergeMetaConfig(),insertIndicatorStyles();let e=getDocument().body;processNode(e);let t=getDocument().querySelectorAll("[hx-trigger='restored'],[data-hx-trigger='restored']");e.addEventListener("htmx:abort",function(r){let o=r.detail.elt||r.target,i=getInternalData(o);i&&i.xhr&&i.xhr.abort()});let n=window.onpopstate?window.onpopstate.bind(window):null;window.onpopstate=function(r){r.state&&r.state.htmx?(restoreHistory(),forEach(t,function(o){triggerEvent(o,"htmx:restored",{document:getDocument(),triggerEvent})})):n&&n(r)},getWindow().setTimeout(function(){triggerEvent(e,"htmx:load",{}),e=null},0)}),htmx})(),Z=$e});_();_();var Ye=Z,P="inlay-picker",j=null,X=null,F=e=>{e.dispatchEvent(new Event("change",{bubbles:!0}))},pe=()=>{let e=document.getElementById(P);return e instanceof HTMLDialogElement?e:null};function ze(e){if(e===null)return null;let t;try{t=JSON.parse(e)}catch{return null}if(typeof t!="object"||t===null)return null;let{value:n,label:r,thumb:o}=t;return typeof n!="string"||typeof r!="string"?null:typeof o=="string"&&o.startsWith("/media/")?{value:n,label:r,thumb:o}:{value:n,label:r}}function Ee(e,t){let n=pe();n&&(j=document.activeElement instanceof HTMLElement?document.activeElement:null,X=t,n.querySelector("#inlay-picker-body")?.replaceChildren(),Ye.ajax("get",e,{target:"#inlay-picker-body",swap:"innerHTML"}),n.open||n.showModal())}function ye(e,t,n){let r=e.querySelector("[data-picker-label]");r&&(r.textContent=t??r.dataset.empty??"",r.classList.remove("rounded-box","bg-warning","px-2","text-warning-content"),r.classList.toggle("text-base-content/70",t===null));let o=e.querySelector("img[data-picker-thumb]");o&&(n===void 0?o.removeAttribute("src"):o.src=n,o.hidden=n===void 0)}function Je(e,t){if(e.hasAttribute("data-many")){let o=e.querySelector("[data-picker-list]"),i=e.querySelector("template[data-picker-chip]");if(!o||!(i instanceof HTMLTemplateElement)||[...o.querySelectorAll('input[type="hidden"]')].some(m=>m.value===t.value))return;let a=i.content.firstElementChild?.cloneNode(!0);if(!(a instanceof HTMLElement))return;let l=a.querySelector('input[type="hidden"]');l&&(l.value=t.value);let c=a.querySelector("[data-chip-label]");c&&(c.textContent=t.label);let f=a.querySelector("[data-picker-remove]"),u=i.dataset.removeLabel;f&&u!==void 0&&f.setAttribute("aria-label",u.replace("{item}",t.label)),o.append(a),l&&F(l);return}let n=e.querySelector("input[data-picker-value]");n&&(n.value=t.value),ye(e,t.label,t.thumb);let r=e.closest("[data-link]")?.querySelector('input[data-link-mode="document"]');r&&(r.checked=!0),n&&F(n)}function Ge(e){if(e.hasAttribute("data-many")){let n=e.querySelector("[data-picker-list]");for(let r of n?.querySelectorAll('input[type="hidden"]')??[])F(r);n?.replaceChildren();return}let t=e.querySelector("input[data-picker-value]");t&&(t.value=""),ye(e,null,void 0),t&&F(t)}function Ke(e){let t=e.closest("[data-picker]"),n=e.closest("li");for(let r of n?.querySelectorAll('input[type="hidden"]')??[])F(r);n?.remove(),t?.querySelector("[data-picker-open]")?.focus()}function be(e){let t=X;t&&(X=null,pe()?.close(),t(e))}function Qe(e){if(/[\u0000-\u001f\u007f]/.test(e))return!1;if(e.startsWith("/"))return!e.startsWith("//")&&!e.startsWith("/\\");try{return["http:","https:","mailto:","tel:"].includes(new URL(e).protocol)}catch{return!1}}function ve(e){let t=e.querySelector("input");if(!t)return;let n=t.value.trim();if(Qe(n)){be({value:`url:${n}`,label:n});return}let r=e.querySelector("[data-pick-web-problem]");if(r){r.hidden=!1;let o=(t.getAttribute("aria-describedby")??"").split(" ").filter(i=>i!=="");r.id!==""&&!o.includes(r.id)&&t.setAttribute("aria-describedby",[...o,r.id].join(" "))}t.setAttribute("aria-invalid","true"),t.focus()}function Ze(e){let t=e.target instanceof Element?e.target:null;if(!t)return;let n=t.closest(`#${P} [data-pick]`);if(n){let a=ze(n.getAttribute("data-pick"));a&&be(a);return}let r=t.closest(`#${P} [data-pick-web-use]`)?.closest("[data-pick-web]");if(r){ve(r);return}let o=t.closest("[data-picker-open]"),i=t.closest("[data-picker]");if(o&&i){let a=i.dataset.picker;a!==void 0&&Ee(a,l=>Je(i,l));return}if(t.closest("[data-picker-clear]")&&i){Ge(i);return}let s=t.closest("[data-picker-remove]");s&&Ke(s)}function et(e){let t=e.target;if(!(t instanceof HTMLInputElement)||!t.hasAttribute("data-link-url"))return;let n=t.closest("[data-link]")?.querySelector('input[data-link-mode="url"]');n&&t.value!==""&&(n.checked=!0)}function tt(e){if(e.key!=="Enter"||!(e.target instanceof HTMLInputElement))return;let t=e.target.closest(`#${P} [data-pick-web]`);t&&(e.preventDefault(),ve(t))}function nt(e){!(e.target instanceof HTMLDialogElement)||e.target.id!==P||(X=null,j?.isConnected&&j.focus(),j=null)}function rt(e){let t=e.target;!(t instanceof Element)||t.id!=="inlay-picker-body"||t.querySelector('input[type="search"]')?.focus()}document.addEventListener("click",Ze);document.addEventListener("input",et);document.addEventListener("keydown",tt);document.addEventListener("close",nt,!0);document.addEventListener("htmx:afterSwap",rt);window.InlayAdmin={openPicker:Ee};async function ot(e){await(await Promise.resolve().then(()=>(_(),ge))).default.ajax("get",e,{target:"#bulk-delete-body",select:"#bulk-delete-confirm"})}var $=new WeakSet;function it(e){$.has(e)||($.add(e),e.addEventListener("click",t=>{!(t.target instanceof Element)||t.target.closest("[data-dialog-cancel]")===null||(t.preventDefault(),e.close())}))}function st(e,t){let n=e.ownerDocument,r=n.getElementById("bulk-delete-body");r?.replaceChildren(),it(e),e.open||e.showModal();let o=()=>{e.close(),n.defaultView?.location.assign(t)};ot(t).then(()=>{let i=r?.querySelector("#bulk-delete-confirm");if(i==null)return o();i.querySelector('form button[type="submit"]')?.focus()},o)}function xe(e){if($.has(e))return;$.add(e);let t=e.querySelector("form");if(t===null||t.id==="")return;let n=e.ownerDocument,r=c=>[...n.querySelectorAll(c)].filter(f=>f.getAttribute("form")===t.id),o=()=>r('input[type="checkbox"][name="ids"]'),i=()=>r('input[type="checkbox"][data-select-all]'),s=e.querySelector("[data-selected-count]"),a=e.dataset.selectedTemplate??"{count}",l=()=>{let c=o(),f=c.filter(u=>u.checked).length;e.hidden=f===0,s!==null&&(s.textContent=f===0?"":a.replace("{count}",String(f)));for(let u of i())u.checked=f>0&&f===c.length,u.indeterminate=f>0&&f<c.length};for(let c of o())c.addEventListener("change",l);for(let c of i())c.addEventListener("change",()=>{for(let f of o())f.checked=c.checked;l()});for(let c of e.querySelectorAll("button[data-bulk-delete]"))c.addEventListener("click",f=>{let u=n.getElementById("bulk-delete-dialog"),m=c.getAttribute("formaction");if(!(u instanceof HTMLDialogElement)||m===null)return;f.preventDefault();let E=new URLSearchParams;for(let h of o())h.checked&&E.append("ids",h.value);let T=r('input[name="back"]')[0];T!==void 0&&E.set("back",T.value),st(u,`${m}?${E.toString()}`)});e.querySelector("[data-clear-selection]")?.addEventListener("click",()=>{for(let c of o())c.checked=!1;l(),i()[0]?.focus()}),l()}function ee(e){e instanceof HTMLElement&&e.matches("[data-bulk-bar]")&&xe(e);for(let t of e.querySelectorAll("[data-bulk-bar]"))xe(t)}var Se=new WeakSet;function Te(e){if(Se.has(e))return;Se.add(e);let t=()=>[...e.querySelectorAll("details.dropdown[open]")];e.addEventListener("keydown",n=>{if(n.key!=="Escape"||!(n.target instanceof Element))return;let r=n.target.closest("details.dropdown[open]");r!==null&&(n.preventDefault(),r.open=!1,r.querySelector(":scope > summary")?.focus())}),e.addEventListener("click",n=>{let r=n.target instanceof Node?n.target:null;for(let o of t())(r===null||!o.contains(r))&&(o.open=!1)})}function we(){document.addEventListener("click",e=>{let t=e.target;if(!(t instanceof Element))return;let n=t.closest("button[data-copy]");if(!n)return;let r=document.getElementById(n.dataset.copy??"");if(!(r instanceof HTMLInputElement||r instanceof HTMLTextAreaElement))return;let o=()=>{r.focus(),r.select()},i=()=>{let s=n.dataset.original??n.textContent;n.dataset.original=s,n.textContent=n.dataset.copied??s,clearTimeout(Number(n.dataset.timer)),n.dataset.timer=String(setTimeout(()=>{n.textContent=s,delete n.dataset.original},2e3))};try{let s=navigator.clipboard?.writeText(r.value);if(!s)return o();s.then(i,o)}catch{o()}})}var Ae=new WeakSet;function te(e){for(let t of e.querySelectorAll("[data-length-for]")){if(Ae.has(t))continue;let n=t.ownerDocument.getElementById(t.getAttribute("data-length-for")??""),r=Number(t.getAttribute("data-suggested-length")),o=t.getAttribute("data-label"),i=t.querySelector("[data-length-count]"),s=t.querySelector("[data-length-hint]");if(!(n instanceof HTMLInputElement||n instanceof HTMLTextAreaElement)||o===null||i===null||!Number.isFinite(r))continue;Ae.add(t);let a=()=>{let l=n.value.length;i.textContent=o.replace("{count}",()=>String(l)),s?.toggleAttribute("hidden",l<=r)};n.addEventListener("input",a)}}var at="publish-panel",lt="publish-dialog-body",He=new WeakSet;function Ce(e,t){for(let n of e.querySelectorAll("[data-refresh][id]")){let r=t.getElementById(n.id);r!==null&&n.replaceWith(e.importNode(r,!0))}}function Le(e){if(e.querySelector('input[name="_dialog"]')!==null)return;let t=e.ownerDocument.createElement("input");t.type="hidden",t.name="_dialog",t.value="1",e.append(t)}function ne(e,t){let n=new URLSearchParams;for(let[r,o]of new FormData(e))typeof o=="string"&&n.append(r,o);return t instanceof HTMLButtonElement&&t.name!==""&&n.append(t.name,t.value),n}function De(e,t={}){let n=e.getElementById("publish-dialog");if(!(n instanceof HTMLDialogElement)||He.has(n))return;He.add(n);let r=n,o=e.defaultView,i=e.getElementById(lt),s=e.getElementById("publish-dialog-title"),a=r.querySelector("[data-publish-loading]"),l=t.reload??(()=>o?.location.reload()),c=!1,f=!1,u=0,m=d=>{r.dataset.state=d;for(let g of r.querySelectorAll("[data-state-icon]"))g.hidden=g.dataset.stateIcon!==d},E=d=>{let g=new DOMParser().parseFromString(d,"text/html").getElementById(at);if(g===null||i===null)return!1;let x=g.dataset.state??"";s!==null&&(s.textContent=g.dataset.title??"");for(let D of g.querySelectorAll("[data-dialog-label]"))D.textContent=D.dataset.dialogLabel??"";return i.replaceChildren(e.importNode(g,!0)),a!==null&&(a.hidden=!0),m(x),x==="done"&&(c=!0),(i.querySelector('form button[type="submit"]')??i.querySelector("a, button"))?.focus(),!0},T=()=>{if(e.getElementById("editor-form")===null||o===null)return l();fetch(o.location.href,{headers:{accept:"text/html"}}).then(d=>d.text()).then(d=>Ce(e,new DOMParser().parseFromString(d,"text/html")),l)},h=(d,g)=>{let x=ne(d,g);x.set("_dialog","1"),g.disabled=!0;let S=()=>{g.disabled=!1,Le(d),d.requestSubmit(g)};fetch(d.action,{method:"POST",body:x,headers:{accept:"text/html"}}).then(D=>D.text()).then(D=>{let w=new DOMParser().parseFromString(D,"text/html"),k=w.querySelector("[data-publish-open]")?.dataset.publishOpen,B=w.querySelector('#editor-form input[name="base"]')?.value,O=d.querySelector('input[name="base"]');if(k===void 0||B===void 0||O===null)return S();O.value=B;let I=w.getElementById("save-state");I!==null&&e.getElementById("save-state")?.replaceWith(e.importNode(I,!0)),Ce(e,w),d.dispatchEvent(new CustomEvent("inlay:saved",{bubbles:!0})),g.disabled=!1,p(k)},S)},p=d=>{let g=++u;i?.replaceChildren(),a!==null&&(a.hidden=!1),m(""),r.open||(c=!1,r.showModal());let x=()=>{g===u&&(r.close(),o?.location.assign(d))};fetch(d,{headers:{accept:"text/html"}}).then(S=>S.text()).then(S=>{g===u&&!E(S)&&x()},x)},v=d=>{let g=++u;f=!0;let x=ne(d);x.set("_dialog","1");for(let w of d.querySelectorAll("button, a"))w instanceof HTMLButtonElement?w.disabled=!0:w.setAttribute("aria-disabled","true");let S=d.querySelector('button[type="submit"]');S!==null&&d.dataset.busyLabel!==void 0&&(S.textContent=d.dataset.busyLabel);let D=()=>{g===u&&d.submit()};fetch(d.action,{method:"POST",body:x,headers:{accept:"text/html"}}).finally(()=>{f=!1}).then(w=>w.text()).then(w=>{g===u&&!E(w)&&D()},D)};e.addEventListener("click",d=>{if(!(d.target instanceof Element)||!r.isConnected)return;let g=d.target.closest("[data-publish-dialog]");if(g===null||r.contains(g))return;if(g instanceof HTMLAnchorElement){d.preventDefault(),g.closest("details.dropdown")?.removeAttribute("open"),p(g.href);return}if(!(g instanceof HTMLButtonElement)||g.form===null)return;let x=g.form;if(g.name==="_action"){if(x.hasAttribute("data-save-errors"))return Le(x);d.preventDefault(),h(x,g);return}d.preventDefault();let S=new URL(g.getAttribute("formaction")??x.getAttribute("action")??"",e.baseURI);S.search=ne(x).toString(),p(S.href)}),i?.addEventListener("click",d=>{if(!(d.target instanceof Element))return;let g=d.target.closest("a, button");if(g!==null){if(g.getAttribute("aria-disabled")==="true"){d.preventDefault();return}if(g.hasAttribute("data-dialog-cancel")){d.preventDefault(),r.close();return}g instanceof HTMLAnchorElement&&new URL(g.href).pathname==="/admin/publish"&&(d.preventDefault(),p(g.href))}}),i?.addEventListener("submit",d=>{let g=d.target;!(g instanceof HTMLFormElement)||g.method!=="post"||(d.preventDefault(),v(g))}),r.addEventListener("close",()=>{u++,(c||f)&&T()});let H=e.querySelector("[data-publish-open]"),b=H?.dataset.publishOpen;if(!(H==null||b===void 0)){if(H.remove(),o!==null){let d=new URL(o.location.href);d.searchParams.delete("review"),o.history.replaceState(o.history.state,"",d.href)}p(b)}}var ct='input:not([type="hidden"]):not([type="radio"]), select, textarea',Y=new WeakSet,Ie=new WeakSet,Re=new WeakSet,re=e=>!e.closest("[hidden]"),ut=e=>[...e.querySelectorAll('[role="alert"], [aria-invalid="true"]')].some(re);function Me(e){e.open||e.showModal();let t=o=>[...e.querySelectorAll(o)].find(re),n=t('[role="alert"]');if(n){n.hasAttribute("tabindex")||n.setAttribute("tabindex","-1"),n.focus();return}let r=t('[aria-invalid="true"]');if(r){let o=[...e.querySelectorAll('input[type="password"]')].find(s=>re(s)&&s.value==="");(o&&o.compareDocumentPosition(r)&Node.DOCUMENT_POSITION_FOLLOWING?o:r).focus();return}(t("[autofocus]")??t(ct))?.focus()}function Oe(e){for(let t of e.querySelectorAll("dialog.sheet"))for(let n of t.querySelectorAll("[data-shown-when]")){let[r="",o=""]=(n.dataset.shownWhen??"").split("="),i=[...t.querySelectorAll("input")].find(s=>s.name===r&&s.checked);n.hidden=i?.value!==o}}function ft(){let e=new URL(location.href);e.searchParams.has("sheet")&&(e.searchParams.delete("sheet"),history.replaceState(history.state,"",`${e.pathname}${e.search}${e.hash}`))}function dt(e){if(Re.has(e))return;Re.add(e);let t=()=>Y.add(e);e.addEventListener("input",t),e.addEventListener("change",t),e.addEventListener("close",()=>{Y.delete(e),ft()})}function qe(e){let t=e.querySelectorAll("dialog.sheet");for(let n of t)dt(n);Ie.has(e)||(Ie.add(e),e.addEventListener("click",n=>{let r=n.target;if(!(r instanceof Element))return;let o=r.closest("[data-sheet-open]");if(o){let s=e.getElementById(o.dataset.sheetOpen??"");s instanceof HTMLDialogElement&&Me(s);return}let i=r.closest("[data-sheet-close]");if(i){i.closest("dialog")?.close();return}r instanceof HTMLDialogElement&&r.classList.contains("sheet")&&!Y.has(r)&&r.close()}),e.addEventListener("change",n=>{let r=n.target instanceof Element?n.target.closest("dialog.sheet"):null;r&&Oe(r.parentNode??e)})),Oe(e);for(let n of e.querySelectorAll("dialog.sheet[data-sheet-autoopen]"))ut(n)&&Y.add(n),Me(n)}var mt="global-search",ht="global-search-results",gt='input, textarea, select, [contenteditable]:not([contenteditable="false"])',ke=new WeakSet,oe=new WeakMap,q=e=>e.getElementById(mt),N=e=>e.getElementById(ht),se=e=>[...N(e)?.querySelectorAll('[role="option"]')??[]];function Pe(e){let t=N(e);return t!==null&&!t.hidden&&t.childElementCount>0}function z(e){return Pe(e)&&N(e)?.querySelector('[role="listbox"]')!=null}function J(e,t){let n=q(e);for(let r of se(e))r.setAttribute("aria-selected",String(r===t)),r.querySelector("a")?.classList.toggle("menu-active",r===t);n!==null&&(t===null?n.removeAttribute("aria-activedescendant"):n.setAttribute("aria-activedescendant",t.id))}function ae(e){let t=q(e)?.getAttribute("aria-activedescendant");return t==null?null:se(e).find(n=>n.id===t&&n.getAttribute("aria-selected")==="true")??null}function ie(e){let t=q(e);if(t===null)return;let n=N(e);oe.has(e)&&oe.get(e)!==n&&J(e,null),oe.set(e,n);let r=String(z(e));t.getAttribute("aria-expanded")!==r&&t.setAttribute("aria-expanded",r),t.hasAttribute("aria-activedescendant")&&ae(e)===null&&t.removeAttribute("aria-activedescendant")}function Fe(e){let t=N(e);t!==null&&(t.hidden=!0),J(e,null),ie(e)}function pt(e,t){let n=se(e);if(n.length===0||!z(e))return;let r=n.indexOf(ae(e)??(t===1?n[n.length-1]:n[0])),o=n[(r+t+n.length)%n.length]??null;J(e,o),o?.scrollIntoView?.({block:"nearest"})}function Et(e,t,n){switch(n.key){case"ArrowDown":case"ArrowUp":if(!z(e))return;n.preventDefault(),pt(e,n.key==="ArrowDown"?1:-1);return;case"Enter":{let r=ae(e)?.querySelector("a");if(!r||!z(e))return;n.preventDefault(),r.click();return}case"Escape":n.preventDefault(),t.value="",Fe(e);return}}function Ne(e){if(ie(e),ke.has(e))return;ke.add(e),e.addEventListener("keydown",n=>{let r=q(e);if(r===null)return;if(n.target===r){Et(e,r,n);return}if(n.key!=="/"||n.ctrlKey||n.metaKey||n.altKey)return;let o=e.activeElement;o instanceof Element&&o.closest(gt)!==null||(n.preventDefault(),r.focus())}),e.addEventListener("input",n=>{n.target===q(e)&&J(e,null)}),e.addEventListener("click",n=>{let r=q(e);if(r===null||!Pe(e))return;let o=r.form??r.parentElement;n.target instanceof Node&&o?.contains(n.target)||Fe(e)});let t=e.body??e.documentElement;new MutationObserver(()=>ie(e)).observe(t,{childList:!0,subtree:!0})}var le="inlay:place",G=e=>[...document.querySelectorAll(e)];function yt(e){let t=e.target;if(e.defaultPrevented||!(t instanceof HTMLFormElement)||t.method!=="post")return;let n={};for(let o of document.querySelectorAll("[data-keep-scroll]"))o.id!==""&&(n[o.id]=o.scrollTop);let r={path:location.pathname,y:window.scrollY,panes:n,open:G("details[data-item]").filter(o=>o.open).map(o=>o.dataset.item??""),closed:G("details[data-card]").filter(o=>!o.open).map(o=>o.dataset.card??"")};try{sessionStorage.setItem(le,JSON.stringify(r))}catch{}}function bt(){try{let e=sessionStorage.getItem(le);return sessionStorage.removeItem(le),e===null?null:JSON.parse(e)}catch{return null}}function vt(e){let t=new Set(e.open),n=new Set(e.closed);for(let r of G("details[data-item]"))t.has(r.dataset.item??"")&&(r.open=!0);for(let r of G("details[data-card]"))n.has(r.dataset.card??"")&&(r.open=!1);requestAnimationFrame(()=>{for(let[r,o]of Object.entries(e.panes)){let i=document.getElementById(r);i?.hasAttribute("data-keep-scroll")&&(i.scrollTop=o)}window.scrollTo(0,e.y)})}function xt(e){let t=()=>{e.classList.add("opacity-0"),setTimeout(()=>e.remove(),300)},n=Math.max(6e3,(e.textContent??"").length*80),r=setTimeout(t,n);e.addEventListener("pointerenter",()=>clearTimeout(r)),e.addEventListener("pointerleave",()=>{r=setTimeout(t,3e3)}),e.querySelector("[data-notice-dismiss]")?.addEventListener("click",()=>e.remove())}function St(e){let t=new URL(location.href);for(let n of(e.dataset.noticeQuery??"").split(" "))t.searchParams.delete(n);t.href!==location.href&&history.replaceState(history.state,"",t)}function Be(){let e=bt(),t=document.getElementById("admin-notice");t&&(xt(t),St(t),e&&e.path===location.pathname&&vt(e))}document.addEventListener("submit",yt);var Tt=new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}),wt=new Intl.DateTimeFormat(void 0,{dateStyle:"medium"}),ce=new Intl.RelativeTimeFormat(void 0,{numeric:"auto"}),Ve=6e4,fe=60*Ve,ue=24*fe;function At(e,t){let n=e.getTime()-t.getTime(),r=Math.abs(n);return r>=7*ue?wt.format(e):r<fe?ce.format(Math.round(n/Ve),"minute"):r<ue?ce.format(Math.round(n/fe),"hour"):ce.format(Math.round(n/ue),"day")}function de(e,t=new Date){for(let n of e.querySelectorAll("time[data-local]")){let r=new Date(n.dateTime);if(Number.isNaN(r.getTime()))continue;let o=Tt.format(r);n.hasAttribute("data-relative")?(n.textContent=At(r,t),n.title=o):n.textContent=o}}document.addEventListener("DOMContentLoaded",()=>{de(document),ee(document),te(document),Te(document),Ne(document),De(document),qe(document),Be(),we()});document.addEventListener("htmx:afterSwap",e=>{let t=e.target;de(t instanceof Element?t:document),ee(t instanceof Element?t:document),te(t instanceof Element?t:document)});
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { FastifyInstance, FastifyRequest } from 'fastify';
|
|
2
|
-
import type { Ctx, MediaInfo } from '../../../core/types.js';
|
|
2
|
+
import type { Ctx, MediaInfo, Redirect } from '../../../core/types.js';
|
|
3
|
+
import type { Core } from '../../../core/core.js';
|
|
3
4
|
import { type AdminContext } from '../context.js';
|
|
4
5
|
/** How many files one upload form may carry. */
|
|
5
6
|
export declare const MAX_FILES = 10;
|
|
@@ -16,5 +17,7 @@ export interface UploadOutcome {
|
|
|
16
17
|
* message in `problems`; the others are still stored.
|
|
17
18
|
*/
|
|
18
19
|
export declare function receiveUploads(request: FastifyRequest, ctx: AdminContext, as: Ctx): Promise<UploadOutcome>;
|
|
20
|
+
/** The redirects that send visitors to a media file, sorted by their address. */
|
|
21
|
+
export declare function mediaRedirects(core: Core, id: string, baseUrl: string): Promise<Redirect[]>;
|
|
19
22
|
/** The media library: a grid of uploaded files with search, a kind filter, paging and an upload form. */
|
|
20
23
|
export declare function registerMedia(scope: FastifyInstance, ctx: AdminContext): void;
|
|
@@ -74,6 +74,24 @@ const usageState = (u) => t(u.in === 'draft' ? 'admin.media.usage.draft' : u.in
|
|
|
74
74
|
function UsageList({ usages }) {
|
|
75
75
|
return (_jsx("ul", { class: "list-disc pl-6", children: usages.map((u) => (_jsxs("li", { children: [_jsx("a", { href: `/admin/documents/${encodeURIComponent(u.documentId)}`, class: "link", children: u.title }), ' ', "(", u.locale, ", ", usageState(u), ")"] }))) }));
|
|
76
76
|
}
|
|
77
|
+
const normalUrl = (url) => {
|
|
78
|
+
try {
|
|
79
|
+
return new URL(url).href;
|
|
80
|
+
}
|
|
81
|
+
catch {
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
/** The redirects that send visitors to a media file, sorted by their address. */
|
|
86
|
+
export async function mediaRedirects(core, id, baseUrl) {
|
|
87
|
+
const to = `/media/${id}`;
|
|
88
|
+
const full = normalUrl(`${baseUrl.replace(/\/+$/, '')}${to}`);
|
|
89
|
+
const hits = (r) => ('path' in r.to ? r.to.path === to : full !== null && 'url' in r.to && normalUrl(r.to.url) === full);
|
|
90
|
+
return (await core.listRedirects()).filter(hits).sort((a, b) => (a.from < b.from ? -1 : a.from > b.from ? 1 : 0));
|
|
91
|
+
}
|
|
92
|
+
function RedirectList({ redirects }) {
|
|
93
|
+
return (_jsx("ul", { class: "list-disc pl-6", children: redirects.map((r) => (_jsx("li", { children: _jsx("a", { href: "/admin/redirects", class: "link", children: _jsx("code", { children: r.from }) }) }))) }));
|
|
94
|
+
}
|
|
77
95
|
/** The media library: a grid of uploaded files with search, a kind filter, paging and an upload form. */
|
|
78
96
|
export function registerMedia(scope, ctx) {
|
|
79
97
|
const { core, uploads } = ctx;
|
|
@@ -117,7 +135,8 @@ export function registerMedia(scope, ctx) {
|
|
|
117
135
|
async function detail(reply, actor, media, opts = {}) {
|
|
118
136
|
const usages = opts.usages ?? (await core.findUsages({ kind: 'media', id: media.id }));
|
|
119
137
|
const id = encodeURIComponent(media.id);
|
|
120
|
-
const
|
|
138
|
+
const redirects = await mediaRedirects(core, media.id, ctx.baseUrl);
|
|
139
|
+
const body = (_jsxs("div", { class: "flex flex-col gap-8", children: [_jsx("div", { children: isRasterImage(media.mime) ? (_jsx("img", { src: `/media/${media.id}/960.webp`, alt: media.defaultAlt ?? '', class: "max-h-96 max-w-full" })) : (_jsx("a", { href: `/media/${id}`, class: "link", children: t('admin.media.download') })) }), _jsxs("dl", { class: "grid grid-cols-[max-content_1fr] gap-x-6 gap-y-1", children: [_jsx("dt", { class: "font-medium", children: t('admin.media.type') }), _jsx("dd", { children: typeLabel(media.mime) }), _jsx("dt", { class: "font-medium", children: t('admin.media.size') }), _jsx("dd", { children: formatSize(media.size) }), media.width !== null && media.height !== null && (_jsxs(_Fragment, { children: [_jsx("dt", { class: "font-medium", children: t('admin.media.dimensions') }), _jsx("dd", { children: t('admin.media.dimensionsValue', { width: media.width, height: media.height }) })] })), _jsx("dt", { class: "font-medium", children: t('admin.media.uploadedBy') }), _jsxs("dd", { children: [media.createdBy, ", ", _jsx(Time, { iso: media.createdAt })] })] }), _jsxs("div", { class: "flex flex-col gap-1", children: [_jsx("label", { for: "media-address", class: "text-sm font-medium", children: t('admin.media.address') }), _jsxs("div", { class: "flex gap-2", children: [_jsx("input", { id: "media-address", type: "text", readonly: true, value: `${ctx.baseUrl.replace(/\/+$/, '')}/media/${id}`, class: "input input-bordered w-full font-mono", "aria-describedby": "media-address-hint", autocomplete: "off" }), _jsx("button", { type: "button", class: "btn", "data-copy": "media-address", "data-copied": t('admin.copied'), "aria-live": "polite", children: t('admin.copy') })] }), _jsx("p", { id: "media-address-hint", class: "text-sm", children: t('admin.media.addressHint') })] }), _jsxs("form", { method: "post", action: `/admin/media/${id}/alt`, class: "flex flex-col gap-2", children: [_jsx("label", { for: "alt", class: "text-sm font-medium", children: t('admin.media.alt') }), _jsx("input", { id: "alt", name: "alt", type: "text", value: media.defaultAlt ?? '', class: "input input-bordered w-full", "aria-describedby": "alt-hint" }), _jsx("p", { id: "alt-hint", class: "text-sm", children: t('admin.media.altHint') }), _jsx("div", { children: _jsx("button", { type: "submit", class: "btn", children: t('admin.media.altSave') }) })] }), _jsxs("section", { "aria-labelledby": "usage-heading", class: "flex flex-col gap-2", children: [_jsx("h2", { id: "usage-heading", class: "text-lg font-semibold", children: t('admin.media.usageHeading') }), usages.length === 0 ? _jsx("p", { children: t('admin.media.unused') }) : _jsx(UsageList, { usages: usages })] }), _jsxs("section", { "aria-labelledby": "redirects-heading", class: "flex flex-col gap-2", children: [_jsx("h2", { id: "redirects-heading", class: "text-lg font-semibold", children: t('admin.media.redirectsHeading') }), redirects.length === 0 ? _jsx("p", { children: t('admin.media.redirectsNone') }) : _jsx(RedirectList, { redirects: redirects }), _jsx("p", { class: "text-sm", children: t('admin.media.redirectsHint') }), _jsx("div", { children: _jsx("a", { href: href('/admin/redirects', { sheet: 'add', to_path: `/media/${media.id}`, status: '302' }), class: "btn", children: t('admin.media.redirectsAdd') }) })] }), _jsx("div", { children: _jsx("a", { href: `/admin/media/${id}/delete`, class: "btn btn-error btn-outline", children: t('admin.media.delete') }) })] }));
|
|
121
140
|
return send(reply, 200, {
|
|
122
141
|
title: media.filename,
|
|
123
142
|
actor,
|
|
@@ -129,7 +148,8 @@ export function registerMedia(scope, ctx) {
|
|
|
129
148
|
async function confirmDelete(reply, status, actor, media, error) {
|
|
130
149
|
const usages = error?.details.usages ?? [];
|
|
131
150
|
const id = encodeURIComponent(media.id);
|
|
132
|
-
const
|
|
151
|
+
const redirects = await mediaRedirects(core, media.id, ctx.baseUrl);
|
|
152
|
+
const body = (_jsxs("div", { class: "flex flex-col gap-4", children: [error && (_jsx(Alert, { kind: "error", id: "delete-error", children: error.message })), usages.length > 0 && _jsx(UsageList, { usages: usages }), redirects.length > 0 && (_jsxs("div", { id: "delete-redirects", class: "flex flex-col gap-2", children: [_jsx("p", { children: t('admin.media.delete.redirects') }), _jsx(RedirectList, { redirects: redirects })] })), _jsx("p", { children: t('admin.media.delete.confirm', { filename: media.filename }) }), _jsxs("form", { method: "post", action: `/admin/media/${id}/delete`, class: "flex gap-4", children: [_jsx("button", { type: "submit", class: "btn btn-error", children: t('admin.media.delete.submit') }), _jsx("a", { href: `/admin/media/${id}`, class: "btn", children: t('admin.media.cancel') })] })] }));
|
|
133
153
|
return send(reply, status, {
|
|
134
154
|
title: t('admin.media.delete.title', { filename: media.filename }),
|
|
135
155
|
actor,
|
|
@@ -47,7 +47,9 @@ export function registerRedirects(scope, ctx) {
|
|
|
47
47
|
const to = 'path' in r.to ? r.to.path : 'url' in r.to ? r.to.url : (docs.get(r.to.document)?.title ?? '');
|
|
48
48
|
return [r.from, to, r.note ?? ''].some((s) => s.toLowerCase().includes(needle));
|
|
49
49
|
});
|
|
50
|
-
const
|
|
50
|
+
const asked = typeof query.to_path === 'string' ? query.to_path : '';
|
|
51
|
+
const seeded = { to_mode: 'path', ...(asked !== '' && { to_path: asked }), ...(query.status === '302' && { status: '302' }) };
|
|
52
|
+
const values = form.values ?? (sheets.add === undefined && (asked !== '' || query.status === '302') ? seeded : {});
|
|
51
53
|
const mode = values.to_mode === 'document' ? 'document' : 'path';
|
|
52
54
|
const chosen = values.to_document ? docs.get(values.to_document)?.title : undefined;
|
|
53
55
|
const picker = `/admin/pick/documents?${new URLSearchParams({ locale: core.registry.defaultLocale }).toString()}`;
|
|
@@ -23,6 +23,7 @@ import { t } from '../../core/messages/index.js';
|
|
|
23
23
|
import { formatReport } from '../../core/report.js';
|
|
24
24
|
import { buildRegistry } from '../../core/registry/registry.js';
|
|
25
25
|
import { generateKeyPair, publicKeyOf } from '../../core/release/keys.js';
|
|
26
|
+
import { publicClashes, publicClashMessage } from '../../core/release/public-files.js';
|
|
26
27
|
import { packRelease, releaseName } from '../../core/release/pack.js';
|
|
27
28
|
import { loadRelease } from '../../core/release/read.js';
|
|
28
29
|
import { loadConfig } from '../../config.js';
|
|
@@ -923,8 +924,9 @@ export async function runCli(argv, io) {
|
|
|
923
924
|
return printImportReport(io, await dryRunImport(config.site, resolve(io.cwd, rest[0] ?? '')), values.json);
|
|
924
925
|
}
|
|
925
926
|
if (command === 'check') {
|
|
927
|
+
let registry;
|
|
926
928
|
try {
|
|
927
|
-
buildRegistry(config.site);
|
|
929
|
+
registry = buildRegistry(config.site);
|
|
928
930
|
}
|
|
929
931
|
catch (e) {
|
|
930
932
|
if (!(e instanceof InlayError) || e.code !== 'definition')
|
|
@@ -940,6 +942,12 @@ export async function runCli(argv, io) {
|
|
|
940
942
|
report.problems.push(...problems);
|
|
941
943
|
report.ok = false;
|
|
942
944
|
}
|
|
945
|
+
if (existsSync(join(dir, 'public'))) {
|
|
946
|
+
for (const c of await publicClashes(join(dir, 'public'), registry)) {
|
|
947
|
+
report.problems.push({ code: 'public_clash', message: publicClashMessage(c) });
|
|
948
|
+
report.ok = false;
|
|
949
|
+
}
|
|
950
|
+
}
|
|
943
951
|
if (values.json)
|
|
944
952
|
io.out(JSON.stringify(report, null, 2));
|
|
945
953
|
else
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { McpServer } from '@modelcontextprotocol/server';
|
|
2
2
|
import type { Ctx } from '../../../core/types.js';
|
|
3
3
|
import type { McpDeps } from '../server.js';
|
|
4
|
-
/** `describe_site`, `describe_type`, `get_document`, `search_entries` and `list_gaps`. */
|
|
4
|
+
/** `describe_site`, `describe_type`, `get_document`, `search_entries`, `find_text` and `list_gaps`. */
|
|
5
5
|
export declare function register(server: McpServer, deps: McpDeps, _ctx: Ctx): void;
|