@hyperfixi/core 2.4.0 → 2.5.1
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/dist/chunks/{bridge-C4d3blZX.js → bridge-Ce2mO-nk.js} +2 -2
- package/dist/chunks/browser-modular-D5vPrb2X.js +2 -0
- package/dist/chunks/{index-Beno_SBy.js → index-DsBHN4zW.js} +2 -2
- package/dist/commands/index.js +1 -0
- package/dist/commands/index.mjs +1 -0
- package/dist/htmx/i18n-orchestrator.d.ts +1 -0
- package/dist/hyperfixi-browser-classic-i18n.js +1 -1
- package/dist/hyperfixi-browser-minimal.js +1 -1
- package/dist/hyperfixi-browser-standard.js +1 -1
- package/dist/hyperfixi-browser.js +1 -1
- package/dist/hyperfixi-classic-i18n.js +1 -1
- package/dist/hyperfixi-hx-v4.js +1 -1
- package/dist/hyperfixi-hx.js +1 -1
- package/dist/hyperfixi-hybrid-hx.js +1 -1
- package/dist/hyperfixi-minimal.js +1 -1
- package/dist/hyperfixi-multilingual.js +1 -1
- package/dist/hyperfixi-standard.js +1 -1
- package/dist/hyperfixi.js +1 -1
- package/dist/hyperfixi.mjs +1 -1
- package/dist/index.js +1 -0
- package/dist/index.min.js +1 -1
- package/dist/index.mjs +1 -0
- package/dist/lokascript-browser-classic-i18n.js +1 -1
- package/dist/lokascript-browser-minimal.js +1 -1
- package/dist/lokascript-browser-standard.js +1 -1
- package/dist/lokascript-browser.js +1 -1
- package/dist/lokascript-hybrid-hx.js +1 -1
- package/dist/lokascript-multilingual.js +1 -1
- package/dist/parser/full-parser.js +1 -0
- package/dist/parser/full-parser.mjs +1 -0
- package/dist/registry/index.js +1 -0
- package/dist/registry/index.mjs +1 -0
- package/package.json +5 -5
- package/dist/chunks/browser-modular-BwIRlrTM.js +0 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(t){"use strict";const e=new Set(["on","from","to","into","before","after","in","of","at","with","if","else","unless","end","then","and","or","not","repeat","times","for","each","while","until","toggle","add","remove","put","set","get","call","return","append","log","send","trigger","wait","settle","fetch","as","show","hide","take","increment","decrement","focus","blur","go","transition","over","the","a","an","my","its","me","it","you","first","last","next","previous","closest","parent","true","false","null","undefined","is","matches","contains","includes","exists","has","init","every","by","halt","via","values","default","event"]);function s(t){const s=[];let n=0;for(;t.length>n;){if(/\s/.test(t[n])){n++;continue}if("--"===t.slice(n,n+2)){for(;t.length>n&&"\n"!==t[n];)n++;continue}const i=n;if("<"===t[n]&&/[a-zA-Z]/.test(t[n+1]||"")){for(n++;t.length>n&&">"!==t[n];)n++;">"===t[n]&&n++;const e=t.slice(i,n);if(e.endsWith("/>")||e.endsWith(">")){const t=e.slice(1).replace(/\/?>$/,"");s.push({type:"selector",value:t,pos:i});continue}}if("'s"===t.slice(n,n+2)&&!/[a-zA-Z]/.test(t[n+2]||"")){s.push({type:"operator",value:"'s",pos:i}),n+=2;continue}if('"'===t[n]||"'"===t[n]){const e=t[n++];for(;t.length>n&&t[n]!==e;)"\\"===t[n]&&n++,n++;n++,s.push({type:"string",value:t.slice(i,n),pos:i});continue}if(/\d/.test(t[n])||"-"===t[n]&&/\d/.test(t[n+1]||"")){for("-"===t[n]&&n++;t.length>n&&/[\d.]/.test(t[n]);)n++;"ms"===t.slice(n,n+2)?n+=2:"s"!==t[n]||/[a-zA-Z]/.test(t[n+1]||"")?"px"===t.slice(n,n+2)&&(n+=2):n++,s.push({type:"number",value:t.slice(i,n),pos:i});continue}if(":"===t[n]){for(n++;t.length>n&&/[\w]/.test(t[n]);)n++;s.push({type:"localVar",value:t.slice(i,n),pos:i});continue}if("$"===t[n]){for(n++;t.length>n&&/[\w]/.test(t[n]);)n++;s.push({type:"globalVar",value:t.slice(i,n),pos:i});continue}if("@"===t[n]){for(n++;t.length>n&&/[\w-]/.test(t[n]);)n++;s.push({type:"selector",value:t.slice(i,n),pos:i});continue}if("#"===t[n]||"."===t[n]){if("."===t[n]&&t.slice(n+1).match(/^(once|prevent|stop|debounce|throttle)\b/i)){s.push({type:"symbol",value:".",pos:i}),n++;continue}for(n++;t.length>n&&/[\w-]/.test(t[n]);)n++;s.push({type:"selector",value:t.slice(i,n),pos:i});continue}if("["===t[n]){let e=n+1;for(;t.length>e&&/\s/.test(t[e]);)e++;const r=t[e]||"";if(/['"\d\[\]:\$\-]/.test(r)||""===r){s.push({type:"symbol",value:"[",pos:i}),n++;continue}{n++;let e=1;for(;t.length>n&&e>0;)"["===t[n]&&e++,"]"===t[n]&&e--,n++;s.push({type:"selector",value:t.slice(i,n),pos:i});continue}}if("]"===t[n]){s.push({type:"symbol",value:"]",pos:i}),n++;continue}if("'s"===t.slice(n,n+2)){s.push({type:"operator",value:"'s",pos:i}),n+=2;continue}const r=t.slice(n,n+2);if(["==","!=","<=",">=","&&","||"].includes(r))s.push({type:"operator",value:r,pos:i}),n+=2;else if("*"===t[n]&&/[a-zA-Z]/.test(t[n+1]||"")){for(n++;t.length>n&&/[\w-]/.test(t[n]);)n++;s.push({type:"styleProperty",value:t.slice(i,n),pos:i})}else if("+-*/%<>!".includes(t[n]))s.push({type:"operator",value:t[n],pos:i}),n++;else if("()[]{},.".includes(t[n]))s.push({type:"symbol",value:t[n],pos:i}),n++;else{if(/[a-zA-Z_]/.test(t[n])){for(;t.length>n&&/[\w-]/.test(t[n]);)n++;const r=t.slice(i,n),o=e.has(r.toLowerCase())?"keyword":"identifier";s.push({type:o,value:r,pos:i});continue}n++}}return s.push({type:"eof",value:"",pos:t.length}),s}const n={flip:"toggle",switch:"toggle",display:"show",reveal:"show",conceal:"hide",increase:"increment",decrease:"decrement",fire:"trigger",dispatch:"send",navigate:"go",goto:"go"},i={clicked:"click",pressed:"keydown",changed:"change",submitted:"submit",loaded:"load"};function r(t){const e=t.toLowerCase();return n[e]||e}function o(t){const e=t.toLowerCase();return i[e]||e}class a{constructor(t){this.pos=0,this.tokens=s(t)}peek(t=0){return this.tokens[Math.min(this.pos+t,this.tokens.length-1)]}advance(){return this.tokens[this.pos++]}match(...t){const e=this.peek();return t.some(t=>e.value.toLowerCase()===t.toLowerCase())}matchType(...t){return t.includes(this.peek().type)}expect(t){if(!this.match(t)&&r(this.peek().value)!==t)throw Error(`Expected '${t}', got '${this.peek().value}'`);return this.advance()}isAtEnd(){return"eof"===this.peek().type}parse(){return this.match("on")?this.parseEventHandler():this.match("init")?(this.advance(),{type:"event",event:"init",modifiers:{},body:this.parseCommandSequence()}):this.match("every")?this.parseEveryHandler():{type:"sequence",commands:this.parseCommandSequence()}}parseEventHandler(){this.expect("on");const t=this.advance().value,e={};let s;for(;"."===this.peek().value;){this.advance();const t=this.advance().value.toLowerCase();if("once"===t)e.once=1;else if("prevent"===t)e.prevent=1;else if("stop"===t)e.stop=1;else if(("debounce"===t||"throttle"===t)&&"("===this.peek().value){this.advance();const s=this.advance().value;this.expect(")"),"debounce"===t?e.debounce=parseInt(s)||100:e.throttle=parseInt(s)||100}}return this.match("from")&&(this.advance(),s=this.parseExpression()),{type:"event",event:o(t),filter:s,modifiers:e,body:this.parseCommandSequence()}}parseEveryHandler(){return this.expect("every"),{type:"event",event:"interval:"+this.advance().value,modifiers:{},body:this.parseCommandSequence()}}parseCommandSequence(){const t=[];for(;!this.isAtEnd()&&!this.match("end","else");){const e=this.parseCommand();e&&t.push(e),this.match("then","and")&&this.advance()}return t}parseCommand(){if(this.match("if","unless"))return this.parseIf();if(this.match("repeat"))return this.parseRepeat();if(this.match("for"))return this.parseFor();if(this.match("while"))return this.parseWhile();if(this.match("fetch"))return this.parseFetchBlock();const t={toggle:()=>this.parseToggle(),add:()=>this.parseAdd(),remove:()=>this.parseRemove(),put:()=>this.parsePut(),append:()=>this.parseAppend(),set:()=>this.parseSet(),get:()=>this.parseGet(),call:()=>this.parseCall(),log:()=>this.parseLog(),send:()=>this.parseSend(),trigger:()=>this.parseSend(),wait:()=>this.parseWait(),show:()=>this.parseShow(),hide:()=>this.parseHide(),take:()=>this.parseTake(),increment:()=>this.parseIncDec("increment"),decrement:()=>this.parseIncDec("decrement"),focus:()=>this.parseFocusBlur("focus"),blur:()=>this.parseFocusBlur("blur"),go:()=>this.parseGo(),return:()=>this.parseReturn(),transition:()=>this.parseTransition(),halt:()=>this.parseHalt()},e=r(this.peek().value);return t[e]?t[e]():(this.isAtEnd()||this.match("then","and","end","else")||this.advance(),null)}parseIf(){const t=this.match("unless");this.advance();const e=this.parseExpression(),s=this.parseCommandSequence();let n;return this.match("else")&&(this.advance(),n=this.parseCommandSequence()),this.match("end")&&this.advance(),{type:"if",condition:t?{type:"unary",operator:"not",operand:e}:e,body:s,elseBody:n}}parseRepeat(){let t;this.expect("repeat"),this.match("until","while","forever")||(t=this.parseExpression(),this.match("times")&&this.advance());const e=this.parseCommandSequence();return this.match("end")&&this.advance(),{type:"repeat",condition:t,body:e}}parseFor(){this.expect("for"),this.match("each")&&this.advance();const t=this.advance().value;this.expect("in");const e=this.parseExpression(),s=this.parseCommandSequence();return this.match("end")&&this.advance(),{type:"for",condition:{type:"forCondition",variable:t,iterable:e},body:s}}parseWhile(){this.expect("while");const t=this.parseExpression(),e=this.parseCommandSequence();return this.match("end")&&this.advance(),{type:"while",condition:t,body:e}}parseFetchBlock(){this.expect("fetch");const t=this.parseExpression();let e,s,n={type:"literal",value:"text"};this.match("{")&&(this.pos--,e=this.parseExpression());for(let t=0;3>t;t++)if(!this.match("via")||s)if(this.match("as"))this.advance(),(this.match("a")||this.match("an"))&&this.advance(),n=this.parseExpression();else{if(!this.match("with")||e)break;this.advance(),e=this.parseExpression()}else this.advance(),s=this.parseExpression();return this.match("then")&&this.advance(),{type:"fetch",condition:{type:"fetchConfig",url:t,responseType:n,options:e,method:s},body:this.parseCommandSequence()}}parseToggle(){this.expect("toggle");const t=this.parseExpression();let e;return this.match("on")&&(this.advance(),e=this.parseExpression()),{type:"command",name:"toggle",args:[t],target:e}}parseAdd(){this.expect("add");const t=this.parseExpression();let e;return this.match("to")&&(this.advance(),e=this.parseExpression()),{type:"command",name:"add",args:[t],target:e}}parseRemove(){if(this.expect("remove"),this.matchType("selector")){const t=this.parseExpression();let e;return this.match("from")&&(this.advance(),e=this.parseExpression()),{type:"command",name:"removeClass",args:[t],target:e}}return{type:"command",name:"remove",args:[],target:this.parseExpression()}}parsePut(){this.expect("put");const t=this.parseExpression();let e="into";if(this.match("into","before","after","at")&&(e=this.advance().value,"at"===e)){const t=this.advance().value;this.expect("of"),e=`at ${t} of`}return{type:"command",name:"put",args:[t],target:this.parseExpression(),modifier:e}}parseAppend(){this.expect("append");const t=this.parseExpression();let e;return this.match("to")&&(this.advance(),e=this.parseExpression()),{type:"command",name:"append",args:[t],target:e}}parseSet(){this.expect("set");const t=this.parseExpression();return this.match("to")?(this.advance(),{type:"command",name:"set",args:[t,this.parseExpression()]}):{type:"command",name:"set",args:[t]}}parseGet(){return this.expect("get"),{type:"command",name:"get",args:[this.parseExpression()]}}parseCall(){return this.expect("call"),{type:"command",name:"call",args:[this.parseExpression()]}}parseLog(){this.expect("log");const t=[];for(;!this.isAtEnd()&&!this.match("then","and","end","else")&&(t.push(this.parseExpression()),this.match(","));)this.advance();return{type:"command",name:"log",args:t}}parseSend(){this.advance();const t=this.advance().value;let e;return this.match("to")&&(this.advance(),e=this.parseExpression()),{type:"command",name:"send",args:[{type:"literal",value:t}],target:e}}parseWait(){if(this.expect("wait"),this.match("for")){this.advance();const t=this.advance().value;let e;return this.match("from")&&(this.advance(),e=this.parseExpression()),{type:"command",name:"waitFor",args:[{type:"literal",value:t}],target:e}}return{type:"command",name:"wait",args:[this.parseExpression()]}}parseShow(){let t;this.expect("show");const e={};return this.isAtEnd()||this.match("then","and","end","else","when","where")||(t=this.parseExpression()),!this.isAtEnd()&&this.match("when","where")&&(e[this.advance().value]=this.parseExpression()),{type:"command",name:"show",args:[],target:t,modifiers:e}}parseHide(){let t;this.expect("hide");const e={};return this.isAtEnd()||this.match("then","and","end","else","when","where")||(t=this.parseExpression()),!this.isAtEnd()&&this.match("when","where")&&(e[this.advance().value]=this.parseExpression()),{type:"command",name:"hide",args:[],target:t,modifiers:e}}parseTake(){this.expect("take");const t=this.parseExpression();let e;return this.match("from")&&(this.advance(),e=this.parseExpression()),{type:"command",name:"take",args:[t],target:e}}parseIncDec(t){this.advance();const e=this.parseExpression();let s={type:"literal",value:1};return this.match("by")&&(this.advance(),s=this.parseExpression()),{type:"command",name:t,args:[e,s]}}parseFocusBlur(t){let e;return this.advance(),this.isAtEnd()||this.match("then","and","end","else")||(e=this.parseExpression()),{type:"command",name:t,args:[],target:e}}parseGo(){return this.expect("go"),this.match("to")&&this.advance(),this.match("url")&&this.advance(),{type:"command",name:"go",args:[this.parseExpression()]}}parseReturn(){let t;return this.expect("return"),this.isAtEnd()||this.match("then","and","end","else")||(t=this.parseExpression()),{type:"command",name:"return",args:t?[t]:[]}}parseHalt(){return this.expect("halt"),this.match("the")&&this.advance(),this.match("event","default")&&this.advance(),{type:"command",name:"halt",args:[]}}parseTransition(){let t;if(this.expect("transition"),this.match("my","its"))t={type:"identifier",value:"my"===this.advance().value?"me":"it"};else if(this.matchType("selector")){const e=this.parseExpression();if("possessive"===e.type)return this.parseTransitionRest(e.object,e.property);t=e}const e=this.peek();let s;return s="styleProperty"===e.type||"identifier"===e.type||"keyword"===e.type?this.advance().value:"opacity",this.parseTransitionRest(t,s)}parseTransitionRest(t,e){let s={type:"literal",value:1};this.match("to")&&(this.advance(),s=this.parseExpression());let n={type:"literal",value:300};return this.match("over")&&(this.advance(),n=this.parseExpression()),{type:"command",name:"transition",args:[{type:"literal",value:e},s,n],target:t}}parseExpression(){return this.parseOr()}parseOr(){let t=this.parseAnd();for(;this.match("or","||");)this.advance(),t={type:"binary",operator:"or",left:t,right:this.parseAnd()};return t}parseAnd(){let t=this.parseEquality();for(;this.match("and","&&")&&!this.isCommandKeyword(this.peek(1));)this.advance(),t={type:"binary",operator:"and",left:t,right:this.parseEquality()};return t}isCommandKeyword(t){return["toggle","add","remove","set","put","log","send","wait","show","hide","increment","decrement","focus","blur","go"].includes(r(t.value))}parseEquality(){let t=this.parseComparison();for(;this.match("==","!=","is","matches","contains","includes","has");){const e=this.advance().value;"is"===e.toLowerCase()&&this.match("not")?(this.advance(),t={type:"binary",operator:"is not",left:t,right:this.parseComparison()}):t={type:"binary",operator:e,left:t,right:this.parseComparison()}}return t}parseComparison(){let t=this.parseAdditive();for(;this.match("<",">","<=",">=");)t={type:"binary",operator:this.advance().value,left:t,right:this.parseAdditive()};return t}parseAdditive(){let t=this.parseMultiplicative();for(;this.match("+","-");)t={type:"binary",operator:this.advance().value,left:t,right:this.parseMultiplicative()};return t}parseMultiplicative(){let t=this.parseUnary();for(;this.match("*","/","%");)t={type:"binary",operator:this.advance().value,left:t,right:this.parseUnary()};return t}parseUnary(){if(this.match("not","!"))return this.advance(),{type:"unary",operator:"not",operand:this.parseUnary()};if(this.match("-")&&"number"===this.peek(1).type){this.advance();const t=this.advance();return{type:"literal",value:-parseFloat(t.value)}}return this.parsePostfix()}parsePostfix(){let t=this.parsePrimary();for(;;)if(this.match("'s"))this.advance(),this.peek(),t={type:"possessive",object:t,property:this.advance().value};else if("styleProperty"===this.peek().type)t={type:"possessive",object:t,property:this.advance().value};else if("."===this.peek().value)this.advance(),t={type:"member",object:t,property:this.advance().value};else if("selector"===this.peek().type&&this.peek().value.startsWith("."))t={type:"member",object:t,property:this.advance().value.slice(1)};else if("("===this.peek().value){this.advance();const e=[];for(;!this.match(")");)e.push(this.parseExpression()),this.match(",")&&this.advance();this.expect(")"),t={type:"call",callee:t,args:e}}else{if("["!==this.peek().value||"selector"===t.type)break;{this.advance();const e=this.parseExpression();this.expect("]"),t={type:"member",object:t,property:e,computed:1}}}return t}parsePrimary(){const t=this.peek();if("("===t.value){this.advance();const t=this.parseExpression();return this.expect(")"),t}if("{"===t.value)return this.parseObjectLiteral();if("["===t.value)return this.parseArrayLiteral();if("number"===t.type){this.advance();const e=t.value;return e.endsWith("ms")?{type:"literal",value:parseInt(e),unit:"ms"}:e.endsWith("s")?{type:"literal",value:1e3*parseFloat(e),unit:"ms"}:{type:"literal",value:parseFloat(e)}}if("string"===t.type)return this.advance(),{type:"literal",value:t.value.slice(1,-1)};if(this.match("true"))return this.advance(),{type:"literal",value:1};if(this.match("false"))return this.advance(),{type:"literal",value:0};if(this.match("null"))return this.advance(),{type:"literal",value:null};if(this.match("undefined"))return this.advance(),{type:"literal",value:void 0};if("localVar"===t.type)return this.advance(),{type:"variable",name:t.value,scope:"local"};if("globalVar"===t.type)return this.advance(),{type:"variable",name:t.value,scope:"global"};if("selector"===t.type)return this.advance(),{type:"selector",value:t.value};if(this.match("my")){this.advance();const t=this.peek();return"identifier"!==t.type&&"keyword"!==t.type||this.isCommandKeyword(t)?{type:"identifier",value:"me"}:{type:"possessive",object:{type:"identifier",value:"me"},property:this.advance().value}}if(this.match("its")){this.advance();const t=this.peek();return"identifier"!==t.type&&"keyword"!==t.type||this.isCommandKeyword(t)?{type:"identifier",value:"it"}:{type:"possessive",object:{type:"identifier",value:"it"},property:this.advance().value}}return this.match("me")?(this.advance(),{type:"identifier",value:"me"}):this.match("it")?(this.advance(),{type:"identifier",value:"it"}):this.match("you")?(this.advance(),{type:"identifier",value:"you"}):this.match("the","a","an")?(this.advance(),this.match("first","last","next","previous","closest","parent")?{type:"positional",position:this.advance().value,target:this.parsePositionalTarget()}:this.parsePrimary()):this.match("first","last","next","previous","closest","parent")?{type:"positional",position:this.advance().value,target:this.parsePositionalTarget()}:this.match("values")?(this.advance(),this.match("of")?(this.advance(),{type:"valuesOf",target:this.parseExpression()}):{type:"identifier",value:t.value}):(this.advance(),{type:"identifier",value:t.value})}parseObjectLiteral(){this.expect("{");const t=[];for(;!this.match("}");){const e=this.advance().value;this.expect(":");const s=this.parseExpression();t.push({key:e,value:s}),this.match(",")&&this.advance()}return this.expect("}"),{type:"object",properties:t}}parseArrayLiteral(){this.expect("[");const t=[];for(;!this.match("]");)t.push(this.parseExpression()),this.match(",")&&this.advance();return this.expect("]"),{type:"array",elements:t}}parsePositionalTarget(){const t=this.peek();return"selector"===t.type?{type:"selector",value:this.advance().value}:"identifier"===t.type||"keyword"===t.type?{type:"identifier",value:this.advance().value}:this.parseExpression()}}const c=new Map,h=1e3;async function l(t,e){switch(t.type){case"literal":return t.value;case"identifier":return"me"===t.value||"my"===t.value?e.me:"it"===t.value?e.it:"you"===t.value?e.you:"event"===t.value?e.event:"body"===t.value?document.body:"document"===t.value?document:"window"===t.value?window:e.locals.has(t.value)?e.locals.get(t.value):t.value in e.me?e.me[t.value]:t.value in window?window[t.value]:t.value;case"variable":if("local"===t.scope)return e.locals.get(t.name.slice(1));const s=t.name.slice(1);return c.has(s)?c.get(s):window[t.name];case"selector":const n=document.querySelectorAll(t.value);return 1===n.length?n[0]:Array.from(n);case"binary":return async function(t,e){if("has"===t.operator){const s=await l(t.left,e);return s instanceof Element&&"selector"===t.right.type&&t.right.value.startsWith(".")?s.classList.contains(t.right.value.slice(1)):0}const s=await l(t.left,e),n=await l(t.right,e);switch(t.operator){case"+":return s+n;case"-":return s-n;case"*":return s*n;case"/":return s/n;case"%":return s%n;case"==":case"is":return s==n;case"!=":case"is not":return s!=n;case"<":return n>s;case">":return s>n;case"<=":return n>=s;case">=":return s>=n;case"and":case"&&":return s&&n;case"or":case"||":return s||n;case"has":if(s instanceof Element){const t="string"==typeof n?n:n?.value;if("string"==typeof t&&t.startsWith("."))return s.classList.contains(t.slice(1))}return 0;case"contains":case"includes":return"string"==typeof s||Array.isArray(s)?s.includes(n):s instanceof Element?s.contains(n):0;case"matches":return s instanceof Element?s.matches(n):"string"==typeof s?RegExp(n).test(s):0;default:return}}(t,e);case"unary":const i=await l(t.operand,e);return"not"===t.operator?!i:i;case"possessive":case"member":const r=await l(t.object,e);if(null==r)return;const o=t.computed?await l(t.property,e):t.property;return"values"===o&&r instanceof Element?u(r):r[o];case"call":{let s,n=null;if("member"===t.callee.type||"possessive"===t.callee.type){n=await l(t.callee.object,e);const i=t.callee.computed?await l(t.callee.property,e):t.callee.property;s=n?.[i]}else s=await l(t.callee,e);const i=await Promise.all(t.args.map(t=>l(t,e)));return"function"==typeof s?s.apply(n,i):void 0}case"positional":return function(t,e){const s=t.target;let n=[],i=null;switch(("selector"===s.type||"identifier"===s.type||"htmlSelector"===s.type)&&(i=s.value),i&&(n=Array.from(document.querySelectorAll(i))),t.position){case"first":default:return n[0]||null;case"last":return n[n.length-1]||null;case"next":if(i){let t=e.me.nextElementSibling;for(;t;){if(t.matches(i))return t;t=t.nextElementSibling}return null}return e.me.nextElementSibling;case"previous":if(i){let t=e.me.previousElementSibling;for(;t;){if(t.matches(i))return t;t=t.previousElementSibling}return null}return e.me.previousElementSibling;case"closest":return i?e.me.closest(i):null;case"parent":if(i){let t=e.me.parentElement;for(;t;){if(t.matches(i))return t;t=t.parentElement}return null}return e.me.parentElement}}(t,e);case"object":const a={};for(const s of t.properties)a[s.key]=await l(s.value,e);return a;case"array":return Promise.all(t.elements.map(t=>l(t,e)));case"valuesOf":{const s=await l(t.target,e);return s instanceof Element?u(s):new FormData}default:return}}function u(t){if(t instanceof HTMLFormElement)return new FormData(t);const e=new FormData;return t.querySelectorAll("input, select, textarea").forEach(t=>{const s=t.getAttribute("name");s&&"value"in t&&e.append(s,t.value)}),e}async function f(t,e){const s=async()=>{if(!t.target)return[e.me];const s=await l(t.target,e);return Array.isArray(s)?s:s instanceof Element?[s]:"string"==typeof s?Array.from(document.querySelectorAll(s)):[e.me]},n=t=>{if(!t)return"";if("selector"===t.type)return t.value.startsWith("@")?t.value:t.value.slice(1);if("string"===t.type||"literal"===t.type){const e=t.value;return"string"==typeof e&&e.startsWith(".")?e.slice(1):e+""}return"identifier"===t.type?t.value:""},i=t=>Array.isArray(t)?t.filter(t=>t instanceof Element):t instanceof Element?[t]:"string"==typeof t?Array.from(document.querySelectorAll(t)):[],r=t=>t.startsWith("*"),o=t=>t.substring(1),a=(t,e,s)=>r(e)?(t.style.setProperty(o(e),s+""),1):0,h=(t,e)=>{if(r(e))return getComputedStyle(t).getPropertyValue(o(e))};switch(t.name){case"toggle":{const i=n(t.args[0])||await l(t.args[0],e)+"",r=await s();if(i.startsWith("@")){const t=i.slice(1);for(const e of r)e.hasAttribute(t)?e.removeAttribute(t):e.setAttribute(t,"")}else for(const t of r)t.classList.toggle(i);return e.it=1===r.length?r[0]:r,e.it}case"add":{const i=n(t.args[0])||await l(t.args[0],e)+"",r=await s();if(i.startsWith("@")){const t=i.slice(1);for(const e of r)e.setAttribute(t,"")}else for(const t of r)t.classList.add(i);return e.it=1===r.length?r[0]:r,e.it}case"removeClass":{const i=n(t.args[0])||await l(t.args[0],e)+"",r=await s();if(i.startsWith("@")){const t=i.slice(1);for(const e of r)e.removeAttribute(t)}else for(const t of r)t.classList.remove(i);return e.it=1===r.length?r[0]:r,e.it}case"remove":{const t=await s();for(const e of t)e.remove();return null}case"put":{const n=await l(t.args[0],e),o=t.modifier||"into";if("possessive"===t.target?.type&&r(t.target.property)){const s=i(await l(t.target.object,e));for(const e of s)a(e,t.target.property,n);return e.it=n,n}const c=await s();for(const t of c){const e=n+"";"into"===o?t.innerHTML=e:"before"===o?t.insertAdjacentHTML("beforebegin",e):"after"===o?t.insertAdjacentHTML("afterend",e):"at start of"===o?t.insertAdjacentHTML("afterbegin",e):"at end of"===o&&t.insertAdjacentHTML("beforeend",e)}return e.it=n,n}case"append":{const n=await l(t.args[0],e),i=await s();for(const t of i)t.insertAdjacentHTML("beforeend",n+"");return e.it=n,n}case"set":{const s=t.args[0],n=await l(t.args[1],e);if("variable"===s.type){const t=s.name.slice(1);return("local"===s.scope?e.locals:c).set(t,n),e.it=n,n}if("possessive"===s.type||"member"===s.type){const t=await l(s.object,e);if(t)return t instanceof Element&&a(t,s.property,n)?(e.it=n,n):(t[s.property]=n,e.it=n,n)}return e.it=n,n}case"get":{const s=await l(t.args[0],e);return e.it=s,s}case"call":{const s=await l(t.args[0],e);return e.it=s,s}case"log":{const s=await Promise.all(t.args.map(t=>l(t,e)));return console.log(...s),s[0]}case"send":{const n=await l(t.args[0],e),i=await s(),r=new CustomEvent(n+"",{bubbles:1,detail:e.it});for(const t of i)t.dispatchEvent(r);return e.it=r,r}case"wait":{const s=await l(t.args[0],e),n="number"==typeof s?s:parseInt(s+"");return await new Promise(t=>setTimeout(t,n)),n}case"waitFor":{const n=await l(t.args[0],e),i=(await s())[0]||e.me;return new Promise(t=>{i.addEventListener(n+"",s=>{e.it=s,t(s)},{once:1})})}case"show":{const t=await s();for(const e of t)e.style.display="",e.classList.remove("hidden");return t}case"hide":{const t=await s();for(const e of t)e.style.display="none";return t}case"transition":{const n=(await l(t.args[0],e)+"").replace(/^\*/,""),i=await l(t.args[1],e),r=await l(t.args[2],e),o="number"==typeof r?r:(r+"").endsWith("ms")?parseInt(r+""):(r+"").endsWith("s")?1e3*parseFloat(r+""):parseInt(r+"")||300,a=await s(),c=[];for(const t of a){const e=t,s=n.replace(/([A-Z])/g,"-$1").toLowerCase(),r=e.style.transition;e.style.transition=`${s} ${o}ms ease`,e.style.setProperty(s,i+""),c.push(new Promise(t=>{const n=()=>{e.style.transition=r,t()},i=t=>{t.propertyName===s&&(e.removeEventListener("transitionend",i),n())};e.addEventListener("transitionend",i),setTimeout(n,o+50)}))}return await Promise.all(c),e.it=1===a.length?a[0]:a,e.it}case"take":{const i=n(await l(t.args[0],e)),r=t.target?await s():[e.me.parentElement];for(const t of r)t.querySelectorAll("."+i).forEach(t=>t.classList.remove(i));return e.me.classList.add(i),e.me}case"increment":case"decrement":{const s=t.args[0],n=await l(t.args[1],e),o="increment"===t.name?n:-n;if("variable"===s.type){const t=s.name.slice(1),n="local"===s.scope?e.locals:c,i=(n.get(t)||0)+o;return n.set(t,i),e.it=i,i}if("possessive"===s.type&&r(s.property)){const t=i(await l(s.object,e));for(const n of t){const t=(parseFloat(h(n,s.property)||"0")||0)+o;a(n,s.property,t),e.it=t}return e.it}const u=i(await l(s,e));for(const t of u){const s=(parseFloat(t.textContent||"0")||0)+o;t.textContent=s+"",e.it=s}return e.it}case"focus":{const t=await s();for(const e of t)e.focus();return t}case"blur":{const t=await s();for(const e of t)e.blur();return t}case"go":{const s=await l(t.args[0],e),n=(s+"").toLowerCase();return"back"===n?history.back():"forward"===n?history.forward():window.location.href=s+"",null}case"return":throw{type:"return",value:t.args[0]?await l(t.args[0],e):e.it};case"halt":return e.event&&(e.event.preventDefault(),e.event.stopPropagation()),null;default:return console.warn("Unknown command: "+t.name),null}}async function p(t,e){try{return await m(t,e)}catch(t){if("return"===t?.type)throw t;throw t}}async function d(t,e){switch(t.type){case"if":return await l(t.condition,e)?p(t.body,e):t.elseBody?p(t.elseBody,e):null;case"repeat":{const s=await l(t.condition,e),n="number"==typeof s?s:parseInt(s+"");for(let s=0;n>s&&h>s;s++)e.locals.set("__loop_index__",s),e.locals.set("__loop_count__",s+1),await p(t.body,e);return null}case"for":{const{variable:s,iterable:n}=t.condition,i=await l(n,e),r=Array.isArray(i)?i:i instanceof NodeList?Array.from(i):[i],o=s.startsWith(":")?s.slice(1):s;for(let s=0;r.length>s&&h>s;s++)e.locals.set(o,r[s]),e.locals.set("__loop_index__",s),e.locals.set("__loop_count__",s+1),await p(t.body,e);return null}case"while":{let s=0;for(;await l(t.condition,e)&&h>s;)e.locals.set("__loop_index__",s),await p(t.body,e),s++;return null}case"fetch":{const{url:s,responseType:n,options:i,method:r}=t.condition;try{const o=await l(s,e),a={};if(r){const t=await l(r,e);a.method=(t+"").toUpperCase()}if(i){const t=await l(i,e);t instanceof FormData?a.body=t:!t||"object"!=typeof t||t instanceof Element||Object.assign(a,t)}const c=await fetch(o+"",a);if(!c.ok)throw Error("HTTP "+c.status);const h=await l(n,e);let u;if("json"===h)u=await c.json();else if("html"===h){const t=await c.text();u=(new DOMParser).parseFromString(t,"text/html").body.innerHTML}else u=await c.text();e.it=u,e.locals.set("it",u),e.locals.set("result",u),e.locals.set("response",c),await p(t.body,e)}catch(t){if("return"===t?.type)throw t;e.locals.set("error",t),console.error("Fetch error:",t)}return null}default:return null}}async function m(t,e){let s;for(const n of t)"command"===n.type?s=await f(n,e):["if","repeat","for","while","fetch"].includes(n.type)&&(s=await d(n,e));return s}async function y(t,e,s){const n={me:e,event:s,locals:new Map,globals:c};if("sequence"===t.type)return m(t.commands,n);if("event"===t.type){const s=t,i=s.event;if(i.startsWith("interval:")){const t=i.split(":")[1],n=t.endsWith("ms")?parseInt(t):t.endsWith("s")?1e3*parseFloat(t):parseInt(t);return void setInterval(async()=>{const t={me:e,locals:new Map,globals:c};try{await m(s.body,t)}catch(t){if("return"!==t?.type)throw t}},n)}if("init"===i){try{await m(s.body,n)}catch(t){if("return"!==t?.type)throw t}return}const r=s.filter?await l(s.filter,n):e,o=r instanceof Element?r:e,a=s.modifiers;let h=async t=>{a.prevent&&t.preventDefault(),a.stop&&t.stopPropagation();const n={me:e,event:t,you:t.target instanceof Element?t.target:void 0,locals:new Map,globals:c};try{await m(s.body,n)}catch(t){if("return"===t?.type)return t.value;throw t}};if(a.debounce){let t;const e=h;h=async s=>{clearTimeout(t),t=setTimeout(()=>e(s),a.debounce)}}if(a.throttle){let t=0;const e=h;h=async s=>{const n=Date.now();a.throttle>n-t||(t=n,await e(s))}}return void o.addEventListener(i,h,{once:!!a.once})}return null}function w(t){const e=t.getAttribute("_");if(e)try{y(new a(e).parse(),t)}catch(t){console.error("HyperFixi Hybrid Complete error:",t,"Code:",e)}}function g(t=document){t.querySelectorAll("[_]").forEach(w)}const b={version:"1.0.0-hybrid-complete",parse:t=>new a(t).parse(),async execute(t,e){const s=e||document.body;return y(new a(t).parse(),s)},init:g,process:g,addAliases:function(t){Object.assign(n,t)},addEventAliases:function(t){Object.assign(i,t)},tokenize:s,evaluate:l,commands:["toggle","add","remove","put","append","set","get","call","log","send","trigger","wait","show","hide","transition","take","increment","decrement","focus","blur","go","return","halt"],blocks:["if","else","unless","repeat","for","while","fetch"]};"undefined"!=typeof window&&(window.hyperfixi=b,"loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>g()):g());let v={nameOf:(t,e,s)=>`${e}-${s}`,selectorFor:(t,e)=>`[${t}-${e}]`,eventNameOf:(t,e)=>e};function x(){return v}const E={innerHTML:"innerHTML",outerHTML:"outerHTML",beforebegin:"before",afterbegin:"start",beforeend:"end",afterend:"after",delete:"delete",none:"none",morph:"morph","morph:innerHTML":"innerHTML morph","morph:outerHTML":"morph"},$={click:"click",load:"init",revealed:"intersection",intersect:"intersection",submit:"submit",change:"change",input:"input",keyup:"keyup",keydown:"keydown",focus:"focus",blur:"blur",mouseenter:"mouseenter",mouseleave:"mouseleave"};function M(t){if("this"===t)return"me";const e=t.match(/^closest\s+(.+)$/);if(e)return`closest <${e[1]}/>`;const s=t.match(/^find\s+(.+)$/);if(s)return`first <${s[1]}/> in me`;const n=t.match(/^next\s+(.+)$/);if(n)return`next <${n[1]}/>`;const i=t.match(/^previous\s+(.+)$/);return i?`previous <${i[1]}/>`:t}function S(t,e){const s=[];if(t.hxLive&&s.push(`live\n ${t.hxLive}\nend`),!t.url)return s.join("\n");const n=[],i=t.trigger||function(t){const e=t.tagName.toLowerCase();if("form"===e)return"submit";if("input"===e||"textarea"===e||"select"===e){const e=t.getAttribute("type");return"submit"===e||"button"===e?"click":"change"}return"click"}(e),{event:r,modifiers:o}=function(t,e){const s=t.trim().split(/\s+/),n=s[0],i=s.slice(1),r=n.match(/^(\w+)\[(.+)\]$/);if(r){const t=e(r[1]);return{event:$[t]||t,modifiers:["filter: "+r[2],...i]}}const o=e(n);return{event:$[o]||o,modifiers:i}}(i,t=>x().eventNameOf(e,t)),a=function(t){const e=[];for(const s of t){const t=s.match(/^delay:(\d+)(ms|s)?$/);if(t){e.push(`.debounce(${t[1]}${"s"===(t[2]||"ms")?"000":""})`);continue}const n=s.match(/^throttle:(\d+)(ms|s)?$/);n?e.push(`.throttle(${n[1]}${"s"===(n[2]||"ms")?"000":""})`):"once"!==s||e.push(".once")}return e.join("")}(o);t.confirm&&n.push(`if not js window.confirm('${t.confirm.replace(/'/g,"\\'")}') return end`);const c=e.tagName.toLowerCase();"form"!==c&&"a"!==c||n.push("halt the event");let h=`fetch '${t.url}'`;t.method&&"GET"!==t.method&&(h+=" via "+t.method),"form"===c?h+=" with values of me":t.vals&&(h+=" with "+t.vals),h+=" as html",n.push(h);const l=function(t,e){const s=E[e]||e;return"none"===s?"":"delete"===s?"remove "+t:"before"===s?"put it before "+t:"after"===s?"put it after "+t:"start"===s?"put it at start of "+t:"end"===s?"put it at end of "+t:"morph"===s?`morph ${t} with it`:"innerHTML morph"===s?`morph innerHTML of ${t} with it`:"outerHTML"===s?`set ${t}'s outerHTML to it`:"put it into "+t}(t.target?M(t.target):"me",t.swap||"innerHTML");l&&n.push("then "+l),t.pushUrl?n.push(`then push url '${1==t.pushUrl?t.url:t.pushUrl}'`):t.replaceUrl&&n.push(`then replace url '${1==t.replaceUrl?t.url:t.replaceUrl}'`);const u=`on ${r}${a}\n ${n.join("\n ")}`;return s.push(u),s.join("\n")}function k(t){const e=t.attributes;for(let t=0;e.length>t;t++)if(e[t].name.startsWith("hx-"))return 1;return 0}function T(t){return t.hasAttribute("fx-action")}function H(t){return k(t)||T(t)}const A=new Set(["add","append","async","beep","blur","break","breakpoint","call","clear","close","continue","copy","decrement","default","empty","exit","fetch","focus","for","get","go","halt","hide","open","if","increment","install","js","log","make","measure","morph","pick","process","push","put","remove","render","repeat","replace","reset","return","scroll","select","send","set","settle","show","start","swap","take","tell","throw","toggle","transition","trigger","unless","wait"]),_=new Set(["==","!=","===","!==","<",">","<=",">=","is","is not","am","is a","is an","is not a","is not an","precedes","does not precede","follows","does not follow","contains","starts with","ends with","does not start with","does not end with","has","have","does not contain","include","includes","does not include","match","matches","exists","does not exist","is empty","is not empty","is in","is not in","is between","is not between","equals","in","is equal to","is really equal to","is not equal to","is not really equal to","is greater than","is less than","is greater than or equal to","is less than or equal to","really equals","ignoring case","sorted by","mapped to","split by","joined by"]);function C(t,e){return{infix:{bp:[t,t+1],handler:e??((e,s,n)=>{const i=n.parseExpr(t+1);return{type:"binaryExpression",operator:s.value,left:e,right:i,start:e.start,end:i.end??s.end,line:e.line??s.line,column:e.column??s.column}})}}}function L(t,e){return{infix:{bp:[t+1,t],handler:(e,s,n)=>{const i=n.parseExpr(t);return{type:"binaryExpression",operator:s.value,left:e,right:i,start:e.start,end:i.end??s.end,line:e.line??s.line,column:e.column??s.column}}}}}function O(t,e){return{prefix:{bp:t,handler:e??((e,s)=>{const n=s.parseExpr(t);return{type:"unaryExpression",operator:e.value,operand:n,argument:n,prefix:1,start:e.start,end:n.end??e.end,line:e.line,column:e.column}})}}}function F(t){return(e,s,n)=>{const i=n.advance();if(!i||!i.value)throw Error(`Type check requires a type name after 'is ${t?"not ":""}a/an', got: <end>`);let r=1;const o=n.peek();return o&&"!"===o.value&&(n.advance(),r=0),{type:"typeCheckExpression",value:e,typeName:i.value,nullOk:r,negated:t,start:e.start,end:i.end}}}const P=function(...t){const e=new Map;for(const s of t)for(const[t,n]of s){const s=e.get(t);e.set(t,s?{prefix:n.prefix??s.prefix,infix:n.infix??s.infix}:{...n})}return e}(new Map([["or",C(10)],["||",C(10)],["and",C(20)],["&&",C(20)],["==",C(30)],["!=",C(30)],["<",C(30)],[">",C(30)],["<=",C(30)],[">=",C(30)],["is",C(30)],["matches",C(30)],["contains",C(30)],["starts with",C(30)],["ends with",C(30)],["does not start with",C(30)],["does not end with",C(30)],["is between",C(30,(t,e,s)=>{const n=s.parseExpr(31),i=s.peek();if(!i||"and"!==i.value.toLowerCase())throw Error("between requires 'and' between min and max operands, got: "+(i?.value??"<end>"));s.advance();const r=s.parseExpr(31);return{type:"betweenExpression",value:t,min:n,max:r,negated:0,start:t.start,end:r.end}})],["is not between",C(30,(t,e,s)=>{const n=s.parseExpr(31),i=s.peek();if(!i||"and"!==i.value.toLowerCase())throw Error("between requires 'and' between min and max operands, got: "+(i?.value??"<end>"));s.advance();const r=s.parseExpr(31);return{type:"betweenExpression",value:t,min:n,max:r,negated:1,start:t.start,end:r.end}})],["ignoring case",{infix:{bp:[25,26],handler:(t,e,s)=>(t.ignoringCase=1,t)}}],["where",C(28,(t,e,s)=>{const n=s.parseExpr(29);return{type:"collectionExpression",operator:"where",collection:t,right:n,start:t.start,end:n.end}})],["sorted by",C(28,(t,e,s)=>{const n=s.parseExpr(29);let i="asc";const r=s.peek();if(r&&"string"==typeof r.value){const t=r.value.toLowerCase();"asc"===t||"ascending"===t?(s.advance(),i="asc"):"desc"!==t&&"descending"!==t||(s.advance(),i="desc")}return{type:"collectionExpression",operator:"sorted by",collection:t,right:n,order:i,start:t.start,end:n.end}})],["mapped to",C(28,(t,e,s)=>{const n=s.parseExpr(29);return{type:"collectionExpression",operator:"mapped to",collection:t,right:n,start:t.start,end:n.end}})],["split by",C(28,(t,e,s)=>{const n=s.parseExpr(29);return{type:"collectionExpression",operator:"split by",collection:t,right:n,start:t.start,end:n.end}})],["joined by",C(28,(t,e,s)=>{const n=s.parseExpr(29);return{type:"collectionExpression",operator:"joined by",collection:t,right:n,start:t.start,end:n.end}})],["+",{...C(40),...O(80)}],["-",{...C(40),...O(80)}],["*",C(50)],["/",C(50)],["%",C(50)],["mod",C(50)],["^",L(60)],["**",L(60)],["as",C(70,(t,e,s)=>{const n=s.parseExpr(71),i=s.peek();if(i&&":"===i.value&&n&&"identifier"===n.type){s.advance();const t=s.advance();t&&void 0!==t.value&&(n.name=`${n.name}:${t.value}`,n.end=t.end)}return{type:"asExpression",expression:t,targetType:n,start:t.start,end:n.end??e.end,line:t.line??e.line,column:t.column??e.column}})],["not",O(80)],["!",O(80)],["no",O(80)]]),new Map([["===",C(30)],["!==",C(30)],["is not",C(30)],["am",C(30)],["is in",C(30)],["is not in",C(30)],["precedes",C(30)],["does not precede",C(30)],["follows",C(30)],["does not follow",C(30)],["is a",C(30,F(0))],["is an",C(30,F(0))],["is not a",C(30,F(1))],["is not an",C(30,F(1))],["has",C(30)],["have",C(30)],["match",C(30)],["include",C(30)],["includes",C(30)],["equals",C(30)],["does not contain",C(30)],["does not include",C(30)],["is equal to",C(30)],["is not equal to",C(30)],["is really equal to",C(30)],["is not really equal to",C(30)],["really equals",C(30)],["is greater than",C(30)],["is less than",C(30)],["is greater than or equal to",C(30)],["is less than or equal to",C(30)],["in",C(30)],["of",C(30)],["really",C(30)],["exists",{prefix:{bp:80,handler:(t,e)=>({type:"unaryExpression",operator:t.value,operand:e.parseExpr(80),start:t.start})},infix:{bp:[30,31],handler:(t,e)=>({type:"unaryExpression",operator:e.value,operand:t,prefix:0,start:t.start})}}],["does not exist",{infix:{bp:[30,31],handler:(t,e)=>({type:"unaryExpression",operator:e.value,operand:t,prefix:0,start:t.start})}}],["is empty",{infix:{bp:[30,31],handler:(t,e)=>({type:"unaryExpression",operator:e.value,operand:t,prefix:0,start:t.start})}}],["is not empty",{infix:{bp:[30,31],handler:(t,e)=>({type:"unaryExpression",operator:e.value,operand:t,prefix:0,start:t.start})}}],["some",O(80)]]),new Map([["=",L(5)]])),q=new Map,j=new Map,W=new Map,R=new Set,D=new Set,I=new Set,G=new Set,N=new class{registerCommand(t){A.add(t.toLowerCase())}registerCompoundOperator(t){_.add(t.toLowerCase())}registerInfixOperator(t,e,s,n){const i=t.toLowerCase(),r=P.get(i);P.set(i,{...r??{},infix:{bp:[e,s],handler:n}})}registerPrefixOperator(t,e,s){const n=t.toLowerCase(),i=P.get(n);P.set(n,{...i??{},prefix:{bp:e,handler:s}})}hasCommand(t){return A.has(t.toLowerCase())}registerFeature(t,e){q.set(t.toLowerCase(),e)}hasFeature(t){return q.has(t.toLowerCase())}registerNodeEvaluator(t,e){j.set(t,e)}registerNodeWriter(t,e){W.set(t,e)}registerGlobalWriteHook(t){return R.add(t),()=>R.delete(t)}registerGlobalReadHook(t){return D.add(t),()=>D.delete(t)}registerLocalWriteHook(t){return I.add(t),()=>I.delete(t)}registerLocalReadHook(t){return G.add(t),()=>G.delete(t)}snapshot(){return{commands:Array.from(A),operators:Array.from(_),prattEntries:Array.from(P.entries()).map(([t,e])=>[t,{...e}]),features:Array.from(q.entries()),nodeEvaluators:Array.from(j.entries()),nodeWriters:Array.from(W.entries()),globalWriteHooks:Array.from(R),globalReadHooks:Array.from(D),localWriteHooks:Array.from(I),localReadHooks:Array.from(G)}}restore(t){A.clear();for(const e of t.commands)A.add(e);_.clear();for(const e of t.operators)_.add(e);P.clear();for(const[e,s]of t.prattEntries)P.set(e,s);q.clear();for(const[e,s]of t.features)q.set(e,s);j.clear();for(const[e,s]of t.nodeEvaluators)j.set(e,s);W.clear();for(const[e,s]of t.nodeWriters??[])W.set(e,s);R.clear();for(const e of t.globalWriteHooks)R.add(e);D.clear();for(const e of t.globalReadHooks??[])D.add(e);I.clear();for(const e of t.localWriteHooks??[])I.add(e);G.clear();for(const e of t.localReadHooks??[])G.add(e)}},z="__hyperfixi_parser_extension_registry__";class Z{constructor(t,e,s,n={}){this.element=t,this.url=e,this.swapHandler=s,this.source=null,this.listeners=new Map,this.destroyed=0,this.reconnectAttempts=0,this.reconnectTimer=null,this.maxAttempts=n.maxAttempts??5,this.baseBackoffMs=n.baseBackoffMs??1e3,this.maxBackoffMs=n.maxBackoffMs??3e4,this.debug=n.debug??0,this.EventSourceCtor=n.EventSourceCtor??("undefined"!=typeof EventSource?EventSource:null),this.EventSourceCtor?this.open():this.debug&&void 0!==console&&console.warn("[sse] EventSource is not available in this environment")}listenFor(t){if(this.destroyed)return;if(this.listeners.has(t))return;const e=t=>{this.swapHandler(t.type,t.data)};this.listeners.set(t,e),this.source&&this.source.addEventListener(t,e)}detach(){this.destroyed||(this.destroyed=1,null!==this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.closeSource(),this.dispatch("htmx:sseClose",{url:this.url}))}get readyState(){return this.source?.readyState??-1}open(){if(!this.destroyed){try{this.source=new this.EventSourceCtor(this.url)}catch(t){return this.dispatch("htmx:sseError",{url:this.url,error:t}),void this.scheduleReconnect()}this.source.onopen=()=>{this.reconnectAttempts=0,this.dispatch("htmx:sseOpen",{url:this.url})},this.source.onmessage=t=>{this.dispatch("htmx:sseMessage",{url:this.url,data:t.data})},this.source.onerror=t=>{this.dispatch("htmx:sseError",{url:this.url,event:t}),this.source&&2===this.source.readyState&&(this.closeSource(),this.scheduleReconnect())};for(const[t,e]of this.listeners)this.source.addEventListener(t,e)}}closeSource(){if(this.source){for(const[t,e]of this.listeners)try{this.source.removeEventListener(t,e)}catch{}this.source.onopen=null,this.source.onmessage=null,this.source.onerror=null;try{this.source.close()}catch{}this.source=null}}scheduleReconnect(){if(this.destroyed)return;if(this.reconnectAttempts>=this.maxAttempts)return this.debug&&void 0!==console&&console.warn(`[sse] giving up after ${this.maxAttempts} reconnect attempts to ${this.url}`),void this.detach();const t=Math.min(this.baseBackoffMs*Math.pow(2,this.reconnectAttempts),this.maxBackoffMs);this.reconnectAttempts++,this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.open()},t)}dispatch(t,e){if("undefined"!=typeof CustomEvent)try{const s=new CustomEvent(t,{detail:e,bubbles:1,cancelable:0});this.element.dispatchEvent(s)}catch{}}}class B{constructor(t,e,s,n={}){this.element=t,this.url=e,this.swapHandler=s,this.socket=null,this.destroyed=0,this.reconnectAttempts=0,this.reconnectTimer=null,this.outboundQueue=[],this.maxAttempts=n.maxAttempts??5,this.baseBackoffMs=n.baseBackoffMs??1e3,this.maxBackoffMs=n.maxBackoffMs??3e4,this.debug=n.debug??0,this.protocols=n.protocols,this.WSCtor=n.WSEventSourceCtor??("undefined"!=typeof WebSocket?WebSocket:null),this.WSCtor?this.open():this.debug&&void 0!==console&&console.warn("[ws] WebSocket is not available in this environment")}get readyState(){return this.socket?.readyState??-1}get isDestroyed(){return this.destroyed}send(t){if(this.destroyed)return;const e="string"==typeof t?t:JSON.stringify(t);this.socket&&1===this.socket.readyState?this.socket.send(e):this.outboundQueue.push(e)}detach(){this.destroyed||(this.destroyed=1,null!==this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.closeSocket(),this.dispatch("htmx:wsClose",{url:this.url,code:1e3,reason:"detached"}))}open(){if(!this.destroyed){try{this.socket=new this.WSCtor(this.url,this.protocols)}catch(t){return this.dispatch("htmx:wsError",{url:this.url,error:t}),void this.scheduleReconnect()}this.socket.onopen=()=>{if(this.reconnectAttempts=0,this.dispatch("htmx:wsOpen",{url:this.url}),this.outboundQueue.length&&this.socket){for(const t of this.outboundQueue)try{this.socket.send(t)}catch(t){this.dispatch("htmx:wsError",{url:this.url,error:t})}this.outboundQueue=[]}},this.socket.onmessage=t=>{const e="string"==typeof t.data?t.data:t.data+"",s=function(t){if(!t||"{"!==t[0])return null;let e;try{e=JSON.parse(t)}catch{return null}return"object"!=typeof e||null===e||"string"!=typeof e.target||"string"!=typeof e.data?null:{target:e.target,swap:"string"==typeof e.swap?e.swap:void 0,data:e.data}}(e);s?this.swapHandler(s,s.data):this.dispatch("htmx:wsMessage",{url:this.url,data:e})},this.socket.onerror=t=>{this.dispatch("htmx:wsError",{url:this.url,event:t})},this.socket.onclose=t=>{this.dispatch("htmx:wsClose",{url:this.url,code:t.code,reason:t.reason}),this.socket=null,this.destroyed||t.wasClean||this.scheduleReconnect()}}}closeSocket(){if(this.socket){this.socket.onopen=null,this.socket.onmessage=null,this.socket.onerror=null,this.socket.onclose=null;try{this.socket.close(1e3,"detached")}catch{}this.socket=null}}scheduleReconnect(){if(this.destroyed)return;if(this.reconnectAttempts>=this.maxAttempts)return this.debug&&void 0!==console&&console.warn(`[ws] giving up after ${this.maxAttempts} reconnect attempts to ${this.url}`),void this.detach();const t=Math.min(this.baseBackoffMs*Math.pow(2,this.reconnectAttempts),this.maxBackoffMs);this.reconnectAttempts++,this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.open()},t)}dispatch(t,e){if("undefined"!=typeof CustomEvent)try{const s=new CustomEvent(t,{detail:e,bubbles:1,cancelable:0});this.element.dispatchEvent(s)}catch{}}}function J(t){if("undefined"!=typeof HTMLFormElement&&t instanceof HTMLFormElement){const e=new FormData(t),s={};for(const[t,n]of e.entries())s[t]="string"==typeof n?n:n.name;return s}const e=t.getAttribute("name"),s=t.value;return e&&void 0!==s?{[e]:s+""}:{}}function V(t){return t?t.split(/[-_]/)[0].toLowerCase():"en"}function U(t){const e=t.getAttribute?.("data-hyperfixi-lang");if(e)return V(e);const s=t.closest?.("[data-hyperfixi-lang]");if(s)return V(s.getAttribute("data-hyperfixi-lang"));const n=t.closest?.("[lang]");return n?V(n.getAttribute("lang")):"en"}const K=new Map,Q=new Map,X=new Set;let Y=0;const tt=new Set;function et(){const t=new Set;for(const e of Q.values())for(const s of e.values())t.add(s);return[...t]}function st(t,e){const s=V(t),n=e?.hyperfixi??{};var i;K.set(s,n),Q.set(s,function(t){const e=new Map;if(!t)return e;for(const[s,n]of Object.entries(t))e.set(n,s);return e}(n.attrs)),X.delete(s),Y||(i={nameOf:(t,e,s)=>{const n=`${e}-${s}`,i=U(t);if("en"===i)return n;const r=Q.get(i)?.get(n);return r||(K.has(i)||X.has(i)||(X.add(i),void 0!==console&&console.warn(`[hyperfixi-i18n] No vocab registered for lang="${i}". Elements in this language scope fall back to English attribute names. Load packages/core/dist/i18n/htmx/${i}.js to opt in.`)),n)},selectorFor:(t,e)=>{const s=`${t}-${e}`,n=new Set([s]);for(const t of Q.values()){const e=t.get(s);e&&n.add(e)}return[...n].map(t=>`[${t}]`).join(", ")},eventNameOf:(t,e)=>{const s=U(t);return"en"===s?e:K.get(s)?.events?.[e]??e}},v=i,Y=1);for(const t of tt)t()}function nt(t){for(const e of function(){const t=new Set(["hx-on:"]);for(const e of Q.values()){const s=e.get("hx-on");s&&t.add(s+":")}return[...t]}())if(t.startsWith(e))return t.slice(e.length);return null}!function(){if("undefined"==typeof window)return;const t=window;t.t||(t.t={register:st})}();const it=["get","post","put","patch","delete","target","swap","trigger","confirm","boost","vals","headers","push-url","replace-url","on","live"].filter(t=>"on"!==t).map(t=>"hx-"+t).concat(["sse-swap","ws-send"]),rt=["live"],ot=["fx-action","fx-method","fx-trigger","fx-target","fx-swap","fx-ignore"],at=[...it,...ot];function ct(t,e,s){return t.getAttribute(x().nameOf(t,e,s))}function ht(t,e,s){return t.hasAttribute(x().nameOf(t,e,s))}class lt{getSwapTemplate(t,e){const s=`${e.target??"me"}|${e.swap??"innerHTML"}`,n=this.swapTemplateCache.get(t);if(n&&n.sig===s)return n.build;const i=function(t){const e=t.swap??"innerHTML",s=M(t.target??"me");switch(e){case"outerHTML":return t=>`set ${s}'s outerHTML to ${t}`;case"beforebegin":return t=>`put ${t} before ${s}`;case"afterend":return t=>`put ${t} after ${s}`;case"afterbegin":return t=>`put ${t} at start of ${s}`;case"beforeend":return t=>`put ${t} at end of ${s}`;case"none":return()=>"";case"delete":return()=>"remove "+s;default:return t=>`put ${t} into ${s}`}}(e);return this.swapTemplateCache.set(t,{sig:s,build:i}),i}dispatchLifecycleEvent(t,e,s,n={}){const i=new CustomEvent(e,{detail:s,bubbles:n.bubbles??1,cancelable:n.cancelable??1}),r=t.dispatchEvent(i);return!r&&this.options.debug&&console.log(`[${n.debugPrefix??"htmx"}-compat] ${e} cancelled`),r}constructor(t={}){this.observer=null,this.processedElements=new WeakSet,this.executeCallback=null,this.pendingRequests=new WeakMap,this.sseConnections=new WeakMap,this.sseConnectionsSet=new Set,this.wsConnections=new WeakMap,this.wsConnectionsSet=new Set,this.wsSendListeners=new WeakMap,this.onHandlerListeners=new WeakMap,this.onHandlerElements=new Set,this.localizedAttrSet=new Set,this.unsubscribeVocab=null,this.swapTemplateCache=new WeakMap,this.options={processExisting:t.processExisting??1,watchMutations:t.watchMutations??1,debug:t.debug??0,root:t.root??("undefined"!=typeof document?document.body:null),requestDropping:t.requestDropping??1,fixiEvents:t.fixiEvents??1,eventSourceCtor:t.eventSourceCtor,wsEventSourceCtor:t.wsEventSourceCtor},this.eventSourceCtor=t.eventSourceCtor,this.wsEventSourceCtor=t.wsEventSourceCtor}init(t){this.executeCallback=t,this.options.processExisting&&this.options.root&&this.processSubtree(this.options.root),this.options.watchMutations&&"undefined"!=typeof MutationObserver&&this.options.root&&this.startObserver()}destroy(){this.unsubscribeVocab&&(this.unsubscribeVocab(),this.unsubscribeVocab=null),this.observer&&(this.observer.disconnect(),this.observer=null);for(const t of this.sseConnectionsSet)t.detach();this.sseConnectionsSet.clear();for(const t of this.wsConnectionsSet)t.detach();this.wsConnectionsSet.clear();for(const t of[...this.onHandlerElements])this.detachOnHandlers(t);this.executeCallback=null}attachSSE(t){const e=this.sseConnections.get(t);if(e)return e;const s=ct(t,"sse","connect");if(!s)return null;const n=new Z(t,s,(e,n)=>{const i={url:void 0,method:"GET",target:ct(t,"hx","target")??void 0,swap:ct(t,"hx","swap")??"innerHTML"},r=this.getSwapTemplate(t,i)(JSON.stringify(n));r&&(this.dispatchLifecycleEvent(t,"htmx:sseMessage",{url:s,event:e,data:n},{cancelable:0}),this.executeCallback&&this.executeCallback(r,t).catch(t=>{void 0!==console&&console.error("[sse-compat] swap execution failed:",t)}))},{EventSourceCtor:this.eventSourceCtor,debug:this.options.debug});this.sseConnections.set(t,n),this.sseConnectionsSet.add(n);const i=ct(t,"sse","swap");if(i)for(const t of i.split(",").map(t=>t.trim()).filter(Boolean))n.listenFor(t);return n}getSSEConnection(t){return this.sseConnections.get(t)??null}detachSSE(t){const e=this.sseConnections.get(t);e&&(e.detach(),this.sseConnections.delete(t),this.sseConnectionsSet.delete(e))}detachSSESubtree(t){if(this.detachSSE(t),"function"!=typeof t.querySelectorAll)return;const e=t.querySelectorAll(x().selectorFor("sse","connect"));for(const t of e)this.detachSSE(t)}attachWS(t){const e=this.wsConnections.get(t);if(e)return e;const s=ct(t,"ws","connect");if(!s)return null;const n=new B(t,s,(e,n)=>{const i={url:void 0,method:"GET",target:e.target,swap:e.swap??ct(t,"hx","swap")??"innerHTML"},r=this.getSwapTemplate(t,i)(JSON.stringify(e.data));r&&(this.dispatchLifecycleEvent(t,"htmx:wsMessage",{url:s,envelope:e,data:e.data},{cancelable:0}),this.executeCallback&&this.executeCallback(r,t).catch(t=>{void 0!==console&&console.error("[ws-compat] swap execution failed:",t)}))},{WSEventSourceCtor:this.wsEventSourceCtor,debug:this.options.debug});return this.wsConnections.set(t,n),this.wsConnectionsSet.add(n),this.wireWSSendDescendants(t,n),n}wireWSSendDescendants(t,e){if("function"!=typeof t.querySelectorAll)return;const s=x().selectorFor("ws","send"),n=[];t.matches?.(s)&&n.push(t);for(const e of t.querySelectorAll(s))n.push(e);for(const t of n){if(this.wsSendListeners.has(t))continue;const s="FORM"===t.tagName?"submit":"click",n=n=>{"submit"===s&&n.preventDefault();const i=J(t);e.send(i)};t.addEventListener(s,n),this.wsSendListeners.set(t,()=>t.removeEventListener(s,n))}}getWSConnection(t){return this.wsConnections.get(t)??null}detachWS(t){const e=this.wsConnections.get(t);if(e&&(e.detach(),this.wsConnections.delete(t),this.wsConnectionsSet.delete(e),"function"==typeof t.querySelectorAll)){const e=x().selectorFor("ws","send"),s=[];t.matches?.(e)&&s.push(t);for(const n of t.querySelectorAll(e))s.push(n);for(const t of s){const e=this.wsSendListeners.get(t);e&&(e(),this.wsSendListeners.delete(t))}}}detachWSSubtree(t){if(this.detachWS(t),"function"!=typeof t.querySelectorAll)return;const e=t.querySelectorAll(x().selectorFor("ws","connect"));for(const t of e)this.detachWS(t)}installOnHandlers(t,e){if(this.detachOnHandlers(t),!this.executeCallback)return;const s=this.executeCallback,n=new Map;for(const[i,r]of Object.entries(e)){const e=x().eventNameOf(t,i),o=e=>{s(r,t).catch(t=>{void 0!==console&&console.error(`[htmx-compat] hx-on:${i} execution failed:`,t)})};t.addEventListener(e,o),n.set(e,()=>t.removeEventListener(e,o))}this.onHandlerListeners.set(t,n),this.onHandlerElements.add(t)}detachOnHandlers(t){const e=this.onHandlerListeners.get(t);if(e){for(const t of e.values())t();this.onHandlerListeners.delete(t),this.onHandlerElements.delete(t)}}detachOnHandlersSubtree(t){for(const e of this.findHxOnElements(t))this.detachOnHandlers(e)}scanForHtmxElements(t){const e=t??this.options.root;if(!e)return[];if(e.closest?.("[fx-ignore]"))return[];const s=function(){const t=x(),e=[];for(const s of["get","post","put","patch","delete",...rt])e.push(t.selectorFor("hx",s));return e.push(t.selectorFor("sse","connect")),e.push(t.selectorFor("ws","connect")),e.push("[fx-action]"),e.join(", ")}(),n=new Set(e.querySelectorAll(s));e.matches?.(s)&&n.add(e);for(const t of this.findHxOnElements(e))n.add(t);return Array.from(n).filter(t=>!t.closest("[fx-ignore]"))}findHxOnElements(t){const e=[],s=t=>{const s=t.attributes;for(let n=0;s.length>n;n++)if(null!==nt(s[n].name))return void e.push(t)};if(s(t),"function"==typeof t.querySelectorAll)for(const e of t.querySelectorAll("*"))s(e);return e}collectAttributes(t){const e={};for(const s of["get","post","put","patch","delete"]){const n=ct(t,"hx",s);if(n){e.method=s.toUpperCase(),e.url=n;break}}const s=ct(t,"hx","target");s&&(e.target=s);const n=ct(t,"hx","swap");n&&(e.swap=n);const i=ct(t,"hx","trigger");i&&(e.trigger=i);const r=ct(t,"hx","confirm");r&&(e.confirm=r),"true"===ct(t,"hx","boost")&&(e.boost=1);const o=ct(t,"hx","vals");o&&(e.vals=o);const a=ct(t,"hx","headers");a&&(e.headers=a);const c=ct(t,"hx","push-url");c&&(e.pushUrl="true"===c?1:c);const h=ct(t,"hx","replace-url");h&&(e.replaceUrl="true"===h?1:h);const l={};for(const e of t.attributes){const t=nt(e.name);null!==t&&(l[t]=e.value)}Object.keys(l).length>0&&(e.onHandlers=l);const u=ct(t,"hx","live");return u&&(e.hxLive=u),e}collectFxAttributes(t){const e={},s=t.getAttribute("fx-action");s&&(e.url=s);const n=t.getAttribute("fx-method");e.method=n?.toUpperCase()||"GET";const i=t.getAttribute("fx-target");i&&(e.target=i);const r=t.getAttribute("fx-swap");e.swap=r||"outerHTML";const o=t.getAttribute("fx-trigger");return o&&(e.trigger=o),e}isFxElement(t){return t.hasAttribute("fx-action")}processElement(t){if(this.processedElements.has(t))return;ht(t,"sse","connect")&&this.attachSSE(t),ht(t,"ws","connect")&&this.attachWS(t);const e=this.isFxElement(t),s=e?this.collectFxAttributes(t):this.collectAttributes(t),n=e?"fx":"htmx";if(s.onHandlers&&this.installOnHandlers(t,s.onHandlers),!s.url&&!s.boost&&!s.hxLive)return;if(s.hxLive&&!function(){if("undefined"!=typeof globalThis){const t=globalThis,e=t[z];if(e&&"object"==typeof e&&"function"==typeof e.registerFeature)return e;t[z]=N}return N}().hasFeature("live")&&(void 0!==console&&console.error(`[${n}-compat] hx-live requires @hyperfixi/reactivity to be installed. Install it via \`installPlugin(runtime, reactivityPlugin)\`, or use the hyperfixi-hx-v4 bundle which auto-installs it. Element:`,t),delete s.hxLive,!s.url&&!s.boost))return;if(e&&this.options.fixiEvents&&!this.dispatchLifecycleEvent(t,"fx:init",{element:t,options:{}},{debugPrefix:"fx"}))return;if(!this.dispatchLifecycleEvent(t,"htmx:configuring",{config:s,element:t},{debugPrefix:n}))return;if(e&&this.options.fixiEvents){const e={cfg:{trigger:s.trigger||"click",method:s.method||"GET",action:s.url,headers:{},target:s.target,swap:s.swap||"outerHTML",body:null,drop:this.pendingRequests.has(t)?1:0,transition:1,preventTrigger:1,signal:(new AbortController).signal},element:t};if(!this.dispatchLifecycleEvent(t,"fx:config",e,{debugPrefix:"fx"}))return}const i=S(s,t);if(this.options.debug&&console.log(`[${n}-compat] Translated:`,{element:t.tagName,config:s,hyperscript:i}),this.processedElements.add(t),this.executeCallback&&i){if(e&&this.options.requestDropping&&this.pendingRequests.has(t))return void(this.options.debug&&console.log("[fx-compat] Request dropped - pending request exists"));const r=new AbortController;if(e&&this.options.requestDropping&&this.pendingRequests.set(t,r),t.setAttribute(e?"data-fx-generated":"data-hx-generated",i),!this.dispatchLifecycleEvent(t,"htmx:beforeRequest",{element:t,url:s.url,method:s.method||"GET"},{debugPrefix:n}))return void this.pendingRequests.delete(t);if(e&&this.options.fixiEvents&&!this.dispatchLifecycleEvent(t,"fx:before",{element:t,url:s.url,method:s.method||"GET"},{debugPrefix:"fx"}))return void this.pendingRequests.delete(t);let o=1;this.executeCallback(i,t).then(()=>{e&&this.options.fixiEvents&&!this.dispatchLifecycleEvent(t,"fx:after",{cfg:{trigger:s.trigger||"click",method:s.method||"GET",action:s.url,headers:{},target:s.target,swap:s.swap||"outerHTML",body:null,drop:0,transition:1,preventTrigger:1,signal:r.signal,response:null,text:""},element:t},{debugPrefix:"fx"})||(this.dispatchLifecycleEvent(t,"htmx:afterSettle",{element:t,target:s.target},{cancelable:0}),e&&this.options.fixiEvents&&this.dispatchLifecycleEvent(t,"fx:swapped",{element:t,target:s.target},{cancelable:0,debugPrefix:"fx"}))}).catch(s=>{o=0,console.error(`[${n}-compat] Execution error:`,s);const i=s instanceof Error?s:Error(s+"");this.dispatchLifecycleEvent(t,"htmx:error",{element:t,error:i},{cancelable:0}),e&&this.options.fixiEvents&&this.dispatchLifecycleEvent(t,"fx:error",{element:t,error:i},{cancelable:0,debugPrefix:"fx"})}).finally(()=>{this.pendingRequests.delete(t),e&&this.options.fixiEvents&&this.dispatchLifecycleEvent(t,"fx:finally",{element:t,success:o},{cancelable:0,debugPrefix:"fx"}),e&&this.options.fixiEvents&&this.dispatchLifecycleEvent(t,"fx:inited",{element:t},{cancelable:0,bubbles:0,debugPrefix:"fx"})})}}processSubtree(t){const e=this.scanForHtmxElements(t);for(const t of e)this.processElement(t)}startObserver(){var t;this.observer=new MutationObserver(t=>{for(const e of t){for(const t of e.addedNodes)t instanceof Element&&this.processSubtree(t);for(const t of e.removedNodes)t instanceof Element&&(this.detachSSESubtree(t),this.detachWSSubtree(t),this.detachOnHandlersSubtree(t));if("attributes"===e.type&&e.target instanceof Element){const t=e.attributeName;null!=t&&(at.includes(t)||null!==nt(t)||this.localizedAttrSet.has(t))&&(this.processedElements.delete(e.target),this.processElement(e.target))}}}),this.localizedAttrSet=new Set(et()),this.unsubscribeVocab=(tt.add(t=()=>this.refreshLocalizedAttrs()),()=>{tt.delete(t)}),this.options.root&&this.observer.observe(this.options.root,{childList:1,subtree:1,attributes:1,attributeFilter:this.computeAttributeFilter()})}computeAttributeFilter(){const t=et();return 0===t.length?at:[...new Set([...at,...t])]}refreshLocalizedAttrs(){this.localizedAttrSet=new Set(et()),this.observer&&this.options.root&&(this.observer.disconnect(),this.observer.observe(this.options.root,{childList:1,subtree:1,attributes:1,attributeFilter:this.computeAttributeFilter()}))}manualProcess(t){return S(this.isFxElement(t)?this.collectFxAttributes(t):this.collectAttributes(t),t)}hasPendingRequest(t){return this.pendingRequests.has(t)}abortPendingRequest(t){const e=this.pendingRequests.get(t);return e?(e.abort(),this.pendingRequests.delete(t),1):0}}let ut=null;function ft(t={}){const{processHyperscript:e=1,...s}=t;ut=new lt({processExisting:s.processExisting??1,watchMutations:s.watchMutations??1,debug:s.debug??0,root:s.root??document.body,requestDropping:s.requestDropping??1,fixiEvents:s.fixiEvents??1}),ut.init(async(t,e)=>{await b.execute(t,e)}),pt||"undefined"==typeof document||(pt=t=>{const e=t.detail,s=e?.elt??t.target;s&&"function"==typeof s.querySelector&&b.process(s)},document.addEventListener("htmx:load",pt),document.addEventListener("htmx:after:process",pt)),t.debug&&console.log("[hyperfixi-hx] htmx/fixi compatibility enabled")}let pt=null;function dt(){ut&&(ut.destroy(),ut=null),pt&&"undefined"!=typeof document&&(document.removeEventListener("htmx:load",pt),document.removeEventListener("htmx:after:process",pt),pt=null)}function mt(t){return new lt({processExisting:0,watchMutations:0}).manualProcess(t)}const yt={...b,version:"1.0.0-hybrid-hx",enableHtmxCompatibility:ft,disableHtmxCompatibility:dt,getHtmxProcessor:function(){return ut},translateHtmx:mt,hasHtmxAttributes:k,hasFxAttributes:T,hasAnyAttributes:H,HtmxAttributeProcessor:lt,translateToHyperscript:S,features:{htmx:1,fixi:1,hyperscript:1},htmxAttributes:it,fixiAttributes:ot,fixiEvents:["fx:init","fx:inited","fx:config","fx:before","fx:after","fx:error","fx:finally","fx:swapped"]};if("undefined"!=typeof window){window.hyperfixi=yt,window.lokascript=yt;const t=()=>{ft({processExisting:1,watchMutations:1,processHyperscript:1,requestDropping:1,fixiEvents:1})};"loading"===document.readyState?document.addEventListener("DOMContentLoaded",t):t()}t.FIXI_ATTRS=ot,t.HTMX_ATTRS=it,t.HtmxAttributeProcessor=lt,t.default=yt,t.disableHtmxCompatibility=dt,t.enableHtmxCompatibility=ft,t.hasAnyAttributes=H,t.hasFxAttributes=T,t.translateHtmx=mt,Object.defineProperty(t,"i",{value:1})}({});
|
|
1
|
+
!function(t){"use strict";const e=new Set(["on","from","to","into","before","after","in","of","at","with","if","else","unless","end","then","and","or","not","repeat","times","for","each","while","until","toggle","add","remove","put","set","get","call","return","append","log","send","trigger","wait","settle","fetch","as","show","hide","take","increment","decrement","focus","blur","go","transition","over","the","a","an","my","its","me","it","you","first","last","next","previous","closest","parent","true","false","null","undefined","is","matches","contains","includes","exists","has","init","every","by","halt","via","values","default","event"]);function s(t){const s=[];let n=0;for(;t.length>n;){if(/\s/.test(t[n])){n++;continue}if("--"===t.slice(n,n+2)){for(;t.length>n&&"\n"!==t[n];)n++;continue}const i=n;if("<"===t[n]&&/[a-zA-Z]/.test(t[n+1]||"")){for(n++;t.length>n&&">"!==t[n];)n++;">"===t[n]&&n++;const e=t.slice(i,n);if(e.endsWith("/>")||e.endsWith(">")){const t=e.slice(1).replace(/\/?>$/,"");s.push({type:"selector",value:t,pos:i});continue}}if("'s"===t.slice(n,n+2)&&!/[a-zA-Z]/.test(t[n+2]||"")){s.push({type:"operator",value:"'s",pos:i}),n+=2;continue}if('"'===t[n]||"'"===t[n]){const e=t[n++];for(;t.length>n&&t[n]!==e;)"\\"===t[n]&&n++,n++;n++,s.push({type:"string",value:t.slice(i,n),pos:i});continue}if(/\d/.test(t[n])||"-"===t[n]&&/\d/.test(t[n+1]||"")){for("-"===t[n]&&n++;t.length>n&&/[\d.]/.test(t[n]);)n++;"ms"===t.slice(n,n+2)?n+=2:"s"!==t[n]||/[a-zA-Z]/.test(t[n+1]||"")?"px"===t.slice(n,n+2)&&(n+=2):n++,s.push({type:"number",value:t.slice(i,n),pos:i});continue}if(":"===t[n]){for(n++;t.length>n&&/[\w]/.test(t[n]);)n++;s.push({type:"localVar",value:t.slice(i,n),pos:i});continue}if("$"===t[n]){for(n++;t.length>n&&/[\w]/.test(t[n]);)n++;s.push({type:"globalVar",value:t.slice(i,n),pos:i});continue}if("@"===t[n]){for(n++;t.length>n&&/[\w-]/.test(t[n]);)n++;s.push({type:"selector",value:t.slice(i,n),pos:i});continue}if("#"===t[n]||"."===t[n]){if("."===t[n]&&t.slice(n+1).match(/^(once|prevent|stop|debounce|throttle)\b/i)){s.push({type:"symbol",value:".",pos:i}),n++;continue}for(n++;t.length>n&&/[\w-]/.test(t[n]);)n++;s.push({type:"selector",value:t.slice(i,n),pos:i});continue}if("["===t[n]){let e=n+1;for(;t.length>e&&/\s/.test(t[e]);)e++;const r=t[e]||"";if(/['"\d\[\]:\$\-]/.test(r)||""===r){s.push({type:"symbol",value:"[",pos:i}),n++;continue}{n++;let e=1;for(;t.length>n&&e>0;)"["===t[n]&&e++,"]"===t[n]&&e--,n++;s.push({type:"selector",value:t.slice(i,n),pos:i});continue}}if("]"===t[n]){s.push({type:"symbol",value:"]",pos:i}),n++;continue}if("'s"===t.slice(n,n+2)){s.push({type:"operator",value:"'s",pos:i}),n+=2;continue}const r=t.slice(n,n+2);if(["==","!=","<=",">=","&&","||"].includes(r))s.push({type:"operator",value:r,pos:i}),n+=2;else if("*"===t[n]&&/[a-zA-Z]/.test(t[n+1]||"")){for(n++;t.length>n&&/[\w-]/.test(t[n]);)n++;s.push({type:"styleProperty",value:t.slice(i,n),pos:i})}else if("+-*/%<>!".includes(t[n]))s.push({type:"operator",value:t[n],pos:i}),n++;else if("()[]{},.".includes(t[n]))s.push({type:"symbol",value:t[n],pos:i}),n++;else{if(/[a-zA-Z_]/.test(t[n])){for(;t.length>n&&/[\w-]/.test(t[n]);)n++;const r=t.slice(i,n),o=e.has(r.toLowerCase())?"keyword":"identifier";s.push({type:o,value:r,pos:i});continue}n++}}return s.push({type:"eof",value:"",pos:t.length}),s}const n={flip:"toggle",switch:"toggle",display:"show",reveal:"show",conceal:"hide",increase:"increment",decrease:"decrement",fire:"trigger",dispatch:"send",navigate:"go",goto:"go"},i={clicked:"click",pressed:"keydown",changed:"change",submitted:"submit",loaded:"load"};function r(t){const e=t.toLowerCase();return n[e]||e}function o(t){const e=t.toLowerCase();return i[e]||e}class a{constructor(t){this.pos=0,this.tokens=s(t)}peek(t=0){return this.tokens[Math.min(this.pos+t,this.tokens.length-1)]}advance(){return this.tokens[this.pos++]}match(...t){const e=this.peek();return t.some(t=>e.value.toLowerCase()===t.toLowerCase())}matchType(...t){return t.includes(this.peek().type)}expect(t){if(!this.match(t)&&r(this.peek().value)!==t)throw Error(`Expected '${t}', got '${this.peek().value}'`);return this.advance()}isAtEnd(){return"eof"===this.peek().type}parse(){return this.match("on")?this.parseEventHandler():this.match("init")?(this.advance(),{type:"event",event:"init",modifiers:{},body:this.parseCommandSequence()}):this.match("every")?this.parseEveryHandler():{type:"sequence",commands:this.parseCommandSequence()}}parseEventHandler(){this.expect("on");const t=this.advance().value,e={};let s;for(;"."===this.peek().value;){this.advance();const t=this.advance().value.toLowerCase();if("once"===t)e.once=1;else if("prevent"===t)e.prevent=1;else if("stop"===t)e.stop=1;else if(("debounce"===t||"throttle"===t)&&"("===this.peek().value){this.advance();const s=this.advance().value;this.expect(")"),"debounce"===t?e.debounce=parseInt(s)||100:e.throttle=parseInt(s)||100}}return this.match("from")&&(this.advance(),s=this.parseExpression()),{type:"event",event:o(t),filter:s,modifiers:e,body:this.parseCommandSequence()}}parseEveryHandler(){return this.expect("every"),{type:"event",event:"interval:"+this.advance().value,modifiers:{},body:this.parseCommandSequence()}}parseCommandSequence(){const t=[];for(;!this.isAtEnd()&&!this.match("end","else");){const e=this.parseCommand();e&&t.push(e),this.match("then","and")&&this.advance()}return t}parseCommand(){if(this.match("if","unless"))return this.parseIf();if(this.match("repeat"))return this.parseRepeat();if(this.match("for"))return this.parseFor();if(this.match("while"))return this.parseWhile();if(this.match("fetch"))return this.parseFetchBlock();const t={toggle:()=>this.parseToggle(),add:()=>this.parseAdd(),remove:()=>this.parseRemove(),put:()=>this.parsePut(),append:()=>this.parseAppend(),set:()=>this.parseSet(),get:()=>this.parseGet(),call:()=>this.parseCall(),log:()=>this.parseLog(),send:()=>this.parseSend(),trigger:()=>this.parseSend(),wait:()=>this.parseWait(),show:()=>this.parseShow(),hide:()=>this.parseHide(),take:()=>this.parseTake(),increment:()=>this.parseIncDec("increment"),decrement:()=>this.parseIncDec("decrement"),focus:()=>this.parseFocusBlur("focus"),blur:()=>this.parseFocusBlur("blur"),go:()=>this.parseGo(),return:()=>this.parseReturn(),transition:()=>this.parseTransition(),halt:()=>this.parseHalt()},e=r(this.peek().value);return t[e]?t[e]():(this.isAtEnd()||this.match("then","and","end","else")||this.advance(),null)}parseIf(){const t=this.match("unless");this.advance();const e=this.parseExpression(),s=this.parseCommandSequence();let n;return this.match("else")&&(this.advance(),n=this.parseCommandSequence()),this.match("end")&&this.advance(),{type:"if",condition:t?{type:"unary",operator:"not",operand:e}:e,body:s,elseBody:n}}parseRepeat(){let t;this.expect("repeat"),this.match("until","while","forever")||(t=this.parseExpression(),this.match("times")&&this.advance());const e=this.parseCommandSequence();return this.match("end")&&this.advance(),{type:"repeat",condition:t,body:e}}parseFor(){this.expect("for"),this.match("each")&&this.advance();const t=this.advance().value;this.expect("in");const e=this.parseExpression(),s=this.parseCommandSequence();return this.match("end")&&this.advance(),{type:"for",condition:{type:"forCondition",variable:t,iterable:e},body:s}}parseWhile(){this.expect("while");const t=this.parseExpression(),e=this.parseCommandSequence();return this.match("end")&&this.advance(),{type:"while",condition:t,body:e}}parseFetchBlock(){this.expect("fetch");const t=this.parseExpression();let e,s,n={type:"literal",value:"text"};this.match("{")&&(this.pos--,e=this.parseExpression());for(let t=0;3>t;t++)if(!this.match("via")||s)if(this.match("as"))this.advance(),(this.match("a")||this.match("an"))&&this.advance(),n=this.parseExpression();else{if(!this.match("with")||e)break;this.advance(),e=this.parseExpression()}else this.advance(),s=this.parseExpression();return this.match("then")&&this.advance(),{type:"fetch",condition:{type:"fetchConfig",url:t,responseType:n,options:e,method:s},body:this.parseCommandSequence()}}parseToggle(){this.expect("toggle");const t=this.parseExpression();let e;return this.match("on")&&(this.advance(),e=this.parseExpression()),{type:"command",name:"toggle",args:[t],target:e}}parseAdd(){this.expect("add");const t=this.parseExpression();let e;return this.match("to")&&(this.advance(),e=this.parseExpression()),{type:"command",name:"add",args:[t],target:e}}parseRemove(){if(this.expect("remove"),this.matchType("selector")){const t=this.parseExpression();let e;return this.match("from")&&(this.advance(),e=this.parseExpression()),{type:"command",name:"removeClass",args:[t],target:e}}return{type:"command",name:"remove",args:[],target:this.parseExpression()}}parsePut(){this.expect("put");const t=this.parseExpression();let e="into";if(this.match("into","before","after","at")&&(e=this.advance().value,"at"===e)){const t=this.advance().value;this.expect("of"),e=`at ${t} of`}return{type:"command",name:"put",args:[t],target:this.parseExpression(),modifier:e}}parseAppend(){this.expect("append");const t=this.parseExpression();let e;return this.match("to")&&(this.advance(),e=this.parseExpression()),{type:"command",name:"append",args:[t],target:e}}parseSet(){this.expect("set");const t=this.parseExpression();return this.match("to")?(this.advance(),{type:"command",name:"set",args:[t,this.parseExpression()]}):{type:"command",name:"set",args:[t]}}parseGet(){return this.expect("get"),{type:"command",name:"get",args:[this.parseExpression()]}}parseCall(){return this.expect("call"),{type:"command",name:"call",args:[this.parseExpression()]}}parseLog(){this.expect("log");const t=[];for(;!this.isAtEnd()&&!this.match("then","and","end","else")&&(t.push(this.parseExpression()),this.match(","));)this.advance();return{type:"command",name:"log",args:t}}parseSend(){this.advance();const t=this.advance().value;let e;return this.match("to")&&(this.advance(),e=this.parseExpression()),{type:"command",name:"send",args:[{type:"literal",value:t}],target:e}}parseWait(){if(this.expect("wait"),this.match("for")){this.advance();const t=this.advance().value;let e;return this.match("from")&&(this.advance(),e=this.parseExpression()),{type:"command",name:"waitFor",args:[{type:"literal",value:t}],target:e}}return{type:"command",name:"wait",args:[this.parseExpression()]}}parseShow(){let t;this.expect("show");const e={};return this.isAtEnd()||this.match("then","and","end","else","when","where")||(t=this.parseExpression()),!this.isAtEnd()&&this.match("when","where")&&(e[this.advance().value]=this.parseExpression()),{type:"command",name:"show",args:[],target:t,modifiers:e}}parseHide(){let t;this.expect("hide");const e={};return this.isAtEnd()||this.match("then","and","end","else","when","where")||(t=this.parseExpression()),!this.isAtEnd()&&this.match("when","where")&&(e[this.advance().value]=this.parseExpression()),{type:"command",name:"hide",args:[],target:t,modifiers:e}}parseTake(){this.expect("take");const t=this.parseExpression();let e;return this.match("from")&&(this.advance(),e=this.parseExpression()),{type:"command",name:"take",args:[t],target:e}}parseIncDec(t){this.advance();const e=this.parseExpression();let s={type:"literal",value:1};return this.match("by")&&(this.advance(),s=this.parseExpression()),{type:"command",name:t,args:[e,s]}}parseFocusBlur(t){let e;return this.advance(),this.isAtEnd()||this.match("then","and","end","else")||(e=this.parseExpression()),{type:"command",name:t,args:[],target:e}}parseGo(){return this.expect("go"),this.match("to")&&this.advance(),this.match("url")&&this.advance(),{type:"command",name:"go",args:[this.parseExpression()]}}parseReturn(){let t;return this.expect("return"),this.isAtEnd()||this.match("then","and","end","else")||(t=this.parseExpression()),{type:"command",name:"return",args:t?[t]:[]}}parseHalt(){return this.expect("halt"),this.match("the")&&this.advance(),this.match("event","default")&&this.advance(),{type:"command",name:"halt",args:[]}}parseTransition(){let t;if(this.expect("transition"),this.match("my","its"))t={type:"identifier",value:"my"===this.advance().value?"me":"it"};else if(this.matchType("selector")){const e=this.parseExpression();if("possessive"===e.type)return this.parseTransitionRest(e.object,e.property);t=e}const e=this.peek();let s;return s="styleProperty"===e.type||"identifier"===e.type||"keyword"===e.type?this.advance().value:"opacity",this.parseTransitionRest(t,s)}parseTransitionRest(t,e){let s={type:"literal",value:1};this.match("to")&&(this.advance(),s=this.parseExpression());let n={type:"literal",value:300};return this.match("over")&&(this.advance(),n=this.parseExpression()),{type:"command",name:"transition",args:[{type:"literal",value:e},s,n],target:t}}parseExpression(){return this.parseOr()}parseOr(){let t=this.parseAnd();for(;this.match("or","||");)this.advance(),t={type:"binary",operator:"or",left:t,right:this.parseAnd()};return t}parseAnd(){let t=this.parseEquality();for(;this.match("and","&&")&&!this.isCommandKeyword(this.peek(1));)this.advance(),t={type:"binary",operator:"and",left:t,right:this.parseEquality()};return t}isCommandKeyword(t){return["toggle","add","remove","set","put","log","send","wait","show","hide","increment","decrement","focus","blur","go"].includes(r(t.value))}parseEquality(){let t=this.parseComparison();for(;this.match("==","!=","is","matches","contains","includes","has");){const e=this.advance().value;"is"===e.toLowerCase()&&this.match("not")?(this.advance(),t={type:"binary",operator:"is not",left:t,right:this.parseComparison()}):t={type:"binary",operator:e,left:t,right:this.parseComparison()}}return t}parseComparison(){let t=this.parseAdditive();for(;this.match("<",">","<=",">=");)t={type:"binary",operator:this.advance().value,left:t,right:this.parseAdditive()};return t}parseAdditive(){let t=this.parseMultiplicative();for(;this.match("+","-");)t={type:"binary",operator:this.advance().value,left:t,right:this.parseMultiplicative()};return t}parseMultiplicative(){let t=this.parseUnary();for(;this.match("*","/","%");)t={type:"binary",operator:this.advance().value,left:t,right:this.parseUnary()};return t}parseUnary(){if(this.match("not","!"))return this.advance(),{type:"unary",operator:"not",operand:this.parseUnary()};if(this.match("-")&&"number"===this.peek(1).type){this.advance();const t=this.advance();return{type:"literal",value:-parseFloat(t.value)}}return this.parsePostfix()}parsePostfix(){let t=this.parsePrimary();for(;;)if(this.match("'s"))this.advance(),this.peek(),t={type:"possessive",object:t,property:this.advance().value};else if("styleProperty"===this.peek().type)t={type:"possessive",object:t,property:this.advance().value};else if("."===this.peek().value)this.advance(),t={type:"member",object:t,property:this.advance().value};else if("selector"===this.peek().type&&this.peek().value.startsWith("."))t={type:"member",object:t,property:this.advance().value.slice(1)};else if("("===this.peek().value){this.advance();const e=[];for(;!this.match(")");)e.push(this.parseExpression()),this.match(",")&&this.advance();this.expect(")"),t={type:"call",callee:t,args:e}}else{if("["!==this.peek().value||"selector"===t.type)break;{this.advance();const e=this.parseExpression();this.expect("]"),t={type:"member",object:t,property:e,computed:1}}}return t}parsePrimary(){const t=this.peek();if("("===t.value){this.advance();const t=this.parseExpression();return this.expect(")"),t}if("{"===t.value)return this.parseObjectLiteral();if("["===t.value)return this.parseArrayLiteral();if("number"===t.type){this.advance();const e=t.value;return e.endsWith("ms")?{type:"literal",value:parseInt(e),unit:"ms"}:e.endsWith("s")?{type:"literal",value:1e3*parseFloat(e),unit:"ms"}:{type:"literal",value:parseFloat(e)}}if("string"===t.type)return this.advance(),{type:"literal",value:t.value.slice(1,-1)};if(this.match("true"))return this.advance(),{type:"literal",value:1};if(this.match("false"))return this.advance(),{type:"literal",value:0};if(this.match("null"))return this.advance(),{type:"literal",value:null};if(this.match("undefined"))return this.advance(),{type:"literal",value:void 0};if("localVar"===t.type)return this.advance(),{type:"variable",name:t.value,scope:"local"};if("globalVar"===t.type)return this.advance(),{type:"variable",name:t.value,scope:"global"};if("selector"===t.type)return this.advance(),{type:"selector",value:t.value};if(this.match("my")){this.advance();const t=this.peek();return"identifier"!==t.type&&"keyword"!==t.type||this.isCommandKeyword(t)?{type:"identifier",value:"me"}:{type:"possessive",object:{type:"identifier",value:"me"},property:this.advance().value}}if(this.match("its")){this.advance();const t=this.peek();return"identifier"!==t.type&&"keyword"!==t.type||this.isCommandKeyword(t)?{type:"identifier",value:"it"}:{type:"possessive",object:{type:"identifier",value:"it"},property:this.advance().value}}return this.match("me")?(this.advance(),{type:"identifier",value:"me"}):this.match("it")?(this.advance(),{type:"identifier",value:"it"}):this.match("you")?(this.advance(),{type:"identifier",value:"you"}):this.match("the","a","an")?(this.advance(),this.match("first","last","next","previous","closest","parent")?{type:"positional",position:this.advance().value,target:this.parsePositionalTarget()}:this.parsePrimary()):this.match("first","last","next","previous","closest","parent")?{type:"positional",position:this.advance().value,target:this.parsePositionalTarget()}:this.match("values")?(this.advance(),this.match("of")?(this.advance(),{type:"valuesOf",target:this.parseExpression()}):{type:"identifier",value:t.value}):(this.advance(),{type:"identifier",value:t.value})}parseObjectLiteral(){this.expect("{");const t=[];for(;!this.match("}");){const e=this.advance().value;this.expect(":");const s=this.parseExpression();t.push({key:e,value:s}),this.match(",")&&this.advance()}return this.expect("}"),{type:"object",properties:t}}parseArrayLiteral(){this.expect("[");const t=[];for(;!this.match("]");)t.push(this.parseExpression()),this.match(",")&&this.advance();return this.expect("]"),{type:"array",elements:t}}parsePositionalTarget(){const t=this.peek();return"selector"===t.type?{type:"selector",value:this.advance().value}:"identifier"===t.type||"keyword"===t.type?{type:"identifier",value:this.advance().value}:this.parseExpression()}}const c=new Map,h=1e3;async function l(t,e){switch(t.type){case"literal":return t.value;case"identifier":return"me"===t.value||"my"===t.value?e.me:"it"===t.value?e.it:"you"===t.value?e.you:"event"===t.value?e.event:"body"===t.value?document.body:"document"===t.value?document:"window"===t.value?window:e.locals.has(t.value)?e.locals.get(t.value):t.value in e.me?e.me[t.value]:t.value in window?window[t.value]:t.value;case"variable":if("local"===t.scope)return e.locals.get(t.name.slice(1));const s=t.name.slice(1);return c.has(s)?c.get(s):window[t.name];case"selector":const n=document.querySelectorAll(t.value);return 1===n.length?n[0]:Array.from(n);case"binary":return async function(t,e){if("has"===t.operator){const s=await l(t.left,e);return s instanceof Element&&"selector"===t.right.type&&t.right.value.startsWith(".")?s.classList.contains(t.right.value.slice(1)):0}const s=await l(t.left,e),n=await l(t.right,e);switch(t.operator){case"+":return s+n;case"-":return s-n;case"*":return s*n;case"/":return s/n;case"%":return s%n;case"==":case"is":return s==n;case"!=":case"is not":return s!=n;case"<":return n>s;case">":return s>n;case"<=":return n>=s;case">=":return s>=n;case"and":case"&&":return s&&n;case"or":case"||":return s||n;case"has":if(s instanceof Element){const t="string"==typeof n?n:n?.value;if("string"==typeof t&&t.startsWith("."))return s.classList.contains(t.slice(1))}return 0;case"contains":case"includes":return"string"==typeof s||Array.isArray(s)?s.includes(n):s instanceof Element?s.contains(n):0;case"matches":return s instanceof Element?s.matches(n):"string"==typeof s?RegExp(n).test(s):0;default:return}}(t,e);case"unary":const i=await l(t.operand,e);return"not"===t.operator?!i:i;case"possessive":case"member":const r=await l(t.object,e);if(null==r)return;const o=t.computed?await l(t.property,e):t.property;return"values"===o&&r instanceof Element?u(r):r[o];case"call":{let s,n=null;if("member"===t.callee.type||"possessive"===t.callee.type){n=await l(t.callee.object,e);const i=t.callee.computed?await l(t.callee.property,e):t.callee.property;s=n?.[i]}else s=await l(t.callee,e);const i=await Promise.all(t.args.map(t=>l(t,e)));return"function"==typeof s?s.apply(n,i):void 0}case"positional":return function(t,e){const s=t.target;let n=[],i=null;switch(("selector"===s.type||"identifier"===s.type||"htmlSelector"===s.type)&&(i=s.value),i&&(n=Array.from(document.querySelectorAll(i))),t.position){case"first":default:return n[0]||null;case"last":return n[n.length-1]||null;case"next":if(i){let t=e.me.nextElementSibling;for(;t;){if(t.matches(i))return t;t=t.nextElementSibling}return null}return e.me.nextElementSibling;case"previous":if(i){let t=e.me.previousElementSibling;for(;t;){if(t.matches(i))return t;t=t.previousElementSibling}return null}return e.me.previousElementSibling;case"closest":return i?e.me.closest(i):null;case"parent":if(i){let t=e.me.parentElement;for(;t;){if(t.matches(i))return t;t=t.parentElement}return null}return e.me.parentElement}}(t,e);case"object":const a={};for(const s of t.properties)a[s.key]=await l(s.value,e);return a;case"array":return Promise.all(t.elements.map(t=>l(t,e)));case"valuesOf":{const s=await l(t.target,e);return s instanceof Element?u(s):new FormData}default:return}}function u(t){if(t instanceof HTMLFormElement)return new FormData(t);const e=new FormData;return t.querySelectorAll("input, select, textarea").forEach(t=>{const s=t.getAttribute("name");s&&"value"in t&&e.append(s,t.value)}),e}async function f(t,e){const s=async()=>{if(!t.target)return[e.me];const s=await l(t.target,e);return Array.isArray(s)?s:s instanceof Element?[s]:"string"==typeof s?Array.from(document.querySelectorAll(s)):[e.me]},n=t=>{if(!t)return"";if("selector"===t.type)return t.value.startsWith("@")?t.value:t.value.slice(1);if("string"===t.type||"literal"===t.type){const e=t.value;return"string"==typeof e&&e.startsWith(".")?e.slice(1):e+""}return"identifier"===t.type?t.value:""},i=t=>Array.isArray(t)?t.filter(t=>t instanceof Element):t instanceof Element?[t]:"string"==typeof t?Array.from(document.querySelectorAll(t)):[],r=t=>t.startsWith("*"),o=t=>t.substring(1),a=(t,e,s)=>r(e)?(t.style.setProperty(o(e),s+""),1):0,h=(t,e)=>{if(r(e))return getComputedStyle(t).getPropertyValue(o(e))};switch(t.name){case"toggle":{const i=n(t.args[0])||await l(t.args[0],e)+"",r=await s();if(i.startsWith("@")){const t=i.slice(1);for(const e of r)e.hasAttribute(t)?e.removeAttribute(t):e.setAttribute(t,"")}else for(const t of r)t.classList.toggle(i);return e.it=1===r.length?r[0]:r,e.it}case"add":{const i=n(t.args[0])||await l(t.args[0],e)+"",r=await s();if(i.startsWith("@")){const t=i.slice(1);for(const e of r)e.setAttribute(t,"")}else for(const t of r)t.classList.add(i);return e.it=1===r.length?r[0]:r,e.it}case"removeClass":{const i=n(t.args[0])||await l(t.args[0],e)+"",r=await s();if(i.startsWith("@")){const t=i.slice(1);for(const e of r)e.removeAttribute(t)}else for(const t of r)t.classList.remove(i);return e.it=1===r.length?r[0]:r,e.it}case"remove":{const t=await s();for(const e of t)e.remove();return null}case"put":{const n=await l(t.args[0],e),o=t.modifier||"into";if("possessive"===t.target?.type&&r(t.target.property)){const s=i(await l(t.target.object,e));for(const e of s)a(e,t.target.property,n);return e.it=n,n}const c=await s();for(const t of c){const e=n+"";"into"===o?t.innerHTML=e:"before"===o?t.insertAdjacentHTML("beforebegin",e):"after"===o?t.insertAdjacentHTML("afterend",e):"at start of"===o?t.insertAdjacentHTML("afterbegin",e):"at end of"===o&&t.insertAdjacentHTML("beforeend",e)}return e.it=n,n}case"append":{const n=await l(t.args[0],e),i=await s();for(const t of i)t.insertAdjacentHTML("beforeend",n+"");return e.it=n,n}case"set":{const s=t.args[0],n=await l(t.args[1],e);if("variable"===s.type){const t=s.name.slice(1);return("local"===s.scope?e.locals:c).set(t,n),e.it=n,n}if("possessive"===s.type||"member"===s.type){const t=await l(s.object,e);if(t)return t instanceof Element&&a(t,s.property,n)?(e.it=n,n):(t[s.property]=n,e.it=n,n)}return e.it=n,n}case"get":{const s=await l(t.args[0],e);return e.it=s,s}case"call":{const s=await l(t.args[0],e);return e.it=s,s}case"log":{const s=await Promise.all(t.args.map(t=>l(t,e)));return console.log(...s),s[0]}case"send":{const n=await l(t.args[0],e),i=await s(),r=new CustomEvent(n+"",{bubbles:1,detail:e.it});for(const t of i)t.dispatchEvent(r);return e.it=r,r}case"wait":{const s=await l(t.args[0],e),n="number"==typeof s?s:parseInt(s+"");return await new Promise(t=>setTimeout(t,n)),n}case"waitFor":{const n=await l(t.args[0],e),i=(await s())[0]||e.me;return new Promise(t=>{i.addEventListener(n+"",s=>{e.it=s,t(s)},{once:1})})}case"show":{const t=await s();for(const e of t)e.style.display="",e.classList.remove("hidden");return t}case"hide":{const t=await s();for(const e of t)e.style.display="none";return t}case"transition":{const n=(await l(t.args[0],e)+"").replace(/^\*/,""),i=await l(t.args[1],e),r=await l(t.args[2],e),o="number"==typeof r?r:(r+"").endsWith("ms")?parseInt(r+""):(r+"").endsWith("s")?1e3*parseFloat(r+""):parseInt(r+"")||300,a=await s(),c=[];for(const t of a){const e=t,s=n.replace(/([A-Z])/g,"-$1").toLowerCase(),r=e.style.transition;e.style.transition=`${s} ${o}ms ease`,e.style.setProperty(s,i+""),c.push(new Promise(t=>{const n=()=>{e.style.transition=r,t()},i=t=>{t.propertyName===s&&(e.removeEventListener("transitionend",i),n())};e.addEventListener("transitionend",i),setTimeout(n,o+50)}))}return await Promise.all(c),e.it=1===a.length?a[0]:a,e.it}case"take":{const i=n(await l(t.args[0],e)),r=t.target?await s():[e.me.parentElement];for(const t of r)t.querySelectorAll("."+i).forEach(t=>t.classList.remove(i));return e.me.classList.add(i),e.me}case"increment":case"decrement":{const s=t.args[0],n=await l(t.args[1],e),o="increment"===t.name?n:-n;if("variable"===s.type){const t=s.name.slice(1),n="local"===s.scope?e.locals:c,i=(n.get(t)||0)+o;return n.set(t,i),e.it=i,i}if("possessive"===s.type&&r(s.property)){const t=i(await l(s.object,e));for(const n of t){const t=(parseFloat(h(n,s.property)||"0")||0)+o;a(n,s.property,t),e.it=t}return e.it}const u=i(await l(s,e));for(const t of u){const s=(parseFloat(t.textContent||"0")||0)+o;t.textContent=s+"",e.it=s}return e.it}case"focus":{const t=await s();for(const e of t)e.focus();return t}case"blur":{const t=await s();for(const e of t)e.blur();return t}case"go":{const s=await l(t.args[0],e),n=(s+"").toLowerCase();return"back"===n?history.back():"forward"===n?history.forward():window.location.href=s+"",null}case"return":throw{type:"return",value:t.args[0]?await l(t.args[0],e):e.it};case"halt":return e.event&&(e.event.preventDefault(),e.event.stopPropagation()),null;default:return console.warn("Unknown command: "+t.name),null}}async function p(t,e){try{return await m(t,e)}catch(t){if("return"===t?.type)throw t;throw t}}async function d(t,e){switch(t.type){case"if":return await l(t.condition,e)?p(t.body,e):t.elseBody?p(t.elseBody,e):null;case"repeat":{const s=await l(t.condition,e),n="number"==typeof s?s:parseInt(s+"");for(let s=0;n>s&&h>s;s++)e.locals.set("__loop_index__",s),e.locals.set("__loop_count__",s+1),await p(t.body,e);return null}case"for":{const{variable:s,iterable:n}=t.condition,i=await l(n,e),r=Array.isArray(i)?i:i instanceof NodeList?Array.from(i):[i],o=s.startsWith(":")?s.slice(1):s;for(let s=0;r.length>s&&h>s;s++)e.locals.set(o,r[s]),e.locals.set("__loop_index__",s),e.locals.set("__loop_count__",s+1),await p(t.body,e);return null}case"while":{let s=0;for(;await l(t.condition,e)&&h>s;)e.locals.set("__loop_index__",s),await p(t.body,e),s++;return null}case"fetch":{const{url:s,responseType:n,options:i,method:r}=t.condition;try{const o=await l(s,e),a={};if(r){const t=await l(r,e);a.method=(t+"").toUpperCase()}if(i){const t=await l(i,e);t instanceof FormData?a.body=t:!t||"object"!=typeof t||t instanceof Element||Object.assign(a,t)}const c=await fetch(o+"",a);if(!c.ok)throw Error("HTTP "+c.status);const h=await l(n,e);let u;if("json"===h)u=await c.json();else if("html"===h){const t=await c.text();u=(new DOMParser).parseFromString(t,"text/html").body.innerHTML}else u=await c.text();e.it=u,e.locals.set("it",u),e.locals.set("result",u),e.locals.set("response",c),await p(t.body,e)}catch(t){if("return"===t?.type)throw t;e.locals.set("error",t),console.error("Fetch error:",t)}return null}default:return null}}async function m(t,e){let s;for(const n of t)"command"===n.type?s=await f(n,e):["if","repeat","for","while","fetch"].includes(n.type)&&(s=await d(n,e));return s}async function y(t,e,s){const n={me:e,event:s,locals:new Map,globals:c};if("sequence"===t.type)return m(t.commands,n);if("event"===t.type){const s=t,i=s.event;if(i.startsWith("interval:")){const t=i.split(":")[1],n=t.endsWith("ms")?parseInt(t):t.endsWith("s")?1e3*parseFloat(t):parseInt(t);return void setInterval(async()=>{const t={me:e,locals:new Map,globals:c};try{await m(s.body,t)}catch(t){if("return"!==t?.type)throw t}},n)}if("init"===i){try{await m(s.body,n)}catch(t){if("return"!==t?.type)throw t}return}const r=s.filter?await l(s.filter,n):e,o=r instanceof Element?r:e,a=s.modifiers;let h=async t=>{a.prevent&&t.preventDefault(),a.stop&&t.stopPropagation();const n={me:e,event:t,you:t.target instanceof Element?t.target:void 0,locals:new Map,globals:c};try{await m(s.body,n)}catch(t){if("return"===t?.type)return t.value;throw t}};if(a.debounce){let t;const e=h;h=async s=>{clearTimeout(t),t=setTimeout(()=>e(s),a.debounce)}}if(a.throttle){let t=0;const e=h;h=async s=>{const n=Date.now();a.throttle>n-t||(t=n,await e(s))}}return void o.addEventListener(i,h,{once:!!a.once})}return null}function w(t){const e=t.getAttribute("_");if(e)try{y(new a(e).parse(),t)}catch(t){console.error("HyperFixi Hybrid Complete error:",t,"Code:",e)}}function g(t=document){t.querySelectorAll("[_]").forEach(w)}const b={version:"1.0.0-hybrid-complete",parse:t=>new a(t).parse(),async execute(t,e){const s=e||document.body;return y(new a(t).parse(),s)},init:g,process:g,addAliases:function(t){Object.assign(n,t)},addEventAliases:function(t){Object.assign(i,t)},tokenize:s,evaluate:l,commands:["toggle","add","remove","put","append","set","get","call","log","send","trigger","wait","show","hide","transition","take","increment","decrement","focus","blur","go","return","halt"],blocks:["if","else","unless","repeat","for","while","fetch"]};"undefined"!=typeof window&&(window.hyperfixi=b,"loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>g()):g());let v={nameOf:(t,e,s)=>`${e}-${s}`,selectorFor:(t,e)=>`[${t}-${e}]`,eventNameOf:(t,e)=>e};function x(){return v}const E={innerHTML:"innerHTML",outerHTML:"outerHTML",beforebegin:"before",afterbegin:"start",beforeend:"end",afterend:"after",delete:"delete",none:"none",morph:"morph","morph:innerHTML":"innerHTML morph","morph:outerHTML":"morph"},$={click:"click",load:"init",revealed:"intersection",intersect:"intersection",submit:"submit",change:"change",input:"input",keyup:"keyup",keydown:"keydown",focus:"focus",blur:"blur",mouseenter:"mouseenter",mouseleave:"mouseleave"};function M(t){if("this"===t)return"me";const e=t.match(/^closest\s+(.+)$/);if(e)return`closest <${e[1]}/>`;const s=t.match(/^find\s+(.+)$/);if(s)return`first <${s[1]}/> in me`;const n=t.match(/^next\s+(.+)$/);if(n)return`next <${n[1]}/>`;const i=t.match(/^previous\s+(.+)$/);return i?`previous <${i[1]}/>`:t}function S(t,e){const s=[];if(t.hxLive&&s.push(`live\n ${t.hxLive}\nend`),!t.url)return s.join("\n");const n=[],i=t.trigger||function(t){const e=t.tagName.toLowerCase();if("form"===e)return"submit";if("input"===e||"textarea"===e||"select"===e){const e=t.getAttribute("type");return"submit"===e||"button"===e?"click":"change"}return"click"}(e),{event:r,modifiers:o}=function(t,e){const s=t.trim().split(/\s+/),n=s[0],i=s.slice(1),r=n.match(/^(\w+)\[(.+)\]$/);if(r){const t=e(r[1]);return{event:$[t]||t,modifiers:["filter: "+r[2],...i]}}const o=e(n);return{event:$[o]||o,modifiers:i}}(i,t=>x().eventNameOf(e,t)),a=function(t){const e=[];for(const s of t){const t=s.match(/^delay:(\d+)(ms|s)?$/);if(t){e.push(`.debounce(${t[1]}${"s"===(t[2]||"ms")?"000":""})`);continue}const n=s.match(/^throttle:(\d+)(ms|s)?$/);n?e.push(`.throttle(${n[1]}${"s"===(n[2]||"ms")?"000":""})`):"once"!==s||e.push(".once")}return e.join("")}(o);t.confirm&&n.push(`if not js window.confirm('${t.confirm.replace(/'/g,"\\'")}') return end`);const c=e.tagName.toLowerCase();"form"!==c&&"a"!==c||n.push("halt the event");let h=`fetch '${t.url}'`;t.method&&"GET"!==t.method&&(h+=" via "+t.method),"form"===c?h+=" with values of me":t.vals&&(h+=" with "+t.vals),h+=" as html",n.push(h);const l=function(t,e){const s=E[e]||e;return"none"===s?"":"delete"===s?"remove "+t:"before"===s?"put it before "+t:"after"===s?"put it after "+t:"start"===s?"put it at start of "+t:"end"===s?"put it at end of "+t:"morph"===s?`morph ${t} with it`:"innerHTML morph"===s?`morph innerHTML of ${t} with it`:"outerHTML"===s?`set ${t}'s outerHTML to it`:"put it into "+t}(t.target?M(t.target):"me",t.swap||"innerHTML");l&&n.push("then "+l),t.pushUrl?n.push(`then push url '${1==t.pushUrl?t.url:t.pushUrl}'`):t.replaceUrl&&n.push(`then replace url '${1==t.replaceUrl?t.url:t.replaceUrl}'`);const u=`on ${r}${a}\n ${n.join("\n ")}`;return s.push(u),s.join("\n")}function k(t){const e=t.attributes;for(let t=0;e.length>t;t++)if(e[t].name.startsWith("hx-"))return 1;return 0}function T(t){return t.hasAttribute("fx-action")}function H(t){return k(t)||T(t)}const A=new Set(["add","append","async","beep","blur","break","breakpoint","call","clear","close","continue","copy","decrement","default","empty","exit","fetch","focus","for","get","go","halt","hide","open","if","increment","install","js","log","make","measure","morph","pick","process","push","put","remove","render","repeat","replace","reset","return","scroll","select","send","set","settle","show","start","swap","take","tell","throw","toggle","transition","trigger","unless","wait"]),_=new Set(["==","!=","===","!==","<",">","<=",">=","is","is not","am","is a","is an","is not a","is not an","precedes","does not precede","follows","does not follow","contains","starts with","ends with","does not start with","does not end with","has","have","does not contain","include","includes","does not include","match","matches","exists","does not exist","is empty","is not empty","is in","is not in","is between","is not between","equals","in","is equal to","is really equal to","is not equal to","is not really equal to","is greater than","is less than","is greater than or equal to","is less than or equal to","really equals","ignoring case","sorted by","mapped to","split by","joined by"]);function C(t,e){return{infix:{bp:[t,t+1],handler:e??((e,s,n)=>{const i=n.parseExpr(t+1);return{type:"binaryExpression",operator:s.value,left:e,right:i,start:e.start,end:i.end??s.end,line:e.line??s.line,column:e.column??s.column}})}}}function L(t,e){return{infix:{bp:[t+1,t],handler:(e,s,n)=>{const i=n.parseExpr(t);return{type:"binaryExpression",operator:s.value,left:e,right:i,start:e.start,end:i.end??s.end,line:e.line??s.line,column:e.column??s.column}}}}}function O(t,e){return{prefix:{bp:t,handler:e??((e,s)=>{const n=s.parseExpr(t);return{type:"unaryExpression",operator:e.value,operand:n,argument:n,prefix:1,start:e.start,end:n.end??e.end,line:e.line,column:e.column}})}}}function F(t){return(e,s,n)=>{const i=n.advance();if(!i||!i.value)throw Error(`Type check requires a type name after 'is ${t?"not ":""}a/an', got: <end>`);let r=1;const o=n.peek();return o&&"!"===o.value&&(n.advance(),r=0),{type:"typeCheckExpression",value:e,typeName:i.value,nullOk:r,negated:t,start:e.start,end:i.end}}}const P=function(...t){const e=new Map;for(const s of t)for(const[t,n]of s){const s=e.get(t);e.set(t,s?{prefix:n.prefix??s.prefix,infix:n.infix??s.infix}:{...n})}return e}(new Map([["or",C(10)],["||",C(10)],["and",C(20)],["&&",C(20)],["==",C(30)],["!=",C(30)],["<",C(30)],[">",C(30)],["<=",C(30)],[">=",C(30)],["is",C(30)],["matches",C(30)],["contains",C(30)],["starts with",C(30)],["ends with",C(30)],["does not start with",C(30)],["does not end with",C(30)],["is between",C(30,(t,e,s)=>{const n=s.parseExpr(31),i=s.peek();if(!i||"and"!==i.value.toLowerCase())throw Error("between requires 'and' between min and max operands, got: "+(i?.value??"<end>"));s.advance();const r=s.parseExpr(31);return{type:"betweenExpression",value:t,min:n,max:r,negated:0,start:t.start,end:r.end}})],["is not between",C(30,(t,e,s)=>{const n=s.parseExpr(31),i=s.peek();if(!i||"and"!==i.value.toLowerCase())throw Error("between requires 'and' between min and max operands, got: "+(i?.value??"<end>"));s.advance();const r=s.parseExpr(31);return{type:"betweenExpression",value:t,min:n,max:r,negated:1,start:t.start,end:r.end}})],["ignoring case",{infix:{bp:[25,26],handler:(t,e,s)=>(t.ignoringCase=1,t)}}],["where",C(28,(t,e,s)=>{const n=s.parseExpr(29);return{type:"collectionExpression",operator:"where",collection:t,right:n,start:t.start,end:n.end}})],["sorted by",C(28,(t,e,s)=>{const n=s.parseExpr(29);let i="asc";const r=s.peek();if(r&&"string"==typeof r.value){const t=r.value.toLowerCase();"asc"===t||"ascending"===t?(s.advance(),i="asc"):"desc"!==t&&"descending"!==t||(s.advance(),i="desc")}return{type:"collectionExpression",operator:"sorted by",collection:t,right:n,order:i,start:t.start,end:n.end}})],["mapped to",C(28,(t,e,s)=>{const n=s.parseExpr(29);return{type:"collectionExpression",operator:"mapped to",collection:t,right:n,start:t.start,end:n.end}})],["split by",C(28,(t,e,s)=>{const n=s.parseExpr(29);return{type:"collectionExpression",operator:"split by",collection:t,right:n,start:t.start,end:n.end}})],["joined by",C(28,(t,e,s)=>{const n=s.parseExpr(29);return{type:"collectionExpression",operator:"joined by",collection:t,right:n,start:t.start,end:n.end}})],["+",{...C(40),...O(80)}],["-",{...C(40),...O(80)}],["*",C(50)],["/",C(50)],["%",C(50)],["mod",C(50)],["^",L(60)],["**",L(60)],["as",C(70,(t,e,s)=>{const n=s.parseExpr(71),i=s.peek();if(i&&":"===i.value&&n&&"identifier"===n.type){s.advance();const t=s.advance();t&&void 0!==t.value&&(n.name=`${n.name}:${t.value}`,n.end=t.end)}return{type:"asExpression",expression:t,targetType:n,start:t.start,end:n.end??e.end,line:t.line??e.line,column:t.column??e.column}})],["not",O(80)],["!",O(80)],["no",O(80)]]),new Map([["===",C(30)],["!==",C(30)],["is not",C(30)],["am",C(30)],["is in",C(30)],["is not in",C(30)],["precedes",C(30)],["does not precede",C(30)],["follows",C(30)],["does not follow",C(30)],["is a",C(30,F(0))],["is an",C(30,F(0))],["is not a",C(30,F(1))],["is not an",C(30,F(1))],["has",C(30)],["have",C(30)],["match",C(30)],["include",C(30)],["includes",C(30)],["equals",C(30)],["does not contain",C(30)],["does not include",C(30)],["is equal to",C(30)],["is not equal to",C(30)],["is really equal to",C(30)],["is not really equal to",C(30)],["really equals",C(30)],["is greater than",C(30)],["is less than",C(30)],["is greater than or equal to",C(30)],["is less than or equal to",C(30)],["in",C(30)],["of",C(30)],["really",C(30)],["exists",{prefix:{bp:80,handler:(t,e)=>({type:"unaryExpression",operator:t.value,operand:e.parseExpr(80),start:t.start})},infix:{bp:[30,31],handler:(t,e)=>({type:"unaryExpression",operator:e.value,operand:t,prefix:0,start:t.start})}}],["does not exist",{infix:{bp:[30,31],handler:(t,e)=>({type:"unaryExpression",operator:e.value,operand:t,prefix:0,start:t.start})}}],["is empty",{infix:{bp:[30,31],handler:(t,e)=>({type:"unaryExpression",operator:e.value,operand:t,prefix:0,start:t.start})}}],["is not empty",{infix:{bp:[30,31],handler:(t,e)=>({type:"unaryExpression",operator:e.value,operand:t,prefix:0,start:t.start})}}],["some",O(80)]]),new Map([["=",L(5)]])),q=new Map,j=new Map,W=new Map,R=new Set,D=new Set,I=new Set,G=new Set,N=new class{registerCommand(t){A.add(t.toLowerCase())}registerCompoundOperator(t){_.add(t.toLowerCase())}registerInfixOperator(t,e,s,n){const i=t.toLowerCase(),r=P.get(i);P.set(i,{...r??{},infix:{bp:[e,s],handler:n}})}registerPrefixOperator(t,e,s){const n=t.toLowerCase(),i=P.get(n);P.set(n,{...i??{},prefix:{bp:e,handler:s}})}hasCommand(t){return A.has(t.toLowerCase())}registerFeature(t,e){q.set(t.toLowerCase(),e)}hasFeature(t){return q.has(t.toLowerCase())}registerNodeEvaluator(t,e){j.set(t,e)}registerNodeWriter(t,e){W.set(t,e)}registerGlobalWriteHook(t){return R.add(t),()=>R.delete(t)}registerGlobalReadHook(t){return D.add(t),()=>D.delete(t)}registerLocalWriteHook(t){return I.add(t),()=>I.delete(t)}registerLocalReadHook(t){return G.add(t),()=>G.delete(t)}snapshot(){return{commands:Array.from(A),operators:Array.from(_),prattEntries:Array.from(P.entries()).map(([t,e])=>[t,{...e}]),features:Array.from(q.entries()),nodeEvaluators:Array.from(j.entries()),nodeWriters:Array.from(W.entries()),globalWriteHooks:Array.from(R),globalReadHooks:Array.from(D),localWriteHooks:Array.from(I),localReadHooks:Array.from(G)}}restore(t){A.clear();for(const e of t.commands)A.add(e);_.clear();for(const e of t.operators)_.add(e);P.clear();for(const[e,s]of t.prattEntries)P.set(e,s);q.clear();for(const[e,s]of t.features)q.set(e,s);j.clear();for(const[e,s]of t.nodeEvaluators)j.set(e,s);W.clear();for(const[e,s]of t.nodeWriters??[])W.set(e,s);R.clear();for(const e of t.globalWriteHooks)R.add(e);D.clear();for(const e of t.globalReadHooks??[])D.add(e);I.clear();for(const e of t.localWriteHooks??[])I.add(e);G.clear();for(const e of t.localReadHooks??[])G.add(e)}},z="__hyperfixi_parser_extension_registry__";class Z{constructor(t,e,s,n={}){this.element=t,this.url=e,this.swapHandler=s,this.source=null,this.listeners=new Map,this.destroyed=0,this.reconnectAttempts=0,this.reconnectTimer=null,this.maxAttempts=n.maxAttempts??5,this.baseBackoffMs=n.baseBackoffMs??1e3,this.maxBackoffMs=n.maxBackoffMs??3e4,this.debug=n.debug??0,this.EventSourceCtor=n.EventSourceCtor??("undefined"!=typeof EventSource?EventSource:null),this.EventSourceCtor?this.open():this.debug&&void 0!==console&&console.warn("[sse] EventSource is not available in this environment")}listenFor(t){if(this.destroyed)return;if(this.listeners.has(t))return;const e=t=>{this.swapHandler(t.type,t.data)};this.listeners.set(t,e),this.source&&this.source.addEventListener(t,e)}detach(){this.destroyed||(this.destroyed=1,null!==this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.closeSource(),this.dispatch("htmx:sseClose",{url:this.url}))}get readyState(){return this.source?.readyState??-1}open(){if(!this.destroyed){try{this.source=new this.EventSourceCtor(this.url)}catch(t){return this.dispatch("htmx:sseError",{url:this.url,error:t}),void this.scheduleReconnect()}this.source.onopen=()=>{this.reconnectAttempts=0,this.dispatch("htmx:sseOpen",{url:this.url})},this.source.onmessage=t=>{this.dispatch("htmx:sseMessage",{url:this.url,data:t.data})},this.source.onerror=t=>{this.dispatch("htmx:sseError",{url:this.url,event:t}),this.source&&2===this.source.readyState&&(this.closeSource(),this.scheduleReconnect())};for(const[t,e]of this.listeners)this.source.addEventListener(t,e)}}closeSource(){if(this.source){for(const[t,e]of this.listeners)try{this.source.removeEventListener(t,e)}catch{}this.source.onopen=null,this.source.onmessage=null,this.source.onerror=null;try{this.source.close()}catch{}this.source=null}}scheduleReconnect(){if(this.destroyed)return;if(this.reconnectAttempts>=this.maxAttempts)return this.debug&&void 0!==console&&console.warn(`[sse] giving up after ${this.maxAttempts} reconnect attempts to ${this.url}`),void this.detach();const t=Math.min(this.baseBackoffMs*Math.pow(2,this.reconnectAttempts),this.maxBackoffMs);this.reconnectAttempts++,this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.open()},t)}dispatch(t,e){if("undefined"!=typeof CustomEvent)try{const s=new CustomEvent(t,{detail:e,bubbles:1,cancelable:0});this.element.dispatchEvent(s)}catch{}}}class B{constructor(t,e,s,n={}){this.element=t,this.url=e,this.swapHandler=s,this.socket=null,this.destroyed=0,this.reconnectAttempts=0,this.reconnectTimer=null,this.outboundQueue=[],this.maxAttempts=n.maxAttempts??5,this.baseBackoffMs=n.baseBackoffMs??1e3,this.maxBackoffMs=n.maxBackoffMs??3e4,this.debug=n.debug??0,this.protocols=n.protocols,this.WSCtor=n.WSEventSourceCtor??("undefined"!=typeof WebSocket?WebSocket:null),this.WSCtor?this.open():this.debug&&void 0!==console&&console.warn("[ws] WebSocket is not available in this environment")}get readyState(){return this.socket?.readyState??-1}get isDestroyed(){return this.destroyed}send(t){if(this.destroyed)return;const e="string"==typeof t?t:JSON.stringify(t);this.socket&&1===this.socket.readyState?this.socket.send(e):this.outboundQueue.push(e)}detach(){this.destroyed||(this.destroyed=1,null!==this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.closeSocket(),this.dispatch("htmx:wsClose",{url:this.url,code:1e3,reason:"detached"}))}open(){if(!this.destroyed){try{this.socket=new this.WSCtor(this.url,this.protocols)}catch(t){return this.dispatch("htmx:wsError",{url:this.url,error:t}),void this.scheduleReconnect()}this.socket.onopen=()=>{if(this.reconnectAttempts=0,this.dispatch("htmx:wsOpen",{url:this.url}),this.outboundQueue.length&&this.socket){for(const t of this.outboundQueue)try{this.socket.send(t)}catch(t){this.dispatch("htmx:wsError",{url:this.url,error:t})}this.outboundQueue=[]}},this.socket.onmessage=t=>{const e="string"==typeof t.data?t.data:t.data+"",s=function(t){if(!t||"{"!==t[0])return null;let e;try{e=JSON.parse(t)}catch{return null}return"object"!=typeof e||null===e||"string"!=typeof e.target||"string"!=typeof e.data?null:{target:e.target,swap:"string"==typeof e.swap?e.swap:void 0,data:e.data}}(e);s?this.swapHandler(s,s.data):this.dispatch("htmx:wsMessage",{url:this.url,data:e})},this.socket.onerror=t=>{this.dispatch("htmx:wsError",{url:this.url,event:t})},this.socket.onclose=t=>{this.dispatch("htmx:wsClose",{url:this.url,code:t.code,reason:t.reason}),this.socket=null,this.destroyed||t.wasClean||this.scheduleReconnect()}}}closeSocket(){if(this.socket){this.socket.onopen=null,this.socket.onmessage=null,this.socket.onerror=null,this.socket.onclose=null;try{this.socket.close(1e3,"detached")}catch{}this.socket=null}}scheduleReconnect(){if(this.destroyed)return;if(this.reconnectAttempts>=this.maxAttempts)return this.debug&&void 0!==console&&console.warn(`[ws] giving up after ${this.maxAttempts} reconnect attempts to ${this.url}`),void this.detach();const t=Math.min(this.baseBackoffMs*Math.pow(2,this.reconnectAttempts),this.maxBackoffMs);this.reconnectAttempts++,this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.open()},t)}dispatch(t,e){if("undefined"!=typeof CustomEvent)try{const s=new CustomEvent(t,{detail:e,bubbles:1,cancelable:0});this.element.dispatchEvent(s)}catch{}}}function J(t){if("undefined"!=typeof HTMLFormElement&&t instanceof HTMLFormElement){const e=new FormData(t),s={};for(const[t,n]of e.entries())s[t]="string"==typeof n?n:n.name;return s}const e=t.getAttribute("name"),s=t.value;return e&&void 0!==s?{[e]:s+""}:{}}function V(t){return t?t.split(/[-_]/)[0].toLowerCase():"en"}function U(t){const e=t.getAttribute?.("data-hyperfixi-lang");if(e)return V(e);const s=t.closest?.("[data-hyperfixi-lang]");if(s)return V(s.getAttribute("data-hyperfixi-lang"));const n=t.closest?.("[lang]");return n?V(n.getAttribute("lang")):"en"}const K=new Map,Q=new Map,X=new Set;let Y=0;const tt=new Set;function et(){const t=new Set;for(const e of Q.values())for(const s of e.values())t.add(s);return[...t]}function st(t,e){const s=V(t),n=e?.hyperfixi??{};var i;K.set(s,n),Q.set(s,function(t){const e=new Map;if(!t)return e;for(const[s,n]of Object.entries(t))e.set(n,s);return e}(n.attrs)),X.delete(s),Y||(i={nameOf:(t,e,s)=>{const n=`${e}-${s}`,i=U(t);if("en"===i)return n;const r=Q.get(i)?.get(n);return r||(K.has(i)||X.has(i)||(X.add(i),void 0!==console&&console.warn(`[hyperfixi-i18n] No vocab registered for lang="${i}". Elements in this language scope fall back to English attribute names. Load packages/core/dist/i18n/htmx/${i}.js to opt in.`)),n)},selectorFor:(t,e)=>{const s=`${t}-${e}`,n=new Set([s]);for(const t of Q.values()){const e=t.get(s);e&&n.add(e)}return[...n].map(t=>`[${t}]`).join(", ")},eventNameOf:(t,e)=>{const s=U(t);return"en"===s?e:K.get(s)?.events?.[e]??e}},v=i,Y=1);for(const t of tt)t()}const nt="__hyperfixi_i18n";function it(){if("undefined"==typeof window)return;const t=window;t[nt]||(t[nt]={register:st})}function rt(t){for(const e of function(){const t=new Set(["hx-on:"]);for(const e of Q.values()){const s=e.get("hx-on");s&&t.add(s+":")}return[...t]}())if(t.startsWith(e))return t.slice(e.length);return null}it();const ot=["get","post","put","patch","delete","target","swap","trigger","confirm","boost","vals","headers","push-url","replace-url","on","live"].filter(t=>"on"!==t).map(t=>"hx-"+t).concat(["sse-swap","ws-send"]),at=["live"],ct=["fx-action","fx-method","fx-trigger","fx-target","fx-swap","fx-ignore"],ht=[...ot,...ct];function lt(t,e,s){return t.getAttribute(x().nameOf(t,e,s))}function ut(t,e,s){return t.hasAttribute(x().nameOf(t,e,s))}class ft{getSwapTemplate(t,e){const s=`${e.target??"me"}|${e.swap??"innerHTML"}`,n=this.swapTemplateCache.get(t);if(n&&n.sig===s)return n.build;const i=function(t){const e=t.swap??"innerHTML",s=M(t.target??"me");switch(e){case"outerHTML":return t=>`set ${s}'s outerHTML to ${t}`;case"beforebegin":return t=>`put ${t} before ${s}`;case"afterend":return t=>`put ${t} after ${s}`;case"afterbegin":return t=>`put ${t} at start of ${s}`;case"beforeend":return t=>`put ${t} at end of ${s}`;case"none":return()=>"";case"delete":return()=>"remove "+s;default:return t=>`put ${t} into ${s}`}}(e);return this.swapTemplateCache.set(t,{sig:s,build:i}),i}dispatchLifecycleEvent(t,e,s,n={}){const i=new CustomEvent(e,{detail:s,bubbles:n.bubbles??1,cancelable:n.cancelable??1}),r=t.dispatchEvent(i);return!r&&this.options.debug&&console.log(`[${n.debugPrefix??"htmx"}-compat] ${e} cancelled`),r}constructor(t={}){this.observer=null,this.processedElements=new WeakSet,this.executeCallback=null,this.pendingRequests=new WeakMap,this.sseConnections=new WeakMap,this.sseConnectionsSet=new Set,this.wsConnections=new WeakMap,this.wsConnectionsSet=new Set,this.wsSendListeners=new WeakMap,this.onHandlerListeners=new WeakMap,this.onHandlerElements=new Set,this.localizedAttrSet=new Set,this.unsubscribeVocab=null,this.swapTemplateCache=new WeakMap,this.options={processExisting:t.processExisting??1,watchMutations:t.watchMutations??1,debug:t.debug??0,root:t.root??("undefined"!=typeof document?document.body:null),requestDropping:t.requestDropping??1,fixiEvents:t.fixiEvents??1,eventSourceCtor:t.eventSourceCtor,wsEventSourceCtor:t.wsEventSourceCtor},this.eventSourceCtor=t.eventSourceCtor,this.wsEventSourceCtor=t.wsEventSourceCtor}init(t){this.executeCallback=t,this.options.processExisting&&this.options.root&&this.processSubtree(this.options.root),this.options.watchMutations&&"undefined"!=typeof MutationObserver&&this.options.root&&this.startObserver()}destroy(){this.unsubscribeVocab&&(this.unsubscribeVocab(),this.unsubscribeVocab=null),this.observer&&(this.observer.disconnect(),this.observer=null);for(const t of this.sseConnectionsSet)t.detach();this.sseConnectionsSet.clear();for(const t of this.wsConnectionsSet)t.detach();this.wsConnectionsSet.clear();for(const t of[...this.onHandlerElements])this.detachOnHandlers(t);this.executeCallback=null}attachSSE(t){const e=this.sseConnections.get(t);if(e)return e;const s=lt(t,"sse","connect");if(!s)return null;const n=new Z(t,s,(e,n)=>{const i={url:void 0,method:"GET",target:lt(t,"hx","target")??void 0,swap:lt(t,"hx","swap")??"innerHTML"},r=this.getSwapTemplate(t,i)(JSON.stringify(n));r&&(this.dispatchLifecycleEvent(t,"htmx:sseMessage",{url:s,event:e,data:n},{cancelable:0}),this.executeCallback&&this.executeCallback(r,t).catch(t=>{void 0!==console&&console.error("[sse-compat] swap execution failed:",t)}))},{EventSourceCtor:this.eventSourceCtor,debug:this.options.debug});this.sseConnections.set(t,n),this.sseConnectionsSet.add(n);const i=lt(t,"sse","swap");if(i)for(const t of i.split(",").map(t=>t.trim()).filter(Boolean))n.listenFor(t);return n}getSSEConnection(t){return this.sseConnections.get(t)??null}detachSSE(t){const e=this.sseConnections.get(t);e&&(e.detach(),this.sseConnections.delete(t),this.sseConnectionsSet.delete(e))}detachSSESubtree(t){if(this.detachSSE(t),"function"!=typeof t.querySelectorAll)return;const e=t.querySelectorAll(x().selectorFor("sse","connect"));for(const t of e)this.detachSSE(t)}attachWS(t){const e=this.wsConnections.get(t);if(e)return e;const s=lt(t,"ws","connect");if(!s)return null;const n=new B(t,s,(e,n)=>{const i={url:void 0,method:"GET",target:e.target,swap:e.swap??lt(t,"hx","swap")??"innerHTML"},r=this.getSwapTemplate(t,i)(JSON.stringify(e.data));r&&(this.dispatchLifecycleEvent(t,"htmx:wsMessage",{url:s,envelope:e,data:e.data},{cancelable:0}),this.executeCallback&&this.executeCallback(r,t).catch(t=>{void 0!==console&&console.error("[ws-compat] swap execution failed:",t)}))},{WSEventSourceCtor:this.wsEventSourceCtor,debug:this.options.debug});return this.wsConnections.set(t,n),this.wsConnectionsSet.add(n),this.wireWSSendDescendants(t,n),n}wireWSSendDescendants(t,e){if("function"!=typeof t.querySelectorAll)return;const s=x().selectorFor("ws","send"),n=[];t.matches?.(s)&&n.push(t);for(const e of t.querySelectorAll(s))n.push(e);for(const t of n){if(this.wsSendListeners.has(t))continue;const s="FORM"===t.tagName?"submit":"click",n=n=>{"submit"===s&&n.preventDefault();const i=J(t);e.send(i)};t.addEventListener(s,n),this.wsSendListeners.set(t,()=>t.removeEventListener(s,n))}}getWSConnection(t){return this.wsConnections.get(t)??null}detachWS(t){const e=this.wsConnections.get(t);if(e&&(e.detach(),this.wsConnections.delete(t),this.wsConnectionsSet.delete(e),"function"==typeof t.querySelectorAll)){const e=x().selectorFor("ws","send"),s=[];t.matches?.(e)&&s.push(t);for(const n of t.querySelectorAll(e))s.push(n);for(const t of s){const e=this.wsSendListeners.get(t);e&&(e(),this.wsSendListeners.delete(t))}}}detachWSSubtree(t){if(this.detachWS(t),"function"!=typeof t.querySelectorAll)return;const e=t.querySelectorAll(x().selectorFor("ws","connect"));for(const t of e)this.detachWS(t)}installOnHandlers(t,e){if(this.detachOnHandlers(t),!this.executeCallback)return;const s=this.executeCallback,n=new Map;for(const[i,r]of Object.entries(e)){const e=x().eventNameOf(t,i),o=e=>{s(r,t).catch(t=>{void 0!==console&&console.error(`[htmx-compat] hx-on:${i} execution failed:`,t)})};t.addEventListener(e,o),n.set(e,()=>t.removeEventListener(e,o))}this.onHandlerListeners.set(t,n),this.onHandlerElements.add(t)}detachOnHandlers(t){const e=this.onHandlerListeners.get(t);if(e){for(const t of e.values())t();this.onHandlerListeners.delete(t),this.onHandlerElements.delete(t)}}detachOnHandlersSubtree(t){for(const e of this.findHxOnElements(t))this.detachOnHandlers(e)}scanForHtmxElements(t){const e=t??this.options.root;if(!e)return[];if(e.closest?.("[fx-ignore]"))return[];const s=function(){const t=x(),e=[];for(const s of["get","post","put","patch","delete",...at])e.push(t.selectorFor("hx",s));return e.push(t.selectorFor("sse","connect")),e.push(t.selectorFor("ws","connect")),e.push("[fx-action]"),e.join(", ")}(),n=new Set(e.querySelectorAll(s));e.matches?.(s)&&n.add(e);for(const t of this.findHxOnElements(e))n.add(t);return Array.from(n).filter(t=>!t.closest("[fx-ignore]"))}findHxOnElements(t){const e=[],s=t=>{const s=t.attributes;for(let n=0;s.length>n;n++)if(null!==rt(s[n].name))return void e.push(t)};if(s(t),"function"==typeof t.querySelectorAll)for(const e of t.querySelectorAll("*"))s(e);return e}collectAttributes(t){const e={};for(const s of["get","post","put","patch","delete"]){const n=lt(t,"hx",s);if(n){e.method=s.toUpperCase(),e.url=n;break}}const s=lt(t,"hx","target");s&&(e.target=s);const n=lt(t,"hx","swap");n&&(e.swap=n);const i=lt(t,"hx","trigger");i&&(e.trigger=i);const r=lt(t,"hx","confirm");r&&(e.confirm=r),"true"===lt(t,"hx","boost")&&(e.boost=1);const o=lt(t,"hx","vals");o&&(e.vals=o);const a=lt(t,"hx","headers");a&&(e.headers=a);const c=lt(t,"hx","push-url");c&&(e.pushUrl="true"===c?1:c);const h=lt(t,"hx","replace-url");h&&(e.replaceUrl="true"===h?1:h);const l={};for(const e of t.attributes){const t=rt(e.name);null!==t&&(l[t]=e.value)}Object.keys(l).length>0&&(e.onHandlers=l);const u=lt(t,"hx","live");return u&&(e.hxLive=u),e}collectFxAttributes(t){const e={},s=t.getAttribute("fx-action");s&&(e.url=s);const n=t.getAttribute("fx-method");e.method=n?.toUpperCase()||"GET";const i=t.getAttribute("fx-target");i&&(e.target=i);const r=t.getAttribute("fx-swap");e.swap=r||"outerHTML";const o=t.getAttribute("fx-trigger");return o&&(e.trigger=o),e}isFxElement(t){return t.hasAttribute("fx-action")}processElement(t){if(this.processedElements.has(t))return;ut(t,"sse","connect")&&this.attachSSE(t),ut(t,"ws","connect")&&this.attachWS(t);const e=this.isFxElement(t),s=e?this.collectFxAttributes(t):this.collectAttributes(t),n=e?"fx":"htmx";if(s.onHandlers&&this.installOnHandlers(t,s.onHandlers),!s.url&&!s.boost&&!s.hxLive)return;if(s.hxLive&&!function(){if("undefined"!=typeof globalThis){const t=globalThis,e=t[z];if(e&&"object"==typeof e&&"function"==typeof e.registerFeature)return e;t[z]=N}return N}().hasFeature("live")&&(void 0!==console&&console.error(`[${n}-compat] hx-live requires @hyperfixi/reactivity to be installed. Install it via \`installPlugin(runtime, reactivityPlugin)\`, or use the hyperfixi-hx-v4 bundle which auto-installs it. Element:`,t),delete s.hxLive,!s.url&&!s.boost))return;if(e&&this.options.fixiEvents&&!this.dispatchLifecycleEvent(t,"fx:init",{element:t,options:{}},{debugPrefix:"fx"}))return;if(!this.dispatchLifecycleEvent(t,"htmx:configuring",{config:s,element:t},{debugPrefix:n}))return;if(e&&this.options.fixiEvents){const e={cfg:{trigger:s.trigger||"click",method:s.method||"GET",action:s.url,headers:{},target:s.target,swap:s.swap||"outerHTML",body:null,drop:this.pendingRequests.has(t)?1:0,transition:1,preventTrigger:1,signal:(new AbortController).signal},element:t};if(!this.dispatchLifecycleEvent(t,"fx:config",e,{debugPrefix:"fx"}))return}const i=S(s,t);if(this.options.debug&&console.log(`[${n}-compat] Translated:`,{element:t.tagName,config:s,hyperscript:i}),this.processedElements.add(t),this.executeCallback&&i){if(e&&this.options.requestDropping&&this.pendingRequests.has(t))return void(this.options.debug&&console.log("[fx-compat] Request dropped - pending request exists"));const r=new AbortController;if(e&&this.options.requestDropping&&this.pendingRequests.set(t,r),t.setAttribute(e?"data-fx-generated":"data-hx-generated",i),!this.dispatchLifecycleEvent(t,"htmx:beforeRequest",{element:t,url:s.url,method:s.method||"GET"},{debugPrefix:n}))return void this.pendingRequests.delete(t);if(e&&this.options.fixiEvents&&!this.dispatchLifecycleEvent(t,"fx:before",{element:t,url:s.url,method:s.method||"GET"},{debugPrefix:"fx"}))return void this.pendingRequests.delete(t);let o=1;this.executeCallback(i,t).then(()=>{e&&this.options.fixiEvents&&!this.dispatchLifecycleEvent(t,"fx:after",{cfg:{trigger:s.trigger||"click",method:s.method||"GET",action:s.url,headers:{},target:s.target,swap:s.swap||"outerHTML",body:null,drop:0,transition:1,preventTrigger:1,signal:r.signal,response:null,text:""},element:t},{debugPrefix:"fx"})||(this.dispatchLifecycleEvent(t,"htmx:afterSettle",{element:t,target:s.target},{cancelable:0}),e&&this.options.fixiEvents&&this.dispatchLifecycleEvent(t,"fx:swapped",{element:t,target:s.target},{cancelable:0,debugPrefix:"fx"}))}).catch(s=>{o=0,console.error(`[${n}-compat] Execution error:`,s);const i=s instanceof Error?s:Error(s+"");this.dispatchLifecycleEvent(t,"htmx:error",{element:t,error:i},{cancelable:0}),e&&this.options.fixiEvents&&this.dispatchLifecycleEvent(t,"fx:error",{element:t,error:i},{cancelable:0,debugPrefix:"fx"})}).finally(()=>{this.pendingRequests.delete(t),e&&this.options.fixiEvents&&this.dispatchLifecycleEvent(t,"fx:finally",{element:t,success:o},{cancelable:0,debugPrefix:"fx"}),e&&this.options.fixiEvents&&this.dispatchLifecycleEvent(t,"fx:inited",{element:t},{cancelable:0,bubbles:0,debugPrefix:"fx"})})}}processSubtree(t){const e=this.scanForHtmxElements(t);for(const t of e)this.processElement(t)}startObserver(){var t;this.observer=new MutationObserver(t=>{for(const e of t){for(const t of e.addedNodes)t instanceof Element&&this.processSubtree(t);for(const t of e.removedNodes)t instanceof Element&&(this.detachSSESubtree(t),this.detachWSSubtree(t),this.detachOnHandlersSubtree(t));if("attributes"===e.type&&e.target instanceof Element){const t=e.attributeName;null!=t&&(ht.includes(t)||null!==rt(t)||this.localizedAttrSet.has(t))&&(this.processedElements.delete(e.target),this.processElement(e.target))}}}),this.localizedAttrSet=new Set(et()),this.unsubscribeVocab=(tt.add(t=()=>this.refreshLocalizedAttrs()),()=>{tt.delete(t)}),this.options.root&&this.observer.observe(this.options.root,{childList:1,subtree:1,attributes:1,attributeFilter:this.computeAttributeFilter()})}computeAttributeFilter(){const t=et();return 0===t.length?ht:[...new Set([...ht,...t])]}refreshLocalizedAttrs(){this.localizedAttrSet=new Set(et()),this.observer&&this.options.root&&(this.observer.disconnect(),this.observer.observe(this.options.root,{childList:1,subtree:1,attributes:1,attributeFilter:this.computeAttributeFilter()}))}manualProcess(t){return S(this.isFxElement(t)?this.collectFxAttributes(t):this.collectAttributes(t),t)}hasPendingRequest(t){return this.pendingRequests.has(t)}abortPendingRequest(t){const e=this.pendingRequests.get(t);return e?(e.abort(),this.pendingRequests.delete(t),1):0}}it();let pt=null;function dt(t={}){const{processHyperscript:e=1,...s}=t;pt=new ft({processExisting:s.processExisting??1,watchMutations:s.watchMutations??1,debug:s.debug??0,root:s.root??document.body,requestDropping:s.requestDropping??1,fixiEvents:s.fixiEvents??1}),pt.init(async(t,e)=>{await b.execute(t,e)}),mt||"undefined"==typeof document||(mt=t=>{const e=t.detail,s=e?.elt??t.target;s&&"function"==typeof s.querySelector&&b.process(s)},document.addEventListener("htmx:load",mt),document.addEventListener("htmx:after:process",mt)),t.debug&&console.log("[hyperfixi-hx] htmx/fixi compatibility enabled")}let mt=null;function yt(){pt&&(pt.destroy(),pt=null),mt&&"undefined"!=typeof document&&(document.removeEventListener("htmx:load",mt),document.removeEventListener("htmx:after:process",mt),mt=null)}function wt(t){return new ft({processExisting:0,watchMutations:0}).manualProcess(t)}const gt={...b,version:"1.0.0-hybrid-hx",enableHtmxCompatibility:dt,disableHtmxCompatibility:yt,getHtmxProcessor:function(){return pt},translateHtmx:wt,hasHtmxAttributes:k,hasFxAttributes:T,hasAnyAttributes:H,HtmxAttributeProcessor:ft,translateToHyperscript:S,features:{htmx:1,fixi:1,hyperscript:1},htmxAttributes:ot,fixiAttributes:ct,fixiEvents:["fx:init","fx:inited","fx:config","fx:before","fx:after","fx:error","fx:finally","fx:swapped"]};if("undefined"!=typeof window){window.hyperfixi=gt,window.lokascript=gt;const t=()=>{dt({processExisting:1,watchMutations:1,processHyperscript:1,requestDropping:1,fixiEvents:1})};"loading"===document.readyState?document.addEventListener("DOMContentLoaded",t):t()}t.FIXI_ATTRS=ct,t.HTMX_ATTRS=ot,t.HtmxAttributeProcessor=ft,t.default=gt,t.disableHtmxCompatibility=yt,t.enableHtmxCompatibility=dt,t.hasAnyAttributes=H,t.hasFxAttributes=T,t.translateHtmx=wt,Object.defineProperty(t,"t",{value:1})}({});
|