From 26d23de15da5711aea79f06d0c9754a93a0ca80b Mon Sep 17 00:00:00 2001 From: "Daniel J. Summers" Date: Sat, 13 Jun 2026 17:37:10 -0400 Subject: [PATCH] Add htmax bundle; update package info --- src/Common/Common.fs | 5 ++++- src/Common/wwwroot/htmax.min.js | 1 + src/Common/wwwroot/htmx.min.js | 2 +- src/Directory.Build.props | 12 ++++++++---- src/Tests/Common.fs | 2 +- src/Tests/ViewEngine.fs | 25 +++++++++++++++++++++++-- src/ViewEngine.Htmx/Htmx.fs | 25 +++++++++++++++++++++---- 7 files changed, 59 insertions(+), 13 deletions(-) create mode 100644 src/Common/wwwroot/htmax.min.js diff --git a/src/Common/Common.fs b/src/Common/Common.fs index 854d0b7..aaaa3e6 100644 --- a/src/Common/Common.fs +++ b/src/Common/Common.fs @@ -3,11 +3,14 @@ module Giraffe.Htmx.Common /// The version of htmx embedded in the package -let HtmxVersion = "4.0.0-alpha8" +let HtmxVersion = "4.0.0-beta4" /// The path for the provided htmx script let internal htmxLocalScript = $"/_content/Giraffe.Htmx.Common/htmx.min.js?ver={HtmxVersion}" +/// The path for the provided htmax script +let internal htmaxLocalScript = $"/_content/Giraffe.Htmx.Common/htmax.min.js?ver={HtmxVersion}" + /// Serialize a list of key/value pairs to JSON (very rudimentary) /// The key/value pairs to be serialized to JSON /// A string with the key/value pairs serialized to JSON diff --git a/src/Common/wwwroot/htmax.min.js b/src/Common/wwwroot/htmax.min.js new file mode 100644 index 0000000..6f1b8d2 --- /dev/null +++ b/src/Common/wwwroot/htmax.min.js @@ -0,0 +1 @@ +var htmx=(()=>{class e{#e=null;#t=[];issue(e,t){return e.queueStrategy=t,this.#e?"replace"===t||"abort"!==t&&"abort"===this.#e.queueStrategy?(this.#t.forEach(e=>e.status="dropped"),this.#t=[],this.#e.request?.abort?.(),this.#e=e,!0):("queue all"===t?(this.#t.push(e),e.status="queued"):"drop"===t?e.status="dropped":"queue last"===t?(this.#t.forEach(e=>e.status="dropped"),this.#t=[e],e.status="queued"):0===this.#t.length&&"abort"!==t?(this.#t.push(e),e.status="queued"):e.status="dropped",!1):(this.#e=e,!0)}finish(){this.#e=null}next(){return this.#t.shift()}abort(){this.#e?.request?.abort?.()}more(){return this.#t?.length}}return new class{#r=new Map;#i="";#n=new Set;#s;#o=Function;#a=Object.getPrototypeOf(async function(){}).constructor;#l={createHTML:e=>e,createScript:e=>e};#c;#h="a,form";#u=["get","post","put","patch","delete"];#d;#m;#f;#p;constructor(){this.#g(),this.#x(),this.#c=this.#b("[hx-action],[hx-get],[hx-post],[hx-put],[hx-patch],[hx-delete]"),this.#d=(new XPathEvaluator).createExpression(`.//*[@*[${this.#y("hx-on").map(e=>`starts-with(name(), "${e}")`).join(" or ")}]]`),this.#s={attributeValue:this.#v.bind(this),parseTriggerSpecs:this.#w.bind(this),determineMethodAndAction:this.#E.bind(this),createRequestContext:this.#S.bind(this),collectFormData:this.#C.bind(this),getAttributeObject:this.#q.bind(this),insertContent:this.#A.bind(this),morph:this.#T.bind(this),isSoftMatch:this.#H.bind(this),initSecurity:(e,t,r)=>{e&&(this.#l=e),t&&(this.#o=t),r&&(this.#a=r)},onTrigger:this.#k.bind(this),htmxProp:this.#M.bind(this),triggerHtmxEvent:this.#N.bind(this),executeJavaScript:this.#_.bind(this)};let e=()=>{this.#I(),this.process(document.body)};"loading"===document.readyState?document.addEventListener("DOMContentLoaded",e):setTimeout(e)}#g(){this.version="4.0.0-beta4",this.config={logAll:!1,prefix:"data-hx-",transitions:!1,history:!0,mode:"same-origin",defaultSwap:"innerHTML",defaultFocusScroll:!1,indicatorClass:"htmx-indicator",requestClass:"htmx-request",includeIndicatorCSS:!0,defaultTimeout:6e4,extensions:"",morphIgnore:["data-htmx-powered"],morphScanLimit:10,noSwap:[204,304],implicitInheritance:!1,defaultSettleDelay:1};let e=document.querySelector('meta[name="htmx-config"]');e&&this.#L(e.content,this.config),this.#i=this.config.extensions}#x(){if(!1!==this.config.includeIndicatorCSS){let e=this.config.indicatorClass,t=this.config.requestClass,r=new CSSStyleSheet;r.replaceSync(`.${e}{opacity:0;visibility: hidden} .${t} .${e}, .${t}.${e}{opacity:1;visibility: visible;transition: opacity 200ms ease-in}`),document.adoptedStyleSheets=[...document.adoptedStyleSheets,r]}}registerExtension(e,t){return!(this.#i&&!this.#i.split(/,\s*/).includes(e))&&(!this.#n.has(e)&&(this.#n.add(e),t.init&&t.init(this.#s),void Object.entries(t).forEach(([e,t])=>{this.#r.get(e)?.push(t)||this.#r.set(e,[t])})))}#O(e){let t=this.config.prefix;return!e.closest||null!=e.closest("[hx-ignore]")||t&&null!=e.closest(`[${t}ignore]`)}#R(e,t){let r=this.config.prefix;return e.getAttribute(t)??(r?e.getAttribute(t.replace("hx-",r)):null)}#D(e,t){let r=this.config.prefix&&t.replace("hx-",this.config.prefix);return e.hasAttribute(t)?t:r&&e.hasAttribute(r)?r:null}#b(e){return this.#y(e).join(",")}#y(e){let t=[e];return this.config.prefix&&t.push(e.replaceAll("hx-",this.config.prefix)),t}#P(e,t){let r=[...e.querySelectorAll?.(t)??[]];return e.matches?.(t)&&r.unshift(e),r}#j(e){return"before"===e?"beforebegin":"after"===e?"afterend":"prepend"===e?"afterbegin":"append"===e?"beforeend":e}#V(e,t){let r=[];return this.#v(e,t,void 0,(e,t)=>{e?.split(/\s*[,:]\s*/).includes("this")&&r.push(t)}),r}#v(e,t,r,i){t=this.#F(t);let n=this.#F(":inherited"),s=this.#F(":append"),o=this.#R(e,t)??this.#R(e,t+n);if(null!=o)return i?i(o,e):o;let a=CSS.escape(this.config.implicitInheritance?t:t+n),l=CSS.escape(t+n+s),c=this.#b(`[${a}],[${l}]`),h=this.#D(e,t+s)??this.#D(e,t+n+s);if(h){let r=e.getAttribute(h),n=e.parentNode?.closest?.(c);if(i&&i(r,e),n){let e=this.#v(n,t,void 0,i);return e?(e+","+r).replace(/[{}]/g,""):r}return r}let u=e.parentNode?.closest?.(c);return u?(o=this.#v(u,t,void 0,i),!i&&o&&this.config.implicitInheritance&&this.#B(e,"htmx:after:implicitInheritance",{elt:e,name:t,parent:u}),o):r}#W(e){if(!e)return{};if("{"===e[0])return JSON.parse(e);return[...e.matchAll(/(?:"([^"]+)"|([^\s,:]+))(?:\s*:\s*(?:"([^"]*)"|'([^']*)'|<([^>]+)\/>|([^\s,]+)))?(?=\s|,|$)/g)].reduce((e,t)=>{let r=(t[1]??t[2]).split("."),i=(t[3]??t[4]??t[5]??t[6]??"true").trim();return"true"===i?i=!0:"false"===i?i=!1:/^\d+$/.test(i)&&(i=parseInt(i)),r.some(e=>this.#$(e))||(r.slice(0,-1).reduce((e,t)=>e[t]??={},e)[r.at(-1)]=i),e},{})}#$(e){return"#proto#"===e||"constructor"===e||"prototype"===e}#L(e,t){let r=this.#W(e);for(let e in r){if(this.#$(e))continue;let i=r[e];i&&"object"==typeof i&&!Array.isArray(i)&&t[e]?Object.assign(t[e],i):t[e]=i}return t}#w(e){return e.split(/,(?![^\[]*\])/).flatMap(e=>{let[,t,r]=e.match(/^\s*(\S+\[[^\]]*\]|\S+)\s*(.*?)\s*$/)??[];if(!t)return[];if(/\[[^\]]*$/.test(t))throw"unterminated:"+t;return[{name:t,...this.#W(r)}]})}#E(e,t){if(this.#U(e))return this.#z(e,t);{let t=this.#v(e,"hx-method")||"GET",r=this.#v(e,"hx-action");if(!r)for(let i of this.#u){let n=this.#v(e,"hx-"+i);if(null!=n){r=n,t=i;break}}return t=t.toUpperCase(),{action:r,method:t}}}#z(e,t){if(e.matches("a"))return{action:e.getAttribute("href"),method:"GET"};return{action:t.submitter?.getAttribute?.("formAction")||e.getAttribute("action"),method:(t.submitter?.getAttribute?.("formMethod")||e.getAttribute("method")||"GET").toUpperCase()}}#M(e){return e._htmx||(e._htmx={listeners:[],triggerSpecs:[]},e.setAttribute("data-htmx-powered","true")),e._htmx}#J(e){if(this.#Q(e)&&this.#N(e,"htmx:before:init",{},!0)){let t=this.#M(e);t.initialized=!0,t.eventHandler=this.#G(e),this.#X(e),this.#K(e),this.#N(e,"htmx:after:init",{},!0)}}#G(e){return async t=>{try{let r=this.#S(e,t);await this.#Y(r)}catch(t){this.#N(e,"htmx:error",{error:t})}}}#S(e,t){let{action:r,method:i}=this.#E(e,t),[n,s]=(r||"").split("#"),o=new AbortController,a={sourceElement:e,sourceEvent:t,status:"created",select:this.#v(e,"hx-select"),selectOOB:this.#v(e,"hx-select-oob"),target:this.#v(e,"hx-target"),swap:this.#v(e,"hx-swap")??this.config.defaultSwap,push:this.#v(e,"hx-push-url"),replace:this.#v(e,"hx-replace-url"),transition:this.config.transitions,confirm:this.#v(e,"hx-confirm"),request:{validate:"true"===this.#v(e,"hx-validate",!e.matches("form")||e.noValidate||t.submitter?.formNoValidate?"false":"true"),action:n,anchor:s,method:i,headers:this.#Z(e),abort:o.abort.bind(o),credentials:"same-origin",signal:o.signal,mode:this.config.mode}};e._htmx?.boosted&&this.#L(e._htmx.boosted,a),a.target=this.#ee(e,a.target),a.request.headers["HX-Request-Type"]=a.target===document.body||a.select?"full":"partial",a.target&&(a.request.headers["HX-Target"]=this.#te(a.target));let l=this.#v(e,"hx-config");return l&&(this.#L(l,a.request),a.request.mode=this.config.mode),a}#te(e){return`${e.tagName.toLowerCase()}${e.id?"#"+encodeURI(e.id):""}`}#Z(e){let t={"HX-Request":"true","HX-Source":this.#te(e),"HX-Current-URL":location.href,Accept:"text/html"};return this.#U(e)&&(t["HX-Boosted"]="true"),t}#re(e,t){return this.#q(e,"hx-headers",e=>{for(let r in e)t[r]=String(e[r])})}#ee(e,t){return t instanceof Element?t:null!=t?this.#ie(e,t,"hx-target"):this.#U(e)?document.body:e}#U(e){return e?._htmx?.boosted}async#Y(e){let t=e.sourceElement,r=e.sourceEvent;if(!t.isConnected)return;if(this.#ne(r))return;this.#se(r)&&r.preventDefault();let i=/GET|DELETE/.test(e.request.method),n=i?t.matches("form")?t:null:t.form||t.closest("form"),s=this.#C(t,n,r.submitter,e.request.validate,i);if(!s)return;let o=this.#q(t,"hx-vals",t=>{e.vals=t;for(let e in t)s.set(e,t[e])});if(o&&await o,e.values)for(let t in e.values)s.delete(t),s.append(t,e.values[t]);let a=this.#re(t,e.request.headers);if(a&&await a,Object.assign(e.request,{form:n,submitter:r.submitter,body:s}),!this.#N(t,"htmx:config:request",{ctx:e}))return;if(!this.#u.includes(e.request.method.toLowerCase()))return;let l=this.#oe(e.request.action);if(null!=l){let t=Object.fromEntries(e.request.body);return void await this.#_(e.sourceElement,t,l,!1)}if(i){let t=new URL(e.request.action,document.baseURI);for(let r of e.request.body.keys())t.searchParams.delete(r);for(let[r,i]of e.request.body)t.searchParams.append(r,i);t.origin===location.origin?e.request.action=t.pathname+t.search:e.request.action=t.href,e.request.body=null}else"multipart/form-data"!==this.#v(t,"hx-encoding")&&(e.request.body=new URLSearchParams(e.request.body));await this.#ae(e)}async#ae(e){let t=e.sourceElement,r=this.#le(t),i=this.#ce(t);if(!i.issue(e,r))return;e.status="issuing";let n=[],s=[];try{if(e.confirm){if(!await new Promise(r=>{let i={ctx:e,issueRequest:()=>r(!0),dropRequest:()=>r(!1)};if(this.#N(t,"htmx:confirm",i)){let i=this.#oe(e.confirm);r(i?this.#_(t,{},i,!0):window.confirm(e.confirm))}}))return}if(this.#he(e),n=this.#ue(t),s=this.#de(t),e.fetch||=window.fetch.bind(window),!this.#N(t,"htmx:before:request",{ctx:e}))return;let r=await e.fetch(e.request.action,e.request);if(e.response={raw:r,status:r.status,headers:r.headers},this.#me(e),!this.#N(t,"htmx:before:response",{ctx:e}))return;if(e.text=await r.text(),!this.#N(t,"htmx:after:request",{ctx:e}))return;if(e.response.status>=400&&this.#N(t,"htmx:response:error",{ctx:e}),this.#fe(e))return void(e.keepIndicators=!0);"issuing"===e.status&&(e.hx.retarget&&(e.target=e.hx.retarget),e.hx.reswap&&(e.swap=e.hx.reswap),e.hx.reselect&&(e.select=e.hx.reselect),e.status="response received",this.#pe(e),await this.swap(e),e.status="swapped")}catch(r){e.status="error: "+r,this.#N(t,"htmx:error",{ctx:e,error:r})}finally{clearTimeout(e.requestTimeout),this.#N(t,"htmx:finally:request",{ctx:e}),e.keepIndicators||(this.#ge(n),this.#xe(s)),i.finish(),i.more()&&this.#ae(i.next())}}#me(e){e.hx={};for(let[t,r]of e.response.raw.headers)t.toLowerCase().startsWith("hx-")&&(e.hx[t.slice(3).toLowerCase().replace(/-/g,"")]=r)}#fe(e){if(e.hx.trigger&&this.#be(e.hx.trigger,e.sourceElement),"true"===e.hx.refresh)return location.reload(),!0;if(e.hx.redirect)return location.href=e.hx.redirect,!0;if(e.hx.location){let t=e.hx.location,r={};return("{"===t[0]||/[\s,]/.test(t))&&(r=this.#W(t),t=r.path,delete r.path),r.push??="true",this.ajax("GET",t,r),!0}}#he(e){let t=null!=e.request.timeout?this.parseInterval(e.request.timeout):this.config.defaultTimeout;t&&(e.requestTimeout=setTimeout(()=>e.request?.abort?.(),t))}#le(e){let t=this.#v(e,"hx-sync");if(!t)return"queue first";let r=t.split(":").pop().trim();return/^(drop|abort|replace|queue)/.test(r)?r:"queue first"}#ce(t){let r=this.#v(t,"hx-sync"),i=t;if(r){let e=r.includes(":")?r.slice(0,r.lastIndexOf(":")).trim():/^(drop|abort|replace|queue)/.test(r)?null:r;e&&(i=this.#ie(t,e,"hx-sync")||t)}return this.#M(i).rq||=new e}#ne(e){return"click"===e.type&&(e.ctrlKey||e.metaKey||e.shiftKey)}#se(e){let t=e.currentTarget;if("submit"===e.type&&"FORM"===t?.tagName)return!0;if(!("click"===e.type&&0===e.button))return!1;let r=t?.closest?.('button, input[type="submit"], input[type="image"]'),i=r?.form||r?.closest("form");if(r&&!r.disabled&&i&&("submit"===r.type||"image"===r.type||!r.type&&"BUTTON"===r.tagName))return!0;let n=t?.closest?.("a");if(!n||!n.href)return!1;let s=n.getAttribute("href");return!(s&&s.startsWith("#")&&s.length>1)}#X(e,t=e._htmx.eventHandler){let r=this.#v(e,"hx-trigger");r||(r=e.matches("form")?"submit":e.matches("input:not([type=button]):not([type=submit]),select,textarea")?"change":"click"),this.#k(e,r,t)}#k(e,t,r){let i=this.#w(t);this.#M(e).triggerSpecs.push(...i);for(let t of i){t.listeners=[];let[i,n]=this.#ye(t.name),s=[e];"outside"===t.from?s=[document]:t.from&&"self"!==t.from&&(s=this.#ve(e,t.from));let o=e=>{if((t.halt||t.prevent)&&e.preventDefault(),(t.halt||t.stop||t.consume)&&e.stopPropagation(),t.once)for(let e of t.listeners)e.fromElt.removeEventListener(e.eventName,e.handler,e);r(e)},a=o;if(t.delay?a=e=>{clearTimeout(t.timeout),t.timeout=setTimeout(()=>o(e),this.parseInterval(t.delay))}:t.throttle&&(a=e=>{t.throttled?t.throttledEvent=e:(t.throttled=!0,o(e),t.throttleTimeout=setTimeout(()=>{if(t.throttled=!1,t.throttledEvent){let e=t.throttledEvent;t.throttledEvent=null,a(e)}},this.parseInterval(t.throttle)))}),t.handler=r=>{if(("self"!==t.from||r.target===e)&&("outside"!==t.from||!e.contains(r.target))&&(!t.target||r.target?.matches?.(t.target))){if(t.changed){let e=t.values??=new WeakMap,r=!1;for(let t of s)e.get(t)!==t.value&&(r=!0,e.set(t,t.value));if(!r)return}if(n){this.#se(r)&&r.preventDefault();let t={};for(let e in r)t[e]=r[e];if(!this.#_(e,t,n,!0,!1))return}a(r)}},"intersect"===i||"revealed"===i){let r={rootMargin:t.rootMargin};t.root&&(r.root=this.#ie(e,t.root)),t.threshold&&(r.threshold=parseFloat(t.threshold));let n="revealed"===i;t.observer=new IntersectionObserver(r=>{for(let i=0;i"name"!==e);t.interval=setInterval(()=>{e.isConnected?this.#N(e,"every",{},!1):clearInterval(t.interval)},this.parseInterval(r))}if("load"!==i)for(let r of s){let n={fromElt:r,eventName:i,handler:t.handler,capture:!!t.capture,passive:!!t.passive};e._htmx.listeners.push(n),t.listeners.push(n),r.addEventListener(i,t.handler,n)}else t.handler(new CustomEvent("load"))}}#ye(e){let t=e.match(/^([^\[]*)\[([^\]]*)]/);return t?[t[1],t[2]]:[e,null]}#be(e,t){if("{"===e[0]){let r=this.#W(e);for(let e in r){let i=r[e],n=t;i?.target&&(n=this.find(i.target)),this.trigger(n,e,"object"==typeof i?i:{value:i})}}else e.split(",").forEach(e=>this.trigger(t,e.trim(),{}))}#we(e){let t={},r=Object.getPrototypeOf(this);for(let i of Object.getOwnPropertyNames(r))"constructor"!==i&&"function"==typeof this[i]&&(["find","findAll"].includes(i)?t[i]=(t,r)=>void 0===r?this[i](e,t):this[i](t,r):t[i]=this[i].bind(this));return t}#_(e,t,r,i=!0,n=!0){let s={};Object.assign(s,this.#we(e));let o={};this.#B(e,"htmx:scope",{scope:o}),Object.assign(s,o),Object.assign(s,t);let a=Object.keys(s),l=Object.values(s);return new(n?this.#a:this.#o)(...a,i?`return (${r})`:r).call(e,...l)}process(e){if(!e)return;if(!(e instanceof Element)){for(let t of e.children||[])this.process(t);return}if(this.#O(e))return;if(!this.#N(e,"htmx:before:process"))return;let t=[e],r=this.#d.evaluate(e),i=null;for(;i=r.iterateNext();)t.push(i);for(let e of t)!this.#O(e)&&this.#N(e,"htmx:before:on:init",{},!0)&&this.#Ee(e);for(let t of this.#P(e,this.#c))this.#J(t);for(let t of this.#P(e,this.#h))this.#Se(t);this.#N(e,"htmx:after:process")}#Se(e){let t=this.#v(e,"hx-boost");if(t&&"false"!==t&&this.#Ce(e)&&this.#N(e,"htmx:before:init",{},!0)){let r=this.#M(e);r.initialized=!0,r.eventHandler=this.#G(e),r.boosted=t;let i=e.matches("a")?"click":"submit";e._htmx.listeners.push({fromElt:e,eventName:i,handler:e._htmx.eventHandler}),e.addEventListener(i,e._htmx.eventHandler),this.#N(e,"htmx:after:init",{},!0)}}#Ce(e){if(this.#Q(e))if("A"===e.tagName){if(""===e.target||"_self"===e.target)return!e.getAttribute("href")?.startsWith?.("#")&&this.#qe(e.href)}else if("FORM"===e.tagName)return"dialog"!==e.method&&this.#qe(e.action)}#qe(e){try{return new URL(e,window.location.href).origin===window.location.origin}catch(e){return!1}}#Q(e){return!e._htmx?.initialized&&!this.#O(e)}#Ae(e){if(e._htmx){this.#N(e,"htmx:before:cleanup");for(let t of e._htmx.triggerSpecs||[])t.interval&&clearInterval(t.interval),t.timeout&&clearTimeout(t.timeout),t.throttleTimeout&&clearTimeout(t.throttleTimeout),t.observer?.disconnect();for(let t of e._htmx.listeners||[])t.fromElt.removeEventListener(t.eventName,t.handler,t);this.#N(e,"htmx:after:cleanup")}if(e.firstChild)for(let t of e.querySelectorAll("[data-htmx-powered]"))this.#Ae(t)}#Te(e){let t=document.createElement("div");t.hidden=!0,document.body.insertAdjacentElement("afterend",t);let r=e.querySelectorAll?.(this.#b("[hx-preserve]"))||[];for(let e of r){let r=document.getElementById(e.id);r&&this.#He(t,r,null)}return t}#ke(e){for(let t of[...e.children]){let e=document.getElementById(t.id);e&&(this.#He(e.parentNode,t,e),this.#Ae(e),e.remove())}e.remove()}#Me(e){let t=this.#l.createHTML(e);return Document.parseHTMLUnsafe?.(t)||(new DOMParser).parseFromString(t,"text/html")}#Ne(e){let t=e.replace(/)/gi,'"),r="";t=t.replace(/]*)?>[\s\S]*?<\/head>/i,e=>(r=this.#Me(e).title,""));let i,n,s=t.match(/<([a-z][^\/>\x20\t\r\n\f]*)/i)?.[1]?.toLowerCase();if("html"===s||"body"===s?(i=this.#Me(t),n=document.createDocumentFragment(),n.append(i.body)):(i=this.#Me(``),n=i.querySelector("template").content),!r){let e=n.querySelector("title:not(svg title)");e&&(r=e.textContent,e.remove())}return this.#_e(n),{fragment:n,title:r}}#Ie(e,t,r,i){let n=t.id?"#"+CSS.escape(t.id):null;"true"!==r&&r&&!r.includes(" ")&&([r,n=n]=r.split(/:(.*)/)),"true"!==r&&r||(r="outerHTML");let s=this.#Le(r);if(n=s.target||n,s.strip??=!s.style.startsWith("outer"),!n)return;let o=[...document.querySelectorAll(n)];for(let r of o){let n=document.createDocumentFragment();n.append(t.cloneNode(!0)),e.push({type:"oob",fragment:n,target:r,swapSpec:s,sourceElement:i})}t.remove()}#Oe(e,t,r){let i=[];if(r)for(let n of r.split(",")){let[r,s="true"]=n.split(/:(.*)/);for(let n of e.querySelectorAll(r))this.#Ie(i,n,s,t)}for(let r of e.querySelectorAll(this.#b("[hx-swap-oob]"))){let e=this.#D(r,"hx-swap-oob"),n=r.getAttribute(e);r.removeAttribute(e),this.#Ie(i,r,n,t)}return i}#Re(e,t,r){t?t.before(...r.childNodes):e.append(...r.childNodes)}#Le(e){e=e.trim();let t=this.config.defaultSwap;if(e&&!/^\S*:/.test(e)){let r=e.match(/^(\S+)\s*(.*)$/);t=r[1],e=r[2]}return{style:this.#j(t),...this.#W(e)}}#De(e,t){let r=[];for(let i of e.querySelectorAll("template[hx]")){let e=i.getAttribute("type");if("partial"===e){let e=this.#R(i,"hx-target")||(i.id?"#"+CSS.escape(i.id):null);if(e){this.#_e(i.content);let n=this.#Le(this.#R(i,"hx-swap")||this.config.defaultSwap);for(let s of document.querySelectorAll(e))r.push({type:"partial",fragment:i.content.cloneNode(!0),target:s,swapSpec:n,sourceElement:t.sourceElement})}}else this.#B(i,"htmx:process:"+e,{ctx:t,tasks:r});i.remove()}return r}#Pe(e,t,r,i){try{null!=r&&e.setSelectionRange&&e.setSelectionRange(r,i),e.focus(t)}catch(e){}}#je(e){let t=this.#P(e,"[autofocus]")[0];t&&this.#Pe(t)}#Ve(e,t){if(e.scroll){let r=e.scrollTarget?this.#Fe(e.scrollTarget):t;r&&("top"===e.scroll?r.scrollTop=0:"bottom"===e.scroll&&(r.scrollTop=r.scrollHeight))}if("top"===e.show||"bottom"===e.show){let r=e.showTarget?this.#Fe(e.showTarget):t;r?.scrollIntoView("top"===e.show)}}#Be(e){e.request?.anchor&&document.getElementById(e.request.anchor)?.scrollIntoView({block:"start",behavior:"auto"})}#_e(e){let t=this.#P(e,"script");for(let e of t){let t=document.createElement("script");for(let r of e.attributes)t.setAttribute(r.name,r.value);this.config.inlineScriptNonce&&(t.nonce=this.config.inlineScriptNonce),t.textContent=this.#l.createScript(e.textContent),e.replaceWith(t)}}async swap(e){try{this.#We(e);let{fragment:t,title:r}=this.#Ne(e.text);e.title=r;let i=[],n=this.#Oe(t,e.sourceElement,e.selectOOB),s=this.#De(t,e);i.push(...n,...s);let o=this.#$e(e,t,s);if(o&&i.unshift(o),!this.#N(e.sourceElement,"htmx:before:swap",{ctx:e,tasks:i}))return;let a=[],l=[];for(let t of i)t.swapSpec?.transition??o?.transition??e.transition?l.push(t):a.push(this.#A(t));if(l.length>0){let e=async()=>{for(let e of l)await this.#A(e,!1)};a.push(this.#Ue(e))}await Promise.all(a),this.#N(e.sourceElement,"htmx:after:swap",{ctx:e}),e.title&&!o?.swapSpec?.ignoreTitle&&(document.title=e.title),this.#Be(e)}finally{this.#N(e.sourceElement,"htmx:swap:finally",{ctx:e})}}#$e(e,t,r){let i=this.#Le(e.swap||this.config.defaultSwap);if("delete"===i.style||t.childElementCount>0||/\S/.test(t.textContent)||!r.length){if(e.select){let r=t.querySelectorAll(e.select);(t=document.createDocumentFragment()).append(...r)}return this.#U(e.sourceElement)&&(i.show||="top"),{type:"main",fragment:t,target:this.#ee(e.sourceElement||document.body,i.target||e.target),swapSpec:i,sourceElement:e.sourceElement,transition:e.transition&&!1!==i.transition}}}async#A(e,t=!0){let{target:r,swapSpec:i,fragment:n}=e;if("string"==typeof r&&(r=document.querySelector(r)),!r)return;"string"==typeof i&&(i=this.#Le(i));let s,o=i.style;if("none"===o)return;if("BODY"===n.firstElementChild?.tagName&&("outerHTML"===o?o="outerSync":o.startsWith("outer")||(i.strip=!0)),i.strip&&n.firstElementChild&&(n=document.createDocumentFragment(),n.append(...(e.fragment.firstElementChild.content||e.fragment.firstElementChild).childNodes)),this.#ze(r,"htmx-swapping"),t&&e.swapSpec?.swap&&await this.timeout(e.swapSpec?.swap),"delete"===o)return void(r.parentNode&&(this.#Ae(r),r.parentNode.removeChild(r)));let a=[],l=i.settle??this.config.defaultSettleDelay,c=r.parentNode;if("innerHTML"===o||"outerHTML"===o&&c){let e=document.activeElement;if(e?.id){let t,r;try{t=e.selectionStart,r=e.selectionEnd}catch(e){}s={elt:e,start:t,end:r}}a=t&&l?this.#Je(n,r):[]}let h=this.#Te(n),u=[...n.childNodes];try{if("innerHTML"===o){for(const e of r.children)this.#Ae(e);r.replaceChildren(...n.childNodes)}else if("textContent"===o){for(const e of r.querySelectorAll("[data-htmx-powered]"))this.#Ae(e);r.textContent=n.textContent}else if("outerHTML"===o)c&&(this.#Re(c,r,n),this.#Ae(r),c.removeChild(r),r=u[0]||c);else if("outerSync"===o)this.#Qe(r,n.firstElementChild),this.#Ae(r),delete r._htmx,r.replaceChildren(...n.firstElementChild.childNodes),u=[r];else if("innerMorph"===o)this.#T(r,n,!0),u=[...r.childNodes];else if("outerMorph"===o)this.#T(r,n,!1),u.push(r);else if("beforebegin"===o)c&&this.#Re(c,r,n);else if("afterbegin"===o)this.#Re(r,r.firstChild,n);else if("beforeend"===o)this.#Re(r,null,n);else if("afterend"===o)c&&this.#Re(c,r.nextSibling,n);else{let e=this.#r.get("handle_swap")||[],t=!1;for(const s of e){let e=s(o,r,n,i);if(e){t=!0,Array.isArray(e)&&(u=e);break}}if(!t)throw new Error(`Unknown swap style: ${o}`)}}finally{this.#Ge(r,"htmx-swapping")}if(this.#ke(h),s&&!s.elt.matches(":focus")){let e=document.getElementById(s.elt.id);if(e){let t={preventScroll:void 0!==i.focusScroll?!i.focusScroll:!this.config.defaultFocusScroll};this.#Pe(e,t,s.start,s.end)}}this.#N(r,"htmx:before:settle",{task:e,newContent:u,settleTasks:a});for(const e of u)this.#ze(e,"htmx-added");if(t&&a.length>0){this.#ze(r,"htmx-settling"),await this.timeout(l);for(let e of a)e();this.#Ge(r,"htmx-settling")}this.#N(r,"htmx:after:settle",{task:e,newContent:u,settleTasks:a});for(const e of u)this.#Ge(e,"htmx-added"),this.process(e),this.#je(e);this.#Ve(i,r)}#N(e,t,r={},i=!0){if(r.error){let i=`htmx: ${t}: ${r.error.message??r.error}`;r.error instanceof Error?console.error(i,r.error,{elt:e,detail:r}):console.error(i,{elt:e,detail:r})}else r.warn?console.warn(`htmx: ${t}: ${r.warn}`,{elt:e,detail:r}):this.config.logAll&&console.log(`htmx: ${t}`,{elt:e,detail:r});return e=this.#Xe(e),this.#B(e,t,r),this.trigger(e,this.#F(t),r,i)}#B(e,t,r={}){let i=this.#r.get(t.replace(/:/g,"_"));if(i){r.cancelled=!1;for(const t of i)if(!1===t(e,r)||r.cancelled)return r.cancelled=!0,!1}return!0}timeout(e){if((e=this.parseInterval(e))>0)return new Promise(t=>setTimeout(t,e))}onLoad(e){this.on(this.#F("htmx:after:process"),t=>{e(t.target)})}on(e,t,r){let i,n=document;return void 0===r?(i=e,r=t):(n=this.#Xe(e),i=t),n.addEventListener(i,r),r}find(e,t){return this.#Fe(e,t)}findAll(e,t){return this.#ve(e,t)}parseInterval(e){if("number"==typeof e)return e;let[,t,r]=e?.match(/^([\d.]+)(ms|s|m)?$/)||[],i=parseFloat(t)*({ms:1,s:1e3,m:6e4}[r]||1);return isNaN(i)?void 0:i}trigger(e,t,r={},i=!0){e=this.#Xe(e);let n=new CustomEvent(t,{detail:r,cancelable:!0,bubbles:i,composed:!0}),s=e?.isConnected?e:document;return!r.cancelled&&s.dispatchEvent(n)}ajax(e,t,r){(!r||r instanceof Element||"string"==typeof r)&&(r={target:r});let i="string"==typeof r.source?document.querySelector(r.source):r.source;if("string"==typeof r.source&&!i)return Promise.reject(new Error("Source not found"));if(r.target){let e=this.#ee(document.body,r.target);if(!e)return Promise.reject(new Error("Target not found"));i||=e}i||=document.body;let n=this.#S(i,r.event||{});return Object.assign(n,r),r.target&&(n.target=this.#ee(document.body,r.target)),Object.assign(n.request,{action:t,method:e.toUpperCase()}),r.headers&&Object.assign(n.request.headers,r.headers),this.#Y(n)}#I(){this.config.history&&(history.state||history.replaceState({htmx:!0},"",location.href),window.addEventListener("popstate",e=>{e.state&&e.state.htmx&&(this.#f?.abort(),this.#Ke())}))}#Ye(e){this.config.history&&(history.pushState({htmx:!0},"",e),this.#N(document,"htmx:after:history:push",{path:e}))}#Ze(e){this.config.history&&(history.replaceState({htmx:!0},"",e),this.#N(document,"htmx:after:history:replace",{path:e}))}#Ke(e){e=e||location.pathname+location.search;let t=document.querySelector(this.#b("[hx-history-elt]"))||document.body;this.#N(document,"htmx:before:history:restore",{path:e,cacheMiss:!0})&&("reload"===this.config.history?location.reload():(this.#f=new AbortController,this.ajax("GET",e,{target:t,swap:"outerSync",select:t!==document.body?this.#b("[hx-history-elt]"):void 0,request:{headers:{"HX-History-Restore-Request":"true"},signal:this.#f.signal}})))}#et(e){let{sourceElement:t,push:r,replace:i,hx:n,response:s}=e;if((n?.pushurl||n?.replaceurl)&&(r=n.pushurl,i=n.replaceurl),null==r&&null==i&&this.#U(t)&&(r="true"),"false"!==r&&!1!==r||(r=null),"false"!==i&&!1!==i||(i=null),!r&&!i)return null;let o=r||i;if("true"===o){let t=s?.raw?.url||e.request.action,r=new URL(t,location.href);o=r.pathname+r.search+(e.request.anchor?"#"+e.request.anchor:"")}return{type:r?"push":"replace",path:o}}#We(e){let t=this.#et(e);if(!t)return;let r={history:t,sourceElement:e.sourceElement,response:e.response};this.#N(document,"htmx:before:history:update",r)&&("push"===t.type?this.#Ye(t.path):this.#Ze(t.path),this.#N(document,"htmx:after:history:update",r))}#Ee(e){let t=this.#y("hx-on"),r=this.config.metaCharacter||":",i=t=>async r=>{try{await this.#_(e,{event:r},`with(event?.detail||{}){${t}}`,!1)}catch(t){"symbol"!=typeof t&&this.#N(e,"htmx:error",{error:t})}};for(let n of e.getAttributeNames()){let s=t.find(e=>n.startsWith(e));if(!s)continue;let o=n.substring(s.length),a=e.getAttribute(n);if(!o){for(let t of a.split(/;(?=[^;]*->)/)){let r=t.indexOf("->");-1!==r&&this.#k(e,t.substring(0,r).trim(),i(t.substring(r+2).trim()))}continue}if(o[0]!==r)continue;let l=o.substring(1);l.startsWith(r)&&(l="htmx"+r+l.substring(1)),this.#k(e,l,i(a))}}#ue(e){let t,r=this.#v(e,"hx-indicator");t=r?this.#ve(e,r,"hx-indicator"):[e];for(const e of t){let t=this.#M(e);t.rc=(t.rc||0)+1,this.#ze(e,this.config.requestClass)}return t}#ge(e){for(let t of e){let e=this.#M(t);e.rc&&--e.rc<=0&&(this.#Ge(t,this.config.requestClass),delete e.rc)}}#de(e){let t=this.#v(e,"hx-disable"),r=[];if(t){r=this.#ve(e,t,"hx-disable");for(let e of r){let t=this.#M(e);t.dc=(t.dc||0)+1,e.disabled=!0}}return r}#xe(e){for(const t of e){let e=this.#M(t);e.dc&&--e.dc<=0&&(t.disabled=!1,delete e.dc)}}#C(e,t,r,i,n){if(i&&t&&!t.reportValidity())return;let s=t?new FormData(t):new FormData,o=t?new Set(t.elements):new Set;if(!t){if(i&&e.reportValidity&&!e.reportValidity())return;this.#tt(e,o,s,n)}r&&r.name&&(s.append(r.name,r.value),o.add(r));let a=this.#v(e,"hx-include");if(a)for(let t of this.#ve(e,a)){if(i&&t.reportValidity&&!t.reportValidity())return;this.#tt(t,o,s)}return s}#tt(e,t,r,i){let n=e.tagName,s=[];"BUTTON"===n?s=[e]:!["INPUT","SELECT","TEXTAREA","FIELDSET"].includes(n)&&i||(s=this.#P(e,"input, select, textarea"));for(let e of s){if(!e.name||e.matches(":disabled")||t.has(e))continue;t.add(e);let i=e.type;if("checkbox"===i||"radio"===i)e.checked&&r.append(e.name,e.value);else if("file"===i)for(let t of e.files)r.append(e.name,t);else if("select-multiple"===i)for(let t of e.selectedOptions)r.append(e.name,t.value);else r.append(e.name,e.value)}}#q(e,t,r){let i=this.#v(e,t);if(!i)return null;let n=this.#oe(i);if(n)return 0!==n.indexOf("{")&&(n="{"+n+"}"),this.#_(e,{},n,!0).then(e=>{r(e)});r(this.#W(i))}#rt(e){let t=e.trim();return t.startsWith("<")&&t.endsWith("/>")?t.slice(1,-2):t}#ve(e,t,r,i){let n=t??e,s=t?this.#Xe(e):document;if(n.startsWith("global "))return this.#ve(s,n.slice(7),r,!0);let o=n?n.replace(/<[^>]+\/>/g,e=>e.replace(/,/g,"%2C")).split(",").map(e=>e.replace(/%2C/g,",")):[],a=[],l=[];for(const e of o){let t,n=this.#rt(e);if(n.startsWith("closest "))t=s.closest(n.slice(8));else if(n.startsWith("find "))t=s.querySelector(n.slice(5));else if(n.startsWith("findAll "))a.push(...s.querySelectorAll(n.slice(8)));else if("next"===n||"nextElementSibling"===n)t=s.nextElementSibling;else if(n.startsWith("next "))t=this.#it(s,n.slice(5),!!i);else if("previous"===n||"previousElementSibling"===n)t=s.previousElementSibling;else if(n.startsWith("previous "))t=this.#nt(s,n.slice(9),!!i);else if("document"===n)t=document;else if("window"===n)t=window;else if("body"===n)t=document.body;else if("host"===n)t=s.getRootNode().host;else if("this"===n){if(r){a.push(...this.#V(s,r));continue}t=s}else l.push(n);t&&a.push(t)}if(l.length>0){let e=l.join(","),t=this.#st(s,!!i);a.push(...t.querySelectorAll(e))}return[...new Set(a)]}#it(e,t,r){return this.#ot(this.#st(e,r).querySelectorAll(t),e,Node.DOCUMENT_POSITION_PRECEDING)}#nt(e,t,r){let i=[...this.#st(e,r).querySelectorAll(t)].reverse();return this.#ot(i,e,Node.DOCUMENT_POSITION_FOLLOWING)}#ot(e,t,r){for(const i of e)if(i.compareDocumentPosition(t)===r)return i}#st(e,t){return e.isConnected&&e.getRootNode?e.getRootNode?.({composed:t}):document}#ie(e,t,r){let i=this.#ve(e,t,r)[0];return i||console.warn(`htmx: '${t}' on ${r} did not match any element`,{elt:e,selector:t,attr:r}),i}#Fe(e,t,r){return this.#ve(e,t,r)[0]}#oe(e){if(null!=e){if(e.startsWith("js:"))return e.substring(3);if(e.startsWith("javascript:"))return e.substring(11)}}#K(e){let t=()=>{this.#ce(e).abort()};e.addEventListener("htmx:abort",t),e._htmx.listeners.push({fromElt:e,eventName:"htmx:abort",handler:t})}#T(e,t,r){let{persistentIds:i,idMap:n}=this.#at(e,t),s=document.createElement("div");s.hidden=!0,document.body.after(s);let o={target:e,idMap:n,persistentIds:i,pantry:s,futureMatches:new WeakSet};r?this.#lt(o,e,t):this.#lt(o,e.parentNode,t,e,e.nextSibling),this.#Ae(s),s.remove()}#lt(e,t,r,i=null,n=null){t instanceof HTMLTemplateElement&&r instanceof HTMLTemplateElement&&(t=t.content,r=r.content),i||=t.firstChild;let s=r.firstChild;for(;s;){let r;if(i&&i!=n&&(r=this.#ct(e,s,i,n),r&&r!==i)){let o=i;for(;o&&o!==r;){let r=o;o=o.nextSibling,r instanceof Element&&(e.idMap.has(r)||this.#ht(e,r,s))?this.#He(t,r,n):this.#ut(e,r)}}if(!r&&s instanceof Element&&e.persistentIds.has(s.id)){let n=CSS.escape(s.id);r=e.target.id===s.id&&e.target||e.target.querySelector(`[id="${n}"]`)||e.pantry.querySelector(`[id="${n}"]`);let o=r;for(;o=o.parentNode;){let t=e.idMap.get(o);t&&(t.delete(r.id),t.size||e.idMap.delete(o))}this.#He(t,r,i)}if(r){this.#dt(r,s,e),i=r.nextSibling,s=s.nextSibling;continue}let o=s.nextSibling;if(e.idMap.has(s)){let r=document.createElement(s.tagName);t.insertBefore(r,i),this.#dt(r,s,e),i=r.nextSibling}else t.insertBefore(s,i),i=s.nextSibling;s=o}for(;i&&i!=n;){let t=i;i=i.nextSibling,this.#ut(e,t)}}#ht(e,t,r){if(e.futureMatches.has(t))return!0;for(let i=r.nextSibling,n=0;i&&na.has(e)))return c;if(!r){if(o>0&&c.isEqualNode(t))return c;n||(n=c)}}if(s+=r?.size||0,s>l)break;if(c.contains(document.activeElement))break;if(--o<1&&0===l)break;c=c.nextSibling}return n&&this.#ht(e,n,t)?null:n}#H(e,t){return e instanceof Element&&e.tagName===t.tagName&&(!("SCRIPT"===e.tagName&&!e.isEqualNode(t))&&(!(!e._x_bindings?.id||!t.matches?.("[\\:id], [x-bind\\:id]"))||(!e.id||e.id===t.id)))}#ut(e,t){e.idMap.has(t)?this.#He(e.pantry,t,null):(this.#Ae(t),t.remove())}#He(e,t,r){if(e.moveBefore)try{return void e.moveBefore(t,r)}catch(e){}e.insertBefore(t,r)}#dt(e,t,r){if(this.config.morphSkip&&e.matches?.(this.config.morphSkip))return;if(!this.#B(e,"htmx:before:morph:node",{oldNode:e,newNode:t}))return;this.#Qe(e,t),e instanceof HTMLTextAreaElement&&e.defaultValue!=t.defaultValue&&(e.value=t.value),this.config.morphSkipChildren&&e.matches?.(this.config.morphSkipChildren)||e.isEqualNode(t)&&"TEMPLATE"!==t.tagName&&!t.querySelector?.("template")||this.#lt(r,e,t)}#Qe(e,t){let r=this.config.morphIgnore||[];for(const i of t.attributes)r.includes(i.name)||e.getAttribute(i.name)===i.value||(e.setAttribute(i.name,i.value),"value"===i.name&&e instanceof HTMLInputElement&&"file"!==e.type&&(e.value=i.value));for(let i=e.attributes.length-1;i>=0;i--){let n=e.attributes[i];!n||t.hasAttribute(n.name)||r.includes(n.name)||e.removeAttribute(n.name)}}#mt(e,t,r,i){for(const n of i)if(t.has(n.id)){let t=n;for(;t&&t!==r;){let r=e.get(t);null==r&&(r=new Set,e.set(t,r)),r.add(n.id),t=t.parentElement}}}#at(e,t){let r=this.#P(e,"[id]"),i=t.querySelectorAll("[id]"),n=this.#ft(r,i),s=new Map;return this.#mt(s,n,e.parentElement,r),this.#mt(s,n,t,i),{persistentIds:n,idMap:s}}#ft(e,t){let r=new Set,i=new Map;for(const{id:t,tagName:n}of e)i.has(t)?r.add(t):t&&i.set(t,n);let n=new Set;for(const{id:e,tagName:s}of t)n.has(e)?r.add(e):i.get(e)===s&&n.add(e);for(const e of r)n.delete(e);return n}#pe(e){let t=e.response.raw.status,r=this.config.noSwap.map(e=>e+""),i=t+"";for(let t of[i,i.slice(0,2)+"x",i[0]+"xx"]){if(r.includes(t))return void(e.swap="none");let i=this.#v(e.sourceElement,"hx-status:"+t);if(i)return void this.#L(i,e)}}#Ue(e){return new Promise(t=>{this.#m||=[],this.#m.push({task:e,resolve:t}),this.#p||this.#pt()})}async#pt(){if(0===this.#m.length||this.#p)return;this.#p=!0;let{task:e,resolve:t}=this.#m.shift();try{document.startViewTransition?(this.#N(document,"htmx:before:viewTransition",{task:e}),await document.startViewTransition(e).finished,this.#N(document,"htmx:after:viewTransition",{task:e})):await e()}catch(e){}finally{this.#p=!1,t(),this.#pt()}}#Je(e,t){let r=t.querySelectorAll("[id]"),i=Object.fromEntries([...r].map(e=>[e.id,e])),n=e.querySelectorAll("[id]"),s=[];for(let e of n){let t=i[e.id];if(t?.tagName===e.tagName){let r=e.cloneNode(!1);this.#Qe(e,t),s.push(()=>{this.#Qe(e,r)})}}return s}#ze(e,t){e?.classList?.add?.(t)}#Ge(e,t){e?.classList?.remove?.(t),0===e?.classList?.length&&e.removeAttribute("class")}#Xe(e){return"string"==typeof e?this.find(e):e}#F(e){return this.config.metaCharacter?e.replace(/:/g,this.config.metaCharacter):e}}})();(()=>{let e;async function*t(e){let t=new TextDecoder,r="",i=!1,n={data:"",event:"",id:"",retry:null},s=!0;try{for(;;){let{done:o,value:a}=await e.read();if(o)break;let l=t.decode(a,{stream:!0});s&&(65279===l.charCodeAt(0)&&(l=l.slice(1)),s=!1),r+=l;let c=r.split(/\r\n|\r|\n/);r=c.pop()||"";for(let e of c){if(!e){i&&(yield n,i=!1,n={data:"",event:"",id:"",retry:null});continue}let t,r,s=e.indexOf(":");if(0!==s)if(s<0?(t=e,r=""):(t=e.slice(0,s),r=e.slice(s+1)," "===r[0]&&(r=r.slice(1))),"data"===t)n.data+=(i?"\n":"")+r,i=!0;else if("event"===t)n.event=r;else if("id"===t)r.includes("\0")||(n.id=r);else if("retry"===t){let e=parseInt(r,10);isNaN(e)||(n.retry=e)}}}}finally{e.releaseLock()}}async function r(r){let i=r.sourceElement,s=function(t){let r=null!=e.attributeValue(t.sourceElement,"hx-sse:connect");return{reconnect:r,reconnectDelay:500,reconnectMaxDelay:6e4,reconnectMaxAttempts:1/0,reconnectJitter:.3,pauseOnBackground:r,...htmx.config.sse||{},...t.request.sse||{}}}(r),o=!1,a={url:r.request.action,config:s,abortController:null,reader:null,lastEventId:null,delayCanceller:null,visibilityHandler:null,attempt:0,cancelled:!1,status:null};e.htmxProp(i).sse=a;let l=!1,c=null;if(s.pauseOnBackground){let e=()=>{document.hidden?(l=!0,a.reader?.cancel()):l&&(l=!1,c&&c())};document.addEventListener("visibilitychange",e),a.visibilityHandler=e}if(a.cancelled=!1,!e.triggerHtmxEvent(i,"htmx:before:sse:connection",{connection:a})||a.cancelled)return void n(i,"cancelled");a.status=r.response.status,e.triggerHtmxEvent(i,"htmx:after:sse:connection",{connection:a});let h=r.response.raw;try{for(;i.isConnected;){if(a.attempt>0){if(l){if(await new Promise(e=>{c=e}),c=null,!i.isConnected)break;a.attempt=1,o=!0}if(!o&&(!s.reconnect||a.attempt>s.reconnectMaxAttempts))break;let t=htmx.parseInterval(s.reconnectDelay)??s.reconnectDelay,n=htmx.parseInterval(s.reconnectMaxDelay)??s.reconnectMaxDelay,u=Math.min(t*Math.pow(2,a.attempt-1),n);if(s.reconnectJitter>0){let e=u*s.reconnectJitter;u=Math.max(0,u+(2*Math.random()-1)*e)}if(a.cancelled=!1,!e.triggerHtmxEvent(i,"htmx:before:sse:connection",{connection:a})||a.cancelled)break;if(await new Promise(e=>{a.delayCanceller=e,setTimeout(e,u)}),a.delayCanceller=null,!i.isConnected)break;let d=new AbortController;a.abortController=d;try{a.lastEventId&&(r.request.headers["Last-Event-ID"]=a.lastEventId),h=await fetch(r.request.action,{...r.request,signal:d.signal})}catch(t){if(d.signal.aborted)break;e.triggerHtmxEvent(i,"htmx:sse:error",{error:t,url:r.request.action}),o=!1,a.attempt++;continue}if(!h.ok){e.triggerHtmxEvent(i,"htmx:sse:error",{error:new Error(`SSE reconnect failed with status ${h.status}`),status:h.status,url:r.request.action}),o=!1,a.attempt++;continue}a.status=h.status,e.triggerHtmxEvent(i,"htmx:after:sse:connection",{connection:a}),a.attempt=0}o=!1;try{a.reader=h.body.getReader();for await(let l of t(a.reader)){if(!i.isConnected||o)break;let t={message:{data:l.data,event:l.event,id:l.id,cancelled:!1}};if(e.triggerHtmxEvent(i,"htmx:before:sse:message",t)&&!t.message.cancelled){if(l.id&&(a.lastEventId=l.id),null!=l.retry&&(s.reconnectDelay=l.retry),t.message.event){htmx.trigger(i,t.message.event,{data:t.message.data,id:t.message.id}),delete t.message.cancelled,e.triggerHtmxEvent(i,"htmx:after:sse:message",t);let r=e.attributeValue(i,"hx-sse:close");if(r&&t.message.event===r)return void n(i,"message");continue}r.text=t.message.data,await htmx.swap(r),delete t.message.cancelled,e.triggerHtmxEvent(i,"htmx:after:sse:message",t)}}}catch(t){a.abortController?.signal?.aborted||e.triggerHtmxEvent(i,"htmx:sse:error",{error:t,url:r.request.action})}if(a.reader=null,!i.isConnected)break;a.attempt++}}finally{n(i,i.isConnected?"ended":"removed")}}function i(t){let r=e.attributeValue(t,"hx-sse:connect");if(!r)return;if(t._htmx?.sse)return;let i=e.attributeValue(t,"hx-trigger")||"load";e.onTrigger(t,i,()=>{t._htmx?.sse||htmx.ajax("GET",r,{source:t})})}function n(t,r){let i=t?._htmx?.sse;i&&(i.abortController?.abort(),i.reader?.cancel?.(),i.delayCanceller&&i.delayCanceller(),i.visibilityHandler&&document.removeEventListener("visibilitychange",i.visibilityHandler),e.triggerHtmxEvent(t,"htmx:sse:close",{connection:i,reason:r||"cleanup"}),delete t._htmx.sse)}function s(e){if(e.hasAttribute("sse-connect")){console.warn("htmx: [hx-sse] legacy attribute sse-connect is deprecated; use hx-sse:connect instead");let t=e.getAttribute("sse-connect"),r=(htmx.config.prefix||"hx-")+"sse"+(htmx.config.metaCharacter||":")+"connect";e.hasAttribute(r)||e.setAttribute(r,t)}e.hasAttribute("sse-swap")&&console.warn("htmx: [hx-sse] sse-swap is removed in htmx 4. Unnamed SSE messages are swapped automatically. Named events are dispatched as DOM events.")}htmx.registerExtension("sse",{init:t=>{e=t},htmx_config_request:(e,t)=>{t.ctx.request.headers.Accept="text/html, text/event-stream"},htmx_before_response:(t,i)=>{let s=i.ctx,o=s.response.raw.headers.get("Content-Type");if(o?.includes("text/event-stream"))return r(s).catch(r=>{e.triggerHtmxEvent(t,"htmx:sse:error",{error:r,url:s.request.action}),n(t)}),!1},htmx_after_process:e=>{s(e),i(e);let t=htmx.config.metaCharacter||":",r=`[${CSS.escape("hx-sse"+t+"connect")}]`;htmx.config.prefix&&(r+=`,[${CSS.escape(htmx.config.prefix+"sse"+t+"connect")}]`),e.querySelectorAll(`${r},[sse-connect]`).forEach(e=>{s(e),i(e)})},htmx_before_cleanup:e=>{n(e)}})})(),(()=>{let e;function t(e){let t=htmx.config.metaCharacter||":",r=`[${CSS.escape("hx-ws"+t+e)}]`;return htmx.config.prefix&&(r+=`,[${CSS.escape(htmx.config.prefix+"ws"+t+e)}]`),r}function r(t){const r={reconnect:!0,reconnectDelay:500,reconnectMaxDelay:6e4,reconnectMaxAttempts:1/0,reconnectJitter:.3,pauseOnBackground:!0,pendingRequestTTL:3e4};let i=htmx.config.ws||{},n={};if(t){n=e.createRequestContext(t,new CustomEvent("_")).request.ws||{}}let s={...r,...i,...n};return"boolean"==typeof s.reconnectJitter&&(s.reconnectJitter=s.reconnectJitter?.3:0),s}function i(e){if(e.startsWith("ws://")||e.startsWith("wss://"))return e;if(e.startsWith("http://"))return"ws://"+e.slice(7);if(e.startsWith("https://"))return"wss://"+e.slice(8);let t="https:"===window.location.protocol?"wss:":"ws:",r=window.location.host;return e.startsWith("//")?t+e:e.startsWith("/")?t+"//"+r+e:t+"//"+r+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/")+1)+e}const n=new Map;function s(t,s){let o=i(t);if(n.has(o))return n.get(o);let a={url:o,config:r(s),socket:null,attempt:0,timer:null,pendingRequests:new Map,visibilityHandler:null,cancelled:!1};return!e.triggerHtmxEvent(s,"htmx:before:ws:connection",{connection:a})||a.cancelled?(e.triggerHtmxEvent(s,"htmx:ws:close",{connection:a,reason:"cancelled",code:null}),null):(n.set(o,a),l(o,a),a.config.pauseOnBackground&&(a.visibilityHandler=()=>{document.hidden?a.socket&&a.socket.readyState===WebSocket.OPEN&&a.socket.close():a.socket&&a.socket.readyState!==WebSocket.CLOSED||(a.attempt=0,l(o,a))},document.addEventListener("visibilitychange",a.visibilityHandler)),a)}function o(e){let r=t("connect")+","+t("send");for(let t of document.querySelectorAll(r))if(t._htmx?.ws?.url===e)return t;return null}function a(e,t){if(t.timer&&clearTimeout(t.timer),t.visibilityHandler&&document.removeEventListener("visibilitychange",t.visibilityHandler),t.abortController&&t.abortController.abort(),t.pendingRequests.clear(),t.socket)try{t.socket.readyState!==WebSocket.OPEN&&t.socket.readyState!==WebSocket.CONNECTING||t.socket.close()}catch(e){}n.delete(e)}function l(t,r){if(r.abortController&&r.abortController.abort(),r.socket){let e=r.socket;r.socket=null;try{e.readyState!==WebSocket.OPEN&&e.readyState!==WebSocket.CONNECTING||e.close()}catch(e){}}try{r.socket=new WebSocket(t);let i=new AbortController;r.abortController=i;let s={signal:i.signal};r.socket.addEventListener("open",()=>{let i=o(t);i?(e.triggerHtmxEvent(i,"htmx:after:ws:connection",{connection:r}),r.attempt=0):a(t,r)},s),r.socket.addEventListener("message",t=>{!function(t,r){let i=null;try{i=JSON.parse(r.data)}catch(e){}c(t);let n=null,s=i?.["HX-Request-ID"]||i?.request_id;s&&t.pendingRequests.has(s)?(n=t.pendingRequests.get(s).element,t.pendingRequests.delete(s),n.isConnected||(n=o(t.url))):n=o(t.url);if(!n)return void a(t.url,t);let l,h={message:{text:r.data,json:i,cancelled:!1}};if(!e.triggerHtmxEvent(n,"htmx:before:ws:message",h)||h.message.cancelled)return;h.message.json?void 0!==h.message.json.content?l=h.message.json.content:void 0!==h.message.json.payload&&(l=h.message.json.payload,t._payloadWarnFired||(console.warn("htmx: [hx-ws] json.payload is deprecated; use json.content instead"),t._payloadWarnFired=!0)):l=h.message.text;if(null!=l){let t=h.message.json?.target||e.attributeValue(n,"hx-target"),r=h.message.json?.swap||e.attributeValue(n,"hx-swap");htmx.swap({sourceElement:n,target:t||n,swap:r||(t?htmx.config.defaultSwap:"none"),text:l,transition:!1})}delete h.message.cancelled,e.triggerHtmxEvent(n,"htmx:after:ws:message",h)}(r,t)},s),r.socket.addEventListener("close",i=>{if(i.target!==r.socket)return;let s=o(t);if(s&&e.triggerHtmxEvent(s,"htmx:ws:close",{connection:r,reason:"closed",code:i.code}),!n.has(t))return;let c=r.config;c.pauseOnBackground&&document.hidden||(c.reconnect&&o(t)?function(t,r){let i=r.config;r.attempt++;let n=r.attempt;if(!i.reconnect||n>i.reconnectMaxAttempts)return void a(t,r);let s=htmx.parseInterval(i.reconnectDelay)??i.reconnectDelay,c=htmx.parseInterval(i.reconnectMaxDelay)??i.reconnectMaxDelay,h=Math.min(s*Math.pow(2,n-1),c);if(i.reconnectJitter>0){let e=h*i.reconnectJitter;h=Math.max(0,h+(2*Math.random()-1)*e)}let u=o(t);if(!u)return void a(t,r);if(r.cancelled=!1,!e.triggerHtmxEvent(u,"htmx:before:ws:connection",{connection:r})||r.cancelled)return e.triggerHtmxEvent(u,"htmx:ws:close",{connection:r,reason:"cancelled",code:null}),void a(t,r);r.timer=setTimeout(()=>{o(t)?l(t,r):a(t,r)},h)}(t,r):a(t,r))},s),r.socket.addEventListener("error",r=>{let i=o(t);i&&e.triggerHtmxEvent(i,"htmx:ws:error",{url:t,error:r})},s)}catch(r){let i=o(t);i&&e.triggerHtmxEvent(i,"htmx:ws:error",{url:t,error:r})}}function c(e){let t=e.config,r=Date.now(),i=t.pendingRequestTTL||3e4;for(let[t,n]of e.pendingRequests)r-n.timestamp>i&&e.pendingRequests.delete(t)}function h(r){if(e.htmxProp(r).ws??={},r._htmx.ws.sendInitialized)return;let o=e.attributeValue(r,"hx-ws:send"),a=o&&"true"!==o?o:null,l=e.attributeValue(r,"hx-trigger");l||(l=r.matches("form")?"submit":r.matches("input:not([type=button]),select,textarea")?"change":"click"),e.onTrigger(r,l,async o=>{if(r.matches("form")&&"submit"===o.type&&o.preventDefault(),a&&!r._htmx?.ws?.url){let e=s(a,r);e&&(r._htmx.ws.url=e.url)}await async function(r,s){let o=e.attributeValue(r,"hx-ws:send"),a=o&&"true"!==o?o:null;if(!a){let i=r.closest(t("connect"));i&&(a=e.attributeValue(i,"hx-ws:connect"))}if(!a)return void e.triggerHtmxEvent(r,"htmx:ws:error",{url:null,error:"No WebSocket connection found for element"});let l=i(a),h=n.get(l);if(h&&h.socket&&h.socket.readyState===WebSocket.CONNECTING&&await new Promise(e=>{h.socket.addEventListener("open",e,{once:!0}),h.socket.addEventListener("close",e,{once:!0}),h.socket.addEventListener("error",e,{once:!0})}),!h||!h.socket||h.socket.readyState!==WebSocket.OPEN)return void e.triggerHtmxEvent(r,"htmx:ws:error",{url:l,error:"Connection not open"});c(h);let u={...e.createRequestContext(r,s).request.headers};delete u.Accept;let d=crypto.randomUUID();u["HX-Request-ID"]=d;let m=r.form||r.closest("form"),f=e.collectFormData(r,m,s.submitter),p={};for(let[e,t]of f)p[e]=e in p?[].concat(p[e],t):t;let g=e.getAttributeObject(r,"hx-vals",e=>Object.assign(p,e));g&&await g;let x={headers:u,body:p};if(e.triggerHtmxEvent(r,"htmx:before:ws:request",x))try{h.socket.send(JSON.stringify(x)),h.pendingRequests.set(d,{element:r,timestamp:Date.now()}),e.triggerHtmxEvent(r,"htmx:after:ws:request",x)}catch(t){e.triggerHtmxEvent(r,"htmx:ws:error",{url:l,error:t})}}(r,o)}),r._htmx.ws.sendInitialized=!0}function u(t){let r=t._htmx?.ws?.url;r&&n.has(r)&&(t._htmx.ws.url=null,o(r)||function(t,r){let i=n.get(t);i&&(i.timer&&clearTimeout(i.timer),i.visibilityHandler&&document.removeEventListener("visibilitychange",i.visibilityHandler),i.abortController&&i.abortController.abort(),i.pendingRequests.clear(),e.triggerHtmxEvent(r,"htmx:ws:close",{connection:i,reason:"removed",code:null}),i.socket&&i.socket.readyState===WebSocket.OPEN&&i.socket.close(),n.delete(t))}(r,t))}htmx.registerExtension("ws",{init:t=>{e=t,htmx.config.ws||(htmx.config.ws={})},htmx_after_process:r=>{const i=t=>{!function(e){if(e.hasAttribute("ws-connect")||e.hasAttribute("ws-send")){if(console.warn("htmx: [hx-ws] legacy attributes ws-connect and ws-send are deprecated; use hx-ws:connect and hx-ws:send instead"),e.hasAttribute("ws-connect")){let t=e.getAttribute("ws-connect"),r=htmx.config.metaCharacter||":",i=(htmx.config.prefix||"hx-")+"ws"+r+"connect";e.hasAttribute(i)||e.setAttribute(i,t)}if(e.hasAttribute("ws-send")){let t=htmx.config.metaCharacter||":",r=(htmx.config.prefix||"hx-")+"ws"+t+"send";e.hasAttribute(r)||e.setAttribute(r,"")}}}(t),null!=e.attributeValue(t,"hx-ws:connect")&&function(t){if(e.htmxProp(t).ws??={},t._htmx.ws.initialized)return;let r=e.attributeValue(t,"hx-ws:connect");if(!r)return;let i=e.attributeValue(t,"hx-trigger")||"load";e.onTrigger(t,i,()=>{if(t._htmx?.ws?.url)return;let e=s(r,t);e&&(t._htmx.ws.url=e.url)}),t._htmx.ws.initialized=!0}(t),null!=e.attributeValue(t,"hx-ws:send")&&h(t)};i(r);let n=t("connect")+","+t("send")+",[ws-connect],[ws-send]";r.querySelectorAll(n).forEach(i)},htmx_before_cleanup:e=>{u(e)}}),"undefined"!=typeof window&&window.htmx&&(window.addEventListener("pagehide",()=>{n.forEach(e=>{e.socket&&e.socket.close(1001,"page navigating away")})}),window.htmx.ext=window.htmx.ext||{},window.htmx.ext.ws={getRegistry:()=>({clear:()=>{let e=Array.from(n.values());n.clear(),e.forEach(e=>{e.timer&&clearTimeout(e.timer),e.visibilityHandler&&document.removeEventListener("visibilitychange",e.visibilityHandler),e.abortController&&e.abortController.abort(),e.socket&&e.socket.close(),e.pendingRequests.clear()})},get:e=>n.get(i(e)),has:e=>n.has(i(e)),get size(){return n.size}})})})(),(()=>{let e;htmx.registerExtension("preload",{init:t=>{e=t},htmx_after_init:t=>{!function(t){let r=e.attributeValue(t,"hx-preload");if(null==r&&!t._htmx?.boosted)return;let i=[],n=5e3;if(r){let t=e.parseTriggerSpecs(r);if(0===t.length)return;for(const e of t)i.push(e.name),e.timeout&&(n=htmx.parseInterval(e.timeout))}else{let r=t._htmx?.boosted&&"A"===t.tagName,s=null!=e.attributeValue(t,"hx-get");if(!r&&!s)return;if(r&&!1===htmx.config?.preload?.autoBoost)return;htmx.config?.preload?.boostTimeout&&(n=htmx.parseInterval(htmx.config.preload.boostTimeout)),i.push(htmx.config?.preload?.boostEvent||"mousedown"),i.push("touchstart")}let s=async r=>{let{method:i}=e.determineMethodAndAction(t,r);if("GET"!==i)return;if(t._htmx?.preload)return;let s=e.createRequestContext(t,r),o=t.form||t.closest("form"),a=e.collectFormData(t,o,r.submitter),l=e.getAttributeObject(t,"hx-vals",e=>{for(let t in e)a.set(t,e[t])});l&&await l;let c=s.request.action.replace?.(/#.*$/,""),h=new URLSearchParams(a);h.size&&(c+=(/\?/.test(c)?"&":"?")+h),t._htmx.preload={prefetch:fetch(c,s.request),action:c,expiresAt:Date.now()+n};try{await t._htmx.preload.prefetch}catch(e){delete t._htmx.preload}};for(let e of i)t.addEventListener(e,s);t._htmx.preloadListener=s,t._htmx.preloadEvents=i}(t)},htmx_before_request:(e,t)=>{let{ctx:r}=t;if(e._htmx?.preload&&e._htmx.preload.action===r.request.action&&Date.now()t,delete e._htmx.preload}else e._htmx&&delete e._htmx.preload},htmx_before_cleanup:e=>{if(e._htmx?.preloadListener)for(let t of e._htmx.preloadEvents)e.removeEventListener(t,e._htmx.preloadListener)}})})()(()=>{if("undefined"==typeof navigation)return;let e,t=0,r=new Set,i=!1,n=null;function s(){navigation.addEventListener("navigate",e=>{let o;e.intercept({handler:()=>new Promise(e=>{o=e}),scroll:"manual",focusReset:"manual"});let a=()=>{i?s():(r.forEach(e=>e()),r.clear(),t=0,n=null)};e.signal.addEventListener("abort",a),n=()=>{e.signal.removeEventListener("abort",a),o()}},{once:!0})}function o(){s(),navigation.navigate(location.href,{history:"replace"})}htmx.registerExtension("browser-indicator",{init:t=>{e=t},htmx_before_history_update:()=>{i=!0},htmx_after_history_update:()=>{i=!1},htmx_before_request:(i,n)=>{(function(t){return"true"===e.attributeValue(t,"hx-browser-indicator")||!(!htmx.config.boostBrowserIndicator||!t._htmx?.boosted)})(i)&&(n.ctx._browserIndicator=!0,n.ctx.request?.abort&&r.add(n.ctx.request.abort),t++,1===t&&o())},htmx_finally_request:(e,i)=>{i.ctx._browserIndicator&&(i.ctx.request?.abort&&r.delete(i.ctx.request.abort),0!==t&&(t--,0===t&&n&&(n(),n=null)))}})})(),(()=>{let e;function t(t,r,i){(async()=>{let n=+r.headers.get("Content-Length")||null;e.triggerHtmxEvent(t,"htmx:download:start",{total:n});let s=r.body.getReader(),o=[],a=0;for(;;){let{done:r,value:i}=await s.read();if(r)break;o.push(i),a+=i.length,e.triggerHtmxEvent(t,"htmx:download:progress",{loaded:a,total:n,percent:n?Math.round(a/n*100):null})}let l=new Blob(o,{type:r.headers.get("Content-Type")||"application/octet-stream"}),c=function(e,t){let r=e.get("Content-Disposition");if(r){let e=r.match(/filename\*?=['"]?(?:UTF-8'')?([^'";]+)/i);if(e)return decodeURIComponent(e[1])}return t.split("/").pop().split("?")[0]||"download"}(r.headers,i),h=URL.createObjectURL(l);Object.assign(document.createElement("a"),{href:h,download:c}).click(),URL.revokeObjectURL(h),e.triggerHtmxEvent(t,"htmx:download:complete",{filename:c,size:l.size})})()}htmx.registerExtension("download",{init:t=>{e=t},htmx_before_response:(e,{ctx:r})=>{let i=r.response.headers.get("HX-Download");if(i)return void(async()=>{t(r.sourceElement,await fetch(i),i)})();let n=r.response.headers.get("Content-Disposition");return"download"===r.swap||n?.includes("attachment")?(t(r.sourceElement,r.response.raw,r.request.action),!1):void 0}})})(),(()=>{let e;function t(e){if(e.optimisticDiv){e.optimisticDiv.remove();for(let t of e.optHidden)t.style.display=""}}htmx.registerExtension("hx-optimistic",{init:t=>{e=t},htmx_before_request:(t,r)=>{!function(t){if(t.optimistic=e.attributeValue(t.sourceElement,"hx-optimistic"),!t.optimistic)return;let r=document.querySelector(t.optimistic);if(!r)return;let i=t.target;if(!i)return;"string"==typeof i&&(i=document.querySelector(i));let n=document.createElement("div");n.style.cssText="all: initial",n.innerHTML=r.innerHTML;let s="before"===(o=t.swap)?"beforebegin":"after"===o?"afterend":"prepend"===o?"afterbegin":"append"===o?"beforeend":o;var o;if(t.optHidden=[],"innerHTML"===s){for(let e of i.children)e.style.display="none",t.optHidden.push(e);i.appendChild(n),t.optimisticDiv=n}else["beforebegin","afterbegin","beforeend","afterend"].includes(s)?(i.insertAdjacentElement(s,n),t.optimisticDiv=n):(i.style.display="none",t.optHidden.push(i),i.after(n),t.optimisticDiv=n)}(r.ctx)},htmx_error:(e,r)=>{t(r.ctx)},htmx_before_swap:(e,r)=>{t(r.ctx)}})})(),(()=>{let e;htmx.registerExtension("hx-targets",{init:t=>{e=t},htmx_before_swap:(t,r)=>{let{ctx:i,tasks:n}=r,s=e.attributeValue(i.sourceElement,"hx-targets");if(!s)return;let o=htmx.findAll(i.sourceElement,s);if(!o.length)return void console.warn(`htmx: '${s}' on hx-targets did not match any elements`,{selector:s});let a=n.findIndex(e=>"main"===e.type);if(-1===a)return;let l=n[a],c=Array.from(o).map(e=>({...l,fragment:l.fragment.cloneNode(!0),target:e}));n.splice(a,1,...c)}})})(),(()=>{let e,t=new Set,r=!1,i=Symbol(),n=null,s=null,o=0,a=0,l=0;function c(){n||(s=()=>u(),document.addEventListener("input",s,!0),document.addEventListener("change",s,!0),n=new MutationObserver(s),n.observe(document.documentElement,{childList:!0,subtree:!0,attributes:!0,characterData:!0}))}function h(){n&&(document.removeEventListener("input",s,!0),document.removeEventListener("change",s,!0),n.disconnect(),n=null,s=null)}function u(){if(r)return;if(o>0)return;let e=Date.now();if(e-l>1e3&&(l=e,a=0),++a>50)return console.warn("htmx: hx-live recompute exceeded 50/sec, deactivating. Likely a self-mutating expression."),h(),void t.clear();r=!0,queueMicrotask(()=>{t.forEach(e=>e()),0===t.size&&h(),setTimeout(()=>{r=!1})})}function d(e,t,r){let i;void 0===r&&(r=e[0]?.parentElement),i=r&&r.nodeType&&r.querySelectorAll?[r,...r.querySelectorAll("."+t)]:"string"==typeof r?document.querySelectorAll(r):r||[];for(let e of i)e.classList?.remove(t),0===e.classList?.length&&e.removeAttribute("class");for(let r of e)r.classList?.add(t)}function m(e,...t){let r=e||document;for(let e of t)e?.nodeType&&(r=e);return new Promise(e=>{let i=[],n=!1,s=t=>{if(!n){n=!0;for(let e of i)e();e(t)}};for(let e of t){if(null==e||e?.nodeType)continue;let t="number"==typeof e?e:"string"==typeof e?htmx.parseInterval(e):void 0;if(void 0!==t&&t>0){let r=setTimeout(()=>s(e),t);i.push(()=>clearTimeout(r))}else if("string"==typeof e){let t=e=>s(e);r.addEventListener(e,t,{once:!0}),i.push(()=>r.removeEventListener(e,t))}}})}let f=/^([.@*])([^=]+)(?:=(.*))?$/;function p(e,t){let r=e.trim().match(f);if(!r)return;let[,i,n,s]=r;n=n.trim();let o=void 0===s?null:s.split("|").map(e=>e.trim());if("."===i)t.classList.toggle(n);else if("@"===i)if(o)if(1===o.length)t.hasAttribute(n)?t.removeAttribute(n):t.setAttribute(n,o[0]);else{let e=t.getAttribute(n),r=o.indexOf(null===e?"":e),i=o[(r+1)%o.length];""===i?t.removeAttribute(n):t.setAttribute(n,i)}else t.toggleAttribute(n);else{if(!o)return;if(1===o.length)t.style[n]?t.style[n]="":t.style[n]=o[0];else{let e=o.indexOf(t.style[n]||"");t.style[n]=o[(e+1)%o.length]}}}function g(){let e=new Map;return(t,r)=>{let n=(s=r?r.toString():null,e.get(s)||(e.set(s,{last:0,reject:null}),e.get(s)));var s;n.reject?.(i),n.reject=null;let o=++n.last;if(!r)return new Promise((e,r)=>{n.reject=r,setTimeout(()=>{o===n.last&&(n.reject=null,e())},t)});setTimeout(()=>o===n.last&&r(),t)}}function x(t){let r=e.htmxProp(t);return r.debounce||(r.debounce=g())}function b(e,t=document){return r=>{if("string"!=typeof r)return v(r?.nodeType?[r]:[...r||[]]);let i=r,n=i.match(/^(.+)\s+in\s+(.+)$/),s=[t];if(n&&(i=n[1],s="this"===n[2]||"me"===n[2]?[e]:[...document.querySelectorAll(n[2])]),!s.length)return v([]);let o,a=e=>{if(1===s.length)return[...s[0].querySelectorAll(e)];let t=[],r=new Set;for(let i of s)for(let n of i.querySelectorAll(e))r.has(n)||(r.add(n),t.push(n));return t.sort((e,t)=>4&e.compareDocumentPosition(t)?-1:1)},l=i.match(/^(next|prev|closest|first|last)\s+(.+)$/);if(l){let[,t,r]=l,i=t=>e.compareDocumentPosition(t);if("closest"===t){let t=e.closest?.(r);o=t?[t]:[]}else{let e=a(r);if("first"===t)o=e.slice(0,1);else if("last"===t)o=e.slice(-1);else if("next"===t){let t=e.find(e=>4&i(e));o=t?[t]:[]}else{let t=e.reverse().find(e=>2&i(e));o=t?[t]:[]}}}else o=a(i);return v(o)}}let y=new Set(["map","filter","reduce","reduceRight","forEach","some","every","find","findIndex","findLast","findLastIndex","flatMap","flat","slice","indexOf","lastIndexOf","includes","join","at"]);function v(e){let t={before:"beforebegin",after:"afterend",start:"afterbegin",end:"beforeend"},r=new Proxy({},{get:(i,n)=>{if("count"===n)return e.length;if("arr"===n)return()=>e.slice();if(n===Symbol.iterator)return()=>e.values();if("q"===n)return t=>{let r=new Set;for(let i of e)for(let e of b(i,i)(t).arr())r.add(e);return v([...r])};if("trigger"===n)return(t,i,n)=>(e.forEach(e=>htmx.trigger(e,t,i,n)),r);if("insert"===n)return(i,n)=>(e.forEach(e=>e.insertAdjacentHTML(t[i],n)),r);if("take"===n)return(t,i)=>(d(e,t,i),r);if("toggle"===n)return(...t)=>(e.forEach(e=>t.forEach(t=>p(t,e))),r);if(y.has(n))return e[n].bind(e);let s=e[0]?.[n];return"function"==typeof s?(...t)=>e.map(e=>e[n](...t))[0]:s&&"object"==typeof s?v(e.map(e=>e[n])):s},set:(t,r,i)=>(e.forEach(e=>e[r]=i),u(),!0)});return r}htmx.live={q:e=>b(document.documentElement)(e),debounce:g(),refresh:()=>u(),take:(e,t,r)=>{return d([...(i=e,null==i?[]:"string"==typeof i?document.querySelectorAll(i):i.nodeType?[i]:i)],t,r);var i},forEvent:(...e)=>m(null,...e),nextFrame:()=>new Promise(e=>requestAnimationFrame(e))},htmx.registerExtension("hx-live",{init:t=>{e=t},htmx_after_process:r=>{!function(r){let n="[hx-live]"+(htmx.config.prefix?",["+htmx.config.prefix+"live]":""),s=[...r.querySelectorAll?.(n)??[]];r.matches?.(n)&&s.unshift(r);for(let r of s){if(r.closest("[hx-ignore]"))continue;let n=e.htmxProp(r);if(n.liveRegistered)continue;let s=r.hasAttribute("hx-live")?"hx-live":htmx.config.prefix+"live";n.liveRegistered=!0,c();let o=r.getAttribute(s),a=x(r),l=async()=>{if(r.isConnected)try{await e.executeJavaScript(r,{debounce:a},o,!1)}catch(e){e!==i&&console.error("htmx: hx-live expression threw",e,{elt:r})}else t.delete(l)};t.add(l),l()}}(r)},htmx_before_swap:()=>{o++},htmx_swap_finally:()=>{0===--o&&t.size>0&&u()},htmx_scope:(e,t)=>{Object.assign(t.scope,{q:b(e),forEvent:(...t)=>m(e,...t),nextFrame:()=>new Promise(e=>requestAnimationFrame(e)),trigger:(t,r,i)=>htmx.trigger(e,t,r,i),debounce:x(e),take:(t,r)=>d([e],t,r),toggle:(...t)=>t.forEach(t=>p(t,e))})}})})(); \ No newline at end of file diff --git a/src/Common/wwwroot/htmx.min.js b/src/Common/wwwroot/htmx.min.js index 4b14094..7a34d3e 100644 --- a/src/Common/wwwroot/htmx.min.js +++ b/src/Common/wwwroot/htmx.min.js @@ -1 +1 @@ -var htmx=(()=>{class e{#e=null;#t=[];issue(e,t){return e.queueStrategy=t,this.#e?"replace"===t||"abort"!==t&&"abort"===this.#e.queueStrategy?(this.#t.forEach(e=>e.status="dropped"),this.#t=[],this.#e.request?.abort?.(),this.#e=e,!0):("queue all"===t?(this.#t.push(e),e.status="queued"):"drop"===t?e.status="dropped":"queue last"===t?(this.#t.forEach(e=>e.status="dropped"),this.#t=[e],e.status="queued"):0===this.#t.length&&"abort"!==t?(this.#t.push(e),e.status="queued"):e.status="dropped",!1):(this.#e=e,!0)}finish(){this.#e=null}next(){return this.#t.shift()}abort(){this.#e?.request?.abort?.()}more(){return this.#t?.length}}return new class{#r=new Map;#i="";#s=new Set;#n;#a;#o="a,form";#l=["get","post","put","patch","delete"];#h;#u;#c;#d;constructor(){this.#f(),this.#m(),this.#a=`[${this.#p("hx-action")}],[${this.#p("hx-get")}],[${this.#p("hx-post")}],[${this.#p("hx-put")}],[${this.#p("hx-patch")}],[${this.#p("hx-delete")}]`,this.#h=(new XPathEvaluator).createExpression(`.//*[@*[ starts-with(name(), "${this.#p("hx-on")}")]]`),this.#n={attributeValue:this.#g.bind(this),parseTriggerSpecs:this.#b.bind(this),determineMethodAndAction:this.#x.bind(this),createRequestContext:this.#y.bind(this),collectFormData:this.#v.bind(this),getAttributeObject:this.#S.bind(this),insertContent:this.#E.bind(this),morph:this.#w.bind(this),isSoftMatch:this.#C.bind(this),onTrigger:this.#A.bind(this),htmxProp:this.#q.bind(this),triggerHtmxEvent:this.#T.bind(this)};let e=()=>{this.#M(),this.process(document.body)};"loading"===document.readyState?document.addEventListener("DOMContentLoaded",e):setTimeout(e)}#f(){this.version="4.0.0-alpha8",this.config={logAll:!1,prefix:"",transitions:!1,history:!0,mode:"same-origin",defaultSwap:"innerHTML",defaultFocusScroll:!1,indicatorClass:"htmx-indicator",requestClass:"htmx-request",includeIndicatorCSS:!0,defaultTimeout:6e4,extensions:"",morphIgnore:["data-htmx-powered"],morphScanLimit:10,noSwap:[204,304],implicitInheritance:!1,defaultSettleDelay:1};let e=document.querySelector('meta[name="htmx-config"]');e&&this.#N(e.content,this.config),this.#i=this.config.extensions}#m(){if(!1!==this.config.includeIndicatorCSS){let e="";this.config.inlineStyleNonce&&(e=` nonce="${this.config.inlineStyleNonce}"`);let t=this.config.indicatorClass,r=this.config.requestClass;document.head.insertAdjacentHTML("beforeend",`.${t}{opacity:0;visibility: hidden} .${r} .${t}, .${r}.${t}{opacity:1;visibility: visible;transition: opacity 200ms ease-in}`)}}registerExtension(e,t){return!(this.#i&&!this.#i.split(/,\s*/).includes(e))&&(!this.#s.has(e)&&(this.#s.add(e),t.init&&t.init(this.#n),void Object.entries(t).forEach(([e,t])=>{this.#r.get(e)?.push(t)||this.#r.set(e,[t])})))}#H(e){return!e.closest||null!=e.closest(`[${this.#p("hx-ignore")}]`)}#p(e){return this.config.prefix?e.replace("hx-",this.config.prefix):e}#I(e,t){let r=[...e.querySelectorAll?.(t)??[]];return e.matches?.(t)&&r.unshift(e),r}#O(e){return"before"===e?"beforebegin":"after"===e?"afterend":"prepend"===e?"afterbegin":"append"===e?"beforeend":e}#L(e,t){let r=[];return this.#g(e,t,void 0,(e,t)=>{e?.split(/\s*,\s*/).includes("this")&&r.push(t)}),r}#g(e,t,r,i){let s=t,n=(t=this.#k(this.#p(t)))+this.#k(":append"),a=t+(this.config.implicitInheritance?"":this.#k(":inherited")),o=t+this.#k(":inherited:append");if(e.hasAttribute(t)){let r=e.getAttribute(t);return i?i(r,e):r}if(e.hasAttribute(a)){let t=e.getAttribute(a);return i?i(t,e):t}if(e.hasAttribute(n)||e.hasAttribute(o)){let t=e.getAttribute(n)||e.getAttribute(o),r=e.parentNode?.closest?.(`[${CSS.escape(a)}],[${CSS.escape(o)}]`);if(i&&i(t,e),r){let e=this.#g(r,s,void 0,i);return e?(e+","+t).replace(/[{}]/g,""):t}return t}let l=e.parentNode?.closest?.(`[${CSS.escape(a)}],[${CSS.escape(o)}]`);if(l){let r=this.#g(l,s,void 0,i);return!i&&r&&this.config.implicitInheritance&&this.#R(e,"htmx:after:implicitInheritance",{elt:e,name:t,parent:l}),r}return r}#j(e){if(!e)return{};if("{"===e[0])return JSON.parse(e);return[...e.matchAll(/(?:"([^"]+)"|([^\s,:]+))(?:\s*:\s*(?:"([^"]*)"|'([^']*)'|<([^>]+)\/>|([^\s,]+)))?(?=\s|,|$)/g)].reduce((e,t)=>{let r=(t[1]??t[2]).split("."),i=(t[3]??t[4]??t[5]??t[6]??"true").trim();return"true"===i?i=!0:"false"===i?i=!1:/^\d+$/.test(i)&&(i=parseInt(i)),r.some(e=>this.#V(e))||(r.slice(0,-1).reduce((e,t)=>e[t]??={},e)[r.at(-1)]=i),e},{})}#V(e){return"#proto#"===e||"constructor"===e||"prototype"===e}#N(e,t){let r=this.#j(e);for(let e in r){if(this.#V(e))continue;let i=r[e];i&&"object"==typeof i&&!Array.isArray(i)&&t[e]?Object.assign(t[e],i):t[e]=i}return t}#b(e){return e.split(",").map(e=>{let t=e.match(/^\s*(\S+\[[^\]]*\]|\S+)\s*(.*?)\s*$/);if(!t||!t[1])return null;if(t[1].includes("[")&&!t[1].includes("]"))throw"unterminated:"+t[1];let r=t[2]?this.#j(t[2]):{};return r.name=t[1],r}).filter(e=>e)}#x(e,t){if(this.#P(e))return this.#B(e,t);{let t=this.#g(e,"hx-method")||"GET",r=this.#g(e,"hx-action");if(!r)for(let i of this.#l){let s=this.#g(e,"hx-"+i);if(null!=s){r=s,t=i;break}}return t=t.toUpperCase(),{action:r,method:t}}}#B(e,t){if(e.matches("a"))return{action:e.getAttribute("href"),method:"GET"};return{action:t.submitter?.getAttribute?.("formAction")||e.getAttribute("action"),method:(t.submitter?.getAttribute?.("formMethod")||e.getAttribute("method")||"GET").toUpperCase()}}#q(e){return e._htmx||(e._htmx={listeners:[],triggerSpecs:[]},e.setAttribute("data-htmx-powered","true")),e._htmx}#$(e){if(this.#_(e)&&this.#T(e,"htmx:before:init",{},!0)){let t=this.#q(e);t.initialized=!0,t.eventHandler=this.#D(e),this.#F(e),this.#z(e),this.#T(e,"htmx:after:init",{},!0)}}#D(e){return async t=>{try{let r=this.#y(e,t);await this.#U(r)}catch(e){console.error(e)}}}#y(e,t){let{action:r,method:i}=this.#x(e,t),[s,n]=(r||"").split("#"),a=new AbortController,o={sourceElement:e,sourceEvent:t,status:"created",select:this.#g(e,"hx-select"),selectOOB:this.#g(e,"hx-select-oob"),target:this.#g(e,"hx-target"),swap:this.#g(e,"hx-swap")??this.config.defaultSwap,push:this.#g(e,"hx-push-url"),replace:this.#g(e,"hx-replace-url"),transition:this.config.transitions,confirm:this.#g(e,"hx-confirm"),request:{validate:"true"===this.#g(e,"hx-validate",!e.matches("form")||e.noValidate||t.submitter?.formNoValidate?"false":"true"),action:s,anchor:n,method:i,headers:this.#W(e),abort:a.abort.bind(a),credentials:"same-origin",signal:a.signal,mode:this.config.mode}};e._htmx?.boosted&&this.#N(e._htmx.boosted,o),o.target=this.#Q(e,o.target);let l=this.#g(e,"hx-config");return l&&this.#N(l,o.request),o}#J(e){return`${e.tagName.toLowerCase()}${e.id?"#"+e.id:""}`}#W(e){let t={"HX-Request":"true","HX-Source":this.#J(e),"HX-Current-URL":location.href,Accept:"text/html"};return this.#P(e)&&(t["HX-Boosted"]="true"),t}#G(e,t){return this.#S(e,"hx-headers",e=>{for(let r in e)t[r]=String(e[r])})}#Q(e,t){return t instanceof Element?t:null!=t?this.#X(e,t,"hx-target"):this.#P(e)?document.body:e}#P(e){return e?._htmx?.boosted}async#U(e){let t=e.sourceElement,r=e.sourceEvent;if(!t.isConnected)return;if(this.#K(r))return;this.#Y(r)&&r.preventDefault();let i=/GET|DELETE/.test(e.request.method),s=i?t.matches("form")?t:null:t.form||t.closest("form"),n=this.#v(t,s,r.submitter,e.request.validate);if(!n)return;let a=this.#S(t,"hx-vals",t=>{e.vals=t;for(let e in t)n.set(e,t[e])});if(a&&await a,e.values)for(let t in e.values)n.delete(t),n.append(t,e.values[t]);let o=this.#G(t,e.request.headers);if(o&&await o,e.request.headers["HX-Request-Type"]=e.target===document.body||e.select?"full":"partial",e.target&&(e.request.headers["HX-Target"]=this.#J(e.target)),Object.assign(e.request,{form:s,submitter:r.submitter,body:n}),!this.#T(t,"htmx:config:request",{ctx:e}))return;if(!this.#l.includes(e.request.method.toLowerCase()))return;let l=this.#Z(e.request.action);if(null!=l){let t=Object.fromEntries(e.request.body);return void await this.#ee(e.sourceElement,t,l,!1)}if(i){let t=new URL(e.request.action,document.baseURI);for(let r of e.request.body.keys())t.searchParams.delete(r);for(let[r,i]of e.request.body)t.searchParams.append(r,i);t.origin===location.origin?e.request.action=t.pathname+t.search:e.request.action=t.href,e.request.body=null}else"multipart/form-data"!==this.#g(t,"hx-encoding")&&(e.request.body=new URLSearchParams(e.request.body));await this.#te(e)}async#te(e){let t=e.sourceElement,r=this.#re(t),i=this.#ie(t);if(!i.issue(e,r))return;e.status="issuing";let s=[],n=[];try{if(e.confirm){if(!await new Promise(r=>{let i={ctx:e,issueRequest:()=>r(!0),dropRequest:()=>r(!1)};if(this.#T(t,"htmx:confirm",i)){let i=this.#Z(e.confirm);r(i?this.#ee(t,{},i,!0):window.confirm(e.confirm))}}))return}if(this.#se(e),s=this.#ne(t),n=this.#ae(t),e.fetch||=window.fetch.bind(window),!this.#T(t,"htmx:before:request",{ctx:e}))return;let r=await e.fetch(e.request.action,e.request);if(e.response={raw:r,status:r.status,headers:r.headers},this.#oe(e),!this.#T(t,"htmx:before:response",{ctx:e}))return;if(e.text=await r.text(),!this.#T(t,"htmx:after:request",{ctx:e}))return;if(this.#le(e))return void(e.keepIndicators=!0);"issuing"===e.status&&(e.hx.retarget&&(e.target=e.hx.retarget),e.hx.reswap&&(e.swap=e.hx.reswap),e.hx.reselect&&(e.select=e.hx.reselect),e.status="response received",this.#he(e),await this.swap(e),e.status="swapped")}catch(r){e.status="error: "+r,this.#T(t,"htmx:error",{ctx:e,error:r})}finally{clearTimeout(e.requestTimeout),this.#T(t,"htmx:finally:request",{ctx:e}),e.keepIndicators||(this.#ue(s),this.#ce(n)),i.finish(),i.more()&&this.#te(i.next())}}#oe(e){e.hx={};for(let[t,r]of e.response.raw.headers)t.toLowerCase().startsWith("hx-")&&(e.hx[t.slice(3).toLowerCase().replace(/-/g,"")]=r)}#le(e){if(e.hx.trigger&&this.#de(e.hx.trigger,e.sourceElement),"true"===e.hx.refresh)return location.reload(),!0;if(e.hx.redirect)return location.href=e.hx.redirect,!0;if(e.hx.location){let t=e.hx.location,r={};return("{"===t[0]||/[\s,]/.test(t))&&(r=this.#j(t),t=r.path,delete r.path),r.push=r.push||"true",this.ajax("GET",t,r),!0}}#se(e){let t=null!=e.request.timeout?this.parseInterval(e.request.timeout):this.config.defaultTimeout;t&&(e.requestTimeout=setTimeout(()=>e.request?.abort?.(),t))}#re(e){let t=this.#g(e,"hx-sync");return t?t.split(":").pop():"queue first"}#ie(t){let r=this.#g(t,"hx-sync"),i=t;if(r&&r.includes(":")){let e=r.split(":")[0];i=this.#X(t,e,"hx-sync")||t}return i._htmxRequestQueue||=new e}#K(e){return"click"===e.type&&(e.ctrlKey||e.metaKey||e.shiftKey)}#Y(e){let t=e.currentTarget;if("submit"===e.type&&"FORM"===t?.tagName)return!0;if(!("click"===e.type&&0===e.button))return!1;let r=t?.closest?.('button, input[type="submit"], input[type="image"]'),i=r?.form||r?.closest("form");if(r&&!r.disabled&&i&&("submit"===r.type||"image"===r.type||!r.type&&"BUTTON"===r.tagName))return!0;let s=t?.closest?.("a");if(!s||!s.href)return!1;let n=s.getAttribute("href");return!(n&&n.startsWith("#")&&n.length>1)}#F(e,t=e._htmx.eventHandler){let r=this.#g(e,"hx-trigger");r||(r=e.matches("form")?"submit":e.matches("input:not([type=button]):not([type=submit]),select,textarea")?"change":"click"),this.#A(e,r,t)}#A(e,t,r){let i=this.#b(t);this.#q(e).triggerSpecs.push(...i);for(let t of i){t.handler=r,t.listeners=[],t.values=new WeakMap;let[i,s]=this.#fe(t.name);if(t.once){let e=t.handler;t.handler=r=>{e(r);for(let e of t.listeners)e.fromElt.removeEventListener(e.eventName,e.handler)}}if("intersect"===i||"revealed"===i){let r={};t.opts?.root&&(r.root=this.#X(e,t.opts.root)),t.opts?.threshold&&(r.threshold=parseFloat(t.opts.threshold));let s="revealed"===i;t.observer=new IntersectionObserver(r=>{for(let i=0;i{clearTimeout(t.timeout),t.timeout=setTimeout(()=>e(r),this.parseInterval(t.delay))}}if(t.throttle){let e=t.handler;t.handler=r=>{t.throttled?t.throttledEvent=r:(t.throttled=!0,e(r),t.throttleTimeout=setTimeout(()=>{if(t.throttled=!1,t.throttledEvent){let e=t.throttledEvent;t.throttledEvent=null,t.handler(e)}},this.parseInterval(t.throttle)))}}if(t.target){let e=t.handler;t.handler=r=>{r.target?.matches?.(t.target)&&e(r)}}if("every"===i){let r=Object.keys(t).find(e=>"name"!==e);t.interval=setInterval(()=>{e.isConnected?this.#T(e,"every",{},!1):clearInterval(t.interval)},this.parseInterval(r))}if(t.consume){let e=t.handler;t.handler=t=>{t.stopPropagation(),e(t)}}if(s){let r=t.handler;t.handler=t=>{this.#Y(t)&&t.preventDefault(),this.#me(e,t,s)&&r(t)}}let n=[e];if(t.from&&(n=this.#pe(e,t.from)),t.changed){let e=t.handler;t.handler=r=>{let i=!1;for(let e of n)t.values.get(e)!==e.value&&(i=!0,t.values.set(e,e.value));i&&e(r)}}if("load"!==i)for(let r of n){let s={fromElt:r,eventName:i,handler:t.handler};e._htmx.listeners.push(s),t.listeners.push(s),r.addEventListener(i,t.handler)}else t.handler(new CustomEvent("load"))}}#fe(e){let t=e.match(/^([^\[]*)\[([^\]]*)]/);return t?[t[1],t[2]]:[e,null]}#de(e,t){if("{"===e[0]){let r=this.#j(e);for(let e in r){let i=r[e],s=t;i?.target&&(s=this.find(i.target)),this.trigger(s,e,"object"==typeof i?i:{value:i})}}else e.split(",").forEach(e=>this.trigger(t,e.trim(),{}))}#ge(e){let t={},r=Object.getPrototypeOf(this);for(let i of Object.getOwnPropertyNames(r))"constructor"!==i&&"function"==typeof this[i]&&(["find","findAll"].includes(i)?t[i]=(t,r)=>void 0===r?this[i](e,t):this[i](t,r):t[i]=this[i].bind(this));return t}async#ee(e,t,r,i=!0){let s={};Object.assign(s,this.#ge(e)),Object.assign(s,t);let n=Object.keys(s),a=Object.values(s),o=new(0,Object.getPrototypeOf(async function(){}).constructor)(...n,i?`return (${r})`:r);return await o.call(e,...a)}#me(e,t,r){let i={};Object.assign(i,this.#ge(e));for(let e in t)i[e]=t[e];let s=Object.keys(i),n=Object.values(i);return new Function(...s,`return (${r})`).call(e,...n)}process(e){if(!e||this.#H(e))return;if(!this.#T(e,"htmx:before:process"))return;let t=[e],r=this.#h.evaluate(e),i=null;for(;i=r.iterateNext();)t.push(i);for(let e of t)this.#H(e)||this.#be(e);for(let t of this.#I(e,this.#a))this.#$(t);for(let t of this.#I(e,this.#o))this.#xe(t);this.#T(e,"htmx:after:process")}#xe(e){let t=this.#g(e,"hx-boost");if(t&&"false"!==t&&this.#ye(e)&&this.#T(e,"htmx:before:init",{},!0)){let r=this.#q(e);r.initialized=!0,r.eventHandler=this.#D(e),r.boosted=t;let i=e.matches("a")?"click":"submit";e._htmx.listeners.push({fromElt:e,eventName:i,handler:e._htmx.eventHandler}),e.addEventListener(i,e._htmx.eventHandler),this.#T(e,"htmx:after:init",{},!0)}}#ye(e){if(this.#_(e))if("A"===e.tagName){if(""===e.target||"_self"===e.target)return!e.getAttribute("href")?.startsWith?.("#")&&this.#ve(e.href)}else if("FORM"===e.tagName)return"dialog"!==e.method&&this.#ve(e.action)}#ve(e){try{return new URL(e,window.location.href).origin===window.location.origin}catch(e){return!1}}#_(e){return!e._htmx?.initialized&&!this.#H(e)}#Se(e){if(e._htmx){this.#T(e,"htmx:before:cleanup");for(let t of e._htmx.triggerSpecs||[])t.interval&&clearInterval(t.interval),t.timeout&&clearTimeout(t.timeout),t.throttleTimeout&&clearTimeout(t.throttleTimeout),t.observer?.disconnect();for(let t of e._htmx.listeners||[])t.fromElt.removeEventListener(t.eventName,t.handler);this.#T(e,"htmx:after:cleanup")}if(e.firstChild)for(let t of e.querySelectorAll("[data-htmx-powered]"))this.#Se(t)}#Ee(e){let t=document.createElement("div");t.style.display="none",document.body.insertAdjacentElement("afterend",t);let r=e.querySelectorAll?.(`[${this.#p("hx-preserve")}]`)||[];for(let e of r){let r=document.getElementById(e.id);r&&this.#we(t,r,null)}return t}#Ce(e){for(let t of[...e.children]){let e=document.getElementById(t.id);e&&(this.#we(e.parentNode,t,e),this.#Se(e),e.remove())}e.remove()}#Ae(e){return Document.parseHTMLUnsafe?.(e)||(new DOMParser).parseFromString(e,"text/html")}#qe(e){let t=e.replace(/)/gi,'"),r="";t=t.replace(/]*)?>[\s\S]*?<\/head>/i,e=>(r=this.#Ae(e).title,""));let i,s,n=t.match(/<([a-z][^\/>\x20\t\r\n\f]*)/i)?.[1]?.toLowerCase();if("html"===n||"body"===n)for(i=this.#Ae(t),s=document.createDocumentFragment();i.body.childNodes.length>0;)s.append(i.body.childNodes[0]);else i=this.#Ae(``),s=i.querySelector("template").content;if(!r){let e=s.querySelector("title:not(svg title)");e&&(r=e.textContent,e.remove())}return this.#Te(s),{fragment:s,title:r}}#Me(e,t,r,i){let s=t.id?"#"+CSS.escape(t.id):null;"true"!==r&&r&&!r.includes(" ")&&([r,s=s]=r.split(/:(.*)/)),"true"!==r&&r||(r="outerHTML");let n=this.#Ne(r);if(s=n.target||s,n.strip??=!n.style.startsWith("outer"),!s)return;let a=[...document.querySelectorAll(s)];for(let r of a){let s=document.createDocumentFragment();s.append(t.cloneNode(!0)),e.push({type:"oob",fragment:s,target:r,swapSpec:n,sourceElement:i})}t.remove()}#He(e,t,r){let i=[];if(r)for(let s of r.split(",")){let[r,n="true"]=s.split(/:(.*)/);for(let s of e.querySelectorAll(r))this.#Me(i,s,n,t)}for(let r of e.querySelectorAll(`[${this.#p("hx-swap-oob")}]`)){let e=r.getAttribute(this.#p("hx-swap-oob"));r.removeAttribute(this.#p("hx-swap-oob")),this.#Me(i,r,e,t)}return i}#Ie(e,t,r){t?t.before(...r.childNodes):e.append(...r.childNodes)}#Ne(e){e=e.trim();let t=this.config.defaultSwap;if(e&&!/^\S*:/.test(e)){let r=e.match(/^(\S+)\s*(.*)$/);t=r[1],e=r[2]}return{style:this.#O(t),...this.#j(e)}}#Oe(e,t){let r=[];for(let i of e.querySelectorAll("template[hx]")){let e=i.getAttribute("type");if("partial"===e){let e=i.getAttribute(this.#p("hx-target"))||(i.id?"#"+CSS.escape(i.id):null);if(e){this.#Te(i.content);let s=this.#Ne(i.getAttribute(this.#p("hx-swap"))||this.config.defaultSwap);for(let n of document.querySelectorAll(e))r.push({type:"partial",fragment:i.content.cloneNode(!0),target:n,swapSpec:s,sourceElement:t.sourceElement})}}else this.#R(i,"htmx:process:"+e,{ctx:t,tasks:r});i.remove()}return r}#Le(e,t,r,i){try{null!=r&&e.setSelectionRange&&e.setSelectionRange(r,i),e.focus(t)}catch(e){}}#ke(e){let t=this.#I(e,"[autofocus]")[0];t&&this.#Le(t)}#Re(e,t){if(e.scroll){let r=e.scrollTarget?this.#je(e.scrollTarget):t;r&&("top"===e.scroll?r.scrollTop=0:"bottom"===e.scroll&&(r.scrollTop=r.scrollHeight))}if(e.show){let r=e.showTarget?this.#je(e.showTarget):t;r?.scrollIntoView("top"===e.show)}}#Ve(e){e.request?.anchor&&document.getElementById(e.request.anchor)?.scrollIntoView({block:"start",behavior:"auto"})}#Te(e){let t=this.#I(e,"script");for(let e of t){let t=document.createElement("script");for(let r of e.attributes)t.setAttribute(r.name,r.value);this.config.inlineScriptNonce&&(t.nonce=this.config.inlineScriptNonce),t.textContent=e.textContent,e.replaceWith(t)}}async swap(e){this.#Pe(e);let{fragment:t,title:r}=this.#qe(e.text);e.title=r;let i=[],s=this.#He(t,e.sourceElement,e.selectOOB),n=this.#Oe(t,e);i.push(...s,...n);let a=this.#Be(e,t,n);if(a&&i.unshift(a),!this.#T(e.sourceElement,"htmx:before:swap",{ctx:e,tasks:i}))return;let o=[],l=[];for(let t of i)t.swapSpec?.transition??a?.transition??e.transition?l.push(t):o.push(this.#E(t));if(l.length>0){let e=async()=>{for(let e of l)await this.#E(e,!1)};o.push(this.#$e(e))}await Promise.all(o),this.#T(e.sourceElement,"htmx:after:swap",{ctx:e}),e.title&&!a?.swapSpec?.ignoreTitle&&(document.title=e.title),this.#Ve(e)}#Be(e,t,r){let i=this.#Ne(e.swap||this.config.defaultSwap);if("delete"===i.style||t.childElementCount>0||/\S/.test(t.textContent)||!r.length){if(e.select){let r=t.querySelectorAll(e.select);(t=document.createDocumentFragment()).append(...r)}return this.#P(e.sourceElement)&&(i.show||="top"),{type:"main",fragment:t,target:this.#Q(e.sourceElement||document.body,i.target||e.target),swapSpec:i,sourceElement:e.sourceElement,transition:e.transition&&!1!==i.transition}}}async#E(e,t=!0){let{target:r,swapSpec:i,fragment:s}=e;if("string"==typeof r&&(r=document.querySelector(r)),!r)return;"string"==typeof i&&(i=this.#Ne(i));let n,a=i.style;if("none"===a)return;if(i.strip&&s.firstElementChild&&(s=document.createDocumentFragment(),s.append(...(e.fragment.firstElementChild.content||e.fragment.firstElementChild).childNodes)),this.#_e(r,"htmx-swapping"),t&&e.swapSpec?.swap&&await this.timeout(e.swapSpec?.swap),"delete"===a)return void(r.parentNode&&(this.#Se(r),r.parentNode.removeChild(r)));let o=[],l=i.settle??this.config.defaultSettleDelay,h=r.parentNode;if("innerHTML"===a||"outerHTML"===a&&h){let e=document.activeElement;if(e?.id){let t,r;try{t=e.selectionStart,r=e.selectionEnd}catch(e){}n={elt:e,start:t,end:r}}o=t&&l?this.#De(s,r):[]}let u=this.#Ee(s),c=[...s.childNodes];try{if("innerHTML"===a){for(const e of r.children)this.#Se(e);r.replaceChildren(...s.childNodes)}else if("textContent"===a){for(const e of r.querySelectorAll("[data-htmx-powered]"))this.#Se(e);r.textContent=s.textContent}else if("outerHTML"===a)h&&(this.#Ie(h,r,s),this.#Se(r),h.removeChild(r));else if("innerMorph"===a)this.#w(r,s,!0),c=[...r.childNodes];else if("outerMorph"===a)this.#w(r,s,!1),c.push(r);else if("beforebegin"===a)h&&this.#Ie(h,r,s);else if("afterbegin"===a)this.#Ie(r,r.firstChild,s);else if("beforeend"===a)this.#Ie(r,null,s);else if("afterend"===a)h&&this.#Ie(h,r.nextSibling,s);else{let e=this.#r.get("handle_swap")||[],t=!1;for(const n of e){let e=n(a,r,s,i);if(e){t=!0,Array.isArray(e)&&(c=e);break}}if(!t)throw new Error(`Unknown swap style: ${a}`)}}finally{this.#Fe(r,"htmx-swapping")}if(this.#Ce(u),n&&!n.elt.matches(":focus")){let e=document.getElementById(n.elt.id);if(e){let t={preventScroll:void 0!==i.focusScroll?!i.focusScroll:!this.config.defaultFocusScroll};this.#Le(e,t,n.start,n.end)}}this.#T(r,"htmx:before:settle",{task:e,newContent:c,settleTasks:o});for(const e of c)this.#_e(e,"htmx-added");if(t&&o.length>0){this.#_e(r,"htmx-settling"),await this.timeout(l);for(let e of o)e();this.#Fe(r,"htmx-settling")}this.#T(r,"htmx:after:settle",{task:e,newContent:c,settleTasks:o});for(const e of c)this.#Fe(e,"htmx-added"),this.process(e),this.#ke(e);this.#Re(i,r)}#T(e,t,r={},i=!0){return this.config.logAll&&console.log(t,r,e),e=this.#ze(e),this.#R(e,t,r),this.trigger(e,this.#k(t),r,i)}#R(e,t,r={}){let i=this.#r.get(t.replace(/:/g,"_"));if(i){r.cancelled=!1;for(const t of i)if(!1===t(e,r)||r.cancelled)return r.cancelled=!0,!1}return!0}timeout(e){if((e=this.parseInterval(e))>0)return new Promise(t=>setTimeout(t,e))}forEvent(e,t,r=document){return new Promise((i,s)=>{let n=e=>{clearTimeout(a),i(e)},a=t&&setTimeout(()=>{r.removeEventListener(e,n),i(null)},t);r.addEventListener(e,n,{once:!0})})}onLoad(e){this.on(this.#k("htmx:after:process"),t=>{e(t.target)})}takeClass(e,t,r=e.parentElement){for(let e of this.#pe(this.#ze(r),"."+t))this.#Fe(e,t);this.#_e(e,t)}on(e,t,r){let i,s=document;return void 0===r?(i=e,r=t):(s=this.#ze(e),i=t),s.addEventListener(i,r),r}find(e,t){return this.#je(e,t)}findAll(e,t){return this.#pe(e,t)}parseInterval(e){if("number"==typeof e)return e;let[,t,r]=e?.match(/^([\d.]+)(ms|s|m)?$/)||[],i=parseFloat(t)*({ms:1,s:1e3,m:6e4}[r]||1);return isNaN(i)?void 0:i}trigger(e,t,r={},i=!0){e=this.#ze(e);let s=new CustomEvent(t,{detail:r,cancelable:!0,bubbles:i,composed:!0}),n=e?.isConnected?e:document;return!r.cancelled&&n.dispatchEvent(s)}ajax(e,t,r){(!r||r instanceof Element||"string"==typeof r)&&(r={target:r});let i="string"==typeof r.source?document.querySelector(r.source):r.source;if("string"==typeof r.source&&!i)return Promise.reject(new Error("Source not found"));if(r.target){let e=this.#Q(document.body,r.target);if(!e)return Promise.reject(new Error("Target not found"));i||=e}i||=document.body;let s=this.#y(i,r.event||{});return Object.assign(s,r),r.target&&(s.target=this.#Q(document.body,r.target)),Object.assign(s.request,{action:t,method:e.toUpperCase()}),r.headers&&Object.assign(s.request.headers,r.headers),this.#U(s)}#M(){this.config.history&&(history.state||history.replaceState({htmx:!0},"",location.href),window.addEventListener("popstate",e=>{e.state&&e.state.htmx&&(this.#c?.abort(),this.#Ue())}))}#We(e){this.config.history&&(history.pushState({htmx:!0},"",e),this.#T(document,"htmx:after:history:push",{path:e}))}#Qe(e){this.config.history&&(history.replaceState({htmx:!0},"",e),this.#T(document,"htmx:after:history:replace",{path:e}))}#Ue(e){e=e||location.pathname+location.search,this.#T(document,"htmx:before:history:restore",{path:e,cacheMiss:!0})&&("reload"===this.config.history?location.reload():(this.#c=new AbortController,this.ajax("GET",e,{target:"body",swap:"innerHTML",request:{headers:{"HX-History-Restore-Request":"true"},signal:this.#c.signal}})))}#Je(e){let{sourceElement:t,push:r,replace:i,hx:s,response:n}=e;if((s?.pushurl||s?.replaceurl)&&(r=s.pushurl,i=s.replaceurl),null==r&&null==i&&this.#P(t)&&(r="true"),"false"!==r&&!1!==r||(r=null),"false"!==i&&!1!==i||(i=null),!r&&!i)return null;let a=r||i;if("true"===a){let t=n?.raw?.url||e.request.action,r=new URL(t,location.href);a=r.pathname+r.search+(e.request.anchor?"#"+e.request.anchor:"")}return{type:r?"push":"replace",path:a}}#Pe(e){let t=this.#Je(e);if(!t)return;let r={history:t,sourceElement:e.sourceElement,response:e.response};this.#T(document,"htmx:before:history:update",r)&&("push"===t.type?this.#We(t.path):this.#Qe(t.path),this.#T(document,"htmx:after:history:update",r))}#be(e){let t=this.#k(this.#p("hx-on:"));for(let r of e.getAttributeNames())if(r.startsWith(t)){let i=r.substring(t.length),s=e.getAttribute(r),n=async t=>{try{await this.#ee(e,{event:t},s,!1)}catch(e){console.error(e)}};e.addEventListener(i,n),this.#q(e).listeners.push({fromElt:e,eventName:i,handler:n})}}#ne(e){let t,r=this.#g(e,"hx-indicator");t=r?this.#pe(e,r,"hx-indicator"):[e];for(const e of t)e._htmxReqCount||=0,e._htmxReqCount++,this.#_e(e,this.config.requestClass);return t}#ue(e){for(let t of e)t._htmxReqCount&&(t._htmxReqCount--,t._htmxReqCount<=0&&(this.#Fe(t,this.config.requestClass),delete t._htmxReqCount))}#ae(e){let t=this.#g(e,"hx-disable"),r=[];if(t){r=this.#pe(e,t,"hx-disable");for(let e of r)e._htmxDisableCount||=0,e._htmxDisableCount++,e.disabled=!0}return r}#ce(e){for(const t of e)t._htmxDisableCount&&(t._htmxDisableCount--,t._htmxDisableCount<=0&&(t.disabled=!1,delete t._htmxDisableCount))}#v(e,t,r,i){if(i&&t&&!t.reportValidity())return;let s=t?new FormData(t):new FormData,n=t?new Set(t.elements):new Set;if(!t&&e.name){if(i&&e.reportValidity&&!e.reportValidity())return;s.append(e.name,e.value),n.add(e)}r&&r.name&&(s.append(r.name,r.value),n.add(r));let a=this.#g(e,"hx-include");if(a)for(let t of this.#pe(e,a)){if(i&&t.reportValidity&&!t.reportValidity())return;this.#Ge(t,n,s)}return s}#Ge(e,t,r){let i=this.#I(e,"input:not([disabled]), select:not([disabled]), textarea:not([disabled])");for(let e of i){if(!e.name||t.has(e))continue;t.add(e);let i=e.type;if("checkbox"===i||"radio"===i)e.checked&&r.append(e.name,e.value);else if("file"===i)for(let t of e.files)r.append(e.name,t);else if("select-multiple"===i)for(let t of e.selectedOptions)r.append(e.name,t.value);else e.matches("select, textarea, input")&&r.append(e.name,e.value)}}#S(e,t,r){let i=this.#g(e,t);if(!i)return null;let s=this.#Z(i);if(s)return 0!==s.indexOf("{")&&(s="{"+s+"}"),this.#ee(e,{},s,!0).then(e=>{r(e)});r(this.#j(i))}#Xe(e){let t=e.trim();return t.startsWith("<")&&t.endsWith("/>")?t.slice(1,-2):t}#pe(e,t,r,i){let s=t??e,n=t?this.#ze(e):document;if(s.startsWith("global "))return this.#pe(n,s.slice(7),r,!0);let a=s?s.replace(/<[^>]+\/>/g,e=>e.replace(/,/g,"%2C")).split(",").map(e=>e.replace(/%2C/g,",")):[],o=[],l=[];for(const e of a){let t,s=this.#Xe(e);if(s.startsWith("closest "))t=n.closest(s.slice(8));else if(s.startsWith("find "))t=n.querySelector(s.slice(5));else if(s.startsWith("findAll "))o.push(...n.querySelectorAll(s.slice(8)));else if("next"===s||"nextElementSibling"===s)t=n.nextElementSibling;else if(s.startsWith("next "))t=this.#Ke(n,s.slice(5),!!i);else if("previous"===s||"previousElementSibling"===s)t=n.previousElementSibling;else if(s.startsWith("previous "))t=this.#Ye(n,s.slice(9),!!i);else if("document"===s)t=document;else if("window"===s)t=window;else if("body"===s)t=document.body;else if("host"===s)t=n.getRootNode().host;else if("this"===s){if(r){o.push(...this.#L(n,r));continue}t=n}else l.push(s);t&&o.push(t)}if(l.length>0){let e=l.join(","),t=this.#Ze(n,!!i);o.push(...t.querySelectorAll(e))}return[...new Set(o)]}#Ke(e,t,r){return this.#et(this.#Ze(e,r).querySelectorAll(t),e,Node.DOCUMENT_POSITION_PRECEDING)}#Ye(e,t,r){let i=[...this.#Ze(e,r).querySelectorAll(t)].reverse();return this.#et(i,e,Node.DOCUMENT_POSITION_FOLLOWING)}#et(e,t,r){for(const i of e)if(i.compareDocumentPosition(t)===r)return i}#Ze(e,t){return e.isConnected&&e.getRootNode?e.getRootNode?.({composed:t}):document}#X(e,t,r){let i=this.#pe(e,t,r)[0];return i||console.warn(`htmx: '${t}' on ${r} did not match any element`),i}#je(e,t,r){return this.#pe(e,t,r)[0]}#Z(e){if(null!=e){if(e.startsWith("js:"))return e.substring(3);if(e.startsWith("javascript:"))return e.substring(11)}}#z(e){let t=()=>{this.#ie(e).abort()};e.addEventListener("htmx:abort",t),e._htmx.listeners.push({fromElt:e,eventName:"htmx:abort",handler:t})}#w(e,t,r){let{persistentIds:i,idMap:s}=this.#tt(e,t),n=document.createElement("div");n.hidden=!0,document.body.after(n);let a={target:e,idMap:s,persistentIds:i,pantry:n,futureMatches:new WeakSet};r?this.#rt(a,e,t):this.#rt(a,e.parentNode,t,e,e.nextSibling),this.#Se(n),n.remove()}#rt(e,t,r,i=null,s=null){t instanceof HTMLTemplateElement&&r instanceof HTMLTemplateElement&&(t=t.content,r=r.content),i||=t.firstChild;let n=r.firstChild;for(;n;){let r;if(i&&i!=s&&(r=this.#it(e,n,i,s),r&&r!==i)){let a=i;for(;a&&a!==r;){let r=a;a=a.nextSibling,r instanceof Element&&(e.idMap.has(r)||this.#st(e,r,n))?this.#we(t,r,s):this.#nt(e,r)}}if(!r&&n instanceof Element&&e.persistentIds.has(n.id)){let s=CSS.escape(n.id);r=e.target.id===n.id&&e.target||e.target.querySelector(`[id="${s}"]`)||e.pantry.querySelector(`[id="${s}"]`);let a=r;for(;a=a.parentNode;){let t=e.idMap.get(a);t&&(t.delete(r.id),t.size||e.idMap.delete(a))}this.#we(t,r,i)}if(r){this.#at(r,n,e),i=r.nextSibling,n=n.nextSibling;continue}let a=n.nextSibling;if(e.idMap.has(n)){let r=document.createElement(n.tagName);t.insertBefore(r,i),this.#at(r,n,e),i=r.nextSibling}else t.insertBefore(n,i),i=n.nextSibling;n=a}for(;i&&i!=s;){let t=i;i=i.nextSibling,this.#nt(e,t)}}#st(e,t,r){if(e.futureMatches.has(t))return!0;for(let i=r.nextSibling,s=0;i&&so.has(e)))return h;if(!r){if(a>0&&h.isEqualNode(t))return h;s||(s=h)}}if(n+=r?.size||0,n>l)break;if(h.contains(document.activeElement))break;if(--a<1&&0===l)break;h=h.nextSibling}return s&&this.#st(e,s,t)?null:s}#C(e,t){return e instanceof Element&&e.tagName===t.tagName&&(!("SCRIPT"===e.tagName&&!e.isEqualNode(t))&&(!(!e._x_bindings?.id||!t.matches?.("[\\:id], [x-bind\\:id]"))||(!e.id||e.id===t.id)))}#nt(e,t){e.idMap.has(t)?this.#we(e.pantry,t,null):(this.#Se(t),t.remove())}#we(e,t,r){if(e.moveBefore)try{return void e.moveBefore(t,r)}catch(e){}e.insertBefore(t,r)}#at(e,t,r){if(this.config.morphSkip&&e.matches?.(this.config.morphSkip))return;if(!this.#R(e,"htmx:before:morph:node",{oldNode:e,newNode:t}))return;this.#ot(e,t),e instanceof HTMLTextAreaElement&&e.defaultValue!=t.defaultValue&&(e.value=t.value),this.config.morphSkipChildren&&e.matches?.(this.config.morphSkipChildren)||e.isEqualNode(t)&&"TEMPLATE"!==t.tagName&&!t.querySelector?.("template")||this.#rt(r,e,t)}#ot(e,t){let r=this.config.morphIgnore||[];for(const i of t.attributes)r.includes(i.name)||e.getAttribute(i.name)===i.value||(e.setAttribute(i.name,i.value),"value"===i.name&&e instanceof HTMLInputElement&&"file"!==e.type&&(e.value=i.value));for(let i=e.attributes.length-1;i>=0;i--){let s=e.attributes[i];!s||t.hasAttribute(s.name)||r.includes(s.name)||e.removeAttribute(s.name)}}#lt(e,t,r,i){for(const s of i)if(t.has(s.id)){let t=s;for(;t&&t!==r;){let r=e.get(t);null==r&&(r=new Set,e.set(t,r)),r.add(s.id),t=t.parentElement}}}#tt(e,t){let r=this.#I(e,"[id]"),i=t.querySelectorAll("[id]"),s=this.#ht(r,i),n=new Map;return this.#lt(n,s,e.parentElement,r),this.#lt(n,s,t,i),{persistentIds:s,idMap:n}}#ht(e,t){let r=new Set,i=new Map;for(const{id:t,tagName:s}of e)i.has(t)?r.add(t):t&&i.set(t,s);let s=new Set;for(const{id:e,tagName:n}of t)s.has(e)?r.add(e):i.get(e)===n&&s.add(e);for(const e of r)s.delete(e);return s}#he(e){let t=e.response.raw.status,r=this.config.noSwap.map(e=>e+""),i=t+"";for(let t of[i,i.slice(0,2)+"x",i[0]+"xx"]){if(r.includes(t))return void(e.swap="none");let i=this.#g(e.sourceElement,this.#k("hx-status:")+t);if(i)return void this.#N(i,e)}}#$e(e){return new Promise(t=>{this.#u||=[],this.#u.push({task:e,resolve:t}),this.#d||this.#ut()})}async#ut(){if(0===this.#u.length||this.#d)return;this.#d=!0;let{task:e,resolve:t}=this.#u.shift();try{document.startViewTransition?(this.#T(document,"htmx:before:viewTransition",{task:e}),await document.startViewTransition(e).finished,this.#T(document,"htmx:after:viewTransition",{task:e})):await e()}catch(e){}finally{this.#d=!1,t(),this.#ut()}}#De(e,t){let r=t.querySelectorAll("[id]"),i=Object.fromEntries([...r].map(e=>[e.id,e])),s=e.querySelectorAll("[id]"),n=[];for(let e of s){let t=i[e.id];if(t?.tagName===e.tagName){let r=e.cloneNode(!1);this.#ot(e,t),n.push(()=>{this.#ot(e,r)})}}return n}#_e(e,t){e?.classList?.add?.(t)}#Fe(e,t){e?.classList?.remove?.(t),0===e?.classList?.length&&e.removeAttribute("class")}#ze(e){return"string"==typeof e?this.find(e):e}#k(e){return this.config.metaCharacter?e.replace(/:/g,this.config.metaCharacter):e}}})(); \ No newline at end of file +var htmx=(()=>{class e{#e=null;#t=[];issue(e,t){return e.queueStrategy=t,this.#e?"replace"===t||"abort"!==t&&"abort"===this.#e.queueStrategy?(this.#t.forEach(e=>e.status="dropped"),this.#t=[],this.#e.request?.abort?.(),this.#e=e,!0):("queue all"===t?(this.#t.push(e),e.status="queued"):"drop"===t?e.status="dropped":"queue last"===t?(this.#t.forEach(e=>e.status="dropped"),this.#t=[e],e.status="queued"):0===this.#t.length&&"abort"!==t?(this.#t.push(e),e.status="queued"):e.status="dropped",!1):(this.#e=e,!0)}finish(){this.#e=null}next(){return this.#t.shift()}abort(){this.#e?.request?.abort?.()}more(){return this.#t?.length}}return new class{#r=new Map;#i="";#s=new Set;#n;#o=Function;#a=Object.getPrototypeOf(async function(){}).constructor;#l={createHTML:e=>e,createScript:e=>e};#h;#c="a,form";#u=["get","post","put","patch","delete"];#d;#f;#m;#p;constructor(){this.#g(),this.#x(),this.#h=this.#b("[hx-action],[hx-get],[hx-post],[hx-put],[hx-patch],[hx-delete]"),this.#d=(new XPathEvaluator).createExpression(`.//*[@*[${this.#y("hx-on").map(e=>`starts-with(name(), "${e}")`).join(" or ")}]]`),this.#n={attributeValue:this.#S.bind(this),parseTriggerSpecs:this.#v.bind(this),determineMethodAndAction:this.#E.bind(this),createRequestContext:this.#w.bind(this),collectFormData:this.#C.bind(this),getAttributeObject:this.#A.bind(this),insertContent:this.#q.bind(this),morph:this.#T.bind(this),isSoftMatch:this.#N.bind(this),initSecurity:(e,t,r)=>{e&&(this.#l=e),t&&(this.#o=t),r&&(this.#a=r)},onTrigger:this.#M.bind(this),htmxProp:this.#I.bind(this),triggerHtmxEvent:this.#H.bind(this),executeJavaScript:this.#O.bind(this)};let e=()=>{this.#L(),this.process(document.body)};"loading"===document.readyState?document.addEventListener("DOMContentLoaded",e):setTimeout(e)}#g(){this.version="4.0.0-beta4",this.config={logAll:!1,prefix:"data-hx-",transitions:!1,history:!0,mode:"same-origin",defaultSwap:"innerHTML",defaultFocusScroll:!1,indicatorClass:"htmx-indicator",requestClass:"htmx-request",includeIndicatorCSS:!0,defaultTimeout:6e4,extensions:"",morphIgnore:["data-htmx-powered"],morphScanLimit:10,noSwap:[204,304],implicitInheritance:!1,defaultSettleDelay:1};let e=document.querySelector('meta[name="htmx-config"]');e&&this.#P(e.content,this.config),this.#i=this.config.extensions}#x(){if(!1!==this.config.includeIndicatorCSS){let e=this.config.indicatorClass,t=this.config.requestClass,r=new CSSStyleSheet;r.replaceSync(`.${e}{opacity:0;visibility: hidden} .${t} .${e}, .${t}.${e}{opacity:1;visibility: visible;transition: opacity 200ms ease-in}`),document.adoptedStyleSheets=[...document.adoptedStyleSheets,r]}}registerExtension(e,t){return!(this.#i&&!this.#i.split(/,\s*/).includes(e))&&(!this.#s.has(e)&&(this.#s.add(e),t.init&&t.init(this.#n),void Object.entries(t).forEach(([e,t])=>{this.#r.get(e)?.push(t)||this.#r.set(e,[t])})))}#k(e){let t=this.config.prefix;return!e.closest||null!=e.closest("[hx-ignore]")||t&&null!=e.closest(`[${t}ignore]`)}#V(e,t){let r=this.config.prefix;return e.getAttribute(t)??(r?e.getAttribute(t.replace("hx-",r)):null)}#R(e,t){let r=this.config.prefix&&t.replace("hx-",this.config.prefix);return e.hasAttribute(t)?t:r&&e.hasAttribute(r)?r:null}#b(e){return this.#y(e).join(",")}#y(e){let t=[e];return this.config.prefix&&t.push(e.replaceAll("hx-",this.config.prefix)),t}#j(e,t){let r=[...e.querySelectorAll?.(t)??[]];return e.matches?.(t)&&r.unshift(e),r}#B(e){return"before"===e?"beforebegin":"after"===e?"afterend":"prepend"===e?"afterbegin":"append"===e?"beforeend":e}#F(e,t){let r=[];return this.#S(e,t,void 0,(e,t)=>{e?.split(/\s*[,:]\s*/).includes("this")&&r.push(t)}),r}#S(e,t,r,i){t=this.#$(t);let s=this.#$(":inherited"),n=this.#$(":append"),o=this.#V(e,t)??this.#V(e,t+s);if(null!=o)return i?i(o,e):o;let a=CSS.escape(this.config.implicitInheritance?t:t+s),l=CSS.escape(t+s+n),h=this.#b(`[${a}],[${l}]`),c=this.#R(e,t+n)??this.#R(e,t+s+n);if(c){let r=e.getAttribute(c),s=e.parentNode?.closest?.(h);if(i&&i(r,e),s){let e=this.#S(s,t,void 0,i);return e?(e+","+r).replace(/[{}]/g,""):r}return r}let u=e.parentNode?.closest?.(h);return u?(o=this.#S(u,t,void 0,i),!i&&o&&this.config.implicitInheritance&&this.#D(e,"htmx:after:implicitInheritance",{elt:e,name:t,parent:u}),o):r}#U(e){if(!e)return{};if("{"===e[0])return JSON.parse(e);return[...e.matchAll(/(?:"([^"]+)"|([^\s,:]+))(?:\s*:\s*(?:"([^"]*)"|'([^']*)'|<([^>]+)\/>|([^\s,]+)))?(?=\s|,|$)/g)].reduce((e,t)=>{let r=(t[1]??t[2]).split("."),i=(t[3]??t[4]??t[5]??t[6]??"true").trim();return"true"===i?i=!0:"false"===i?i=!1:/^\d+$/.test(i)&&(i=parseInt(i)),r.some(e=>this.#W(e))||(r.slice(0,-1).reduce((e,t)=>e[t]??={},e)[r.at(-1)]=i),e},{})}#W(e){return"#proto#"===e||"constructor"===e||"prototype"===e}#P(e,t){let r=this.#U(e);for(let e in r){if(this.#W(e))continue;let i=r[e];i&&"object"==typeof i&&!Array.isArray(i)&&t[e]?Object.assign(t[e],i):t[e]=i}return t}#v(e){return e.split(/,(?![^\[]*\])/).flatMap(e=>{let[,t,r]=e.match(/^\s*(\S+\[[^\]]*\]|\S+)\s*(.*?)\s*$/)??[];if(!t)return[];if(/\[[^\]]*$/.test(t))throw"unterminated:"+t;return[{name:t,...this.#U(r)}]})}#E(e,t){if(this.#_(e))return this.#z(e,t);{let t=this.#S(e,"hx-method")||"GET",r=this.#S(e,"hx-action");if(!r)for(let i of this.#u){let s=this.#S(e,"hx-"+i);if(null!=s){r=s,t=i;break}}return t=t.toUpperCase(),{action:r,method:t}}}#z(e,t){if(e.matches("a"))return{action:e.getAttribute("href"),method:"GET"};return{action:t.submitter?.getAttribute?.("formAction")||e.getAttribute("action"),method:(t.submitter?.getAttribute?.("formMethod")||e.getAttribute("method")||"GET").toUpperCase()}}#I(e){return e._htmx||(e._htmx={listeners:[],triggerSpecs:[]},e.setAttribute("data-htmx-powered","true")),e._htmx}#Q(e){if(this.#J(e)&&this.#H(e,"htmx:before:init",{},!0)){let t=this.#I(e);t.initialized=!0,t.eventHandler=this.#X(e),this.#G(e),this.#K(e),this.#H(e,"htmx:after:init",{},!0)}}#X(e){return async t=>{try{let r=this.#w(e,t);await this.#Y(r)}catch(t){this.#H(e,"htmx:error",{error:t})}}}#w(e,t){let{action:r,method:i}=this.#E(e,t),[s,n]=(r||"").split("#"),o=new AbortController,a={sourceElement:e,sourceEvent:t,status:"created",select:this.#S(e,"hx-select"),selectOOB:this.#S(e,"hx-select-oob"),target:this.#S(e,"hx-target"),swap:this.#S(e,"hx-swap")??this.config.defaultSwap,push:this.#S(e,"hx-push-url"),replace:this.#S(e,"hx-replace-url"),transition:this.config.transitions,confirm:this.#S(e,"hx-confirm"),request:{validate:"true"===this.#S(e,"hx-validate",!e.matches("form")||e.noValidate||t.submitter?.formNoValidate?"false":"true"),action:s,anchor:n,method:i,headers:this.#Z(e),abort:o.abort.bind(o),credentials:"same-origin",signal:o.signal,mode:this.config.mode}};e._htmx?.boosted&&this.#P(e._htmx.boosted,a),a.target=this.#ee(e,a.target),a.request.headers["HX-Request-Type"]=a.target===document.body||a.select?"full":"partial",a.target&&(a.request.headers["HX-Target"]=this.#te(a.target));let l=this.#S(e,"hx-config");return l&&(this.#P(l,a.request),a.request.mode=this.config.mode),a}#te(e){return`${e.tagName.toLowerCase()}${e.id?"#"+encodeURI(e.id):""}`}#Z(e){let t={"HX-Request":"true","HX-Source":this.#te(e),"HX-Current-URL":location.href,Accept:"text/html"};return this.#_(e)&&(t["HX-Boosted"]="true"),t}#re(e,t){return this.#A(e,"hx-headers",e=>{for(let r in e)t[r]=String(e[r])})}#ee(e,t){return t instanceof Element?t:null!=t?this.#ie(e,t,"hx-target"):this.#_(e)?document.body:e}#_(e){return e?._htmx?.boosted}async#Y(e){let t=e.sourceElement,r=e.sourceEvent;if(!t.isConnected)return;if(this.#se(r))return;this.#ne(r)&&r.preventDefault();let i=/GET|DELETE/.test(e.request.method),s=i?t.matches("form")?t:null:t.form||t.closest("form"),n=this.#C(t,s,r.submitter,e.request.validate,i);if(!n)return;let o=this.#A(t,"hx-vals",t=>{e.vals=t;for(let e in t)n.set(e,t[e])});if(o&&await o,e.values)for(let t in e.values)n.delete(t),n.append(t,e.values[t]);let a=this.#re(t,e.request.headers);if(a&&await a,Object.assign(e.request,{form:s,submitter:r.submitter,body:n}),!this.#H(t,"htmx:config:request",{ctx:e}))return;if(!this.#u.includes(e.request.method.toLowerCase()))return;let l=this.#oe(e.request.action);if(null!=l){let t=Object.fromEntries(e.request.body);return void await this.#O(e.sourceElement,t,l,!1)}if(i){let t=new URL(e.request.action,document.baseURI);for(let r of e.request.body.keys())t.searchParams.delete(r);for(let[r,i]of e.request.body)t.searchParams.append(r,i);t.origin===location.origin?e.request.action=t.pathname+t.search:e.request.action=t.href,e.request.body=null}else"multipart/form-data"!==this.#S(t,"hx-encoding")&&(e.request.body=new URLSearchParams(e.request.body));await this.#ae(e)}async#ae(e){let t=e.sourceElement,r=this.#le(t),i=this.#he(t);if(!i.issue(e,r))return;e.status="issuing";let s=[],n=[];try{if(e.confirm){if(!await new Promise(r=>{let i={ctx:e,issueRequest:()=>r(!0),dropRequest:()=>r(!1)};if(this.#H(t,"htmx:confirm",i)){let i=this.#oe(e.confirm);r(i?this.#O(t,{},i,!0):window.confirm(e.confirm))}}))return}if(this.#ce(e),s=this.#ue(t),n=this.#de(t),e.fetch||=window.fetch.bind(window),!this.#H(t,"htmx:before:request",{ctx:e}))return;let r=await e.fetch(e.request.action,e.request);if(e.response={raw:r,status:r.status,headers:r.headers},this.#fe(e),!this.#H(t,"htmx:before:response",{ctx:e}))return;if(e.text=await r.text(),!this.#H(t,"htmx:after:request",{ctx:e}))return;if(e.response.status>=400&&this.#H(t,"htmx:response:error",{ctx:e}),this.#me(e))return void(e.keepIndicators=!0);"issuing"===e.status&&(e.hx.retarget&&(e.target=e.hx.retarget),e.hx.reswap&&(e.swap=e.hx.reswap),e.hx.reselect&&(e.select=e.hx.reselect),e.status="response received",this.#pe(e),await this.swap(e),e.status="swapped")}catch(r){e.status="error: "+r,this.#H(t,"htmx:error",{ctx:e,error:r})}finally{clearTimeout(e.requestTimeout),this.#H(t,"htmx:finally:request",{ctx:e}),e.keepIndicators||(this.#ge(s),this.#xe(n)),i.finish(),i.more()&&this.#ae(i.next())}}#fe(e){e.hx={};for(let[t,r]of e.response.raw.headers)t.toLowerCase().startsWith("hx-")&&(e.hx[t.slice(3).toLowerCase().replace(/-/g,"")]=r)}#me(e){if(e.hx.trigger&&this.#be(e.hx.trigger,e.sourceElement),"true"===e.hx.refresh)return location.reload(),!0;if(e.hx.redirect)return location.href=e.hx.redirect,!0;if(e.hx.location){let t=e.hx.location,r={};return("{"===t[0]||/[\s,]/.test(t))&&(r=this.#U(t),t=r.path,delete r.path),r.push??="true",this.ajax("GET",t,r),!0}}#ce(e){let t=null!=e.request.timeout?this.parseInterval(e.request.timeout):this.config.defaultTimeout;t&&(e.requestTimeout=setTimeout(()=>e.request?.abort?.(),t))}#le(e){let t=this.#S(e,"hx-sync");if(!t)return"queue first";let r=t.split(":").pop().trim();return/^(drop|abort|replace|queue)/.test(r)?r:"queue first"}#he(t){let r=this.#S(t,"hx-sync"),i=t;if(r){let e=r.includes(":")?r.slice(0,r.lastIndexOf(":")).trim():/^(drop|abort|replace|queue)/.test(r)?null:r;e&&(i=this.#ie(t,e,"hx-sync")||t)}return this.#I(i).rq||=new e}#se(e){return"click"===e.type&&(e.ctrlKey||e.metaKey||e.shiftKey)}#ne(e){let t=e.currentTarget;if("submit"===e.type&&"FORM"===t?.tagName)return!0;if(!("click"===e.type&&0===e.button))return!1;let r=t?.closest?.('button, input[type="submit"], input[type="image"]'),i=r?.form||r?.closest("form");if(r&&!r.disabled&&i&&("submit"===r.type||"image"===r.type||!r.type&&"BUTTON"===r.tagName))return!0;let s=t?.closest?.("a");if(!s||!s.href)return!1;let n=s.getAttribute("href");return!(n&&n.startsWith("#")&&n.length>1)}#G(e,t=e._htmx.eventHandler){let r=this.#S(e,"hx-trigger");r||(r=e.matches("form")?"submit":e.matches("input:not([type=button]):not([type=submit]),select,textarea")?"change":"click"),this.#M(e,r,t)}#M(e,t,r){let i=this.#v(t);this.#I(e).triggerSpecs.push(...i);for(let t of i){t.listeners=[];let[i,s]=this.#ye(t.name),n=[e];"outside"===t.from?n=[document]:t.from&&"self"!==t.from&&(n=this.#Se(e,t.from));let o=e=>{if((t.halt||t.prevent)&&e.preventDefault(),(t.halt||t.stop||t.consume)&&e.stopPropagation(),t.once)for(let e of t.listeners)e.fromElt.removeEventListener(e.eventName,e.handler,e);r(e)},a=o;if(t.delay?a=e=>{clearTimeout(t.timeout),t.timeout=setTimeout(()=>o(e),this.parseInterval(t.delay))}:t.throttle&&(a=e=>{t.throttled?t.throttledEvent=e:(t.throttled=!0,o(e),t.throttleTimeout=setTimeout(()=>{if(t.throttled=!1,t.throttledEvent){let e=t.throttledEvent;t.throttledEvent=null,a(e)}},this.parseInterval(t.throttle)))}),t.handler=r=>{if(("self"!==t.from||r.target===e)&&("outside"!==t.from||!e.contains(r.target))&&(!t.target||r.target?.matches?.(t.target))){if(t.changed){let e=t.values??=new WeakMap,r=!1;for(let t of n)e.get(t)!==t.value&&(r=!0,e.set(t,t.value));if(!r)return}if(s){this.#ne(r)&&r.preventDefault();let t={};for(let e in r)t[e]=r[e];if(!this.#O(e,t,s,!0,!1))return}a(r)}},"intersect"===i||"revealed"===i){let r={rootMargin:t.rootMargin};t.root&&(r.root=this.#ie(e,t.root)),t.threshold&&(r.threshold=parseFloat(t.threshold));let s="revealed"===i;t.observer=new IntersectionObserver(r=>{for(let i=0;i"name"!==e);t.interval=setInterval(()=>{e.isConnected?this.#H(e,"every",{},!1):clearInterval(t.interval)},this.parseInterval(r))}if("load"!==i)for(let r of n){let s={fromElt:r,eventName:i,handler:t.handler,capture:!!t.capture,passive:!!t.passive};e._htmx.listeners.push(s),t.listeners.push(s),r.addEventListener(i,t.handler,s)}else t.handler(new CustomEvent("load"))}}#ye(e){let t=e.match(/^([^\[]*)\[([^\]]*)]/);return t?[t[1],t[2]]:[e,null]}#be(e,t){if("{"===e[0]){let r=this.#U(e);for(let e in r){let i=r[e],s=t;i?.target&&(s=this.find(i.target)),this.trigger(s,e,"object"==typeof i?i:{value:i})}}else e.split(",").forEach(e=>this.trigger(t,e.trim(),{}))}#ve(e){let t={},r=Object.getPrototypeOf(this);for(let i of Object.getOwnPropertyNames(r))"constructor"!==i&&"function"==typeof this[i]&&(["find","findAll"].includes(i)?t[i]=(t,r)=>void 0===r?this[i](e,t):this[i](t,r):t[i]=this[i].bind(this));return t}#O(e,t,r,i=!0,s=!0){let n={};Object.assign(n,this.#ve(e));let o={};this.#D(e,"htmx:scope",{scope:o}),Object.assign(n,o),Object.assign(n,t);let a=Object.keys(n),l=Object.values(n);return new(s?this.#a:this.#o)(...a,i?`return (${r})`:r).call(e,...l)}process(e){if(!e)return;if(!(e instanceof Element)){for(let t of e.children||[])this.process(t);return}if(this.#k(e))return;if(!this.#H(e,"htmx:before:process"))return;let t=[e],r=this.#d.evaluate(e),i=null;for(;i=r.iterateNext();)t.push(i);for(let e of t)!this.#k(e)&&this.#H(e,"htmx:before:on:init",{},!0)&&this.#Ee(e);for(let t of this.#j(e,this.#h))this.#Q(t);for(let t of this.#j(e,this.#c))this.#we(t);this.#H(e,"htmx:after:process")}#we(e){let t=this.#S(e,"hx-boost");if(t&&"false"!==t&&this.#Ce(e)&&this.#H(e,"htmx:before:init",{},!0)){let r=this.#I(e);r.initialized=!0,r.eventHandler=this.#X(e),r.boosted=t;let i=e.matches("a")?"click":"submit";e._htmx.listeners.push({fromElt:e,eventName:i,handler:e._htmx.eventHandler}),e.addEventListener(i,e._htmx.eventHandler),this.#H(e,"htmx:after:init",{},!0)}}#Ce(e){if(this.#J(e))if("A"===e.tagName){if(""===e.target||"_self"===e.target)return!e.getAttribute("href")?.startsWith?.("#")&&this.#Ae(e.href)}else if("FORM"===e.tagName)return"dialog"!==e.method&&this.#Ae(e.action)}#Ae(e){try{return new URL(e,window.location.href).origin===window.location.origin}catch(e){return!1}}#J(e){return!e._htmx?.initialized&&!this.#k(e)}#qe(e){if(e._htmx){this.#H(e,"htmx:before:cleanup");for(let t of e._htmx.triggerSpecs||[])t.interval&&clearInterval(t.interval),t.timeout&&clearTimeout(t.timeout),t.throttleTimeout&&clearTimeout(t.throttleTimeout),t.observer?.disconnect();for(let t of e._htmx.listeners||[])t.fromElt.removeEventListener(t.eventName,t.handler,t);this.#H(e,"htmx:after:cleanup")}if(e.firstChild)for(let t of e.querySelectorAll("[data-htmx-powered]"))this.#qe(t)}#Te(e){let t=document.createElement("div");t.hidden=!0,document.body.insertAdjacentElement("afterend",t);let r=e.querySelectorAll?.(this.#b("[hx-preserve]"))||[];for(let e of r){let r=document.getElementById(e.id);r&&this.#Ne(t,r,null)}return t}#Me(e){for(let t of[...e.children]){let e=document.getElementById(t.id);e&&(this.#Ne(e.parentNode,t,e),this.#qe(e),e.remove())}e.remove()}#Ie(e){let t=this.#l.createHTML(e);return Document.parseHTMLUnsafe?.(t)||(new DOMParser).parseFromString(t,"text/html")}#He(e){let t=e.replace(/)/gi,'"),r="";t=t.replace(/]*)?>[\s\S]*?<\/head>/i,e=>(r=this.#Ie(e).title,""));let i,s,n=t.match(/<([a-z][^\/>\x20\t\r\n\f]*)/i)?.[1]?.toLowerCase();if("html"===n||"body"===n?(i=this.#Ie(t),s=document.createDocumentFragment(),s.append(i.body)):(i=this.#Ie(``),s=i.querySelector("template").content),!r){let e=s.querySelector("title:not(svg title)");e&&(r=e.textContent,e.remove())}return this.#Oe(s),{fragment:s,title:r}}#Le(e,t,r,i){let s=t.id?"#"+CSS.escape(t.id):null;"true"!==r&&r&&!r.includes(" ")&&([r,s=s]=r.split(/:(.*)/)),"true"!==r&&r||(r="outerHTML");let n=this.#Pe(r);if(s=n.target||s,n.strip??=!n.style.startsWith("outer"),!s)return;let o=[...document.querySelectorAll(s)];for(let r of o){let s=document.createDocumentFragment();s.append(t.cloneNode(!0)),e.push({type:"oob",fragment:s,target:r,swapSpec:n,sourceElement:i})}t.remove()}#ke(e,t,r){let i=[];if(r)for(let s of r.split(",")){let[r,n="true"]=s.split(/:(.*)/);for(let s of e.querySelectorAll(r))this.#Le(i,s,n,t)}for(let r of e.querySelectorAll(this.#b("[hx-swap-oob]"))){let e=this.#R(r,"hx-swap-oob"),s=r.getAttribute(e);r.removeAttribute(e),this.#Le(i,r,s,t)}return i}#Ve(e,t,r){t?t.before(...r.childNodes):e.append(...r.childNodes)}#Pe(e){e=e.trim();let t=this.config.defaultSwap;if(e&&!/^\S*:/.test(e)){let r=e.match(/^(\S+)\s*(.*)$/);t=r[1],e=r[2]}return{style:this.#B(t),...this.#U(e)}}#Re(e,t){let r=[];for(let i of e.querySelectorAll("template[hx]")){let e=i.getAttribute("type");if("partial"===e){let e=this.#V(i,"hx-target")||(i.id?"#"+CSS.escape(i.id):null);if(e){this.#Oe(i.content);let s=this.#Pe(this.#V(i,"hx-swap")||this.config.defaultSwap);for(let n of document.querySelectorAll(e))r.push({type:"partial",fragment:i.content.cloneNode(!0),target:n,swapSpec:s,sourceElement:t.sourceElement})}}else this.#D(i,"htmx:process:"+e,{ctx:t,tasks:r});i.remove()}return r}#je(e,t,r,i){try{null!=r&&e.setSelectionRange&&e.setSelectionRange(r,i),e.focus(t)}catch(e){}}#Be(e){let t=this.#j(e,"[autofocus]")[0];t&&this.#je(t)}#Fe(e,t){if(e.scroll){let r=e.scrollTarget?this.#$e(e.scrollTarget):t;r&&("top"===e.scroll?r.scrollTop=0:"bottom"===e.scroll&&(r.scrollTop=r.scrollHeight))}if("top"===e.show||"bottom"===e.show){let r=e.showTarget?this.#$e(e.showTarget):t;r?.scrollIntoView("top"===e.show)}}#De(e){e.request?.anchor&&document.getElementById(e.request.anchor)?.scrollIntoView({block:"start",behavior:"auto"})}#Oe(e){let t=this.#j(e,"script");for(let e of t){let t=document.createElement("script");for(let r of e.attributes)t.setAttribute(r.name,r.value);this.config.inlineScriptNonce&&(t.nonce=this.config.inlineScriptNonce),t.textContent=this.#l.createScript(e.textContent),e.replaceWith(t)}}async swap(e){try{this.#Ue(e);let{fragment:t,title:r}=this.#He(e.text);e.title=r;let i=[],s=this.#ke(t,e.sourceElement,e.selectOOB),n=this.#Re(t,e);i.push(...s,...n);let o=this.#We(e,t,n);if(o&&i.unshift(o),!this.#H(e.sourceElement,"htmx:before:swap",{ctx:e,tasks:i}))return;let a=[],l=[];for(let t of i)t.swapSpec?.transition??o?.transition??e.transition?l.push(t):a.push(this.#q(t));if(l.length>0){let e=async()=>{for(let e of l)await this.#q(e,!1)};a.push(this.#_e(e))}await Promise.all(a),this.#H(e.sourceElement,"htmx:after:swap",{ctx:e}),e.title&&!o?.swapSpec?.ignoreTitle&&(document.title=e.title),this.#De(e)}finally{this.#H(e.sourceElement,"htmx:swap:finally",{ctx:e})}}#We(e,t,r){let i=this.#Pe(e.swap||this.config.defaultSwap);if("delete"===i.style||t.childElementCount>0||/\S/.test(t.textContent)||!r.length){if(e.select){let r=t.querySelectorAll(e.select);(t=document.createDocumentFragment()).append(...r)}return this.#_(e.sourceElement)&&(i.show||="top"),{type:"main",fragment:t,target:this.#ee(e.sourceElement||document.body,i.target||e.target),swapSpec:i,sourceElement:e.sourceElement,transition:e.transition&&!1!==i.transition}}}async#q(e,t=!0){let{target:r,swapSpec:i,fragment:s}=e;if("string"==typeof r&&(r=document.querySelector(r)),!r)return;"string"==typeof i&&(i=this.#Pe(i));let n,o=i.style;if("none"===o)return;if("BODY"===s.firstElementChild?.tagName&&("outerHTML"===o?o="outerSync":o.startsWith("outer")||(i.strip=!0)),i.strip&&s.firstElementChild&&(s=document.createDocumentFragment(),s.append(...(e.fragment.firstElementChild.content||e.fragment.firstElementChild).childNodes)),this.#ze(r,"htmx-swapping"),t&&e.swapSpec?.swap&&await this.timeout(e.swapSpec?.swap),"delete"===o)return void(r.parentNode&&(this.#qe(r),r.parentNode.removeChild(r)));let a=[],l=i.settle??this.config.defaultSettleDelay,h=r.parentNode;if("innerHTML"===o||"outerHTML"===o&&h){let e=document.activeElement;if(e?.id){let t,r;try{t=e.selectionStart,r=e.selectionEnd}catch(e){}n={elt:e,start:t,end:r}}a=t&&l?this.#Qe(s,r):[]}let c=this.#Te(s),u=[...s.childNodes];try{if("innerHTML"===o){for(const e of r.children)this.#qe(e);r.replaceChildren(...s.childNodes)}else if("textContent"===o){for(const e of r.querySelectorAll("[data-htmx-powered]"))this.#qe(e);r.textContent=s.textContent}else if("outerHTML"===o)h&&(this.#Ve(h,r,s),this.#qe(r),h.removeChild(r),r=u[0]||h);else if("outerSync"===o)this.#Je(r,s.firstElementChild),this.#qe(r),delete r._htmx,r.replaceChildren(...s.firstElementChild.childNodes),u=[r];else if("innerMorph"===o)this.#T(r,s,!0),u=[...r.childNodes];else if("outerMorph"===o)this.#T(r,s,!1),u.push(r);else if("beforebegin"===o)h&&this.#Ve(h,r,s);else if("afterbegin"===o)this.#Ve(r,r.firstChild,s);else if("beforeend"===o)this.#Ve(r,null,s);else if("afterend"===o)h&&this.#Ve(h,r.nextSibling,s);else{let e=this.#r.get("handle_swap")||[],t=!1;for(const n of e){let e=n(o,r,s,i);if(e){t=!0,Array.isArray(e)&&(u=e);break}}if(!t)throw new Error(`Unknown swap style: ${o}`)}}finally{this.#Xe(r,"htmx-swapping")}if(this.#Me(c),n&&!n.elt.matches(":focus")){let e=document.getElementById(n.elt.id);if(e){let t={preventScroll:void 0!==i.focusScroll?!i.focusScroll:!this.config.defaultFocusScroll};this.#je(e,t,n.start,n.end)}}this.#H(r,"htmx:before:settle",{task:e,newContent:u,settleTasks:a});for(const e of u)this.#ze(e,"htmx-added");if(t&&a.length>0){this.#ze(r,"htmx-settling"),await this.timeout(l);for(let e of a)e();this.#Xe(r,"htmx-settling")}this.#H(r,"htmx:after:settle",{task:e,newContent:u,settleTasks:a});for(const e of u)this.#Xe(e,"htmx-added"),this.process(e),this.#Be(e);this.#Fe(i,r)}#H(e,t,r={},i=!0){if(r.error){let i=`htmx: ${t}: ${r.error.message??r.error}`;r.error instanceof Error?console.error(i,r.error,{elt:e,detail:r}):console.error(i,{elt:e,detail:r})}else r.warn?console.warn(`htmx: ${t}: ${r.warn}`,{elt:e,detail:r}):this.config.logAll&&console.log(`htmx: ${t}`,{elt:e,detail:r});return e=this.#Ge(e),this.#D(e,t,r),this.trigger(e,this.#$(t),r,i)}#D(e,t,r={}){let i=this.#r.get(t.replace(/:/g,"_"));if(i){r.cancelled=!1;for(const t of i)if(!1===t(e,r)||r.cancelled)return r.cancelled=!0,!1}return!0}timeout(e){if((e=this.parseInterval(e))>0)return new Promise(t=>setTimeout(t,e))}onLoad(e){this.on(this.#$("htmx:after:process"),t=>{e(t.target)})}on(e,t,r){let i,s=document;return void 0===r?(i=e,r=t):(s=this.#Ge(e),i=t),s.addEventListener(i,r),r}find(e,t){return this.#$e(e,t)}findAll(e,t){return this.#Se(e,t)}parseInterval(e){if("number"==typeof e)return e;let[,t,r]=e?.match(/^([\d.]+)(ms|s|m)?$/)||[],i=parseFloat(t)*({ms:1,s:1e3,m:6e4}[r]||1);return isNaN(i)?void 0:i}trigger(e,t,r={},i=!0){e=this.#Ge(e);let s=new CustomEvent(t,{detail:r,cancelable:!0,bubbles:i,composed:!0}),n=e?.isConnected?e:document;return!r.cancelled&&n.dispatchEvent(s)}ajax(e,t,r){(!r||r instanceof Element||"string"==typeof r)&&(r={target:r});let i="string"==typeof r.source?document.querySelector(r.source):r.source;if("string"==typeof r.source&&!i)return Promise.reject(new Error("Source not found"));if(r.target){let e=this.#ee(document.body,r.target);if(!e)return Promise.reject(new Error("Target not found"));i||=e}i||=document.body;let s=this.#w(i,r.event||{});return Object.assign(s,r),r.target&&(s.target=this.#ee(document.body,r.target)),Object.assign(s.request,{action:t,method:e.toUpperCase()}),r.headers&&Object.assign(s.request.headers,r.headers),this.#Y(s)}#L(){this.config.history&&(history.state||history.replaceState({htmx:!0},"",location.href),window.addEventListener("popstate",e=>{e.state&&e.state.htmx&&(this.#m?.abort(),this.#Ke())}))}#Ye(e){this.config.history&&(history.pushState({htmx:!0},"",e),this.#H(document,"htmx:after:history:push",{path:e}))}#Ze(e){this.config.history&&(history.replaceState({htmx:!0},"",e),this.#H(document,"htmx:after:history:replace",{path:e}))}#Ke(e){e=e||location.pathname+location.search;let t=document.querySelector(this.#b("[hx-history-elt]"))||document.body;this.#H(document,"htmx:before:history:restore",{path:e,cacheMiss:!0})&&("reload"===this.config.history?location.reload():(this.#m=new AbortController,this.ajax("GET",e,{target:t,swap:"outerSync",select:t!==document.body?this.#b("[hx-history-elt]"):void 0,request:{headers:{"HX-History-Restore-Request":"true"},signal:this.#m.signal}})))}#et(e){let{sourceElement:t,push:r,replace:i,hx:s,response:n}=e;if((s?.pushurl||s?.replaceurl)&&(r=s.pushurl,i=s.replaceurl),null==r&&null==i&&this.#_(t)&&(r="true"),"false"!==r&&!1!==r||(r=null),"false"!==i&&!1!==i||(i=null),!r&&!i)return null;let o=r||i;if("true"===o){let t=n?.raw?.url||e.request.action,r=new URL(t,location.href);o=r.pathname+r.search+(e.request.anchor?"#"+e.request.anchor:"")}return{type:r?"push":"replace",path:o}}#Ue(e){let t=this.#et(e);if(!t)return;let r={history:t,sourceElement:e.sourceElement,response:e.response};this.#H(document,"htmx:before:history:update",r)&&("push"===t.type?this.#Ye(t.path):this.#Ze(t.path),this.#H(document,"htmx:after:history:update",r))}#Ee(e){let t=this.#y("hx-on"),r=this.config.metaCharacter||":",i=t=>async r=>{try{await this.#O(e,{event:r},`with(event?.detail||{}){${t}}`,!1)}catch(t){"symbol"!=typeof t&&this.#H(e,"htmx:error",{error:t})}};for(let s of e.getAttributeNames()){let n=t.find(e=>s.startsWith(e));if(!n)continue;let o=s.substring(n.length),a=e.getAttribute(s);if(!o){for(let t of a.split(/;(?=[^;]*->)/)){let r=t.indexOf("->");-1!==r&&this.#M(e,t.substring(0,r).trim(),i(t.substring(r+2).trim()))}continue}if(o[0]!==r)continue;let l=o.substring(1);l.startsWith(r)&&(l="htmx"+r+l.substring(1)),this.#M(e,l,i(a))}}#ue(e){let t,r=this.#S(e,"hx-indicator");t=r?this.#Se(e,r,"hx-indicator"):[e];for(const e of t){let t=this.#I(e);t.rc=(t.rc||0)+1,this.#ze(e,this.config.requestClass)}return t}#ge(e){for(let t of e){let e=this.#I(t);e.rc&&--e.rc<=0&&(this.#Xe(t,this.config.requestClass),delete e.rc)}}#de(e){let t=this.#S(e,"hx-disable"),r=[];if(t){r=this.#Se(e,t,"hx-disable");for(let e of r){let t=this.#I(e);t.dc=(t.dc||0)+1,e.disabled=!0}}return r}#xe(e){for(const t of e){let e=this.#I(t);e.dc&&--e.dc<=0&&(t.disabled=!1,delete e.dc)}}#C(e,t,r,i,s){if(i&&t&&!t.reportValidity())return;let n=t?new FormData(t):new FormData,o=t?new Set(t.elements):new Set;if(!t){if(i&&e.reportValidity&&!e.reportValidity())return;this.#tt(e,o,n,s)}r&&r.name&&(n.append(r.name,r.value),o.add(r));let a=this.#S(e,"hx-include");if(a)for(let t of this.#Se(e,a)){if(i&&t.reportValidity&&!t.reportValidity())return;this.#tt(t,o,n)}return n}#tt(e,t,r,i){let s=e.tagName,n=[];"BUTTON"===s?n=[e]:!["INPUT","SELECT","TEXTAREA","FIELDSET"].includes(s)&&i||(n=this.#j(e,"input, select, textarea"));for(let e of n){if(!e.name||e.matches(":disabled")||t.has(e))continue;t.add(e);let i=e.type;if("checkbox"===i||"radio"===i)e.checked&&r.append(e.name,e.value);else if("file"===i)for(let t of e.files)r.append(e.name,t);else if("select-multiple"===i)for(let t of e.selectedOptions)r.append(e.name,t.value);else r.append(e.name,e.value)}}#A(e,t,r){let i=this.#S(e,t);if(!i)return null;let s=this.#oe(i);if(s)return 0!==s.indexOf("{")&&(s="{"+s+"}"),this.#O(e,{},s,!0).then(e=>{r(e)});r(this.#U(i))}#rt(e){let t=e.trim();return t.startsWith("<")&&t.endsWith("/>")?t.slice(1,-2):t}#Se(e,t,r,i){let s=t??e,n=t?this.#Ge(e):document;if(s.startsWith("global "))return this.#Se(n,s.slice(7),r,!0);let o=s?s.replace(/<[^>]+\/>/g,e=>e.replace(/,/g,"%2C")).split(",").map(e=>e.replace(/%2C/g,",")):[],a=[],l=[];for(const e of o){let t,s=this.#rt(e);if(s.startsWith("closest "))t=n.closest(s.slice(8));else if(s.startsWith("find "))t=n.querySelector(s.slice(5));else if(s.startsWith("findAll "))a.push(...n.querySelectorAll(s.slice(8)));else if("next"===s||"nextElementSibling"===s)t=n.nextElementSibling;else if(s.startsWith("next "))t=this.#it(n,s.slice(5),!!i);else if("previous"===s||"previousElementSibling"===s)t=n.previousElementSibling;else if(s.startsWith("previous "))t=this.#st(n,s.slice(9),!!i);else if("document"===s)t=document;else if("window"===s)t=window;else if("body"===s)t=document.body;else if("host"===s)t=n.getRootNode().host;else if("this"===s){if(r){a.push(...this.#F(n,r));continue}t=n}else l.push(s);t&&a.push(t)}if(l.length>0){let e=l.join(","),t=this.#nt(n,!!i);a.push(...t.querySelectorAll(e))}return[...new Set(a)]}#it(e,t,r){return this.#ot(this.#nt(e,r).querySelectorAll(t),e,Node.DOCUMENT_POSITION_PRECEDING)}#st(e,t,r){let i=[...this.#nt(e,r).querySelectorAll(t)].reverse();return this.#ot(i,e,Node.DOCUMENT_POSITION_FOLLOWING)}#ot(e,t,r){for(const i of e)if(i.compareDocumentPosition(t)===r)return i}#nt(e,t){return e.isConnected&&e.getRootNode?e.getRootNode?.({composed:t}):document}#ie(e,t,r){let i=this.#Se(e,t,r)[0];return i||console.warn(`htmx: '${t}' on ${r} did not match any element`,{elt:e,selector:t,attr:r}),i}#$e(e,t,r){return this.#Se(e,t,r)[0]}#oe(e){if(null!=e){if(e.startsWith("js:"))return e.substring(3);if(e.startsWith("javascript:"))return e.substring(11)}}#K(e){let t=()=>{this.#he(e).abort()};e.addEventListener("htmx:abort",t),e._htmx.listeners.push({fromElt:e,eventName:"htmx:abort",handler:t})}#T(e,t,r){let{persistentIds:i,idMap:s}=this.#at(e,t),n=document.createElement("div");n.hidden=!0,document.body.after(n);let o={target:e,idMap:s,persistentIds:i,pantry:n,futureMatches:new WeakSet};r?this.#lt(o,e,t):this.#lt(o,e.parentNode,t,e,e.nextSibling),this.#qe(n),n.remove()}#lt(e,t,r,i=null,s=null){t instanceof HTMLTemplateElement&&r instanceof HTMLTemplateElement&&(t=t.content,r=r.content),i||=t.firstChild;let n=r.firstChild;for(;n;){let r;if(i&&i!=s&&(r=this.#ht(e,n,i,s),r&&r!==i)){let o=i;for(;o&&o!==r;){let r=o;o=o.nextSibling,r instanceof Element&&(e.idMap.has(r)||this.#ct(e,r,n))?this.#Ne(t,r,s):this.#ut(e,r)}}if(!r&&n instanceof Element&&e.persistentIds.has(n.id)){let s=CSS.escape(n.id);r=e.target.id===n.id&&e.target||e.target.querySelector(`[id="${s}"]`)||e.pantry.querySelector(`[id="${s}"]`);let o=r;for(;o=o.parentNode;){let t=e.idMap.get(o);t&&(t.delete(r.id),t.size||e.idMap.delete(o))}this.#Ne(t,r,i)}if(r){this.#dt(r,n,e),i=r.nextSibling,n=n.nextSibling;continue}let o=n.nextSibling;if(e.idMap.has(n)){let r=document.createElement(n.tagName);t.insertBefore(r,i),this.#dt(r,n,e),i=r.nextSibling}else t.insertBefore(n,i),i=n.nextSibling;n=o}for(;i&&i!=s;){let t=i;i=i.nextSibling,this.#ut(e,t)}}#ct(e,t,r){if(e.futureMatches.has(t))return!0;for(let i=r.nextSibling,s=0;i&&sa.has(e)))return h;if(!r){if(o>0&&h.isEqualNode(t))return h;s||(s=h)}}if(n+=r?.size||0,n>l)break;if(h.contains(document.activeElement))break;if(--o<1&&0===l)break;h=h.nextSibling}return s&&this.#ct(e,s,t)?null:s}#N(e,t){return e instanceof Element&&e.tagName===t.tagName&&(!("SCRIPT"===e.tagName&&!e.isEqualNode(t))&&(!(!e._x_bindings?.id||!t.matches?.("[\\:id], [x-bind\\:id]"))||(!e.id||e.id===t.id)))}#ut(e,t){e.idMap.has(t)?this.#Ne(e.pantry,t,null):(this.#qe(t),t.remove())}#Ne(e,t,r){if(e.moveBefore)try{return void e.moveBefore(t,r)}catch(e){}e.insertBefore(t,r)}#dt(e,t,r){if(this.config.morphSkip&&e.matches?.(this.config.morphSkip))return;if(!this.#D(e,"htmx:before:morph:node",{oldNode:e,newNode:t}))return;this.#Je(e,t),e instanceof HTMLTextAreaElement&&e.defaultValue!=t.defaultValue&&(e.value=t.value),this.config.morphSkipChildren&&e.matches?.(this.config.morphSkipChildren)||e.isEqualNode(t)&&"TEMPLATE"!==t.tagName&&!t.querySelector?.("template")||this.#lt(r,e,t)}#Je(e,t){let r=this.config.morphIgnore||[];for(const i of t.attributes)r.includes(i.name)||e.getAttribute(i.name)===i.value||(e.setAttribute(i.name,i.value),"value"===i.name&&e instanceof HTMLInputElement&&"file"!==e.type&&(e.value=i.value));for(let i=e.attributes.length-1;i>=0;i--){let s=e.attributes[i];!s||t.hasAttribute(s.name)||r.includes(s.name)||e.removeAttribute(s.name)}}#ft(e,t,r,i){for(const s of i)if(t.has(s.id)){let t=s;for(;t&&t!==r;){let r=e.get(t);null==r&&(r=new Set,e.set(t,r)),r.add(s.id),t=t.parentElement}}}#at(e,t){let r=this.#j(e,"[id]"),i=t.querySelectorAll("[id]"),s=this.#mt(r,i),n=new Map;return this.#ft(n,s,e.parentElement,r),this.#ft(n,s,t,i),{persistentIds:s,idMap:n}}#mt(e,t){let r=new Set,i=new Map;for(const{id:t,tagName:s}of e)i.has(t)?r.add(t):t&&i.set(t,s);let s=new Set;for(const{id:e,tagName:n}of t)s.has(e)?r.add(e):i.get(e)===n&&s.add(e);for(const e of r)s.delete(e);return s}#pe(e){let t=e.response.raw.status,r=this.config.noSwap.map(e=>e+""),i=t+"";for(let t of[i,i.slice(0,2)+"x",i[0]+"xx"]){if(r.includes(t))return void(e.swap="none");let i=this.#S(e.sourceElement,"hx-status:"+t);if(i)return void this.#P(i,e)}}#_e(e){return new Promise(t=>{this.#f||=[],this.#f.push({task:e,resolve:t}),this.#p||this.#pt()})}async#pt(){if(0===this.#f.length||this.#p)return;this.#p=!0;let{task:e,resolve:t}=this.#f.shift();try{document.startViewTransition?(this.#H(document,"htmx:before:viewTransition",{task:e}),await document.startViewTransition(e).finished,this.#H(document,"htmx:after:viewTransition",{task:e})):await e()}catch(e){}finally{this.#p=!1,t(),this.#pt()}}#Qe(e,t){let r=t.querySelectorAll("[id]"),i=Object.fromEntries([...r].map(e=>[e.id,e])),s=e.querySelectorAll("[id]"),n=[];for(let e of s){let t=i[e.id];if(t?.tagName===e.tagName){let r=e.cloneNode(!1);this.#Je(e,t),n.push(()=>{this.#Je(e,r)})}}return n}#ze(e,t){e?.classList?.add?.(t)}#Xe(e,t){e?.classList?.remove?.(t),0===e?.classList?.length&&e.removeAttribute("class")}#Ge(e){return"string"==typeof e?this.find(e):e}#$(e){return this.config.metaCharacter?e.replace(/:/g,this.config.metaCharacter):e}}})(); \ No newline at end of file diff --git a/src/Directory.Build.props b/src/Directory.Build.props index df9e73d..d439fe3 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -3,11 +3,15 @@ net8.0;net9.0;net10.0 4.0.0 - alpha8 + beta4 true - Update htmx 4 to alpha8 -- [Common] Update provided htmx 4 to 4.0.0-alpha8 -- [View Engine] Updated script tags to pull htmx 4.0.0-alpha8 + Update htmx 4 to beta4 +- [Common] Update provided htmx 4 to 4.0.0-beta4 +- [Common] Add htmax bundle to provided version +- [Server] Update HX-Target header to return tag and ID (similar to HX-Source) +- [Server] Add support for HX-Request-Type header +- [View Engine] Add hx-status attribute +- [View Engine] Updated script tags to pull htmx 4.0.0-beta4, added "max" bundle links for local and CDN See package and prior alpha release READMEs; v2 to v4 is not an update-and-forget-it release diff --git a/src/Tests/Common.fs b/src/Tests/Common.fs index 5f18b56..093414b 100644 --- a/src/Tests/Common.fs +++ b/src/Tests/Common.fs @@ -6,7 +6,7 @@ open Giraffe.Htmx /// Test to ensure the version was updated let version = test "HtmxVersion is correct" { - Expect.equal HtmxVersion "4.0.0-alpha8" "htmx version incorrect" + Expect.equal HtmxVersion "4.0.0-beta4" "htmx version incorrect" } /// Tests for the HxSwap module diff --git a/src/Tests/ViewEngine.fs b/src/Tests/ViewEngine.fs index cedf42c..0e17a22 100644 --- a/src/Tests/ViewEngine.fs +++ b/src/Tests/ViewEngine.fs @@ -731,18 +731,39 @@ let script = $"""""" "Local script tag is incorrect" } + test "localMax succeeds" { + let html = RenderView.AsString.htmlNode Script.localMax + Expect.equal + html + $"""""" + "Local script tag is incorrect" + } test "cdnMinified succeeds" { let html = RenderView.AsString.htmlNode Script.cdnMinified Expect.equal html - $"""""" + $"""""" "CDN minified script tag is incorrect" } test "cdnUnminified succeeds" { let html = RenderView.AsString.htmlNode Script.cdnUnminified Expect.equal html - $"""""" + $"""""" + "CDN unminified script tag is incorrect" + } + test "cdnMaxMinified succeeds" { + let html = RenderView.AsString.htmlNode Script.cdnMaxMinified + Expect.equal + html + $"""""" + "CDN minified script tag is incorrect" + } + test "cdnMaxUnminified succeeds" { + let html = RenderView.AsString.htmlNode Script.cdnMaxUnminified + Expect.equal + html + $"""""" "CDN unminified script tag is incorrect" } ] diff --git a/src/ViewEngine.Htmx/Htmx.fs b/src/ViewEngine.Htmx/Htmx.fs index ad7fd74..019de9c 100644 --- a/src/ViewEngine.Htmx/Htmx.fs +++ b/src/ViewEngine.Htmx/Htmx.fs @@ -1011,18 +1011,35 @@ module Script = /// Script tag to load the package-provided version of htmx let local = script [ _src htmxLocalScript ] [] + /// Script tag to load the package-provided version of the htmx-plus-extensions bundle + let localMax = script [ _src htmaxLocalScript ] [] + /// Script tag to load the minified version from jsdelivr.net /// Ensure cdn.jsdelivr.net is in your CSP script-src list (if applicable) let cdnMinified = - script [ _src "https://cdn.jsdelivr.net/npm/htmx.org@4.0.0-alpha8/dist/htmx.min.js" - _integrity "sha384-hUj4cz/Dd2p+Dq0r8A6TAMS1u7gu2bTyisk8xCQX3nodazPP+fRmcAWJrTh4Ycwb" + script [ _src $"https://cdn.jsdelivr.net/npm/htmx.org@{HtmxVersion}/dist/htmx.min.js" + _integrity "sha384-aWZK1NtOs/aWb/+YZdTM8q2JkWEshlMc9mgZ189numT9bwFhyAyYEoO4nO/2dTXt" _crossorigin "anonymous" ] [] /// Script tag to load the unminified version from jsdelivr.net /// Ensure cdn.jsdelivr.net is in your CSP script-src list (if applicable) let cdnUnminified = - script [ _src "https://cdn.jsdelivr.net/npm/htmx.org@4.0.0-alpha8/dist/htmx.js" - _integrity "sha384-CHKZYHwIgmpkwoWtoPaiFIiMxP1Up7yHcsZ2NeECzLxRTXCO0mqXlujZwdJgFsFC" + script [ _src $"https://cdn.jsdelivr.net/npm/htmx.org@{HtmxVersion}/dist/htmx.js" + _integrity "sha384-OFLRIZpuqI2wwFozxvDGcuF3TQ36ySMgp44WEthOiR4wFzRkhZbK72HFaBo2C3cx" + _crossorigin "anonymous" ] [] + + /// Script tag to load the minified htmx-plus-extensions bundle from jsdelivr.net + /// Ensure cdn.jsdelivr.net is in your CSP script-src list (if applicable) + let cdnMaxMinified = + script [ _src $"https://cdn.jsdelivr.net/npm/htmx.org@{HtmxVersion}/dist/htmax.min.js" + _integrity "sha384-Qoqie5IRtOE79SDFFRSb/yKi+pkzpSnfjgwr1KksyP14OaHkLHar0KrLVxUwlsJF" + _crossorigin "anonymous" ] [] + + /// Script tag to load the unminified htmx-plus-extensions bundle from jsdelivr.net + /// Ensure cdn.jsdelivr.net is in your CSP script-src list (if applicable) + let cdnMaxUnminified = + script [ _src $"https://cdn.jsdelivr.net/npm/htmx.org@{HtmxVersion}/dist/htmax.js" + _integrity "sha384-gGi3Urue6ZkE4NrJCmXWIZkfNkrt1IrdP3fr0kb/v06GWg3V1RnD9Pg/Ul3qhtAK" _crossorigin "anonymous" ] [] /// Script tag to load the minified version from jsdelivr.net