htmx.org 1.9.9 → 2.0.0-alpha1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/LICENSE +13 -25
- package/README.md +1 -1
- package/dist/ext/path-params.js +11 -0
- package/dist/htmx.amd.js +3629 -0
- package/dist/htmx.cjs.js +3627 -0
- package/dist/htmx.d.ts +36 -0
- package/dist/htmx.esm.js +3627 -0
- package/dist/htmx.js +3512 -3741
- package/dist/htmx.min.js +1 -1
- package/dist/htmx.min.js.gz +0 -0
- package/package.json +42 -12
- package/dist/ext/ajax-header.js +0 -7
- package/dist/ext/alpine-morph.js +0 -16
- package/dist/ext/class-tools.js +0 -92
- package/dist/ext/client-side-templates.js +0 -96
- package/dist/ext/debug.js +0 -11
- package/dist/ext/disable-element.js +0 -18
- package/dist/ext/event-header.js +0 -37
- package/dist/ext/head-support.js +0 -141
- package/dist/ext/include-vals.js +0 -24
- package/dist/ext/json-enc.js +0 -12
- package/dist/ext/loading-states.js +0 -183
- package/dist/ext/method-override.js +0 -11
- package/dist/ext/morphdom-swap.js +0 -17
- package/dist/ext/multi-swap.js +0 -45
- package/dist/ext/path-deps.js +0 -60
- package/dist/ext/preload.js +0 -147
- package/dist/ext/rails-method.js +0 -10
- package/dist/ext/remove-me.js +0 -27
- package/dist/ext/response-targets.js +0 -130
- package/dist/ext/restored.js +0 -15
- package/dist/ext/sse.js +0 -322
- package/dist/ext/ws.js +0 -477
package/dist/htmx.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(e,t){if(typeof define==="function"&&define.amd){define([],t)}else if(typeof module==="object"&&module.exports){module.exports=t()}else{e.htmx=e.htmx||t()}})(typeof self!=="undefined"?self:this,function(){return function(){"use strict";var Q={onLoad:t,process:Bt,on:Z,off:K,trigger:ce,ajax:Or,find:C,findAll:f,closest:v,values:function(e,t){var r=ur(e,t||"post");return r.values},remove:B,addClass:F,removeClass:n,toggleClass:V,takeClass:j,defineExtension:kr,removeExtension:Pr,logAll:X,logNone:U,logger:null,config:{historyEnabled:true,historyCacheSize:10,refreshOnHistoryMiss:false,defaultSwapStyle:"innerHTML",defaultSwapDelay:0,defaultSettleDelay:20,includeIndicatorStyles:true,indicatorClass:"htmx-indicator",requestClass:"htmx-request",addedClass:"htmx-added",settlingClass:"htmx-settling",swappingClass:"htmx-swapping",allowEval:true,allowScriptTags:true,inlineScriptNonce:"",attributesToSettle:["class","style","width","height"],withCredentials:false,timeout:0,wsReconnectDelay:"full-jitter",wsBinaryType:"blob",disableSelector:"[hx-disable], [data-hx-disable]",useTemplateFragments:false,scrollBehavior:"smooth",defaultFocusScroll:false,getCacheBusterParam:false,globalViewTransitions:false,methodsThatUseUrlParams:["get"],selfRequestsOnly:false,ignoreTitle:false,scrollIntoViewOnBoost:true},parseInterval:d,_:e,createEventSource:function(e){return new EventSource(e,{withCredentials:true})},createWebSocket:function(e){var t=new WebSocket(e,[]);t.binaryType=Q.config.wsBinaryType;return t},version:"1.9.9"};var r={addTriggerHandler:Tt,bodyContains:se,canAccessLocalStorage:M,findThisElement:de,filterValues:dr,hasAttribute:o,getAttributeValue:te,getClosestAttributeValue:ne,getClosestMatch:c,getExpressionVars:Cr,getHeaders:vr,getInputValues:ur,getInternalData:ae,getSwapSpecification:mr,getTriggerSpecs:Qe,getTarget:ge,makeFragment:l,mergeObjects:le,makeSettleInfo:R,oobSwap:xe,querySelectorExt:ue,selectAndSwap:Ue,settleImmediately:Yt,shouldCancel:it,triggerEvent:ce,triggerErrorEvent:fe,withExtensions:T};var b=["get","post","put","delete","patch"];var w=b.map(function(e){return"[hx-"+e+"], [data-hx-"+e+"]"}).join(", ");function d(e){if(e==undefined){return undefined}if(e.slice(-2)=="ms"){return parseFloat(e.slice(0,-2))||undefined}if(e.slice(-1)=="s"){return parseFloat(e.slice(0,-1))*1e3||undefined}if(e.slice(-1)=="m"){return parseFloat(e.slice(0,-1))*1e3*60||undefined}return parseFloat(e)||undefined}function ee(e,t){return e.getAttribute&&e.getAttribute(t)}function o(e,t){return e.hasAttribute&&(e.hasAttribute(t)||e.hasAttribute("data-"+t))}function te(e,t){return ee(e,t)||ee(e,"data-"+t)}function u(e){return e.parentElement}function re(){return document}function c(e,t){while(e&&!t(e)){e=u(e)}return e?e:null}function S(e,t,r){var n=te(t,r);var i=te(t,"hx-disinherit");if(e!==t&&i&&(i==="*"||i.split(" ").indexOf(r)>=0)){return"unset"}else{return n}}function ne(t,r){var n=null;c(t,function(e){return n=S(t,e,r)});if(n!=="unset"){return n}}function h(e,t){var r=e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.oMatchesSelector;return r&&r.call(e,t)}function q(e){var t=/<([a-z][^\/\0>\x20\t\r\n\f]*)/i;var r=t.exec(e);if(r){return r[1].toLowerCase()}else{return""}}function i(e,t){var r=new DOMParser;var n=r.parseFromString(e,"text/html");var i=n.body;while(t>0){t--;i=i.firstChild}if(i==null){i=re().createDocumentFragment()}return i}function H(e){return e.match(/<body/)}function l(e){var t=!H(e);if(Q.config.useTemplateFragments&&t){var r=i("<body><template>"+e+"</template></body>",0);return r.querySelector("template").content}else{var n=q(e);switch(n){case"thead":case"tbody":case"tfoot":case"colgroup":case"caption":return i("<table>"+e+"</table>",1);case"col":return i("<table><colgroup>"+e+"</colgroup></table>",2);case"tr":return i("<table><tbody>"+e+"</tbody></table>",2);case"td":case"th":return i("<table><tbody><tr>"+e+"</tr></tbody></table>",3);case"script":case"style":return i("<div>"+e+"</div>",1);default:return i(e,0)}}}function ie(e){if(e){e()}}function L(e,t){return Object.prototype.toString.call(e)==="[object "+t+"]"}function A(e){return L(e,"Function")}function N(e){return L(e,"Object")}function ae(e){var t="htmx-internal-data";var r=e[t];if(!r){r=e[t]={}}return r}function I(e){var t=[];if(e){for(var r=0;r<e.length;r++){t.push(e[r])}}return t}function oe(e,t){if(e){for(var r=0;r<e.length;r++){t(e[r])}}}function k(e){var t=e.getBoundingClientRect();var r=t.top;var n=t.bottom;return r<window.innerHeight&&n>=0}function se(e){if(e.getRootNode&&e.getRootNode()instanceof window.ShadowRoot){return re().body.contains(e.getRootNode().host)}else{return re().body.contains(e)}}function P(e){return e.trim().split(/\s+/)}function le(e,t){for(var r in t){if(t.hasOwnProperty(r)){e[r]=t[r]}}return e}function E(e){try{return JSON.parse(e)}catch(e){x(e);return null}}function M(){var e="htmx:localStorageTest";try{localStorage.setItem(e,e);localStorage.removeItem(e);return true}catch(e){return false}}function D(t){try{var e=new URL(t);if(e){t=e.pathname+e.search}if(!t.match("^/$")){t=t.replace(/\/+$/,"")}return t}catch(e){return t}}function e(e){return wr(re().body,function(){return eval(e)})}function t(t){var e=Q.on("htmx:load",function(e){t(e.detail.elt)});return e}function X(){Q.logger=function(e,t,r){if(console){console.log(t,e,r)}}}function U(){Q.logger=null}function C(e,t){if(t){return e.querySelector(t)}else{return C(re(),e)}}function f(e,t){if(t){return e.querySelectorAll(t)}else{return f(re(),e)}}function B(e,t){e=s(e);if(t){setTimeout(function(){B(e);e=null},t)}else{e.parentElement.removeChild(e)}}function F(e,t,r){e=s(e);if(r){setTimeout(function(){F(e,t);e=null},r)}else{e.classList&&e.classList.add(t)}}function n(e,t,r){e=s(e);if(r){setTimeout(function(){n(e,t);e=null},r)}else{if(e.classList){e.classList.remove(t);if(e.classList.length===0){e.removeAttribute("class")}}}}function V(e,t){e=s(e);e.classList.toggle(t)}function j(e,t){e=s(e);oe(e.parentElement.children,function(e){n(e,t)});F(e,t)}function v(e,t){e=s(e);if(e.closest){return e.closest(t)}else{do{if(e==null||h(e,t)){return e}}while(e=e&&u(e));return null}}function g(e,t){return e.substring(0,t.length)===t}function _(e,t){return e.substring(e.length-t.length)===t}function z(e){var t=e.trim();if(g(t,"<")&&_(t,"/>")){return t.substring(1,t.length-2)}else{return t}}function W(e,t){if(t.indexOf("closest ")===0){return[v(e,z(t.substr(8)))]}else if(t.indexOf("find ")===0){return[C(e,z(t.substr(5)))]}else if(t==="next"){return[e.nextElementSibling]}else if(t.indexOf("next ")===0){return[$(e,z(t.substr(5)))]}else if(t==="previous"){return[e.previousElementSibling]}else if(t.indexOf("previous ")===0){return[G(e,z(t.substr(9)))]}else if(t==="document"){return[document]}else if(t==="window"){return[window]}else if(t==="body"){return[document.body]}else{return re().querySelectorAll(z(t))}}var $=function(e,t){var r=re().querySelectorAll(t);for(var n=0;n<r.length;n++){var i=r[n];if(i.compareDocumentPosition(e)===Node.DOCUMENT_POSITION_PRECEDING){return i}}};var G=function(e,t){var r=re().querySelectorAll(t);for(var n=r.length-1;n>=0;n--){var i=r[n];if(i.compareDocumentPosition(e)===Node.DOCUMENT_POSITION_FOLLOWING){return i}}};function ue(e,t){if(t){return W(e,t)[0]}else{return W(re().body,e)[0]}}function s(e){if(L(e,"String")){return C(e)}else{return e}}function J(e,t,r){if(A(t)){return{target:re().body,event:e,listener:t}}else{return{target:s(e),event:t,listener:r}}}function Z(t,r,n){Dr(function(){var e=J(t,r,n);e.target.addEventListener(e.event,e.listener)});var e=A(r);return e?r:n}function K(t,r,n){Dr(function(){var e=J(t,r,n);e.target.removeEventListener(e.event,e.listener)});return A(r)?r:n}var ve=re().createElement("output");function Y(e,t){var r=ne(e,t);if(r){if(r==="this"){return[de(e,t)]}else{var n=W(e,r);if(n.length===0){x('The selector "'+r+'" on '+t+" returned no matches!");return[ve]}else{return n}}}}function de(e,t){return c(e,function(e){return te(e,t)!=null})}function ge(e){var t=ne(e,"hx-target");if(t){if(t==="this"){return de(e,"hx-target")}else{return ue(e,t)}}else{var r=ae(e);if(r.boosted){return re().body}else{return e}}}function me(e){var t=Q.config.attributesToSettle;for(var r=0;r<t.length;r++){if(e===t[r]){return true}}return false}function pe(t,r){oe(t.attributes,function(e){if(!r.hasAttribute(e.name)&&me(e.name)){t.removeAttribute(e.name)}});oe(r.attributes,function(e){if(me(e.name)){t.setAttribute(e.name,e.value)}})}function ye(e,t){var r=Mr(t);for(var n=0;n<r.length;n++){var i=r[n];try{if(i.isInlineSwap(e)){return true}}catch(e){x(e)}}return e==="outerHTML"}function xe(e,i,a){var t="#"+ee(i,"id");var o="outerHTML";if(e==="true"){}else if(e.indexOf(":")>0){o=e.substr(0,e.indexOf(":"));t=e.substr(e.indexOf(":")+1,e.length)}else{o=e}var r=re().querySelectorAll(t);if(r){oe(r,function(e){var t;var r=i.cloneNode(true);t=re().createDocumentFragment();t.appendChild(r);if(!ye(o,e)){t=r}var n={shouldSwap:true,target:e,fragment:t};if(!ce(e,"htmx:oobBeforeSwap",n))return;e=n.target;if(n["shouldSwap"]){De(o,e,e,t,a)}oe(a.elts,function(e){ce(e,"htmx:oobAfterSwap",n)})});i.parentNode.removeChild(i)}else{i.parentNode.removeChild(i);fe(re().body,"htmx:oobErrorNoTarget",{content:i})}return e}function be(e,t,r){var n=ne(e,"hx-select-oob");if(n){var i=n.split(",");for(let e=0;e<i.length;e++){var a=i[e].split(":",2);var o=a[0].trim();if(o.indexOf("#")===0){o=o.substring(1)}var s=a[1]||"true";var l=t.querySelector("#"+o);if(l){xe(s,l,r)}}}oe(f(t,"[hx-swap-oob], [data-hx-swap-oob]"),function(e){var t=te(e,"hx-swap-oob");if(t!=null){xe(t,e,r)}})}function we(e){oe(f(e,"[hx-preserve], [data-hx-preserve]"),function(e){var t=te(e,"id");var r=re().getElementById(t);if(r!=null){e.parentNode.replaceChild(r,e)}})}function Se(o,e,s){oe(e.querySelectorAll("[id]"),function(e){var t=ee(e,"id");if(t&&t.length>0){var r=t.replace("'","\\'");var n=e.tagName.replace(":","\\:");var i=o.querySelector(n+"[id='"+r+"']");if(i&&i!==o){var a=e.cloneNode();pe(e,i);s.tasks.push(function(){pe(e,a)})}}})}function Ee(e){return function(){n(e,Q.config.addedClass);Bt(e);Ot(e);Ce(e);ce(e,"htmx:load")}}function Ce(e){var t="[autofocus]";var r=h(e,t)?e:e.querySelector(t);if(r!=null){r.focus()}}function a(e,t,r,n){Se(e,r,n);while(r.childNodes.length>0){var i=r.firstChild;F(i,Q.config.addedClass);e.insertBefore(i,t);if(i.nodeType!==Node.TEXT_NODE&&i.nodeType!==Node.COMMENT_NODE){n.tasks.push(Ee(i))}}}function Te(e,t){var r=0;while(r<e.length){t=(t<<5)-t+e.charCodeAt(r++)|0}return t}function Re(e){var t=0;if(e.attributes){for(var r=0;r<e.attributes.length;r++){var n=e.attributes[r];if(n.value){t=Te(n.name,t);t=Te(n.value,t)}}}return t}function Oe(t){var r=ae(t);if(r.onHandlers){for(let e=0;e<r.onHandlers.length;e++){const n=r.onHandlers[e];t.removeEventListener(n.event,n.listener)}delete r.onHandlers}}function qe(e){var t=ae(e);if(t.timeout){clearTimeout(t.timeout)}if(t.webSocket){t.webSocket.close()}if(t.sseEventSource){t.sseEventSource.close()}if(t.listenerInfos){oe(t.listenerInfos,function(e){if(e.on){e.on.removeEventListener(e.trigger,e.listener)}})}if(t.initHash){t.initHash=null}Oe(e)}function m(e){ce(e,"htmx:beforeCleanupElement");qe(e);if(e.children){oe(e.children,function(e){m(e)})}}function He(t,e,r){if(t.tagName==="BODY"){return Pe(t,e,r)}else{var n;var i=t.previousSibling;a(u(t),t,e,r);if(i==null){n=u(t).firstChild}else{n=i.nextSibling}ae(t).replacedWith=n;r.elts=r.elts.filter(function(e){return e!=t});while(n&&n!==t){if(n.nodeType===Node.ELEMENT_NODE){r.elts.push(n)}n=n.nextElementSibling}m(t);u(t).removeChild(t)}}function Le(e,t,r){return a(e,e.firstChild,t,r)}function Ae(e,t,r){return a(u(e),e,t,r)}function Ne(e,t,r){return a(e,null,t,r)}function Ie(e,t,r){return a(u(e),e.nextSibling,t,r)}function ke(e,t,r){m(e);return u(e).removeChild(e)}function Pe(e,t,r){var n=e.firstChild;a(e,n,t,r);if(n){while(n.nextSibling){m(n.nextSibling);e.removeChild(n.nextSibling)}m(n);e.removeChild(n)}}function Me(e,t,r){var n=r||ne(e,"hx-select");if(n){var i=re().createDocumentFragment();oe(t.querySelectorAll(n),function(e){i.appendChild(e)});t=i}return t}function De(e,t,r,n,i){switch(e){case"none":return;case"outerHTML":He(r,n,i);return;case"afterbegin":Le(r,n,i);return;case"beforebegin":Ae(r,n,i);return;case"beforeend":Ne(r,n,i);return;case"afterend":Ie(r,n,i);return;case"delete":ke(r,n,i);return;default:var a=Mr(t);for(var o=0;o<a.length;o++){var s=a[o];try{var l=s.handleSwap(e,r,n,i);if(l){if(typeof l.length!=="undefined"){for(var u=0;u<l.length;u++){var f=l[u];if(f.nodeType!==Node.TEXT_NODE&&f.nodeType!==Node.COMMENT_NODE){i.tasks.push(Ee(f))}}}return}}catch(e){x(e)}}if(e==="innerHTML"){Pe(r,n,i)}else{De(Q.config.defaultSwapStyle,t,r,n,i)}}}function Xe(e){if(e.indexOf("<title")>-1){var t=e.replace(/<svg(\s[^>]*>|>)([\s\S]*?)<\/svg>/gim,"");var r=t.match(/<title(\s[^>]*>|>)([\s\S]*?)<\/title>/im);if(r){return r[2]}}}function Ue(e,t,r,n,i,a){i.title=Xe(n);var o=l(n);if(o){be(r,o,i);o=Me(r,o,a);we(o);return De(e,r,t,o,i)}}function Be(e,t,r){var n=e.getResponseHeader(t);if(n.indexOf("{")===0){var i=E(n);for(var a in i){if(i.hasOwnProperty(a)){var o=i[a];if(!N(o)){o={value:o}}ce(r,a,o)}}}else{var s=n.split(",");for(var l=0;l<s.length;l++){ce(r,s[l].trim(),[])}}}var Fe=/\s/;var p=/[\s,]/;var Ve=/[_$a-zA-Z]/;var je=/[_$a-zA-Z0-9]/;var _e=['"',"'","/"];var ze=/[^\s]/;var We=/[{(]/;var $e=/[})]/;function Ge(e){var t=[];var r=0;while(r<e.length){if(Ve.exec(e.charAt(r))){var n=r;while(je.exec(e.charAt(r+1))){r++}t.push(e.substr(n,r-n+1))}else if(_e.indexOf(e.charAt(r))!==-1){var i=e.charAt(r);var n=r;r++;while(r<e.length&&e.charAt(r)!==i){if(e.charAt(r)==="\\"){r++}r++}t.push(e.substr(n,r-n+1))}else{var a=e.charAt(r);t.push(a)}r++}return t}function Je(e,t,r){return Ve.exec(e.charAt(0))&&e!=="true"&&e!=="false"&&e!=="this"&&e!==r&&t!=="."}function Ze(e,t,r){if(t[0]==="["){t.shift();var n=1;var i=" return (function("+r+"){ return (";var a=null;while(t.length>0){var o=t[0];if(o==="]"){n--;if(n===0){if(a===null){i=i+"true"}t.shift();i+=")})";try{var s=wr(e,function(){return Function(i)()},function(){return true});s.source=i;return s}catch(e){fe(re().body,"htmx:syntax:error",{error:e,source:i});return null}}}else if(o==="["){n++}if(Je(o,a,r)){i+="(("+r+"."+o+") ? ("+r+"."+o+") : (window."+o+"))"}else{i=i+o}a=t.shift()}}}function y(e,t){var r="";while(e.length>0&&!e[0].match(t)){r+=e.shift()}return r}function Ke(e){var t;if(e.length>0&&We.test(e[0])){e.shift();t=y(e,$e).trim();e.shift()}else{t=y(e,p)}return t}var Ye="input, textarea, select";function Qe(e){var t=te(e,"hx-trigger");var r=[];if(t){var n=Ge(t);do{y(n,ze);var i=n.length;var a=y(n,/[,\[\s]/);if(a!==""){if(a==="every"){var o={trigger:"every"};y(n,ze);o.pollInterval=d(y(n,/[,\[\s]/));y(n,ze);var s=Ze(e,n,"event");if(s){o.eventFilter=s}r.push(o)}else if(a.indexOf("sse:")===0){r.push({trigger:"sse",sseEvent:a.substr(4)})}else{var l={trigger:a};var s=Ze(e,n,"event");if(s){l.eventFilter=s}while(n.length>0&&n[0]!==","){y(n,ze);var u=n.shift();if(u==="changed"){l.changed=true}else if(u==="once"){l.once=true}else if(u==="consume"){l.consume=true}else if(u==="delay"&&n[0]===":"){n.shift();l.delay=d(y(n,p))}else if(u==="from"&&n[0]===":"){n.shift();if(We.test(n[0])){var f=Ke(n)}else{var f=y(n,p);if(f==="closest"||f==="find"||f==="next"||f==="previous"){n.shift();var c=Ke(n);if(c.length>0){f+=" "+c}}}l.from=f}else if(u==="target"&&n[0]===":"){n.shift();l.target=Ke(n)}else if(u==="throttle"&&n[0]===":"){n.shift();l.throttle=d(y(n,p))}else if(u==="queue"&&n[0]===":"){n.shift();l.queue=y(n,p)}else if(u==="root"&&n[0]===":"){n.shift();l[u]=Ke(n)}else if(u==="threshold"&&n[0]===":"){n.shift();l[u]=y(n,p)}else{fe(e,"htmx:syntax:error",{token:n.shift()})}}r.push(l)}}if(n.length===i){fe(e,"htmx:syntax:error",{token:n.shift()})}y(n,ze)}while(n[0]===","&&n.shift())}if(r.length>0){return r}else if(h(e,"form")){return[{trigger:"submit"}]}else if(h(e,'input[type="button"], input[type="submit"]')){return[{trigger:"click"}]}else if(h(e,Ye)){return[{trigger:"change"}]}else{return[{trigger:"click"}]}}function et(e){ae(e).cancelled=true}function tt(e,t,r){var n=ae(e);n.timeout=setTimeout(function(){if(se(e)&&n.cancelled!==true){if(!ot(r,e,Vt("hx:poll:trigger",{triggerSpec:r,target:e}))){t(e)}tt(e,t,r)}},r.pollInterval)}function rt(e){return location.hostname===e.hostname&&ee(e,"href")&&ee(e,"href").indexOf("#")!==0}function nt(t,r,e){if(t.tagName==="A"&&rt(t)&&(t.target===""||t.target==="_self")||t.tagName==="FORM"){r.boosted=true;var n,i;if(t.tagName==="A"){n="get";i=ee(t,"href")}else{var a=ee(t,"method");n=a?a.toLowerCase():"get";if(n==="get"){}i=ee(t,"action")}e.forEach(function(e){st(t,function(e,t){if(v(e,Q.config.disableSelector)){m(e);return}he(n,i,e,t)},r,e,true)})}}function it(e,t){if(e.type==="submit"||e.type==="click"){if(t.tagName==="FORM"){return true}if(h(t,'input[type="submit"], button')&&v(t,"form")!==null){return true}if(t.tagName==="A"&&t.href&&(t.getAttribute("href")==="#"||t.getAttribute("href").indexOf("#")!==0)){return true}}return false}function at(e,t){return ae(e).boosted&&e.tagName==="A"&&t.type==="click"&&(t.ctrlKey||t.metaKey)}function ot(e,t,r){var n=e.eventFilter;if(n){try{return n.call(t,r)!==true}catch(e){fe(re().body,"htmx:eventFilter:error",{error:e,source:n.source});return true}}return false}function st(a,o,e,s,l){var u=ae(a);var t;if(s.from){t=W(a,s.from)}else{t=[a]}if(s.changed){t.forEach(function(e){var t=ae(e);t.lastValue=e.value})}oe(t,function(n){var i=function(e){if(!se(a)){n.removeEventListener(s.trigger,i);return}if(at(a,e)){return}if(l||it(e,a)){e.preventDefault()}if(ot(s,a,e)){return}var t=ae(e);t.triggerSpec=s;if(t.handledFor==null){t.handledFor=[]}if(t.handledFor.indexOf(a)<0){t.handledFor.push(a);if(s.consume){e.stopPropagation()}if(s.target&&e.target){if(!h(e.target,s.target)){return}}if(s.once){if(u.triggeredOnce){return}else{u.triggeredOnce=true}}if(s.changed){var r=ae(n);if(r.lastValue===n.value){return}r.lastValue=n.value}if(u.delayed){clearTimeout(u.delayed)}if(u.throttle){return}if(s.throttle){if(!u.throttle){o(a,e);u.throttle=setTimeout(function(){u.throttle=null},s.throttle)}}else if(s.delay){u.delayed=setTimeout(function(){o(a,e)},s.delay)}else{ce(a,"htmx:trigger");o(a,e)}}};if(e.listenerInfos==null){e.listenerInfos=[]}e.listenerInfos.push({trigger:s.trigger,listener:i,on:n});n.addEventListener(s.trigger,i)})}var lt=false;var ut=null;function ft(){if(!ut){ut=function(){lt=true};window.addEventListener("scroll",ut);setInterval(function(){if(lt){lt=false;oe(re().querySelectorAll("[hx-trigger='revealed'],[data-hx-trigger='revealed']"),function(e){ct(e)})}},200)}}function ct(t){if(!o(t,"data-hx-revealed")&&k(t)){t.setAttribute("data-hx-revealed","true");var e=ae(t);if(e.initHash){ce(t,"revealed")}else{t.addEventListener("htmx:afterProcessNode",function(e){ce(t,"revealed")},{once:true})}}}function ht(e,t,r){var n=P(r);for(var i=0;i<n.length;i++){var a=n[i].split(/:(.+)/);if(a[0]==="connect"){vt(e,a[1],0)}if(a[0]==="send"){gt(e)}}}function vt(s,r,n){if(!se(s)){return}if(r.indexOf("/")==0){var e=location.hostname+(location.port?":"+location.port:"");if(location.protocol=="https:"){r="wss://"+e+r}else if(location.protocol=="http:"){r="ws://"+e+r}}var t=Q.createWebSocket(r);t.onerror=function(e){fe(s,"htmx:wsError",{error:e,socket:t});dt(s)};t.onclose=function(e){if([1006,1012,1013].indexOf(e.code)>=0){var t=mt(n);setTimeout(function(){vt(s,r,n+1)},t)}};t.onopen=function(e){n=0};ae(s).webSocket=t;t.addEventListener("message",function(e){if(dt(s)){return}var t=e.data;T(s,function(e){t=e.transformResponse(t,null,s)});var r=R(s);var n=l(t);var i=I(n.children);for(var a=0;a<i.length;a++){var o=i[a];xe(te(o,"hx-swap-oob")||"true",o,r)}Yt(r.tasks)})}function dt(e){if(!se(e)){ae(e).webSocket.close();return true}}function gt(u){var f=c(u,function(e){return ae(e).webSocket!=null});if(f){u.addEventListener(Qe(u)[0].trigger,function(e){var t=ae(f).webSocket;var r=vr(u,f);var n=ur(u,"post");var i=n.errors;var a=n.values;var o=Cr(u);var s=le(a,o);var l=dr(s,u);l["HEADERS"]=r;if(i&&i.length>0){ce(u,"htmx:validation:halted",i);return}t.send(JSON.stringify(l));if(it(e,u)){e.preventDefault()}})}else{fe(u,"htmx:noWebSocketSourceError")}}function mt(e){var t=Q.config.wsReconnectDelay;if(typeof t==="function"){return t(e)}if(t==="full-jitter"){var r=Math.min(e,6);var n=1e3*Math.pow(2,r);return n*Math.random()}x('htmx.config.wsReconnectDelay must either be a function or the string "full-jitter"')}function pt(e,t,r){var n=P(r);for(var i=0;i<n.length;i++){var a=n[i].split(/:(.+)/);if(a[0]==="connect"){yt(e,a[1])}if(a[0]==="swap"){xt(e,a[1])}}}function yt(t,e){var r=Q.createEventSource(e);r.onerror=function(e){fe(t,"htmx:sseError",{error:e,source:r});wt(t)};ae(t).sseEventSource=r}function xt(a,o){var s=c(a,St);if(s){var l=ae(s).sseEventSource;var u=function(e){if(wt(s)){return}if(!se(a)){l.removeEventListener(o,u);return}var t=e.data;T(a,function(e){t=e.transformResponse(t,null,a)});var r=mr(a);var n=ge(a);var i=R(a);Ue(r.swapStyle,n,a,t,i);Yt(i.tasks);ce(a,"htmx:sseMessage",e)};ae(a).sseListener=u;l.addEventListener(o,u)}else{fe(a,"htmx:noSSESourceError")}}function bt(e,t,r){var n=c(e,St);if(n){var i=ae(n).sseEventSource;var a=function(){if(!wt(n)){if(se(e)){t(e)}else{i.removeEventListener(r,a)}}};ae(e).sseListener=a;i.addEventListener(r,a)}else{fe(e,"htmx:noSSESourceError")}}function wt(e){if(!se(e)){ae(e).sseEventSource.close();return true}}function St(e){return ae(e).sseEventSource!=null}function Et(e,t,r,n){var i=function(){if(!r.loaded){r.loaded=true;t(e)}};if(n){setTimeout(i,n)}else{i()}}function Ct(t,i,e){var a=false;oe(b,function(r){if(o(t,"hx-"+r)){var n=te(t,"hx-"+r);a=true;i.path=n;i.verb=r;e.forEach(function(e){Tt(t,e,i,function(e,t){if(v(e,Q.config.disableSelector)){m(e);return}he(r,n,e,t)})})}});return a}function Tt(n,e,t,r){if(e.sseEvent){bt(n,r,e.sseEvent)}else if(e.trigger==="revealed"){ft();st(n,r,t,e);ct(n)}else if(e.trigger==="intersect"){var i={};if(e.root){i.root=ue(n,e.root)}if(e.threshold){i.threshold=parseFloat(e.threshold)}var a=new IntersectionObserver(function(e){for(var t=0;t<e.length;t++){var r=e[t];if(r.isIntersecting){ce(n,"intersect");break}}},i);a.observe(n);st(n,r,t,e)}else if(e.trigger==="load"){if(!ot(e,n,Vt("load",{elt:n}))){Et(n,r,t,e.delay)}}else if(e.pollInterval){t.polling=true;tt(n,r,e)}else{st(n,r,t,e)}}function Rt(e){if(Q.config.allowScriptTags&&(e.type==="text/javascript"||e.type==="module"||e.type==="")){var t=re().createElement("script");oe(e.attributes,function(e){t.setAttribute(e.name,e.value)});t.textContent=e.textContent;t.async=false;if(Q.config.inlineScriptNonce){t.nonce=Q.config.inlineScriptNonce}var r=e.parentElement;try{r.insertBefore(t,e)}catch(e){x(e)}finally{if(e.parentElement){e.parentElement.removeChild(e)}}}}function Ot(e){if(h(e,"script")){Rt(e)}oe(f(e,"script"),function(e){Rt(e)})}function qt(){return document.querySelector("[hx-boost], [data-hx-boost]")}function Ht(e){var t=null;var r=[];if(document.evaluate){var n=document.evaluate('//*[@*[ starts-with(name(), "hx-on:") or starts-with(name(), "data-hx-on:") ]]',e);while(t=n.iterateNext())r.push(t)}else{var i=document.getElementsByTagName("*");for(var a=0;a<i.length;a++){var o=i[a].attributes;for(var s=0;s<o.length;s++){var l=o[s].name;if(g(l,"hx-on:")||g(l,"data-hx-on:")){r.push(i[a])}}}}return r}function Lt(e){if(e.querySelectorAll){var t=qt()?", a":"";var r=e.querySelectorAll(w+t+", form, [type='submit'], [hx-sse], [data-hx-sse], [hx-ws],"+" [data-hx-ws], [hx-ext], [data-hx-ext], [hx-trigger], [data-hx-trigger], [hx-on], [data-hx-on]");return r}else{return[]}}function At(e){var t=v(e.target,"button, input[type='submit']");var r=It(e);if(r){r.lastButtonClicked=t}}function Nt(e){var t=It(e);if(t){t.lastButtonClicked=null}}function It(e){var t=v(e.target,"button, input[type='submit']");if(!t){return}var r=s("#"+ee(t,"form"))||v(t,"form");if(!r){return}return ae(r)}function kt(e){e.addEventListener("click",At);e.addEventListener("focusin",At);e.addEventListener("focusout",Nt)}function Pt(e){var t=Ge(e);var r=0;for(let e=0;e<t.length;e++){const n=t[e];if(n==="{"){r++}else if(n==="}"){r--}}return r}function Mt(t,e,r){var n=ae(t);if(!Array.isArray(n.onHandlers)){n.onHandlers=[]}var i;var a=function(e){return wr(t,function(){if(!i){i=new Function("event",r)}i.call(t,e)})};t.addEventListener(e,a);n.onHandlers.push({event:e,listener:a})}function Dt(e){var t=te(e,"hx-on");if(t){var r={};var n=t.split("\n");var i=null;var a=0;while(n.length>0){var o=n.shift();var s=o.match(/^\s*([a-zA-Z:\-\.]+:)(.*)/);if(a===0&&s){o.split(":");i=s[1].slice(0,-1);r[i]=s[2]}else{r[i]+=o}a+=Pt(o)}for(var l in r){Mt(e,l,r[l])}}}function Xt(t){Oe(t);for(var e=0;e<t.attributes.length;e++){var r=t.attributes[e].name;var n=t.attributes[e].value;if(g(r,"hx-on:")||g(r,"data-hx-on:")){let e=r.slice(r.indexOf(":")+1);if(g(e,":"))e="htmx"+e;Mt(t,e,n)}}}function Ut(t){if(v(t,Q.config.disableSelector)){m(t);return}var r=ae(t);if(r.initHash!==Re(t)){qe(t);r.initHash=Re(t);Dt(t);ce(t,"htmx:beforeProcessNode");if(t.value){r.lastValue=t.value}var e=Qe(t);var n=Ct(t,r,e);if(!n){if(ne(t,"hx-boost")==="true"){nt(t,r,e)}else if(o(t,"hx-trigger")){e.forEach(function(e){Tt(t,e,r,function(){})})}}if(t.tagName==="FORM"||ee(t,"type")==="submit"&&o(t,"form")){kt(t)}var i=te(t,"hx-sse");if(i){pt(t,r,i)}var a=te(t,"hx-ws");if(a){ht(t,r,a)}ce(t,"htmx:afterProcessNode")}}function Bt(e){e=s(e);if(v(e,Q.config.disableSelector)){m(e);return}Ut(e);oe(Lt(e),function(e){Ut(e)});oe(Ht(e),Xt)}function Ft(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function Vt(e,t){var r;if(window.CustomEvent&&typeof window.CustomEvent==="function"){r=new CustomEvent(e,{bubbles:true,cancelable:true,detail:t})}else{r=re().createEvent("CustomEvent");r.initCustomEvent(e,true,true,t)}return r}function fe(e,t,r){ce(e,t,le({error:t},r))}function jt(e){return e==="htmx:afterProcessNode"}function T(e,t){oe(Mr(e),function(e){try{t(e)}catch(e){x(e)}})}function x(e){if(console.error){console.error(e)}else if(console.log){console.log("ERROR: ",e)}}function ce(e,t,r){e=s(e);if(r==null){r={}}r["elt"]=e;var n=Vt(t,r);if(Q.logger&&!jt(t)){Q.logger(e,t,r)}if(r.error){x(r.error);ce(e,"htmx:error",{errorInfo:r})}var i=e.dispatchEvent(n);var a=Ft(t);if(i&&a!==t){var o=Vt(a,n.detail);i=i&&e.dispatchEvent(o)}T(e,function(e){i=i&&(e.onEvent(t,n)!==false&&!n.defaultPrevented)});return i}var _t=location.pathname+location.search;function zt(){var e=re().querySelector("[hx-history-elt],[data-hx-history-elt]");return e||re().body}function Wt(e,t,r,n){if(!M()){return}if(Q.config.historyCacheSize<=0){localStorage.removeItem("htmx-history-cache");return}e=D(e);var i=E(localStorage.getItem("htmx-history-cache"))||[];for(var a=0;a<i.length;a++){if(i[a].url===e){i.splice(a,1);break}}var o={url:e,content:t,title:r,scroll:n};ce(re().body,"htmx:historyItemCreated",{item:o,cache:i});i.push(o);while(i.length>Q.config.historyCacheSize){i.shift()}while(i.length>0){try{localStorage.setItem("htmx-history-cache",JSON.stringify(i));break}catch(e){fe(re().body,"htmx:historyCacheError",{cause:e,cache:i});i.shift()}}}function $t(e){if(!M()){return null}e=D(e);var t=E(localStorage.getItem("htmx-history-cache"))||[];for(var r=0;r<t.length;r++){if(t[r].url===e){return t[r]}}return null}function Gt(e){var t=Q.config.requestClass;var r=e.cloneNode(true);oe(f(r,"."+t),function(e){n(e,t)});return r.innerHTML}function Jt(){var e=zt();var t=_t||location.pathname+location.search;var r;try{r=re().querySelector('[hx-history="false" i],[data-hx-history="false" i]')}catch(e){r=re().querySelector('[hx-history="false"],[data-hx-history="false"]')}if(!r){ce(re().body,"htmx:beforeHistorySave",{path:t,historyElt:e});Wt(t,Gt(e),re().title,window.scrollY)}if(Q.config.historyEnabled)history.replaceState({htmx:true},re().title,window.location.href)}function Zt(e){if(Q.config.getCacheBusterParam){e=e.replace(/org\.htmx\.cache-buster=[^&]*&?/,"");if(_(e,"&")||_(e,"?")){e=e.slice(0,-1)}}if(Q.config.historyEnabled){history.pushState({htmx:true},"",e)}_t=e}function Kt(e){if(Q.config.historyEnabled)history.replaceState({htmx:true},"",e);_t=e}function Yt(e){oe(e,function(e){e.call()})}function Qt(a){var e=new XMLHttpRequest;var o={path:a,xhr:e};ce(re().body,"htmx:historyCacheMiss",o);e.open("GET",a,true);e.setRequestHeader("HX-History-Restore-Request","true");e.onload=function(){if(this.status>=200&&this.status<400){ce(re().body,"htmx:historyCacheMissLoad",o);var e=l(this.response);e=e.querySelector("[hx-history-elt],[data-hx-history-elt]")||e;var t=zt();var r=R(t);var n=Xe(this.response);if(n){var i=C("title");if(i){i.innerHTML=n}else{window.document.title=n}}Pe(t,e,r);Yt(r.tasks);_t=a;ce(re().body,"htmx:historyRestore",{path:a,cacheMiss:true,serverResponse:this.response})}else{fe(re().body,"htmx:historyCacheMissLoadError",o)}};e.send()}function er(e){Jt();e=e||location.pathname+location.search;var t=$t(e);if(t){var r=l(t.content);var n=zt();var i=R(n);Pe(n,r,i);Yt(i.tasks);document.title=t.title;setTimeout(function(){window.scrollTo(0,t.scroll)},0);_t=e;ce(re().body,"htmx:historyRestore",{path:e,item:t})}else{if(Q.config.refreshOnHistoryMiss){window.location.reload(true)}else{Qt(e)}}}function tr(e){var t=Y(e,"hx-indicator");if(t==null){t=[e]}oe(t,function(e){var t=ae(e);t.requestCount=(t.requestCount||0)+1;e.classList["add"].call(e.classList,Q.config.requestClass)});return t}function rr(e){var t=Y(e,"hx-disabled-elt");if(t==null){t=[]}oe(t,function(e){var t=ae(e);t.requestCount=(t.requestCount||0)+1;e.setAttribute("disabled","")});return t}function nr(e,t){oe(e,function(e){var t=ae(e);t.requestCount=(t.requestCount||0)-1;if(t.requestCount===0){e.classList["remove"].call(e.classList,Q.config.requestClass)}});oe(t,function(e){var t=ae(e);t.requestCount=(t.requestCount||0)-1;if(t.requestCount===0){e.removeAttribute("disabled")}})}function ir(e,t){for(var r=0;r<e.length;r++){var n=e[r];if(n.isSameNode(t)){return true}}return false}function ar(e){if(e.name===""||e.name==null||e.disabled){return false}if(e.type==="button"||e.type==="submit"||e.tagName==="image"||e.tagName==="reset"||e.tagName==="file"){return false}if(e.type==="checkbox"||e.type==="radio"){return e.checked}return true}function or(e,t,r){if(e!=null&&t!=null){var n=r[e];if(n===undefined){r[e]=t}else if(Array.isArray(n)){if(Array.isArray(t)){r[e]=n.concat(t)}else{n.push(t)}}else{if(Array.isArray(t)){r[e]=[n].concat(t)}else{r[e]=[n,t]}}}}function sr(t,r,n,e,i){if(e==null||ir(t,e)){return}else{t.push(e)}if(ar(e)){var a=ee(e,"name");var o=e.value;if(e.multiple&&e.tagName==="SELECT"){o=I(e.querySelectorAll("option:checked")).map(function(e){return e.value})}if(e.files){o=I(e.files)}or(a,o,r);if(i){lr(e,n)}}if(h(e,"form")){var s=e.elements;oe(s,function(e){sr(t,r,n,e,i)})}}function lr(e,t){if(e.willValidate){ce(e,"htmx:validation:validate");if(!e.checkValidity()){t.push({elt:e,message:e.validationMessage,validity:e.validity});ce(e,"htmx:validation:failed",{message:e.validationMessage,validity:e.validity})}}}function ur(e,t){var r=[];var n={};var i={};var a=[];var o=ae(e);if(o.lastButtonClicked&&!se(o.lastButtonClicked)){o.lastButtonClicked=null}var s=h(e,"form")&&e.noValidate!==true||te(e,"hx-validate")==="true";if(o.lastButtonClicked){s=s&&o.lastButtonClicked.formNoValidate!==true}if(t!=="get"){sr(r,i,a,v(e,"form"),s)}sr(r,n,a,e,s);if(o.lastButtonClicked||e.tagName==="BUTTON"||e.tagName==="INPUT"&&ee(e,"type")==="submit"){var l=o.lastButtonClicked||e;var u=ee(l,"name");or(u,l.value,i)}var f=Y(e,"hx-include");oe(f,function(e){sr(r,n,a,e,s);if(!h(e,"form")){oe(e.querySelectorAll(Ye),function(e){sr(r,n,a,e,s)})}});n=le(n,i);return{errors:a,values:n}}function fr(e,t,r){if(e!==""){e+="&"}if(String(r)==="[object Object]"){r=JSON.stringify(r)}var n=encodeURIComponent(r);e+=encodeURIComponent(t)+"="+n;return e}function cr(e){var t="";for(var r in e){if(e.hasOwnProperty(r)){var n=e[r];if(Array.isArray(n)){oe(n,function(e){t=fr(t,r,e)})}else{t=fr(t,r,n)}}}return t}function hr(e){var t=new FormData;for(var r in e){if(e.hasOwnProperty(r)){var n=e[r];if(Array.isArray(n)){oe(n,function(e){t.append(r,e)})}else{t.append(r,n)}}}return t}function vr(e,t,r){var n={"HX-Request":"true","HX-Trigger":ee(e,"id"),"HX-Trigger-Name":ee(e,"name"),"HX-Target":te(t,"id"),"HX-Current-URL":re().location.href};br(e,"hx-headers",false,n);if(r!==undefined){n["HX-Prompt"]=r}if(ae(e).boosted){n["HX-Boosted"]="true"}return n}function dr(t,e){var r=ne(e,"hx-params");if(r){if(r==="none"){return{}}else if(r==="*"){return t}else if(r.indexOf("not ")===0){oe(r.substr(4).split(","),function(e){e=e.trim();delete t[e]});return t}else{var n={};oe(r.split(","),function(e){e=e.trim();n[e]=t[e]});return n}}else{return t}}function gr(e){return ee(e,"href")&&ee(e,"href").indexOf("#")>=0}function mr(e,t){var r=t?t:ne(e,"hx-swap");var n={swapStyle:ae(e).boosted?"innerHTML":Q.config.defaultSwapStyle,swapDelay:Q.config.defaultSwapDelay,settleDelay:Q.config.defaultSettleDelay};if(Q.config.scrollIntoViewOnBoost&&ae(e).boosted&&!gr(e)){n["show"]="top"}if(r){var i=P(r);if(i.length>0){for(var a=0;a<i.length;a++){var o=i[a];if(o.indexOf("swap:")===0){n["swapDelay"]=d(o.substr(5))}else if(o.indexOf("settle:")===0){n["settleDelay"]=d(o.substr(7))}else if(o.indexOf("transition:")===0){n["transition"]=o.substr(11)==="true"}else if(o.indexOf("ignoreTitle:")===0){n["ignoreTitle"]=o.substr(12)==="true"}else if(o.indexOf("scroll:")===0){var s=o.substr(7);var l=s.split(":");var u=l.pop();var f=l.length>0?l.join(":"):null;n["scroll"]=u;n["scrollTarget"]=f}else if(o.indexOf("show:")===0){var c=o.substr(5);var l=c.split(":");var h=l.pop();var f=l.length>0?l.join(":"):null;n["show"]=h;n["showTarget"]=f}else if(o.indexOf("focus-scroll:")===0){var v=o.substr("focus-scroll:".length);n["focusScroll"]=v=="true"}else if(a==0){n["swapStyle"]=o}else{x("Unknown modifier in hx-swap: "+o)}}}}return n}function pr(e){return ne(e,"hx-encoding")==="multipart/form-data"||h(e,"form")&&ee(e,"enctype")==="multipart/form-data"}function yr(t,r,n){var i=null;T(r,function(e){if(i==null){i=e.encodeParameters(t,n,r)}});if(i!=null){return i}else{if(pr(r)){return hr(n)}else{return cr(n)}}}function R(e){return{tasks:[],elts:[e]}}function xr(e,t){var r=e[0];var n=e[e.length-1];if(t.scroll){var i=null;if(t.scrollTarget){i=ue(r,t.scrollTarget)}if(t.scroll==="top"&&(r||i)){i=i||r;i.scrollTop=0}if(t.scroll==="bottom"&&(n||i)){i=i||n;i.scrollTop=i.scrollHeight}}if(t.show){var i=null;if(t.showTarget){var a=t.showTarget;if(t.showTarget==="window"){a="body"}i=ue(r,a)}if(t.show==="top"&&(r||i)){i=i||r;i.scrollIntoView({block:"start",behavior:Q.config.scrollBehavior})}if(t.show==="bottom"&&(n||i)){i=i||n;i.scrollIntoView({block:"end",behavior:Q.config.scrollBehavior})}}}function br(e,t,r,n){if(n==null){n={}}if(e==null){return n}var i=te(e,t);if(i){var a=i.trim();var o=r;if(a==="unset"){return null}if(a.indexOf("javascript:")===0){a=a.substr(11);o=true}else if(a.indexOf("js:")===0){a=a.substr(3);o=true}if(a.indexOf("{")!==0){a="{"+a+"}"}var s;if(o){s=wr(e,function(){return Function("return ("+a+")")()},{})}else{s=E(a)}for(var l in s){if(s.hasOwnProperty(l)){if(n[l]==null){n[l]=s[l]}}}}return br(u(e),t,r,n)}function wr(e,t,r){if(Q.config.allowEval){return t()}else{fe(e,"htmx:evalDisallowedError");return r}}function Sr(e,t){return br(e,"hx-vars",true,t)}function Er(e,t){return br(e,"hx-vals",false,t)}function Cr(e){return le(Sr(e),Er(e))}function Tr(t,r,n){if(n!==null){try{t.setRequestHeader(r,n)}catch(e){t.setRequestHeader(r,encodeURIComponent(n));t.setRequestHeader(r+"-URI-AutoEncoded","true")}}}function Rr(t){if(t.responseURL&&typeof URL!=="undefined"){try{var e=new URL(t.responseURL);return e.pathname+e.search}catch(e){fe(re().body,"htmx:badResponseUrl",{url:t.responseURL})}}}function O(e,t){return e.getAllResponseHeaders().match(t)}function Or(e,t,r){e=e.toLowerCase();if(r){if(r instanceof Element||L(r,"String")){return he(e,t,null,null,{targetOverride:s(r),returnPromise:true})}else{return he(e,t,s(r.source),r.event,{handler:r.handler,headers:r.headers,values:r.values,targetOverride:s(r.target),swapOverride:r.swap,select:r.select,returnPromise:true})}}else{return he(e,t,null,null,{returnPromise:true})}}function qr(e){var t=[];while(e){t.push(e);e=e.parentElement}return t}function Hr(e,t,r){var n;var i;if(typeof URL==="function"){i=new URL(t,document.location.href);var a=document.location.origin;n=a===i.origin}else{i=t;n=g(t,document.location.origin)}if(Q.config.selfRequestsOnly){if(!n){return false}}return ce(e,"htmx:validateUrl",le({url:i,sameHost:n},r))}function he(t,r,n,i,a,e){var o=null;var s=null;a=a!=null?a:{};if(a.returnPromise&&typeof Promise!=="undefined"){var l=new Promise(function(e,t){o=e;s=t})}if(n==null){n=re().body}var M=a.handler||Ar;var D=a.select||null;if(!se(n)){ie(o);return l}var u=a.targetOverride||ge(n);if(u==null||u==ve){fe(n,"htmx:targetError",{target:te(n,"hx-target")});ie(s);return l}var f=ae(n);var c=f.lastButtonClicked;if(c){var h=ee(c,"formaction");if(h!=null){r=h}var v=ee(c,"formmethod");if(v!=null){if(v.toLowerCase()!=="dialog"){t=v}}}var d=ne(n,"hx-confirm");if(e===undefined){var X=function(e){return he(t,r,n,i,a,!!e)};var U={target:u,elt:n,path:r,verb:t,triggeringEvent:i,etc:a,issueRequest:X,question:d};if(ce(n,"htmx:confirm",U)===false){ie(o);return l}}var g=n;var m=ne(n,"hx-sync");var p=null;var y=false;if(m){var B=m.split(":");var F=B[0].trim();if(F==="this"){g=de(n,"hx-sync")}else{g=ue(n,F)}m=(B[1]||"drop").trim();f=ae(g);if(m==="drop"&&f.xhr&&f.abortable!==true){ie(o);return l}else if(m==="abort"){if(f.xhr){ie(o);return l}else{y=true}}else if(m==="replace"){ce(g,"htmx:abort")}else if(m.indexOf("queue")===0){var V=m.split(" ");p=(V[1]||"last").trim()}}if(f.xhr){if(f.abortable){ce(g,"htmx:abort")}else{if(p==null){if(i){var x=ae(i);if(x&&x.triggerSpec&&x.triggerSpec.queue){p=x.triggerSpec.queue}}if(p==null){p="last"}}if(f.queuedRequests==null){f.queuedRequests=[]}if(p==="first"&&f.queuedRequests.length===0){f.queuedRequests.push(function(){he(t,r,n,i,a)})}else if(p==="all"){f.queuedRequests.push(function(){he(t,r,n,i,a)})}else if(p==="last"){f.queuedRequests=[];f.queuedRequests.push(function(){he(t,r,n,i,a)})}ie(o);return l}}var b=new XMLHttpRequest;f.xhr=b;f.abortable=y;var w=function(){f.xhr=null;f.abortable=false;if(f.queuedRequests!=null&&f.queuedRequests.length>0){var e=f.queuedRequests.shift();e()}};var j=ne(n,"hx-prompt");if(j){var S=prompt(j);if(S===null||!ce(n,"htmx:prompt",{prompt:S,target:u})){ie(o);w();return l}}if(d&&!e){if(!confirm(d)){ie(o);w();return l}}var E=vr(n,u,S);if(t!=="get"&&!pr(n)){E["Content-Type"]="application/x-www-form-urlencoded"}if(a.headers){E=le(E,a.headers)}var _=ur(n,t);var C=_.errors;var T=_.values;if(a.values){T=le(T,a.values)}var z=Cr(n);var W=le(T,z);var R=dr(W,n);if(Q.config.getCacheBusterParam&&t==="get"){R["org.htmx.cache-buster"]=ee(u,"id")||"true"}if(r==null||r===""){r=re().location.href}var O=br(n,"hx-request");var $=ae(n).boosted;var q=Q.config.methodsThatUseUrlParams.indexOf(t)>=0;var H={boosted:$,useUrlParams:q,parameters:R,unfilteredParameters:W,headers:E,target:u,verb:t,errors:C,withCredentials:a.credentials||O.credentials||Q.config.withCredentials,timeout:a.timeout||O.timeout||Q.config.timeout,path:r,triggeringEvent:i};if(!ce(n,"htmx:configRequest",H)){ie(o);w();return l}r=H.path;t=H.verb;E=H.headers;R=H.parameters;C=H.errors;q=H.useUrlParams;if(C&&C.length>0){ce(n,"htmx:validation:halted",H);ie(o);w();return l}var G=r.split("#");var J=G[0];var L=G[1];var A=r;if(q){A=J;var Z=Object.keys(R).length!==0;if(Z){if(A.indexOf("?")<0){A+="?"}else{A+="&"}A+=cr(R);if(L){A+="#"+L}}}if(!Hr(n,A,H)){fe(n,"htmx:invalidPath",H);ie(s);return l}b.open(t.toUpperCase(),A,true);b.overrideMimeType("text/html");b.withCredentials=H.withCredentials;b.timeout=H.timeout;if(O.noHeaders){}else{for(var N in E){if(E.hasOwnProperty(N)){var K=E[N];Tr(b,N,K)}}}var I={xhr:b,target:u,requestConfig:H,etc:a,boosted:$,select:D,pathInfo:{requestPath:r,finalRequestPath:A,anchor:L}};b.onload=function(){try{var e=qr(n);I.pathInfo.responsePath=Rr(b);M(n,I);nr(k,P);ce(n,"htmx:afterRequest",I);ce(n,"htmx:afterOnLoad",I);if(!se(n)){var t=null;while(e.length>0&&t==null){var r=e.shift();if(se(r)){t=r}}if(t){ce(t,"htmx:afterRequest",I);ce(t,"htmx:afterOnLoad",I)}}ie(o);w()}catch(e){fe(n,"htmx:onLoadError",le({error:e},I));throw e}};b.onerror=function(){nr(k,P);fe(n,"htmx:afterRequest",I);fe(n,"htmx:sendError",I);ie(s);w()};b.onabort=function(){nr(k,P);fe(n,"htmx:afterRequest",I);fe(n,"htmx:sendAbort",I);ie(s);w()};b.ontimeout=function(){nr(k,P);fe(n,"htmx:afterRequest",I);fe(n,"htmx:timeout",I);ie(s);w()};if(!ce(n,"htmx:beforeRequest",I)){ie(o);w();return l}var k=tr(n);var P=rr(n);oe(["loadstart","loadend","progress","abort"],function(t){oe([b,b.upload],function(e){e.addEventListener(t,function(e){ce(n,"htmx:xhr:"+t,{lengthComputable:e.lengthComputable,loaded:e.loaded,total:e.total})})})});ce(n,"htmx:beforeSend",I);var Y=q?null:yr(b,n,R);b.send(Y);return l}function Lr(e,t){var r=t.xhr;var n=null;var i=null;if(O(r,/HX-Push:/i)){n=r.getResponseHeader("HX-Push");i="push"}else if(O(r,/HX-Push-Url:/i)){n=r.getResponseHeader("HX-Push-Url");i="push"}else if(O(r,/HX-Replace-Url:/i)){n=r.getResponseHeader("HX-Replace-Url");i="replace"}if(n){if(n==="false"){return{}}else{return{type:i,path:n}}}var a=t.pathInfo.finalRequestPath;var o=t.pathInfo.responsePath;var s=ne(e,"hx-push-url");var l=ne(e,"hx-replace-url");var u=ae(e).boosted;var f=null;var c=null;if(s){f="push";c=s}else if(l){f="replace";c=l}else if(u){f="push";c=o||a}if(c){if(c==="false"){return{}}if(c==="true"){c=o||a}if(t.pathInfo.anchor&&c.indexOf("#")===-1){c=c+"#"+t.pathInfo.anchor}return{type:f,path:c}}else{return{}}}function Ar(l,u){var f=u.xhr;var c=u.target;var e=u.etc;var t=u.requestConfig;var h=u.select;if(!ce(l,"htmx:beforeOnLoad",u))return;if(O(f,/HX-Trigger:/i)){Be(f,"HX-Trigger",l)}if(O(f,/HX-Location:/i)){Jt();var r=f.getResponseHeader("HX-Location");var v;if(r.indexOf("{")===0){v=E(r);r=v["path"];delete v["path"]}Or("GET",r,v).then(function(){Zt(r)});return}var n=O(f,/HX-Refresh:/i)&&"true"===f.getResponseHeader("HX-Refresh");if(O(f,/HX-Redirect:/i)){location.href=f.getResponseHeader("HX-Redirect");n&&location.reload();return}if(n){location.reload();return}if(O(f,/HX-Retarget:/i)){u.target=re().querySelector(f.getResponseHeader("HX-Retarget"))}var d=Lr(l,u);var i=f.status>=200&&f.status<400&&f.status!==204;var g=f.response;var a=f.status>=400;var m=Q.config.ignoreTitle;var o=le({shouldSwap:i,serverResponse:g,isError:a,ignoreTitle:m},u);if(!ce(c,"htmx:beforeSwap",o))return;c=o.target;g=o.serverResponse;a=o.isError;m=o.ignoreTitle;u.target=c;u.failed=a;u.successful=!a;if(o.shouldSwap){if(f.status===286){et(l)}T(l,function(e){g=e.transformResponse(g,f,l)});if(d.type){Jt()}var s=e.swapOverride;if(O(f,/HX-Reswap:/i)){s=f.getResponseHeader("HX-Reswap")}var v=mr(l,s);if(v.hasOwnProperty("ignoreTitle")){m=v.ignoreTitle}c.classList.add(Q.config.swappingClass);var p=null;var y=null;var x=function(){try{var e=document.activeElement;var t={};try{t={elt:e,start:e?e.selectionStart:null,end:e?e.selectionEnd:null}}catch(e){}var r;if(h){r=h}if(O(f,/HX-Reselect:/i)){r=f.getResponseHeader("HX-Reselect")}if(d.type){ce(re().body,"htmx:beforeHistoryUpdate",le({history:d},u));if(d.type==="push"){Zt(d.path);ce(re().body,"htmx:pushedIntoHistory",{path:d.path})}else{Kt(d.path);ce(re().body,"htmx:replacedInHistory",{path:d.path})}}var n=R(c);Ue(v.swapStyle,c,l,g,n,r);if(t.elt&&!se(t.elt)&&ee(t.elt,"id")){var i=document.getElementById(ee(t.elt,"id"));var a={preventScroll:v.focusScroll!==undefined?!v.focusScroll:!Q.config.defaultFocusScroll};if(i){if(t.start&&i.setSelectionRange){try{i.setSelectionRange(t.start,t.end)}catch(e){}}i.focus(a)}}c.classList.remove(Q.config.swappingClass);oe(n.elts,function(e){if(e.classList){e.classList.add(Q.config.settlingClass)}ce(e,"htmx:afterSwap",u)});if(O(f,/HX-Trigger-After-Swap:/i)){var o=l;if(!se(l)){o=re().body}Be(f,"HX-Trigger-After-Swap",o)}var s=function(){oe(n.tasks,function(e){e.call()});oe(n.elts,function(e){if(e.classList){e.classList.remove(Q.config.settlingClass)}ce(e,"htmx:afterSettle",u)});if(u.pathInfo.anchor){var e=re().getElementById(u.pathInfo.anchor);if(e){e.scrollIntoView({block:"start",behavior:"auto"})}}if(n.title&&!m){var t=C("title");if(t){t.innerHTML=n.title}else{window.document.title=n.title}}xr(n.elts,v);if(O(f,/HX-Trigger-After-Settle:/i)){var r=l;if(!se(l)){r=re().body}Be(f,"HX-Trigger-After-Settle",r)}ie(p)};if(v.settleDelay>0){setTimeout(s,v.settleDelay)}else{s()}}catch(e){fe(l,"htmx:swapError",u);ie(y);throw e}};var b=Q.config.globalViewTransitions;if(v.hasOwnProperty("transition")){b=v.transition}if(b&&ce(l,"htmx:beforeTransition",u)&&typeof Promise!=="undefined"&&document.startViewTransition){var w=new Promise(function(e,t){p=e;y=t});var S=x;x=function(){document.startViewTransition(function(){S();return w})}}if(v.swapDelay>0){setTimeout(x,v.swapDelay)}else{x()}}if(a){fe(l,"htmx:responseError",le({error:"Response Status Error Code "+f.status+" from "+u.pathInfo.requestPath},u))}}var Nr={};function Ir(){return{init:function(e){return null},onEvent:function(e,t){return true},transformResponse:function(e,t,r){return e},isInlineSwap:function(e){return false},handleSwap:function(e,t,r,n){return false},encodeParameters:function(e,t,r){return null}}}function kr(e,t){if(t.init){t.init(r)}Nr[e]=le(Ir(),t)}function Pr(e){delete Nr[e]}function Mr(e,r,n){if(e==undefined){return r}if(r==undefined){r=[]}if(n==undefined){n=[]}var t=te(e,"hx-ext");if(t){oe(t.split(","),function(e){e=e.replace(/ /g,"");if(e.slice(0,7)=="ignore:"){n.push(e.slice(7));return}if(n.indexOf(e)<0){var t=Nr[e];if(t&&r.indexOf(t)<0){r.push(t)}}})}return Mr(u(e),r,n)}function Dr(e){var t=function(){if(!e)return;e();e=null};if(re().readyState==="complete"){t()}else{re().addEventListener("DOMContentLoaded",function(){t()});re().addEventListener("readystatechange",function(){if(re().readyState!=="complete")return;t()})}}function Xr(){if(Q.config.includeIndicatorStyles!==false){re().head.insertAdjacentHTML("beforeend","<style> ."+Q.config.indicatorClass+"{opacity:0} ."+Q.config.requestClass+" ."+Q.config.indicatorClass+"{opacity:1; transition: opacity 200ms ease-in;} ."+Q.config.requestClass+"."+Q.config.indicatorClass+"{opacity:1; transition: opacity 200ms ease-in;} </style>")}}function Ur(){var e=re().querySelector('meta[name="htmx-config"]');if(e){return E(e.content)}else{return null}}function Br(){var e=Ur();if(e){Q.config=le(Q.config,e)}}Dr(function(){Br();Xr();var e=re().body;Bt(e);var t=re().querySelectorAll("[hx-trigger='restored'],[data-hx-trigger='restored']");e.addEventListener("htmx:abort",function(e){var t=e.target;var r=ae(t);if(r&&r.xhr){r.xhr.abort()}});var r=window.onpopstate;window.onpopstate=function(e){if(e.state&&e.state.htmx){er();oe(t,function(e){ce(e,"htmx:restored",{document:re(),triggerEvent:ce})})}else{if(r){r(e)}}};setTimeout(function(){ce(e,"htmx:load",{});e=null},0)});return Q}()});
|
|
1
|
+
const htmx=function(){"use strict";const Q={onLoad:_,process:It,on:me,off:pe,trigger:fe,ajax:Sn,find:v,findAll:c,closest:h,values:function(e,t){const n=nn(e,t||"post");return n.values},remove:G,addClass:J,removeClass:r,toggleClass:Z,takeClass:K,defineExtension:Hn,removeExtension:Ln,logAll:z,logNone:$,logger:null,config:{historyEnabled:true,historyCacheSize:10,refreshOnHistoryMiss:false,defaultSwapStyle:"innerHTML",defaultSwapDelay:0,defaultSettleDelay:20,includeIndicatorStyles:true,indicatorClass:"htmx-indicator",requestClass:"htmx-request",addedClass:"htmx-added",settlingClass:"htmx-settling",swappingClass:"htmx-swapping",allowEval:true,allowScriptTags:true,inlineScriptNonce:"",attributesToSettle:["class","style","width","height"],withCredentials:false,timeout:0,wsReconnectDelay:"full-jitter",wsBinaryType:"blob",disableSelector:"[hx-disable], [data-hx-disable]",useTemplateFragments:false,scrollBehavior:"instant",defaultFocusScroll:false,getCacheBusterParam:false,globalViewTransitions:false,methodsThatUseUrlParams:["get","delete"],selfRequestsOnly:true,ignoreTitle:false,scrollIntoViewOnBoost:true,triggerSpecsCache:null},parseInterval:d,_:t,version:"1.9.10"};const n={addTriggerHandler:bt,bodyContains:le,canAccessLocalStorage:V,findThisElement:be,filterValues:un,hasAttribute:s,getAttributeValue:te,getClosestAttributeValue:re,getClosestMatch:N,getExpressionVars:bn,getHeaders:ln,getInputValues:nn,getInternalData:ie,getSwapSpecification:an,getTriggerSpecs:ot,getTarget:ve,makeFragment:k,mergeObjects:ue,makeSettleInfo:dn,oobSwap:Re,querySelectorExt:ce,selectAndSwap:_e,settleImmediately:zt,shouldCancel:ct,triggerEvent:fe,triggerErrorEvent:ae,withExtensions:Mt};const E=["get","post","put","delete","patch"];const q=E.map(function(e){return"[hx-"+e+"], [data-hx-"+e+"]"}).join(", ");const T=e("head");const O=e("title");const H=e("svg",true);function e(e,t=false){return new RegExp(`<${e}(\\s[^>]*>|>)([\\s\\S]*?)<\\/${e}>`,t?"gim":"im")}function d(e){if(e==undefined){return undefined}let t=NaN;if(e.slice(-2)=="ms"){t=parseFloat(e.slice(0,-2))}else if(e.slice(-1)=="s"){t=parseFloat(e.slice(0,-1))*1e3}else if(e.slice(-1)=="m"){t=parseFloat(e.slice(0,-1))*1e3*60}else{t=parseFloat(e)}return isNaN(t)?undefined:t}function ee(e,t){return e.getAttribute&&e.getAttribute(t)}function s(e,t){return e.hasAttribute&&(e.hasAttribute(t)||e.hasAttribute("data-"+t))}function te(e,t){return ee(e,t)||ee(e,"data-"+t)}function u(e){const t=e.parentElement;if(!t&&e.parentNode instanceof ShadowRoot)return e.parentNode;return t}function ne(){return document}function L(e,t){return e.getRootNode?e.getRootNode({composed:t}):ne()}function N(e,t){while(e&&!t(e)){e=u(e)}return e||null}function A(e,t,n){const r=te(t,n);const o=te(t,"hx-disinherit");if(e!==t&&o&&(o==="*"||o.split(" ").indexOf(n)>=0)){return"unset"}else{return r}}function re(t,n){let r=null;N(t,function(e){return r=A(t,e,n)});if(r!=="unset"){return r}}function f(e,t){const n=e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.oMatchesSelector;return n&&n.call(e,t)}function I(e){const t=/<([a-z][^\/\0>\x20\t\r\n\f]*)/i;const n=t.exec(e);if(n){return n[1].toLowerCase()}else{return""}}function i(e,t){const n=new DOMParser;const r=n.parseFromString(e,"text/html");let o=r.body;while(t>0){t--;o=o.firstChild}if(o==null){o=ne().createDocumentFragment()}return o}function P(e){return/<body/.test(e)}function k(e){const t=!P(e);const n=I(e);let r=e;if(n==="head"){r=r.replace(T,"")}if(Q.config.useTemplateFragments&&t){const o=i("<body><template>"+r+"</template></body>",0);return o.querySelector("template").content}switch(n){case"thead":case"tbody":case"tfoot":case"colgroup":case"caption":return i("<table>"+r+"</table>",1);case"col":return i("<table><colgroup>"+r+"</colgroup></table>",2);case"tr":return i("<table><tbody>"+r+"</tbody></table>",2);case"td":case"th":return i("<table><tbody><tr>"+r+"</tr></tbody></table>",3);case"script":case"style":return i("<div>"+r+"</div>",1);default:return i(r,0)}}function oe(e){if(e){e()}}function X(e,t){return Object.prototype.toString.call(e)==="[object "+t+"]"}function M(e){return X(e,"Function")}function D(e){return X(e,"Object")}function ie(e){const t="htmx-internal-data";let n=e[t];if(!n){n=e[t]={}}return n}function U(t){const n=[];if(t){for(let e=0;e<t.length;e++){n.push(t[e])}}return n}function se(t,n){if(t){for(let e=0;e<t.length;e++){n(t[e])}}}function F(e){const t=e.getBoundingClientRect();const n=t.top;const r=t.bottom;return n<window.innerHeight&&r>=0}function le(e){if(e.getRootNode&&e.getRootNode()instanceof window.ShadowRoot){return ne().body.contains(e.getRootNode().host)}else{return ne().body.contains(e)}}function B(e){return e.trim().split(/\s+/)}function ue(e,t){for(const n in t){if(t.hasOwnProperty(n)){e[n]=t[n]}}return e}function b(e){try{return JSON.parse(e)}catch(e){S(e);return null}}function V(){const e="htmx:localStorageTest";try{localStorage.setItem(e,e);localStorage.removeItem(e);return true}catch(e){return false}}function j(t){try{const e=new URL(t);if(e){t=e.pathname+e.search}if(!/^\/$/.test(t)){t=t.replace(/\/+$/,"")}return t}catch(e){return t}}function t(e){return pn(ne().body,function(){return eval(e)})}function _(t){const e=Q.on("htmx:load",function(e){t(e.detail.elt)});return e}function z(){Q.logger=function(e,t,n){if(console){console.log(t,e,n)}}}function $(){Q.logger=null}function v(e,t){if(t){return e.querySelector(t)}else{return v(ne(),e)}}function c(e,t){if(t){return e.querySelectorAll(t)}else{return c(ne(),e)}}function G(e,t){e=g(e);if(t){setTimeout(function(){G(e);e=null},t)}else{u(e).removeChild(e)}}function J(e,t,n){e=g(e);if(n){setTimeout(function(){J(e,t);e=null},n)}else{e.classList&&e.classList.add(t)}}function r(e,t,n){e=g(e);if(n){setTimeout(function(){r(e,t);e=null},n)}else{if(e.classList){e.classList.remove(t);if(e.classList.length===0){e.removeAttribute("class")}}}}function Z(e,t){e=g(e);e.classList.toggle(t)}function K(e,t){e=g(e);se(e.parentElement.children,function(e){r(e,t)});J(e,t)}function h(e,t){e=g(e);if(e.closest){return e.closest(t)}else{do{if(e==null||f(e,t)){return e}}while(e=e&&u(e));return null}}function l(e,t){return e.substring(0,t.length)===t}function Y(e,t){return e.substring(e.length-t.length)===t}function o(e){const t=e.trim();if(l(t,"<")&&Y(t,"/>")){return t.substring(1,t.length-2)}else{return t}}function a(e,t,n){if(t.indexOf("closest ")===0){return[h(e,o(t.substr(8)))]}else if(t.indexOf("find ")===0){return[v(e,o(t.substr(5)))]}else if(t==="next"){return[e.nextElementSibling]}else if(t.indexOf("next ")===0){return[W(e,o(t.substr(5)),!!n)]}else if(t==="previous"){return[e.previousElementSibling]}else if(t.indexOf("previous ")===0){return[de(e,o(t.substr(9)),!!n)]}else if(t==="document"){return[document]}else if(t==="window"){return[window]}else if(t==="body"){return[document.body]}else if(t==="root"){return[L(e,!!n)]}else if(t.indexOf("global ")===0){return a(e,t.slice(7),true)}else{return L(e,!!n).querySelectorAll(o(t))}}var W=function(t,e,n){const r=L(t,n).querySelectorAll(e);for(let e=0;e<r.length;e++){const o=r[e];if(o.compareDocumentPosition(t)===Node.DOCUMENT_POSITION_PRECEDING){return o}}};var de=function(t,e,n){const r=L(t,n).querySelectorAll(e);for(let e=r.length-1;e>=0;e--){const o=r[e];if(o.compareDocumentPosition(t)===Node.DOCUMENT_POSITION_FOLLOWING){return o}}};function ce(e,t){if(t){return a(e,t)[0]}else{return a(ne().body,e)[0]}}function g(e,t){if(X(e,"String")){return v(t||document,e)}else{return e}}function ge(e,t,n){if(M(t)){return{target:ne().body,event:e,listener:t}}else{return{target:g(e),event:t,listener:n}}}function me(t,n,r){An(function(){const e=ge(t,n,r);e.target.addEventListener(e.event,e.listener)});const e=M(n);return e?n:r}function pe(t,n,r){An(function(){const e=ge(t,n,r);e.target.removeEventListener(e.event,e.listener)});return M(n)?n:r}const ye=ne().createElement("output");function xe(e,t){const n=re(e,t);if(n){if(n==="this"){return[be(e,t)]}else{const r=a(e,n);if(r.length===0){S('The selector "'+n+'" on '+t+" returned no matches!");return[ye]}else{return r}}}}function be(e,t){return N(e,function(e){return te(e,t)!=null})}function ve(e){const t=re(e,"hx-target");if(t){if(t==="this"){return be(e,"hx-target")}else{return ce(e,t)}}else{const n=ie(e);if(n.boosted){return ne().body}else{return e}}}function we(t){const n=Q.config.attributesToSettle;for(let e=0;e<n.length;e++){if(t===n[e]){return true}}return false}function Se(t,n){se(t.attributes,function(e){if(!n.hasAttribute(e.name)&&we(e.name)){t.removeAttribute(e.name)}});se(n.attributes,function(e){if(we(e.name)){t.setAttribute(e.name,e.value)}})}function Ce(t,e){const n=Nn(e);for(let e=0;e<n.length;e++){const r=n[e];try{if(r.isInlineSwap(t)){return true}}catch(e){S(e)}}return t==="outerHTML"}function Re(e,o,i){let t="#"+ee(o,"id");let s="outerHTML";if(e==="true"){}else if(e.indexOf(":")>0){s=e.substr(0,e.indexOf(":"));t=e.substr(e.indexOf(":")+1,e.length)}else{s=e}const n=ne().querySelectorAll(t);if(n){se(n,function(e){let t;const n=o.cloneNode(true);t=ne().createDocumentFragment();t.appendChild(n);if(!Ce(s,e)){t=n}const r={shouldSwap:true,target:e,fragment:t};if(!fe(e,"htmx:oobBeforeSwap",r))return;e=r.target;if(r.shouldSwap){Ve(s,e,e,t,i)}se(i.elts,function(e){fe(e,"htmx:oobAfterSwap",r)})});o.parentNode.removeChild(o)}else{o.parentNode.removeChild(o);ae(ne().body,"htmx:oobErrorNoTarget",{content:o})}return e}function Ee(e,n,r){const t=re(e,"hx-select-oob");if(t){const o=t.split(",");for(let t=0;t<o.length;t++){const i=o[t].split(":",2);let e=i[0].trim();if(e.indexOf("#")===0){e=e.substring(1)}const s=i[1]||"true";const l=n.querySelector("#"+e);if(l){Re(s,l,r)}}}se(c(n,"[hx-swap-oob], [data-hx-swap-oob]"),function(e){const t=te(e,"hx-swap-oob");if(t!=null){Re(t,e,r)}})}function qe(e){se(c(e,"[hx-preserve], [data-hx-preserve]"),function(e){const t=te(e,"id");const n=ne().getElementById(t);if(n!=null){e.parentNode.replaceChild(n,e)}})}function Te(s,e,l){se(e.querySelectorAll("[id]"),function(e){const t=ee(e,"id");if(t&&t.length>0){const n=t.replace("'","\\'");const r=e.tagName.replace(":","\\:");const o=s.querySelector(r+"[id='"+n+"']");if(o&&o!==s){const i=e.cloneNode();Se(e,o);l.tasks.push(function(){Se(e,i)})}}})}function Oe(e){return function(){r(e,Q.config.addedClass);It(e);wt(e);He(e);fe(e,"htmx:load")}}function He(e){const t="[autofocus]";const n=f(e,t)?e:e.querySelector(t);if(n!=null){n.focus()}}function m(e,t,n,r){Te(e,n,r);while(n.childNodes.length>0){const o=n.firstChild;J(o,Q.config.addedClass);e.insertBefore(o,t);if(o.nodeType!==Node.TEXT_NODE&&o.nodeType!==Node.COMMENT_NODE){r.tasks.push(Oe(o))}}}function Le(e,t){let n=0;while(n<e.length){t=(t<<5)-t+e.charCodeAt(n++)|0}return t}function Ne(t){let n=0;if(t.attributes){for(let e=0;e<t.attributes.length;e++){const r=t.attributes[e];if(r.value){n=Le(r.name,n);n=Le(r.value,n)}}}return n}function Ae(t){const n=ie(t);if(n.onHandlers){for(let e=0;e<n.onHandlers.length;e++){const r=n.onHandlers[e];t.removeEventListener(r.event,r.listener)}delete n.onHandlers}}function Ie(e){const t=ie(e);if(t.timeout){clearTimeout(t.timeout)}if(t.listenerInfos){se(t.listenerInfos,function(e){if(e.on){e.on.removeEventListener(e.trigger,e.listener)}})}Ae(e);se(Object.keys(t),function(e){delete t[e]})}function p(e){fe(e,"htmx:beforeCleanupElement");Ie(e);if(e.children){se(e.children,function(e){p(e)})}}function Pe(t,n,r){if(t.tagName==="BODY"){return Fe(t,n,r)}else{let e;const o=t.previousSibling;m(u(t),t,n,r);if(o==null){e=u(t).firstChild}else{e=o.nextSibling}r.elts=r.elts.filter(function(e){return e!=t});while(e&&e!==t){if(e.nodeType===Node.ELEMENT_NODE){r.elts.push(e)}e=e.nextElementSibling}p(t);u(t).removeChild(t)}}function ke(e,t,n){return m(e,e.firstChild,t,n)}function Xe(e,t,n){return m(u(e),e,t,n)}function Me(e,t,n){return m(e,null,t,n)}function De(e,t,n){return m(u(e),e.nextSibling,t,n)}function Ue(e,t,n){p(e);return u(e).removeChild(e)}function Fe(e,t,n){const r=e.firstChild;m(e,r,t,n);if(r){while(r.nextSibling){p(r.nextSibling);e.removeChild(r.nextSibling)}p(r);e.removeChild(r)}}function Be(e,t,n){const r=n||re(e,"hx-select");if(r){const o=ne().createDocumentFragment();se(t.querySelectorAll(r),function(e){o.appendChild(e)});t=o}return t}function Ve(t,e,n,r,o){switch(t){case"none":return;case"outerHTML":Pe(n,r,o);return;case"afterbegin":ke(n,r,o);return;case"beforebegin":Xe(n,r,o);return;case"beforeend":Me(n,r,o);return;case"afterend":De(n,r,o);return;case"delete":Ue(n,r,o);return;default:var i=Nn(e);for(let e=0;e<i.length;e++){const s=i[e];try{const l=s.handleSwap(t,n,r,o);if(l){if(typeof l.length!=="undefined"){for(let e=0;e<l.length;e++){const u=l[e];if(u.nodeType!==Node.TEXT_NODE&&u.nodeType!==Node.COMMENT_NODE){o.tasks.push(Oe(u))}}}return}}catch(e){S(e)}}if(t==="innerHTML"){Fe(n,r,o)}else{Ve(Q.config.defaultSwapStyle,e,n,r,o)}}}function je(e){if(e.indexOf("<title")>-1){const t=e.replace(H,"");const n=t.match(O);if(n){return n[2]}}}function _e(e,t,n,r,o,i){o.title=je(r);let s=k(r);if(s){Ee(n,s,o);s=Be(n,s,i);qe(s);return Ve(e,n,t,s,o)}}function ze(e,t,n){const r=e.getResponseHeader(t);if(r.indexOf("{")===0){const o=b(r);for(const i in o){if(o.hasOwnProperty(i)){let e=o[i];if(!D(e)){e={value:e}}fe(n,i,e)}}}else{const s=r.split(",");for(let e=0;e<s.length;e++){fe(n,s[e].trim(),[])}}}const $e=/\s/;const y=/[\s,]/;const Ge=/[_$a-zA-Z]/;const Je=/[_$a-zA-Z0-9]/;const Ze=['"',"'","/"];const x=/[^\s]/;const Ke=/[{(]/;const Ye=/[})]/;function We(e){const t=[];let n=0;while(n<e.length){if(Ge.exec(e.charAt(n))){var r=n;while(Je.exec(e.charAt(n+1))){n++}t.push(e.substr(r,n-r+1))}else if(Ze.indexOf(e.charAt(n))!==-1){const o=e.charAt(n);var r=n;n++;while(n<e.length&&e.charAt(n)!==o){if(e.charAt(n)==="\\"){n++}n++}t.push(e.substr(r,n-r+1))}else{const i=e.charAt(n);t.push(i)}n++}return t}function Qe(e,t,n){return Ge.exec(e.charAt(0))&&e!=="true"&&e!=="false"&&e!=="this"&&e!==n&&t!=="."}function et(r,o,i){if(o[0]==="["){o.shift();let e=1;let t=" return (function("+i+"){ return (";let n=null;while(o.length>0){const s=o[0];if(s==="]"){e--;if(e===0){if(n===null){t=t+"true"}o.shift();t+=")})";try{const l=pn(r,function(){return Function(t)()},function(){return true});l.source=t;return l}catch(e){ae(ne().body,"htmx:syntax:error",{error:e,source:t});return null}}}else if(s==="["){e++}if(Qe(s,n,i)){t+="(("+i+"."+s+") ? ("+i+"."+s+") : (window."+s+"))"}else{t=t+s}n=o.shift()}}}function w(e,t){let n="";while(e.length>0&&!t.test(e[0])){n+=e.shift()}return n}function tt(e){let t;if(e.length>0&&Ke.test(e[0])){e.shift();t=w(e,Ye).trim();e.shift()}else{t=w(e,y)}return t}const nt="input, textarea, select";function rt(e,t,n){const r=[];const o=We(t);do{w(o,x);const l=o.length;const u=w(o,/[,\[\s]/);if(u!==""){if(u==="every"){const c={trigger:"every"};w(o,x);c.pollInterval=d(w(o,/[,\[\s]/));w(o,x);var i=et(e,o,"event");if(i){c.eventFilter=i}r.push(c)}else{const a={trigger:u};var i=et(e,o,"event");if(i){a.eventFilter=i}while(o.length>0&&o[0]!==","){w(o,x);const f=o.shift();if(f==="changed"){a.changed=true}else if(f==="once"){a.once=true}else if(f==="consume"){a.consume=true}else if(f==="delay"&&o[0]===":"){o.shift();a.delay=d(w(o,y))}else if(f==="from"&&o[0]===":"){o.shift();if(Ke.test(o[0])){var s=tt(o)}else{var s=w(o,y);if(s==="closest"||s==="find"||s==="next"||s==="previous"){o.shift();const h=tt(o);if(h.length>0){s+=" "+h}}}a.from=s}else if(f==="target"&&o[0]===":"){o.shift();a.target=tt(o)}else if(f==="throttle"&&o[0]===":"){o.shift();a.throttle=d(w(o,y))}else if(f==="queue"&&o[0]===":"){o.shift();a.queue=w(o,y)}else if(f==="root"&&o[0]===":"){o.shift();a[f]=tt(o)}else if(f==="threshold"&&o[0]===":"){o.shift();a[f]=w(o,y)}else{ae(e,"htmx:syntax:error",{token:o.shift()})}}r.push(a)}}if(o.length===l){ae(e,"htmx:syntax:error",{token:o.shift()})}w(o,x)}while(o[0]===","&&o.shift());if(n){n[t]=r}return r}function ot(e){const t=te(e,"hx-trigger");let n=[];if(t){const r=Q.config.triggerSpecsCache;n=r&&r[t]||rt(e,t,r)}if(n.length>0){return n}else if(f(e,"form")){return[{trigger:"submit"}]}else if(f(e,'input[type="button"], input[type="submit"]')){return[{trigger:"click"}]}else if(f(e,nt)){return[{trigger:"change"}]}else{return[{trigger:"click"}]}}function it(e){ie(e).cancelled=true}function st(e,t,n){const r=ie(e);r.timeout=setTimeout(function(){if(le(e)&&r.cancelled!==true){if(!ft(n,e,kt("hx:poll:trigger",{triggerSpec:n,target:e}))){t(e)}st(e,t,n)}},n.pollInterval)}function lt(e){return location.hostname===e.hostname&&ee(e,"href")&&ee(e,"href").indexOf("#")!==0}function ut(t,o,e){if(t.tagName==="A"&<(t)&&(t.target===""||t.target==="_self")||t.tagName==="FORM"){o.boosted=true;let n,r;if(t.tagName==="A"){n="get";r=ee(t,"href")}else{const i=ee(t,"method");n=i?i.toLowerCase():"get";if(n==="get"){}r=ee(t,"action")}e.forEach(function(e){ht(t,function(e,t){if(h(e,Q.config.disableSelector)){p(e);return}he(n,r,e,t)},o,e,true)})}}function ct(e,t){if(e.type==="submit"||e.type==="click"){if(t.tagName==="FORM"){return true}if(f(t,'input[type="submit"], button')&&h(t,"form")!==null){return true}if(t.tagName==="A"&&t.href&&(t.getAttribute("href")==="#"||t.getAttribute("href").indexOf("#")!==0)){return true}}return false}function at(e,t){return ie(e).boosted&&e.tagName==="A"&&t.type==="click"&&(t.ctrlKey||t.metaKey)}function ft(e,t,n){const r=e.eventFilter;if(r){try{return r.call(t,n)!==true}catch(e){ae(ne().body,"htmx:eventFilter:error",{error:e,source:r.source});return true}}return false}function ht(i,s,e,l,u){const c=ie(i);let t;if(l.from){t=a(i,l.from)}else{t=[i]}if(l.changed){t.forEach(function(e){const t=ie(e);t.lastValue=e.value})}se(t,function(r){const o=function(e){if(!le(i)){r.removeEventListener(l.trigger,o);return}if(at(i,e)){return}if(u||ct(e,i)){e.preventDefault()}if(ft(l,i,e)){return}const t=ie(e);t.triggerSpec=l;if(t.handledFor==null){t.handledFor=[]}if(t.handledFor.indexOf(i)<0){t.handledFor.push(i);if(l.consume){e.stopPropagation()}if(l.target&&e.target){if(!f(e.target,l.target)){return}}if(l.once){if(c.triggeredOnce){return}else{c.triggeredOnce=true}}if(l.changed){const n=ie(r);if(n.lastValue===r.value){return}n.lastValue=r.value}if(c.delayed){clearTimeout(c.delayed)}if(c.throttle){return}if(l.throttle>0){if(!c.throttle){s(i,e);c.throttle=setTimeout(function(){c.throttle=null},l.throttle)}}else if(l.delay>0){c.delayed=setTimeout(function(){s(i,e)},l.delay)}else{fe(i,"htmx:trigger");s(i,e)}}};if(e.listenerInfos==null){e.listenerInfos=[]}e.listenerInfos.push({trigger:l.trigger,listener:o,on:r});r.addEventListener(l.trigger,o)})}let dt=false;let gt=null;function mt(){if(!gt){gt=function(){dt=true};window.addEventListener("scroll",gt);setInterval(function(){if(dt){dt=false;se(ne().querySelectorAll("[hx-trigger='revealed'],[data-hx-trigger='revealed']"),function(e){pt(e)})}},200)}}function pt(t){if(!s(t,"data-hx-revealed")&&F(t)){t.setAttribute("data-hx-revealed","true");const e=ie(t);if(e.initHash){fe(t,"revealed")}else{t.addEventListener("htmx:afterProcessNode",function(e){fe(t,"revealed")},{once:true})}}}function yt(e,t,n,r){const o=function(){if(!n.loaded){n.loaded=true;t(e)}};if(r>0){setTimeout(o,r)}else{o()}}function xt(t,o,e){let i=false;se(E,function(n){if(s(t,"hx-"+n)){const r=te(t,"hx-"+n);i=true;o.path=r;o.verb=n;e.forEach(function(e){bt(t,e,o,function(e,t){if(h(e,Q.config.disableSelector)){p(e);return}he(n,r,e,t)})})}});return i}function bt(r,e,t,n){if(e.trigger==="revealed"){mt();ht(r,n,t,e);pt(r)}else if(e.trigger==="intersect"){const o={};if(e.root){o.root=ce(r,e.root)}if(e.threshold){o.threshold=parseFloat(e.threshold)}const i=new IntersectionObserver(function(t){for(let e=0;e<t.length;e++){const n=t[e];if(n.isIntersecting){fe(r,"intersect");break}}},o);i.observe(r);ht(r,n,t,e)}else if(e.trigger==="load"){if(!ft(e,r,kt("load",{elt:r}))){yt(r,n,t,e.delay)}}else if(e.pollInterval>0){t.polling=true;st(r,n,e)}else{ht(r,n,t,e)}}function vt(e){if(Q.config.allowScriptTags&&(e.type==="text/javascript"||e.type==="module"||e.type==="")){const t=ne().createElement("script");se(e.attributes,function(e){t.setAttribute(e.name,e.value)});t.textContent=e.textContent;t.async=false;if(Q.config.inlineScriptNonce){t.nonce=Q.config.inlineScriptNonce}const n=e.parentElement;try{n.insertBefore(t,e)}catch(e){S(e)}finally{if(e.parentElement){e.parentElement.removeChild(e)}}}}function wt(e){if(f(e,"script")){vt(e)}se(c(e,"script"),function(e){vt(e)})}function St(e){const t=e.attributes;for(let e=0;e<t.length;e++){const n=t[e].name;if(l(n,"hx-on:")||l(n,"data-hx-on:")||l(n,"hx-on-")||l(n,"data-hx-on-")){return true}}return false}function Ct(e){let t=null;const n=[];if(!(e instanceof ShadowRoot)){if(St(e)){n.push(e)}const r=document.evaluate('.//*[@*[ starts-with(name(), "hx-on:") or starts-with(name(), "data-hx-on:") or'+' starts-with(name(), "hx-on-") or starts-with(name(), "data-hx-on-") ]]',e);while(t=r.iterateNext())n.push(t)}return n}function Rt(e){if(e.querySelectorAll){const t=", [hx-boost] a, [data-hx-boost] a, a[hx-boost], a[data-hx-boost]";const n=e.querySelectorAll(q+t+", form, [type='submit'],"+" [hx-ext], [data-hx-ext], [hx-trigger], [data-hx-trigger]");return n}else{return[]}}function Et(e){const t=h(e.target,"button, input[type='submit']");const n=Tt(e);if(n){n.lastButtonClicked=t}}function qt(e){const t=Tt(e);if(t){t.lastButtonClicked=null}}function Tt(e){const t=h(e.target,"button, input[type='submit']");if(!t){return}const n=g("#"+ee(t,"form"),t.getRootNode())||h(t,"form");if(!n){return}return ie(n)}function Ot(e){e.addEventListener("click",Et);e.addEventListener("focusin",Et);e.addEventListener("focusout",qt)}function Ht(e){const t=We(e);let n=0;for(let e=0;e<t.length;e++){const r=t[e];if(r==="{"){n++}else if(r==="}"){n--}}return n}function Lt(t,e,n){const r=ie(t);if(!Array.isArray(r.onHandlers)){r.onHandlers=[]}let o;const i=function(e){return pn(t,function(){if(!o){o=new Function("event",n)}o.call(t,e)})};t.addEventListener(e,i);r.onHandlers.push({event:e,listener:i})}function Nt(t){Ae(t);for(let e=0;e<t.attributes.length;e++){const n=t.attributes[e].name;const r=t.attributes[e].value;if(l(n,"hx-on")||l(n,"data-hx-on")){const o=n.indexOf("-on")+3;const i=n.slice(o,o+1);if(i==="-"||i===":"){let e=n.slice(o+1);if(l(e,":")){e="htmx"+e}else if(l(e,"-")){e="htmx:"+e.slice(1)}else if(l(e,"htmx-")){e="htmx:"+e.slice(5)}Lt(t,e,r)}}}}function At(t){if(h(t,Q.config.disableSelector)){p(t);return}const n=ie(t);if(n.initHash!==Ne(t)){Ie(t);n.initHash=Ne(t);fe(t,"htmx:beforeProcessNode");if(t.value){n.lastValue=t.value}const e=ot(t);const r=xt(t,n,e);if(!r){if(re(t,"hx-boost")==="true"){ut(t,n,e)}else if(s(t,"hx-trigger")){e.forEach(function(e){bt(t,e,n,function(){})})}}if(t.tagName==="FORM"||ee(t,"type")==="submit"&&s(t,"form")){Ot(t)}fe(t,"htmx:afterProcessNode")}}function It(e){e=g(e);if(h(e,Q.config.disableSelector)){p(e);return}At(e);se(Rt(e),function(e){At(e)});se(Ct(e),Nt)}function Pt(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function kt(e,t){let n;if(window.CustomEvent&&typeof window.CustomEvent==="function"){n=new CustomEvent(e,{bubbles:true,cancelable:true,composed:true,detail:t})}else{n=ne().createEvent("CustomEvent");n.initCustomEvent(e,true,true,t)}return n}function ae(e,t,n){fe(e,t,ue({error:t},n))}function Xt(e){return e==="htmx:afterProcessNode"}function Mt(e,t){se(Nn(e),function(e){try{t(e)}catch(e){S(e)}})}function S(e){if(console.error){console.error(e)}else if(console.log){console.log("ERROR: ",e)}}function fe(e,t,n){e=g(e);if(n==null){n={}}n.elt=e;const r=kt(t,n);if(Q.logger&&!Xt(t)){Q.logger(e,t,n)}if(n.error){S(n.error);fe(e,"htmx:error",{errorInfo:n})}let o=e.dispatchEvent(r);const i=Pt(t);if(o&&i!==t){const s=kt(i,r.detail);o=o&&e.dispatchEvent(s)}Mt(e,function(e){o=o&&(e.onEvent(t,r)!==false&&!r.defaultPrevented)});return o}let C=location.pathname+location.search;function Dt(){const e=ne().querySelector("[hx-history-elt],[data-hx-history-elt]");return e||ne().body}function Ut(t,e,n,r){if(!V()){return}if(Q.config.historyCacheSize<=0){localStorage.removeItem("htmx-history-cache");return}t=j(t);const o=b(localStorage.getItem("htmx-history-cache"))||[];for(let e=0;e<o.length;e++){if(o[e].url===t){o.splice(e,1);break}}const i={url:t,content:e,title:n,scroll:r};fe(ne().body,"htmx:historyItemCreated",{item:i,cache:o});o.push(i);while(o.length>Q.config.historyCacheSize){o.shift()}while(o.length>0){try{localStorage.setItem("htmx-history-cache",JSON.stringify(o));break}catch(e){ae(ne().body,"htmx:historyCacheError",{cause:e,cache:o});o.shift()}}}function Ft(t){if(!V()){return null}t=j(t);const n=b(localStorage.getItem("htmx-history-cache"))||[];for(let e=0;e<n.length;e++){if(n[e].url===t){return n[e]}}return null}function Bt(e){const t=Q.config.requestClass;const n=e.cloneNode(true);se(c(n,"."+t),function(e){r(e,t)});return n.innerHTML}function Vt(){const e=Dt();const t=C||location.pathname+location.search;let n;try{n=ne().querySelector('[hx-history="false" i],[data-hx-history="false" i]')}catch(e){n=ne().querySelector('[hx-history="false"],[data-hx-history="false"]')}if(!n){fe(ne().body,"htmx:beforeHistorySave",{path:t,historyElt:e});Ut(t,Bt(e),ne().title,window.scrollY)}if(Q.config.historyEnabled)history.replaceState({htmx:true},ne().title,window.location.href)}function jt(e){if(Q.config.getCacheBusterParam){e=e.replace(/org\.htmx\.cache-buster=[^&]*&?/,"");if(Y(e,"&")||Y(e,"?")){e=e.slice(0,-1)}}if(Q.config.historyEnabled){history.pushState({htmx:true},"",e)}C=e}function _t(e){if(Q.config.historyEnabled)history.replaceState({htmx:true},"",e);C=e}function zt(e){se(e,function(e){e.call()})}function $t(i){const e=new XMLHttpRequest;const s={path:i,xhr:e};fe(ne().body,"htmx:historyCacheMiss",s);e.open("GET",i,true);e.setRequestHeader("HX-Request","true");e.setRequestHeader("HX-History-Restore-Request","true");e.setRequestHeader("HX-Current-URL",ne().location.href);e.onload=function(){if(this.status>=200&&this.status<400){fe(ne().body,"htmx:historyCacheMissLoad",s);let e=k(this.response);e=e.querySelector("[hx-history-elt],[data-hx-history-elt]")||e;const t=Dt();const n=dn(t);const r=je(this.response);if(r){const o=v("title");if(o){o.innerHTML=r}else{window.document.title=r}}Fe(t,e,n);zt(n.tasks);C=i;fe(ne().body,"htmx:historyRestore",{path:i,cacheMiss:true,serverResponse:this.response})}else{ae(ne().body,"htmx:historyCacheMissLoadError",s)}};e.send()}function Gt(e){Vt();e=e||location.pathname+location.search;const t=Ft(e);if(t){const n=k(t.content);const r=Dt();const o=dn(r);Fe(r,n,o);zt(o.tasks);document.title=t.title;setTimeout(function(){window.scrollTo(0,t.scroll)},0);C=e;fe(ne().body,"htmx:historyRestore",{path:e,item:t})}else{if(Q.config.refreshOnHistoryMiss){window.location.reload(true)}else{$t(e)}}}function Jt(e){let t=xe(e,"hx-indicator");if(t==null){t=[e]}se(t,function(e){const t=ie(e);t.requestCount=(t.requestCount||0)+1;e.classList.add.call(e.classList,Q.config.requestClass)});return t}function Zt(e){let t=xe(e,"hx-disabled-elt");if(t==null){t=[]}se(t,function(e){const t=ie(e);t.requestCount=(t.requestCount||0)+1;e.setAttribute("disabled","")});return t}function Kt(e,t){se(e,function(e){const t=ie(e);t.requestCount=(t.requestCount||0)-1;if(t.requestCount===0){e.classList.remove.call(e.classList,Q.config.requestClass)}});se(t,function(e){const t=ie(e);t.requestCount=(t.requestCount||0)-1;if(t.requestCount===0){e.removeAttribute("disabled")}})}function Yt(t,n){for(let e=0;e<t.length;e++){const r=t[e];if(r.isSameNode(n)){return true}}return false}function Wt(e){if(e.name===""||e.name==null||e.disabled){return false}if(e.type==="button"||e.type==="submit"||e.tagName==="image"||e.tagName==="reset"||e.tagName==="file"){return false}if(e.type==="checkbox"||e.type==="radio"){return e.checked}return true}function Qt(e,t,n){if(e!=null&&t!=null){const r=n[e];if(r===undefined){n[e]=t}else if(Array.isArray(r)){if(Array.isArray(t)){n[e]=r.concat(t)}else{r.push(t)}}else{if(Array.isArray(t)){n[e]=[r].concat(t)}else{n[e]=[r,t]}}}}function en(t,n,r,o,i){if(o==null||Yt(t,o)){return}else{t.push(o)}if(Wt(o)){const s=ee(o,"name");let e=o.value;if(o.multiple&&o.tagName==="SELECT"){e=U(o.querySelectorAll("option:checked")).map(function(e){return e.value})}if(o.files){e=U(o.files)}Qt(s,e,n);if(i){tn(o,r)}}if(f(o,"form")){const e=o.elements;se(e,function(e){en(t,n,r,e,i)})}}function tn(e,t){if(e.willValidate){fe(e,"htmx:validation:validate");if(!e.checkValidity()){t.push({elt:e,message:e.validationMessage,validity:e.validity});fe(e,"htmx:validation:failed",{message:e.validationMessage,validity:e.validity})}}}function nn(e,t){const n=[];let r={};const o={};const i=[];const s=ie(e);if(s.lastButtonClicked&&!le(s.lastButtonClicked)){s.lastButtonClicked=null}let l=f(e,"form")&&e.noValidate!==true||te(e,"hx-validate")==="true";if(s.lastButtonClicked){l=l&&s.lastButtonClicked.formNoValidate!==true}if(t!=="get"){en(n,o,i,h(e,"form"),l)}en(n,r,i,e,l);if(s.lastButtonClicked||e.tagName==="BUTTON"||e.tagName==="INPUT"&&ee(e,"type")==="submit"){const c=s.lastButtonClicked||e;const a=ee(c,"name");Qt(a,c.value,o)}const u=xe(e,"hx-include");se(u,function(e){en(n,r,i,e,l);if(!f(e,"form")){se(e.querySelectorAll(nt),function(e){en(n,r,i,e,l)})}});r=ue(r,o);return{errors:i,values:r}}function rn(e,t,n){if(e!==""){e+="&"}if(String(n)==="[object Object]"){n=JSON.stringify(n)}const r=encodeURIComponent(n);e+=encodeURIComponent(t)+"="+r;return e}function on(e){let t="";for(var n in e){if(e.hasOwnProperty(n)){const r=e[n];if(Array.isArray(r)){se(r,function(e){t=rn(t,n,e)})}else{t=rn(t,n,r)}}}return t}function sn(e){const t=new FormData;for(var n in e){if(e.hasOwnProperty(n)){const r=e[n];if(Array.isArray(r)){se(r,function(e){t.append(n,e)})}else{t.append(n,r)}}}return t}function ln(e,t,n){const r={"HX-Request":"true","HX-Trigger":ee(e,"id"),"HX-Trigger-Name":ee(e,"name"),"HX-Target":te(t,"id"),"HX-Current-URL":ne().location.href};mn(e,"hx-headers",false,r);if(n!==undefined){r["HX-Prompt"]=n}if(ie(e).boosted){r["HX-Boosted"]="true"}return r}function un(t,e){const n=re(e,"hx-params");if(n){if(n==="none"){return{}}else if(n==="*"){return t}else if(n.indexOf("not ")===0){se(n.substr(4).split(","),function(e){e=e.trim();delete t[e]});return t}else{const r={};se(n.split(","),function(e){e=e.trim();r[e]=t[e]});return r}}else{return t}}function cn(e){return ee(e,"href")&&ee(e,"href").indexOf("#")>=0}function an(e,t){const n=t||re(e,"hx-swap");const r={swapStyle:ie(e).boosted?"innerHTML":Q.config.defaultSwapStyle,swapDelay:Q.config.defaultSwapDelay,settleDelay:Q.config.defaultSettleDelay};if(Q.config.scrollIntoViewOnBoost&&ie(e).boosted&&!cn(e)){r.show="top"}if(n){const s=B(n);if(s.length>0){for(let e=0;e<s.length;e++){const l=s[e];if(l.indexOf("swap:")===0){r.swapDelay=d(l.substr(5))}else if(l.indexOf("settle:")===0){r.settleDelay=d(l.substr(7))}else if(l.indexOf("transition:")===0){r.transition=l.substr(11)==="true"}else if(l.indexOf("ignoreTitle:")===0){r.ignoreTitle=l.substr(12)==="true"}else if(l.indexOf("scroll:")===0){const u=l.substr(7);var o=u.split(":");const c=o.pop();var i=o.length>0?o.join(":"):null;r.scroll=c;r.scrollTarget=i}else if(l.indexOf("show:")===0){const a=l.substr(5);var o=a.split(":");const f=o.pop();var i=o.length>0?o.join(":"):null;r.show=f;r.showTarget=i}else if(l.indexOf("focus-scroll:")===0){const h=l.substr("focus-scroll:".length);r.focusScroll=h=="true"}else if(e==0){r.swapStyle=l}else{S("Unknown modifier in hx-swap: "+l)}}}}return r}function fn(e){return re(e,"hx-encoding")==="multipart/form-data"||f(e,"form")&&ee(e,"enctype")==="multipart/form-data"}function hn(t,n,r){let o=null;Mt(n,function(e){if(o==null){o=e.encodeParameters(t,r,n)}});if(o!=null){return o}else{if(fn(n)){return sn(r)}else{return on(r)}}}function dn(e){return{tasks:[],elts:[e]}}function gn(e,t){const n=e[0];const r=e[e.length-1];if(t.scroll){var o=null;if(t.scrollTarget){o=ce(n,t.scrollTarget)}if(t.scroll==="top"&&(n||o)){o=o||n;o.scrollTop=0}if(t.scroll==="bottom"&&(r||o)){o=o||r;o.scrollTop=o.scrollHeight}}if(t.show){var o=null;if(t.showTarget){let e=t.showTarget;if(t.showTarget==="window"){e="body"}o=ce(n,e)}if(t.show==="top"&&(n||o)){o=o||n;o.scrollIntoView({block:"start",behavior:Q.config.scrollBehavior})}if(t.show==="bottom"&&(r||o)){o=o||r;o.scrollIntoView({block:"end",behavior:Q.config.scrollBehavior})}}}function mn(r,e,o,i){if(i==null){i={}}if(r==null){return i}const s=te(r,e);if(s){let e=s.trim();let t=o;if(e==="unset"){return null}if(e.indexOf("javascript:")===0){e=e.substr(11);t=true}else if(e.indexOf("js:")===0){e=e.substr(3);t=true}if(e.indexOf("{")!==0){e="{"+e+"}"}let n;if(t){n=pn(r,function(){return Function("return ("+e+")")()},{})}else{n=b(e)}for(const l in n){if(n.hasOwnProperty(l)){if(i[l]==null){i[l]=n[l]}}}}return mn(u(r),e,o,i)}function pn(e,t,n){if(Q.config.allowEval){return t()}else{ae(e,"htmx:evalDisallowedError");return n}}function yn(e,t){return mn(e,"hx-vars",true,t)}function xn(e,t){return mn(e,"hx-vals",false,t)}function bn(e){return ue(yn(e),xn(e))}function vn(t,n,r){if(r!==null){try{t.setRequestHeader(n,r)}catch(e){t.setRequestHeader(n,encodeURIComponent(r));t.setRequestHeader(n+"-URI-AutoEncoded","true")}}}function wn(t){if(t.responseURL&&typeof URL!=="undefined"){try{const e=new URL(t.responseURL);return e.pathname+e.search}catch(e){ae(ne().body,"htmx:badResponseUrl",{url:t.responseURL})}}}function R(e,t){return t.test(e.getAllResponseHeaders())}function Sn(e,t,n){e=e.toLowerCase();if(n){if(n instanceof Element||X(n,"String")){return he(e,t,null,null,{targetOverride:g(n),returnPromise:true})}else{return he(e,t,g(n.source),n.event,{handler:n.handler,headers:n.headers,values:n.values,targetOverride:g(n.target),swapOverride:n.swap,select:n.select,returnPromise:true})}}else{return he(e,t,null,null,{returnPromise:true})}}function Cn(e){const t=[];while(e){t.push(e);e=e.parentElement}return t}function Rn(e,t,n){let r;let o;if(typeof URL==="function"){o=new URL(t,document.location.href);const i=document.location.origin;r=i===o.origin}else{o=t;r=l(t,document.location.origin)}if(Q.config.selfRequestsOnly){if(!r){return false}}return fe(e,"htmx:validateUrl",ue({url:o,sameHost:r},n))}function he(t,n,r,o,i,X){let s=null;let l=null;i=i!=null?i:{};if(i.returnPromise&&typeof Promise!=="undefined"){var e=new Promise(function(e,t){s=e;l=t})}if(r==null){r=ne().body}const M=i.handler||qn;const D=i.select||null;if(!le(r)){oe(s);return e}const u=i.targetOverride||ve(r);if(u==null||u==ye){ae(r,"htmx:targetError",{target:te(r,"hx-target")});oe(l);return e}let c=ie(r);const a=c.lastButtonClicked;if(a){const L=ee(a,"formaction");if(L!=null){n=L}const N=ee(a,"formmethod");if(N!=null){if(N.toLowerCase()!=="dialog"){t=N}}}const f=re(r,"hx-confirm");if(X===undefined){const J=function(e){return he(t,n,r,o,i,!!e)};const Z={target:u,elt:r,path:n,verb:t,triggeringEvent:o,etc:i,issueRequest:J,question:f};if(fe(r,"htmx:confirm",Z)===false){oe(s);return e}}let h=r;let d=re(r,"hx-sync");let g=null;let U=false;if(d){const A=d.split(":");const I=A[0].trim();if(I==="this"){h=be(r,"hx-sync")}else{h=ce(r,I)}d=(A[1]||"drop").trim();c=ie(h);if(d==="drop"&&c.xhr&&c.abortable!==true){oe(s);return e}else if(d==="abort"){if(c.xhr){oe(s);return e}else{U=true}}else if(d==="replace"){fe(h,"htmx:abort")}else if(d.indexOf("queue")===0){const K=d.split(" ");g=(K[1]||"last").trim()}}if(c.xhr){if(c.abortable){fe(h,"htmx:abort")}else{if(g==null){if(o){const P=ie(o);if(P&&P.triggerSpec&&P.triggerSpec.queue){g=P.triggerSpec.queue}}if(g==null){g="last"}}if(c.queuedRequests==null){c.queuedRequests=[]}if(g==="first"&&c.queuedRequests.length===0){c.queuedRequests.push(function(){he(t,n,r,o,i)})}else if(g==="all"){c.queuedRequests.push(function(){he(t,n,r,o,i)})}else if(g==="last"){c.queuedRequests=[];c.queuedRequests.push(function(){he(t,n,r,o,i)})}oe(s);return e}}const m=new XMLHttpRequest;c.xhr=m;c.abortable=U;const p=function(){c.xhr=null;c.abortable=false;if(c.queuedRequests!=null&&c.queuedRequests.length>0){const e=c.queuedRequests.shift();e()}};const F=re(r,"hx-prompt");if(F){var y=prompt(F);if(y===null||!fe(r,"htmx:prompt",{prompt:y,target:u})){oe(s);p();return e}}if(f&&!X){if(!confirm(f)){oe(s);p();return e}}let x=ln(r,u,y);if(t!=="get"&&!fn(r)){x["Content-Type"]="application/x-www-form-urlencoded"}if(i.headers){x=ue(x,i.headers)}const B=nn(r,t);let b=B.errors;let v=B.values;if(i.values){v=ue(v,i.values)}const V=bn(r);const j=ue(v,V);let w=un(j,r);if(Q.config.getCacheBusterParam&&t==="get"){w["org.htmx.cache-buster"]=ee(u,"id")||"true"}if(n==null||n===""){n=ne().location.href}const S=mn(r,"hx-request");const _=ie(r).boosted;let C=Q.config.methodsThatUseUrlParams.indexOf(t)>=0;const R={boosted:_,useUrlParams:C,parameters:w,unfilteredParameters:j,headers:x,target:u,verb:t,errors:b,withCredentials:i.credentials||S.credentials||Q.config.withCredentials,timeout:i.timeout||S.timeout||Q.config.timeout,path:n,triggeringEvent:o};if(!fe(r,"htmx:configRequest",R)){oe(s);p();return e}n=R.path;t=R.verb;x=R.headers;w=R.parameters;b=R.errors;C=R.useUrlParams;if(b&&b.length>0){fe(r,"htmx:validation:halted",R);oe(s);p();return e}const z=n.split("#");const $=z[0];const E=z[1];let q=n;if(C){q=$;const Y=Object.keys(w).length!==0;if(Y){if(q.indexOf("?")<0){q+="?"}else{q+="&"}q+=on(w);if(E){q+="#"+E}}}if(!Rn(r,q,R)){ae(r,"htmx:invalidPath",R);oe(l);return e}m.open(t.toUpperCase(),q,true);m.overrideMimeType("text/html");m.withCredentials=R.withCredentials;m.timeout=R.timeout;if(S.noHeaders){}else{for(const k in x){if(x.hasOwnProperty(k)){const W=x[k];vn(m,k,W)}}}const T={xhr:m,target:u,requestConfig:R,etc:i,boosted:_,select:D,pathInfo:{requestPath:n,finalRequestPath:q,anchor:E}};m.onload=function(){try{const t=Cn(r);T.pathInfo.responsePath=wn(m);M(r,T);Kt(O,H);fe(r,"htmx:afterRequest",T);fe(r,"htmx:afterOnLoad",T);if(!le(r)){let e=null;while(t.length>0&&e==null){const n=t.shift();if(le(n)){e=n}}if(e){fe(e,"htmx:afterRequest",T);fe(e,"htmx:afterOnLoad",T)}}oe(s);p()}catch(e){ae(r,"htmx:onLoadError",ue({error:e},T));throw e}};m.onerror=function(){Kt(O,H);ae(r,"htmx:afterRequest",T);ae(r,"htmx:sendError",T);oe(l);p()};m.onabort=function(){Kt(O,H);ae(r,"htmx:afterRequest",T);ae(r,"htmx:sendAbort",T);oe(l);p()};m.ontimeout=function(){Kt(O,H);ae(r,"htmx:afterRequest",T);ae(r,"htmx:timeout",T);oe(l);p()};if(!fe(r,"htmx:beforeRequest",T)){oe(s);p();return e}var O=Jt(r);var H=Zt(r);se(["loadstart","loadend","progress","abort"],function(t){se([m,m.upload],function(e){e.addEventListener(t,function(e){fe(r,"htmx:xhr:"+t,{lengthComputable:e.lengthComputable,loaded:e.loaded,total:e.total})})})});fe(r,"htmx:beforeSend",T);const G=C?null:hn(m,r,w);m.send(G);return e}function En(e,t){const n=t.xhr;let r=null;let o=null;if(R(n,/HX-Push:/i)){r=n.getResponseHeader("HX-Push");o="push"}else if(R(n,/HX-Push-Url:/i)){r=n.getResponseHeader("HX-Push-Url");o="push"}else if(R(n,/HX-Replace-Url:/i)){r=n.getResponseHeader("HX-Replace-Url");o="replace"}if(r){if(r==="false"){return{}}else{return{type:o,path:r}}}const i=t.pathInfo.finalRequestPath;const s=t.pathInfo.responsePath;const l=re(e,"hx-push-url");const u=re(e,"hx-replace-url");const c=ie(e).boosted;let a=null;let f=null;if(l){a="push";f=l}else if(u){a="replace";f=u}else if(c){a="push";f=s||i}if(f){if(f==="false"){return{}}if(f==="true"){f=s||i}if(t.pathInfo.anchor&&f.indexOf("#")===-1){f=f+"#"+t.pathInfo.anchor}return{type:a,path:f}}else{return{}}}function qn(c,a){const f=a.xhr;let h=a.target;const r=a.etc;const e=a.requestConfig;const d=a.select;if(!fe(c,"htmx:beforeOnLoad",a))return;if(R(f,/HX-Trigger:/i)){ze(f,"HX-Trigger",c)}if(R(f,/HX-Location:/i)){Vt();let e=f.getResponseHeader("HX-Location");var g;if(e.indexOf("{")===0){g=b(e);e=g.path;delete g.path}Sn("GET",e,g).then(function(){jt(e)});return}const t=R(f,/HX-Refresh:/i)&&f.getResponseHeader("HX-Refresh")==="true";if(R(f,/HX-Redirect:/i)){location.href=f.getResponseHeader("HX-Redirect");t&&location.reload();return}if(t){location.reload();return}if(R(f,/HX-Retarget:/i)){if(f.getResponseHeader("HX-Retarget")==="this"){a.target=c}else{a.target=ce(c,f.getResponseHeader("HX-Retarget"))}}const m=En(c,a);const n=f.status>=200&&f.status<400&&f.status!==204;let p=f.response;let o=f.status>=400;let y=Q.config.ignoreTitle;const i=ue({shouldSwap:n,serverResponse:p,isError:o,ignoreTitle:y},a);if(!fe(h,"htmx:beforeSwap",i))return;h=i.target;p=i.serverResponse;o=i.isError;y=i.ignoreTitle;a.target=h;a.failed=o;a.successful=!o;if(i.shouldSwap){if(f.status===286){it(c)}Mt(c,function(e){p=e.transformResponse(p,f,c)});if(m.type){Vt()}let e=r.swapOverride;if(R(f,/HX-Reswap:/i)){e=f.getResponseHeader("HX-Reswap")}var g=an(c,e);if(g.hasOwnProperty("ignoreTitle")){y=g.ignoreTitle}h.classList.add(Q.config.swappingClass);let l=null;let u=null;let t=function(){try{const n=document.activeElement;let e={};try{e={elt:n,start:n?n.selectionStart:null,end:n?n.selectionEnd:null}}catch(e){}let t;if(d){t=d}if(R(f,/HX-Reselect:/i)){t=f.getResponseHeader("HX-Reselect")}if(m.type){fe(ne().body,"htmx:beforeHistoryUpdate",ue({history:m},a));if(m.type==="push"){jt(m.path);fe(ne().body,"htmx:pushedIntoHistory",{path:m.path})}else{_t(m.path);fe(ne().body,"htmx:replacedInHistory",{path:m.path})}}const r=dn(h);_e(g.swapStyle,h,c,p,r,t);if(e.elt&&!le(e.elt)&&ee(e.elt,"id")){const i=document.getElementById(ee(e.elt,"id"));const s={preventScroll:g.focusScroll!==undefined?!g.focusScroll:!Q.config.defaultFocusScroll};if(i){if(e.start&&i.setSelectionRange){try{i.setSelectionRange(e.start,e.end)}catch(e){}}i.focus(s)}}h.classList.remove(Q.config.swappingClass);se(r.elts,function(e){if(e.classList){e.classList.add(Q.config.settlingClass)}fe(e,"htmx:afterSwap",a)});if(R(f,/HX-Trigger-After-Swap:/i)){let e=c;if(!le(c)){e=ne().body}ze(f,"HX-Trigger-After-Swap",e)}const o=function(){se(r.tasks,function(e){e.call()});se(r.elts,function(e){if(e.classList){e.classList.remove(Q.config.settlingClass)}fe(e,"htmx:afterSettle",a)});if(a.pathInfo.anchor){const e=ne().getElementById(a.pathInfo.anchor);if(e){e.scrollIntoView({block:"start",behavior:"auto"})}}if(r.title&&!y){const t=v("title");if(t){t.innerHTML=r.title}else{window.document.title=r.title}}gn(r.elts,g);if(R(f,/HX-Trigger-After-Settle:/i)){let e=c;if(!le(c)){e=ne().body}ze(f,"HX-Trigger-After-Settle",e)}oe(l)};if(g.settleDelay>0){setTimeout(o,g.settleDelay)}else{o()}}catch(e){ae(c,"htmx:swapError",a);oe(u);throw e}};let n=Q.config.globalViewTransitions;if(g.hasOwnProperty("transition")){n=g.transition}if(n&&fe(c,"htmx:beforeTransition",a)&&typeof Promise!=="undefined"&&document.startViewTransition){const s=new Promise(function(e,t){l=e;u=t});const x=t;t=function(){document.startViewTransition(function(){x();return s})}}if(g.swapDelay>0){setTimeout(t,g.swapDelay)}else{t()}}if(o){ae(c,"htmx:responseError",ue({error:"Response Status Error Code "+f.status+" from "+a.pathInfo.requestPath},a))}}const Tn={};function On(){return{init:function(e){return null},onEvent:function(e,t){return true},transformResponse:function(e,t,n){return e},isInlineSwap:function(e){return false},handleSwap:function(e,t,n,r){return false},encodeParameters:function(e,t,n){return null}}}function Hn(e,t){if(t.init){t.init(n)}Tn[e]=ue(On(),t)}function Ln(e){delete Tn[e]}function Nn(e,n,r){if(e==undefined){return n}if(n==undefined){n=[]}if(r==undefined){r=[]}const t=te(e,"hx-ext");if(t){se(t.split(","),function(e){e=e.replace(/ /g,"");if(e.slice(0,7)=="ignore:"){r.push(e.slice(7));return}if(r.indexOf(e)<0){const t=Tn[e];if(t&&n.indexOf(t)<0){n.push(t)}}})}return Nn(u(e),n,r)}function An(e){const t=function(){if(!e)return;e();e=null};if(ne().readyState==="complete"){t()}else{ne().addEventListener("DOMContentLoaded",function(){t()});ne().addEventListener("readystatechange",function(){if(ne().readyState!=="complete")return;t()})}}function In(){if(Q.config.includeIndicatorStyles!==false){ne().head.insertAdjacentHTML("beforeend","<style> ."+Q.config.indicatorClass+"{opacity:0} ."+Q.config.requestClass+" ."+Q.config.indicatorClass+"{opacity:1; transition: opacity 200ms ease-in;} ."+Q.config.requestClass+"."+Q.config.indicatorClass+"{opacity:1; transition: opacity 200ms ease-in;} </style>")}}function Pn(){const e=ne().querySelector('meta[name="htmx-config"]');if(e){return b(e.content)}else{return null}}function kn(){const e=Pn();if(e){Q.config=ue(Q.config,e)}}An(function(){kn();In();let e=ne().body;It(e);const t=ne().querySelectorAll("[hx-trigger='restored'],[data-hx-trigger='restored']");e.addEventListener("htmx:abort",function(e){const t=e.target;const n=ie(t);if(n&&n.xhr){n.xhr.abort()}});const n=window.onpopstate?window.onpopstate.bind(window):null;window.onpopstate=function(e){if(e.state&&e.state.htmx){Gt();se(t,function(e){fe(e,"htmx:restored",{document:ne(),triggerEvent:fe})})}else{if(n){n(e)}}};setTimeout(function(){fe(e,"htmx:load",{});e=null},0)});return Q}();
|
package/dist/htmx.min.js.gz
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -5,12 +5,12 @@
|
|
|
5
5
|
"AJAX",
|
|
6
6
|
"HTML"
|
|
7
7
|
],
|
|
8
|
-
"version": "
|
|
8
|
+
"version": "2.0.0-alpha1",
|
|
9
9
|
"homepage": "https://htmx.org/",
|
|
10
10
|
"bugs": {
|
|
11
11
|
"url": "https://github.com/bigskysoftware/htmx/issues"
|
|
12
12
|
},
|
|
13
|
-
"license": "
|
|
13
|
+
"license": "0BSD",
|
|
14
14
|
"files": [
|
|
15
15
|
"LICENSE",
|
|
16
16
|
"README.md",
|
|
@@ -25,25 +25,55 @@
|
|
|
25
25
|
"unpkg": "dist/htmx.min.js",
|
|
26
26
|
"web-types": "editors/jetbrains/htmx.web-types.json",
|
|
27
27
|
"scripts": {
|
|
28
|
-
"
|
|
28
|
+
"dist": "./scripts/dist.sh",
|
|
29
|
+
"lint": "eslint src/htmx.js test/attributes/ test/core/ test/util/",
|
|
30
|
+
"lint-fix": "eslint src/htmx.js test/attributes/ test/core/ test/util/ --fix",
|
|
31
|
+
"format": "eslint --fix src/htmx.js test/attributes/ test/core/ test/util/",
|
|
32
|
+
"test": "npm run lint && mocha-chrome test/index.html",
|
|
29
33
|
"test-types": "tsc --project ./jsconfig.json",
|
|
30
|
-
"dist": "cp -r src/* dist/ && npm run-script uglify && gzip -9 -k -f dist/htmx.min.js > dist/htmx.min.js.gz && exit",
|
|
31
34
|
"ws-tests": "cd ./test/ws-sse && node ./server.js",
|
|
32
|
-
"www": "bash ./scripts/www.sh"
|
|
33
|
-
"uglify": "uglifyjs -m eval -o dist/htmx.min.js dist/htmx.js"
|
|
35
|
+
"www": "bash ./scripts/www.sh"
|
|
34
36
|
},
|
|
35
37
|
"repository": {
|
|
36
38
|
"type": "git",
|
|
37
39
|
"url": "git+https://github.com/bigskysoftware/htmx.git"
|
|
38
40
|
},
|
|
41
|
+
"eslintConfig": {
|
|
42
|
+
"extends": "standard",
|
|
43
|
+
"rules": {
|
|
44
|
+
"camelcase": 0,
|
|
45
|
+
"no-var": 0,
|
|
46
|
+
"no-undef": 0,
|
|
47
|
+
"eqeqeq": 0,
|
|
48
|
+
"no-multi-str": 0,
|
|
49
|
+
"no-prototype-builtins": 0,
|
|
50
|
+
"no-cond-assign": 0,
|
|
51
|
+
"no-empty": 0,
|
|
52
|
+
"no-eval": 0,
|
|
53
|
+
"no-new-func": 0,
|
|
54
|
+
"no-redeclare": 0,
|
|
55
|
+
"no-return-assign": 0,
|
|
56
|
+
"no-unused-vars": 0,
|
|
57
|
+
"no-useless-call": 0,
|
|
58
|
+
"no-useless-escape": 0,
|
|
59
|
+
"no-unused-expressions": 0,
|
|
60
|
+
"space-before-function-paren": [
|
|
61
|
+
"error",
|
|
62
|
+
"never"
|
|
63
|
+
]
|
|
64
|
+
}
|
|
65
|
+
},
|
|
39
66
|
"devDependencies": {
|
|
40
|
-
"chai": "^4.3.
|
|
41
|
-
"chai-dom": "^1.
|
|
67
|
+
"chai": "^4.3.10",
|
|
68
|
+
"chai-dom": "^1.12.0",
|
|
69
|
+
"eslint": "^8.56.0",
|
|
70
|
+
"eslint-config-standard": "^17.1.0",
|
|
71
|
+
"eslint-plugin-import": "^2.29.1",
|
|
42
72
|
"fs-extra": "^9.1.0",
|
|
43
|
-
"mocha": "
|
|
44
|
-
"mocha-chrome": "
|
|
45
|
-
"mocha-webdriver
|
|
46
|
-
"mock-socket": "^9.
|
|
73
|
+
"mocha": "10.1.0",
|
|
74
|
+
"mocha-chrome": "https://github.com/Telroshan/mocha-chrome",
|
|
75
|
+
"mocha-webdriver": "^0.3.2",
|
|
76
|
+
"mock-socket": "^9.3.1",
|
|
47
77
|
"sinon": "^9.2.4",
|
|
48
78
|
"typescript": "^4.9.5",
|
|
49
79
|
"uglify-js": "^3.17.4",
|
package/dist/ext/ajax-header.js
DELETED
package/dist/ext/alpine-morph.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
htmx.defineExtension('alpine-morph', {
|
|
2
|
-
isInlineSwap: function (swapStyle) {
|
|
3
|
-
return swapStyle === 'morph';
|
|
4
|
-
},
|
|
5
|
-
handleSwap: function (swapStyle, target, fragment) {
|
|
6
|
-
if (swapStyle === 'morph') {
|
|
7
|
-
if (fragment.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {
|
|
8
|
-
Alpine.morph(target, fragment.firstElementChild);
|
|
9
|
-
return [target];
|
|
10
|
-
} else {
|
|
11
|
-
Alpine.morph(target, fragment.outerHTML);
|
|
12
|
-
return [target];
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
});
|
package/dist/ext/class-tools.js
DELETED
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
(function () {
|
|
2
|
-
|
|
3
|
-
function splitOnWhitespace(trigger) {
|
|
4
|
-
return trigger.split(/\s+/);
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
function parseClassOperation(trimmedValue) {
|
|
8
|
-
var split = splitOnWhitespace(trimmedValue);
|
|
9
|
-
if (split.length > 1) {
|
|
10
|
-
var operation = split[0];
|
|
11
|
-
var classDef = split[1].trim();
|
|
12
|
-
var cssClass;
|
|
13
|
-
var delay;
|
|
14
|
-
if (classDef.indexOf(":") > 0) {
|
|
15
|
-
var splitCssClass = classDef.split(':');
|
|
16
|
-
cssClass = splitCssClass[0];
|
|
17
|
-
delay = htmx.parseInterval(splitCssClass[1]);
|
|
18
|
-
} else {
|
|
19
|
-
cssClass = classDef;
|
|
20
|
-
delay = 100;
|
|
21
|
-
}
|
|
22
|
-
return {
|
|
23
|
-
operation: operation,
|
|
24
|
-
cssClass: cssClass,
|
|
25
|
-
delay: delay
|
|
26
|
-
}
|
|
27
|
-
} else {
|
|
28
|
-
return null;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function performOperation(elt, classOperation, classList, currentRunTime) {
|
|
33
|
-
setTimeout(function () {
|
|
34
|
-
elt.classList[classOperation.operation].call(elt.classList, classOperation.cssClass);
|
|
35
|
-
}, currentRunTime)
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function toggleOperation(elt, classOperation, classList, currentRunTime) {
|
|
39
|
-
setTimeout(function () {
|
|
40
|
-
setInterval(function () {
|
|
41
|
-
elt.classList[classOperation.operation].call(elt.classList, classOperation.cssClass);
|
|
42
|
-
}, classOperation.delay);
|
|
43
|
-
}, currentRunTime)
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
function processClassList(elt, classList) {
|
|
47
|
-
var runs = classList.split("&");
|
|
48
|
-
for (var i = 0; i < runs.length; i++) {
|
|
49
|
-
var run = runs[i];
|
|
50
|
-
var currentRunTime = 0;
|
|
51
|
-
var classOperations = run.split(",");
|
|
52
|
-
for (var j = 0; j < classOperations.length; j++) {
|
|
53
|
-
var value = classOperations[j];
|
|
54
|
-
var trimmedValue = value.trim();
|
|
55
|
-
var classOperation = parseClassOperation(trimmedValue);
|
|
56
|
-
if (classOperation) {
|
|
57
|
-
if (classOperation.operation === "toggle") {
|
|
58
|
-
toggleOperation(elt, classOperation, classList, currentRunTime);
|
|
59
|
-
currentRunTime = currentRunTime + classOperation.delay;
|
|
60
|
-
} else {
|
|
61
|
-
currentRunTime = currentRunTime + classOperation.delay;
|
|
62
|
-
performOperation(elt, classOperation, classList, currentRunTime);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
function maybeProcessClasses(elt) {
|
|
70
|
-
if (elt.getAttribute) {
|
|
71
|
-
var classList = elt.getAttribute("classes") || elt.getAttribute("data-classes");
|
|
72
|
-
if (classList) {
|
|
73
|
-
processClassList(elt, classList);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
htmx.defineExtension('class-tools', {
|
|
79
|
-
onEvent: function (name, evt) {
|
|
80
|
-
if (name === "htmx:afterProcessNode") {
|
|
81
|
-
var elt = evt.detail.elt;
|
|
82
|
-
maybeProcessClasses(elt);
|
|
83
|
-
if (elt.querySelectorAll) {
|
|
84
|
-
var children = elt.querySelectorAll("[classes], [data-classes]");
|
|
85
|
-
for (var i = 0; i < children.length; i++) {
|
|
86
|
-
maybeProcessClasses(children[i]);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
});
|
|
92
|
-
})();
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
htmx.defineExtension('client-side-templates', {
|
|
2
|
-
transformResponse : function(text, xhr, elt) {
|
|
3
|
-
|
|
4
|
-
var mustacheTemplate = htmx.closest(elt, "[mustache-template]");
|
|
5
|
-
if (mustacheTemplate) {
|
|
6
|
-
var data = JSON.parse(text);
|
|
7
|
-
var templateId = mustacheTemplate.getAttribute('mustache-template');
|
|
8
|
-
var template = htmx.find("#" + templateId);
|
|
9
|
-
if (template) {
|
|
10
|
-
return Mustache.render(template.innerHTML, data);
|
|
11
|
-
} else {
|
|
12
|
-
throw "Unknown mustache template: " + templateId;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
var mustacheArrayTemplate = htmx.closest(elt, "[mustache-array-template]");
|
|
17
|
-
if (mustacheArrayTemplate) {
|
|
18
|
-
var data = JSON.parse(text);
|
|
19
|
-
var templateId = mustacheArrayTemplate.getAttribute('mustache-array-template');
|
|
20
|
-
var template = htmx.find("#" + templateId);
|
|
21
|
-
if (template) {
|
|
22
|
-
return Mustache.render(template.innerHTML, {"data": data });
|
|
23
|
-
} else {
|
|
24
|
-
throw "Unknown mustache template: " + templateId;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
var handlebarsTemplate = htmx.closest(elt, "[handlebars-template]");
|
|
29
|
-
if (handlebarsTemplate) {
|
|
30
|
-
var data = JSON.parse(text);
|
|
31
|
-
var templateId = handlebarsTemplate.getAttribute('handlebars-template');
|
|
32
|
-
var templateElement = htmx.find('#' + templateId).innerHTML;
|
|
33
|
-
var renderTemplate = Handlebars.compile(templateElement);
|
|
34
|
-
if (renderTemplate) {
|
|
35
|
-
return renderTemplate(data);
|
|
36
|
-
} else {
|
|
37
|
-
throw "Unknown handlebars template: " + templateId;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
var handlebarsArrayTemplate = htmx.closest(elt, "[handlebars-array-template]");
|
|
42
|
-
if (handlebarsArrayTemplate) {
|
|
43
|
-
var data = JSON.parse(text);
|
|
44
|
-
var templateId = handlebarsArrayTemplate.getAttribute('handlebars-array-template');
|
|
45
|
-
var templateElement = htmx.find('#' + templateId).innerHTML;
|
|
46
|
-
var renderTemplate = Handlebars.compile(templateElement);
|
|
47
|
-
if (renderTemplate) {
|
|
48
|
-
return renderTemplate(data);
|
|
49
|
-
} else {
|
|
50
|
-
throw "Unknown handlebars template: " + templateId;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
var nunjucksTemplate = htmx.closest(elt, "[nunjucks-template]");
|
|
55
|
-
if (nunjucksTemplate) {
|
|
56
|
-
var data = JSON.parse(text);
|
|
57
|
-
var templateName = nunjucksTemplate.getAttribute('nunjucks-template');
|
|
58
|
-
var template = htmx.find('#' + templateName);
|
|
59
|
-
if (template) {
|
|
60
|
-
return nunjucks.renderString(template.innerHTML, data);
|
|
61
|
-
} else {
|
|
62
|
-
return nunjucks.render(templateName, data);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
var xsltTemplate = htmx.closest(elt, "[xslt-template]");
|
|
67
|
-
if (xsltTemplate) {
|
|
68
|
-
var templateId = xsltTemplate.getAttribute('xslt-template');
|
|
69
|
-
var template = htmx.find("#" + templateId);
|
|
70
|
-
if (template) {
|
|
71
|
-
var content = template.innerHTML ? new DOMParser().parseFromString(template.innerHTML, 'application/xml')
|
|
72
|
-
: template.contentDocument;
|
|
73
|
-
var processor = new XSLTProcessor();
|
|
74
|
-
processor.importStylesheet(content);
|
|
75
|
-
var data = new DOMParser().parseFromString(text, "application/xml");
|
|
76
|
-
var frag = processor.transformToFragment(data, document);
|
|
77
|
-
return new XMLSerializer().serializeToString(frag);
|
|
78
|
-
} else {
|
|
79
|
-
throw "Unknown XSLT template: " + templateId;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
var nunjucksArrayTemplate = htmx.closest(elt, "[nunjucks-array-template]");
|
|
84
|
-
if (nunjucksArrayTemplate) {
|
|
85
|
-
var data = JSON.parse(text);
|
|
86
|
-
var templateName = nunjucksArrayTemplate.getAttribute('nunjucks-array-template');
|
|
87
|
-
var template = htmx.find('#' + templateName);
|
|
88
|
-
if (template) {
|
|
89
|
-
return nunjucks.renderString(template.innerHTML, {"data": data});
|
|
90
|
-
} else {
|
|
91
|
-
return nunjucks.render(templateName, {"data": data});
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
return text;
|
|
95
|
-
}
|
|
96
|
-
});
|
package/dist/ext/debug.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
// Disable Submit Button
|
|
4
|
-
htmx.defineExtension('disable-element', {
|
|
5
|
-
onEvent: function (name, evt) {
|
|
6
|
-
let elt = evt.detail.elt;
|
|
7
|
-
let target = elt.getAttribute("hx-disable-element");
|
|
8
|
-
let targetElements = (target == "self") ? [ elt ] : document.querySelectorAll(target);
|
|
9
|
-
|
|
10
|
-
for (var i = 0; i < targetElements.length; i++) {
|
|
11
|
-
if (name === "htmx:beforeRequest" && targetElements[i]) {
|
|
12
|
-
targetElements[i].disabled = true;
|
|
13
|
-
} else if (name == "htmx:afterRequest" && targetElements[i]) {
|
|
14
|
-
targetElements[i].disabled = false;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
});
|
package/dist/ext/event-header.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
(function(){
|
|
2
|
-
function stringifyEvent(event) {
|
|
3
|
-
var obj = {};
|
|
4
|
-
for (var key in event) {
|
|
5
|
-
obj[key] = event[key];
|
|
6
|
-
}
|
|
7
|
-
return JSON.stringify(obj, function(key, value){
|
|
8
|
-
if(value instanceof Node){
|
|
9
|
-
var nodeRep = value.tagName;
|
|
10
|
-
if (nodeRep) {
|
|
11
|
-
nodeRep = nodeRep.toLowerCase();
|
|
12
|
-
if(value.id){
|
|
13
|
-
nodeRep += "#" + value.id;
|
|
14
|
-
}
|
|
15
|
-
if(value.classList && value.classList.length){
|
|
16
|
-
nodeRep += "." + value.classList.toString().replace(" ", ".")
|
|
17
|
-
}
|
|
18
|
-
return nodeRep;
|
|
19
|
-
} else {
|
|
20
|
-
return "Node"
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
if (value instanceof Window) return 'Window';
|
|
24
|
-
return value;
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
htmx.defineExtension('event-header', {
|
|
29
|
-
onEvent: function (name, evt) {
|
|
30
|
-
if (name === "htmx:configRequest") {
|
|
31
|
-
if (evt.detail.triggeringEvent) {
|
|
32
|
-
evt.detail.headers['Triggering-Event'] = stringifyEvent(evt.detail.triggeringEvent);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
})();
|